|
1 | | -import path from "path"; |
| 1 | +// @ts-nocheck |
| 2 | +import path from 'path'; |
2 | 3 |
|
3 | | -import { SigningClient } from "@interchainjs/cosmos/signing-client"; |
4 | | -import { DirectGenericOfflineSigner } from "@interchainjs/cosmos/types/wallet"; |
5 | | -import { Secp256k1HDWallet } from "@interchainjs/cosmos/wallets/secp256k1hd"; |
6 | | -import { |
7 | | - ConfigContext, |
8 | | - generateMnemonic, |
9 | | - useChain, |
10 | | - useRegistry, |
11 | | -} from "starshipjs"; |
| 4 | +import { StargateClient } from '@cosmjs/stargate'; |
| 5 | + |
| 6 | +import { ConfigContext, useChain, useRegistry } from 'starshipjs'; |
12 | 7 |
|
13 | 8 | beforeAll(async () => { |
14 | | - const configFile = path.join(__dirname, "..", "configs", "local.yaml"); |
| 9 | + const configFile = path.join(__dirname, '..', 'configs', 'local.yaml'); |
15 | 10 | ConfigContext.setConfigFile(configFile); |
16 | 11 | ConfigContext.setRegistry(await useRegistry(configFile)); |
17 | 12 | }); |
18 | 13 |
|
19 | | -describe("Test clients", () => { |
20 | | - let client: SigningClient; |
| 14 | +describe('Test clients', () => { |
| 15 | + let client; |
21 | 16 |
|
22 | 17 | beforeAll(async () => { |
23 | | - const { getRpcEndpoint, chainInfo } = useChain("hyperweb"); |
24 | | - |
25 | | - const commonPrefix = chainInfo?.chain?.bech32_prefix; |
26 | | - const cosmosHdPath = "m/44'/118'/0'/0/0"; |
27 | | - |
28 | | - const directWallet = Secp256k1HDWallet.fromMnemonic(generateMnemonic(), [ |
29 | | - { |
30 | | - prefix: commonPrefix, |
31 | | - hdPath: cosmosHdPath, |
32 | | - }, |
33 | | - ]); |
34 | | - const directSigner = directWallet.toOfflineDirectSigner(); |
35 | | - |
36 | | - client = await SigningClient.connectWithSigner( |
37 | | - await getRpcEndpoint(), |
38 | | - new DirectGenericOfflineSigner(directSigner), |
39 | | - { |
40 | | - signerOptions: { |
41 | | - prefix: commonPrefix, |
42 | | - }, |
43 | | - } |
44 | | - ); |
| 18 | + const { getRpcEndpoint } = useChain('hyperweb'); |
| 19 | + client = await StargateClient.connect(await getRpcEndpoint()); |
45 | 20 | }); |
46 | 21 |
|
47 | | - it("check chain height", async () => { |
48 | | - const { header } = await client.getBlock(1); |
| 22 | + it('check chain height', async () => { |
| 23 | + const height = await client.getHeight(); |
49 | 24 |
|
50 | | - expect(header.height).toBeGreaterThan(0); |
| 25 | + expect(height).toBeGreaterThan(0); |
51 | 26 | }); |
52 | 27 | }); |
0 commit comments