RPC handler for AEPP side Contain functionality for wallet interaction and connect it to sdk

use WalletConnectorFrame instead

Hierarchy (View Summary)

Constructors

  • Parameters

    • options: {
          name: string;
          onAddressChange?: (a: Accounts) => void;
          onDisconnect?: (p: any) => void;
          onNetworkChange?: (a: Network) => void;
      } & AeSdkMethodsOptions & { nodes?: { instance: Node; name: string }[] }

      Options

      • name: string

        Aepp name

      • OptionalonAddressChange?: (a: Accounts) => void

        Call-back function for update address event

      • OptionalonDisconnect?: (p: any) => void

        Call-back function for disconnect event

      • OptionalonNetworkChange?: (a: Network) => void

        Call-back function for update network event

      • Optionalnodes?: { instance: Node; name: string }[]

    Returns AeSdkAepp

Properties

_accounts?: Accounts
_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
_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
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
buildAuthTxHashByGaMetaTx: (
    ...args:
        | [transaction: `tx_${string}`]
        | [
            transaction: `tx_${string}`,
            Omit<{ onNode: Node }, "onNode" | "onAccount" | "onCompiler"> & Partial<
                { onNode: Node },
            >,
        ],
) => Promise
createGeneralizedAccount: (
    ...args:
        | [authFnName: string, args: any[]]
        | [
            authFnName: string,
            args: any[],
            Omit<
                CreateGeneralizedAccountOptions,
                "onNode"
                | "onAccount"
                | "onCompiler",
            > & Partial<
                Omit<CreateGeneralizedAccountOptions, "onAccount"> & {
                    onAccount: OnAccount;
                },
            >,
        ],
) => Promise
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
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
getContract: (
    ...args:
        | [contractId: `ct_${string}`]
        | [
            contractId: `ct_${string}`,
            Omit<{ onNode: Node }, "onNode" | "onAccount" | "onCompiler"> & Partial<
                { onNode: Node },
            >,
        ],
) => Promise
getContractByteCode: (
    ...args:
        | [contractId: `ct_${string}`]
        | [
            contractId: `ct_${string}`,
            Omit<{ onNode: Node }, "onNode" | "onAccount" | "onCompiler"> & Partial<
                { onNode: Node },
            >,
        ],
) => Promise
getCurrentGeneration: (
    ...args:
        | []
        | [
            Omit<{ onNode: Node }, "onNode" | "onAccount" | "onCompiler"> & Partial<
                { onNode: Node },
            >,
        ],
) => Promise
getGeneration: (
    ...args:
        | [hashOrHeight: number | `kh_${string}`]
        | [
            hashOrHeight: number
            | `kh_${string}`,
            Omit<{ onNode: Node }, "onNode" | "onAccount" | "onCompiler"> & Partial<
                { onNode: Node },
            >,
        ],
) => Promise
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
getKeyBlock: (
    ...args:
        | [hashOrHeight: number | `kh_${string}`]
        | [
            hashOrHeight: number
            | `kh_${string}`,
            Omit<{ onNode: Node }, "onNode" | "onAccount" | "onCompiler"> & Partial<
                { onNode: Node },
            >,
        ],
) => Promise
getMicroBlockHeader: (
    ...args:
        | [hash: `mh_${string}`]
        | [
            hash: `mh_${string}`,
            Omit<{ onNode: Node }, "onNode" | "onAccount" | "onCompiler"> & Partial<
                { onNode: Node },
            >,
        ],
) => Promise
getMicroBlockTransactions: (
    ...args:
        | [hash: `mh_${string}`]
        | [
            hash: `mh_${string}`,
            Omit<{ onNode: Node }, "onNode" | "onAccount" | "onCompiler"> & Partial<
                { onNode: Node },
            >,
        ],
) => Promise
getName: (
    ...args:
        | [name: `${string}.chain`]
        | [
            name: `${string}.chain`,
            Omit<{ onNode: Node }, "onNode" | "onAccount" | "onCompiler"> & Partial<
                { onNode: Node },
            >,
        ],
) => Promise
name: string
onAddressChange: (a: Accounts) => void
onDisconnect: (p: any) => void
onNetworkChange: (a: Network) => void
payForTransaction: (
    ...args:
        | [transaction: `tx_${string}`]
        | [
            transaction: `tx_${string}`,
            Omit<PayForTransactionOptions, "onNode" | "onAccount" | "onCompiler"> & Partial<
                Omit<PayForTransactionOptions, "onAccount"> & {
                    onAccount: OnAccount;
                },
            >,
        ],
) => Promise
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
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
rpcClient?: default<WalletApi, AeppApi>
selectedNodeName?: string
sendTransaction: (
    ...args:
        | [txUnsigned: `tx_${string}`]
        | [
            txUnsigned: `tx_${string}`,
            Omit<SendTransactionOptions, "onNode" | "onAccount" | "onCompiler"> & Partial<
                Omit<SendTransactionOptions, "onAccount"> & { onAccount: OnAccount },
            >,
        ],
) => Promise
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
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
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
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

Accessors

  • get address(): `ak_${string}`

    Returns `ak_${string}`

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)
  • Ask addresses from wallet

    Returns Promise<`ak_${string}`[]>

    Addresses from wallet

  • Connect to wallet

    Parameters

    • connection: default

      Wallet connection object

    • options: { connectNode?: boolean; name?: string } = {}

      Options

      • OptionalconnectNode?: boolean

        Request wallet to bind node

      • Optionalname?: string

        Node name

    Returns Promise<WalletInfo & { node?: Node }>

  • Disconnect from wallet

    Returns void

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

    Use unsafeSign method instead

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

  • Subscribe for addresses from wallet

    Parameters

    • type: SUBSCRIPTION_TYPES

      Subscription type

    • value: "connected" | "current"

      Should be one of 'current' (the selected account), 'connected' (all)

    Returns Promise<
        Promise<
            { address: Accounts; subscription: ("connected" | "current")[] },
        >,
    >

    Accounts from wallet

  • Sign data blob

    Parameters

    • data: string | Uint8Array

      Data to sign

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

      Options

    Returns Promise<Uint8Array>