From f43101bfd25fbb7c0a71a758ebec706a5b49448a Mon Sep 17 00:00:00 2001 From: Shadab Khan Date: Mon, 13 Mar 2023 20:01:05 +0530 Subject: [PATCH] fix(bridge-ui): pending transaction store logic --- packages/bridge-ui/src/App.svelte | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/bridge-ui/src/App.svelte b/packages/bridge-ui/src/App.svelte index 063d10f7ef1..ca04b9c9ad4 100644 --- a/packages/bridge-ui/src/App.svelte +++ b/packages/bridge-ui/src/App.svelte @@ -174,14 +174,20 @@ }); pendingTransactions.subscribe((store) => { - store.forEach(async (tx, index) => { - await $signer.provider.waitForTransaction(tx.hash, 1); + (async () => { + const confirmedPendingTxIndex = await Promise.race( + store.map((tx, index) => { + return new Promise(async (resolve) => { + await $signer.provider.waitForTransaction(tx.hash, 1); + resolve(index); + }); + }), + ); successToast('Transaction completed!'); - - const s = store; - s.slice(index, 0); + let s = store; + s = s.slice(confirmedPendingTxIndex, 0); pendingTransactions.set(s); - }); + })(); }); const transactionToIntervalMap = new Map();