Class AgentAbstract

By authenticating to a network you obtain an Agent, which can perform transactions as the authenticated identity.

Hierarchy

Implemented by

Constructors

Properties

Bundle: BundleClass<Bundle> = ...

The Bundle subclass to use.

address?: string

The address from which transactions are signed and sent.

chain?: Chain

The chain on which this agent operates.

fees?: AgentFees

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

log: Console = ...
mnemonic?: string

The wallet's mnemonic.

name?: string

The friendly name of the agent.

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>
  • Complete the asynchronous initialization of this Agent.

    Returns Promise<this>

Methods

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

    Parameters

    • address: string
    • Optional codeHash: string

    Returns Promise<string>

  • Call a transaction method on a smart contract.

    Parameters

    Returns Promise<unknown>

  • Get the balance of this or another address.

    Parameters

    • denom: string = ...
    • address: undefined | 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 ID of a contract.

    Parameters

    • address: string

    Returns Promise<string>

  • Get the code hash of a contract or template.

    Parameters

    • address: string | number

    Returns Promise<string>

  • Get the label of a contract.

    Parameters

    • address: string

    Returns Promise<string>

  • Get an uploader instance which performs code uploads and optionally caches them.

    Type Parameters

    Parameters

    Returns U

  • Create a new smart contract from a code id, label and init message.

    Type Parameters

    Parameters

    Returns PromiseLike<Instantiated>

    AnyContract with no address populated yet. This will be populated after executing the bundle.

    Example

    await agent.instantiate(template.define({ label, initMsg })
    
  • 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 }),
    }))
  • Send native tokens to 1 recipient.

    Parameters

    Returns Promise<unknown>

  • Send native tokens to multiple recipients.

    Parameters

    Returns Promise<unknown>

Generated using TypeDoc