Specify Tendermint version explicitly in stargate
This commit is contained in:
parent
bfd9ebeeed
commit
dc8c58081c
@ -1,6 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import { encodePubkey } from "@cosmjs/proto-signing";
|
||||
import { Client as TendermintClient } from "@cosmjs/tendermint-rpc";
|
||||
import { adaptor34, Client as TendermintClient } from "@cosmjs/tendermint-rpc";
|
||||
import { assert } from "@cosmjs/utils";
|
||||
import Long from "long";
|
||||
|
||||
@ -12,7 +12,7 @@ import { QueryClient } from "./queryclient";
|
||||
const { Any } = google.protobuf;
|
||||
|
||||
async function makeClientWithAuth(rpcUrl: string): Promise<[QueryClient & AuthExtension, TendermintClient]> {
|
||||
const tmClient = await TendermintClient.connect(rpcUrl);
|
||||
const tmClient = await TendermintClient.connect(rpcUrl, adaptor34);
|
||||
return [QueryClient.withExtensions(tmClient, setupAuthExtension), tmClient];
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Client as TendermintClient } from "@cosmjs/tendermint-rpc";
|
||||
import { adaptor34, Client as TendermintClient } from "@cosmjs/tendermint-rpc";
|
||||
|
||||
import {
|
||||
nonExistentAddress,
|
||||
@ -11,7 +11,7 @@ import { BankExtension, setupBankExtension } from "./bank";
|
||||
import { QueryClient } from "./queryclient";
|
||||
|
||||
async function makeClientWithBank(rpcUrl: string): Promise<[QueryClient & BankExtension, TendermintClient]> {
|
||||
const tmClient = await TendermintClient.connect(rpcUrl);
|
||||
const tmClient = await TendermintClient.connect(rpcUrl, adaptor34);
|
||||
return [QueryClient.withExtensions(tmClient, setupBankExtension), tmClient];
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Client as TendermintClient } from "@cosmjs/tendermint-rpc";
|
||||
import { adaptor34, Client as TendermintClient } from "@cosmjs/tendermint-rpc";
|
||||
import Long from "long";
|
||||
|
||||
import { cosmos, ibc } from "../codec";
|
||||
@ -8,7 +8,7 @@ import * as ibcTest from "./ibctestdata.spec";
|
||||
import { QueryClient } from "./queryclient";
|
||||
|
||||
async function makeClientWithIbc(rpcUrl: string): Promise<[QueryClient & IbcExtension, TendermintClient]> {
|
||||
const tmClient = await TendermintClient.connect(rpcUrl);
|
||||
const tmClient = await TendermintClient.connect(rpcUrl, adaptor34);
|
||||
return [QueryClient.withExtensions(tmClient, setupIbcExtension), tmClient];
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import { toAscii } from "@cosmjs/encoding";
|
||||
import { Client as TendermintClient } from "@cosmjs/tendermint-rpc";
|
||||
import { adaptor34, Client as TendermintClient } from "@cosmjs/tendermint-rpc";
|
||||
|
||||
import { cosmos } from "../codec";
|
||||
import { nonNegativeIntegerMatcher, pendingWithoutSimapp, simapp, unused } from "../testutils.spec";
|
||||
@ -11,7 +11,7 @@ const { Coin } = cosmos.base.v1beta1;
|
||||
const { QueryAllBalancesRequest, QueryAllBalancesResponse } = cosmos.bank.v1beta1;
|
||||
|
||||
async function makeClient(rpcUrl: string): Promise<[QueryClient, TendermintClient]> {
|
||||
const tmClient = await TendermintClient.connect(rpcUrl);
|
||||
const tmClient = await TendermintClient.connect(rpcUrl, adaptor34);
|
||||
return [QueryClient.withExtensions(tmClient), tmClient];
|
||||
}
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ import {
|
||||
OfflineSigner,
|
||||
Registry,
|
||||
} from "@cosmjs/proto-signing";
|
||||
import { Client as TendermintClient } from "@cosmjs/tendermint-rpc";
|
||||
import { adaptor34, Client as TendermintClient } from "@cosmjs/tendermint-rpc";
|
||||
|
||||
import { cosmos } from "./codec";
|
||||
import { getMsgType } from "./encoding";
|
||||
@ -54,7 +54,7 @@ export class SigningStargateClient extends StargateClient {
|
||||
signer: OfflineSigner,
|
||||
options: SigningStargateClientOptions = {},
|
||||
): Promise<SigningStargateClient> {
|
||||
const tmClient = await TendermintClient.connect(endpoint);
|
||||
const tmClient = await TendermintClient.connect(endpoint, adaptor34);
|
||||
return new SigningStargateClient(tmClient, signer, options);
|
||||
}
|
||||
|
||||
|
||||
@ -13,7 +13,12 @@ import {
|
||||
} from "@cosmjs/launchpad";
|
||||
import { Uint53, Uint64 } from "@cosmjs/math";
|
||||
import { decodePubkey } from "@cosmjs/proto-signing";
|
||||
import { broadcastTxCommitSuccess, Client as TendermintClient, QueryString } from "@cosmjs/tendermint-rpc";
|
||||
import {
|
||||
adaptor34,
|
||||
broadcastTxCommitSuccess,
|
||||
Client as TendermintClient,
|
||||
QueryString,
|
||||
} from "@cosmjs/tendermint-rpc";
|
||||
import { assert, assertDefined } from "@cosmjs/utils";
|
||||
import Long from "long";
|
||||
|
||||
@ -121,7 +126,7 @@ export class StargateClient {
|
||||
private chainId: string | undefined;
|
||||
|
||||
public static async connect(endpoint: string): Promise<StargateClient> {
|
||||
const tmClient = await TendermintClient.connect(endpoint);
|
||||
const tmClient = await TendermintClient.connect(endpoint, adaptor34);
|
||||
return new StargateClient(tmClient);
|
||||
}
|
||||
|
||||
|
||||
@ -31,7 +31,6 @@ export const adaptor34 = v0_33; // With this alias we can swap out the implement
|
||||
const hashes = {
|
||||
v0_34: [
|
||||
"ca2c9df", // v0.34.0-rc6
|
||||
"", // See https://github.com/cosmos/cosmos-sdk/issues/7963
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@ import {
|
||||
assertNumber,
|
||||
assertObject,
|
||||
assertSet,
|
||||
assertString,
|
||||
Base64,
|
||||
Base64String,
|
||||
DateTime,
|
||||
@ -502,9 +503,7 @@ function decodeNodeInfo(data: RpcNodeInfo): responses.NodeInfo {
|
||||
id: fromHex(assertNotEmpty(data.id)),
|
||||
listenAddr: assertNotEmpty(data.listen_addr),
|
||||
network: assertNotEmpty(data.network),
|
||||
// TODO: Reactivate check when https://github.com/cosmos/cosmos-sdk/issues/7963 is resolved
|
||||
// version: assertNotEmpty(data.version),
|
||||
version: data.version,
|
||||
version: assertString(data.version), // Can be empty (https://github.com/cosmos/cosmos-sdk/issues/7963)
|
||||
channels: assertNotEmpty(data.channels),
|
||||
moniker: assertNotEmpty(data.moniker),
|
||||
other: dictionaryToStringMap(data.other),
|
||||
|
||||
@ -40,6 +40,20 @@ export function assertBoolean(value: boolean): boolean {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* A runtime checker that ensures a given value is a string.
|
||||
*
|
||||
* This is used when you want to verify that data at runtime matches the expected type.
|
||||
* This implies assertSet.
|
||||
*/
|
||||
export function assertString(value: string): string {
|
||||
assertSet(value);
|
||||
if (typeof (value as unknown) !== "string") {
|
||||
throw new Error("Value must be a string");
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* A runtime checker that ensures a given value is a number
|
||||
*
|
||||
|
||||
7
packages/tendermint-rpc/types/encodings.d.ts
vendored
7
packages/tendermint-rpc/types/encodings.d.ts
vendored
@ -17,6 +17,13 @@ export declare function assertSet<T>(value: T): T;
|
||||
* This implies assertSet.
|
||||
*/
|
||||
export declare function assertBoolean(value: boolean): boolean;
|
||||
/**
|
||||
* A runtime checker that ensures a given value is a string.
|
||||
*
|
||||
* This is used when you want to verify that data at runtime matches the expected type.
|
||||
* This implies assertSet.
|
||||
*/
|
||||
export declare function assertString(value: string): string;
|
||||
/**
|
||||
* A runtime checker that ensures a given value is a number
|
||||
*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user