data.seed = this.#seed\r
}\r
success &&= await this.#safe.put(this.id, passkey as string, data)\r
- for (const a of this.#accounts) {\r
- success &&= await a.lock(passkey as string)\r
- }\r
+ await Promise.all(this.#accounts.map((a) => a.lock(passkey as string)))\r
if (!success) {\r
throw null\r
}\r
if (id !== this.id) {\r
throw null\r
}\r
- for (const a of this.#accounts) {\r
- await a.unlock(passkey as string)\r
- }\r
+ await Promise.all(this.#accounts.map((a) => a.unlock(passkey as string)))\r
if (mnemonic != null) {\r
this.#mnemonic = await Bip39Mnemonic.fromPhrase(mnemonic)\r
}\r
})\r
\r
it('should derive low indexed accounts from the given BIP-44 seed', async function () {\r
- const accounts = await wallet.accounts(0, 2)\r
-\r
- assert.equal(accounts.length, 3)\r
- assert.equal(accounts[0].privateKey, NANO_TEST_VECTORS.PRIVATE_0)\r
- assert.equal(accounts[0].publicKey, NANO_TEST_VECTORS.PUBLIC_0)\r
- assert.equal(accounts[0].address, NANO_TEST_VECTORS.ADDRESS_0)\r
- assert.equal(accounts[1].privateKey, NANO_TEST_VECTORS.PRIVATE_1)\r
- assert.equal(accounts[1].publicKey, NANO_TEST_VECTORS.PUBLIC_1)\r
- assert.equal(accounts[1].address, NANO_TEST_VECTORS.ADDRESS_1)\r
- assert.equal(accounts[2].privateKey, NANO_TEST_VECTORS.PRIVATE_2)\r
- assert.equal(accounts[2].publicKey, NANO_TEST_VECTORS.PUBLIC_2)\r
- assert.equal(accounts[2].address, NANO_TEST_VECTORS.ADDRESS_2)\r
+ const accounts = await wallet.accounts(1, 2)\r
+\r
+ assert.equal(accounts.length, 2)\r
+ assert.equal(accounts[0].privateKey, NANO_TEST_VECTORS.PRIVATE_1)\r
+ assert.equal(accounts[0].publicKey, NANO_TEST_VECTORS.PUBLIC_1)\r
+ assert.equal(accounts[0].address, NANO_TEST_VECTORS.ADDRESS_1)\r
+ assert.equal(accounts[1].privateKey, NANO_TEST_VECTORS.PRIVATE_2)\r
+ assert.equal(accounts[1].publicKey, NANO_TEST_VECTORS.PUBLIC_2)\r
+ assert.equal(accounts[1].address, NANO_TEST_VECTORS.ADDRESS_2)\r
})\r
\r
it('should derive high indexed accounts from the given seed', async function () {\r