Skip to content

Commit 4930704

Browse files
authored
Merge pull request #116 from ethereum-optimism/harry/usdc_no_balance_bug
fix: usdc balance calculation
2 parents 507c1f4 + d4a76c8 commit 4930704

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/demo/frontend/src/components/Terminal.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,10 +1259,10 @@ Tx: ${result.transaction.blockExplorerUrl}/${result.transaction.hash || 'pen
12591259
// Check if selected wallet has USDC balance before proceeding
12601260
try {
12611261
const balanceResult = await verbsApi.getWalletBalance(selectedWallet.id)
1262-
const usdcToken = balanceResult.balance.find(
1263-
(token) => token.symbol === 'USDC',
1262+
const usdcTokens = balanceResult.balance.filter(
1263+
(token) => token.symbol === 'USDC' || token.symbol === 'USDC_DEMO',
12641264
)
1265-
const usdcBalance = usdcToken ? parseFloat(usdcToken.totalBalance) : 0
1265+
const usdcBalance = usdcTokens.reduce((acc, token) => acc + parseFloat(token.totalBalance), 0)
12661266

12671267
if (usdcBalance <= 0) {
12681268
const noBalanceLine: TerminalLine = {

0 commit comments

Comments
 (0)