From 6d763bd06781547d84f4efac0ae1abb6ac81f88a Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Wed, 25 Oct 2023 14:58:33 +0200 Subject: [PATCH] Rename getTmClient -> getCometClient --- CHANGELOG.md | 8 ++++++-- packages/cosmwasm-stargate/src/cosmwasmclient.ts | 14 +++++++------- packages/stargate/src/stargateclient.ts | 14 +++++++------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe6d1d537c..9745c383a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,12 +22,16 @@ and this project adheres to `StargateClient.create` take a `CometClient` argument, adding support for `Comet38Client`. The auto-detection in `SigningStargateClient.connectWithSigner` and `StargateClient.connect` now - supports CometBFT 0.38. + supports CometBFT 0.38. Rename + `StargateClient.getTmClient`/`.forceGetTmClient` to + `.getCometClient`/`.forceGetCometClient`. - @cosmjs/cosmwasm-stargate: Let `SigningCosmWasmClient.createWithSigner` and `CosmWasmClient.create` take a `CometClient` argument, adding support for `Comet38Client`. The auto-detection in `SigningCosmWasmClient.connectWithSigner` and `CosmWasmClient.connect` now - supports CometBFT 0.38. + supports CometBFT 0.38. Rename + `CosmWasmClient.getTmClient`/`.forceGetTmClient` to + `.getCometClient`/`.forceGetCometClient`. [#1421]: https://github.com/cosmos/cosmjs/issues/1421 [#1484]: https://github.com/cosmos/cosmjs/pull/1484 diff --git a/packages/cosmwasm-stargate/src/cosmwasmclient.ts b/packages/cosmwasm-stargate/src/cosmwasmclient.ts index 7c35d797a6..c2e278712c 100644 --- a/packages/cosmwasm-stargate/src/cosmwasmclient.ts +++ b/packages/cosmwasm-stargate/src/cosmwasmclient.ts @@ -121,11 +121,11 @@ export class CosmWasmClient { } } - protected getTmClient(): CometClient | undefined { + protected getCometClient(): CometClient | undefined { return this.cometClient; } - protected forceGetTmClient(): CometClient { + protected forceGetCometClient(): CometClient { if (!this.cometClient) { throw new Error("Comet client not available. You cannot use online functionality in offline mode."); } @@ -147,7 +147,7 @@ export class CosmWasmClient { public async getChainId(): Promise { if (!this.chainId) { - const response = await this.forceGetTmClient().status(); + const response = await this.forceGetCometClient().status(); const chainId = response.nodeInfo.network; if (!chainId) throw new Error("Chain ID must not be empty"); this.chainId = chainId; @@ -157,7 +157,7 @@ export class CosmWasmClient { } public async getHeight(): Promise { - const status = await this.forceGetTmClient().status(); + const status = await this.forceGetCometClient().status(); return status.syncInfo.latestBlockHeight; } @@ -187,7 +187,7 @@ export class CosmWasmClient { } public async getBlock(height?: number): Promise { - const response = await this.forceGetTmClient().block(height); + const response = await this.forceGetCometClient().block(height); return { id: toHex(response.blockId.hash).toUpperCase(), header: { @@ -305,7 +305,7 @@ export class CosmWasmClient { * @returns Returns the hash of the transaction */ public async broadcastTxSync(tx: Uint8Array): Promise { - const broadcasted = await this.forceGetTmClient().broadcastTxSync({ tx }); + const broadcasted = await this.forceGetCometClient().broadcastTxSync({ tx }); if (broadcasted.code) { return Promise.reject( @@ -480,7 +480,7 @@ export class CosmWasmClient { } private async txsQuery(query: string): Promise { - const results = await this.forceGetTmClient().txSearchAll({ query: query }); + const results = await this.forceGetCometClient().txSearchAll({ query: query }); return results.txs.map((tx): IndexedTx => { const txMsgData = TxMsgData.decode(tx.result.data ?? new Uint8Array()); return { diff --git a/packages/stargate/src/stargateclient.ts b/packages/stargate/src/stargateclient.ts index 8022d2d5ad..f8a556b936 100644 --- a/packages/stargate/src/stargateclient.ts +++ b/packages/stargate/src/stargateclient.ts @@ -237,11 +237,11 @@ export class StargateClient { this.accountParser = accountParser; } - protected getTmClient(): CometClient | undefined { + protected getCometClient(): CometClient | undefined { return this.cometClient; } - protected forceGetTmClient(): CometClient { + protected forceGetCometClient(): CometClient { if (!this.cometClient) { throw new Error("Comet client not available. You cannot use online functionality in offline mode."); } @@ -267,7 +267,7 @@ export class StargateClient { public async getChainId(): Promise { if (!this.chainId) { - const response = await this.forceGetTmClient().status(); + const response = await this.forceGetCometClient().status(); const chainId = response.nodeInfo.network; if (!chainId) throw new Error("Chain ID must not be empty"); this.chainId = chainId; @@ -277,7 +277,7 @@ export class StargateClient { } public async getHeight(): Promise { - const status = await this.forceGetTmClient().status(); + const status = await this.forceGetCometClient().status(); return status.syncInfo.latestBlockHeight; } @@ -307,7 +307,7 @@ export class StargateClient { } public async getBlock(height?: number): Promise { - const response = await this.forceGetTmClient().block(height); + const response = await this.forceGetCometClient().block(height); return { id: toHex(response.blockId.hash).toUpperCase(), header: { @@ -473,7 +473,7 @@ export class StargateClient { * @returns Returns the hash of the transaction */ public async broadcastTxSync(tx: Uint8Array): Promise { - const broadcasted = await this.forceGetTmClient().broadcastTxSync({ tx }); + const broadcasted = await this.forceGetCometClient().broadcastTxSync({ tx }); if (broadcasted.code) { return Promise.reject( @@ -487,7 +487,7 @@ export class StargateClient { } private async txsQuery(query: string): Promise { - const results = await this.forceGetTmClient().txSearchAll({ query: query }); + const results = await this.forceGetCometClient().txSearchAll({ query: query }); return results.txs.map((tx): IndexedTx => { const txMsgData = TxMsgData.decode(tx.result.data ?? new Uint8Array()); return {