From cbcf854a98bae5ba044a09de57e73f458fbf2a88 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Wed, 11 Mar 2020 10:32:11 +0100 Subject: [PATCH] Rename to CosmWasmClient.getChainId --- packages/bcp/src/cosmwasmconnection.ts | 2 +- packages/sdk/src/cosmwasmclient.spec.ts | 10 +++++----- packages/sdk/src/cosmwasmclient.ts | 2 +- packages/sdk/src/signingcosmwasmclient.ts | 8 ++++---- packages/sdk/types/cosmwasmclient.d.ts | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/bcp/src/cosmwasmconnection.ts b/packages/bcp/src/cosmwasmconnection.ts index e872c9dc..841143db 100644 --- a/packages/bcp/src/cosmwasmconnection.ts +++ b/packages/bcp/src/cosmwasmconnection.ts @@ -94,7 +94,7 @@ export class CosmWasmConnection implements BlockchainConnection { } private static async initialize(cosmWasmClient: CosmWasmClient): Promise { - const rawChainId = await cosmWasmClient.chainId(); + const rawChainId = await cosmWasmClient.getChainId(); return Caip5.encode(rawChainId); } diff --git a/packages/sdk/src/cosmwasmclient.spec.ts b/packages/sdk/src/cosmwasmclient.spec.ts index 22e68a60..521335df 100644 --- a/packages/sdk/src/cosmwasmclient.spec.ts +++ b/packages/sdk/src/cosmwasmclient.spec.ts @@ -48,11 +48,11 @@ describe("CosmWasmClient", () => { }); }); - describe("chainId", () => { + describe("getChainId", () => { it("works", async () => { pendingWithoutWasmd(); const client = new CosmWasmClient(wasmdEndpoint); - expect(await client.chainId()).toEqual("testing"); + expect(await client.getChainId()).toEqual("testing"); }); }); @@ -152,7 +152,7 @@ describe("CosmWasmClient", () => { // header expect(response.header.height).toBeGreaterThanOrEqual(1); - expect(response.header.chainId).toEqual(await client.chainId()); + expect(response.header.chainId).toEqual(await client.getChainId()); expect(new ReadonlyDate(response.header.time).getTime()).toBeLessThan(ReadonlyDate.now()); expect(new ReadonlyDate(response.header.time).getTime()).toBeGreaterThanOrEqual( ReadonlyDate.now() - 5_000, @@ -173,7 +173,7 @@ describe("CosmWasmClient", () => { // header expect(response.header.height).toEqual(height - 1); - expect(response.header.chainId).toEqual(await client.chainId()); + expect(response.header.chainId).toEqual(await client.getChainId()); expect(new ReadonlyDate(response.header.time).getTime()).toBeLessThan(ReadonlyDate.now()); expect(new ReadonlyDate(response.header.time).getTime()).toBeGreaterThanOrEqual( ReadonlyDate.now() - 5_000, @@ -223,7 +223,7 @@ describe("CosmWasmClient", () => { gas: "890000", }; - const chainId = await client.chainId(); + const chainId = await client.getChainId(); const { accountNumber, sequence } = await client.getNonce(faucet.address); const signBytes = makeSignBytes([sendMsg], fee, chainId, memo, accountNumber, sequence); const signature = await pen.sign(signBytes); diff --git a/packages/sdk/src/cosmwasmclient.ts b/packages/sdk/src/cosmwasmclient.ts index 623ddd15..50d8aefa 100644 --- a/packages/sdk/src/cosmwasmclient.ts +++ b/packages/sdk/src/cosmwasmclient.ts @@ -153,7 +153,7 @@ export class CosmWasmClient { this.restClient = new RestClient(url, broadcastMode); } - public async chainId(): Promise { + public async getChainId(): Promise { const response = await this.restClient.nodeInfo(); return response.node_info.network; } diff --git a/packages/sdk/src/signingcosmwasmclient.ts b/packages/sdk/src/signingcosmwasmclient.ts index 2592c04a..44a80c73 100644 --- a/packages/sdk/src/signingcosmwasmclient.ts +++ b/packages/sdk/src/signingcosmwasmclient.ts @@ -144,7 +144,7 @@ export class SigningCosmWasmClient extends CosmWasmClient { }; const fee = this.fees.upload; const { accountNumber, sequence } = await this.getNonce(); - const chainId = await this.chainId(); + const chainId = await this.getChainId(); const signBytes = makeSignBytes([storeCodeMsg], fee, chainId, memo, accountNumber, sequence); const signature = await this.signCallback(signBytes); const signedTx = { @@ -189,7 +189,7 @@ export class SigningCosmWasmClient extends CosmWasmClient { }; const fee = this.fees.init; const { accountNumber, sequence } = await this.getNonce(); - const chainId = await this.chainId(); + const chainId = await this.getChainId(); const signBytes = makeSignBytes([instantiateMsg], fee, chainId, memo, accountNumber, sequence); const signature = await this.signCallback(signBytes); @@ -227,7 +227,7 @@ export class SigningCosmWasmClient extends CosmWasmClient { }; const fee = this.fees.exec; const { accountNumber, sequence } = await this.getNonce(); - const chainId = await this.chainId(); + const chainId = await this.getChainId(); const signBytes = makeSignBytes([executeMsg], fee, chainId, memo, accountNumber, sequence); const signature = await this.signCallback(signBytes); const signedTx = { @@ -261,7 +261,7 @@ export class SigningCosmWasmClient extends CosmWasmClient { }; const fee = this.fees.send; const { accountNumber, sequence } = await this.getNonce(); - const chainId = await this.chainId(); + const chainId = await this.getChainId(); const signBytes = makeSignBytes([sendMsg], fee, chainId, memo, accountNumber, sequence); const signature = await this.signCallback(signBytes); const signedTx = { diff --git a/packages/sdk/types/cosmwasmclient.d.ts b/packages/sdk/types/cosmwasmclient.d.ts index 8864fd7d..f3ed5ac2 100644 --- a/packages/sdk/types/cosmwasmclient.d.ts +++ b/packages/sdk/types/cosmwasmclient.d.ts @@ -113,7 +113,7 @@ export declare class CosmWasmClient { protected anyValidAddress: string | undefined; private readonly codesCache; constructor(url: string, broadcastMode?: BroadcastMode); - chainId(): Promise; + getChainId(): Promise; getHeight(): Promise; /** * Returns a 32 byte upper-case hex transaction hash (typically used as the transaction ID)