fix: pass accounts to getAccountBalances

This commit is contained in:
Ben Kremer 2022-02-04 14:01:32 +01:00
parent 6976e7bbd6
commit 55fff706cf

View File

@ -237,7 +237,7 @@ export default function App() {
const onSessionUpdate = async (accounts: string[], chains: string[]) => { const onSessionUpdate = async (accounts: string[], chains: string[]) => {
setChains(chains); setChains(chains);
setAccounts(accounts); setAccounts(accounts);
await getAccountBalances(); await getAccountBalances(accounts);
}; };
const ping = async () => { const ping = async () => {
@ -274,11 +274,11 @@ export default function App() {
} }
}; };
const getAccountBalances = async () => { const getAccountBalances = async (_accounts: string[]) => {
setFetching(true); setFetching(true);
try { try {
const arr = await Promise.all( const arr = await Promise.all(
accounts.map(async account => { _accounts.map(async account => {
const [namespace, reference, address] = account.split(":"); const [namespace, reference, address] = account.split(":");
const chainId = `${namespace}:${reference}`; const chainId = `${namespace}:${reference}`;
const assets = await apiGetAccountAssets(address, chainId); const assets = await apiGetAccountAssets(address, chainId);