/// import { PathLike } from "fs"; import { Address, IAccount, Message, Transaction } from "../core"; import { KeyPair, UserPublicKey, UserSecretKey } from "../wallet"; /** * An abstraction representing an account (user or Smart Contract) on the Network. */ export declare class Account implements IAccount { /** * The address of the account. */ readonly address: Address; /** * Local copy of the account nonce. * Must be explicitly managed by client code. */ nonce: bigint; /** * The secret key of the account. */ readonly secretKey: UserSecretKey; /** * The public key of the account. */ readonly publicKey: UserPublicKey; /** * Creates an account object from a secret key */ constructor(secretKey: UserSecretKey, hrp?: string); /** * 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. */ static newFromPem(path: PathLike, index?: number, hrp?: string): Promise; /** * 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. */ static newFromKeystore(filePath: string, password: string, addressIndex?: number, hrp?: string): 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. */ static newFromMnemonic(mnemonic: string, addressIndex?: number, hrp?: string): Account; /** * Named constructor * Returns an Account object, initialized with the secret key. */ static newFromKeypair(keypair: KeyPair, hrp?: string): Account; /** * Increments (locally) the nonce (the account sequence number). */ incrementNonce(): void; /** * Signs using the secret key of the account. */ sign(data: Uint8Array): Promise; /** * Verifies the signature using the public key of the account. */ verify(data: Uint8Array, signature: Uint8Array): Promise; /** * Serializes the transaction, computes the signature and returns it. */ signTransaction(transaction: Transaction): Promise; /** * Verifies the transaction signature using the public key of the account. */ verifyTransactionSignature(transaction: Transaction, signature: Uint8Array): Promise; /** * Serializes the message, computes the signature and returns it. */ signMessage(message: Message): Promise; /** * Verifies the message signature using the public key of the account. */ verifyMessageSignature(message: Message, signature: Uint8Array): Promise; /** * Gets the nonce (the one from the object's state) and increments it. */ getNonceThenIncrement(): bigint; /** * Saves the wallet to a pem file */ saveToPem(path: string): void; /** * Saves the wallet to a keystore file */ saveToKeystore(path: PathLike, password: string): void; }