Generic agent for CosmWasm-enabled chains.

Hierarchy

Constructors

Properties

Bundle: BundleClass<Bundle> = ...

The Bundle subclass to use.

address?: string

The address from which transactions are signed and sent.

api?: SigningCosmWasmClient

Signing API handle.

bech32Prefix?: string

The bech32 prefix for the account's address

chain?: Chain

The chain on which this agent operates.

coinType?: number

The coin type in the HD derivation path

fees?: AgentFees

Default fee maximums for send, upload, init, and execute.

hdAccountIndex?: number

The account index in the HD derivation path

log: Console = ...
mnemonic?: string

The wallet's mnemonic.

name?: string

The friendly name of the agent.

publicKey?: Uint8Array

Public key corresponding to private key derived from mnemonic.

signer: OfflineSigner

The provided signer, which signs the transactions. TODO: Implement signing transactions without external signer.

The default Bundle class used by this Agent.

Accessors

  • get balance(): Promise<string>
  • This agent's balance in the chain's native token.

    Returns Promise<string>

  • get defaultDenom(): string
  • The default denomination in which the agent operates.

    Returns string

  • get height(): Promise<number>
  • The chain's current block height.

    Returns Promise<number>

  • get nextBlock(): Promise<number>
  • Wait until the block height increments.

    Returns Promise<number>

  • get ready(): Promise<this & {
        api: SigningCosmWasmClient;
    }>
  • Async initialization. Populates the api property.

    Returns Promise<this & {
        api: SigningCosmWasmClient;
    }>

Methods

  • Check the code hash of a contract at an address against an expected value.

    Parameters

    • address: string
    • Optional codeHash: string

    Returns Promise<string>

  • Query native token balance.

    Parameters

    • Optional denom: string
    • Optional address: string

    Returns Promise<string>

  • Get a client instance for talking to a specific smart contract as this executor.

    Type Parameters

    Parameters

    • $C: ClientClass<C>
    • Optional address: string
    • Optional codeHash: string
    • Rest ...args: unknown[]

    Returns C

  • Get the code hash of a contract or template.

    Parameters

    • address: string | number

    Returns Promise<string>

  • Create multiple smart contracts from a Template (providing code id) and a list or map of label/initmsg pairs. Uses this agent's Bundle class to instantiate them in a single transaction.

    Type Parameters

    Parameters

    • instances: C

    Returns Promise<C>

    either an Array or a Record<string, AnyContract>, depending on what is passed as inputs.

    Example

    await agent.instantiateMany(template.instances({
    One: { label, initMsg },
    Two: { label, initMsg },
    }))
    await agent.instantiateMany({
    One: template1.instance({ label, initMsg }),
    Two: template2.instance({ label, initMsg }),
    }))

Generated using TypeDoc