From f6313b08f23c3563d4f678f37c73736eeefc76f4 Mon Sep 17 00:00:00 2001 From: Jack Hamer Date: Wed, 5 Jun 2024 13:35:17 +0300 Subject: [PATCH] fix: auto l1 balances recognition on sepolia --- store/ethereumBalance.ts | 7 +++++-- store/zksync/ethereumBalance.ts | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/store/ethereumBalance.ts b/store/ethereumBalance.ts index badebb63e..8f8307b31 100644 --- a/store/ethereumBalance.ts +++ b/store/ethereumBalance.ts @@ -26,12 +26,15 @@ export const useEthereumBalanceStore = defineStore("ethereumBalance", () => { if (!portalRuntimeConfig.ankrToken) throw new Error("Ankr token is not available"); const ankrProvider = new AnkrProvider(`https://rpc.ankr.com/multichain/${portalRuntimeConfig.ankrToken}`); - const networkIdToAnkr = new Map([[l1Networks.mainnet.id, "eth"]]); + const networkIdToAnkr = new Map([ + [l1Networks.mainnet.id, "eth"], + [l1Networks.sepolia.id, "eth_sepolia"], + ]); if (!networkIdToAnkr.has(eraNetwork.value.l1Network.id)) { throw new Error(`Ankr does not support ${eraNetwork.value.l1Network.name}`); } const balances = await ankrProvider.getAccountBalance({ - blockchain: [networkIdToAnkr.get(eraNetwork.value.l1Network.id)!], + blockchain: [networkIdToAnkr.get(eraNetwork.value.l1Network.id)!] as AnkrSupportedChains[], walletAddress: account.value.address, onlyWhitelisted: false, }); diff --git a/store/zksync/ethereumBalance.ts b/store/zksync/ethereumBalance.ts index f6dde1197..775d8c850 100644 --- a/store/zksync/ethereumBalance.ts +++ b/store/zksync/ethereumBalance.ts @@ -74,7 +74,10 @@ export const useZkSyncEthereumBalanceStore = defineStore("zkSyncEthereumBalances async () => { if (!l1Network.value) throw new Error(`L1 network is not available on ${selectedNetwork.value.name}`); - if (([l1Networks.mainnet.id] as number[]).includes(l1Network.value?.id) && portalRuntimeConfig.ankrToken) { + if ( + ([l1Networks.mainnet.id, l1Networks.sepolia.id] as number[]).includes(l1Network.value?.id) && + portalRuntimeConfig.ankrToken + ) { return await getBalancesFromApi(); } else { return await getBalancesFromRPC();