throw new TypeError('RPC must be a valid node')
}
const blockQueue: Promise<void>[] = []
- const results: { status: 'success' | 'error', address: string, message: string }[] = []
+ const results: SweepResult[] = []
const recipientAccount = Account.load(recipient)
const accounts = await wallet.refresh(rpc, from, to)
for (const account of accounts) {
- if (account.representative?.address && account.frontier && account.index) {
- const block = new Block(account).send(recipientAccount, account.balance ?? 0n)
- await Promise.all([
- block.pow(),
- block.sign(wallet, account.index)
- ])
+ if (account.representative?.address && account.frontier && account.index != null) {
+ const block = await new Block(account)
+ .send(recipientAccount, account.balance ?? 0n)
+ .sign(wallet, account.index)
const blockRequest: Promise<void> = new Promise(async (resolve) => {
try {
+ await block.pow()
const hash = await block.process(rpc)
results.push({ status: 'success', address: block.account.address, message: hash })
} catch (err: any) {
await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
const results = await Tools.sweep(rpc, wallet, NANO_TEST_VECTORS.ADDRESS_1)\r
\r
- assert.ok(results)\r
+ assert.exists(results)\r
assert.equal(results.length, 1)\r
\r
await assert.resolves(wallet.destroy())\r