diff --git a/README.md b/README.md index dcedc1ef..8afa5175 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,16 @@ discussion please reach out to the team. ## Known limitations +### 0.26 + +1. When connecting to a Cosmos SDK 0.44+ backend, the verified queries from + `AuthExtension` and `BankExtension` as well as + `StargateClient.getAccountVerified` will fail because the storage keys are + not stable. Unverified queries can be used instead. Those queries are + deprecated now and will be removed in 0.27 ([#910]). + +[#910]: https://github.com/cosmos/cosmjs/pull/910 + ### 0.25 1. Decoding blocks of height 1 is unsupported. This is fixed in [#815] and will diff --git a/packages/stargate/src/queries/auth.spec.ts b/packages/stargate/src/queries/auth.spec.ts index b68ffc44..9ca9b454 100644 --- a/packages/stargate/src/queries/auth.spec.ts +++ b/packages/stargate/src/queries/auth.spec.ts @@ -6,7 +6,14 @@ import { BaseAccount } from "cosmjs-types/cosmos/auth/v1beta1/auth"; import { Any } from "cosmjs-types/google/protobuf/any"; import Long from "long"; -import { nonExistentAddress, pendingWithoutSimapp, simapp, unused, validator } from "../testutils.spec"; +import { + nonExistentAddress, + pendingWithoutSimapp, + pendingWithoutSimapp42, + simapp, + unused, + validator, +} from "../testutils.spec"; import { AuthExtension, setupAuthExtension } from "./auth"; import { QueryClient } from "./queryclient"; @@ -68,7 +75,7 @@ describe("AuthExtension", () => { describe("verified", () => { describe("account", () => { it("works for unused account", async () => { - pendingWithoutSimapp(); + pendingWithoutSimapp42(); // Not supported with 0.44, see "Known limitations" in README.md const [client, tmClient] = await makeClientWithAuth(simapp.tendermintUrl); const account = await client.auth.verified.account(unused.address); assert(account); @@ -85,7 +92,7 @@ describe("AuthExtension", () => { }); it("works for account with pubkey and non-zero sequence", async () => { - pendingWithoutSimapp(); + pendingWithoutSimapp42(); // Not supported with 0.44, see "Known limitations" in README.md const [client, tmClient] = await makeClientWithAuth(simapp.tendermintUrl); const account = await client.auth.verified.account(validator.delegatorAddress); assert(account); @@ -102,7 +109,7 @@ describe("AuthExtension", () => { }); it("returns null for non-existent address", async () => { - pendingWithoutSimapp(); + pendingWithoutSimapp42(); // Not supported with 0.44, see "Known limitations" in README.md const [client, tmClient] = await makeClientWithAuth(simapp.tendermintUrl); const account = await client.auth.verified.account(nonExistentAddress); diff --git a/packages/stargate/src/queries/auth.ts b/packages/stargate/src/queries/auth.ts index 0368b0dd..d27f62f4 100644 --- a/packages/stargate/src/queries/auth.ts +++ b/packages/stargate/src/queries/auth.ts @@ -14,6 +14,11 @@ export interface AuthExtension { * `typeUrl` and decode the `value` using its own type decoder. */ readonly account: (address: string) => Promise; + /** + * @deprecated Verified queries are not supported with Cosmos SDK 0.44+. + * See "Known limitations" in README.md. + * Will be rmoved in CosmJS 0.27 (https://github.com/cosmos/cosmjs/pull/910). + */ readonly verified: { /** * Returns an account if it exists and `null` otherwise. diff --git a/packages/stargate/src/queries/bank.spec.ts b/packages/stargate/src/queries/bank.spec.ts index e6fdc1c9..f6002e00 100644 --- a/packages/stargate/src/queries/bank.spec.ts +++ b/packages/stargate/src/queries/bank.spec.ts @@ -4,6 +4,7 @@ import { nonExistentAddress, nonNegativeIntegerMatcher, pendingWithoutSimapp, + pendingWithoutSimapp42, simapp, unused, } from "../testutils.spec"; @@ -147,7 +148,7 @@ describe("BankExtension", () => { describe("verified", () => { describe("balance", () => { it("works for different existing balances", async () => { - pendingWithoutSimapp(); + pendingWithoutSimapp42(); // Not supported with 0.44, see "Known limitations" in README.md const [client, tmClient] = await makeClientWithBank(simapp.tendermintUrl); const response1 = await client.bank.verified.balance(unused.address, simapp.denomFee); @@ -165,7 +166,7 @@ describe("BankExtension", () => { }); it("returns null for non-existent balance", async () => { - pendingWithoutSimapp(); + pendingWithoutSimapp42(); // Not supported with 0.44, see "Known limitations" in README.md const [client, tmClient] = await makeClientWithBank(simapp.tendermintUrl); const response = await client.bank.verified.balance(unused.address, "gintonic"); @@ -175,7 +176,7 @@ describe("BankExtension", () => { }); it("returns null for non-existent address", async () => { - pendingWithoutSimapp(); + pendingWithoutSimapp42(); // Not supported with 0.44, see "Known limitations" in README.md const [client, tmClient] = await makeClientWithBank(simapp.tendermintUrl); const response = await client.bank.verified.balance(nonExistentAddress, simapp.denomFee); diff --git a/packages/stargate/src/queries/bank.ts b/packages/stargate/src/queries/bank.ts index 5ed5d1a5..f1c747be 100644 --- a/packages/stargate/src/queries/bank.ts +++ b/packages/stargate/src/queries/bank.ts @@ -13,6 +13,11 @@ export interface BankExtension { readonly allBalances: (address: string) => Promise; readonly totalSupply: () => Promise; readonly supplyOf: (denom: string) => Promise; + /** + * @deprecated Verified queries are not supported with Cosmos SDK 0.44+. + * See "Known limitations" in README.md. + * Will be rmoved in CosmJS 0.27 (https://github.com/cosmos/cosmjs/pull/910). + */ readonly verified: { readonly balance: (address: string, denom: string) => Promise; }; diff --git a/packages/stargate/src/stargateclient.ts b/packages/stargate/src/stargateclient.ts index a0ac1e59..969a3bbc 100644 --- a/packages/stargate/src/stargateclient.ts +++ b/packages/stargate/src/stargateclient.ts @@ -218,6 +218,11 @@ export class StargateClient { } } + /** + * @deprecated Verified queries are not supported with Cosmos SDK 0.44+. + * See "Known limitations" in README.md. + * Will be rmoved in CosmJS 0.27 (https://github.com/cosmos/cosmjs/pull/910). + */ public async getAccountVerified(searchAddress: string): Promise { const account = await this.forceGetQueryClient().auth.verified.account(searchAddress); return account ? accountFromAny(account) : null;