Skip to content

Commit

Permalink
fix: querying balances for Solana
Browse files Browse the repository at this point in the history
  • Loading branch information
fadeev committed Dec 13, 2024
1 parent 5e088f9 commit c11f0c4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
20 changes: 12 additions & 8 deletions packages/client/src/getBalances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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) =>
Expand Down
2 changes: 1 addition & 1 deletion packages/tasks/src/balances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}` : ""
}
`);
Expand Down

0 comments on commit c11f0c4

Please sign in to comment.