From ad13e14f3d2f90a14ef1bb852d529f1403e91356 Mon Sep 17 00:00:00 2001 From: willclarktech Date: Thu, 25 Mar 2021 13:06:04 +0100 Subject: [PATCH] cosmwasm-stargate: Update fee table etc to match stargate --- packages/cosmwasm-stargate/src/index.ts | 6 +++++- .../src/signingcosmwasmclient.ts | 20 +++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/packages/cosmwasm-stargate/src/index.ts b/packages/cosmwasm-stargate/src/index.ts index 523a85c1..ab7e80ac 100644 --- a/packages/cosmwasm-stargate/src/index.ts +++ b/packages/cosmwasm-stargate/src/index.ts @@ -1,3 +1,7 @@ export { cosmWasmTypes } from "./aminotypes"; export { CosmWasmClient } from "./cosmwasmclient"; -export { SigningCosmWasmClient, SigningCosmWasmClientOptions } from "./signingcosmwasmclient"; +export { + defaultGasLimits, + SigningCosmWasmClient, + SigningCosmWasmClientOptions, +} from "./signingcosmwasmclient"; diff --git a/packages/cosmwasm-stargate/src/signingcosmwasmclient.ts b/packages/cosmwasm-stargate/src/signingcosmwasmclient.ts index 5162cf1c..26ea525c 100644 --- a/packages/cosmwasm-stargate/src/signingcosmwasmclient.ts +++ b/packages/cosmwasm-stargate/src/signingcosmwasmclient.ts @@ -2,7 +2,6 @@ import { encodeSecp256k1Pubkey, makeSignDoc as makeSignDocAmino } from "@cosmjs/amino"; import { ChangeAdminResult, - CosmWasmFeeTable, ExecuteResult, InstantiateOptions, InstantiateResult, @@ -30,6 +29,8 @@ import { buildFeeTable, Coin, CosmosFeeTable, + defaultGasLimits as defaultStargateGasLimits, + defaultGasPrice, defaultRegistryTypes, GasLimits, GasPrice, @@ -54,6 +55,18 @@ import { } from "./codec/x/wasm/internal/types/tx"; import { CosmWasmClient } from "./cosmwasmclient"; +/** + * These fees are used by the higher level methods of SigningCosmWasmClient + */ +export interface CosmWasmFeeTable extends CosmosFeeTable { + readonly upload: StdFee; + readonly init: StdFee; + readonly exec: StdFee; + readonly migrate: StdFee; + /** Paid when setting the contract admin to a new address or unsetting it */ + readonly changeAdmin: StdFee; +} + function prepareBuilder(builder: string | undefined): string { if (builder === undefined) { return ""; // normalization needed by backend @@ -63,13 +76,12 @@ function prepareBuilder(builder: string | undefined): string { } } -const defaultGasPrice = GasPrice.fromString("0.025ucosm"); -const defaultGasLimits: GasLimits = { +export const defaultGasLimits: GasLimits = { + ...defaultStargateGasLimits, upload: 1_500_000, init: 500_000, migrate: 200_000, exec: 200_000, - send: 80_000, changeAdmin: 80_000, };