if (typeof from !== 'number' || from < 0 || 0xffffffff < from) {
throw new TypeError('Invalid starting account index', { cause: from })
}
- const to = (from + batchSize > 0xffffffff) ? 0xffffffff : from + batchSize
+ const to = (from + batchSize > 0x100000000) ? 0x100000000 : from + batchSize
const accounts = await wallet.accounts(from, to)
const addresses = []
for (const account of accounts.values()) {
if (to >= 0xffffffff) {
throw new RangeError('Max index reached')
}
- return await _unopened(wallet, rpc, batchSize, to + 1)
+ return await _unopened(wallet, rpc, batchSize, to)
}
await test('derive low indexed accounts from the given BIP-44 seed', async () => {\r
const wallet = await Wallet.load('BIP-44', TEST_PASSWORD, NANO_TEST_VECTORS.BIP39_SEED)\r
await wallet.unlock(TEST_PASSWORD)\r
- const accounts = await wallet.accounts(1, 2)\r
+ const accounts = await wallet.accounts(1, 3)\r
\r
assert.equal(accounts.size, 2)\r
\r
await test('derive high indexed accounts from the given BIP-44 seed', async () => {\r
const wallet = await Wallet.load('BIP-44', TEST_PASSWORD, NANO_TEST_VECTORS.BIP39_SEED)\r
await wallet.unlock(TEST_PASSWORD)\r
- const accounts = await wallet.accounts(0x70000000, 0x7000000f)\r
+ const accounts = await wallet.accounts(0x70000000, 0x70000010)\r
\r
assert.equal(accounts.size, 0x10)\r
- for (let i = 0x70000000; i < 0x7000000f; i++) {\r
+ for (let i = 0x70000000; i < 0x70000010; i++) {\r
const a = accounts.get(i)\r
assert.exists(a)\r
assert.exists(a.address)\r
await test('derive low indexed accounts from the given BLAKE2b seed', async () => {\r
const wallet = await Wallet.load('BLAKE2b', TEST_PASSWORD, NANO_TEST_VECTORS.BLAKE2B_SEED)\r
await wallet.unlock(TEST_PASSWORD)\r
- const accounts = await wallet.accounts(2, 3)\r
+ const accounts = await wallet.accounts(2, 4)\r
\r
assert.equal(accounts.size, 2)\r
\r
await test('derive high indexed accounts from the given BLAKE2b seed', async () => {\r
const wallet = await Wallet.load('BLAKE2b', TEST_PASSWORD, NANO_TEST_VECTORS.BLAKE2B_SEED)\r
await wallet.unlock(TEST_PASSWORD)\r
- const accounts = await wallet.accounts(0x70000000, 0x7000000f)\r
+ const accounts = await wallet.accounts(0x70000000, 0x70000010)\r
\r
assert.equal(accounts.size, 0x10)\r
- for (let i = 0x70000000; i < 0x7000000f; i++) {\r
+ for (let i = 0x70000000; i < 0x70000010; i++) {\r
const a = accounts.get(i)\r
assert.exists(a)\r
assert.exists(a.address)\r
await test('derive low indexed accounts from the given Exodus seed', async () => {\r
const wallet = await Wallet.load('Exodus', TEST_PASSWORD, BIP39_SEED_1)\r
await wallet.unlock(TEST_PASSWORD)\r
- const accounts = await wallet.accounts(1, 2)\r
+ const accounts = await wallet.accounts(1, 3)\r
\r
assert.equal(accounts.size, 2)\r
\r
await test('derive high indexed accounts from the given Exodus seed', async () => {\r
const wallet = await Wallet.load('Exodus', TEST_PASSWORD, BIP39_SEED_0)\r
await wallet.unlock(TEST_PASSWORD)\r
- const accounts = await wallet.accounts(0x70000000, 0x7000000f)\r
+ const accounts = await wallet.accounts(0x70000000, 0x70000010)\r
\r
assert.equal(accounts.size, 0x10)\r
- for (let i = 0x70000000; i < 0x7000000f; i++) {\r
+ for (let i = 0x70000000; i < 0x70000010; i++) {\r
const a = accounts.get(i)\r
assert.exists(a)\r
assert.exists(a.address)\r
await test('BIP-44 zero-string entropy', async () => {\r
const wallet = await Wallet.load('BIP-44', TEST_PASSWORD, TREZOR_TEST_VECTORS.MNEMONIC_0, TREZOR_TEST_VECTORS.MNEMONIC_SALT)\r
await wallet.unlock(TEST_PASSWORD)\r
- const accounts = await wallet.accounts(0, 3)\r
+ const accounts = await wallet.accounts(0, 4)\r
\r
assert.ok('mnemonic' in wallet)\r
assert.ok('seed' in wallet)\r
await test('BLAKE2b zero-string seed', async () => {\r
const wallet = await Wallet.load('BLAKE2b', TEST_PASSWORD, TREZOR_TEST_VECTORS.MNEMONIC_0)\r
await wallet.unlock(TEST_PASSWORD)\r
- const accounts = await wallet.accounts(0, 3)\r
+ const accounts = await wallet.accounts(0, 4)\r
\r
assert.ok('mnemonic' in wallet)\r
assert.ok('seed' in wallet)\r
await test('Trezor-derived BLAKE2b test vectors verified with third-party libraries', async () => {\r
const wallet = await Wallet.load('BLAKE2b', TEST_PASSWORD, TREZOR_TEST_VECTORS.MNEMONIC_1)\r
await wallet.unlock(TEST_PASSWORD)\r
- const accounts = await wallet.accounts(0, 1)\r
+ const accounts = await wallet.accounts(0, 2)\r
\r
assert.ok(await wallet.verify(TREZOR_TEST_VECTORS.MNEMONIC_1))\r
assert.ok(await wallet.verify(TREZOR_TEST_VECTORS.ENTROPY_1))\r