return wallet\r
}\r
\r
+ /**\r
+ * Retrieves an existing HD wallet from storage using its ID.\r
+ *\r
+ * @param {string} id - Generated when the wallet was initially created\r
+ * @returns {Bip44Wallet} Restored locked Bip44Wallet\r
+ */\r
+ static async restore (id: string): Promise<Bip44Wallet> {\r
+ if (typeof id !== 'string' || id === '') {\r
+ throw new TypeError('Wallet ID is required to restore')\r
+ }\r
+ Bip44Wallet.#isInternal = true\r
+ return new this(await Entropy.import(id))\r
+ }\r
+\r
/**\r
* Derives BIP-44 Nano account private keys.\r
*\r
return wallet\r
}\r
\r
+ /**\r
+ * Retrieves an existing BLAKE2b wallet from storage using its ID.\r
+ *\r
+ * @param {string} id - Generated when the wallet was initially created\r
+ * @returns {Blake2bWallet} Restored locked Blake2bWallet\r
+ */\r
+ static async restore (id: string): Promise<Blake2bWallet> {\r
+ if (typeof id !== 'string' || id === '') {\r
+ throw new TypeError('Wallet ID is required to restore')\r
+ }\r
+ Blake2bWallet.#isInternal = true\r
+ return new this(await Entropy.import(id))\r
+ }\r
+\r
/**\r
* Derives BLAKE2b account private keys.\r
*\r
}\r
}\r
\r
+ /**\r
+ * Retrieves an existing Ledger wallet from storage using its ID.\r
+ *\r
+ * @param {string} id - Generated when the wallet was initially created\r
+ * @returns {LedgerWallet} Restored LedgerWallet\r
+ */\r
+ static async restore (id: string): Promise<LedgerWallet> {\r
+ if (typeof id !== 'string' || id === '') {\r
+ throw new TypeError('Wallet ID is required to restore')\r
+ }\r
+ try {\r
+ LedgerWallet.#isInternal = true\r
+ const wallet = new this(await Entropy.import(id))\r
+ return wallet\r
+ } catch (err) {\r
+ console.error(err)\r
+ throw new Error('failed to restore wallet', { cause: err })\r
+ }\r
+ }\r
+\r
/**\r
* Sign a block with the Ledger device.\r
*\r