Skip to content

Commit

Permalink
fix: returns all tokens with zero balance when rpc call fails
Browse files Browse the repository at this point in the history
  • Loading branch information
genaroibc committed Aug 19, 2024
1 parent 81a3f1f commit 8db6a56
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/services/getEvmBalances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ const getTokensBalanceSupportingMultiCall = async (

return tokenBalances;
} catch (error) {
return [];
return tokens.map(t => ({
...t,
balance: "0",
}));
}
};

Expand Down Expand Up @@ -178,7 +181,10 @@ export const getAllEvmTokensBalance = async (
return [...tokensMulticall, ...tokensNotMultiCall];
} catch (error) {
console.error(error);
return [];
return evmTokens.map(t => ({
...t,
balance: "0",
}));
}
};

Expand Down

0 comments on commit 8db6a56

Please sign in to comment.