Represents a connection to the Secret Network, authenticated as a specific address.

Hierarchy

Constructors

Properties

Bundle: BundleClass<Scrt.Bundle> = ScrtAgent.Bundle

Bundle class used by this agent.

address?: string

The address from which transactions are signed and sent.

chain: Scrt.Chain

Downcast chain property to Scrt only.

fees: AgentFees = ScrtChain.defaultFees

Default fees for this agent.

log: Scrt.Console = ...
mnemonic?: string

The wallet's mnemonic.

name?: string

The friendly name of the agent.

simulateForGas: boolean = false

Whether to simulate each execution first to get a more accurate gas estimate.

The default Bundle class used by this Agent.

Accessors

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

  • 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>

Methods

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

    Parameters

    • address: string
    • Optional codeHash: string

    Returns Promise<string>

  • Get the balance of this or another address.

    Parameters

    • denom: string = ...
    • 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

    • arg: string | number

    Returns Promise<string>

  • Returns Promise<{
        accountNumber: number;
        sequence: number;
    }>

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

    Example

    await agent.instantiate(template.define({ label, initMsg })
    

    Returns

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

    Type Parameters

    Parameters

    Returns Promise<Instantiated>

  • 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.

    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 }),
    }))

    Returns

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

    Type Parameters

    Parameters

    • instances: C

    Returns Promise<C>

  • Send native tokens to multiple recipients.

    Parameters

    • outputs: never
    • opts: never

    Returns Promise<void>

Generated using TypeDoc