]> git.codecow.com Git - libnemo.git/commitdiff
Update type definition file.
authorChris Duncan <chris@zoso.dev>
Mon, 18 Aug 2025 21:30:57 +0000 (14:30 -0700)
committerChris Duncan <chris@zoso.dev>
Mon, 18 Aug 2025 21:30:57 +0000 (14:30 -0700)
src/types.d.ts

index c9165a126a83eaa8f6226becc888e048b37a2192..094d0e53c737a28a214a7f7dba8e4decb4788178 100644 (file)
@@ -193,6 +193,7 @@ export declare class Bip39 {
        */
        toBlake2bSeed (format: 'hex'): Promise<string>
 }
+
 /**
 * Implementation derived from blake2b@2.1.4. Copyright 2017 Emil Bay
 * <github@tixz.dk> (https://github.com/emilbayes/blake2b). See LICENSES/ISC.txt
@@ -457,19 +458,11 @@ export declare class Rpc {
        }): Promise<any>
 }
 
-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<NamedData[]>
+       /**
        * 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<Wallet>
        /**
-       * Retrieves all encrypted wallets from the database.
-       *
-       * @returns Array of wallets with encrypted secrets and unencrypted metadata
-       */
-       static backup (): Promise<NamedData[]>
-       /**
        * 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<Wallet[]>} Restored locked Wallets
        */
        static restore (): Promise<Wallet[]>
+       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<void>
        /**
-       * 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<boolean>
+       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<boolean>
+       unlock (password: string): Promise<void>
        /**
        * 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<boolean>
+       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<boolean>
+       unlock (): Promise<void>
        /**
        * Update cache from raw block data. Suitable for offline use.
        *
@@ -890,20 +888,3 @@ export declare class Ledger extends Wallet {
        */
        version (): Promise<LedgerVersionResponse>
 }
-
-/**
-* 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<T extends Data> (data: NamedData): Promise<NamedData<T>>
-       request<T extends Data> (data: NamedData): Promise<NamedData<T>>
-       terminate (): void
-}