Class ConnectionAbstract

Hierarchy (view full)

Constructors

Properties

alive: boolean = true

Setting this to false stops retries.

api?: unknown

Platform SDK.

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?: Identity

Signer identity.

log: Console
url?: string

Connection URL.

gasToken: Native = ...

Native token of chain.

Accessors

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

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

    Returns Promise<number>

Methods

  • Parameters

    • contract: {
          address: string;
      }
      • address: string
    • message: Message
    • options: {
          execFee?: IFee;
          execMemo?: string;
          execSend?: ICoin[];
      }
      • Optional execFee?: IFee
      • Optional execMemo?: string
      • Optional execSend?: ICoin[]

    Returns Promise<unknown>

  • Parameters

    • Optional token: string
    • Optional address: string

    Returns Promise<string | number | bigint>

  • Parameters

    • contract: string

    Returns Promise<string>

  • Parameters

    • codeId: string

    Returns Promise<string>

  • Parameters

    • contract: string

    Returns Promise<string>

  • Parameters

    • id: string

    Returns Promise<Iterable<{
        address: string;
    }>>

  • Parameters

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

    Returns Promise<unknown>

  • Parameters

    • recipient: string
    • amounts: ICoin[]
    • Optional options: {
          sendFee?: IFee;
          sendMemo?: string;
      }
      • Optional sendFee?: IFee
      • Optional sendMemo?: string

    Returns Promise<unknown>

  • Parameters

    • outputs: [string, ICoin[]][]
    • Optional options: unknown

    Returns Promise<unknown>

  • Parameters

    • data: Uint8Array
    • 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<Partial<UploadedCode>>

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

  • Get a client handle for a specific smart contract, authenticated as as this agent.

    Parameters

    • options: string | {
          address: string;
      }

    Returns Contract

  • Get client handles for all contracts that match a code ID

    Parameters

    • id: string

    Returns Promise<Record<string, Contract>>

  • Type Parameters

    Parameters

    • id: string
    • $C: C

    Returns Promise<Record<string, InstanceType<C>>>

  • Get client handles for all contracts that match multiple code IDs

    Parameters

    • ids: Iterable<string>

    Returns Promise<Record<string, Record<string, Contract>>>

  • Type Parameters

    Parameters

    • ids: Iterable<string>
    • Optional $C: C

    Returns Promise<Record<string, Record<string, InstanceType<C>>>>

  • Type Parameters

    Parameters

    • ids: Record<string, C>

    Returns Promise<Record<string, Record<string, InstanceType<C>>>>

  • 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