cosmwasm-stargate: Update fee table etc to match stargate

This commit is contained in:
willclarktech 2021-03-25 13:06:04 +01:00
parent 81793aea31
commit ad13e14f3d
No known key found for this signature in database
GPG Key ID: 551A86E2E398ADF7
2 changed files with 21 additions and 5 deletions

View File

@ -1,3 +1,7 @@
export { cosmWasmTypes } from "./aminotypes";
export { CosmWasmClient } from "./cosmwasmclient";
export { SigningCosmWasmClient, SigningCosmWasmClientOptions } from "./signingcosmwasmclient";
export {
defaultGasLimits,
SigningCosmWasmClient,
SigningCosmWasmClientOptions,
} from "./signingcosmwasmclient";

View File

@ -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<CosmWasmFeeTable> = {
export const defaultGasLimits: GasLimits<CosmWasmFeeTable> = {
...defaultStargateGasLimits,
upload: 1_500_000,
init: 500_000,
migrate: 200_000,
exec: 200_000,
send: 80_000,
changeAdmin: 80_000,
};