From: Chris Duncan Date: Mon, 18 Aug 2025 21:30:57 +0000 (-0700) Subject: Update type definition file. X-Git-Tag: v0.10.5~41^2~57 X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=ecde047ad01be36804997cebf5643d24d9011b4b;p=libnemo.git Update type definition file. --- diff --git a/src/types.d.ts b/src/types.d.ts index c9165a1..094d0e5 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -193,6 +193,7 @@ export declare class Bip39 { */ toBlake2bSeed (format: 'hex'): Promise } + /** * Implementation derived from blake2b@2.1.4. Copyright 2017 Emil Bay * (https://github.com/emilbayes/blake2b). See LICENSES/ISC.txt @@ -457,19 +458,11 @@ export declare class Rpc { }): Promise } -export type SafeRecord = { - label: string - iv: ArrayBuffer - salt: ArrayBuffer - encrypted: ArrayBuffer -} - type SweepResult = { status: "success" | "error" address: string message: string } - /** * Converts a decimal amount of nano from one unit divider to another. * @@ -528,6 +521,12 @@ export declare class Wallet { #private static DB_NAME: string /** + * Retrieves all encrypted wallets from the database. + * + * @returns Array of wallets with encrypted secrets and unencrypted metadata + */ + static backup (): Promise + /** * Creates a new HD wallet by using an entropy value generated using a * cryptographically strong pseudorandom number generator. * @@ -537,12 +536,6 @@ export declare class Wallet { */ static create (type: 'BIP-44' | 'BLAKE2b', password: string, mnemonicSalt?: string): Promise /** - * Retrieves all encrypted wallets from the database. - * - * @returns Array of wallets with encrypted secrets and unencrypted metadata - */ - static backup (): Promise - /** * Imports an existing HD wallet by using an entropy value generated using a * cryptographically strong pseudorandom number generator.NamedD * @@ -577,14 +570,25 @@ export declare class Wallet { * @returns {Promise} Restored locked Wallets */ static restore (): Promise + constructor (type: WalletType, id?: string) + /** + * @returns UUID of the wallet. + */ get id (): string - get vault (): WorkerQueue + /** + * Method used to create wallet and derive accounts. + */ get type (): WalletType - /** Set when calling `create()` and self-destructs after the first read. */ + /** + * Set when calling `create()`. Self-destructs after the first read. + * @returns Mnemonic phrase used to derive the wallet seed. + */ get mnemonic (): string | undefined - /** Set when calling `create()` and self-destructs after the first read. */ + /** + * Set when calling `create()`. Self-destructs after the first read. + * @returns Seed used to derive accounts. + */ get seed (): string | undefined - constructor (type: WalletType, id?: string) /** * Retrieves an account from a wallet using its child key derivation function. * Defaults to the first account at index 0. @@ -647,12 +651,9 @@ export declare class Wallet { */ destroy (): Promise /** - * Locks the wallet and all currently derived accounts with a password that - * will be needed to unlock it later. - * - * @returns True if successfully locked + * Clears the seed and mnemonic from the vault. */ - lock (): Promise + lock (): void /** * Refreshes wallet account balances, frontiers, and representatives from the * current state on the network. @@ -676,9 +677,8 @@ export declare class Wallet { * Unlocks the wallet using the same password as used prior to lock it. * * @param {string} password Used previously to lock the wallet - * @returns True if successfully unlocked */ - unlock (password: string): Promise + unlock (password: string): Promise /** * Fetches the lowest-indexed unopened account from a wallet in sequential * order. An account is unopened if it has no frontier block. @@ -826,10 +826,8 @@ export declare class Ledger extends Wallet { * * Overrides the default wallet `lock()` method since as a hardware wallet it * does not need to be encrypted by software. - * - * @returns True if successfully locked */ - lock (): Promise + lock (): void /** * Sign a block with the Ledger device. * @@ -846,7 +844,7 @@ export declare class Ledger extends Wallet { * * @returns True if successfully unlocked */ - unlock (): Promise + unlock (): Promise /** * Update cache from raw block data. Suitable for offline use. * @@ -890,20 +888,3 @@ export declare class Ledger extends Wallet { */ version (): Promise } - -/** -* Processes a queue of tasks using Web Workers. -*/ -export declare class WorkerQueue { - #private - static get instances (): WorkerQueue[] - /** - * Creates a Web Worker from a stringified script. - * - * @param {string} worker - Stringified worker class body - */ - constructor (worker: string) - prioritize (data: NamedData): Promise> - request (data: NamedData): Promise> - terminate (): void -}