Skip to content

Commit

Permalink
fix(bridge-ui): pending transaction store logic
Browse files Browse the repository at this point in the history
  • Loading branch information
shadab-taiko committed Mar 13, 2023
1 parent 9659175 commit f43101b
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions packages/bridge-ui/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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<number>(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();
Expand Down

0 comments on commit f43101b

Please sign in to comment.