diff --git a/packages/launchpad/src/gas.ts b/packages/launchpad/src/gas.ts index cc48d5c6..a888b94b 100644 --- a/packages/launchpad/src/gas.ts +++ b/packages/launchpad/src/gas.ts @@ -3,6 +3,8 @@ import { Decimal } from "@cosmjs/math"; import { coins } from "./coins"; import { StdFee } from "./types"; +export type FeeTable = Record; + export class GasPrice { public readonly amount: Decimal; public readonly denom: string; diff --git a/packages/launchpad/src/index.ts b/packages/launchpad/src/index.ts index c1b63346..49a0ea91 100644 --- a/packages/launchpad/src/index.ts +++ b/packages/launchpad/src/index.ts @@ -29,7 +29,7 @@ export { isSearchByTagsQuery, } from "./cosmosclient"; export { makeSignBytes } from "./encoding"; -export { buildFeeTable, GasPrice } from "./gas"; +export { buildFeeTable, FeeTable, GasLimits, GasPrice } from "./gas"; export { AuthAccountsResponse, AuthExtension, @@ -98,7 +98,7 @@ export { } from "./pubkey"; export { findSequenceForSignedTx } from "./sequence"; export { encodeSecp256k1Signature, decodeSignature } from "./signature"; -export { FeeTable, SigningCosmosClient } from "./signingcosmosclient"; +export { CosmosFeeTable, SigningCosmosClient } from "./signingcosmosclient"; export { isStdTx, pubkeyType, CosmosSdkTx, PubKey, StdFee, StdSignature, StdTx } from "./types"; export { AccountData, diff --git a/packages/launchpad/src/signingcosmosclient.ts b/packages/launchpad/src/signingcosmosclient.ts index 5cc229ba..5ffbd236 100644 --- a/packages/launchpad/src/signingcosmosclient.ts +++ b/packages/launchpad/src/signingcosmosclient.ts @@ -2,7 +2,7 @@ import { Coin } from "./coins"; import { Account, BroadcastTxResult, CosmosClient, GetSequenceResult } from "./cosmosclient"; import { makeSignBytes } from "./encoding"; -import { buildFeeTable, GasLimits, GasPrice } from "./gas"; +import { buildFeeTable, FeeTable, GasLimits, GasPrice } from "./gas"; import { BroadcastMode } from "./lcdapi"; import { Msg, MsgSend } from "./msgs"; import { StdFee, StdTx } from "./types"; @@ -11,23 +11,23 @@ import { OfflineSigner } from "./wallet"; /** * These fees are used by the higher level methods of SigningCosmosClient */ -export interface FeeTable extends Record { +export interface CosmosFeeTable extends FeeTable { readonly send: StdFee; } const defaultGasPrice = GasPrice.fromString("0.025ucosm"); -const defaultGasLimits: GasLimits = { send: 80000 }; +const defaultGasLimits: GasLimits = { send: 80000 }; /** Use for testing only */ export interface PrivateSigningCosmosClient { - readonly fees: FeeTable; + readonly fees: CosmosFeeTable; } export class SigningCosmosClient extends CosmosClient { public readonly senderAddress: string; private readonly signer: OfflineSigner; - private readonly fees: FeeTable; + private readonly fees: CosmosFeeTable; /** * Creates a new client with signing capability to interact with a Cosmos SDK blockchain. This is the bigger brother of CosmosClient. @@ -47,14 +47,14 @@ export class SigningCosmosClient extends CosmosClient { senderAddress: string, signer: OfflineSigner, gasPrice: GasPrice = defaultGasPrice, - gasLimits: Partial> = {}, + gasLimits: Partial> = {}, broadcastMode = BroadcastMode.Block, ) { super(apiUrl, broadcastMode); this.anyValidAddress = senderAddress; this.senderAddress = senderAddress; this.signer = signer; - this.fees = buildFeeTable(gasPrice, defaultGasLimits, gasLimits); + this.fees = buildFeeTable(gasPrice, defaultGasLimits, gasLimits); } public async getSequence(address?: string): Promise { diff --git a/packages/launchpad/types/gas.d.ts b/packages/launchpad/types/gas.d.ts index b20b96e2..8fccc2bc 100644 --- a/packages/launchpad/types/gas.d.ts +++ b/packages/launchpad/types/gas.d.ts @@ -1,5 +1,6 @@ import { Decimal } from "@cosmjs/math"; import { StdFee } from "./types"; +export declare type FeeTable = Record; export declare class GasPrice { readonly amount: Decimal; readonly denom: string; diff --git a/packages/launchpad/types/index.d.ts b/packages/launchpad/types/index.d.ts index 3f08cbbc..17332cf2 100644 --- a/packages/launchpad/types/index.d.ts +++ b/packages/launchpad/types/index.d.ts @@ -27,7 +27,7 @@ export { isSearchByTagsQuery, } from "./cosmosclient"; export { makeSignBytes } from "./encoding"; -export { buildFeeTable, GasPrice } from "./gas"; +export { buildFeeTable, FeeTable, GasLimits, GasPrice } from "./gas"; export { AuthAccountsResponse, AuthExtension, @@ -96,7 +96,7 @@ export { } from "./pubkey"; export { findSequenceForSignedTx } from "./sequence"; export { encodeSecp256k1Signature, decodeSignature } from "./signature"; -export { FeeTable, SigningCosmosClient } from "./signingcosmosclient"; +export { CosmosFeeTable, SigningCosmosClient } from "./signingcosmosclient"; export { isStdTx, pubkeyType, CosmosSdkTx, PubKey, StdFee, StdSignature, StdTx } from "./types"; export { AccountData, diff --git a/packages/launchpad/types/signingcosmosclient.d.ts b/packages/launchpad/types/signingcosmosclient.d.ts index c6a82eea..e1110ad9 100644 --- a/packages/launchpad/types/signingcosmosclient.d.ts +++ b/packages/launchpad/types/signingcosmosclient.d.ts @@ -1,6 +1,6 @@ import { Coin } from "./coins"; import { Account, BroadcastTxResult, CosmosClient, GetSequenceResult } from "./cosmosclient"; -import { GasLimits, GasPrice } from "./gas"; +import { FeeTable, GasLimits, GasPrice } from "./gas"; import { BroadcastMode } from "./lcdapi"; import { Msg } from "./msgs"; import { StdFee } from "./types"; @@ -8,12 +8,12 @@ import { OfflineSigner } from "./wallet"; /** * These fees are used by the higher level methods of SigningCosmosClient */ -export interface FeeTable extends Record { +export interface CosmosFeeTable extends FeeTable { readonly send: StdFee; } /** Use for testing only */ export interface PrivateSigningCosmosClient { - readonly fees: FeeTable; + readonly fees: CosmosFeeTable; } export declare class SigningCosmosClient extends CosmosClient { readonly senderAddress: string; @@ -37,7 +37,7 @@ export declare class SigningCosmosClient extends CosmosClient { senderAddress: string, signer: OfflineSigner, gasPrice?: GasPrice, - gasLimits?: Partial>, + gasLimits?: Partial>, broadcastMode?: BroadcastMode, ); getSequence(address?: string): Promise;