@multiversx/sdk-core - v14.0.1
    Preparing search index...

    Class Account

    An abstraction representing an account (user or Smart Contract) on the Network.

    Implements

    Index

    Constructors

    Properties

    address: Address

    The address of the account.

    nonce: bigint = 0n

    Local copy of the account nonce. Must be explicitly managed by client code.

    publicKey: UserPublicKey

    The public key of the account.

    secretKey: UserSecretKey

    The secret key of the account.

    Methods

    • Gets the nonce (the one from the object's state) and increments it.

      Returns bigint

    • Increments (locally) the nonce (the account sequence number).

      Returns void

    • Saves the wallet to a keystore file

      Parameters

      • path: PathLike
      • password: string

      Returns void

    • Signs using the secret key of the account.

      Parameters

      • data: Uint8Array

      Returns Promise<Uint8Array<ArrayBufferLike>>

    • Verifies the signature using the public key of the account.

      Parameters

      • data: Uint8Array
      • signature: Uint8Array

      Returns Promise<boolean>

    • Named constructor Loads a secret key from an encrypted keystore file. Handles both keystores that hold a mnemonic and ones that hold a secret key (legacy). For keystores that hold an encrypted mnemonic, the optional "addressIndex" parameter is used to derive the desired secret key. Returns an Account object, initialized with the secret key.

      Parameters

      • filePath: string
      • password: string
      • OptionaladdressIndex: number
      • hrp: string = LibraryConfig.DefaultAddressHrp

      Returns Account

    • Named constructor Loads (derives) a secret key from a mnemonic. The optional "addressIndex" parameter is used to guide the derivation. Returns an Account object, initialized with the secret key.

      Parameters

      • mnemonic: string
      • addressIndex: number = 0
      • hrp: string = LibraryConfig.DefaultAddressHrp

      Returns Account

    • Named constructor Loads a secret key from a PEM file. PEM files may contain multiple accounts - thus, an (optional) "index" is used to select the desired secret key. Returns an Account object, initialized with the secret key.

      Parameters

      • path: PathLike
      • index: number = 0
      • hrp: string = LibraryConfig.DefaultAddressHrp

      Returns Promise<Account>