import { BroadcastMode, BroadcastTxResult, Coin, CosmosFeeTable, GasLimits, GasPrice, logs, Msg, OfflineSigner, StdFee } from "@cosmjs/launchpad"; import { Account, CosmWasmClient, GetSequenceResult } 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; } export interface UploadMeta { /** * An URL to a .tar.gz archive of the source code of the contract, which can be used to reproducibly build the Wasm bytecode. * * @see https://github.com/CosmWasm/cosmwasm-verify */ readonly source?: string; /** * A docker image (including version) to reproducibly build the Wasm bytecode from the source code. * * @example ```cosmwasm/rust-optimizer:0.8.0``` * @see https://github.com/CosmWasm/cosmwasm-verify */ readonly builder?: string; } export interface UploadResult { /** Size of the original wasm code in bytes */ readonly originalSize: number; /** A hex encoded sha256 checksum of the original wasm code (that is stored on chain) */ readonly originalChecksum: string; /** Size of the compressed wasm code in bytes */ readonly compressedSize: number; /** A hex encoded sha256 checksum of the compressed wasm code (that stored in the transaction) */ readonly compressedChecksum: string; /** The ID of the code asigned by the chain */ readonly codeId: number; readonly logs: readonly logs.Log[]; /** Transaction hash (might be used as transaction ID). Guaranteed to be non-empty upper-case hex */ readonly transactionHash: string; } /** * The options of an .instantiate() call. * All properties are optional. */ export interface InstantiateOptions { readonly memo?: string; /** * The funds that are transferred from the sender to the newly created contract. * The funds are transferred as part of the message execution after the contract address is * created and before the instantiation message is executed by the contract. * * Only native tokens are supported. * * TODO: Rename to `funds` for consistency (https://github.com/cosmos/cosmjs/issues/806) */ readonly transferAmount?: readonly Coin[]; /** * A bech32 encoded address of an admin account. * Caution: an admin has the privilege to upgrade a contract. If this is not desired, do not set this value. */ readonly admin?: string; } export interface InstantiateResult { /** The address of the newly instantiated contract */ readonly contractAddress: string; readonly logs: readonly logs.Log[]; /** Transaction hash (might be used as transaction ID). Guaranteed to be non-empty upper-case hex */ readonly transactionHash: string; } /** * Result type of updateAdmin and clearAdmin */ 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; } 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; } 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; } export declare class SigningCosmWasmClient extends CosmWasmClient { readonly fees: CosmWasmFeeTable; readonly signerAddress: string; private readonly signer; /** * Creates a new client with signing capability to interact with a CosmWasm blockchain. This is the bigger brother of CosmWasmClient. * * This instance does a lot of caching. In order to benefit from that you should try to use one instance * for the lifetime of your application. When switching backends, a new instance must be created. * * @param apiUrl The URL of a Cosmos SDK light client daemon API (sometimes called REST server or REST API) * @param signerAddress The address that will sign transactions using this instance. The `signer` must be able to sign with this address. * @param signer An implementation of OfflineSigner which can provide signatures for transactions, potentially requiring user input. * @param gasPrice The price paid per unit of gas * @param gasLimits Custom overrides for gas limits related to specific transaction types * @param broadcastMode Defines at which point of the transaction processing the broadcastTx method returns */ constructor(apiUrl: string, signerAddress: string, signer: OfflineSigner, gasPrice?: GasPrice, gasLimits?: Partial>, broadcastMode?: BroadcastMode); getSequence(address?: string): Promise; getAccount(address?: string): Promise; /** Uploads code and returns a receipt, including the code ID */ upload(wasmCode: Uint8Array, meta?: UploadMeta, memo?: string): Promise; instantiate(codeId: number, msg: Record, label: string, options?: InstantiateOptions): Promise; updateAdmin(contractAddress: string, newAdmin: string, memo?: string): Promise; clearAdmin(contractAddress: string, memo?: string): Promise; migrate(contractAddress: string, codeId: number, migrateMsg: Record, memo?: string): Promise; execute(contractAddress: string, msg: Record, memo?: string, funds?: readonly Coin[]): Promise; sendTokens(recipientAddress: string, amount: readonly Coin[], memo?: string): Promise; /** * Gets account number and sequence from the API, creates a sign doc, * creates a single signature, assembles the signed transaction and broadcasts it. */ signAndBroadcast(msgs: readonly Msg[], fee: StdFee, memo?: string): Promise; }