From: Chris Duncan Date: Fri, 25 Jul 2025 12:39:06 +0000 (-0700) Subject: Add type for wallet export. Remove references to "session" storage which is no longer... X-Git-Tag: v0.10.5~50^2~21^2~2 X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=cd3f7f57e17547d2089eba25273e188a3cd48040;p=libnemo.git Add type for wallet export. Remove references to "session" storage which is no longer used. --- diff --git a/src/lib/wallets/bip44-wallet.ts b/src/lib/wallets/bip44-wallet.ts index 4141334..1b1614e 100644 --- a/src/lib/wallets/bip44-wallet.ts +++ b/src/lib/wallets/bip44-wallet.ts @@ -191,7 +191,7 @@ export class Bip44Wallet extends Wallet { } /** - * Retrieves an existing HD wallet from session storage using its ID. + * Retrieves an existing HD wallet from storage using its ID. * * @param {string} id - Generated when the wallet was initially created * @returns {Bip44Wallet} Restored locked Bip44Wallet diff --git a/src/lib/wallets/blake2b-wallet.ts b/src/lib/wallets/blake2b-wallet.ts index 3bfbe36..4132cc0 100644 --- a/src/lib/wallets/blake2b-wallet.ts +++ b/src/lib/wallets/blake2b-wallet.ts @@ -140,7 +140,7 @@ export class Blake2bWallet extends Wallet { } /** - * Retrieves an existing BLAKE2b wallet from session storage using its ID. + * Retrieves an existing BLAKE2b wallet from storage using its ID. * * @param {string} id - Generated when the wallet was initially created * @returns {Blake2bWallet} Restored locked Blake2bWallet diff --git a/src/lib/wallets/ledger-wallet.ts b/src/lib/wallets/ledger-wallet.ts index 24f8822..e10356b 100644 --- a/src/lib/wallets/ledger-wallet.ts +++ b/src/lib/wallets/ledger-wallet.ts @@ -170,7 +170,7 @@ export class LedgerWallet extends Wallet { } /** - * Retrieves an existing Ledger wallet from session storage using its ID. + * Retrieves an existing Ledger wallet from storage using its ID. * * @param {string} id - Generated when the wallet was initially created * @returns {LedgerWallet} Restored LedgerWallet diff --git a/src/types.d.ts b/src/types.d.ts index e3c0e25..6f0efeb 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -593,6 +593,12 @@ export declare const Tools: { export declare abstract class Wallet { #private abstract ckd (index: number[]): Promise + /** + * Retrieves all wallet IDs from the Safe. + * + * @returns Array of hexadecimal-formatted wallet IDs + */ + static export (): Promise get id (): string get isLocked (): boolean get isUnlocked (): boolean @@ -794,7 +800,7 @@ export declare class Bip44Wallet extends Wallet { */ static fromSeed (key: Uint8Array, seed: string): Promise /** - * Retrieves an existing HD wallet from session storage using its ID. + * Retrieves an existing HD wallet from storage using its ID. * * @param {string} id - Generated when the wallet was initially created * @returns {Bip44Wallet} Restored locked Bip44Wallet @@ -879,7 +885,7 @@ export declare class Blake2bWallet extends Wallet { */ static fromMnemonic (key: Uint8Array, mnemonic: string): Promise /** - * Retrieves an existing BLAKE2b wallet from session storage using its ID. + * Retrieves an existing BLAKE2b wallet from storage using its ID. * * @param {string} id - Generated when the wallet was initially created * @returns {Blake2bWallet} Restored locked Blake2bWallet @@ -972,7 +978,7 @@ export declare class LedgerWallet extends Wallet { onConnectUsb: (e: USBConnectionEvent) => Promise onDisconnectUsb: (e: USBConnectionEvent) => Promise /** - * Retrieves an existing Ledger wallet from session storage using its ID. + * Retrieves an existing Ledger wallet from storage using its ID. * * @param {string} id - Generated when the wallet was initially created * @returns {LedgerWallet} Restored LedgerWallet diff --git a/test/test.import-wallet.mjs b/test/test.import-wallet.mjs index ef41612..af4ba40 100644 --- a/test/test.import-wallet.mjs +++ b/test/test.import-wallet.mjs @@ -262,7 +262,7 @@ await Promise.all([ 'Seed contains invalid hexadecimal characters.') }) - await test('Import BIP-44 wallet from session storage using a wallet-generated ID', async () => { + await test('Import BIP-44 wallet from storage using a wallet-generated ID', async () => { const id = (await Bip44Wallet.fromMnemonic(NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.MNEMONIC, NANO_TEST_VECTORS.PASSWORD)).id const wallet = await Bip44Wallet.restore(id) @@ -282,7 +282,7 @@ await Promise.all([ await assert.resolves(wallet.destroy()) }) - await test('Import BLAKE2B wallet from session storage using a wallet-generated ID', async () => { + await test('Import BLAKE2B wallet from storage using a wallet-generated ID', async () => { const id = (await Blake2bWallet.fromSeed(NANO_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.ENTROPY_0)).id const wallet = await Blake2bWallet.restore(id)