-
Notifications
You must be signed in to change notification settings - Fork 88
Open
Description
| await transfer.wait(); |
Question, in function sendMassPayout... the await transfer.wait() call, wouldn't this make the code not batch and wait for each transfer to complete?
Should we skip this transfer.wait(); but store the "pending transfers" in an array and then check their status later?
something like this:
const transfers = [];
// STEP 1: Queue all transfers (sequentially to enable batching)
for (const address of recipients) {
const transfer = await wallet.createTransfer({
amount: transferAmount,
assetId: assetId,
destination: address,
});
transfers.push({ address, transfer });
console.log(`Queued transfer to ${address}`);
}
// STEP 2: Only after all are queued, check for status
for (const { address, transfer } of transfers) {
await transfer.wait(); // Now we can wait without blocking the next transfer
const status = transfer.getStatus();
if (status === 'complete') {
console.log(`Completed for ${address}`);
} else {
console.error(`Failed for ${address}`);
}
}
Metadata
Metadata
Assignees
Labels
No labels