This class provides common account related RPC calls including signing transactions with a KeyPair.

Hierarchy

Constructors

Properties

accountId: string
connection: Connection
getCode: getCodeFunction
helperUrl: string
onAddRequestResult: ((any) => any)

Type declaration

    • (any): any
    • Parameters

      • any: any

      Returns any

onConfirmResult: ((any) => any)

Type declaration

    • (any): any
    • Parameters

      • any: any

      Returns any

sendCode: sendCodeFunction

Account2FA has options object where you can provide callbacks for:

  • sendCode: how to send the 2FA code in case you don't use NEAR Contract Helper
  • getCode: how to get code from user (use this to provide custom UI/UX for prompt of 2FA code)
  • onResult: the tx result after it's been confirmed by NEAR Contract Helper

storage: any
verifyCode: verifyCodeFunction

Methods

  • Parameters

    • publicKey: string | PublicKey

      A public key to be associated with the contract

    • Optional contractId: string

      NEAR account where the contract is deployed

    • Optional methodNames: string | string[]

      The method names on the contract that should be allowed to be called. Pass null for no method names and '' or [] for any method names.

    • Optional amount: BN

      Payment in yoctoⓃ that is sent to the contract during this function call

    Returns Promise<FinalExecutionOutcome>

    See

    https://docs.near.org/concepts/basics/accounts/access-keys

    Todo

    expand this API to support more options.

  • Create a new account and deploy a contract to it

    Parameters

    • contractId: string

      NEAR account where the contract is deployed

    • publicKey: string | PublicKey

      The public key to add to the created contract account

    • data: Uint8Array

      The compiled contract code

    • amount: BN

      of NEAR to transfer to the created contract account. Transfer enough to pay for storage https://docs.near.org/docs/concepts/storage-staking

    Returns Promise<Account>

  • Returns Promise<void>

  • Parameters

    • __namedParameters: {
          cleanupContractBytes?: Uint8Array;
          contractBytes: Uint8Array;
      }
      • Optional cleanupContractBytes?: Uint8Array
      • contractBytes: Uint8Array

    Returns Promise<FinalExecutionOutcome>

  • Finds the AccessKeyView associated with the accounts PublicKey stored in the Keystore.

    Parameters

    • receiverId: string

      currently unused (see todo)

    • actions: Action[]

      currently unused (see todo)

    Returns Promise<{
        accessKey: AccessKeyView;
        publicKey: PublicKey;
    }>

    { publicKey PublicKey; accessKey: AccessKeyView }

    Todo

    Find matching access key based on transaction (i.e. receiverId and actions)

  • Parameters

    • cleanupContractBytes: Uint8Array

    Returns Promise<Action[]>

  • Returns Promise<Action[]>

  • Returns Promise<{
        detail: any;
        kind: any;
    }>

  • Returns a list of authorized apps

    Returns Promise<{
        authorizedApps: AccountAuthorizedApp[];
    }>

    Todo

    update the response value to return all the different keys, not just app keys.

  • Returns the NEAR tokens balance and validators of a given account that is delegated to the staking pools that are part of the validators set in the current epoch.

    NOTE: If the tokens are delegated to a staking pool that is currently on pause or does not have enough tokens to participate in validation, they won't be accounted for.

    Returns Promise<ActiveDelegatedStakeBalance>

  • Returns Promise<string>

  • Returns Promise<{
        accountId: string;
        data: any;
    }>

  • Returns any

  • Returns Promise<string[]>

  • Parameters

    • path: any
    • body: any

    Returns Promise<any>

  • Returns any

  • Returns Promise<any>

  • Parameters

    • data: any

    Returns any

  • Returns Promise<{
        blockNumber: string;
        blockNumberSignature: string;
    }>

  • Compose and sign a SignedDelegate action to be executed in a transaction on behalf of this Account instance

    Parameters

    • __namedParameters: SignedDelegateOptions

    Returns Promise<SignedDelegate>

  • Parameters

    • securityCode: string

    Returns Promise<any>

  • Returns the state (key value pairs) of this account's contract based on the key prefix. Pass an empty string for prefix if you would like to return the entire state.

    Parameters

    • prefix: string | Uint8Array

      allows to filter which keys should be returned. Empty prefix means all keys. String prefix is utf-8 encoded.

    • Optional blockQuery: BlockReference

      specifies which block to query state at. By default returns last "optimistic" block (i.e. not necessarily finalized).

    Returns Promise<{
        key: Buffer;
        value: Buffer;
    }[]>

Generated using TypeDoc