Deprecate verified queries

This commit is contained in:
Simon Warta
2021-10-24 22:35:45 +02:00
parent 64fecab2e5
commit fbaf8d7068
6 changed files with 40 additions and 7 deletions
+11 -4
View File
@@ -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);
+5
View File
@@ -14,6 +14,11 @@ export interface AuthExtension {
* `typeUrl` and decode the `value` using its own type decoder.
*/
readonly account: (address: string) => Promise<Any | null>;
/**
* @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.
+4 -3
View File
@@ -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);
+5
View File
@@ -13,6 +13,11 @@ export interface BankExtension {
readonly allBalances: (address: string) => Promise<Coin[]>;
readonly totalSupply: () => Promise<Coin[]>;
readonly supplyOf: (denom: string) => Promise<Coin>;
/**
* @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<Coin | null>;
};
+5
View File
@@ -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<Account | null> {
const account = await this.forceGetQueryClient().auth.verified.account(searchAddress);
return account ? accountFromAny(account) : null;