if (!(rpc instanceof Rpc)) {
throw new TypeError('Invalid RPC endpoint', { cause: rpc })
}
- if (typeof batchSize !== 'number' || !Number.isSafeInteger(batchSize) || batchSize < 1) {
- throw new TypeError('Invalid batch size', { cause: batchSize })
+ if (typeof batchSize !== 'number' || batchSize < 1 || 100 < batchSize) {
+ throw new TypeError('Batch size must be 1-100', { cause: batchSize })
}
- if (typeof from !== 'number' || !Number.isSafeInteger(batchSize) || batchSize < 0) {
+ if (typeof from !== 'number' || from < 0 || 0xffffffff < from) {
throw new TypeError('Invalid starting account index', { cause: from })
}
- const to = from + batchSize
- const accounts = await wallet.accounts(from, to - 1)
+ const to = (from + batchSize > 0xffffffff) ? 0xffffffff : from + batchSize
+ const accounts = await wallet.accounts(from, to)
const addresses = []
for (const account of accounts.values()) {
addresses.push(account.address)
}
}
}
- return await _unopened(wallet, rpc, batchSize, from + batchSize)
+ return await _unopened(wallet, rpc, batchSize, to)
}