From 6db399a3404c1d42776666153d9b1a8d47dc1961 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Mon, 31 Jan 2022 09:58:49 +0100 Subject: [PATCH] Add gasWanted/gasUsed values to all result types of SigningCosmWasmClient --- .../src/signingcosmwasmclient.ts | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/packages/cosmwasm-stargate/src/signingcosmwasmclient.ts b/packages/cosmwasm-stargate/src/signingcosmwasmclient.ts index 05a0e543..37cbfdc6 100644 --- a/packages/cosmwasm-stargate/src/signingcosmwasmclient.ts +++ b/packages/cosmwasm-stargate/src/signingcosmwasmclient.ts @@ -71,6 +71,8 @@ export interface UploadResult { readonly logs: readonly logs.Log[]; /** Transaction hash (might be used as transaction ID). Guaranteed to be non-empty upper-case hex */ readonly transactionHash: string; + readonly gasWanted: number; + readonly gasUsed: number; } /** @@ -100,6 +102,8 @@ export interface InstantiateResult { readonly logs: readonly logs.Log[]; /** Transaction hash (might be used as transaction ID). Guaranteed to be non-empty upper-case hex */ readonly transactionHash: string; + readonly gasWanted: number; + readonly gasUsed: number; } /** @@ -109,18 +113,24 @@ export interface ChangeAdminResult { readonly logs: readonly logs.Log[]; /** Transaction hash (might be used as transaction ID). Guaranteed to be non-empty upper-case hex */ readonly transactionHash: string; + readonly gasWanted: number; + readonly gasUsed: number; } export interface MigrateResult { readonly logs: readonly logs.Log[]; /** Transaction hash (might be used as transaction ID). Guaranteed to be non-empty upper-case hex */ readonly transactionHash: string; + readonly gasWanted: number; + readonly gasUsed: number; } export interface ExecuteResult { readonly logs: readonly logs.Log[]; /** Transaction hash (might be used as transaction ID). Guaranteed to be non-empty upper-case hex */ readonly transactionHash: string; + readonly gasWanted: number; + readonly gasUsed: number; } function createDeliverTxResponseErrorMessage(result: DeliverTxResponse): string { @@ -250,6 +260,8 @@ export class SigningCosmWasmClient extends CosmWasmClient { codeId: Number.parseInt(codeIdAttr.value, 10), logs: parsedLogs, transactionHash: result.transactionHash, + gasWanted: result.gasWanted, + gasUsed: result.gasUsed, }; } @@ -282,6 +294,8 @@ export class SigningCosmWasmClient extends CosmWasmClient { contractAddress: contractAddressAttr.value, logs: parsedLogs, transactionHash: result.transactionHash, + gasWanted: result.gasWanted, + gasUsed: result.gasUsed, }; } @@ -307,6 +321,8 @@ export class SigningCosmWasmClient extends CosmWasmClient { return { logs: logs.parseRawLog(result.rawLog), transactionHash: result.transactionHash, + gasWanted: result.gasWanted, + gasUsed: result.gasUsed, }; } @@ -330,6 +346,8 @@ export class SigningCosmWasmClient extends CosmWasmClient { return { logs: logs.parseRawLog(result.rawLog), transactionHash: result.transactionHash, + gasWanted: result.gasWanted, + gasUsed: result.gasUsed, }; } @@ -357,6 +375,8 @@ export class SigningCosmWasmClient extends CosmWasmClient { return { logs: logs.parseRawLog(result.rawLog), transactionHash: result.transactionHash, + gasWanted: result.gasWanted, + gasUsed: result.gasUsed, }; } @@ -384,6 +404,8 @@ export class SigningCosmWasmClient extends CosmWasmClient { return { logs: logs.parseRawLog(result.rawLog), transactionHash: result.transactionHash, + gasWanted: result.gasWanted, + gasUsed: result.gasUsed, }; }