diff --git a/CHANGELOG.md b/CHANGELOG.md index f0134e9b..d8bf757a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,9 @@ and this project adheres to and key/value pairs are now supported. ([#1411]) - @cosmjs/stargate: Let `searchTx` return non-readonly array. The caller owns this array and can mutate it as they want. ([#1411]) +- @cosmjs/stargate: Remove `QueryClient.queryUnverified` and + `QueryClient.queryVerified`. Please use `QueryClient.queryAbci` and + `QueryClient.queryStoreVerified` instead. [#1409]: https://github.com/cosmos/cosmjs/issues/1409 [#1411]: https://github.com/cosmos/cosmjs/pull/1411 diff --git a/packages/stargate/src/queryclient/queryclient.spec.ts b/packages/stargate/src/queryclient/queryclient.spec.ts index 5a825b36..f179c096 100644 --- a/packages/stargate/src/queryclient/queryclient.spec.ts +++ b/packages/stargate/src/queryclient/queryclient.spec.ts @@ -92,83 +92,6 @@ describe("QueryClient", () => { }); }); - describe("queryUnverified", () => { - it("works via WebSockets", async () => { - pendingWithoutSimapp(); - const [client, tmClient] = await makeClient(simapp.tendermintUrlWs); - - const requestData = Uint8Array.from( - QueryAllBalancesRequest.encode({ address: unused.address }).finish(), - ); - const data = await client.queryUnverified(`/cosmos.bank.v1beta1.Query/AllBalances`, requestData); - const response = QueryAllBalancesResponse.decode(data); - expect(response.balances.length).toEqual(2); - - tmClient.disconnect(); - }); - - it("works via http", async () => { - pendingWithoutSimapp(); - const [client, tmClient] = await makeClient(simapp.tendermintUrlHttp); - - const requestData = Uint8Array.from( - QueryAllBalancesRequest.encode({ address: unused.address }).finish(), - ); - const data = await client.queryUnverified(`/cosmos.bank.v1beta1.Query/AllBalances`, requestData); - const response = QueryAllBalancesResponse.decode(data); - expect(response.balances.length).toEqual(2); - - tmClient.disconnect(); - }); - - it("works for height", async () => { - pendingWithoutSimapp(); - const [queryClient, tmClient] = await makeClient(simapp.tendermintUrlHttp); - - const joe = makeRandomAddress(); - const h1 = (await tmClient.status()).syncInfo.latestBlockHeight; - - // Send tokens to `recipient` - const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic); - const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrlHttp, - wallet, - defaultSigningClientOptions, - ); - const amount = coin(332211, simapp.denomFee); - await client.sendTokens(faucet.address0, joe, [amount], "auto"); - - const h2 = (await tmClient.status()).syncInfo.latestBlockHeight; - assert(h1 < h2); - - // Query with no height - { - const requestData = QueryBalanceRequest.encode({ address: joe, denom: simapp.denomFee }).finish(); - const data = await queryClient.queryUnverified(`/cosmos.bank.v1beta1.Query/Balance`, requestData); - const response = QueryBalanceResponse.decode(data); - expect(response.balance).toEqual(amount); - } - - // Query at h2 (after send) - { - const requestData = QueryBalanceRequest.encode({ address: joe, denom: simapp.denomFee }).finish(); - const data = await queryClient.queryUnverified(`/cosmos.bank.v1beta1.Query/Balance`, requestData, h2); - const response = QueryBalanceResponse.decode(data); - expect(response.balance).toEqual(amount); - } - - // Query at h1 (before send) - { - const requestData = QueryBalanceRequest.encode({ address: joe, denom: simapp.denomFee }).finish(); - const data = await queryClient.queryUnverified(`/cosmos.bank.v1beta1.Query/Balance`, requestData, h1); - const response = QueryBalanceResponse.decode(data); - expect(response.balance).toEqual({ amount: "0", denom: simapp.denomFee }); - } - - tmClient.disconnect(); - }); - }); - describe("queryAbci", () => { it("works via WebSockets", async () => { pendingWithoutSimapp(); diff --git a/packages/stargate/src/queryclient/queryclient.ts b/packages/stargate/src/queryclient/queryclient.ts index aaa000a9..fed504ec 100644 --- a/packages/stargate/src/queryclient/queryclient.ts +++ b/packages/stargate/src/queryclient/queryclient.ts @@ -512,18 +512,6 @@ export class QueryClient { this.tmClient = tmClient; } - /** - * @deprecated use queryStoreVerified instead - */ - public async queryVerified( - store: string, - queryKey: Uint8Array, - desiredHeight?: number, - ): Promise { - const { value } = await this.queryStoreVerified(store, queryKey, desiredHeight); - return value; - } - /** * Queries the database store with a proof, which is then verified. * @@ -608,20 +596,6 @@ export class QueryClient { }; } - /** - * Performs an ABCI query to Tendermint without requesting a proof. - * - * @deprecated use queryAbci instead - */ - public async queryUnverified( - path: string, - request: Uint8Array, - desiredHeight?: number, - ): Promise { - const response = await this.queryAbci(path, request, desiredHeight); - return response.value; - } - /** * Performs an ABCI query to Tendermint without requesting a proof. *