@sodax/wallet-sdk-react 1.0.0-rc.6 → 1.0.0-rc.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +17 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +17 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/core/XService.ts +1 -1
- package/src/hooks/useXBalances.ts +1 -1
- package/src/xchains/sui/SuiXService.ts +20 -10
package/dist/index.cjs
CHANGED
|
@@ -736,18 +736,27 @@ var SuiXService = class _SuiXService extends XService {
|
|
|
736
736
|
async getBalances(address, xTokens) {
|
|
737
737
|
if (!address) return {};
|
|
738
738
|
try {
|
|
739
|
-
const
|
|
740
|
-
owner: address
|
|
741
|
-
});
|
|
742
|
-
const tokenMap = xTokens.reduce((map, xToken) => {
|
|
739
|
+
const balancePromises = xTokens.map(async (xToken) => {
|
|
743
740
|
let coinType = isNativeToken(xToken) ? "0x2::sui::SUI" : xToken.address;
|
|
744
741
|
if (coinType === "0x03917a812fe4a6d6bc779c5ab53f8a80ba741f8af04121193fc44e0f662e2ceb::balanced_dollar::BALANCED_DOLLAR") {
|
|
745
742
|
coinType = "0x3917a812fe4a6d6bc779c5ab53f8a80ba741f8af04121193fc44e0f662e2ceb::balanced_dollar::BALANCED_DOLLAR";
|
|
746
743
|
}
|
|
747
|
-
const balance =
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
744
|
+
const balance = await this.suiClient.getBalance({
|
|
745
|
+
owner: address,
|
|
746
|
+
coinType
|
|
747
|
+
});
|
|
748
|
+
return {
|
|
749
|
+
address: xToken.address,
|
|
750
|
+
balance: balance ? BigInt(balance.totalBalance) : void 0
|
|
751
|
+
};
|
|
752
|
+
});
|
|
753
|
+
const results = await Promise.all(balancePromises);
|
|
754
|
+
const tokenMap = {};
|
|
755
|
+
results.forEach((result) => {
|
|
756
|
+
if (result.balance !== void 0) {
|
|
757
|
+
tokenMap[result.address] = result.balance;
|
|
758
|
+
}
|
|
759
|
+
});
|
|
751
760
|
return tokenMap;
|
|
752
761
|
} catch (e) {
|
|
753
762
|
console.log("error", e);
|