diff --git a/package.json b/package.json index 29e42c31..d5898c53 100644 --- a/package.json +++ b/package.json @@ -85,4 +85,4 @@ "engines": { "node": ">=20.0" } -} \ No newline at end of file +} diff --git a/src/testcases/parallel/grpc_queries.test.ts b/src/testcases/parallel/grpc_queries.test.ts index b0b76182..0dfdb172 100644 --- a/src/testcases/parallel/grpc_queries.test.ts +++ b/src/testcases/parallel/grpc_queries.test.ts @@ -105,76 +105,92 @@ describe('Neutron / Grpc Queries', () => { }); }); - // TODO: this function does not make much sense: remove it - async function querySmart(query: any): Promise { - return await neutronClient.queryContractSmart(contractAddress, query); - } - describe('Grpc queries', () => { test('bank balance should work', async () => { - const res = await querySmart({ - bank_balance: { - address: neutronWallet.address, - denom: NEUTRON_DENOM, + const res = await neutronClient.queryContractSmart( + contractAddress, + { + bank_balance: { + address: neutronWallet.address, + denom: NEUTRON_DENOM, + }, }, - }); + ); expect(res.balance.denom).toBe('untrn'); expect(+res.balance.amount).toBeGreaterThan(1000000); }); test('bank denom metadata should work', async () => { - const res = await querySmart({ - bank_denom_metadata: { - denom: newTokenDenom, + const res = await neutronClient.queryContractSmart( + contractAddress, + { + bank_denom_metadata: { + denom: newTokenDenom, + }, }, - }); + ); expect(res.metadata.denom_units[0].denom).toBe(newTokenDenom); }); test('bank params should work', async () => { - const res = await querySmart({ - bank_params: {}, - }); + const res = await neutronClient.queryContractSmart( + contractAddress, + { + bank_params: {}, + }, + ); expect(res.params.default_send_enabled).toBe(true); }); test('bank supply of should work', async () => { - const res = await querySmart({ - bank_supply_of: { - denom: NEUTRON_DENOM, + const res = await neutronClient.queryContractSmart( + contractAddress, + { + bank_supply_of: { + denom: NEUTRON_DENOM, + }, }, - }); + ); expect(res.amount.denom).toBe('untrn'); expect(+res.amount.amount).toBeGreaterThan(1000000); }); // response with the field of type `Any` is expected, but actual type is a different struct test.skip('auth account should work', async () => { - const res = await querySmart({ - auth_account: { - address: neutronWallet.address, + const res = await neutronClient.queryContractSmart( + contractAddress, + { + auth_account: { + address: neutronWallet.address, + }, }, - }); + ); expect(res.account.address).toBe(neutronWallet.address); }); test('transfer denom trace should work', async () => { - const res = await querySmart({ - transfer_denom_trace: { - hash: 'ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2', + const res = await neutronClient.queryContractSmart( + contractAddress, + { + transfer_denom_trace: { + hash: 'ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2', + }, }, - }); + ); expect(res.denom_trace.path).toBe('transfer/channel-0'); expect(res.denom_trace.base_denom).toBe('uatom'); }); // response with the field of type `Any` is expected, but actual type is a different struct test.skip('ibc client state should work', async () => { - const res = await querySmart({ - ibc_client_state: { - client_id: '07-tendermint-1', + const res = await neutronClient.queryContractSmart( + contractAddress, + { + ibc_client_state: { + client_id: '07-tendermint-1', + }, }, - }); + ); expect(res.client_state['@type']).toBe( '/ibc.lightclients.tendermint.v1.ClientState', ); @@ -183,14 +199,17 @@ describe('Neutron / Grpc Queries', () => { // response with the field of type `Any` is expected, but actual type is a different struct test.skip('ibc consensus state should work', async () => { - const res = await querySmart({ - ibc_consensus_state: { - client_id: '07-tendermint-1', - revision_number: 0, - revision_height: 0, - latest_height: true, + const res = await neutronClient.queryContractSmart( + contractAddress, + { + ibc_consensus_state: { + client_id: '07-tendermint-1', + revision_number: 0, + revision_height: 0, + latest_height: true, + }, }, - }); + ); expect(res.consensus_state['@type']).toBe( '/ibc.lightclients.tendermint.v1.ConsensusState', ); @@ -198,59 +217,80 @@ describe('Neutron / Grpc Queries', () => { }); test('ibc connection should work', async () => { - const res = await querySmart({ - ibc_connection: { - connection_id: 'connection-0', + const res = await neutronClient.queryContractSmart( + contractAddress, + { + ibc_connection: { + connection_id: 'connection-0', + }, }, - }); + ); expect(res.connection.client_id).toBe('07-tendermint-1'); expect(+res.proof_height.revision_height).toBeGreaterThan(0); }); test('tokenfactory params should work', async () => { - const res = await querySmart({ - tokenfactory_params: {}, - }); + const res = await neutronClient.queryContractSmart( + contractAddress, + { + tokenfactory_params: {}, + }, + ); expect(res.params.denom_creation_gas_consume).toBe('0'); }); test('tokenfactory denom authority metadata should work', async () => { - const res = await querySmart({ - tokenfactory_denom_authority_metadata: { - creator: neutronWallet.address, - subdenom: newTokenDenom, + const res = await neutronClient.queryContractSmart( + contractAddress, + { + tokenfactory_denom_authority_metadata: { + creator: neutronWallet.address, + subdenom: newTokenDenom, + }, }, - }); + ); expect(res.authority_metadata.admin).toBe(''); }); test('tokenfactory denoms from creator should work', async () => { - const res = await querySmart({ - tokenfactory_denoms_from_creator: { - creator: neutronWallet.address, + const res = await neutronClient.queryContractSmart( + contractAddress, + { + tokenfactory_denoms_from_creator: { + creator: neutronWallet.address, + }, }, - }); + ); expect(res.denoms[0]).toBe(newTokenDenom); }); test('interchaintxs params should work', async () => { - const res = await querySmart({ - interchaintxs_params: {}, - }); + const res = await neutronClient.queryContractSmart( + contractAddress, + { + interchaintxs_params: {}, + }, + ); expect(+res.params.msg_submit_tx_max_messages).toBeGreaterThan(0); }); test('interchainqueries params should work', async () => { - const res = await querySmart({ - interchainqueries_params: {}, - }); + const res = await neutronClient.queryContractSmart( + contractAddress, + { + interchainqueries_params: {}, + }, + ); expect(+res.params.query_submit_timeout).toBeGreaterThan(0); }); test('feeburner params should work', async () => { - const res = await querySmart({ - feeburner_params: {}, - }); + const res = await neutronClient.queryContractSmart( + contractAddress, + { + feeburner_params: {}, + }, + ); expect(res.params.neutron_denom).toBe('untrn'); }); }); diff --git a/yarn.lock b/yarn.lock index c804633d..862ec492 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1302,15 +1302,10 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" -"@ledgerhq/errors@^5.50.0": - version "5.50.0" - resolved "https://registry.yarnpkg.com/@ledgerhq/errors/-/errors-5.50.0.tgz#e3a6834cb8c19346efca214c1af84ed28e69dad9" - integrity sha512-gu6aJ/BHuRlpU7kgVpy2vcYk6atjB4iauP2ymF7Gk0ez0Y/6VSMVSJvubeEQN+IV60+OBK0JgeIZG7OiHaw8ow== - -"@ledgerhq/logs@^5.50.0": - version "5.50.0" - resolved "https://registry.yarnpkg.com/@ledgerhq/logs/-/logs-5.50.0.tgz#29c6419e8379d496ab6d0426eadf3c4d100cd186" - integrity sha512-swKHYCOZUGyVt4ge0u8a7AwNcA//h4nx5wIi0sruGye1IJ5Cva0GyK9L2/WdX+kWVTKp92ZiEo1df31lrWGPgA== +"@neutron-org/cosmjs-types@0.9.2-rc1": + version "0.9.2-rc1" + resolved "https://registry.yarnpkg.com/@neutron-org/cosmjs-types/-/cosmjs-types-0.9.2-rc1.tgz#ca1fc1dc9566858dbd765e8f82c8a70097bcc84b" + integrity sha512-ju2AqJ14yO4+JF8RwY4ZVy7f2HVjhdf66SfhS6y4ucBZm997/E/yYVMnpWmUncVg8ARooISOKaOYNagqz0am6Q== "@neutron-org/neutronjs@4.2.0": version "4.2.0" @@ -1338,7 +1333,7 @@ dependencies: "@noble/hashes" "1.4.0" -"@noble/hashes@1.4.0", "@noble/hashes@^1", "@noble/hashes@^1.0.0", "@noble/hashes@^1.4.0", "@noble/hashes@~1.4.0": +"@noble/hashes@1.4.0", "@noble/hashes@^1", "@noble/hashes@^1.0.0", "@noble/hashes@^1.2.0", "@noble/hashes@^1.4.0", "@noble/hashes@~1.4.0": version "1.4.0" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.4.0.tgz#45814aa329f30e4fe0ba49426f49dfccdd066426" integrity sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg== @@ -1967,6 +1962,13 @@ bignumber.js@^9.0.1: resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.2.tgz#b7c4242259c008903b13707983b5f4bbd31eda0c" integrity sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug== +bip39@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/bip39/-/bip39-3.1.0.tgz#c55a418deaf48826a6ceb34ac55b3ee1577e18a3" + integrity sha512-c9kiwdk45Do5GL0vJMe7tS95VjCii65mYAH7DfWl3uW8AVzXKQVUm64i3hzVybBDMp9r7j9iNxR85+ul8MdN/A== + dependencies: + "@noble/hashes" "^1.2.0" + bn.js@4.11.6: version "4.11.6" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.6.tgz#53344adb14617a13f6e8dd2ce28905d1c0ba3215" @@ -3840,13 +3842,6 @@ run-parallel@^1.1.9: dependencies: queue-microtask "^1.2.2" -rxjs@6: - version "6.6.7" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.7.tgz#90ac018acabf491bf65044235d5863c4dab804c9" - integrity sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ== - dependencies: - tslib "^1.9.0" - rxjs@^7.5.5: version "7.8.1" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.1.tgz#6f6f3d99ea8044291efd92e7c7fcf562c4057543" @@ -3874,7 +3869,7 @@ semver@^6.3.1: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.3.5, semver@^7.3.7: +semver@^7.3.7: version "7.6.3" resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143" integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== @@ -4197,7 +4192,7 @@ ts-node@^9.1.1: source-map-support "^0.5.17" yn "3.1.1" -tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0: +tslib@^1.8.0, tslib@^1.8.1: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==