@rango-dev/widget-embedded 0.41.0 → 0.41.1-next.1
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/CHANGELOG.md +16 -0
- package/dist/hooks/useSubscribeToWidgetEvents/useSubscribeToWidgetEvents.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +2 -2
- package/dist/store/slices/wallets.d.ts.map +1 -1
- package/dist/widget-embedded.build.json +1 -1
- package/package.json +2 -2
- package/src/hooks/useSubscribeToWidgetEvents/useSubscribeToWidgetEvents.ts +22 -18
- package/src/store/slices/wallets.ts +4 -3
package/package.json
CHANGED
|
@@ -28,28 +28,32 @@ export function useSubscribeToWidgetEvents() {
|
|
|
28
28
|
|
|
29
29
|
if (shouldRefetchBalance) {
|
|
30
30
|
const fromWallet = route.wallets[step?.fromBlockchain];
|
|
31
|
-
|
|
32
|
-
(
|
|
33
|
-
connectedWallet
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
if (fromWallet) {
|
|
32
|
+
const fromAccount = connectedWallets.find(
|
|
33
|
+
(connectedWallet) =>
|
|
34
|
+
connectedWallet.address?.toLocaleLowerCase() ===
|
|
35
|
+
fromWallet.address?.toLocaleLowerCase() &&
|
|
36
|
+
connectedWallet.walletType === fromWallet.walletType &&
|
|
37
|
+
connectedWallet.chain === step?.fromBlockchain
|
|
38
|
+
);
|
|
39
|
+
if (fromAccount) {
|
|
40
|
+
void fetchBalances([fromAccount]);
|
|
41
|
+
}
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
if (step?.fromBlockchain !== step?.toBlockchain) {
|
|
43
45
|
const toWallet = route.wallets[step?.toBlockchain];
|
|
44
|
-
|
|
45
|
-
(
|
|
46
|
-
connectedWallet
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
if (toWallet) {
|
|
47
|
+
const toAccount = connectedWallets.find(
|
|
48
|
+
(connectedWallet) =>
|
|
49
|
+
connectedWallet.address?.toLocaleLowerCase() ===
|
|
50
|
+
toWallet.address?.toLocaleLowerCase() &&
|
|
51
|
+
connectedWallet.walletType === toWallet.walletType &&
|
|
52
|
+
connectedWallet.chain === step?.toBlockchain
|
|
53
|
+
);
|
|
54
|
+
if (toAccount) {
|
|
55
|
+
void fetchBalances([toAccount]);
|
|
56
|
+
}
|
|
53
57
|
}
|
|
54
58
|
}
|
|
55
59
|
}
|
|
@@ -641,7 +641,8 @@ export const createWalletsSlice = keepLastUpdated<AppStoreState, WalletsSlice>(
|
|
|
641
641
|
response = await httpService().getWalletsDetails(addressesToFetch);
|
|
642
642
|
} catch (e) {
|
|
643
643
|
get().setConnectedWalletHasError(accounts);
|
|
644
|
-
|
|
644
|
+
console.error(`Request for fetching balances failed. cause: ${e}`);
|
|
645
|
+
return;
|
|
645
646
|
}
|
|
646
647
|
|
|
647
648
|
const walletsDetails = response.wallets;
|
|
@@ -720,8 +721,8 @@ export const createWalletsSlice = keepLastUpdated<AppStoreState, WalletsSlice>(
|
|
|
720
721
|
get().setConnectedWalletRetrievedData(accounts, walletsDetails);
|
|
721
722
|
} else {
|
|
722
723
|
get().setConnectedWalletHasError(accounts);
|
|
723
|
-
|
|
724
|
-
|
|
724
|
+
console.error(
|
|
725
|
+
"We couldn't fetch your account balances. Seem there is no information on blockchain for them yet."
|
|
725
726
|
);
|
|
726
727
|
}
|
|
727
728
|
},
|