@@ -1080,6 +1080,7 @@ export class Ethereum {
10801080
10811081 /**
10821082 * Get balances for all tokens in the token list
1083+ * Processes tokens sequentially to prevent RPC timeouts
10831084 */
10841085 private async getAllTokenBalances (
10851086 address : string ,
@@ -1090,26 +1091,24 @@ export class Ethereum {
10901091 const tokenList = await this . getTokenList ( ) ;
10911092 logger . info ( `Checking balances for all ${ tokenList . length } tokens in the token list` ) ;
10921093
1093- await Promise . all (
1094- tokenList . map ( async ( token ) => {
1095- try {
1096- const contract = this . getContract ( token . address , this . provider ) ;
1097- const balance = isHardware
1098- ? await this . getERC20BalanceByAddress ( contract , address , token . decimals , 2000 , token . symbol )
1099- : await this . getERC20Balance ( contract , wallet ! , token . decimals , 2000 , token . symbol ) ;
1100-
1101- const balanceNum = parseFloat ( tokenValueToString ( balance ) ) ;
1102-
1103- // Only add tokens with non-zero balances
1104- if ( balanceNum > 0 ) {
1105- balances [ token . symbol ] = balanceNum ;
1106- logger . debug ( `Found non-zero balance for ${ token . symbol } : ${ balanceNum } ` ) ;
1107- }
1108- } catch ( err ) {
1109- logger . warn ( `Error getting balance for ${ token . symbol } : ${ err . message } ` ) ;
1094+ for ( const token of tokenList ) {
1095+ try {
1096+ const contract = this . getContract ( token . address , this . provider ) ;
1097+ const balance = isHardware
1098+ ? await this . getERC20BalanceByAddress ( contract , address , token . decimals , 5000 , token . symbol )
1099+ : await this . getERC20Balance ( contract , wallet ! , token . decimals , 5000 , token . symbol ) ;
1100+
1101+ const balanceNum = parseFloat ( tokenValueToString ( balance ) ) ;
1102+
1103+ // Only add tokens with non-zero balances
1104+ if ( balanceNum > 0 ) {
1105+ balances [ token . symbol ] = balanceNum ;
1106+ logger . debug ( `Found non-zero balance for ${ token . symbol } : ${ balanceNum } ` ) ;
11101107 }
1111- } ) ,
1112- ) ;
1108+ } catch ( err ) {
1109+ logger . warn ( `Error getting balance for ${ token . symbol } : ${ err . message } ` ) ;
1110+ }
1111+ }
11131112 }
11141113
11151114 /**
0 commit comments