@embarkai/ui-kit 0.4.64 → 0.4.65
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/iframe/index.html +1 -1
- package/dist/iframe/main.js +1 -1
- package/dist/index.cjs +308 -308
- package/dist/index.d.cts +20 -4
- package/dist/index.d.ts +20 -4
- package/dist/index.js +157 -160
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -831,7 +831,7 @@ var init_iframe_mpc_client = __esm({
|
|
|
831
831
|
|
|
832
832
|
// src/internal/constants.ts
|
|
833
833
|
import { Key, Mail, Wallet2 } from "lucide-react";
|
|
834
|
-
var LOCAL_COLOR_MODE_KEY, LOOCAL_BACKUP_STATUS_KEY, DEFAULT_AUTH_MENU_HEIGHT, DEFAULT_MAIN_MENU_HEIGHT, MAX_CONTENT_HEIGHT, MAIN_DIALOG_ANIMATION_SPEED, Y_ANIMATION_SETUP, BLOCKSCOUT_QUERY_STALE_TIME, BLOCKSCOUT_QUERY_GC_TIME, BLOCKSCOUT_REFRESH_DEBOUNCE, IPFS_GATEWAY, PROVIDERS_META
|
|
834
|
+
var LOCAL_COLOR_MODE_KEY, LOOCAL_BACKUP_STATUS_KEY, DEFAULT_AUTH_MENU_HEIGHT, DEFAULT_MAIN_MENU_HEIGHT, MAX_CONTENT_HEIGHT, MAIN_DIALOG_ANIMATION_SPEED, Y_ANIMATION_SETUP, BLOCKSCOUT_QUERY_STALE_TIME, BLOCKSCOUT_QUERY_GC_TIME, BLOCKSCOUT_REFRESH_DEBOUNCE, IPFS_GATEWAY, PROVIDERS_META;
|
|
835
835
|
var init_constants = __esm({
|
|
836
836
|
"src/internal/constants.ts"() {
|
|
837
837
|
init_assets();
|
|
@@ -857,7 +857,6 @@ var init_constants = __esm({
|
|
|
857
857
|
// Alias for twitter (API uses 'x')
|
|
858
858
|
wallet: { name: "Wallet", icon: Wallet2, description: "External wallet (EOA)" }
|
|
859
859
|
};
|
|
860
|
-
WRAPPED_TOKENS = ["WETH", "WBTC", "WBNB", "WLUMIA"];
|
|
861
860
|
}
|
|
862
861
|
});
|
|
863
862
|
|
|
@@ -933,22 +932,61 @@ var init_useLayoutDataStore = __esm({
|
|
|
933
932
|
}
|
|
934
933
|
});
|
|
935
934
|
|
|
935
|
+
// src/internal/components/BalanceFeedProvider/constants.ts
|
|
936
|
+
var BALANCE_POLLING_INTERVAL, NATIVE_BALANCE_QUERY_KEY, CUSTOM_BALANCE_QUERY_KEY, ASSET_RATE_QUERY_KEY, SKIP_SYMBOLS, WRAPPED_TOKENS;
|
|
937
|
+
var init_constants2 = __esm({
|
|
938
|
+
"src/internal/components/BalanceFeedProvider/constants.ts"() {
|
|
939
|
+
BALANCE_POLLING_INTERVAL = 3e4;
|
|
940
|
+
NATIVE_BALANCE_QUERY_KEY = "embarkai-native-balance-query-key";
|
|
941
|
+
CUSTOM_BALANCE_QUERY_KEY = "embarkai-custom-balance-query-key";
|
|
942
|
+
ASSET_RATE_QUERY_KEY = "embarkai-asset-rate-query-key";
|
|
943
|
+
SKIP_SYMBOLS = ["TEST", "USDT", "P", "$P USDT"];
|
|
944
|
+
WRAPPED_TOKENS = {
|
|
945
|
+
WETH: "ETH"
|
|
946
|
+
};
|
|
947
|
+
}
|
|
948
|
+
});
|
|
949
|
+
|
|
950
|
+
// src/internal/components/BalanceFeedProvider/useAssetRate.ts
|
|
951
|
+
import { useQuery } from "@tanstack/react-query";
|
|
952
|
+
function checkWrapedTokenSymbol(symbol) {
|
|
953
|
+
return WRAPPED_TOKENS[symbol] || symbol;
|
|
954
|
+
}
|
|
955
|
+
async function getAssetRate(symbol, asSymbol) {
|
|
956
|
+
const asTarget = asSymbol || "USDT";
|
|
957
|
+
if (SKIP_SYMBOLS.includes(symbol) || symbol === asTarget) return { symbol, price: "1" };
|
|
958
|
+
const apiTicker = `${checkWrapedTokenSymbol(symbol)}${asTarget}`;
|
|
959
|
+
return await fetch(`${ASSET_API_URL}?symbol=${apiTicker}`).then(async (res) => await res.json()).catch((err) => {
|
|
960
|
+
console.warn("[ASSET RATE] Failed & fallbacked to price 1:", { symbol: apiTicker, error: err });
|
|
961
|
+
return { symbol, price: "1" };
|
|
962
|
+
});
|
|
963
|
+
}
|
|
964
|
+
function useAssetUsdtRate(assetSymbol, options) {
|
|
965
|
+
const { refetchInterval, staleTime } = options || {};
|
|
966
|
+
const address = useSession((st) => st.address);
|
|
967
|
+
return useQuery({
|
|
968
|
+
queryKey: [ASSET_RATE_QUERY_KEY, address, assetSymbol],
|
|
969
|
+
enabled: !!address && !!assetSymbol,
|
|
970
|
+
refetchInterval: refetchInterval || BALANCE_POLLING_INTERVAL * 2,
|
|
971
|
+
staleTime: staleTime || BALANCE_POLLING_INTERVAL * 2,
|
|
972
|
+
// keeps the data fresh for 1 minute before considering it stale
|
|
973
|
+
queryFn: async () => await getAssetRate(assetSymbol)
|
|
974
|
+
});
|
|
975
|
+
}
|
|
976
|
+
var ASSET_API_URL;
|
|
977
|
+
var init_useAssetRate = __esm({
|
|
978
|
+
"src/internal/components/BalanceFeedProvider/useAssetRate.ts"() {
|
|
979
|
+
init_SessionContext();
|
|
980
|
+
init_constants2();
|
|
981
|
+
ASSET_API_URL = "https://api.binance.com/api/v3/ticker/price";
|
|
982
|
+
}
|
|
983
|
+
});
|
|
984
|
+
|
|
936
985
|
// src/internal/components/BalanceFeedProvider/BalanceFeedProvider.tsx
|
|
937
986
|
import { NON_BLOCKSCOUT_CORE_TOKENS } from "@embarkai/core/read";
|
|
938
|
-
import { useQuery } from "@tanstack/react-query";
|
|
987
|
+
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
939
988
|
import { useEffect, useState } from "react";
|
|
940
989
|
import { erc20Abi, formatUnits } from "viem";
|
|
941
|
-
async function getAssetRate(symbol = "LUMIA", fiat = "USDT") {
|
|
942
|
-
if (SKIP_SYMBOLS.includes(symbol) || symbol === fiat) return { symbol, price: "1" };
|
|
943
|
-
try {
|
|
944
|
-
const assetURL = `https://api.binance.com/api/v3/ticker/price?symbol=${symbol.toUpperCase()}${fiat.toUpperCase()}`;
|
|
945
|
-
const response = await fetch(assetURL);
|
|
946
|
-
return await response.json();
|
|
947
|
-
} catch (err) {
|
|
948
|
-
console.warn("[BALANCE FEED] Failed to fetch asset rate:", { symbol, fiat, error: err });
|
|
949
|
-
return { symbol, price: "1" };
|
|
950
|
-
}
|
|
951
|
-
}
|
|
952
990
|
function BalanceFeedProvider() {
|
|
953
991
|
const config = useProviderConfig().config;
|
|
954
992
|
const address = useSession((st) => st.address);
|
|
@@ -963,14 +1001,9 @@ function BalanceFeedProvider() {
|
|
|
963
1001
|
() => useLayoutDataStore.getState().setCryptoSymbol(chainConfig?.nativeCurrency?.symbol || "LUMIA"),
|
|
964
1002
|
[chainConfig]
|
|
965
1003
|
);
|
|
966
|
-
const { data: cryptoRate } =
|
|
967
|
-
queryKey: [LUMIA_RATE_QUERY_KEY, address, balanceSymbol],
|
|
968
|
-
enabled: !!address && !!balanceSymbol,
|
|
969
|
-
refetchInterval: BALANCE_POLLING_INTERVAL * 2,
|
|
970
|
-
queryFn: async () => await getAssetRate(balanceSymbol, "USDT")
|
|
971
|
-
});
|
|
1004
|
+
const { data: cryptoRate } = useAssetUsdtRate(balanceSymbol);
|
|
972
1005
|
const isNativeBalanceFeedEnabled = !!balanceSymbol && !!chainConfig?.nativeCurrency.symbol && balanceSymbol === chainConfig?.nativeCurrency.symbol;
|
|
973
|
-
const { data: nativeBalance } =
|
|
1006
|
+
const { data: nativeBalance } = useQuery2({
|
|
974
1007
|
enabled: !!isNativeBalanceFeedEnabled && !!address && !!publicClient,
|
|
975
1008
|
retry: false,
|
|
976
1009
|
refetchInterval: BALANCE_POLLING_INTERVAL,
|
|
@@ -1004,7 +1037,7 @@ function BalanceFeedProvider() {
|
|
|
1004
1037
|
symbol: projectAssetAssetSymbol
|
|
1005
1038
|
} = config.current?.projectAssets?.assets?.find((a) => a.symbol === config.current?.showBalanceAs) || {};
|
|
1006
1039
|
const isProjectAssetBalanceEnabled = !!balanceSymbol && !!projectAssetAssetSymbol && balanceSymbol === projectAssetAssetSymbol;
|
|
1007
|
-
const { data: projectAssetBalance } =
|
|
1040
|
+
const { data: projectAssetBalance } = useQuery2({
|
|
1008
1041
|
retry: false,
|
|
1009
1042
|
refetchInterval: BALANCE_POLLING_INTERVAL,
|
|
1010
1043
|
enabled: !!address && !!isProjectAssetBalanceEnabled,
|
|
@@ -1028,7 +1061,7 @@ function BalanceFeedProvider() {
|
|
|
1028
1061
|
});
|
|
1029
1062
|
}, [isProjectAssetBalanceEnabled, projectAssetBalance]);
|
|
1030
1063
|
const isCustomAssetBalanceEnabled = !isNativeBalanceFeedEnabled && !isProjectAssetBalanceEnabled;
|
|
1031
|
-
const { data: customBalance } =
|
|
1064
|
+
const { data: customBalance } = useQuery2({
|
|
1032
1065
|
enabled: !!isCustomAssetBalanceEnabled && !!balanceSymbol && !!chainConfig?.id && !!address && !!publicClient,
|
|
1033
1066
|
retry: false,
|
|
1034
1067
|
refetchInterval: BALANCE_POLLING_INTERVAL,
|
|
@@ -1076,17 +1109,13 @@ function BalanceFeedProvider() {
|
|
|
1076
1109
|
}, [isCustomAssetBalanceEnabled, customBalance, cryptoRate]);
|
|
1077
1110
|
return null;
|
|
1078
1111
|
}
|
|
1079
|
-
var BALANCE_POLLING_INTERVAL, NATIVE_BALANCE_QUERY_KEY, CUSTOM_BALANCE_QUERY_KEY, LUMIA_RATE_QUERY_KEY, SKIP_SYMBOLS;
|
|
1080
1112
|
var init_BalanceFeedProvider = __esm({
|
|
1081
1113
|
"src/internal/components/BalanceFeedProvider/BalanceFeedProvider.tsx"() {
|
|
1082
1114
|
init_ProviderContext();
|
|
1083
1115
|
init_SessionContext();
|
|
1084
1116
|
init_useLayoutDataStore();
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
CUSTOM_BALANCE_QUERY_KEY = "embarkai-custom-balance-query-key";
|
|
1088
|
-
LUMIA_RATE_QUERY_KEY = "lembarkai-root-balance-rate-query-key";
|
|
1089
|
-
SKIP_SYMBOLS = ["TEST", "USDT", "P", "$P USDT"];
|
|
1117
|
+
init_constants2();
|
|
1118
|
+
init_useAssetRate();
|
|
1090
1119
|
}
|
|
1091
1120
|
});
|
|
1092
1121
|
|
|
@@ -1094,12 +1123,13 @@ var init_BalanceFeedProvider = __esm({
|
|
|
1094
1123
|
var init_BalanceFeedProvider2 = __esm({
|
|
1095
1124
|
"src/internal/components/BalanceFeedProvider/index.ts"() {
|
|
1096
1125
|
init_BalanceFeedProvider();
|
|
1126
|
+
init_useAssetRate();
|
|
1097
1127
|
}
|
|
1098
1128
|
});
|
|
1099
1129
|
|
|
1100
1130
|
// src/internal/clients/account/constants.ts
|
|
1101
1131
|
var PAYMASTER_VERIFICATION_GAS_LIMIT, PAYMASTER_POSTOP_GAS_LIMIT, MAX_BUNDLER_VERIFICATION_GAS, PAYMASTER_VERIFICATION_GAS, PAYMASTER_POSTOP_GAS, SALT_ZERO, SALT_ZERO_UINT256, COMPAT_CREATE_ABI, executeAbi, executeBatchAbi, entryPointDepositAbi;
|
|
1102
|
-
var
|
|
1132
|
+
var init_constants3 = __esm({
|
|
1103
1133
|
"src/internal/clients/account/constants.ts"() {
|
|
1104
1134
|
PAYMASTER_VERIFICATION_GAS_LIMIT = "0x249f0";
|
|
1105
1135
|
PAYMASTER_POSTOP_GAS_LIMIT = "0x186a0";
|
|
@@ -1342,7 +1372,7 @@ var init_ChainSync = __esm({
|
|
|
1342
1372
|
init_ProviderContext();
|
|
1343
1373
|
init_SessionContext();
|
|
1344
1374
|
init_auth();
|
|
1345
|
-
|
|
1375
|
+
init_constants3();
|
|
1346
1376
|
init_helpers();
|
|
1347
1377
|
init_useLayoutDataStore();
|
|
1348
1378
|
init_vaultClient();
|
|
@@ -1515,7 +1545,7 @@ async function createAccountSession(params) {
|
|
|
1515
1545
|
var init_session = __esm({
|
|
1516
1546
|
"src/internal/clients/account/session.ts"() {
|
|
1517
1547
|
init_iframe_mpc_client();
|
|
1518
|
-
|
|
1548
|
+
init_constants3();
|
|
1519
1549
|
init_helpers();
|
|
1520
1550
|
init_register_smart_account_address();
|
|
1521
1551
|
}
|
|
@@ -1822,7 +1852,7 @@ var init_user_operations = __esm({
|
|
|
1822
1852
|
init_SessionContext();
|
|
1823
1853
|
init_akHelpers();
|
|
1824
1854
|
init_iframe_mpc_client();
|
|
1825
|
-
|
|
1855
|
+
init_constants3();
|
|
1826
1856
|
init_helpers();
|
|
1827
1857
|
init_resolve_paymaster();
|
|
1828
1858
|
}
|
|
@@ -1988,14 +2018,14 @@ var init_deposit_for_smart_account = __esm({
|
|
|
1988
2018
|
"src/internal/clients/account/deposit-for-smart-account.ts"() {
|
|
1989
2019
|
init_SessionContext();
|
|
1990
2020
|
init_base2();
|
|
1991
|
-
|
|
2021
|
+
init_constants3();
|
|
1992
2022
|
}
|
|
1993
2023
|
});
|
|
1994
2024
|
|
|
1995
2025
|
// src/internal/clients/account/index.ts
|
|
1996
2026
|
var init_account = __esm({
|
|
1997
2027
|
"src/internal/clients/account/index.ts"() {
|
|
1998
|
-
|
|
2028
|
+
init_constants3();
|
|
1999
2029
|
init_session();
|
|
2000
2030
|
init_user_operations();
|
|
2001
2031
|
init_signing();
|
|
@@ -6465,7 +6495,7 @@ var init_zh = __esm({
|
|
|
6465
6495
|
|
|
6466
6496
|
// src/i18n/constants.ts
|
|
6467
6497
|
var PASSPORT_TRANSLATIONS, PASSPORT_NAMESPACE, LOCAL_STORAGE_I18N_KEY;
|
|
6468
|
-
var
|
|
6498
|
+
var init_constants4 = __esm({
|
|
6469
6499
|
"src/i18n/constants.ts"() {
|
|
6470
6500
|
init_en();
|
|
6471
6501
|
init_ru();
|
|
@@ -6599,14 +6629,14 @@ function useT() {
|
|
|
6599
6629
|
}
|
|
6600
6630
|
var init_useT = __esm({
|
|
6601
6631
|
"src/i18n/useT.ts"() {
|
|
6602
|
-
|
|
6632
|
+
init_constants4();
|
|
6603
6633
|
}
|
|
6604
6634
|
});
|
|
6605
6635
|
|
|
6606
6636
|
// src/i18n/index.ts
|
|
6607
6637
|
var init_i18n = __esm({
|
|
6608
6638
|
"src/i18n/index.ts"() {
|
|
6609
|
-
|
|
6639
|
+
init_constants4();
|
|
6610
6640
|
init_languages();
|
|
6611
6641
|
init_utils3();
|
|
6612
6642
|
init_useT();
|
|
@@ -7752,7 +7782,7 @@ var init_SignInStep2 = __esm({
|
|
|
7752
7782
|
|
|
7753
7783
|
// src/internal/components/KeyshareRestoreMenu/constants.ts
|
|
7754
7784
|
var AVAILABLE_CLOUD_PROVIDERS_QUERY_KEY, CHECK_BACKUP_QUERY_KEY;
|
|
7755
|
-
var
|
|
7785
|
+
var init_constants5 = __esm({
|
|
7756
7786
|
"src/internal/components/KeyshareRestoreMenu/constants.ts"() {
|
|
7757
7787
|
AVAILABLE_CLOUD_PROVIDERS_QUERY_KEY = "get-available-cloud-providers-query";
|
|
7758
7788
|
CHECK_BACKUP_QUERY_KEY = "check-backup-availability-query";
|
|
@@ -7942,7 +7972,7 @@ var init_useAuthMenuHanders = __esm({
|
|
|
7942
7972
|
init_auth();
|
|
7943
7973
|
init_useLayoutDataStore();
|
|
7944
7974
|
init_useLayoutStore();
|
|
7945
|
-
|
|
7975
|
+
init_constants5();
|
|
7946
7976
|
init_useAuthStore();
|
|
7947
7977
|
}
|
|
7948
7978
|
});
|
|
@@ -10109,7 +10139,7 @@ var init_utils6 = __esm({
|
|
|
10109
10139
|
});
|
|
10110
10140
|
|
|
10111
10141
|
// src/internal/components/BuyMenu/binance/Binance.tsx
|
|
10112
|
-
import { useMutation as useMutation6, useQuery as
|
|
10142
|
+
import { useMutation as useMutation6, useQuery as useQuery3, useQueryClient as useQueryClient5 } from "@tanstack/react-query";
|
|
10113
10143
|
import { LoaderIcon as LoaderIcon3 } from "lucide-react";
|
|
10114
10144
|
import { useEffect as useEffect15 } from "react";
|
|
10115
10145
|
import { Fragment as Fragment11, jsx as jsx40, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
@@ -10138,13 +10168,13 @@ function Binance() {
|
|
|
10138
10168
|
useBuyMenuStore.getState().setRenderKey(`${selectedCrypto}-${selectedFiat}-${Date.now()}`);
|
|
10139
10169
|
}, [isCurrurenciesSelected]);
|
|
10140
10170
|
useBinanceSseTxTracing(walletAddress);
|
|
10141
|
-
const { data: tradingPairsData, isLoading: isTradingPairsLoading } =
|
|
10171
|
+
const { data: tradingPairsData, isLoading: isTradingPairsLoading } = useQuery3({
|
|
10142
10172
|
retry: false,
|
|
10143
10173
|
enabled: !!walletAddress,
|
|
10144
10174
|
queryKey: [QUERY_KEYS2.binanceTradingPairs, walletAddress],
|
|
10145
10175
|
queryFn: async () => await getTradingPairsQuery()
|
|
10146
10176
|
});
|
|
10147
|
-
const { data: networksData = null, isLoading: isNetworksDataLoading } =
|
|
10177
|
+
const { data: networksData = null, isLoading: isNetworksDataLoading } = useQuery3({
|
|
10148
10178
|
retry: false,
|
|
10149
10179
|
enabled: !!walletAddress,
|
|
10150
10180
|
queryKey: [QUERY_KEYS2.binanceNetworks, walletAddress],
|
|
@@ -10153,7 +10183,7 @@ function Binance() {
|
|
|
10153
10183
|
const networkAvailableCryptoList = networksData?.data?.filter(
|
|
10154
10184
|
(ntw) => ntw.networks.map((n) => n.network).includes(CHAIN_ID_TO_BINANCE_NETWORK_TICKER[chainConfig.id] || "UNSUPPORTED")
|
|
10155
10185
|
) || [];
|
|
10156
|
-
const { data: paymentModesData = null, isFetching: isPaymentModesLoading } =
|
|
10186
|
+
const { data: paymentModesData = null, isFetching: isPaymentModesLoading } = useQuery3({
|
|
10157
10187
|
retry: false,
|
|
10158
10188
|
enabled: !!walletAddress && !!selectedCrypto && !!selectedFiat,
|
|
10159
10189
|
// && srcQueryAmount > 0,
|
|
@@ -10773,7 +10803,7 @@ var init_utils7 = __esm({
|
|
|
10773
10803
|
});
|
|
10774
10804
|
|
|
10775
10805
|
// src/internal/components/BuyMenu/finchpay/FinchPay.tsx
|
|
10776
|
-
import { useQuery as
|
|
10806
|
+
import { useQuery as useQuery4, useQueryClient as useQueryClient7 } from "@tanstack/react-query";
|
|
10777
10807
|
import { DollarSign, LoaderIcon as LoaderIcon5 } from "lucide-react";
|
|
10778
10808
|
import { useEffect as useEffect17 } from "react";
|
|
10779
10809
|
import { Fragment as Fragment12, jsx as jsx43, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
@@ -10799,7 +10829,7 @@ function FinchPay() {
|
|
|
10799
10829
|
data: currenciesData = { networks: [], coins: [], fiats: [], currentNetworkCoins: [] },
|
|
10800
10830
|
isLoading: isCurrenciesLoading,
|
|
10801
10831
|
error: currenciesError
|
|
10802
|
-
} =
|
|
10832
|
+
} = useQuery4({
|
|
10803
10833
|
retry: false,
|
|
10804
10834
|
enabled: !!walletAddress,
|
|
10805
10835
|
queryKey: [QUERY_KEYS2.finchPayCurrencies, walletAddress],
|
|
@@ -10840,7 +10870,7 @@ function FinchPay() {
|
|
|
10840
10870
|
data: limitsData,
|
|
10841
10871
|
isLoading: isLimitsLoading,
|
|
10842
10872
|
error: limitsError
|
|
10843
|
-
} =
|
|
10873
|
+
} = useQuery4({
|
|
10844
10874
|
retry: false,
|
|
10845
10875
|
enabled: !!walletAddress && !!selectedFiat && !!selectedCryptoMeta?.ticker,
|
|
10846
10876
|
queryKey: [QUERY_KEYS2.finchPayLimits, selectedFiat || null, selectedCryptoMeta?.ticker || null],
|
|
@@ -10863,7 +10893,7 @@ function FinchPay() {
|
|
|
10863
10893
|
data: estimateData = null,
|
|
10864
10894
|
isLoading: isEstimateLoading,
|
|
10865
10895
|
error: estimateError
|
|
10866
|
-
} =
|
|
10896
|
+
} = useQuery4({
|
|
10867
10897
|
retry: false,
|
|
10868
10898
|
enabled: !!selectedCrypto && !!selectedFiat && !!walletAddress && srcQueryAmount > 0 && minimum > 0 && srcQueryAmount >= minimum,
|
|
10869
10899
|
queryKey: [
|
|
@@ -11683,7 +11713,7 @@ var init_ChainItem = __esm({
|
|
|
11683
11713
|
// src/internal/components/ChainsMenu/ChainsMenu.tsx
|
|
11684
11714
|
import { PAYMASTER_CACHE_TTL_MS } from "@embarkai/core";
|
|
11685
11715
|
import { getChainConfig as getChainConfig8, SUPPORTED_MAINNETS as SUPPORTED_MAINNETS2 } from "@embarkai/core/read";
|
|
11686
|
-
import { useQuery as
|
|
11716
|
+
import { useQuery as useQuery5 } from "@tanstack/react-query";
|
|
11687
11717
|
import { ArrowLeft as ArrowLeft4 } from "lucide-react";
|
|
11688
11718
|
import { useMemo as useMemo5, useState as useState9 } from "react";
|
|
11689
11719
|
import { jsx as jsx53, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
@@ -11700,7 +11730,7 @@ function ChainsMenu() {
|
|
|
11700
11730
|
);
|
|
11701
11731
|
}, [isTestnets]);
|
|
11702
11732
|
const activeDefaultPaymasterAddress = getChainConfig8(activeChainId)?.paymasterAddress;
|
|
11703
|
-
const { data: activePaymasterData, isLoading: isActivePaymasterDataLoading } =
|
|
11733
|
+
const { data: activePaymasterData, isLoading: isActivePaymasterDataLoading } = useQuery5({
|
|
11704
11734
|
queryKey: ["chain-paymaster", config.current.projectId, activeChainId],
|
|
11705
11735
|
queryFn: async () => {
|
|
11706
11736
|
if (!activeChainId) {
|
|
@@ -11882,7 +11912,7 @@ var init_ChainsMenu2 = __esm({
|
|
|
11882
11912
|
});
|
|
11883
11913
|
|
|
11884
11914
|
// src/internal/clients/devices.ts
|
|
11885
|
-
import { useMutation as useMutation8, useQuery as
|
|
11915
|
+
import { useMutation as useMutation8, useQuery as useQuery6, useQueryClient as useQueryClient8 } from "@tanstack/react-query";
|
|
11886
11916
|
async function getDevices() {
|
|
11887
11917
|
const response = await tssClient.get("/api/auth/devices", true);
|
|
11888
11918
|
if (!response.success || !response.data) {
|
|
@@ -11908,7 +11938,7 @@ async function unlinkDevice(deviceId) {
|
|
|
11908
11938
|
}
|
|
11909
11939
|
}
|
|
11910
11940
|
function useDevices() {
|
|
11911
|
-
return
|
|
11941
|
+
return useQuery6({
|
|
11912
11942
|
queryKey: [DEVICES_QUERY_KEY],
|
|
11913
11943
|
queryFn: getDevices
|
|
11914
11944
|
});
|
|
@@ -13881,7 +13911,7 @@ var init_useCreateBackup = __esm({
|
|
|
13881
13911
|
init_auth();
|
|
13882
13912
|
init_useLayoutStore();
|
|
13883
13913
|
init_iframe_manager();
|
|
13884
|
-
|
|
13914
|
+
init_constants5();
|
|
13885
13915
|
init_hooks();
|
|
13886
13916
|
}
|
|
13887
13917
|
});
|
|
@@ -14547,7 +14577,7 @@ var init_Server = __esm({
|
|
|
14547
14577
|
init_icons();
|
|
14548
14578
|
init_highlight();
|
|
14549
14579
|
init_PasswordPasskey();
|
|
14550
|
-
|
|
14580
|
+
init_constants5();
|
|
14551
14581
|
init_hooks();
|
|
14552
14582
|
}
|
|
14553
14583
|
});
|
|
@@ -14686,7 +14716,7 @@ var init_select = __esm({
|
|
|
14686
14716
|
});
|
|
14687
14717
|
|
|
14688
14718
|
// src/internal/components/KeyshareRestoreMenu/methods/Cloud.tsx
|
|
14689
|
-
import { useQuery as
|
|
14719
|
+
import { useQuery as useQuery7 } from "@tanstack/react-query";
|
|
14690
14720
|
import { ArrowLeft as ArrowLeft10, CloudDownload, CloudUpload, Loader as Loader9 } from "lucide-react";
|
|
14691
14721
|
import { useEffect as useEffect24 } from "react";
|
|
14692
14722
|
import { Fragment as Fragment22, jsx as jsx65, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
@@ -14699,7 +14729,7 @@ function Cloud2(props) {
|
|
|
14699
14729
|
data: cloudProviders = [],
|
|
14700
14730
|
isLoading: isCloudProvidersLoading,
|
|
14701
14731
|
error: cloudProvidersError
|
|
14702
|
-
} =
|
|
14732
|
+
} = useQuery7({
|
|
14703
14733
|
retry: false,
|
|
14704
14734
|
enabled: !!passportUserId,
|
|
14705
14735
|
queryKey: [AVAILABLE_CLOUD_PROVIDERS_QUERY_KEY, passportUserId],
|
|
@@ -14779,7 +14809,7 @@ var init_Cloud = __esm({
|
|
|
14779
14809
|
init_button();
|
|
14780
14810
|
init_select();
|
|
14781
14811
|
init_PasswordPasskey();
|
|
14782
|
-
|
|
14812
|
+
init_constants5();
|
|
14783
14813
|
init_useRestoreStore();
|
|
14784
14814
|
}
|
|
14785
14815
|
});
|
|
@@ -14947,7 +14977,7 @@ var init_methods = __esm({
|
|
|
14947
14977
|
});
|
|
14948
14978
|
|
|
14949
14979
|
// src/internal/components/KeyshareRestoreMenu/KeyshareRestoreMenu.tsx
|
|
14950
|
-
import { useMutation as useMutation11, useQuery as
|
|
14980
|
+
import { useMutation as useMutation11, useQuery as useQuery8, useQueryClient as useQueryClient11 } from "@tanstack/react-query";
|
|
14951
14981
|
import { AlertCircle as AlertCircle2, CheckCircle2, CloudDownload as CloudDownload2, Loader as Loader10, UserCircle as UserCircle2 } from "lucide-react";
|
|
14952
14982
|
import { useEffect as useEffect25 } from "react";
|
|
14953
14983
|
import { useDisconnect } from "wagmi";
|
|
@@ -14967,7 +14997,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
14967
14997
|
init_highlight();
|
|
14968
14998
|
init_switch();
|
|
14969
14999
|
init_components2();
|
|
14970
|
-
|
|
15000
|
+
init_constants5();
|
|
14971
15001
|
init_hooks();
|
|
14972
15002
|
init_useOnRestoreSuccess();
|
|
14973
15003
|
init_methods();
|
|
@@ -15020,7 +15050,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
15020
15050
|
restoreFromCloud,
|
|
15021
15051
|
isRestoringFromCloud
|
|
15022
15052
|
} = useRestoreAccount();
|
|
15023
|
-
const { data: serverRecoveryStatus, isLoading: isBackupStatusLoading } =
|
|
15053
|
+
const { data: serverRecoveryStatus, isLoading: isBackupStatusLoading } = useQuery8({
|
|
15024
15054
|
retry: false,
|
|
15025
15055
|
queryKey: [CHECK_BACKUP_QUERY_KEY, address],
|
|
15026
15056
|
queryFn: async () => await getShareRecoveryStats()
|
|
@@ -15171,7 +15201,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
15171
15201
|
});
|
|
15172
15202
|
|
|
15173
15203
|
// src/internal/components/KeyshareRestoreMenu/KeyshareBackupMenu.tsx
|
|
15174
|
-
import { useQuery as
|
|
15204
|
+
import { useQuery as useQuery9 } from "@tanstack/react-query";
|
|
15175
15205
|
import { AlertCircle as AlertCircle3, ArrowLeft as ArrowLeft11, CheckCircle2 as CheckCircle22, Loader as Loader11, LockIcon } from "lucide-react";
|
|
15176
15206
|
import { useEffect as useEffect26 } from "react";
|
|
15177
15207
|
import { Fragment as Fragment25, jsx as jsx68, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
@@ -15196,7 +15226,7 @@ function KeyshareBackupMenu() {
|
|
|
15196
15226
|
setMethod(null);
|
|
15197
15227
|
};
|
|
15198
15228
|
}, []);
|
|
15199
|
-
const { data: serverRecoveryStatus, isLoading: isRecoveryLoading } =
|
|
15229
|
+
const { data: serverRecoveryStatus, isLoading: isRecoveryLoading } = useQuery9({
|
|
15200
15230
|
retry: false,
|
|
15201
15231
|
enabled: !!address,
|
|
15202
15232
|
queryKey: [CHECK_BACKUP_QUERY_KEY, address],
|
|
@@ -15335,7 +15365,7 @@ var init_KeyshareBackupMenu = __esm({
|
|
|
15335
15365
|
init_highlight();
|
|
15336
15366
|
init_switch();
|
|
15337
15367
|
init_components2();
|
|
15338
|
-
|
|
15368
|
+
init_constants5();
|
|
15339
15369
|
init_hooks();
|
|
15340
15370
|
init_methods();
|
|
15341
15371
|
COMPONENTS = {
|
|
@@ -15630,10 +15660,10 @@ var init_KycMenu = __esm({
|
|
|
15630
15660
|
});
|
|
15631
15661
|
|
|
15632
15662
|
// src/internal/hooks/useUserProfile.ts
|
|
15633
|
-
import { useQuery as
|
|
15663
|
+
import { useQuery as useQuery10 } from "@tanstack/react-query";
|
|
15634
15664
|
function useUserProfile() {
|
|
15635
15665
|
const address = useSession((st) => st.address);
|
|
15636
|
-
return
|
|
15666
|
+
return useQuery10({
|
|
15637
15667
|
queryKey: [QUERY_KEYS.userProfile, address],
|
|
15638
15668
|
queryFn: getUserProfile,
|
|
15639
15669
|
enabled: !!address,
|
|
@@ -15793,10 +15823,10 @@ var init_common = __esm({
|
|
|
15793
15823
|
});
|
|
15794
15824
|
|
|
15795
15825
|
// src/internal/components/ManageWalletMenu/hooks/useProvidersList.ts
|
|
15796
|
-
import { useQuery as
|
|
15826
|
+
import { useQuery as useQuery11 } from "@tanstack/react-query";
|
|
15797
15827
|
function useProvidersList() {
|
|
15798
15828
|
const address = useSession((st) => st.address);
|
|
15799
|
-
return
|
|
15829
|
+
return useQuery11({
|
|
15800
15830
|
retry: false,
|
|
15801
15831
|
// hook is invoked on multiple pages to preload cache
|
|
15802
15832
|
enabled: !!address,
|
|
@@ -15867,12 +15897,12 @@ var init_MainMenu2 = __esm({
|
|
|
15867
15897
|
});
|
|
15868
15898
|
|
|
15869
15899
|
// src/modules/linkedProfiles.ts
|
|
15870
|
-
import { useQuery as
|
|
15900
|
+
import { useQuery as useQuery12, useQueryClient as useQueryClient12 } from "@tanstack/react-query";
|
|
15871
15901
|
import { useCallback as useCallback19 } from "react";
|
|
15872
15902
|
function useLinkedProfiles() {
|
|
15873
15903
|
const qc = useQueryClient12();
|
|
15874
15904
|
const address = useSession((st) => st.address);
|
|
15875
|
-
const { data, isFetching, isLoading, error } =
|
|
15905
|
+
const { data, isFetching, isLoading, error } = useQuery12({
|
|
15876
15906
|
retry: false,
|
|
15877
15907
|
enabled: !!address,
|
|
15878
15908
|
queryKey: [LINKED_PROFILES_QUERY_KEY, address],
|
|
@@ -17342,7 +17372,7 @@ var init_NicknameEditForm = __esm({
|
|
|
17342
17372
|
});
|
|
17343
17373
|
|
|
17344
17374
|
// src/internal/components/NicknameMenu/NicknameMenu.tsx
|
|
17345
|
-
import { useQuery as
|
|
17375
|
+
import { useQuery as useQuery13 } from "@tanstack/react-query";
|
|
17346
17376
|
import dayjs4 from "dayjs";
|
|
17347
17377
|
import { ArrowLeft as ArrowLeft15, Info as Info4, Loader as Loader15 } from "lucide-react";
|
|
17348
17378
|
import { jsx as jsx81, jsxs as jsxs75 } from "react/jsx-runtime";
|
|
@@ -17357,7 +17387,7 @@ function NicknameMenu() {
|
|
|
17357
17387
|
data: nicknameInfo,
|
|
17358
17388
|
isLoading: isNicknameInfoLoading,
|
|
17359
17389
|
error: nicknameInfoError
|
|
17360
|
-
} =
|
|
17390
|
+
} = useQuery13({
|
|
17361
17391
|
retry: 1,
|
|
17362
17392
|
enabled: !!address,
|
|
17363
17393
|
queryKey: [QUERY_KEYS.nicknameInfo, address],
|
|
@@ -17510,7 +17540,7 @@ var init_useResolvedPublicClient = __esm({
|
|
|
17510
17540
|
|
|
17511
17541
|
// src/internal/hooks/useBlockscoutAssets/constants.ts
|
|
17512
17542
|
var NATIVE_BALANCE_QUERY_KEY2, WATCH_TOKENS_QUERY_KEY, BLOCKSCOUT_QUERY_KEY, ERC3643_DETECTION_QUERY_KEY, BALANCE_DEFAULT_QUERY_CFG, ERC3643_ABI;
|
|
17513
|
-
var
|
|
17543
|
+
var init_constants6 = __esm({
|
|
17514
17544
|
"src/internal/hooks/useBlockscoutAssets/constants.ts"() {
|
|
17515
17545
|
init_constants();
|
|
17516
17546
|
NATIVE_BALANCE_QUERY_KEY2 = "chain-native-coin-balance-query";
|
|
@@ -17537,11 +17567,11 @@ var init_constants5 = __esm({
|
|
|
17537
17567
|
});
|
|
17538
17568
|
|
|
17539
17569
|
// src/internal/hooks/useBlockscoutAssets/useNativeBalance.ts
|
|
17540
|
-
import { useQuery as
|
|
17570
|
+
import { useQuery as useQuery14 } from "@tanstack/react-query";
|
|
17541
17571
|
import { formatUnits as formatUnits2 } from "viem";
|
|
17542
17572
|
function useNativeBalance(options) {
|
|
17543
17573
|
const { enabled, address, chainId, publicClient, nativeCurrency } = options;
|
|
17544
|
-
return
|
|
17574
|
+
return useQuery14({
|
|
17545
17575
|
enabled: enabled && !!address && !!publicClient && !!nativeCurrency?.symbol,
|
|
17546
17576
|
...BALANCE_DEFAULT_QUERY_CFG,
|
|
17547
17577
|
queryKey: [NATIVE_BALANCE_QUERY_KEY2, chainId, address],
|
|
@@ -17558,12 +17588,12 @@ function useNativeBalance(options) {
|
|
|
17558
17588
|
}
|
|
17559
17589
|
var init_useNativeBalance = __esm({
|
|
17560
17590
|
"src/internal/hooks/useBlockscoutAssets/useNativeBalance.ts"() {
|
|
17561
|
-
|
|
17591
|
+
init_constants6();
|
|
17562
17592
|
}
|
|
17563
17593
|
});
|
|
17564
17594
|
|
|
17565
17595
|
// src/internal/hooks/useBlockscoutAssets/useWatchTokens.ts
|
|
17566
|
-
import { useQuery as
|
|
17596
|
+
import { useQuery as useQuery15 } from "@tanstack/react-query";
|
|
17567
17597
|
import { useMemo as useMemo9 } from "react";
|
|
17568
17598
|
import { erc20Abi as erc20Abi2, formatUnits as formatUnits3 } from "viem";
|
|
17569
17599
|
function useWatchTokens(options) {
|
|
@@ -17574,7 +17604,7 @@ function useWatchTokens(options) {
|
|
|
17574
17604
|
const tokensForChain = chainId ? allWatchTokens?.[chainId] || [] : [];
|
|
17575
17605
|
return tokensForChain;
|
|
17576
17606
|
}, [config, chainId]);
|
|
17577
|
-
return
|
|
17607
|
+
return useQuery15({
|
|
17578
17608
|
enabled: !!publicClient && !!address && enabled && watchTokens.length > 0,
|
|
17579
17609
|
...BALANCE_DEFAULT_QUERY_CFG,
|
|
17580
17610
|
queryKey: [WATCH_TOKENS_QUERY_KEY, chainId, address, watchTokens.map((t) => t.address).join(",")],
|
|
@@ -17640,7 +17670,7 @@ function useWatchTokens(options) {
|
|
|
17640
17670
|
var init_useWatchTokens = __esm({
|
|
17641
17671
|
"src/internal/hooks/useBlockscoutAssets/useWatchTokens.ts"() {
|
|
17642
17672
|
init_ProviderContext();
|
|
17643
|
-
|
|
17673
|
+
init_constants6();
|
|
17644
17674
|
}
|
|
17645
17675
|
});
|
|
17646
17676
|
|
|
@@ -17777,7 +17807,7 @@ var init_utils8 = __esm({
|
|
|
17777
17807
|
|
|
17778
17808
|
// src/internal/hooks/useBlockscoutAssets/useBlockscoutAssets.ts
|
|
17779
17809
|
import { createBlockscoutClient, nonBlockscoutClient } from "@embarkai/core/clients";
|
|
17780
|
-
import { useQuery as
|
|
17810
|
+
import { useQuery as useQuery16, useQueryClient as useQueryClient19 } from "@tanstack/react-query";
|
|
17781
17811
|
import { useCallback as useCallback23, useMemo as useMemo10, useRef as useRef15 } from "react";
|
|
17782
17812
|
function useBlockscoutAssets(options) {
|
|
17783
17813
|
const { address, chainId, enabled = true, detectSecurityTokens = true } = options;
|
|
@@ -17819,7 +17849,7 @@ function useBlockscoutAssets(options) {
|
|
|
17819
17849
|
data: coreTokenBalances = [],
|
|
17820
17850
|
isLoading: coreTokensLoading,
|
|
17821
17851
|
isFetching: coreTokensFetching
|
|
17822
|
-
} =
|
|
17852
|
+
} = useQuery16({
|
|
17823
17853
|
enabled: !!address && enabled && !blockscoutClient && !customTokenBalancesQuery && !customTokenBalancesQueryKey,
|
|
17824
17854
|
...BALANCE_DEFAULT_QUERY_CFG,
|
|
17825
17855
|
queryKey: [`NON-${BLOCKSCOUT_QUERY_KEY}`, resolvedChainId, address],
|
|
@@ -17835,7 +17865,7 @@ function useBlockscoutAssets(options) {
|
|
|
17835
17865
|
data: customItems = [],
|
|
17836
17866
|
isLoading: customLoading,
|
|
17837
17867
|
isFetching: customFetching
|
|
17838
|
-
} =
|
|
17868
|
+
} = useQuery16({
|
|
17839
17869
|
enabled: !!address && enabled && !blockscoutClient && !!customTokenBalancesQuery && !!customTokenBalancesQueryKey,
|
|
17840
17870
|
...BALANCE_DEFAULT_QUERY_CFG,
|
|
17841
17871
|
queryKey: customTokenBalancesQueryKey,
|
|
@@ -17848,7 +17878,7 @@ function useBlockscoutAssets(options) {
|
|
|
17848
17878
|
isFetching: blockscoutFetching,
|
|
17849
17879
|
error: blockscoutError,
|
|
17850
17880
|
dataUpdatedAt
|
|
17851
|
-
} =
|
|
17881
|
+
} = useQuery16({
|
|
17852
17882
|
enabled: !!address && enabled && !!blockscoutClient && !customTokenBalancesQuery && !customTokenBalancesQueryKey,
|
|
17853
17883
|
...BALANCE_DEFAULT_QUERY_CFG,
|
|
17854
17884
|
queryKey: [BLOCKSCOUT_QUERY_KEY, resolvedChainId, blockscoutApiUrl, address],
|
|
@@ -17859,7 +17889,7 @@ function useBlockscoutAssets(options) {
|
|
|
17859
17889
|
data: nftItems,
|
|
17860
17890
|
isLoading: nftsLoading,
|
|
17861
17891
|
isFetching: nftsFetching
|
|
17862
|
-
} =
|
|
17892
|
+
} = useQuery16({
|
|
17863
17893
|
enabled: !!address && enabled && !!blockscoutClient,
|
|
17864
17894
|
...BALANCE_DEFAULT_QUERY_CFG,
|
|
17865
17895
|
queryKey: [BLOCKSCOUT_QUERY_KEY, "nfts", resolvedChainId, blockscoutApiUrl, address],
|
|
@@ -17869,7 +17899,7 @@ function useBlockscoutAssets(options) {
|
|
|
17869
17899
|
if (!blockscoutItems) return [];
|
|
17870
17900
|
return blockscoutItems.filter((tb) => tb.token.type === "ERC-20").map((tb) => tb.token.address_hash);
|
|
17871
17901
|
}, [blockscoutItems]);
|
|
17872
|
-
const { data: erc3643Results } =
|
|
17902
|
+
const { data: erc3643Results } = useQuery16({
|
|
17873
17903
|
queryKey: [ERC3643_DETECTION_QUERY_KEY, resolvedChainId, address, erc20TokenAddresses],
|
|
17874
17904
|
queryFn: async () => {
|
|
17875
17905
|
if (!publicClient || erc20TokenAddresses.length === 0) {
|
|
@@ -18057,7 +18087,7 @@ var init_useBlockscoutAssets = __esm({
|
|
|
18057
18087
|
init_initial();
|
|
18058
18088
|
init_constants();
|
|
18059
18089
|
init_useResolvedPublicClient();
|
|
18060
|
-
|
|
18090
|
+
init_constants6();
|
|
18061
18091
|
init_useNativeBalance();
|
|
18062
18092
|
init_useWatchTokens();
|
|
18063
18093
|
init_utils8();
|
|
@@ -18144,7 +18174,7 @@ var init_BalanceView2 = __esm({
|
|
|
18144
18174
|
});
|
|
18145
18175
|
|
|
18146
18176
|
// src/internal/components/PortfolioMenu/PortfolioItem.tsx
|
|
18147
|
-
import { useQuery as
|
|
18177
|
+
import { useQuery as useQuery17 } from "@tanstack/react-query";
|
|
18148
18178
|
import { LoaderIcon as LoaderIcon8, ShieldAlertIcon, SparklesIcon } from "lucide-react";
|
|
18149
18179
|
import { formatUnits as formatUnits6 } from "viem";
|
|
18150
18180
|
import { Fragment as Fragment30, jsx as jsx83, jsxs as jsxs77 } from "react/jsx-runtime";
|
|
@@ -18166,34 +18196,6 @@ function isSecurityToken(asset) {
|
|
|
18166
18196
|
function isProjectAssetConfig(asset) {
|
|
18167
18197
|
return "balanceQueryKey" in asset && "balanceQuery" in asset;
|
|
18168
18198
|
}
|
|
18169
|
-
function isAssetRateAvailable(symbol) {
|
|
18170
|
-
switch (symbol) {
|
|
18171
|
-
// list of prohibited symbols without market data on Binance
|
|
18172
|
-
// case 'XYZ':
|
|
18173
|
-
// case 'ABC':
|
|
18174
|
-
case "P":
|
|
18175
|
-
return false;
|
|
18176
|
-
default:
|
|
18177
|
-
return true;
|
|
18178
|
-
}
|
|
18179
|
-
}
|
|
18180
|
-
function checkWrapedTokenSymbol(symbol) {
|
|
18181
|
-
if (WRAPPED_TOKENS.includes(symbol)) {
|
|
18182
|
-
return symbol.slice(1);
|
|
18183
|
-
}
|
|
18184
|
-
return symbol.toUpperCase();
|
|
18185
|
-
}
|
|
18186
|
-
async function getAssetRate2(symbol) {
|
|
18187
|
-
if (SKIP_SYMBOLS2.includes(symbol)) return { symbol, price: "0" };
|
|
18188
|
-
if (symbol === "USDT") return { symbol, price: "1" };
|
|
18189
|
-
const assetURL = `https://api.binance.com/api/v3/ticker/price?symbol=${checkWrapedTokenSymbol(symbol)}USDT`;
|
|
18190
|
-
try {
|
|
18191
|
-
const response = await fetch(assetURL);
|
|
18192
|
-
return await response.json();
|
|
18193
|
-
} catch {
|
|
18194
|
-
return { symbol, price: "0" };
|
|
18195
|
-
}
|
|
18196
|
-
}
|
|
18197
18199
|
async function resolveAssetRate(symbol, address, customAssetRateQuery) {
|
|
18198
18200
|
if (customAssetRateQuery) {
|
|
18199
18201
|
try {
|
|
@@ -18206,8 +18208,7 @@ async function resolveAssetRate(symbol, address, customAssetRateQuery) {
|
|
|
18206
18208
|
console.warn("[PortfolioItem] Custom asset rate query failed:", error);
|
|
18207
18209
|
}
|
|
18208
18210
|
}
|
|
18209
|
-
|
|
18210
|
-
return getAssetRate2(symbol);
|
|
18211
|
+
return getAssetRate(symbol);
|
|
18211
18212
|
}
|
|
18212
18213
|
function PortfolioItemImage(props) {
|
|
18213
18214
|
const { asset } = props;
|
|
@@ -18255,7 +18256,7 @@ function PortfolioItem(props) {
|
|
|
18255
18256
|
queryKey: asset.balanceQueryKey,
|
|
18256
18257
|
queryFn: asset.balanceQuery
|
|
18257
18258
|
} : void 0;
|
|
18258
|
-
const { data: projectAssetBalance } =
|
|
18259
|
+
const { data: projectAssetBalance } = useQuery17({
|
|
18259
18260
|
enabled: !!projectAssetQuery,
|
|
18260
18261
|
retry: false,
|
|
18261
18262
|
queryKey: projectAssetQuery?.queryKey ?? ["project-asset-balance-disabled", asset.symbol],
|
|
@@ -18265,18 +18266,19 @@ function PortfolioItem(props) {
|
|
|
18265
18266
|
const isSecurity = isSecurityToken(asset);
|
|
18266
18267
|
const embeddedRate = Number(asset.exchangeRateUsd || 0);
|
|
18267
18268
|
const hasEmbeddedRate = Number.isFinite(embeddedRate) && embeddedRate > 0;
|
|
18268
|
-
const { data: assetRate, isLoading: isRateLoading } =
|
|
18269
|
-
enabled: !!address && !hasEmbeddedRate && !isProjectAsset && !isNft && !isSecurity
|
|
18269
|
+
const { data: assetRate, isLoading: isRateLoading } = useQuery17({
|
|
18270
|
+
enabled: !!address && !hasEmbeddedRate && !isProjectAsset && !isNft && !isSecurity,
|
|
18271
|
+
// (!!customAssetRateQuery || !!isAssetRateAvailable(asset.symbol)),
|
|
18270
18272
|
retry: false,
|
|
18271
18273
|
staleTime: 4 * 60 * 1e3,
|
|
18272
|
-
queryKey: customAssetRateQuery && customAssetRateQueryKey ? customAssetRateQueryKey : [
|
|
18274
|
+
queryKey: customAssetRateQuery && customAssetRateQueryKey ? customAssetRateQueryKey : [PORTFOLIO_ASSET_RATE_QUERY_KEY, address, asset.address, asset.symbol],
|
|
18273
18275
|
// customAssetRateQueryKey
|
|
18274
18276
|
queryFn: async () => await resolveAssetRate(asset.symbol, asset.address, customAssetRateQuery)
|
|
18275
18277
|
});
|
|
18276
18278
|
const hasProjectAssetBalance = isProjectAsset && projectAssetBalance != null;
|
|
18277
18279
|
const renderBalance = hasProjectAssetBalance ? projectAssetBalance.cryptoFormatted : Number(formatUnits6(BigInt(asset?.balance || "0"), asset?.decimals || 18));
|
|
18278
18280
|
const resolvedRate = hasEmbeddedRate ? embeddedRate : Number(assetRate?.price || 0);
|
|
18279
|
-
const usdRenderBalance = resolvedRate > 0 ? renderBalance * resolvedRate : 0;
|
|
18281
|
+
const usdRenderBalance = resolvedRate > 0 && resolvedRate !== 1 ? renderBalance * resolvedRate : 0;
|
|
18280
18282
|
const shortContractAddress = asset.address ? truncateMiddle(asset.address, 6, 4) : null;
|
|
18281
18283
|
return /* @__PURE__ */ jsxs77(
|
|
18282
18284
|
"div",
|
|
@@ -18337,20 +18339,19 @@ function PortfolioItem(props) {
|
|
|
18337
18339
|
}
|
|
18338
18340
|
);
|
|
18339
18341
|
}
|
|
18340
|
-
var
|
|
18342
|
+
var PORTFOLIO_ASSET_RATE_QUERY_KEY;
|
|
18341
18343
|
var init_PortfolioItem = __esm({
|
|
18342
18344
|
"src/internal/components/PortfolioMenu/PortfolioItem.tsx"() {
|
|
18343
18345
|
init_ProviderContext();
|
|
18344
|
-
init_constants();
|
|
18345
18346
|
init_no_image();
|
|
18346
18347
|
init_tokens();
|
|
18347
18348
|
init_base2();
|
|
18348
18349
|
init_priceFormatter();
|
|
18349
18350
|
init_utils2();
|
|
18350
18351
|
init_truncateMiddle();
|
|
18352
|
+
init_BalanceFeedProvider2();
|
|
18351
18353
|
init_BalanceView2();
|
|
18352
|
-
|
|
18353
|
-
ASSETS_RATES_QUERY_KEY = "lumia-passport-assets-rates-query-key";
|
|
18354
|
+
PORTFOLIO_ASSET_RATE_QUERY_KEY = "embarkai-portfolio-asset-rate-query-key";
|
|
18354
18355
|
}
|
|
18355
18356
|
});
|
|
18356
18357
|
|
|
@@ -18683,7 +18684,7 @@ var init_useSecurityStore = __esm({
|
|
|
18683
18684
|
|
|
18684
18685
|
// src/internal/components/SecurityMenu/constants.ts
|
|
18685
18686
|
var KEYSHARE_RECOVERY_STATS_QUERY, CONNECTED_TRUSTED_APPS_QUERY;
|
|
18686
|
-
var
|
|
18687
|
+
var init_constants7 = __esm({
|
|
18687
18688
|
"src/internal/components/SecurityMenu/constants.ts"() {
|
|
18688
18689
|
KEYSHARE_RECOVERY_STATS_QUERY = "keyshare-recovery-stats-query";
|
|
18689
18690
|
CONNECTED_TRUSTED_APPS_QUERY = "connected-trusted-apps-query";
|
|
@@ -18691,11 +18692,11 @@ var init_constants6 = __esm({
|
|
|
18691
18692
|
});
|
|
18692
18693
|
|
|
18693
18694
|
// src/internal/components/SecurityMenu/ConnectedApps/useConnectedApps.ts
|
|
18694
|
-
import { useQuery as
|
|
18695
|
+
import { useQuery as useQuery18 } from "@tanstack/react-query";
|
|
18695
18696
|
function useConnectedApps() {
|
|
18696
18697
|
const session = useSession((st) => st.session);
|
|
18697
18698
|
const userId = session?.mpcUserId || null;
|
|
18698
|
-
return
|
|
18699
|
+
return useQuery18({
|
|
18699
18700
|
retry: false,
|
|
18700
18701
|
enabled: !!userId,
|
|
18701
18702
|
queryKey: [CONNECTED_TRUSTED_APPS_QUERY, userId],
|
|
@@ -18712,7 +18713,7 @@ var init_useConnectedApps = __esm({
|
|
|
18712
18713
|
"src/internal/components/SecurityMenu/ConnectedApps/useConnectedApps.ts"() {
|
|
18713
18714
|
init_SessionContext();
|
|
18714
18715
|
init_httpClient();
|
|
18715
|
-
|
|
18716
|
+
init_constants7();
|
|
18716
18717
|
}
|
|
18717
18718
|
});
|
|
18718
18719
|
|
|
@@ -18939,7 +18940,7 @@ var init_UntrustApplication = __esm({
|
|
|
18939
18940
|
init_iframe_manager();
|
|
18940
18941
|
init_button();
|
|
18941
18942
|
init_highlight();
|
|
18942
|
-
|
|
18943
|
+
init_constants7();
|
|
18943
18944
|
init_useSecurityStore();
|
|
18944
18945
|
}
|
|
18945
18946
|
});
|
|
@@ -19050,11 +19051,11 @@ var init_LastBackup = __esm({
|
|
|
19050
19051
|
});
|
|
19051
19052
|
|
|
19052
19053
|
// src/internal/components/SecurityMenu/Keyshare/useKeyshareRecoveryStats.ts
|
|
19053
|
-
import { useQuery as
|
|
19054
|
+
import { useQuery as useQuery19 } from "@tanstack/react-query";
|
|
19054
19055
|
function useKeyshareRecoveryStats() {
|
|
19055
19056
|
const session = useSession((st) => st.session);
|
|
19056
19057
|
const userId = session?.mpcUserId || null;
|
|
19057
|
-
return
|
|
19058
|
+
return useQuery19({
|
|
19058
19059
|
enabled: !!userId,
|
|
19059
19060
|
queryKey: [KEYSHARE_RECOVERY_STATS_QUERY, userId],
|
|
19060
19061
|
queryFn: async () => {
|
|
@@ -19077,7 +19078,7 @@ var init_useKeyshareRecoveryStats = __esm({
|
|
|
19077
19078
|
init_keyshare();
|
|
19078
19079
|
init_iframe_manager();
|
|
19079
19080
|
init_vaultClient();
|
|
19080
|
-
|
|
19081
|
+
init_constants7();
|
|
19081
19082
|
}
|
|
19082
19083
|
});
|
|
19083
19084
|
|
|
@@ -20373,7 +20374,7 @@ var init_useBridge = __esm({
|
|
|
20373
20374
|
});
|
|
20374
20375
|
|
|
20375
20376
|
// src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneRoutes.ts
|
|
20376
|
-
import { useQuery as
|
|
20377
|
+
import { useQuery as useQuery20 } from "@tanstack/react-query";
|
|
20377
20378
|
import { useEffect as useEffect39 } from "react";
|
|
20378
20379
|
function useHyperlaneRoutes() {
|
|
20379
20380
|
const address = useSession((st) => st.address);
|
|
@@ -20384,7 +20385,7 @@ function useHyperlaneRoutes() {
|
|
|
20384
20385
|
data: hyperlaneWarpRoutes = [],
|
|
20385
20386
|
isLoading: isLoadingWarpRoutes,
|
|
20386
20387
|
error: errorWarpRoutes
|
|
20387
|
-
} =
|
|
20388
|
+
} = useQuery20({
|
|
20388
20389
|
retry: false,
|
|
20389
20390
|
enabled: !!address && page === "send" /* SEND */ && flow === "bridge",
|
|
20390
20391
|
queryKey: [HYPERLANE_WARP_ROUTES_QUERY_KEY, address],
|
|
@@ -20493,16 +20494,10 @@ var init_ResolveChainIcon = __esm({
|
|
|
20493
20494
|
|
|
20494
20495
|
// src/internal/components/SendMenu/hyperbridge/hooks/useBridgeBalance.ts
|
|
20495
20496
|
import { CHAINS_BROWSERS_TRANSPORTS as CHAINS_BROWSERS_TRANSPORTS2 } from "@embarkai/core";
|
|
20496
|
-
import { useQuery as
|
|
20497
|
+
import { useQuery as useQuery21, useQueryClient as useQueryClient23 } from "@tanstack/react-query";
|
|
20497
20498
|
import { useCallback as useCallback28, useEffect as useEffect41 } from "react";
|
|
20498
20499
|
import { createPublicClient as createPublicClient2, erc20Abi as erc20Abi3, formatUnits as formatUnits8, http as http3 } from "viem";
|
|
20499
20500
|
import { useSwitchChain as useSwitchChain2 } from "wagmi";
|
|
20500
|
-
function checkWrapedTokenSymbol2(symbol) {
|
|
20501
|
-
if (WRAPPED_TOKENS.includes(symbol)) {
|
|
20502
|
-
return symbol.slice(1);
|
|
20503
|
-
}
|
|
20504
|
-
return symbol.toUpperCase();
|
|
20505
|
-
}
|
|
20506
20501
|
function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
20507
20502
|
const qc = useQueryClient23();
|
|
20508
20503
|
const { t } = useT();
|
|
@@ -20528,10 +20523,10 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20528
20523
|
enabled: bridgeSender === "embarkai-wallet" && !!selectedWarpRoute && !!address && !!originChain,
|
|
20529
20524
|
address
|
|
20530
20525
|
});
|
|
20531
|
-
const embarkTokenBalanace = assets.find((a) => selectedWarpRoute?.symbol ===
|
|
20526
|
+
const embarkTokenBalanace = assets.find((a) => selectedWarpRoute?.symbol === checkWrapedTokenSymbol(a.symbol));
|
|
20532
20527
|
const originChainMeta = CHAINS_UI_META[originChain];
|
|
20533
20528
|
const isSelectedTokenNative = selectedWarpRoute?.symbol?.toUpperCase() === originChainMeta?.chain?.nativeCurrency?.symbol?.toUpperCase();
|
|
20534
|
-
const { data: externalBalanceData, isLoading: isExternalBalanceLoading } =
|
|
20529
|
+
const { data: externalBalanceData, isLoading: isExternalBalanceLoading } = useQuery21({
|
|
20535
20530
|
retry: false,
|
|
20536
20531
|
enabled: bridgeSender === "direct-wallet" && !isSelectedTokenNative && !!directWalletAddress && !!routeTokenAddress && !!originChain,
|
|
20537
20532
|
queryKey: [EXTERNAL_WALLET_BRIDGING_BALANCE_QUERY, originChain, directWalletAddress, routeTokenAddress],
|
|
@@ -20574,7 +20569,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20574
20569
|
return { value, decimals, symbol, formatted };
|
|
20575
20570
|
}
|
|
20576
20571
|
});
|
|
20577
|
-
const { data: externalNativeBalanceData, isLoading: isExternalNativeBalanceLoading } =
|
|
20572
|
+
const { data: externalNativeBalanceData, isLoading: isExternalNativeBalanceLoading } = useQuery21({
|
|
20578
20573
|
retry: false,
|
|
20579
20574
|
enabled: bridgeSender === "direct-wallet" && isSelectedTokenNative && !!directWalletAddress && !!originChain,
|
|
20580
20575
|
queryKey: [EXTERNAL_WALLET_BRIDGING_NATIVE_BALANCE_QUERY, originChain, directWalletAddress],
|
|
@@ -20639,11 +20634,11 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20639
20634
|
var EXTERNAL_WALLET_BRIDGING_BALANCE_QUERY, EXTERNAL_WALLET_BRIDGING_NATIVE_BALANCE_QUERY;
|
|
20640
20635
|
var init_useBridgeBalance = __esm({
|
|
20641
20636
|
"src/internal/components/SendMenu/hyperbridge/hooks/useBridgeBalance.ts"() {
|
|
20642
|
-
init_constants();
|
|
20643
20637
|
init_SessionContext();
|
|
20644
20638
|
init_i18n();
|
|
20645
20639
|
init_useBlockscoutAssets2();
|
|
20646
20640
|
init_useExternalWalletStore();
|
|
20641
|
+
init_BalanceFeedProvider2();
|
|
20647
20642
|
init_useFlowSelector();
|
|
20648
20643
|
init_chains();
|
|
20649
20644
|
init_useBridgeStore();
|
|
@@ -21723,7 +21718,7 @@ var init_useErc3643Compliance = __esm({
|
|
|
21723
21718
|
});
|
|
21724
21719
|
|
|
21725
21720
|
// src/hooks/useNicknameResolve.ts
|
|
21726
|
-
import { useQuery as
|
|
21721
|
+
import { useQuery as useQuery22 } from "@tanstack/react-query";
|
|
21727
21722
|
import { useEffect as useEffect43, useMemo as useMemo14, useState as useState24 } from "react";
|
|
21728
21723
|
function looksLikeNickname(input) {
|
|
21729
21724
|
if (!input) return false;
|
|
@@ -21753,7 +21748,7 @@ function useNicknameResolve(input, options) {
|
|
|
21753
21748
|
clearTimeout(timer);
|
|
21754
21749
|
};
|
|
21755
21750
|
}, [normalized, isNicknameInput, enabled]);
|
|
21756
|
-
const query =
|
|
21751
|
+
const query = useQuery22({
|
|
21757
21752
|
queryKey: [...QUERY_KEYS.nicknameResolve(debouncedInput), chainId],
|
|
21758
21753
|
queryFn: async () => await resolveNickname(debouncedInput, chainId),
|
|
21759
21754
|
enabled: enabled && isNicknameInput && debouncedInput.length > 0,
|
|
@@ -22329,7 +22324,7 @@ var init_components3 = __esm({
|
|
|
22329
22324
|
|
|
22330
22325
|
// src/internal/components/SendMenu/send/useTokenBalance.ts
|
|
22331
22326
|
import {
|
|
22332
|
-
useQuery as
|
|
22327
|
+
useQuery as useQuery23
|
|
22333
22328
|
} from "@tanstack/react-query";
|
|
22334
22329
|
import {
|
|
22335
22330
|
erc20Abi as erc20Abi4,
|
|
@@ -22342,7 +22337,7 @@ function isNftAsset4(asset) {
|
|
|
22342
22337
|
function useTokenBalance(asset) {
|
|
22343
22338
|
const address = useSession((st) => st.address);
|
|
22344
22339
|
const chainConfig = useSession((st) => st.chainConfig);
|
|
22345
|
-
return
|
|
22340
|
+
return useQuery23({
|
|
22346
22341
|
retry: false,
|
|
22347
22342
|
enabled: !!address && !!chainConfig?.id && !!asset?.symbol,
|
|
22348
22343
|
refetchInterval: 5e3,
|
|
@@ -23203,7 +23198,7 @@ var init_pro_mode = __esm({
|
|
|
23203
23198
|
// src/internal/components/SettingsMenu/constants.ts
|
|
23204
23199
|
import { ArrowLeftRight, AtSign as AtSign4, DatabaseBackup as DatabaseBackup2, Link2, LockKeyhole, UsersRound } from "lucide-react";
|
|
23205
23200
|
var NAV_BUTTONS;
|
|
23206
|
-
var
|
|
23201
|
+
var init_constants8 = __esm({
|
|
23207
23202
|
"src/internal/components/SettingsMenu/constants.ts"() {
|
|
23208
23203
|
init_icons();
|
|
23209
23204
|
NAV_BUTTONS = [
|
|
@@ -23219,7 +23214,7 @@ var init_constants7 = __esm({
|
|
|
23219
23214
|
});
|
|
23220
23215
|
|
|
23221
23216
|
// src/internal/components/SettingsMenu/SettingsMenu.tsx
|
|
23222
|
-
import { useQuery as
|
|
23217
|
+
import { useQuery as useQuery24 } from "@tanstack/react-query";
|
|
23223
23218
|
import { ArrowLeft as ArrowLeft20, HardDrive as HardDrive3 } from "lucide-react";
|
|
23224
23219
|
import { useEffect as useEffect47 } from "react";
|
|
23225
23220
|
import { jsx as jsx112, jsxs as jsxs103 } from "react/jsx-runtime";
|
|
@@ -23262,7 +23257,7 @@ function SettingsMenu() {
|
|
|
23262
23257
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
23263
23258
|
const settingsButtons = useSettingsButtons();
|
|
23264
23259
|
useProvidersList();
|
|
23265
|
-
|
|
23260
|
+
useQuery24({
|
|
23266
23261
|
retry: 1,
|
|
23267
23262
|
enabled: !!address,
|
|
23268
23263
|
queryKey: [QUERY_KEYS.nicknameInfo, address],
|
|
@@ -23317,7 +23312,7 @@ var init_SettingsMenu = __esm({
|
|
|
23317
23312
|
init_utils2();
|
|
23318
23313
|
init_useProvidersList();
|
|
23319
23314
|
init_button();
|
|
23320
|
-
|
|
23315
|
+
init_constants8();
|
|
23321
23316
|
}
|
|
23322
23317
|
});
|
|
23323
23318
|
|
|
@@ -24177,7 +24172,7 @@ var init_TransactionsGroup = __esm({
|
|
|
24177
24172
|
});
|
|
24178
24173
|
|
|
24179
24174
|
// src/internal/components/TransactionsMenu/TransactionsMenu.tsx
|
|
24180
|
-
import { useQuery as
|
|
24175
|
+
import { useQuery as useQuery25, useQueryClient as useQueryClient25 } from "@tanstack/react-query";
|
|
24181
24176
|
import { ArrowLeft as ArrowLeft22, Loader as Loader28, RefreshCw as RefreshCw3, XCircle } from "lucide-react";
|
|
24182
24177
|
import { useCallback as useCallback30, useState as useState27 } from "react";
|
|
24183
24178
|
import { jsx as jsx115, jsxs as jsxs106 } from "react/jsx-runtime";
|
|
@@ -24195,7 +24190,7 @@ function TransactionsMenu() {
|
|
|
24195
24190
|
isLoading: isTxHistoryLoading,
|
|
24196
24191
|
isFetching: isTxHistoryFetching,
|
|
24197
24192
|
error: txHistoryError
|
|
24198
|
-
} =
|
|
24193
|
+
} = useQuery25({
|
|
24199
24194
|
retry: false,
|
|
24200
24195
|
enabled: !!address && !!chainConfig?.id && historySupported,
|
|
24201
24196
|
queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address],
|
|
@@ -24541,7 +24536,7 @@ var init_package = __esm({
|
|
|
24541
24536
|
"package.json"() {
|
|
24542
24537
|
package_default = {
|
|
24543
24538
|
name: "@embarkai/ui-kit",
|
|
24544
|
-
version: "0.4.
|
|
24539
|
+
version: "0.4.65",
|
|
24545
24540
|
description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
|
|
24546
24541
|
type: "module",
|
|
24547
24542
|
main: "./dist/index.cjs",
|
|
@@ -24770,7 +24765,7 @@ var init_Footer = __esm({
|
|
|
24770
24765
|
init_useLayoutStore();
|
|
24771
24766
|
init_utils2();
|
|
24772
24767
|
init_useExternalWalletStore();
|
|
24773
|
-
|
|
24768
|
+
init_constants5();
|
|
24774
24769
|
init_button();
|
|
24775
24770
|
}
|
|
24776
24771
|
});
|
|
@@ -29792,6 +29787,7 @@ init_bundler();
|
|
|
29792
29787
|
init_auth();
|
|
29793
29788
|
init_profile();
|
|
29794
29789
|
init_SecurityMenu2();
|
|
29790
|
+
init_BalanceFeedProvider2();
|
|
29795
29791
|
init_linkedProfiles();
|
|
29796
29792
|
init_nickname_fingerprint();
|
|
29797
29793
|
init_errors();
|
|
@@ -30092,7 +30088,6 @@ init_tokens();
|
|
|
30092
30088
|
init_wallets();
|
|
30093
30089
|
|
|
30094
30090
|
// src/index.ts
|
|
30095
|
-
init_constants();
|
|
30096
30091
|
init_i18n();
|
|
30097
30092
|
|
|
30098
30093
|
// src/internal/exportedQueryKeys.ts
|
|
@@ -30136,13 +30131,14 @@ export {
|
|
|
30136
30131
|
UserOperationTimeoutError,
|
|
30137
30132
|
UserRejectedError,
|
|
30138
30133
|
WALLET_ICONS,
|
|
30139
|
-
|
|
30134
|
+
checkWrapedTokenSymbol,
|
|
30140
30135
|
combineI18NResources,
|
|
30141
30136
|
createAccountAbstractionError,
|
|
30142
30137
|
deployAccount,
|
|
30143
30138
|
destroyIframeManager,
|
|
30144
30139
|
generateFingerprint,
|
|
30145
30140
|
getAllSmartAccounts,
|
|
30141
|
+
getAssetRate,
|
|
30146
30142
|
getAvailableLanguages,
|
|
30147
30143
|
getExplorerUrl,
|
|
30148
30144
|
getIframeManager,
|
|
@@ -30168,6 +30164,7 @@ export {
|
|
|
30168
30164
|
useAccountSession,
|
|
30169
30165
|
useActiveChainId,
|
|
30170
30166
|
useAddress,
|
|
30167
|
+
useAssetUsdtRate,
|
|
30171
30168
|
useAssets,
|
|
30172
30169
|
useBalance,
|
|
30173
30170
|
useBlockscoutAssets,
|