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

Hierarchy (view full)

Constructors

Properties

accountId: string
connection: Connection
onAddRequestResult: ((any) => any)

Type declaration

    • (any): any
    • Parameters

      • any: any

      Returns any

storage: any

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

      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.

  • This method submits a canary transaction that is expected to always fail in order to determine whether the contract currently has valid multisig state and whether it is initialized. The canary transaction attempts to delete a request at index u32_max and will go through if a request exists at that index. a u32_max + 1 and -1 value cannot be used for the canary due to expected u32 error thrown before deserialization attempt.

    Parameters

    • Optional contractBytes: Uint8Array

      The bytecode of the multisig contract.

    Returns Promise<{
        codeStatus: MultisigCodeStatus;
        stateStatus: MultisigStateStatus;
    }>

    A promise that resolves to the status of the code and state.

  • Parameters

    • newAccountId: string

      NEAR account name to be created

    • publicKey: string | PublicKey

      A public key created from the masterAccount

    • amount: bigint

    Returns Promise<FinalExecutionOutcome>

  • Parameters

    • beneficiaryId: string

      The NEAR account that will receive the remaining Ⓝ balance from the account being deleted

    Returns Promise<FinalExecutionOutcome>

  • Delete a multisig request by its ID.

    Parameters

    • request_id: any

      The ID of the multisig request to be deleted.

    Returns Promise<FinalExecutionOutcome>

    A promise that resolves to the final execution outcome of the deletion.

  • Delete unconfirmed multisig requests associated with the account.

    Returns Promise<void>

    A promise that resolves when unconfirmed requests are deleted.

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

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

  • Parameters

    • receiverId: string

      NEAR account receiving Ⓝ

    • amount: bigint

      Amount to send in yoctoⓃ

    Returns Promise<FinalExecutionOutcome>

  • Sign and send a transaction with the multisig account as the sender.

    Parameters

    • receiverId: string

      The NEAR account ID of the transaction receiver.

    • actions: Action[]

      The list of actions to be included in the transaction.

    Returns Promise<FinalExecutionOutcome>

    A promise that resolves to the final execution outcome of the transaction.

  • Create a signed transaction which can be broadcast to the network

    Parameters

    • receiverId: string

      NEAR account receiving the transaction

    • actions: Action[]

      list of actions to perform as part of the transaction

    Returns Promise<[Uint8Array, SignedTransaction]>

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

    Parameters

    • options: SignedDelegateOptions

      Options for the transaction.

    Returns Promise<SignedDelegate>

  • 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;
    }[]>