Chain instance containing a local mocknet.

Hierarchy (view full)

Constructors

Properties

alive: boolean = true

Setting this to false stops retries.

api?: unknown

Platform SDK.

backend: Mocknet.Backend
blockInterval: number = 250

Time to ping for next block.

chainId?: string

Chain ID.

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
identity?: Chain.Identity

Signer identity.

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

  • Parameters

    • Rest ...args: [contract: {
          address: string;
          codeHash: string;
      }, message: Message, options?: {
          execFee?: IFee;
          execMemo?: string;
          execSend?: ICoin[];
      }]

    Returns Promise<unknown>

  • 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 id of a given address.

    Parameters

    • contract: string | {
          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 })
    
  • 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