Generic agent for CosmWasm-enabled chains.

Hierarchy (view full)

Constructors

Properties

alive: boolean = true

Setting this to false stops retries.

API connects asynchronously, so API handle is a promise of either variant.

bech32Prefix?: string

The bech32 prefix for the account's address

blockInterval: number = 250

Time to ping for next block.

chainId?: string

Chain ID.

coinType?: number

The coin type in the HD derivation path

fees?: {
    exec?: IFee;
    init?: IFee;
    send?: IFee;
    upload?: IFee;
}

Default transaction fees.

Type declaration

  • Optional exec?: IFee
  • Optional init?: IFee
  • Optional send?: IFee
  • Optional upload?: IFee
hdAccountIndex?: number

The account index in the HD derivation path

A supported method of authentication.

url?: string

Connection URL.

gasToken: Native = ...

Native token of chain.

Accessors

  • get [toStringTag](): string
  • Returns string

  • get address(): string
  • Returns string

  • get balance(): Promise<unknown>
  • Returns Promise<unknown>

  • get defaultDenom(): string
  • Returns string

  • get height(): Promise<number>
  • Returns Promise<number>

  • get nextBlock(): Promise<number>
  • Wait for the block height to increment.

    Returns Promise<number>

Methods

  • Call a transaction method of a contract.

    Parameters

    • contract: {
          address: string;
      }
      • address: string
    • message: Message
    • __namedParameters: Omit<{
          execFee?: IFee;
          execMemo?: string;
          execSend?: ICoin[];
      }, "execFee"> & {
          execFee?: number | IFee | "auto";
      } = {}

    Returns Promise<unknown>

  • Stargate implementation of querying a smart contract.

    Type Parameters

    • U

    Parameters

    • contract: string | {
          address: string;
      }
    • message: Message

    Returns Promise<U>

  • Call a given program's transaction method.

    Parameters

    • contract: string | Partial<ContractInstance>
    • message: Message
    • Optional options: {
          execFee?: IFee;
          execMemo?: string;
          execSend?: ICoin[];
      }
      • Optional execFee?: IFee
      • Optional execMemo?: string
      • Optional execSend?: ICoin[]

    Returns Promise<unknown>

  • Get the balance in a given native token, of either this connection's identity's address, or of another given address.

    Parameters

    • token: string
    • Optional address: string | {
          address: string;
      }

    Returns Promise<unknown>

  • Get the balance in a native token of a given address, either in this connection's gas token, or in another given token.

    Parameters

    • address: string | {
          address: string;
      }
    • Optional token: string

    Returns Promise<unknown>

  • Get the code hash of a given address.

    Parameters

    • contract: string | {
          address: string;
      }

    Returns Promise<string>

  • Get the code hash of a given code id.

    Parameters

    • contract: string | {
          codeId: string;
      }

    Returns Promise<string>

  • Get the code id of a given address.

    Parameters

    • contract: string | {
          address: string;
      }

    Returns Promise<string>

  • Stargate implementation of getting a contract label.

    Parameters

    • address: string

    Returns Promise<string>

  • Instantiate a new program from a code id, label and init message.

    Parameters

    Returns Promise<ContractInstance & {
        address: string;
    }>

    Deploy.ContractInstance with no address populated yet. This will be populated after executing the batch.

    Example

    await agent.instantiate(template.define({ label, initMsg })
    
  • Query a contract.

    Type Parameters

    • Q

    Parameters

    • contract: string | {
          address: string;
      }
    • message: Message

    Returns Promise<Q>

  • Send native tokens to 1 recipient.

    Parameters

    • recipient: string | {
          address?: string;
      }
    • amounts: (ICoin | Amount)[]
    • Optional options: {
          sendFee?: IFee;
          sendMemo?: string;
      }
      • Optional sendFee?: IFee
      • Optional sendMemo?: string

    Returns Promise<unknown>

  • Upload a contract's code, generating a new code id/hash pair.

    Parameters

    • code: string | Uint8Array | URL | Partial<CompiledCode>
    • options: {
          reupload?: boolean;
          uploadFee?: ICoin[] | "auto";
          uploadMemo?: string;
          uploadStore?: UploadStore;
      } = {}
      • Optional reupload?: boolean
      • Optional uploadFee?: ICoin[] | "auto"
      • Optional uploadMemo?: string
      • Optional uploadStore?: UploadStore

    Returns Promise<UploadedCode & {
        chainId: string;
        codeId: string;
    }>

Generated using TypeDoc