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