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

Hierarchy

Implements

Constructors

Properties

accountId: string
connection: Connection

Methods

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

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

    • 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