Skip to content

Commit 81ff5c7

Browse files
committed
hotfix - walletLayer1 balance
1 parent 3a50d63 commit 81ff5c7

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

  • packages/core/src/stores/walletLayer1

packages/core/src/stores/walletLayer1/saga.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,23 @@ const getWalletLayer1Balance = async <R extends { [key: string]: any }>() => {
1515
const { ethBalance } = await LoopringAPI.exchangeAPI.getEthBalances({
1616
owner: accAddress,
1717
});
18-
const { tokenBalances } = await LoopringAPI.exchangeAPI.getTokenBalances({
19-
owner: accAddress,
20-
token: Reflect.ownKeys(tokenMap).map(
21-
(ele) => tokenMap[ele as string].address
22-
), // marketCoins.join(),
23-
});
18+
const tokenArray2 = Reflect.ownKeys(tokenMap);
19+
const tokenArray1 = tokenArray2.splice(0, tokenArray2.length / 2);
20+
const [
21+
{ tokenBalances: tokenBalances1 },
22+
{ tokenBalances: tokenBalances2 },
23+
] = await Promise.all([
24+
LoopringAPI.exchangeAPI.getTokenBalances({
25+
owner: accAddress,
26+
token: tokenArray1.map((ele) => tokenMap[ele as string].address), // marketCoins.join(),
27+
}),
28+
LoopringAPI.exchangeAPI.getTokenBalances({
29+
owner: accAddress,
30+
token: tokenArray2.map((ele) => tokenMap[ele as string].address), // marketCoins.join(),
31+
}),
32+
]);
33+
var tokenBalances = new Map([...tokenBalances1, ...tokenBalances2]);
34+
2435
tokenBalances.set(
2536
tokenMap["ETH"].address as unknown as sdk.TokenAddress,
2637
ethBalance

0 commit comments

Comments
 (0)