From c11f0c4d160365918b85dd7de1f0f19d23477fbd Mon Sep 17 00:00:00 2001 From: Denis Fadeev Date: Fri, 13 Dec 2024 15:32:21 +0300 Subject: [PATCH] fix: querying balances for Solana --- packages/client/src/getBalances.ts | 20 ++++++++++++-------- packages/tasks/src/balances.ts | 2 +- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/packages/client/src/getBalances.ts b/packages/client/src/getBalances.ts index 25a2132..4c1b48f 100644 --- a/packages/client/src/getBalances.ts +++ b/packages/client/src/getBalances.ts @@ -79,13 +79,18 @@ export const getBalances = async function ( symbol: token.symbol, }); } else if (token.coin_type === "ERC20") { - tokens.push({ - chain_id: token.foreign_chain_id, - coin_type: "ERC20", - contract: token.asset, - symbol: token.symbol, - zrc20: token.zrc20_contract_address, - }); + const supportedChain = supportedChains.find( + (c: any) => c.chain_id === token.foreign_chain_id + ); + if (supportedChain.vm === "evm") { + tokens.push({ + chain_id: token.foreign_chain_id, + coin_type: "ERC20", + contract: token.asset, + symbol: token.symbol, + zrc20: token.zrc20_contract_address, + }); + } tokens.push({ chain_id: this.getChainId(`zeta_${this.network}`), coin_type: "ZRC20", @@ -193,7 +198,6 @@ export const getBalances = async function ( } }); } catch (error) { - console.error(`Multicall failed for ${chainName}:`, error); // Fallback to individual calls if multicall fails for (const token of tokens.filter( (t) => diff --git a/packages/tasks/src/balances.ts b/packages/tasks/src/balances.ts index 2e5ecb0..1bff4aa 100644 --- a/packages/tasks/src/balances.ts +++ b/packages/tasks/src/balances.ts @@ -112,7 +112,7 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { } else { spinner.stop(); console.log(` - EVM: ${evmAddress} ${btcAddress ? `\nBitcoin: ${btcAddress}` : ""} ${ +EVM: ${evmAddress} ${btcAddress ? `\nBitcoin: ${btcAddress}` : ""} ${ solanaAddress ? `\nSolana: ${solanaAddress}` : "" } `);