Skip to content

Commit dd82eb4

Browse files
committed
update test cases for the staking and token test examples
1 parent 30aaa62 commit dd82eb4

File tree

3 files changed

+12
-18
lines changed

3 files changed

+12
-18
lines changed

packages/starship/__tests__/v0/token.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ describe('Token transfers', () => {
9090
const cosmosAddress = (await cosmosWallet.getAccounts())[0].address;
9191

9292
const ibcInfos = chainInfo.fetcher.getChainIbcData(
93-
chainInfo.chain.chain_id
93+
chainInfo.chain.chain_name
9494
);
9595
const ibcInfo = ibcInfos.find(
9696
(i) =>
97-
i.chain_1.chain_name === chainInfo.chain.chain_id &&
98-
i.chain_2.chain_name === cosmosChainInfo.chain.chain_id
97+
i.chain_1.chain_name === chainInfo.chain.chain_name &&
98+
i.chain_2.chain_name === cosmosChainInfo.chain.chain_name
9999
);
100100

101101
expect(ibcInfo).toBeTruthy();

packages/starship/__tests__/v1/staking.test.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { assertIsDeliverTxSuccess } from '@cosmjs/stargate';
22
import { DirectSecp256k1HdWallet } from '@cosmjs/proto-signing';
33

44
import { BigNumber } from 'bignumber.js';
5-
import { cosmos, getSigningCosmosTxRpc } from '../../src/codegen1';
5+
import { cosmos, getSigningOsmosisClient } from '../../src/codegen1';
66
import { useChain, generateMnemonic } from 'starshipjs';
77
import './setup.test';
88
import { MsgDelegate } from '../../src/codegen1/cosmos/staking/v1beta1/tx';
@@ -34,11 +34,6 @@ describe('Staking tokens testing', () => {
3434
});
3535
address1 = (await wallet1.getAccounts())[0].address;
3636

37-
msgClient1 = await cosmos.ClientFactory.createRPCMsgExtensions({
38-
rpcEndpoint: await getRpcEndpoint(),
39-
signer: wallet1
40-
});
41-
4237
// Create custom cosmos interchain client
4338
queryClient = await cosmos.ClientFactory.createRPCQueryClient({
4439
rpcEndpoint: await getRpcEndpoint()
@@ -77,6 +72,10 @@ describe('Staking tokens testing', () => {
7772
});
7873

7974
it('stake tokens to genesis validator', async () => {
75+
const signingClient = await getSigningOsmosisClient({
76+
rpcEndpoint: await getRpcEndpoint(),
77+
signer: wallet1
78+
});
8079
const { balance } = await queryClient.cosmos.bank.v1beta1.balance({
8180
address: address1,
8281
denom
@@ -105,12 +104,7 @@ describe('Staking tokens testing', () => {
105104
gas: '550000'
106105
};
107106

108-
const result = await msgClient1.cosmos.staking.v1beta1.delegate(
109-
address1,
110-
msg,
111-
fee
112-
);
113-
107+
const result = await signingClient.signAndBroadcast(address1, [msg], fee);
114108
assertIsDeliverTxSuccess(result);
115109
});
116110

packages/starship/__tests__/v1/token.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,12 @@ describe("Token transfers", () => {
110110
const cosmosAddress = (await cosmosWallet.getAccounts())[0].address;
111111

112112
const ibcInfos = chainInfo.fetcher.getChainIbcData(
113-
chainInfo.chain.chain_id
113+
chainInfo.chain.chain_name
114114
);
115115
const ibcInfo = ibcInfos.find(
116116
(i) =>
117-
i.chain_1.chain_name === chainInfo.chain.chain_id &&
118-
i.chain_2.chain_name === cosmosChainInfo.chain.chain_id
117+
i.chain_1.chain_name === chainInfo.chain.chain_name &&
118+
i.chain_2.chain_name === cosmosChainInfo.chain.chain_name
119119
);
120120

121121
expect(ibcInfo).toBeTruthy();

0 commit comments

Comments
 (0)