A high level class to construct and work with NEAR promises.

Constructors

Methods

  • Creates a add access key promise action and adds it to the current promise. Uses 0n as the nonce.

    Parameters

    • publicKey: PublicKey

      The public key to add as a access key.

    • allowance: bigint

      The allowance for the key in yoctoNEAR.

    • receiverId: string

      The account ID of the receiver.

    • functionNames: string

      The names of functions to authorize.

    Returns NearPromise

  • Creates a add access key promise action and adds it to the current promise. Allows you to specify the nonce.

    Parameters

    • publicKey: PublicKey

      The public key to add as a access key.

    • allowance: bigint

      The allowance for the key in yoctoNEAR.

    • receiverId: string

      The account ID of the receiver.

    • functionNames: string

      The names of functions to authorize.

    • nonce: bigint

      The nonce to use.

    Returns NearPromise

  • Attach the promise to transaction but does not return it. The promise will be executed, but whether it success or not will not affect the transaction result. If you want the promise fail also makes the transaction fail, you can simply return the promise from a

    Returns PromiseIndex

    method.

  • Creates a delete account promise action and adds it to the current promise.

    Parameters

    • beneficiaryId: string

      The beneficiary of the account deletion - the account to receive all of the remaining funds of the deleted account.

    Returns NearPromise

  • Creates a function call promise action and adds it to the current promise.

    Parameters

    • functionName: string

      The name of the function to be called.

    • args: string

      The utf-8 string arguments to be passed to the function.

    • amount: bigint

      The amount of NEAR to attach to the call.

    • gas: bigint

      The amount of Gas to attach to the call.

    Returns NearPromise

  • Creates a function call raw promise action and adds it to the current promise.

    Parameters

    • functionName: string

      The name of the function to be called.

    • args: Uint8Array

      The arguments to be passed to the function.

    • amount: bigint

      The amount of NEAR to attach to the call.

    • gas: bigint

      The amount of Gas to attach to the call.

    Returns NearPromise

  • Creates a function call weight promise action and adds it to the current promise.

    Parameters

    • functionName: string

      The name of the function to be called.

    • args: string

      The utf-8 string arguments to be passed to the function.

    • amount: bigint

      The amount of NEAR to attach to the call.

    • gas: bigint

      The amount of Gas to attach to the call.

    • weight: bigint

      The weight of unused Gas to use.

    Returns NearPromise

  • Creates a function call weight raw promise action and adds it to the current promise.

    Parameters

    • functionName: string

      The name of the function to be called.

    • args: Uint8Array

      The arguments to be passed to the function.

    • amount: bigint

      The amount of NEAR to attach to the call.

    • gas: bigint

      The amount of Gas to attach to the call.

    • weight: bigint

      The weight of unused Gas to use.

    Returns NearPromise