Skip to content

Commit

Permalink
Merge pull request #353 from neutron-org/feat/whitelist-escrow-addres…
Browse files Browse the repository at this point in the history
…s-ibc-query

feat: add transfer escrow address test #NTRN-392
  • Loading branch information
pr0n00gler authored Sep 18, 2024
2 parents 599607e + afc271f commit 20ba195
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/testcases/parallel/grpc_queries.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { SigningNeutronClient } from '../../helpers/signing_neutron_client';
import { defaultRegistryTypes, SigningStargateClient } from '@cosmjs/stargate';
import { Registry } from '@cosmjs/proto-signing';
import { MsgTransfer } from '@neutron-org/neutronjs/ibc/applications/transfer/v1/tx';
import { QueryClientImpl as IbcQueryClient } from '@neutron-org/neutronjs/ibc/applications/transfer/v1/query.rpc.Query';
import { MsgCreateDenom } from '@neutron-org/neutronjs/osmosis/tokenfactory/v1beta1/tx';
import { COSMOS_DENOM, NEUTRON_DENOM } from '../../helpers/constants';
import config from '../../config.json';
Expand All @@ -23,6 +24,8 @@ describe('Neutron / Grpc Queries', () => {

let newTokenDenom: string;

let ibcQuerier: IbcQueryClient;

beforeAll(async (suite: RunnerTestSuite) => {
testState = await LocalState.create(config, inject('mnemonics'), suite);

Expand All @@ -38,6 +41,9 @@ describe('Neutron / Grpc Queries', () => {
gaiaWallet.directwallet,
{ registry: new Registry(defaultRegistryTypes) },
);

const neutronRpcClient = await testState.neutronRpcClient();
ibcQuerier = new IbcQueryClient(neutronRpcClient);
});

describe('Prepare for queries', () => {
Expand Down Expand Up @@ -160,7 +166,21 @@ describe('Neutron / Grpc Queries', () => {
},
});
expect(res.denom_trace.path).toBe('transfer/channel-0');
expect(res.denom_trace.base_denom).toBe('uatom');
expect(res.denom_trace.base_denom).toBe(COSMOS_DENOM);
});

test('transfer escrow address should work', async () => {
const res = await neutronClient.queryContractSmart(contractAddress, {
transfer_escrow_address: {
port_id: 'transfer',
channel_id: 'channel-0',
},
});
const res2 = await ibcQuerier.escrowAddress({
portId: 'transfer',
channelId: 'channel-0',
});
expect(res2.escrowAddress).toBe(res.escrow_address);
});

// response with the field of type `Any` is expected, but actual type is a different struct
Expand Down

0 comments on commit 20ba195

Please sign in to comment.