Skip to content

Commit af15d8c

Browse files
committed
fix: use balanceIndex to ensure that the correct balance is fetched from the stealthBalances array
1 parent dcd0ab2 commit af15d8c

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

frontend/src/components/AccountReceiveTable.vue

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -617,9 +617,16 @@ function useReceivedFundsTable(userAnnouncements: Ref<UserAnnouncement[]>, spend
617617
const stealthBalanceResponses: Response[] = await multicall.callStatic.aggregate3(stealthBalanceCalls);
618618
const stealthBalances = stealthBalanceResponses.map((r) => BigNumber.from(r.returnData));
619619

620-
formattedAnnouncements.value.forEach((announcement, index) => {
621-
if (newAnnouncements.some((newAnnouncement) => newAnnouncement.txHash === announcement.txHash))
622-
announcement.isWithdrawn = stealthBalances[index].lt(announcement.amount);
620+
formattedAnnouncements.value.forEach((announcement) => {
621+
const isNewAnnouncement = newAnnouncements.some(
622+
(newAnnouncement) => newAnnouncement.txHash === announcement.txHash
623+
);
624+
625+
if (isNewAnnouncement) {
626+
const balanceIndex = userAnnouncements.value.findIndex((a) => a.txHash === announcement.txHash);
627+
const stealthBalance = stealthBalances[balanceIndex];
628+
announcement.isWithdrawn = stealthBalance.lt(announcement.amount);
629+
}
623630
});
624631
isLoading.value = false;
625632
});

0 commit comments

Comments
 (0)