Basic AeSdk class implements:

  • node selector,
  • integrated compiler support,
  • wrappers of account methods mapped to the current account.

Hierarchy (view full)

Constructors

Properties

_getPollInterval: ((...args: [type: "key-block" | "micro-block"] | [type: "key-block" | "micro-block", Omit<{
    _expectedMineRate?: number;
    _microBlockCycle?: number;
    onNode: Node;
}, "onNode" | "onAccount" | "onCompiler"> & Partial<{
    _expectedMineRate?: number;
    _microBlockCycle?: number;
    onNode: Node;
}>]) => Promise<number>)
_options: AeSdkMethodsOptions = {}
awaitHeight: ((...args: [height: number] | [height: number, Omit<{
    interval?: number;
    onNode: Node;
} & {
    _expectedMineRate?: number;
    _microBlockCycle?: number;
    onNode: Node;
}, "onNode" | "onAccount" | "onCompiler"> & Partial<{
    interval?: number;
    onNode: Node;
} & {
    _expectedMineRate?: number;
    _microBlockCycle?: number;
    onNode: Node;
}>]) => Promise<number>)
buildAuthTxHash: ((...args: [transaction: `tx_${string}`] | [transaction: `tx_${string}`, Omit<{
    fee?: Int;
    gasPrice?: Int;
    onNode: Node;
}, "onNode" | "onAccount" | "onCompiler"> & Partial<{
    fee?: Int;
    gasPrice?: Int;
    onNode: Node;
}>]) => Promise<Buffer>)
buildAuthTxHashByGaMetaTx: ((...args: [transaction: `tx_${string}`] | [transaction: `tx_${string}`, Omit<{
    onNode: Node;
}, "onNode" | "onAccount" | "onCompiler"> & Partial<{
    onNode: Node;
}>]) => Promise<Buffer>)
createGeneralizedAccount: ((...args: [authFnName: string, args: any[]] | [authFnName: string, args: any[], Omit<CreateGeneralizedAccountOptions, "onNode" | "onAccount" | "onCompiler"> & Partial<Omit<CreateGeneralizedAccountOptions, "onAccount"> & {
    onAccount: OnAccount;
}>]) => Promise<Readonly<{
    gaContractId: `ct_${string}`;
    owner: `ak_${string}`;
    rawTx: `tx_${string}`;
    transaction: `th_${string}`;
}>>)
getAccount: ((...args: [address: `ct_${string}` | `ak_${string}`] | [address: `ct_${string}` | `ak_${string}`, Omit<{
    hash?: `kh_${string}` | `mh_${string}`;
    height?: number;
    onNode: Node;
}, "onNode" | "onAccount" | "onCompiler"> & Partial<{
    hash?: `kh_${string}` | `mh_${string}`;
    height?: number;
    onNode: Node;
}>]) => Promise<Account>)
getBalance: ((...args: [address: `ct_${string}` | `ok_${string}` | `ak_${string}`] | [address: `ct_${string}` | `ok_${string}` | `ak_${string}`, Omit<{
    format?: AE_AMOUNT_FORMATS;
} & {
    hash?: `kh_${string}` | `mh_${string}`;
    height?: number;
    onNode: Node;
}, "onNode" | "onAccount" | "onCompiler"> & Partial<{
    format?: AE_AMOUNT_FORMATS;
} & {
    hash?: `kh_${string}` | `mh_${string}`;
    height?: number;
    onNode: Node;
}>]) => Promise<string>)
getContract: ((...args: [contractId: `ct_${string}`] | [contractId: `ct_${string}`, Omit<{
    onNode: Node;
}, "onNode" | "onAccount" | "onCompiler"> & Partial<{
    onNode: Node;
}>]) => Promise<ContractObject>)
getContractByteCode: ((...args: [contractId: `ct_${string}`] | [contractId: `ct_${string}`, Omit<{
    onNode: Node;
}, "onNode" | "onAccount" | "onCompiler"> & Partial<{
    onNode: Node;
}>]) => Promise<ByteCode>)
getCurrentGeneration: ((...args: [] | [Omit<{
    onNode: Node;
}, "onNode" | "onAccount" | "onCompiler"> & Partial<{
    onNode: Node;
}>]) => Promise<Generation>)
getGeneration: ((...args: [hashOrHeight: number | `kh_${string}`] | [hashOrHeight: number | `kh_${string}`, Omit<{
    onNode: Node;
}, "onNode" | "onAccount" | "onCompiler"> & Partial<{
    onNode: Node;
}>]) => Promise<Generation>)
getHeight: ((...args: [] | [Omit<{
    cached?: boolean;
    onNode: Node;
} & {
    _expectedMineRate?: number;
    _microBlockCycle?: number;
    onNode: Node;
}, "onNode" | "onAccount" | "onCompiler"> & Partial<{
    cached?: boolean;
    onNode: Node;
} & {
    _expectedMineRate?: number;
    _microBlockCycle?: number;
    onNode: Node;
}>]) => Promise<number>)
getKeyBlock: ((...args: [hashOrHeight: number | `kh_${string}`] | [hashOrHeight: number | `kh_${string}`, Omit<{
    onNode: Node;
}, "onNode" | "onAccount" | "onCompiler"> & Partial<{
    onNode: Node;
}>]) => Promise<KeyBlock>)
getMicroBlockHeader: ((...args: [hash: `mh_${string}`] | [hash: `mh_${string}`, Omit<{
    onNode: Node;
}, "onNode" | "onAccount" | "onCompiler"> & Partial<{
    onNode: Node;
}>]) => Promise<MicroBlockHeader>)
getMicroBlockTransactions: ((...args: [hash: `mh_${string}`] | [hash: `mh_${string}`, Omit<{
    onNode: Node;
}, "onNode" | "onAccount" | "onCompiler"> & Partial<{
    onNode: Node;
}>]) => Promise<SignedTx[]>)
getName: ((...args: [name: `${string}.chain`] | [name: `${string}.chain`, Omit<{
    onNode: Node;
}, "onNode" | "onAccount" | "onCompiler"> & Partial<{
    onNode: Node;
}>]) => Promise<NameEntry>)
payForTransaction: ((...args: [transaction: `tx_${string}`] | [transaction: `tx_${string}`, Omit<PayForTransactionOptions, "onNode" | "onAccount" | "onCompiler"> & Partial<Omit<PayForTransactionOptions, "onAccount"> & {
    onAccount: OnAccount;
}>]) => Promise<SendTransactionReturnType>)
poll: ((...args: [th: `th_${string}`] | [th: `th_${string}`, Omit<{
    blocks?: number;
    interval?: number;
    onNode: Node;
} & {
    _expectedMineRate?: number;
    _microBlockCycle?: number;
    onNode: Node;
}, "onNode" | "onAccount" | "onCompiler"> & Partial<{
    blocks?: number;
    interval?: number;
    onNode: Node;
} & {
    _expectedMineRate?: number;
    _microBlockCycle?: number;
    onNode: Node;
}>]) => Promise<SignedTx>)
pool: Map<string, Node> = ...
resolveName: ((...args: [nameOrId: `${string}.chain` | `ct_${string}` | `ak_${string}`, key: string] | [nameOrId: `${string}.chain` | `ct_${string}` | `ak_${string}`, key: string, Omit<{
    onNode: Node;
    resolveByNode?: boolean;
    verify?: boolean;
}, "onNode" | "onAccount" | "onCompiler"> & Partial<{
    onNode: Node;
    resolveByNode?: boolean;
    verify?: boolean;
}>]) => Promise<`ct_${string}` | `ak_${string}` | `nm_${string}`>)
selectedNodeName?: string
sendTransaction: ((...args: [txUnsigned: `tx_${string}`] | [txUnsigned: `tx_${string}`, Omit<SendTransactionOptions, "onNode" | "onAccount" | "onCompiler"> & Partial<Omit<SendTransactionOptions, "onAccount"> & {
    onAccount: OnAccount;
}>]) => Promise<SendTransactionReturnType>)
spend: ((...args: [amount: string | number, recipientIdOrName: `${string}.chain` | `ct_${string}` | `ak_${string}`] | [amount: string | number, recipientIdOrName: `${string}.chain` | `ct_${string}` | `ak_${string}`, Omit<SpendOptions, "onNode" | "onAccount" | "onCompiler"> & Partial<Omit<SpendOptions, "onAccount"> & {
    onAccount: OnAccount;
}>]) => Promise<SendTransactionReturnType>)
transferFunds: ((...args: [fraction: string | number, recipientIdOrName: `${string}.chain` | `ct_${string}` | `ak_${string}`] | [fraction: string | number, recipientIdOrName: `${string}.chain` | `ct_${string}` | `ak_${string}`, Omit<TransferFundsOptions, "onNode" | "onAccount" | "onCompiler"> & Partial<Omit<TransferFundsOptions, "onAccount"> & {
    onAccount: OnAccount;
}>]) => Promise<SendTransactionReturnType>)
txDryRun: ((...args: [tx: `tx_${string}`, accountAddress: `ak_${string}`] | [tx: `tx_${string}`, accountAddress: `ak_${string}`, Omit<{
    combine?: boolean;
    onNode: Node;
    top?: number | `kh_${string}` | `mh_${string}`;
    txEvents?: boolean;
}, "onNode" | "onAccount" | "onCompiler"> & Partial<{
    combine?: boolean;
    onNode: Node;
    top?: number | `kh_${string}` | `mh_${string}`;
    txEvents?: boolean;
}>]) => Promise<{
    txEvents?: Record<string, unknown>[];
} & DryRunResult>)
waitForTxConfirm: ((...args: [txHash: `th_${string}`] | [txHash: `th_${string}`, Omit<{
    confirm?: number;
    onNode: Node;
} & {
    interval?: number;
    onNode: Node;
} & {
    _expectedMineRate?: number;
    _microBlockCycle?: number;
    onNode: Node;
}, "onNode" | "onAccount" | "onCompiler"> & Partial<{
    confirm?: number;
    onNode: Node;
} & {
    interval?: number;
    onNode: Node;
} & {
    _expectedMineRate?: number;
    _microBlockCycle?: number;
    onNode: Node;
}>]) => Promise<number>)

Accessors

Methods

  • Add Node

    Parameters

    • name: string

      Node name

    • node: Node

      Node instance

    • select: boolean = false

      Select this node as current

    Returns void

    // add and select new node with name 'testNode'
    aeSdkBase.addNode('testNode', new Node({ url }), true)
  • Returns `ak_${string}`[]

  • Parameters

    Returns Promise<`tx_${string}`>

  • Returns asserts this is AeSdkBase & {
        selectedNodeName: string;
    }

  • Get information about node

    Returns Promise<NodeInfo>

    nodePool.getNodeInfo() // { name, version, networkId, protocol, ... }
    
  • Check if you have selected node

    Returns this is AeSdkBase & {
        selectedNodeName: string;
    }

    nodePool.isNodeConnected()
    
  • Select Node

    Parameters

    • name: string

      Node name

    Returns void

    nodePool.selectNode('testNode')
    
  • Sign data blob

    Parameters

    • data: string | Uint8Array

      Data to sign

    • options: {
          onAccount?: OnAccount;
      } = {}

      Options

    Returns Promise<Uint8Array>

  • Sign delegation, works only in Ceres

    Parameters

    • delegation: `ba_${string}`

      Delegation to sign

    • options: {
          onAccount?: OnAccount;
      } & {
          aeppOrigin?: string;
          aeppRpcClientId?: string;
          networkId?: string;
      } = {}

      Options

    Returns Promise<`sg_${string}`>

  • Sign message

    Parameters

    • message: string

      Message to sign

    • options: {
          onAccount?: OnAccount;
      } & {
          aeppOrigin?: string;
          aeppRpcClientId?: string;
      } = {}

      Options

    Returns Promise<Uint8Array>

  • Sign encoded transaction

    Parameters

    • tx: `tx_${string}`

      Transaction to sign

    • options: {
          onAccount?: OnAccount;
      } & {
          aeppOrigin?: string;
          aeppRpcClientId?: string;
          authData?: AuthData | ((tx: `tx_${string}`) => Promise<AuthData>);
          innerTx?: boolean;
          networkId?: string;
          onCompiler?: CompilerBase;
          onNode?: Node;
      } = {}

      Options

    Returns Promise<`tx_${string}`>

  • Sign typed data

    Parameters

    • data: `cb_${string}`

      Encoded data to sign

    • aci: AciValue

      Type of data to sign

    • options: {
          onAccount?: OnAccount;
      } & Domain & {
          aeppOrigin?: string;
          aeppRpcClientId?: string;
      } = {}

      Options

    Returns Promise<`sg_${string}`>