@embarkai/ui-kit 0.4.31 → 0.4.32
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 +323 -281
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +99 -57
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -17640,24 +17640,68 @@ var init_NicknameMenu2 = __esm({
|
|
|
17640
17640
|
}
|
|
17641
17641
|
});
|
|
17642
17642
|
|
|
17643
|
+
// src/internal/hooks/useResolvedPublicClient.ts
|
|
17644
|
+
function getCachedPublicClient(chainId) {
|
|
17645
|
+
const cachedClient = publicClientByChainId.get(chainId);
|
|
17646
|
+
if (cachedClient) return cachedClient;
|
|
17647
|
+
const publicClient = (0, import_read13.createPublicClientForChain)(chainId);
|
|
17648
|
+
publicClientByChainId.set(chainId, publicClient);
|
|
17649
|
+
return publicClient;
|
|
17650
|
+
}
|
|
17651
|
+
function useResolvedPublicClient(chainId, logScope = "useResolvedPublicClient") {
|
|
17652
|
+
const activePublicClient = useSession((st) => st.publicClient);
|
|
17653
|
+
const activeChainId = useSession((st) => st.activeChainId);
|
|
17654
|
+
const activeChainConfig = useSession((st) => st.chainConfig);
|
|
17655
|
+
const resolvedChainId = chainId ?? activeChainId;
|
|
17656
|
+
const shouldUseActiveClient = !chainId || chainId === activeChainId;
|
|
17657
|
+
const chainConfig = (0, import_react56.useMemo)(() => {
|
|
17658
|
+
if (shouldUseActiveClient) return activeChainConfig;
|
|
17659
|
+
return (0, import_read13.getChainConfig)(chainId);
|
|
17660
|
+
}, [activeChainConfig, chainId, shouldUseActiveClient]);
|
|
17661
|
+
const publicClient = (0, import_react56.useMemo)(() => {
|
|
17662
|
+
if (shouldUseActiveClient) return activePublicClient;
|
|
17663
|
+
if (!chainId) return activePublicClient;
|
|
17664
|
+
try {
|
|
17665
|
+
return getCachedPublicClient(chainId);
|
|
17666
|
+
} catch (error) {
|
|
17667
|
+
console.warn(`[${logScope}] Chain ${chainId} is not supported:`, error);
|
|
17668
|
+
return null;
|
|
17669
|
+
}
|
|
17670
|
+
}, [activePublicClient, chainId, logScope, shouldUseActiveClient]);
|
|
17671
|
+
return {
|
|
17672
|
+
activeChainId,
|
|
17673
|
+
chainConfig,
|
|
17674
|
+
publicClient,
|
|
17675
|
+
resolvedChainId
|
|
17676
|
+
};
|
|
17677
|
+
}
|
|
17678
|
+
var import_read13, import_react56, publicClientByChainId;
|
|
17679
|
+
var init_useResolvedPublicClient = __esm({
|
|
17680
|
+
"src/internal/hooks/useResolvedPublicClient.ts"() {
|
|
17681
|
+
init_SessionContext();
|
|
17682
|
+
import_read13 = require("@embarkai/core/read");
|
|
17683
|
+
import_react56 = require("react");
|
|
17684
|
+
publicClientByChainId = /* @__PURE__ */ new Map();
|
|
17685
|
+
}
|
|
17686
|
+
});
|
|
17687
|
+
|
|
17643
17688
|
// src/internal/hooks/useWatchTokens.ts
|
|
17644
17689
|
function useWatchTokens(options) {
|
|
17645
|
-
const { address, enabled = true } = options;
|
|
17690
|
+
const { address, chainId, enabled = true } = options;
|
|
17646
17691
|
const { config } = useProviderConfig();
|
|
17647
|
-
const publicClient =
|
|
17648
|
-
const
|
|
17649
|
-
const watchTokens = (0, import_react56.useMemo)(() => {
|
|
17692
|
+
const { publicClient, resolvedChainId } = useResolvedPublicClient(chainId, "useWatchTokens");
|
|
17693
|
+
const watchTokens = (0, import_react57.useMemo)(() => {
|
|
17650
17694
|
const allWatchTokens = config.current.watchTokens;
|
|
17651
|
-
const tokensForChain =
|
|
17695
|
+
const tokensForChain = resolvedChainId ? allWatchTokens?.[resolvedChainId] || [] : [];
|
|
17652
17696
|
return tokensForChain;
|
|
17653
|
-
}, [config,
|
|
17697
|
+
}, [config, resolvedChainId]);
|
|
17654
17698
|
const {
|
|
17655
17699
|
data: assets,
|
|
17656
17700
|
isLoading,
|
|
17657
17701
|
error,
|
|
17658
17702
|
refetch
|
|
17659
17703
|
} = (0, import_react_query38.useQuery)({
|
|
17660
|
-
queryKey: [WATCH_TOKENS_QUERY_KEY,
|
|
17704
|
+
queryKey: [WATCH_TOKENS_QUERY_KEY, resolvedChainId, address, watchTokens.map((t) => t.address).join(",")],
|
|
17661
17705
|
queryFn: async () => {
|
|
17662
17706
|
if (!publicClient || !address || watchTokens.length === 0) {
|
|
17663
17707
|
return [];
|
|
@@ -17728,14 +17772,14 @@ function useWatchTokens(options) {
|
|
|
17728
17772
|
refetch
|
|
17729
17773
|
};
|
|
17730
17774
|
}
|
|
17731
|
-
var import_react_query38,
|
|
17775
|
+
var import_react_query38, import_react57, import_viem6, WATCH_TOKENS_QUERY_KEY;
|
|
17732
17776
|
var init_useWatchTokens = __esm({
|
|
17733
17777
|
"src/internal/hooks/useWatchTokens.ts"() {
|
|
17734
17778
|
init_ProviderContext();
|
|
17735
|
-
init_SessionContext();
|
|
17736
17779
|
import_react_query38 = require("@tanstack/react-query");
|
|
17737
|
-
|
|
17780
|
+
import_react57 = require("react");
|
|
17738
17781
|
import_viem6 = require("viem");
|
|
17782
|
+
init_useResolvedPublicClient();
|
|
17739
17783
|
WATCH_TOKENS_QUERY_KEY = "watch-tokens";
|
|
17740
17784
|
}
|
|
17741
17785
|
});
|
|
@@ -17865,30 +17909,28 @@ function createError(error) {
|
|
|
17865
17909
|
};
|
|
17866
17910
|
}
|
|
17867
17911
|
function useBlockscoutAssets(options) {
|
|
17868
|
-
const { address, enabled = true, detectSecurityTokens = true } = options;
|
|
17869
|
-
const publicClient =
|
|
17870
|
-
const activeChainId = useSession((st) => st.activeChainId);
|
|
17871
|
-
const chainConfig = useSession((st) => st.chainConfig);
|
|
17912
|
+
const { address, chainId, enabled = true, detectSecurityTokens = true } = options;
|
|
17913
|
+
const { chainConfig, publicClient, resolvedChainId } = useResolvedPublicClient(chainId, "useBlockscoutAssets");
|
|
17872
17914
|
const portfolioConfig = useProviderConfig().config.current.portfolio;
|
|
17873
17915
|
const customTokenBalancesQuery = portfolioConfig?.tokenBalancesQuery;
|
|
17874
17916
|
const customTokenBalancesQueryKey = portfolioConfig?.tokenBalancesQueryKey;
|
|
17875
17917
|
const blockscoutApiUrl = getBlockscoutApiUrl(chainConfig);
|
|
17876
|
-
const blockscoutClient = (0,
|
|
17918
|
+
const blockscoutClient = (0, import_react58.useMemo)(
|
|
17877
17919
|
() => blockscoutApiUrl ? (0, import_clients2.createBlockscoutClient)({ baseUrl: blockscoutApiUrl }) : null,
|
|
17878
17920
|
[blockscoutApiUrl]
|
|
17879
17921
|
);
|
|
17880
|
-
const lastRefreshRef = (0,
|
|
17922
|
+
const lastRefreshRef = (0, import_react58.useRef)(0);
|
|
17881
17923
|
const {
|
|
17882
17924
|
assets: watchTokenAssets,
|
|
17883
17925
|
isLoading: watchTokensLoading,
|
|
17884
17926
|
refetch: refetchWatchTokens
|
|
17885
|
-
} = useWatchTokens({ address, enabled });
|
|
17927
|
+
} = useWatchTokens({ address, chainId: resolvedChainId, enabled });
|
|
17886
17928
|
const {
|
|
17887
17929
|
data: nativeBalanceData,
|
|
17888
17930
|
isLoading: nativeLoading,
|
|
17889
17931
|
refetch: refetchNative
|
|
17890
17932
|
} = (0, import_react_query39.useQuery)({
|
|
17891
|
-
queryKey: ["native-balance",
|
|
17933
|
+
queryKey: ["native-balance", resolvedChainId, address],
|
|
17892
17934
|
queryFn: async () => {
|
|
17893
17935
|
if (!publicClient || !address) return null;
|
|
17894
17936
|
const balance = await publicClient.getBalance({ address });
|
|
@@ -17913,7 +17955,7 @@ function useBlockscoutAssets(options) {
|
|
|
17913
17955
|
refetch: refetchTokens,
|
|
17914
17956
|
dataUpdatedAt
|
|
17915
17957
|
} = (0, import_react_query39.useQuery)({
|
|
17916
|
-
queryKey: [BLOCKSCOUT_QUERY_KEY, address, blockscoutApiUrl, customTokenBalancesQueryKey],
|
|
17958
|
+
queryKey: [BLOCKSCOUT_QUERY_KEY, resolvedChainId, address, blockscoutApiUrl, customTokenBalancesQueryKey],
|
|
17917
17959
|
queryFn: async () => {
|
|
17918
17960
|
if (customTokenBalancesQuery) {
|
|
17919
17961
|
try {
|
|
@@ -17937,7 +17979,7 @@ function useBlockscoutAssets(options) {
|
|
|
17937
17979
|
isLoading: nftsLoading,
|
|
17938
17980
|
refetch: refetchNfts
|
|
17939
17981
|
} = (0, import_react_query39.useQuery)({
|
|
17940
|
-
queryKey: [BLOCKSCOUT_QUERY_KEY, "nfts", address, blockscoutApiUrl],
|
|
17982
|
+
queryKey: [BLOCKSCOUT_QUERY_KEY, "nfts", resolvedChainId, address, blockscoutApiUrl],
|
|
17941
17983
|
queryFn: () => blockscoutClient.getNfts(address),
|
|
17942
17984
|
enabled: !!address && enabled && !!blockscoutClient,
|
|
17943
17985
|
staleTime: BLOCKSCOUT_QUERY_STALE_TIME,
|
|
@@ -17946,12 +17988,12 @@ function useBlockscoutAssets(options) {
|
|
|
17946
17988
|
retry: 2,
|
|
17947
17989
|
retryDelay: 1e3
|
|
17948
17990
|
});
|
|
17949
|
-
const erc20TokenAddresses = (0,
|
|
17991
|
+
const erc20TokenAddresses = (0, import_react58.useMemo)(() => {
|
|
17950
17992
|
if (!tokenBalances) return [];
|
|
17951
17993
|
return tokenBalances.filter((tb) => tb.token.type === "ERC-20").map((tb) => tb.token.address_hash);
|
|
17952
17994
|
}, [tokenBalances]);
|
|
17953
17995
|
const { data: erc3643Results } = (0, import_react_query39.useQuery)({
|
|
17954
|
-
queryKey: [ERC3643_DETECTION_QUERY_KEY, address, erc20TokenAddresses],
|
|
17996
|
+
queryKey: [ERC3643_DETECTION_QUERY_KEY, resolvedChainId, address, erc20TokenAddresses],
|
|
17955
17997
|
queryFn: async () => {
|
|
17956
17998
|
if (!publicClient || erc20TokenAddresses.length === 0) {
|
|
17957
17999
|
return /* @__PURE__ */ new Map();
|
|
@@ -17990,7 +18032,7 @@ function useBlockscoutAssets(options) {
|
|
|
17990
18032
|
gcTime: BLOCKSCOUT_QUERY_GC_TIME,
|
|
17991
18033
|
retry: 1
|
|
17992
18034
|
});
|
|
17993
|
-
const assets = (0,
|
|
18035
|
+
const assets = (0, import_react58.useMemo)(() => {
|
|
17994
18036
|
const result = [];
|
|
17995
18037
|
const addedAddresses = /* @__PURE__ */ new Set();
|
|
17996
18038
|
if (nativeBalanceData) {
|
|
@@ -18036,7 +18078,7 @@ function useBlockscoutAssets(options) {
|
|
|
18036
18078
|
}
|
|
18037
18079
|
return result;
|
|
18038
18080
|
}, [nativeBalanceData, tokenBalances, nftItems, erc3643Results, watchTokenAssets, chainConfig]);
|
|
18039
|
-
const nativeBalance = (0,
|
|
18081
|
+
const nativeBalance = (0, import_react58.useMemo)(() => {
|
|
18040
18082
|
if (!nativeBalanceData) return null;
|
|
18041
18083
|
return {
|
|
18042
18084
|
value: nativeBalanceData.value,
|
|
@@ -18044,11 +18086,11 @@ function useBlockscoutAssets(options) {
|
|
|
18044
18086
|
symbol: nativeBalanceData.symbol
|
|
18045
18087
|
};
|
|
18046
18088
|
}, [nativeBalanceData]);
|
|
18047
|
-
const error = (0,
|
|
18089
|
+
const error = (0, import_react58.useMemo)(() => {
|
|
18048
18090
|
if (!tokensError) return null;
|
|
18049
18091
|
return createError(tokensError);
|
|
18050
18092
|
}, [tokensError]);
|
|
18051
|
-
const refreshBalances = (0,
|
|
18093
|
+
const refreshBalances = (0, import_react58.useCallback)(async () => {
|
|
18052
18094
|
const now = Date.now();
|
|
18053
18095
|
if (now - lastRefreshRef.current < BLOCKSCOUT_REFRESH_DEBOUNCE) {
|
|
18054
18096
|
return;
|
|
@@ -18056,7 +18098,7 @@ function useBlockscoutAssets(options) {
|
|
|
18056
18098
|
lastRefreshRef.current = now;
|
|
18057
18099
|
await Promise.all([refetchNative(), refetchTokens(), refetchNfts(), refetchWatchTokens()]);
|
|
18058
18100
|
}, [refetchNative, refetchTokens, refetchNfts, refetchWatchTokens]);
|
|
18059
|
-
const getTokenBalance = (0,
|
|
18101
|
+
const getTokenBalance = (0, import_react58.useCallback)(
|
|
18060
18102
|
(tokenAddress) => {
|
|
18061
18103
|
return assets.find((a) => a.address?.toLowerCase() === tokenAddress.toLowerCase()) || null;
|
|
18062
18104
|
},
|
|
@@ -18074,17 +18116,17 @@ function useBlockscoutAssets(options) {
|
|
|
18074
18116
|
lastUpdated: dataUpdatedAt || null
|
|
18075
18117
|
};
|
|
18076
18118
|
}
|
|
18077
|
-
var import_clients2, import_react_query39,
|
|
18119
|
+
var import_clients2, import_react_query39, import_react58, import_viem7, BLOCKSCOUT_QUERY_KEY, ERC3643_DETECTION_QUERY_KEY, ERC3643_ABI;
|
|
18078
18120
|
var init_useBlockscoutAssets = __esm({
|
|
18079
18121
|
"src/internal/hooks/useBlockscoutAssets.ts"() {
|
|
18080
18122
|
init_ProviderContext();
|
|
18081
|
-
init_SessionContext();
|
|
18082
18123
|
import_clients2 = require("@embarkai/core/clients");
|
|
18083
18124
|
import_react_query39 = require("@tanstack/react-query");
|
|
18084
|
-
|
|
18125
|
+
import_react58 = require("react");
|
|
18085
18126
|
import_viem7 = require("viem");
|
|
18086
18127
|
init_initial();
|
|
18087
18128
|
init_constants();
|
|
18129
|
+
init_useResolvedPublicClient();
|
|
18088
18130
|
init_useWatchTokens();
|
|
18089
18131
|
BLOCKSCOUT_QUERY_KEY = "blockscout-token-balances";
|
|
18090
18132
|
ERC3643_DETECTION_QUERY_KEY = "erc3643-detection";
|
|
@@ -18197,8 +18239,8 @@ async function resolveAssetRate(symbol, address, customAssetRateQuery) {
|
|
|
18197
18239
|
}
|
|
18198
18240
|
function PortfolioItemImage(props) {
|
|
18199
18241
|
const { asset } = props;
|
|
18200
|
-
const [nftImageError, setNftImageError] = (0,
|
|
18201
|
-
const [logoError, setLogoError] = (0,
|
|
18242
|
+
const [nftImageError, setNftImageError] = (0, import_react59.useState)(false);
|
|
18243
|
+
const [logoError, setLogoError] = (0, import_react59.useState)(false);
|
|
18202
18244
|
const isNft = isNftAsset(asset);
|
|
18203
18245
|
const nftImage = getNftImage(asset);
|
|
18204
18246
|
const isSecurity = isSecurityToken(asset);
|
|
@@ -18317,14 +18359,14 @@ function PortfolioItem(props) {
|
|
|
18317
18359
|
}
|
|
18318
18360
|
);
|
|
18319
18361
|
}
|
|
18320
|
-
var import_react_query40, import_lucide_react50,
|
|
18362
|
+
var import_react_query40, import_lucide_react50, import_react59, import_viem9, import_jsx_runtime81, SKIP_SYMBOLS2, ASSETS_RATES_QUERY_KEY;
|
|
18321
18363
|
var init_PortfolioItem = __esm({
|
|
18322
18364
|
"src/internal/components/PortfolioMenu/PortfolioItem.tsx"() {
|
|
18323
18365
|
init_ProviderContext();
|
|
18324
18366
|
init_tokens();
|
|
18325
18367
|
import_react_query40 = require("@tanstack/react-query");
|
|
18326
18368
|
import_lucide_react50 = require("lucide-react");
|
|
18327
|
-
|
|
18369
|
+
import_react59 = require("react");
|
|
18328
18370
|
import_viem9 = require("viem");
|
|
18329
18371
|
init_base();
|
|
18330
18372
|
init_priceFormatter();
|
|
@@ -18356,7 +18398,7 @@ function PortfolioMenu() {
|
|
|
18356
18398
|
enabled: !!address
|
|
18357
18399
|
});
|
|
18358
18400
|
const shownProjectAssests = projectAssets.filter((asset) => !asset.hideInPortfolio);
|
|
18359
|
-
const refreshAllAssetsBalances = (0,
|
|
18401
|
+
const refreshAllAssetsBalances = (0, import_react60.useCallback)(() => {
|
|
18360
18402
|
Promise.all(shownProjectAssests.map((asset) => qc.invalidateQueries({ queryKey: asset.balanceQueryKey })));
|
|
18361
18403
|
refreshBlockscoutBalances();
|
|
18362
18404
|
}, [qc, shownProjectAssests, refreshBlockscoutBalances]);
|
|
@@ -18406,7 +18448,7 @@ function PortfolioMenu() {
|
|
|
18406
18448
|
}
|
|
18407
18449
|
);
|
|
18408
18450
|
}
|
|
18409
|
-
var import_react_query41, import_lucide_react51,
|
|
18451
|
+
var import_react_query41, import_lucide_react51, import_react60, import_jsx_runtime82;
|
|
18410
18452
|
var init_PortfolioMenu = __esm({
|
|
18411
18453
|
"src/internal/components/PortfolioMenu/PortfolioMenu.tsx"() {
|
|
18412
18454
|
init_ProviderContext();
|
|
@@ -18414,7 +18456,7 @@ var init_PortfolioMenu = __esm({
|
|
|
18414
18456
|
init_i18n();
|
|
18415
18457
|
import_react_query41 = require("@tanstack/react-query");
|
|
18416
18458
|
import_lucide_react51 = require("lucide-react");
|
|
18417
|
-
|
|
18459
|
+
import_react60 = require("react");
|
|
18418
18460
|
init_useBlockscoutAssets();
|
|
18419
18461
|
init_useLayoutDataStore();
|
|
18420
18462
|
init_useLayoutStore();
|
|
@@ -18523,10 +18565,10 @@ function ReceiveMenu() {
|
|
|
18523
18565
|
const { t } = useT();
|
|
18524
18566
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
18525
18567
|
const open = page === "receive";
|
|
18526
|
-
const [qrCodeUrl, setQrCodeUrl] = (0,
|
|
18527
|
-
const [copied, setCopied] = (0,
|
|
18528
|
-
const [fingerprintCopied, setFingerprintCopied] = (0,
|
|
18529
|
-
const fingerprint = (0,
|
|
18568
|
+
const [qrCodeUrl, setQrCodeUrl] = (0, import_react61.useState)("");
|
|
18569
|
+
const [copied, setCopied] = (0, import_react61.useState)(false);
|
|
18570
|
+
const [fingerprintCopied, setFingerprintCopied] = (0, import_react61.useState)(false);
|
|
18571
|
+
const fingerprint = (0, import_react61.useMemo)(() => {
|
|
18530
18572
|
if (!session?.ownerAddress) return null;
|
|
18531
18573
|
try {
|
|
18532
18574
|
return generateFingerprint(session.ownerAddress);
|
|
@@ -18534,7 +18576,7 @@ function ReceiveMenu() {
|
|
|
18534
18576
|
return null;
|
|
18535
18577
|
}
|
|
18536
18578
|
}, [session?.ownerAddress]);
|
|
18537
|
-
(0,
|
|
18579
|
+
(0, import_react61.useEffect)(() => {
|
|
18538
18580
|
if (open && address) {
|
|
18539
18581
|
import_qrcode.default.toDataURL(address, {
|
|
18540
18582
|
width: 200,
|
|
@@ -18547,7 +18589,7 @@ function ReceiveMenu() {
|
|
|
18547
18589
|
});
|
|
18548
18590
|
}
|
|
18549
18591
|
}, [open, address]);
|
|
18550
|
-
const handleCopy = (0,
|
|
18592
|
+
const handleCopy = (0, import_react61.useCallback)(async () => {
|
|
18551
18593
|
if (!address) return;
|
|
18552
18594
|
try {
|
|
18553
18595
|
await navigator.clipboard.writeText(address);
|
|
@@ -18557,7 +18599,7 @@ function ReceiveMenu() {
|
|
|
18557
18599
|
console.error("Failed to copy address:", error);
|
|
18558
18600
|
}
|
|
18559
18601
|
}, [address]);
|
|
18560
|
-
const handleCopyFingerprint = (0,
|
|
18602
|
+
const handleCopyFingerprint = (0, import_react61.useCallback)(async () => {
|
|
18561
18603
|
if (!fingerprint) return;
|
|
18562
18604
|
try {
|
|
18563
18605
|
await navigator.clipboard.writeText(fingerprint);
|
|
@@ -18618,14 +18660,14 @@ function ReceiveMenu() {
|
|
|
18618
18660
|
}
|
|
18619
18661
|
);
|
|
18620
18662
|
}
|
|
18621
|
-
var import_lucide_react52, import_qrcode,
|
|
18663
|
+
var import_lucide_react52, import_qrcode, import_react61, import_jsx_runtime83;
|
|
18622
18664
|
var init_ReceiveMenu = __esm({
|
|
18623
18665
|
"src/internal/components/ReceiveMenu/ReceiveMenu.tsx"() {
|
|
18624
18666
|
init_SessionContext();
|
|
18625
18667
|
init_i18n();
|
|
18626
18668
|
import_lucide_react52 = require("lucide-react");
|
|
18627
18669
|
import_qrcode = __toESM(require("qrcode"), 1);
|
|
18628
|
-
|
|
18670
|
+
import_react61 = require("react");
|
|
18629
18671
|
init_useLayoutDataStore();
|
|
18630
18672
|
init_useLayoutStore();
|
|
18631
18673
|
init_nickname_fingerprint();
|
|
@@ -19099,7 +19141,7 @@ function SecurityMenu() {
|
|
|
19099
19141
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
19100
19142
|
const userId = import_auth21.jwtTokenManager.getUserId();
|
|
19101
19143
|
const serverHasKeyshare = import_auth21.jwtTokenManager.getHasKeyshare() ?? false;
|
|
19102
|
-
const [appToUntrust, untrustApp] = (0,
|
|
19144
|
+
const [appToUntrust, untrustApp] = (0, import_react62.useState)(null);
|
|
19103
19145
|
const { data: recoveryData, isLoading: isRecoveryLoading } = useKeyshareRecoveryStats();
|
|
19104
19146
|
const localInfo = recoveryData?.keyshareInfo || {};
|
|
19105
19147
|
const hasServerBackup = !!recoveryData?.shareRecoveryStats?.created || recoveryData?.shareRecoveryStats?.devices?.length > 0;
|
|
@@ -19175,13 +19217,13 @@ function SecurityMenu() {
|
|
|
19175
19217
|
}
|
|
19176
19218
|
);
|
|
19177
19219
|
}
|
|
19178
|
-
var import_react_query43, import_lucide_react58,
|
|
19220
|
+
var import_react_query43, import_lucide_react58, import_react62, import_jsx_runtime90;
|
|
19179
19221
|
var init_SecurityMenu = __esm({
|
|
19180
19222
|
"src/internal/components/SecurityMenu/SecurityMenu.tsx"() {
|
|
19181
19223
|
init_i18n();
|
|
19182
19224
|
import_react_query43 = require("@tanstack/react-query");
|
|
19183
19225
|
import_lucide_react58 = require("lucide-react");
|
|
19184
|
-
|
|
19226
|
+
import_react62 = require("react");
|
|
19185
19227
|
init_auth();
|
|
19186
19228
|
init_useLayoutDataStore();
|
|
19187
19229
|
init_useLayoutStore();
|
|
@@ -19358,23 +19400,23 @@ var init_useFlowSelector = __esm({
|
|
|
19358
19400
|
});
|
|
19359
19401
|
|
|
19360
19402
|
// src/internal/components/SendMenu/hyperbridge/lib/chains.ts
|
|
19361
|
-
var
|
|
19403
|
+
var import_read14, import_chains, CHAINS_UI_META;
|
|
19362
19404
|
var init_chains = __esm({
|
|
19363
19405
|
"src/internal/components/SendMenu/hyperbridge/lib/chains.ts"() {
|
|
19364
19406
|
init_EthereumIcon();
|
|
19365
19407
|
init_LumiaIcon2();
|
|
19366
19408
|
init_BscIcon();
|
|
19367
|
-
|
|
19409
|
+
import_read14 = require("@embarkai/core/read");
|
|
19368
19410
|
import_chains = require("wagmi/chains");
|
|
19369
19411
|
CHAINS_UI_META = {
|
|
19370
19412
|
lumiaprism: {
|
|
19371
|
-
chainID:
|
|
19372
|
-
chainLabel:
|
|
19413
|
+
chainID: import_read14.lumiaMainnetChain.id,
|
|
19414
|
+
chainLabel: import_read14.lumiaMainnetChain.name,
|
|
19373
19415
|
chainName: "lumiaprism",
|
|
19374
19416
|
// exact hyperlane registry chain name
|
|
19375
19417
|
Icon: LumiaIcon2,
|
|
19376
|
-
explorerUrl:
|
|
19377
|
-
chain:
|
|
19418
|
+
explorerUrl: import_read14.lumiaMainnetChain.blockExplorers.default.url,
|
|
19419
|
+
chain: import_read14.lumiaMainnetChain
|
|
19378
19420
|
},
|
|
19379
19421
|
bsc: {
|
|
19380
19422
|
chainID: import_chains.bsc.id,
|
|
@@ -19478,16 +19520,16 @@ function SenderSelector() {
|
|
|
19478
19520
|
const { openConnectModal } = (0, import_rainbowkit.useConnectModal)();
|
|
19479
19521
|
const directWalletAddress = useExternalWalletStore((st) => st.externalAddress);
|
|
19480
19522
|
const directWalletIsConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
19481
|
-
const pendingWalletRef = (0,
|
|
19523
|
+
const pendingWalletRef = (0, import_react63.useRef)(null);
|
|
19482
19524
|
const { profiles } = useLinkedProfiles();
|
|
19483
19525
|
const originChain = useBridgeStore((st) => st.originChain);
|
|
19484
19526
|
const bridgeSender = useBridgeStore((st) => st.bridgeSender);
|
|
19485
19527
|
const bridgeSenders = useBridgeStore((st) => st.bridgeSenders);
|
|
19486
|
-
const [walletMessage, setWalletMessage] = (0,
|
|
19487
|
-
(0,
|
|
19528
|
+
const [walletMessage, setWalletMessage] = (0, import_react63.useState)(null);
|
|
19529
|
+
(0, import_react63.useEffect)(() => {
|
|
19488
19530
|
useFlowSelectorStore.getState().setRenderKey(`sender-selected-${Date.now()}`);
|
|
19489
19531
|
}, [walletMessage]);
|
|
19490
|
-
(0,
|
|
19532
|
+
(0, import_react63.useEffect)(() => {
|
|
19491
19533
|
const pending = pendingWalletRef.current;
|
|
19492
19534
|
if (!pending || !directWalletIsConnected || !directWalletAddress) return;
|
|
19493
19535
|
if (directWalletAddress.toLowerCase() !== pending.externalId?.toLowerCase()) return;
|
|
@@ -19618,7 +19660,7 @@ function SenderSelector() {
|
|
|
19618
19660
|
] })
|
|
19619
19661
|
] });
|
|
19620
19662
|
}
|
|
19621
|
-
var import_rainbowkit, import_react_query44,
|
|
19663
|
+
var import_rainbowkit, import_react_query44, import_react63, import_wagmi, import_jsx_runtime91;
|
|
19622
19664
|
var init_SenderSelector = __esm({
|
|
19623
19665
|
"src/internal/components/SendMenu/hyperbridge/components/SenderSelector.tsx"() {
|
|
19624
19666
|
init_ProviderContext();
|
|
@@ -19626,7 +19668,7 @@ var init_SenderSelector = __esm({
|
|
|
19626
19668
|
init_linkedProfiles();
|
|
19627
19669
|
import_rainbowkit = require("@rainbow-me/rainbowkit");
|
|
19628
19670
|
import_react_query44 = require("@tanstack/react-query");
|
|
19629
|
-
|
|
19671
|
+
import_react63 = require("react");
|
|
19630
19672
|
import_wagmi = require("wagmi");
|
|
19631
19673
|
init_wallet();
|
|
19632
19674
|
init_useLayoutDataStore();
|
|
@@ -19819,7 +19861,7 @@ function useBridge() {
|
|
|
19819
19861
|
const address = useSession((st) => st.address);
|
|
19820
19862
|
const { data: walletClient } = (0, import_wagmi2.useWalletClient)();
|
|
19821
19863
|
const { switchChainAsync } = (0, import_wagmi2.useSwitchChain)();
|
|
19822
|
-
const swapDirection = (0,
|
|
19864
|
+
const swapDirection = (0, import_react64.useCallback)(() => {
|
|
19823
19865
|
const {
|
|
19824
19866
|
bridgeStep,
|
|
19825
19867
|
originChain,
|
|
@@ -19872,7 +19914,7 @@ function useBridge() {
|
|
|
19872
19914
|
useFlowSelectorStore.getState().setError(error instanceof Error ? error.message : String(error));
|
|
19873
19915
|
}
|
|
19874
19916
|
});
|
|
19875
|
-
const handleQuoteEstimation = (0,
|
|
19917
|
+
const handleQuoteEstimation = (0, import_react64.useCallback)((amnt) => {
|
|
19876
19918
|
const { originChain, destinationChain, bridgeSender } = useBridgeStore.getState();
|
|
19877
19919
|
if (!amnt || !Number(amnt)) {
|
|
19878
19920
|
useBridgeStore.getState().setQuote(null);
|
|
@@ -19998,14 +20040,14 @@ function useBridge() {
|
|
|
19998
20040
|
isAssetBridging
|
|
19999
20041
|
};
|
|
20000
20042
|
}
|
|
20001
|
-
var import_react_query45,
|
|
20043
|
+
var import_react_query45, import_react64, import_wagmi2;
|
|
20002
20044
|
var init_useBridge = __esm({
|
|
20003
20045
|
"src/internal/components/SendMenu/hyperbridge/hooks/useBridge.ts"() {
|
|
20004
20046
|
init_SessionContext();
|
|
20005
20047
|
init_i18n();
|
|
20006
20048
|
init_useExternalWalletStore();
|
|
20007
20049
|
import_react_query45 = require("@tanstack/react-query");
|
|
20008
|
-
|
|
20050
|
+
import_react64 = require("react");
|
|
20009
20051
|
import_wagmi2 = require("wagmi");
|
|
20010
20052
|
init_useLayoutStore();
|
|
20011
20053
|
init_useFlowSelector();
|
|
@@ -20034,7 +20076,7 @@ function useHyperlaneRoutes() {
|
|
|
20034
20076
|
queryKey: [HYPERLANE_WARP_ROUTES_QUERY_KEY, address],
|
|
20035
20077
|
queryFn: async () => getHyperlaneWarpRoutes()
|
|
20036
20078
|
});
|
|
20037
|
-
(0,
|
|
20079
|
+
(0, import_react65.useEffect)(() => {
|
|
20038
20080
|
if (!errorWarpRoutes) return;
|
|
20039
20081
|
useFlowSelectorStore.getState().setError(errorWarpRoutes.message);
|
|
20040
20082
|
const { resetSelections, setRecipient, setOriginChain, setDestinationChain } = useBridgeStore.getState();
|
|
@@ -20043,7 +20085,7 @@ function useHyperlaneRoutes() {
|
|
|
20043
20085
|
setOriginChain(null);
|
|
20044
20086
|
setDestinationChain(null);
|
|
20045
20087
|
}, [errorWarpRoutes]);
|
|
20046
|
-
(0,
|
|
20088
|
+
(0, import_react65.useEffect)(() => {
|
|
20047
20089
|
if (!!hyperRoute || !hyperlaneWarpRoutes.length) return;
|
|
20048
20090
|
const warpRouteToAutoSelect = hyperlaneWarpRoutes.find((route) => route.routeId === hyperRoute);
|
|
20049
20091
|
let originChainIndex = 0;
|
|
@@ -20063,12 +20105,12 @@ function useHyperlaneRoutes() {
|
|
|
20063
20105
|
}, [hyperRoute, hyperlaneWarpRoutes]);
|
|
20064
20106
|
return { hyperlaneWarpRoutes, isLoadingWarpRoutes };
|
|
20065
20107
|
}
|
|
20066
|
-
var import_react_query46,
|
|
20108
|
+
var import_react_query46, import_react65, HYPERLANE_WARP_ROUTES_QUERY_KEY;
|
|
20067
20109
|
var init_useHyperlaneRoutes = __esm({
|
|
20068
20110
|
"src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneRoutes.ts"() {
|
|
20069
20111
|
init_SessionContext();
|
|
20070
20112
|
import_react_query46 = require("@tanstack/react-query");
|
|
20071
|
-
|
|
20113
|
+
import_react65 = require("react");
|
|
20072
20114
|
init_useLayoutDataStore();
|
|
20073
20115
|
init_useFlowSelector();
|
|
20074
20116
|
init_api4();
|
|
@@ -20083,7 +20125,7 @@ function useMenuTitle(warpRoutes) {
|
|
|
20083
20125
|
const { t } = useT();
|
|
20084
20126
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
20085
20127
|
const hyperRouteMeta = useBridgeStore((st) => (warpRoutes || [])?.find((route) => route.routeId === st.hyperRoute)) || null;
|
|
20086
|
-
(0,
|
|
20128
|
+
(0, import_react66.useEffect)(() => {
|
|
20087
20129
|
const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
|
|
20088
20130
|
switch (true) {
|
|
20089
20131
|
case bridgeStep === "sender-selector":
|
|
@@ -20111,11 +20153,11 @@ function useMenuTitle(warpRoutes) {
|
|
|
20111
20153
|
}
|
|
20112
20154
|
}, [bridgeStep, hyperRouteMeta, t]);
|
|
20113
20155
|
}
|
|
20114
|
-
var
|
|
20156
|
+
var import_react66;
|
|
20115
20157
|
var init_useMenuTitle = __esm({
|
|
20116
20158
|
"src/internal/components/SendMenu/hyperbridge/hooks/useMenuTitle.ts"() {
|
|
20117
20159
|
init_i18n();
|
|
20118
|
-
|
|
20160
|
+
import_react66 = require("react");
|
|
20119
20161
|
init_useFlowSelector();
|
|
20120
20162
|
init_useBridgeStore();
|
|
20121
20163
|
}
|
|
@@ -20232,8 +20274,8 @@ function useAvailableSenders() {
|
|
|
20232
20274
|
const activeChainId = useSession((st) => st.activeChainId);
|
|
20233
20275
|
const { profiles } = useLinkedProfiles();
|
|
20234
20276
|
const walletProfiles = profiles.filter((p) => p.provider === "wallet");
|
|
20235
|
-
const lastCalcedSenders = (0,
|
|
20236
|
-
(0,
|
|
20277
|
+
const lastCalcedSenders = (0, import_react67.useRef)([]);
|
|
20278
|
+
(0, import_react67.useEffect)(() => {
|
|
20237
20279
|
const sendersAccumulator = [
|
|
20238
20280
|
{
|
|
20239
20281
|
type: "embarkai-wallet",
|
|
@@ -20262,13 +20304,13 @@ function useAvailableSenders() {
|
|
|
20262
20304
|
useFlowSelectorStore.getState().setRenderKey(`sender-selected-${Date.now()}`);
|
|
20263
20305
|
}, [address, walletProfiles, activeChainId]);
|
|
20264
20306
|
}
|
|
20265
|
-
var
|
|
20307
|
+
var import_react67;
|
|
20266
20308
|
var init_useAvailableSenders = __esm({
|
|
20267
20309
|
"src/internal/components/SendMenu/hyperbridge/hooks/useAvailableSenders.ts"() {
|
|
20268
20310
|
init_SessionContext();
|
|
20269
20311
|
init_tokens();
|
|
20270
20312
|
init_linkedProfiles();
|
|
20271
|
-
|
|
20313
|
+
import_react67 = require("react");
|
|
20272
20314
|
init_wallets();
|
|
20273
20315
|
init_useFlowSelector();
|
|
20274
20316
|
init_useBridgeStore();
|
|
@@ -20357,7 +20399,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20357
20399
|
enabled: bridgeSender === "direct-wallet" && isSelectedTokenNative && !!directWalletAddress && !!routeTokenAddress && !!originChain
|
|
20358
20400
|
}
|
|
20359
20401
|
});
|
|
20360
|
-
const refreshRouteTokenBalance = (0,
|
|
20402
|
+
const refreshRouteTokenBalance = (0, import_react68.useCallback)(
|
|
20361
20403
|
(senderWallet) => {
|
|
20362
20404
|
switch (true) {
|
|
20363
20405
|
case senderWallet === "embarkai-wallet":
|
|
@@ -20373,7 +20415,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20373
20415
|
},
|
|
20374
20416
|
[refreshBalances, qc, refetchExternalNativeBalance]
|
|
20375
20417
|
);
|
|
20376
|
-
(0,
|
|
20418
|
+
(0, import_react68.useEffect)(() => {
|
|
20377
20419
|
if (!bridgeSender || !originChain) return;
|
|
20378
20420
|
switch (bridgeSender) {
|
|
20379
20421
|
case "embarkai-wallet":
|
|
@@ -20404,13 +20446,13 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20404
20446
|
isRouteTokenBalanceLoading: isAssetsLoading || isExternalBalanceLoading || isExternalNativeBalanceLoading
|
|
20405
20447
|
};
|
|
20406
20448
|
}
|
|
20407
|
-
var import_react_query47,
|
|
20449
|
+
var import_react_query47, import_react68, import_viem13, import_wagmi3, EXTERNAL_WALLET_BRIDGING_BALANCE_QUERY;
|
|
20408
20450
|
var init_useBridgeBalance = __esm({
|
|
20409
20451
|
"src/internal/components/SendMenu/hyperbridge/hooks/useBridgeBalance.ts"() {
|
|
20410
20452
|
init_SessionContext();
|
|
20411
20453
|
init_i18n();
|
|
20412
20454
|
import_react_query47 = require("@tanstack/react-query");
|
|
20413
|
-
|
|
20455
|
+
import_react68 = require("react");
|
|
20414
20456
|
import_viem13 = require("viem");
|
|
20415
20457
|
import_wagmi3 = require("wagmi");
|
|
20416
20458
|
init_useBlockscoutAssets();
|
|
@@ -20491,11 +20533,11 @@ function SelectStep(props) {
|
|
|
20491
20533
|
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: "text-[var(--ui-kit-fg-muted)]", children: t("passport:bridgeMenu.labels.selectToken") }),
|
|
20492
20534
|
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: "w-4 h-4" }),
|
|
20493
20535
|
/* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("span", { className: "flex items-center gap-[var(--ui-kit-gap)] leading-4", children: [
|
|
20494
|
-
isRouteTokenBalanceLoading && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_lucide_react60.LoaderIcon, { className: "w-4 h-4 animate-spin" }),
|
|
20495
20536
|
/* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("span", { className: "text-[var(--ui-kit-fg-muted)]", children: [
|
|
20496
20537
|
t("passport:common.balance"),
|
|
20497
20538
|
": "
|
|
20498
20539
|
] }),
|
|
20540
|
+
isRouteTokenBalanceLoading && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_lucide_react60.LoaderIcon, { className: "w-4 h-4 animate-spin text-[var(--ui-kit-fg-muted)]" }),
|
|
20499
20541
|
!isRouteTokenBalanceLoading && /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("span", { className: "font-semibold", children: [
|
|
20500
20542
|
formatPrice(Number(routeTokenBalance || 0)),
|
|
20501
20543
|
" ",
|
|
@@ -20527,7 +20569,7 @@ function SelectStep(props) {
|
|
|
20527
20569
|
variant: "outline",
|
|
20528
20570
|
size: "medium",
|
|
20529
20571
|
className: "bg-[var(--ui-kit-bg)] flex items-center gap-[var(--ui-kit-gap)]",
|
|
20530
|
-
children: selectedWarpRoute.chainPair.map((chain, chIdx) => /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(
|
|
20572
|
+
children: selectedWarpRoute.chainPair.map((chain, chIdx) => /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(import_react69.Fragment, { children: [
|
|
20531
20573
|
chIdx > 0 && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_lucide_react60.ArrowLeftRightIcon, { className: "w-4 h-4 " }),
|
|
20532
20574
|
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(ResolveChainIcon, { chainName: chain.chainName, className: "w-4 h-4" })
|
|
20533
20575
|
] }, `${selectedWarpRoute.id}-icon-${chain.chainID}-${chIdx}`))
|
|
@@ -20665,13 +20707,13 @@ function SelectStep(props) {
|
|
|
20665
20707
|
)
|
|
20666
20708
|
] });
|
|
20667
20709
|
}
|
|
20668
|
-
var import_lucide_react60,
|
|
20710
|
+
var import_lucide_react60, import_react69, import_jsx_runtime95;
|
|
20669
20711
|
var init_SelectStep = __esm({
|
|
20670
20712
|
"src/internal/components/SendMenu/hyperbridge/steps/SelectStep.tsx"() {
|
|
20671
20713
|
init_tokens();
|
|
20672
20714
|
init_i18n();
|
|
20673
20715
|
import_lucide_react60 = require("lucide-react");
|
|
20674
|
-
|
|
20716
|
+
import_react69 = require("react");
|
|
20675
20717
|
init_priceFormatter();
|
|
20676
20718
|
init_utils2();
|
|
20677
20719
|
init_badge();
|
|
@@ -20721,7 +20763,7 @@ var init_checkbox = __esm({
|
|
|
20721
20763
|
// src/internal/components/SendMenu/hyperbridge/steps/ConfirmStep.tsx
|
|
20722
20764
|
function ConfirmStep(props) {
|
|
20723
20765
|
const { isAssetBridging, bridgeAsset, hyperlaneWarpRoutes } = props;
|
|
20724
|
-
const [userConsent, setUserConsent] = (0,
|
|
20766
|
+
const [userConsent, setUserConsent] = (0, import_react70.useState)(false);
|
|
20725
20767
|
const { t } = useT();
|
|
20726
20768
|
const address = useSession((st) => st.address);
|
|
20727
20769
|
const bridgeSender = useBridgeStore((st) => st.bridgeSenders.find((s) => s.type === st.bridgeSender));
|
|
@@ -20829,13 +20871,13 @@ function ConfirmStep(props) {
|
|
|
20829
20871
|
)
|
|
20830
20872
|
] });
|
|
20831
20873
|
}
|
|
20832
|
-
var import_lucide_react62,
|
|
20874
|
+
var import_lucide_react62, import_react70, import_jsx_runtime97, P_CN;
|
|
20833
20875
|
var init_ConfirmStep = __esm({
|
|
20834
20876
|
"src/internal/components/SendMenu/hyperbridge/steps/ConfirmStep.tsx"() {
|
|
20835
20877
|
init_SessionContext();
|
|
20836
20878
|
init_i18n();
|
|
20837
20879
|
import_lucide_react62 = require("lucide-react");
|
|
20838
|
-
|
|
20880
|
+
import_react70 = require("react");
|
|
20839
20881
|
init_priceFormatter();
|
|
20840
20882
|
init_utils2();
|
|
20841
20883
|
init_button();
|
|
@@ -20945,7 +20987,7 @@ function useHyperlaneHistory() {
|
|
|
20945
20987
|
const page = useLayoutDataStore((st) => st.page);
|
|
20946
20988
|
const flow = useFlowSelectorStore((st) => st.flow);
|
|
20947
20989
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
20948
|
-
const [currentPage, setCurrentPage] = (0,
|
|
20990
|
+
const [currentPage, setCurrentPage] = (0, import_react71.useState)(1);
|
|
20949
20991
|
const query = (0, import_react_query48.useQuery)({
|
|
20950
20992
|
retry: false,
|
|
20951
20993
|
refetchInterval: TX_HISTORY_POLLING_INTERVAL,
|
|
@@ -20959,12 +21001,12 @@ function useHyperlaneHistory() {
|
|
|
20959
21001
|
setCurrentPage
|
|
20960
21002
|
};
|
|
20961
21003
|
}
|
|
20962
|
-
var import_react_query48,
|
|
21004
|
+
var import_react_query48, import_react71, HYPERLANE_HISTORY_QUERY_KEY, TX_HISTORY_PAGE_SIZE, TX_HISTORY_POLLING_INTERVAL;
|
|
20963
21005
|
var init_useHyperlaneHistory = __esm({
|
|
20964
21006
|
"src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneHistory.ts"() {
|
|
20965
21007
|
init_SessionContext();
|
|
20966
21008
|
import_react_query48 = require("@tanstack/react-query");
|
|
20967
|
-
|
|
21009
|
+
import_react71 = require("react");
|
|
20968
21010
|
init_useLayoutDataStore();
|
|
20969
21011
|
init_useFlowSelector();
|
|
20970
21012
|
init_api4();
|
|
@@ -21229,9 +21271,9 @@ var init_HistoryStep = __esm({
|
|
|
21229
21271
|
function SelectAssetRoute(props) {
|
|
21230
21272
|
const { hyperlaneWarpRoutes } = props;
|
|
21231
21273
|
const { t } = useT();
|
|
21232
|
-
const [isTokenSymbolSelector, setIsTokenSymbolSelector] = (0,
|
|
21274
|
+
const [isTokenSymbolSelector, setIsTokenSymbolSelector] = (0, import_react72.useState)(false);
|
|
21233
21275
|
const selectedAssetSymbol = useBridgeStore((st) => st.bridgeAssetSymbol);
|
|
21234
|
-
const tokenList = (0,
|
|
21276
|
+
const tokenList = (0, import_react72.useMemo)(() => {
|
|
21235
21277
|
const tokens = hyperlaneWarpRoutes.map((route) => route.symbol);
|
|
21236
21278
|
const uniqueTokens = Array.from(new Set(tokens));
|
|
21237
21279
|
return uniqueTokens.map((symbol) => ({
|
|
@@ -21328,13 +21370,13 @@ function SelectAssetRoute(props) {
|
|
|
21328
21370
|
] })
|
|
21329
21371
|
] });
|
|
21330
21372
|
}
|
|
21331
|
-
var import_lucide_react64,
|
|
21373
|
+
var import_lucide_react64, import_react72, import_jsx_runtime100;
|
|
21332
21374
|
var init_SelectAssetRoute = __esm({
|
|
21333
21375
|
"src/internal/components/SendMenu/hyperbridge/steps/SelectAssetRoute.tsx"() {
|
|
21334
21376
|
init_tokens();
|
|
21335
21377
|
init_i18n();
|
|
21336
21378
|
import_lucide_react64 = require("lucide-react");
|
|
21337
|
-
|
|
21379
|
+
import_react72 = require("react");
|
|
21338
21380
|
init_button();
|
|
21339
21381
|
init_useFlowSelector();
|
|
21340
21382
|
init_ResolveChainIcon();
|
|
@@ -21361,7 +21403,7 @@ function HyperlaneBridge() {
|
|
|
21361
21403
|
const { swapDirection, handleQuoteEstimation, bridgeAsset, isAssetBridging } = useBridge();
|
|
21362
21404
|
const { hyperlaneWarpRoutes, isLoadingWarpRoutes } = useHyperlaneRoutes();
|
|
21363
21405
|
useMenuTitle(hyperlaneWarpRoutes);
|
|
21364
|
-
(0,
|
|
21406
|
+
(0, import_react73.useEffect)(
|
|
21365
21407
|
() => () => {
|
|
21366
21408
|
useBridgeStore.getState().resetSelections();
|
|
21367
21409
|
},
|
|
@@ -21395,10 +21437,10 @@ function HyperlaneBridge() {
|
|
|
21395
21437
|
bridgeStep === "tx-history-details" && /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(HistoryDetailsStep, {})
|
|
21396
21438
|
] });
|
|
21397
21439
|
}
|
|
21398
|
-
var
|
|
21440
|
+
var import_react73, import_jsx_runtime101;
|
|
21399
21441
|
var init_HyperlaneBridge = __esm({
|
|
21400
21442
|
"src/internal/components/SendMenu/hyperbridge/HyperlaneBridge.tsx"() {
|
|
21401
|
-
|
|
21443
|
+
import_react73 = require("react");
|
|
21402
21444
|
init_SenderSelector();
|
|
21403
21445
|
init_useBridge();
|
|
21404
21446
|
init_useHyperlaneRoutes();
|
|
@@ -21415,7 +21457,7 @@ function BridgeHistorySwitch(props) {
|
|
|
21415
21457
|
const selectorFlow = useFlowSelectorStore((st) => st.flow);
|
|
21416
21458
|
const isUiLocked = useFlowSelectorStore((st) => st.isUiLocked);
|
|
21417
21459
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
21418
|
-
const lastBridgeStepRef = (0,
|
|
21460
|
+
const lastBridgeStepRef = (0, import_react74.useRef)(null);
|
|
21419
21461
|
if (selectorFlow !== "bridge" || bridgeStep === "confirm" || bridgeStep === "success" || bridgeStep === "sender-selector" || bridgeStep === "select-token" || bridgeStep === "tx-history-details") {
|
|
21420
21462
|
return null;
|
|
21421
21463
|
}
|
|
@@ -21433,10 +21475,10 @@ function BridgeHistorySwitch(props) {
|
|
|
21433
21475
|
}
|
|
21434
21476
|
);
|
|
21435
21477
|
}
|
|
21436
|
-
var
|
|
21478
|
+
var import_react74, import_jsx_runtime102;
|
|
21437
21479
|
var init_HistorySwitch = __esm({
|
|
21438
21480
|
"src/internal/components/SendMenu/hyperbridge/components/HistorySwitch.tsx"() {
|
|
21439
|
-
|
|
21481
|
+
import_react74 = require("react");
|
|
21440
21482
|
init_switch();
|
|
21441
21483
|
init_useFlowSelector();
|
|
21442
21484
|
init_useBridgeStore();
|
|
@@ -21527,11 +21569,11 @@ function looksLikeNickname(input) {
|
|
|
21527
21569
|
}
|
|
21528
21570
|
function useNicknameResolve(input, options) {
|
|
21529
21571
|
const { enabled = true, chainId } = options;
|
|
21530
|
-
const [debouncedInput, setDebouncedInput] = (0,
|
|
21531
|
-
const [isDebouncing, setIsDebouncing] = (0,
|
|
21572
|
+
const [debouncedInput, setDebouncedInput] = (0, import_react75.useState)("");
|
|
21573
|
+
const [isDebouncing, setIsDebouncing] = (0, import_react75.useState)(false);
|
|
21532
21574
|
const normalized = normalizeNickname(input);
|
|
21533
21575
|
const isNicknameInput = looksLikeNickname(input) && normalized.length >= 3;
|
|
21534
|
-
(0,
|
|
21576
|
+
(0, import_react75.useEffect)(() => {
|
|
21535
21577
|
if (!isNicknameInput || !enabled) {
|
|
21536
21578
|
setDebouncedInput("");
|
|
21537
21579
|
setIsDebouncing(false);
|
|
@@ -21557,7 +21599,7 @@ function useNicknameResolve(input, options) {
|
|
|
21557
21599
|
const isNotFound = query.isError && query.error?.code === "NICKNAME_NOT_FOUND";
|
|
21558
21600
|
const isWalletNotSetup = !!query.data && query.data.resolvedTarget === null;
|
|
21559
21601
|
const isFrozen = query.data?.isFrozen ?? false;
|
|
21560
|
-
const fingerprintVerification = (0,
|
|
21602
|
+
const fingerprintVerification = (0, import_react75.useMemo)(() => {
|
|
21561
21603
|
if (!query.data?.owner || !query.data?.fingerprint) {
|
|
21562
21604
|
return null;
|
|
21563
21605
|
}
|
|
@@ -21579,11 +21621,11 @@ function useNicknameResolve(input, options) {
|
|
|
21579
21621
|
resolvedAddress
|
|
21580
21622
|
};
|
|
21581
21623
|
}
|
|
21582
|
-
var import_react_query50,
|
|
21624
|
+
var import_react_query50, import_react75, DEBOUNCE_MS2;
|
|
21583
21625
|
var init_useNicknameResolve = __esm({
|
|
21584
21626
|
"src/hooks/useNicknameResolve.ts"() {
|
|
21585
21627
|
import_react_query50 = require("@tanstack/react-query");
|
|
21586
|
-
|
|
21628
|
+
import_react75 = require("react");
|
|
21587
21629
|
init_nickname();
|
|
21588
21630
|
init_profile();
|
|
21589
21631
|
init_nickname_validation();
|
|
@@ -21596,10 +21638,10 @@ var init_useNicknameResolve = __esm({
|
|
|
21596
21638
|
function useSendTransaction() {
|
|
21597
21639
|
const session = useSession((st) => st.session);
|
|
21598
21640
|
const address = useSession((st) => st.address);
|
|
21599
|
-
const [isLoading, setIsLoading] = (0,
|
|
21600
|
-
const [error, setError] = (0,
|
|
21601
|
-
const [userOpHash, setUserOpHash] = (0,
|
|
21602
|
-
const sendTransaction = (0,
|
|
21641
|
+
const [isLoading, setIsLoading] = (0, import_react76.useState)(false);
|
|
21642
|
+
const [error, setError] = (0, import_react76.useState)(null);
|
|
21643
|
+
const [userOpHash, setUserOpHash] = (0, import_react76.useState)(null);
|
|
21644
|
+
const sendTransaction = (0, import_react76.useCallback)(
|
|
21603
21645
|
async (params) => {
|
|
21604
21646
|
if (!session || !address) {
|
|
21605
21647
|
setError("No active session");
|
|
@@ -21696,7 +21738,7 @@ function useSendTransaction() {
|
|
|
21696
21738
|
},
|
|
21697
21739
|
[session, address]
|
|
21698
21740
|
);
|
|
21699
|
-
const reset = (0,
|
|
21741
|
+
const reset = (0, import_react76.useCallback)(() => {
|
|
21700
21742
|
setError(null);
|
|
21701
21743
|
setUserOpHash(null);
|
|
21702
21744
|
setIsLoading(false);
|
|
@@ -21709,10 +21751,10 @@ function useSendTransaction() {
|
|
|
21709
21751
|
reset
|
|
21710
21752
|
};
|
|
21711
21753
|
}
|
|
21712
|
-
var
|
|
21754
|
+
var import_react76, import_viem14, ERC20_TRANSFER_ABI, ERC721_SAFE_TRANSFER_ABI, ERC1155_SAFE_TRANSFER_ABI;
|
|
21713
21755
|
var init_useSendTransaction = __esm({
|
|
21714
21756
|
"src/hooks/useSendTransaction.ts"() {
|
|
21715
|
-
|
|
21757
|
+
import_react76 = require("react");
|
|
21716
21758
|
import_viem14 = require("viem");
|
|
21717
21759
|
init_SessionContext();
|
|
21718
21760
|
init_account2();
|
|
@@ -21863,7 +21905,7 @@ var init_AssetInputIcon = __esm({
|
|
|
21863
21905
|
|
|
21864
21906
|
// src/internal/components/SendMenu/send/components/NftDisplayCard.tsx
|
|
21865
21907
|
function NftDisplayCard({ asset }) {
|
|
21866
|
-
const [imageError, setImageError] = (0,
|
|
21908
|
+
const [imageError, setImageError] = (0, import_react77.useState)(false);
|
|
21867
21909
|
const nftImage = asset.image || asset.nftMetadata?.image;
|
|
21868
21910
|
return /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("div", { className: "flex items-center gap-3 p-3 rounded-[var(--ui-kit-el-bdrs)] bg-[var(--ui-kit-bg-secondary)]", children: [
|
|
21869
21911
|
nftImage && !imageError ? /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
@@ -21891,11 +21933,11 @@ function NftDisplayCard({ asset }) {
|
|
|
21891
21933
|
] })
|
|
21892
21934
|
] });
|
|
21893
21935
|
}
|
|
21894
|
-
var import_lucide_react66,
|
|
21936
|
+
var import_lucide_react66, import_react77, import_jsx_runtime104;
|
|
21895
21937
|
var init_NftDisplayCard = __esm({
|
|
21896
21938
|
"src/internal/components/SendMenu/send/components/NftDisplayCard.tsx"() {
|
|
21897
21939
|
import_lucide_react66 = require("lucide-react");
|
|
21898
|
-
|
|
21940
|
+
import_react77 = require("react");
|
|
21899
21941
|
import_jsx_runtime104 = require("react/jsx-runtime");
|
|
21900
21942
|
}
|
|
21901
21943
|
});
|
|
@@ -22546,10 +22588,10 @@ function SendMenu() {
|
|
|
22546
22588
|
userOpHash,
|
|
22547
22589
|
reset
|
|
22548
22590
|
} = useSendTransaction();
|
|
22549
|
-
(0,
|
|
22591
|
+
(0, import_react78.useEffect)(() => {
|
|
22550
22592
|
useFlowSelectorStore.getState().setIsUiLocked(isAssetsLoading || isTransactionPending);
|
|
22551
22593
|
}, [isAssetsLoading, isTransactionPending]);
|
|
22552
|
-
(0,
|
|
22594
|
+
(0, import_react78.useEffect)(() => {
|
|
22553
22595
|
useFlowSelectorStore.getState().setError(sendTransactionError || null);
|
|
22554
22596
|
}, [sendTransactionError]);
|
|
22555
22597
|
const {
|
|
@@ -22564,7 +22606,7 @@ function SendMenu() {
|
|
|
22564
22606
|
} = useSendStore();
|
|
22565
22607
|
const isNft = isNftAsset3(selectedAsset);
|
|
22566
22608
|
const isSecurity = isSecurityToken2(selectedAsset);
|
|
22567
|
-
(0,
|
|
22609
|
+
(0, import_react78.useEffect)(
|
|
22568
22610
|
() => () => {
|
|
22569
22611
|
setSelectedAsset(null);
|
|
22570
22612
|
setRecipient("");
|
|
@@ -22574,7 +22616,7 @@ function SendMenu() {
|
|
|
22574
22616
|
},
|
|
22575
22617
|
[]
|
|
22576
22618
|
);
|
|
22577
|
-
(0,
|
|
22619
|
+
(0, import_react78.useEffect)(() => {
|
|
22578
22620
|
const shouldSetNativeAsset = assets.length > 0 && !selectedAsset;
|
|
22579
22621
|
if (!shouldSetNativeAsset) return;
|
|
22580
22622
|
const native = assets.find((a) => a.type === "native");
|
|
@@ -22585,7 +22627,7 @@ function SendMenu() {
|
|
|
22585
22627
|
const isNicknameInput = looksLikeNickname(recipient);
|
|
22586
22628
|
const resolvedNicknameData = useNicknameResolve(recipient, { enabled: isNicknameInput, chainId: activeChainId });
|
|
22587
22629
|
const effectiveAddress = isNicknameInput ? resolvedNicknameData?.resolvedAddress : recipient;
|
|
22588
|
-
const complianceAmount = (0,
|
|
22630
|
+
const complianceAmount = (0, import_react78.useMemo)(() => {
|
|
22589
22631
|
if (!isSecurity || !amount || !selectedAsset) return void 0;
|
|
22590
22632
|
try {
|
|
22591
22633
|
return (0, import_viem18.parseUnits)(amount, selectedAsset.decimals || 18);
|
|
@@ -22600,7 +22642,7 @@ function SendMenu() {
|
|
|
22600
22642
|
enabled: isSecurity && !!effectiveAddress && !!complianceAmount,
|
|
22601
22643
|
chainId: activeChainId
|
|
22602
22644
|
});
|
|
22603
|
-
(0,
|
|
22645
|
+
(0, import_react78.useEffect)(() => {
|
|
22604
22646
|
const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
|
|
22605
22647
|
switch (true) {
|
|
22606
22648
|
case txStep === "select-asset":
|
|
@@ -22664,7 +22706,7 @@ function SendMenu() {
|
|
|
22664
22706
|
] })
|
|
22665
22707
|
] });
|
|
22666
22708
|
}
|
|
22667
|
-
var import_lucide_react70,
|
|
22709
|
+
var import_lucide_react70, import_react78, import_viem18, import_jsx_runtime109;
|
|
22668
22710
|
var init_SendMenu = __esm({
|
|
22669
22711
|
"src/internal/components/SendMenu/send/SendMenu.tsx"() {
|
|
22670
22712
|
init_SessionContext();
|
|
@@ -22673,7 +22715,7 @@ var init_SendMenu = __esm({
|
|
|
22673
22715
|
init_useSendTransaction();
|
|
22674
22716
|
init_useT();
|
|
22675
22717
|
import_lucide_react70 = require("lucide-react");
|
|
22676
|
-
|
|
22718
|
+
import_react78 = require("react");
|
|
22677
22719
|
import_viem18 = require("viem");
|
|
22678
22720
|
init_useBlockscoutAssets();
|
|
22679
22721
|
init_useLayoutDataStore();
|
|
@@ -22717,7 +22759,7 @@ function SelectorFlowButtons() {
|
|
|
22717
22759
|
Button,
|
|
22718
22760
|
{
|
|
22719
22761
|
size: "medium",
|
|
22720
|
-
variant: selectorFlow === "send" ? "
|
|
22762
|
+
variant: selectorFlow === "send" ? "default" : "ghost",
|
|
22721
22763
|
className: "flex-1 uppercase",
|
|
22722
22764
|
onClick: () => {
|
|
22723
22765
|
useFlowSelectorStore.getState().setError(null);
|
|
@@ -22733,7 +22775,7 @@ function SelectorFlowButtons() {
|
|
|
22733
22775
|
Button,
|
|
22734
22776
|
{
|
|
22735
22777
|
size: "medium",
|
|
22736
|
-
variant: selectorFlow === "bridge" ? "
|
|
22778
|
+
variant: selectorFlow === "bridge" ? "default" : "ghost",
|
|
22737
22779
|
className: "flex-1 uppercase",
|
|
22738
22780
|
onClick: () => {
|
|
22739
22781
|
useFlowSelectorStore.getState().setError(null);
|
|
@@ -22758,7 +22800,7 @@ function SendFlowSelector() {
|
|
|
22758
22800
|
const error = useFlowSelectorStore((st) => st.error);
|
|
22759
22801
|
const menuTitle = useFlowSelectorStore((st) => st.menuTitle);
|
|
22760
22802
|
const selectorFlow = useFlowSelectorStore((st) => st.flow);
|
|
22761
|
-
(0,
|
|
22803
|
+
(0, import_react79.useEffect)(
|
|
22762
22804
|
() => () => {
|
|
22763
22805
|
useFlowSelectorStore.getState().setError(null);
|
|
22764
22806
|
},
|
|
@@ -22835,12 +22877,12 @@ function SendFlowSelector() {
|
|
|
22835
22877
|
}
|
|
22836
22878
|
);
|
|
22837
22879
|
}
|
|
22838
|
-
var import_lucide_react71,
|
|
22880
|
+
var import_lucide_react71, import_react79, import_jsx_runtime110, SELECTOR_FLOW;
|
|
22839
22881
|
var init_SendFlowSelector = __esm({
|
|
22840
22882
|
"src/internal/components/SendMenu/SendFlowSelector.tsx"() {
|
|
22841
22883
|
init_i18n();
|
|
22842
22884
|
import_lucide_react71 = require("lucide-react");
|
|
22843
|
-
|
|
22885
|
+
import_react79 = require("react");
|
|
22844
22886
|
init_useLayoutDataStore();
|
|
22845
22887
|
init_useLayoutStore();
|
|
22846
22888
|
init_utils2();
|
|
@@ -22895,12 +22937,12 @@ function getServerSnapshot() {
|
|
|
22895
22937
|
return false;
|
|
22896
22938
|
}
|
|
22897
22939
|
function useProMode() {
|
|
22898
|
-
return (0,
|
|
22940
|
+
return (0, import_react80.useSyncExternalStore)(subscribe, getSnapshot, getServerSnapshot);
|
|
22899
22941
|
}
|
|
22900
|
-
var
|
|
22942
|
+
var import_react80, STORAGE_KEY, EVENT_NAME;
|
|
22901
22943
|
var init_pro_mode = __esm({
|
|
22902
22944
|
"src/internal/lib/pro-mode.ts"() {
|
|
22903
|
-
|
|
22945
|
+
import_react80 = require("react");
|
|
22904
22946
|
STORAGE_KEY = "embarkai_pro_mode";
|
|
22905
22947
|
EVENT_NAME = "embarkai-pro-mode-changed";
|
|
22906
22948
|
}
|
|
@@ -22960,7 +23002,7 @@ function useSettingsButtons() {
|
|
|
22960
23002
|
if (proMode) {
|
|
22961
23003
|
settingsButtons.push({ id: "devices" /* DEVICES */, name: "Guardians", Icon: import_lucide_react73.HardDrive });
|
|
22962
23004
|
}
|
|
22963
|
-
(0,
|
|
23005
|
+
(0, import_react81.useEffect)(() => {
|
|
22964
23006
|
const cssvEl = document.querySelector(".embarkai-ui-scope");
|
|
22965
23007
|
if (!cssvEl || !window?.getComputedStyle) {
|
|
22966
23008
|
return;
|
|
@@ -23024,7 +23066,7 @@ function SettingsMenu() {
|
|
|
23024
23066
|
}
|
|
23025
23067
|
);
|
|
23026
23068
|
}
|
|
23027
|
-
var import_react_query51, import_lucide_react73,
|
|
23069
|
+
var import_react_query51, import_lucide_react73, import_react81, import_jsx_runtime112;
|
|
23028
23070
|
var init_SettingsMenu = __esm({
|
|
23029
23071
|
"src/internal/components/SettingsMenu/SettingsMenu.tsx"() {
|
|
23030
23072
|
init_ProviderContext();
|
|
@@ -23032,7 +23074,7 @@ var init_SettingsMenu = __esm({
|
|
|
23032
23074
|
init_i18n();
|
|
23033
23075
|
import_react_query51 = require("@tanstack/react-query");
|
|
23034
23076
|
import_lucide_react73 = require("lucide-react");
|
|
23035
|
-
|
|
23077
|
+
import_react81 = require("react");
|
|
23036
23078
|
init_nickname();
|
|
23037
23079
|
init_profile();
|
|
23038
23080
|
init_useLayoutDataStore();
|
|
@@ -23147,27 +23189,27 @@ function getHistoryUrls(params) {
|
|
|
23147
23189
|
}
|
|
23148
23190
|
return getBlockscoutHistoryUrls(params);
|
|
23149
23191
|
}
|
|
23150
|
-
var
|
|
23192
|
+
var import_read15, ETHERSCAN_V2_API_URL, BLOCKSCOUT_API_URLS, CHAIN_SPECIFIC_API_URLS, ETHERSCAN_CHAINS, UNSUPPORTED_HISTORY_CHAINS, TX_HISTORY_URLS;
|
|
23151
23193
|
var init_txUrls = __esm({
|
|
23152
23194
|
"src/internal/components/TransactionsMenu/txUrls.ts"() {
|
|
23153
|
-
|
|
23195
|
+
import_read15 = require("@embarkai/core/read");
|
|
23154
23196
|
init_base();
|
|
23155
23197
|
ETHERSCAN_V2_API_URL = "https://api.etherscan.io/v2/api";
|
|
23156
23198
|
BLOCKSCOUT_API_URLS = {
|
|
23157
|
-
[
|
|
23158
|
-
[
|
|
23199
|
+
[import_read15.ARBITRUM_SEPOLIA_CHAIN_ID]: "https://arbitrum-sepolia.blockscout.com/api",
|
|
23200
|
+
[import_read15.BASE_SEPOLIA_CHAIN_ID]: "https://base-sepolia.blockscout.com/api"
|
|
23159
23201
|
};
|
|
23160
23202
|
CHAIN_SPECIFIC_API_URLS = {};
|
|
23161
23203
|
ETHERSCAN_CHAINS = /* @__PURE__ */ new Set([
|
|
23162
|
-
|
|
23163
|
-
|
|
23164
|
-
|
|
23204
|
+
import_read15.SEPOLIA_CHAIN_ID,
|
|
23205
|
+
import_read15.ARBITRUM_SEPOLIA_CHAIN_ID,
|
|
23206
|
+
import_read15.BASE_SEPOLIA_CHAIN_ID
|
|
23165
23207
|
]);
|
|
23166
23208
|
UNSUPPORTED_HISTORY_CHAINS = /* @__PURE__ */ new Set([
|
|
23167
|
-
|
|
23209
|
+
import_read15.BSC_TESTNET_CHAIN_ID
|
|
23168
23210
|
]);
|
|
23169
23211
|
TX_HISTORY_URLS = {
|
|
23170
|
-
[
|
|
23212
|
+
[import_read15.LUMIA_TESTNET_CHAIN_ID]: (p) => {
|
|
23171
23213
|
const result = getBlockscoutHistoryUrls(p);
|
|
23172
23214
|
return {
|
|
23173
23215
|
transactionsUrl: result.transactionsUrl,
|
|
@@ -23175,7 +23217,7 @@ var init_txUrls = __esm({
|
|
|
23175
23217
|
tokenTransfersUrl: result.tokenTransfersUrl
|
|
23176
23218
|
};
|
|
23177
23219
|
},
|
|
23178
|
-
[
|
|
23220
|
+
[import_read15.LUMIA_MAINNET_CHAIN_ID]: (p) => {
|
|
23179
23221
|
const result = getBlockscoutHistoryUrls(p);
|
|
23180
23222
|
return {
|
|
23181
23223
|
transactionsUrl: result.transactionsUrl,
|
|
@@ -23974,7 +24016,7 @@ function TransactionsMenu() {
|
|
|
23974
24016
|
const { t } = useT();
|
|
23975
24017
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
23976
24018
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
23977
|
-
const [expandedGroups, setExpandedGroups] = (0,
|
|
24019
|
+
const [expandedGroups, setExpandedGroups] = (0, import_react82.useState)({});
|
|
23978
24020
|
const historySupported = isTransactionHistorySupported(chainConfig?.id);
|
|
23979
24021
|
const {
|
|
23980
24022
|
data: txHistoryGroups = [],
|
|
@@ -23987,7 +24029,7 @@ function TransactionsMenu() {
|
|
|
23987
24029
|
queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address],
|
|
23988
24030
|
queryFn: () => getTransactionsListQuery({ address, chainConfig })
|
|
23989
24031
|
});
|
|
23990
|
-
const refreshTxHistory = (0,
|
|
24032
|
+
const refreshTxHistory = (0, import_react82.useCallback)(
|
|
23991
24033
|
() => qc.invalidateQueries({ queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address] }),
|
|
23992
24034
|
[qc, chainConfig.id, address]
|
|
23993
24035
|
);
|
|
@@ -24036,14 +24078,14 @@ function TransactionsMenu() {
|
|
|
24036
24078
|
}
|
|
24037
24079
|
);
|
|
24038
24080
|
}
|
|
24039
|
-
var import_react_query52, import_lucide_react76,
|
|
24081
|
+
var import_react_query52, import_lucide_react76, import_react82, import_jsx_runtime116;
|
|
24040
24082
|
var init_TransactionsMenu = __esm({
|
|
24041
24083
|
"src/internal/components/TransactionsMenu/TransactionsMenu.tsx"() {
|
|
24042
24084
|
init_SessionContext();
|
|
24043
24085
|
init_i18n();
|
|
24044
24086
|
import_react_query52 = require("@tanstack/react-query");
|
|
24045
24087
|
import_lucide_react76 = require("lucide-react");
|
|
24046
|
-
|
|
24088
|
+
import_react82 = require("react");
|
|
24047
24089
|
init_useLayoutDataStore();
|
|
24048
24090
|
init_useLayoutStore();
|
|
24049
24091
|
init_Expandable2();
|
|
@@ -24241,7 +24283,7 @@ function usePageMapper() {
|
|
|
24241
24283
|
setIsDialogOpen,
|
|
24242
24284
|
setIsDialogClosing
|
|
24243
24285
|
} = useLayoutStore();
|
|
24244
|
-
const closeDialog = (0,
|
|
24286
|
+
const closeDialog = (0, import_react83.useCallback)(() => {
|
|
24245
24287
|
setIsDialogClosing(true);
|
|
24246
24288
|
setTimeout(() => {
|
|
24247
24289
|
setDialogContent(null);
|
|
@@ -24252,7 +24294,7 @@ function usePageMapper() {
|
|
|
24252
24294
|
setIsDialogOpen(false);
|
|
24253
24295
|
}, CLEAR_DIALOG_TIMEOUT);
|
|
24254
24296
|
}, [setDialogContent, setDialogDescription, setDialogTitle, setIsDialogForced, setIsDialogOpen, setIsDialogClosing]);
|
|
24255
|
-
const openDialog = (0,
|
|
24297
|
+
const openDialog = (0, import_react83.useCallback)(
|
|
24256
24298
|
(pageItem) => {
|
|
24257
24299
|
const PageContentComponent = pageItem.component;
|
|
24258
24300
|
setDialogTitle(pageItem.title);
|
|
@@ -24262,7 +24304,7 @@ function usePageMapper() {
|
|
|
24262
24304
|
},
|
|
24263
24305
|
[setDialogContent, setDialogDescription, setDialogTitle, setIsDialogOpen]
|
|
24264
24306
|
);
|
|
24265
|
-
(0,
|
|
24307
|
+
(0, import_react83.useEffect)(() => {
|
|
24266
24308
|
if (page === null) return closeDialog();
|
|
24267
24309
|
const pageItem = PAGE_MAP[page];
|
|
24268
24310
|
if (!pageItem) {
|
|
@@ -24273,10 +24315,10 @@ function usePageMapper() {
|
|
|
24273
24315
|
openDialog(pageItem);
|
|
24274
24316
|
}, [page, closeDialog, openDialog]);
|
|
24275
24317
|
}
|
|
24276
|
-
var
|
|
24318
|
+
var import_react83, import_jsx_runtime117, CLEAR_DIALOG_TIMEOUT;
|
|
24277
24319
|
var init_usePageMapper = __esm({
|
|
24278
24320
|
"src/internal/hooks/usePageMapper.tsx"() {
|
|
24279
|
-
|
|
24321
|
+
import_react83 = require("react");
|
|
24280
24322
|
init_PageMap();
|
|
24281
24323
|
init_constants();
|
|
24282
24324
|
init_useLayoutDataStore();
|
|
@@ -24298,26 +24340,26 @@ function useSettingsNotifications() {
|
|
|
24298
24340
|
queryKey: [QUERY_KEYS.userProfile, address],
|
|
24299
24341
|
queryFn: getUserProfile
|
|
24300
24342
|
});
|
|
24301
|
-
(0,
|
|
24343
|
+
(0, import_react84.useEffect)(() => {
|
|
24302
24344
|
const isKYCVerified = userProfile?.kycDetails?.kycStatus === "verified";
|
|
24303
24345
|
setSettingsNotifications({
|
|
24304
24346
|
...COMPLETE_KYC_PROGRESS,
|
|
24305
24347
|
status: isKYCVerified ? "resolved" : "active"
|
|
24306
24348
|
});
|
|
24307
24349
|
}, [userProfile, setSettingsNotifications]);
|
|
24308
|
-
(0,
|
|
24350
|
+
(0, import_react84.useEffect)(() => {
|
|
24309
24351
|
setSettingsNotifications({
|
|
24310
24352
|
...EMAIL_NOT_CONNECTED_NOTIFICATION,
|
|
24311
24353
|
status: hasEmail ? "resolved" : "active"
|
|
24312
24354
|
});
|
|
24313
24355
|
}, [hasEmail, setSettingsNotifications]);
|
|
24314
24356
|
}
|
|
24315
|
-
var import_react_query53,
|
|
24357
|
+
var import_react_query53, import_react84, EMAIL_NOT_CONNECTED_NOTIFICATION, COMPLETE_KYC_PROGRESS;
|
|
24316
24358
|
var init_useSettingsNotifications = __esm({
|
|
24317
24359
|
"src/internal/hooks/useSettingsNotifications.ts"() {
|
|
24318
24360
|
init_SessionContext();
|
|
24319
24361
|
import_react_query53 = require("@tanstack/react-query");
|
|
24320
|
-
|
|
24362
|
+
import_react84 = require("react");
|
|
24321
24363
|
init_auth();
|
|
24322
24364
|
init_profile();
|
|
24323
24365
|
init_useLayoutDataStore();
|
|
@@ -24340,7 +24382,7 @@ var init_package = __esm({
|
|
|
24340
24382
|
"package.json"() {
|
|
24341
24383
|
package_default = {
|
|
24342
24384
|
name: "@embarkai/ui-kit",
|
|
24343
|
-
version: "0.4.
|
|
24385
|
+
version: "0.4.32",
|
|
24344
24386
|
description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
|
|
24345
24387
|
type: "module",
|
|
24346
24388
|
main: "./dist/index.cjs",
|
|
@@ -24567,11 +24609,11 @@ function Header() {
|
|
|
24567
24609
|
const chainConfig = useSession((st) => st.chainConfig);
|
|
24568
24610
|
const { t } = useT();
|
|
24569
24611
|
const proMode = useProMode();
|
|
24570
|
-
const [proToast, setProToast] = (0,
|
|
24571
|
-
const [copied, setCopied] = (0,
|
|
24572
|
-
const clickCountRef = (0,
|
|
24573
|
-
const clickTimerRef = (0,
|
|
24574
|
-
const handleAvatarClick = (0,
|
|
24612
|
+
const [proToast, setProToast] = (0, import_react85.useState)(false);
|
|
24613
|
+
const [copied, setCopied] = (0, import_react85.useState)(false);
|
|
24614
|
+
const clickCountRef = (0, import_react85.useRef)(0);
|
|
24615
|
+
const clickTimerRef = (0, import_react85.useRef)(null);
|
|
24616
|
+
const handleAvatarClick = (0, import_react85.useCallback)(() => {
|
|
24575
24617
|
clickCountRef.current += 1;
|
|
24576
24618
|
if (clickTimerRef.current) {
|
|
24577
24619
|
clearTimeout(clickTimerRef.current);
|
|
@@ -24671,7 +24713,7 @@ function Header() {
|
|
|
24671
24713
|
}
|
|
24672
24714
|
);
|
|
24673
24715
|
}
|
|
24674
|
-
var import_react_query55, import_lucide_react78,
|
|
24716
|
+
var import_react_query55, import_lucide_react78, import_react85, import_jsx_runtime119;
|
|
24675
24717
|
var init_Header = __esm({
|
|
24676
24718
|
"src/internal/components/Header/Header.tsx"() {
|
|
24677
24719
|
init_LumiaIcon3();
|
|
@@ -24681,7 +24723,7 @@ var init_Header = __esm({
|
|
|
24681
24723
|
init_useT();
|
|
24682
24724
|
import_react_query55 = require("@tanstack/react-query");
|
|
24683
24725
|
import_lucide_react78 = require("lucide-react");
|
|
24684
|
-
|
|
24726
|
+
import_react85 = require("react");
|
|
24685
24727
|
init_PositiveIcon();
|
|
24686
24728
|
init_auth();
|
|
24687
24729
|
init_profile();
|
|
@@ -24712,7 +24754,7 @@ function useDecideContentStyles() {
|
|
|
24712
24754
|
style: (0, import_lodash_es7.merge)({}, mobileStyles)
|
|
24713
24755
|
};
|
|
24714
24756
|
}
|
|
24715
|
-
var DialogPrimitive, import_lodash_es7, import_lucide_react79,
|
|
24757
|
+
var DialogPrimitive, import_lodash_es7, import_lucide_react79, import_react86, import_jsx_runtime120, Dialog, DialogPortal, DialogOverlay, CONTENT_BG_SETUP, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription;
|
|
24716
24758
|
var init_dialog = __esm({
|
|
24717
24759
|
"src/internal/components/ui/dialog.tsx"() {
|
|
24718
24760
|
init_utils2();
|
|
@@ -24721,14 +24763,14 @@ var init_dialog = __esm({
|
|
|
24721
24763
|
DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
24722
24764
|
import_lodash_es7 = require("lodash-es");
|
|
24723
24765
|
import_lucide_react79 = require("lucide-react");
|
|
24724
|
-
|
|
24766
|
+
import_react86 = require("react");
|
|
24725
24767
|
init_useLayoutDataStore();
|
|
24726
24768
|
init_useLayoutStore();
|
|
24727
24769
|
init_button();
|
|
24728
24770
|
import_jsx_runtime120 = require("react/jsx-runtime");
|
|
24729
24771
|
Dialog = DialogPrimitive.Root;
|
|
24730
24772
|
DialogPortal = DialogPrimitive.Portal;
|
|
24731
|
-
DialogOverlay = (0,
|
|
24773
|
+
DialogOverlay = (0, import_react86.forwardRef)(
|
|
24732
24774
|
({ className, closing, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
24733
24775
|
DialogPrimitive.Overlay,
|
|
24734
24776
|
{
|
|
@@ -24750,7 +24792,7 @@ var init_dialog = __esm({
|
|
|
24750
24792
|
border: "1px solid var(--ui-kit-bd)",
|
|
24751
24793
|
boxShadow: "var(--ui-kit-shadow, 0px 4px 10px var(--ui-kit-shadow-c, rgba(0, 0, 0, 0.1)))"
|
|
24752
24794
|
};
|
|
24753
|
-
DialogContent = (0,
|
|
24795
|
+
DialogContent = (0, import_react86.forwardRef)(
|
|
24754
24796
|
({ className, children, colorMode, ...props }, ref) => {
|
|
24755
24797
|
const { t, i18n } = useT();
|
|
24756
24798
|
const isSessionLoading = useSession((st) => st.isLoading);
|
|
@@ -24853,7 +24895,7 @@ var init_dialog = __esm({
|
|
|
24853
24895
|
DialogHeader.displayName = "DialogHeader";
|
|
24854
24896
|
DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className), ...props });
|
|
24855
24897
|
DialogFooter.displayName = "DialogFooter";
|
|
24856
|
-
DialogTitle = (0,
|
|
24898
|
+
DialogTitle = (0, import_react86.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
24857
24899
|
DialogPrimitive.Title,
|
|
24858
24900
|
{
|
|
24859
24901
|
ref,
|
|
@@ -24862,7 +24904,7 @@ var init_dialog = __esm({
|
|
|
24862
24904
|
}
|
|
24863
24905
|
));
|
|
24864
24906
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
24865
|
-
DialogDescription = (0,
|
|
24907
|
+
DialogDescription = (0, import_react86.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(DialogPrimitive.Description, { ref, className: cn("text-sm text-muted-foreground", className), ...props }));
|
|
24866
24908
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
24867
24909
|
}
|
|
24868
24910
|
});
|
|
@@ -24887,7 +24929,7 @@ function Dialog2() {
|
|
|
24887
24929
|
const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
|
|
24888
24930
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
24889
24931
|
const { colorMode, isDialogOpen, dialogTitle, dialogDescription, dialogContent, isDialogForced, setIsSettings } = useLayoutStore();
|
|
24890
|
-
(0,
|
|
24932
|
+
(0, import_react87.useEffect)(() => setIsSettings(!!session), [session, setIsSettings]);
|
|
24891
24933
|
usePageMapper();
|
|
24892
24934
|
useAutoConnect();
|
|
24893
24935
|
useBackupStatusChanges();
|
|
@@ -24925,13 +24967,13 @@ function Dialog2() {
|
|
|
24925
24967
|
}
|
|
24926
24968
|
);
|
|
24927
24969
|
}
|
|
24928
|
-
var import_framer_motion,
|
|
24970
|
+
var import_framer_motion, import_react87, import_jsx_runtime122;
|
|
24929
24971
|
var init_Dialog = __esm({
|
|
24930
24972
|
"src/internal/components/Dialog/Dialog.tsx"() {
|
|
24931
24973
|
init_ProviderContext();
|
|
24932
24974
|
init_SessionContext();
|
|
24933
24975
|
import_framer_motion = require("framer-motion");
|
|
24934
|
-
|
|
24976
|
+
import_react87 = require("react");
|
|
24935
24977
|
init_constants();
|
|
24936
24978
|
init_useAutoConnect();
|
|
24937
24979
|
init_useBackupStatusChanges();
|
|
@@ -24957,14 +24999,14 @@ var init_Dialog2 = __esm({
|
|
|
24957
24999
|
});
|
|
24958
25000
|
|
|
24959
25001
|
// src/internal/components/TssManager.tsx
|
|
24960
|
-
var
|
|
25002
|
+
var import_react88, TssManagerWithRef;
|
|
24961
25003
|
var init_TssManager = __esm({
|
|
24962
25004
|
"src/internal/components/TssManager.tsx"() {
|
|
24963
25005
|
init_SessionContext();
|
|
24964
|
-
|
|
25006
|
+
import_react88 = __toESM(require("react"), 1);
|
|
24965
25007
|
init_auth();
|
|
24966
25008
|
init_clients();
|
|
24967
|
-
TssManagerWithRef =
|
|
25009
|
+
TssManagerWithRef = import_react88.default.forwardRef((props, ref) => {
|
|
24968
25010
|
const { mpcPin } = props;
|
|
24969
25011
|
const usePaymaster = useSession((st) => st.usePaymaster);
|
|
24970
25012
|
const publicClient = useSession((st) => st.publicClient);
|
|
@@ -24972,14 +25014,14 @@ var init_TssManager = __esm({
|
|
|
24972
25014
|
const setStatus = useSession((st) => st.setStatus);
|
|
24973
25015
|
const setSession = useSession((st) => st.setSession);
|
|
24974
25016
|
const setAddress = useSession((st) => st.setAddress);
|
|
24975
|
-
const onSessionCreated = (0,
|
|
25017
|
+
const onSessionCreated = (0, import_react88.useCallback)(
|
|
24976
25018
|
(session, address) => {
|
|
24977
25019
|
setSession(session);
|
|
24978
25020
|
setAddress(address);
|
|
24979
25021
|
},
|
|
24980
25022
|
[setSession, setAddress]
|
|
24981
25023
|
);
|
|
24982
|
-
const createSessionWithKeyshare =
|
|
25024
|
+
const createSessionWithKeyshare = import_react88.default.useCallback(
|
|
24983
25025
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
24984
25026
|
setStatus("checking key management setup...");
|
|
24985
25027
|
await ensureKeyshare(userId, hasServerKeyshare, setStatus, isNewUser);
|
|
@@ -25004,7 +25046,7 @@ var init_TssManager = __esm({
|
|
|
25004
25046
|
},
|
|
25005
25047
|
[setStatus, usePaymaster, activeChainId, publicClient, mpcPin]
|
|
25006
25048
|
);
|
|
25007
|
-
|
|
25049
|
+
import_react88.default.useImperativeHandle(ref, () => ({ createSessionWithKeyshare }), [createSessionWithKeyshare]);
|
|
25008
25050
|
return null;
|
|
25009
25051
|
});
|
|
25010
25052
|
}
|
|
@@ -25032,7 +25074,7 @@ function WalletConnectHandler() {
|
|
|
25032
25074
|
const projectId = providerConfig?.projectId;
|
|
25033
25075
|
const setExternalWallet = useExternalWalletStore((st) => st.setExternalWallet);
|
|
25034
25076
|
const setPendingWalletLogin = useLayoutDataStore((st) => st.setPendingWalletLogin);
|
|
25035
|
-
const onLinkingComplete = (0,
|
|
25077
|
+
const onLinkingComplete = (0, import_react89.useCallback)(
|
|
25036
25078
|
async (success) => {
|
|
25037
25079
|
setIsWalletLinking(false);
|
|
25038
25080
|
if (!success && !passportWalletAddress) {
|
|
@@ -25061,10 +25103,10 @@ function WalletConnectHandler() {
|
|
|
25061
25103
|
},
|
|
25062
25104
|
[qc, passportWalletAddress, setProviderType, setPage, setIsWalletLinking]
|
|
25063
25105
|
);
|
|
25064
|
-
const [hasStartedLinking, setHasStartedLinking] =
|
|
25065
|
-
const [modalWasOpened, setModalWasOpened] =
|
|
25066
|
-
const [pendingModalOpen, setPendingModalOpen] =
|
|
25067
|
-
(0,
|
|
25106
|
+
const [hasStartedLinking, setHasStartedLinking] = import_react89.default.useState(false);
|
|
25107
|
+
const [modalWasOpened, setModalWasOpened] = import_react89.default.useState(false);
|
|
25108
|
+
const [pendingModalOpen, setPendingModalOpen] = import_react89.default.useState(false);
|
|
25109
|
+
(0, import_react89.useEffect)(() => {
|
|
25068
25110
|
if (isWalletLinking && !hasStartedLinking) {
|
|
25069
25111
|
console.log("[WalletConnectHandler] Starting wallet link flow:", {
|
|
25070
25112
|
isConnected,
|
|
@@ -25102,18 +25144,18 @@ function WalletConnectHandler() {
|
|
|
25102
25144
|
setProviderType,
|
|
25103
25145
|
walletMode
|
|
25104
25146
|
]);
|
|
25105
|
-
(0,
|
|
25147
|
+
(0, import_react89.useEffect)(() => {
|
|
25106
25148
|
if (pendingModalOpen && !isConnected && openConnectModal) {
|
|
25107
25149
|
setPendingModalOpen(false);
|
|
25108
25150
|
openConnectModal();
|
|
25109
25151
|
}
|
|
25110
25152
|
}, [pendingModalOpen, isConnected, openConnectModal]);
|
|
25111
|
-
(0,
|
|
25153
|
+
(0, import_react89.useEffect)(() => {
|
|
25112
25154
|
if (connectModalOpen && hasStartedLinking) {
|
|
25113
25155
|
setModalWasOpened(true);
|
|
25114
25156
|
}
|
|
25115
25157
|
}, [connectModalOpen, hasStartedLinking]);
|
|
25116
|
-
(0,
|
|
25158
|
+
(0, import_react89.useEffect)(() => {
|
|
25117
25159
|
if (modalWasOpened && !connectModalOpen && !isConnected && isWalletLinking) {
|
|
25118
25160
|
console.log("[WalletConnectHandler] Modal closed without connecting");
|
|
25119
25161
|
onLinkingComplete(false);
|
|
@@ -25121,7 +25163,7 @@ function WalletConnectHandler() {
|
|
|
25121
25163
|
setModalWasOpened(false);
|
|
25122
25164
|
}
|
|
25123
25165
|
}, [connectModalOpen, modalWasOpened, isConnected, isWalletLinking]);
|
|
25124
|
-
(0,
|
|
25166
|
+
(0, import_react89.useEffect)(() => {
|
|
25125
25167
|
if (isWalletLinking) {
|
|
25126
25168
|
const timeout = setTimeout(() => {
|
|
25127
25169
|
console.warn("[WalletConnectHandler] Wallet linking timed out, resetting state");
|
|
@@ -25241,7 +25283,7 @@ function WalletConnectHandler() {
|
|
|
25241
25283
|
setPage(passportWalletAddress ? "manage-wallet" /* MANAGE_WALLET */ : "auth" /* AUTH */);
|
|
25242
25284
|
}
|
|
25243
25285
|
});
|
|
25244
|
-
(0,
|
|
25286
|
+
(0, import_react89.useEffect)(() => {
|
|
25245
25287
|
if (!!chain?.id && isConnected && walletAddress && isWalletLinking && hasStartedLinking && modalWasOpened && !pendingModalOpen) {
|
|
25246
25288
|
console.log("[WalletConnectHandler] handleWalletSign triggered");
|
|
25247
25289
|
if (!passportWalletAddress) {
|
|
@@ -25251,7 +25293,7 @@ function WalletConnectHandler() {
|
|
|
25251
25293
|
handleWalletSign({ chainId: chain.id, signingWalletAddress: walletAddress });
|
|
25252
25294
|
}
|
|
25253
25295
|
}, [chain, isConnected, walletAddress, isWalletLinking, hasStartedLinking, modalWasOpened, pendingModalOpen]);
|
|
25254
|
-
(0,
|
|
25296
|
+
(0, import_react89.useEffect)(() => {
|
|
25255
25297
|
if (isConnected && !chain?.id && isWalletLinking && hasStartedLinking && !connectModalOpen && !isWalletSigning) {
|
|
25256
25298
|
const timeout = setTimeout(() => {
|
|
25257
25299
|
console.warn("[WalletConnectHandler] Wallet connected but chain info missing, resetting");
|
|
@@ -25273,7 +25315,7 @@ function WalletConnectHandler() {
|
|
|
25273
25315
|
]);
|
|
25274
25316
|
return null;
|
|
25275
25317
|
}
|
|
25276
|
-
var import_rainbowkit2, import_react_query56,
|
|
25318
|
+
var import_rainbowkit2, import_react_query56, import_react89, import_wagmi5;
|
|
25277
25319
|
var init_WalletConnectHandler = __esm({
|
|
25278
25320
|
"src/internal/components/WalletConnectHandler.tsx"() {
|
|
25279
25321
|
init_ProviderContext();
|
|
@@ -25281,7 +25323,7 @@ var init_WalletConnectHandler = __esm({
|
|
|
25281
25323
|
init_linkedProfiles();
|
|
25282
25324
|
import_rainbowkit2 = require("@rainbow-me/rainbowkit");
|
|
25283
25325
|
import_react_query56 = require("@tanstack/react-query");
|
|
25284
|
-
|
|
25326
|
+
import_react89 = __toESM(require("react"), 1);
|
|
25285
25327
|
import_wagmi5 = require("wagmi");
|
|
25286
25328
|
init_wallet();
|
|
25287
25329
|
init_AuthMenu2();
|
|
@@ -25302,13 +25344,13 @@ function DirectWalletHandler() {
|
|
|
25302
25344
|
const setExternalChainId = useExternalWalletStore((st) => st.setExternalChainId);
|
|
25303
25345
|
const setConfigMode = useExternalWalletStore((st) => st.setConfigMode);
|
|
25304
25346
|
const setActiveMode = useExternalWalletStore((st) => st.setActiveMode);
|
|
25305
|
-
(0,
|
|
25347
|
+
(0, import_react90.useEffect)(() => {
|
|
25306
25348
|
setConfigMode(walletMode);
|
|
25307
25349
|
if (walletMode !== "both") {
|
|
25308
25350
|
setActiveMode(walletMode);
|
|
25309
25351
|
}
|
|
25310
25352
|
}, [walletMode, setConfigMode, setActiveMode]);
|
|
25311
|
-
(0,
|
|
25353
|
+
(0, import_react90.useEffect)(() => {
|
|
25312
25354
|
if (isConnected && address && !isExternalConnected && connector && chain?.id) {
|
|
25313
25355
|
setExternalWallet({
|
|
25314
25356
|
address,
|
|
@@ -25317,17 +25359,17 @@ function DirectWalletHandler() {
|
|
|
25317
25359
|
});
|
|
25318
25360
|
}
|
|
25319
25361
|
}, [isConnected, address, isExternalConnected, connector, chain?.id, setExternalWallet]);
|
|
25320
|
-
(0,
|
|
25362
|
+
(0, import_react90.useEffect)(() => {
|
|
25321
25363
|
if (isExternalConnected && !isConnected) {
|
|
25322
25364
|
clearExternalWallet();
|
|
25323
25365
|
}
|
|
25324
25366
|
}, [isConnected, isExternalConnected, clearExternalWallet]);
|
|
25325
|
-
(0,
|
|
25367
|
+
(0, import_react90.useEffect)(() => {
|
|
25326
25368
|
if (isExternalConnected && isConnected && chain?.id) {
|
|
25327
25369
|
setExternalChainId(chain.id);
|
|
25328
25370
|
}
|
|
25329
25371
|
}, [chain?.id, isConnected, isExternalConnected, setExternalChainId]);
|
|
25330
|
-
(0,
|
|
25372
|
+
(0, import_react90.useEffect)(() => {
|
|
25331
25373
|
if (isExternalConnected && isConnected && address && address !== externalAddress && connector && chain?.id) {
|
|
25332
25374
|
setExternalWallet({
|
|
25333
25375
|
address,
|
|
@@ -25338,10 +25380,10 @@ function DirectWalletHandler() {
|
|
|
25338
25380
|
}, [address, isConnected, isExternalConnected, externalAddress, chain?.id, connector, setExternalWallet]);
|
|
25339
25381
|
return null;
|
|
25340
25382
|
}
|
|
25341
|
-
var
|
|
25383
|
+
var import_react90, import_wagmi6;
|
|
25342
25384
|
var init_DirectWalletHandler = __esm({
|
|
25343
25385
|
"src/internal/components/DirectWalletHandler.tsx"() {
|
|
25344
|
-
|
|
25386
|
+
import_react90 = require("react");
|
|
25345
25387
|
import_wagmi6 = require("wagmi");
|
|
25346
25388
|
init_ProviderContext();
|
|
25347
25389
|
init_useExternalWalletStore();
|
|
@@ -25353,9 +25395,9 @@ function getChainParams(chainCfg) {
|
|
|
25353
25395
|
return {
|
|
25354
25396
|
activeChainId: chainCfg.id,
|
|
25355
25397
|
chainConfig: chainCfg,
|
|
25356
|
-
publicClient: (0,
|
|
25357
|
-
bundlerClient: (0,
|
|
25358
|
-
viemChain: (0,
|
|
25398
|
+
publicClient: (0, import_read16.createPublicClientForChain)(chainCfg.id),
|
|
25399
|
+
bundlerClient: (0, import_read16.createBundlerClientForChain)(chainCfg.id),
|
|
25400
|
+
viemChain: (0, import_read16.getViemChain)(chainCfg.id)
|
|
25359
25401
|
};
|
|
25360
25402
|
}
|
|
25361
25403
|
function waitForStoreHydration() {
|
|
@@ -25366,7 +25408,7 @@ function waitForStoreHydration() {
|
|
|
25366
25408
|
}
|
|
25367
25409
|
function SessionProvider({ children }) {
|
|
25368
25410
|
const config = useProviderConfig().config;
|
|
25369
|
-
return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
|
|
25411
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(import_react91.Fragment, { children: [
|
|
25370
25412
|
children,
|
|
25371
25413
|
config.current?.wallet?.enabled && /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(WalletConnectHandler, {}),
|
|
25372
25414
|
config.current?.wallet?.enabled && (config.current?.wallet?.mode === "direct" || config.current?.wallet?.mode === "both") && /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(DirectWalletHandler, {}),
|
|
@@ -25381,11 +25423,11 @@ function SessionProvider({ children }) {
|
|
|
25381
25423
|
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(Dialog2, {})
|
|
25382
25424
|
] });
|
|
25383
25425
|
}
|
|
25384
|
-
var
|
|
25426
|
+
var import_read16, import_react91, import_zustand11, import_middleware3, import_jsx_runtime123, useSession, requireActiveChainId;
|
|
25385
25427
|
var init_SessionContext = __esm({
|
|
25386
25428
|
"src/context/SessionContext.tsx"() {
|
|
25387
|
-
|
|
25388
|
-
|
|
25429
|
+
import_read16 = require("@embarkai/core/read");
|
|
25430
|
+
import_react91 = require("react");
|
|
25389
25431
|
import_zustand11 = require("zustand");
|
|
25390
25432
|
import_middleware3 = require("zustand/middleware");
|
|
25391
25433
|
init_BalanceFeedProvider2();
|
|
@@ -25456,7 +25498,7 @@ var init_SessionContext = __esm({
|
|
|
25456
25498
|
// Set default chainId after hydration if not persisted
|
|
25457
25499
|
onRehydrateStorage: () => (state) => {
|
|
25458
25500
|
if (!state) return;
|
|
25459
|
-
const hydartedChain = getChainParams((0,
|
|
25501
|
+
const hydartedChain = getChainParams((0, import_read16.getChainConfig)(state.activeChainId || import_read16.DEFAULT_CHAIN_ID));
|
|
25460
25502
|
state.activeChainId = hydartedChain.activeChainId;
|
|
25461
25503
|
state.publicClient = hydartedChain.publicClient;
|
|
25462
25504
|
state.bundlerClient = hydartedChain.bundlerClient;
|
|
@@ -25531,31 +25573,31 @@ function getExplorerUrl() {
|
|
|
25531
25573
|
const paramUrl = typeof window !== "undefined" ? new URLSearchParams(window.location.search).get("explorerUrl") || void 0 : void 0;
|
|
25532
25574
|
const net = getSelectedNetwork();
|
|
25533
25575
|
const chainId = requireActiveChainId();
|
|
25534
|
-
const chainConfig = (0,
|
|
25576
|
+
const chainConfig = (0, import_read17.getChainConfig)(chainId);
|
|
25535
25577
|
console.log("[getExplorerUrl] ", paramUrl, chainConfig.blockExplorerUrl);
|
|
25536
25578
|
return paramUrl || chainConfig.blockExplorerUrl;
|
|
25537
25579
|
}
|
|
25538
25580
|
function getBundlerClient() {
|
|
25539
25581
|
const chainId = requireActiveChainId();
|
|
25540
|
-
const chainConfig = (0,
|
|
25541
|
-
const viemChain = (0,
|
|
25582
|
+
const chainConfig = (0, import_read17.getChainConfig)(chainId);
|
|
25583
|
+
const viemChain = (0, import_read17.getViemChain)(chainId);
|
|
25542
25584
|
return (0, import_account_abstraction2.createBundlerClient)({
|
|
25543
25585
|
chain: viemChain,
|
|
25544
25586
|
transport: (0, import_viem19.http)(chainConfig.bundlerUrl, { timeout: 1e4, retryCount: 0, fetchOptions: { mode: "cors" } })
|
|
25545
25587
|
});
|
|
25546
25588
|
}
|
|
25547
|
-
var
|
|
25589
|
+
var import_read17, import_viem19, import_account_abstraction2, BUILD_NETWORK, lumiaBeamTestnet, lumiaPrisma, FUNDER_PK;
|
|
25548
25590
|
var init_base = __esm({
|
|
25549
25591
|
"src/internal/clients/base.ts"() {
|
|
25550
25592
|
init_initial();
|
|
25551
25593
|
init_SessionContext();
|
|
25552
|
-
|
|
25594
|
+
import_read17 = require("@embarkai/core/read");
|
|
25553
25595
|
import_viem19 = require("viem");
|
|
25554
25596
|
import_account_abstraction2 = require("viem/account-abstraction");
|
|
25555
25597
|
init_env();
|
|
25556
25598
|
BUILD_NETWORK = true ? "" : "";
|
|
25557
|
-
lumiaBeamTestnet =
|
|
25558
|
-
lumiaPrisma =
|
|
25599
|
+
lumiaBeamTestnet = import_read17.lumiaTestnetChain;
|
|
25600
|
+
lumiaPrisma = import_read17.lumiaMainnetChain;
|
|
25559
25601
|
FUNDER_PK = getEnvVar("VITE_FUNDER_PK") || "";
|
|
25560
25602
|
}
|
|
25561
25603
|
});
|
|
@@ -27796,10 +27838,10 @@ var init_iframe_manager = __esm({
|
|
|
27796
27838
|
});
|
|
27797
27839
|
|
|
27798
27840
|
// src/config/rainbowkit.ts
|
|
27799
|
-
var
|
|
27841
|
+
var import_read18, import_rainbowkit3, import_wallets2, import_wagmi7, import_chains12, getProjectId2, WALLET_MAP, getWagmiStorageKey, buildRainbowChains, createRainbowConfig, rainbowTheme;
|
|
27800
27842
|
var init_rainbowkit = __esm({
|
|
27801
27843
|
"src/config/rainbowkit.ts"() {
|
|
27802
|
-
|
|
27844
|
+
import_read18 = require("@embarkai/core/read");
|
|
27803
27845
|
import_rainbowkit3 = require("@rainbow-me/rainbowkit");
|
|
27804
27846
|
import_wallets2 = require("@rainbow-me/rainbowkit/wallets");
|
|
27805
27847
|
import_wagmi7 = require("wagmi");
|
|
@@ -27824,8 +27866,8 @@ var init_rainbowkit = __esm({
|
|
|
27824
27866
|
};
|
|
27825
27867
|
buildRainbowChains = (supportedChains, preferredChainId) => {
|
|
27826
27868
|
const availableChains = [
|
|
27827
|
-
|
|
27828
|
-
|
|
27869
|
+
import_read18.lumiaMainnetChain,
|
|
27870
|
+
import_read18.lumiaTestnetChain,
|
|
27829
27871
|
import_chains12.mainnet,
|
|
27830
27872
|
import_chains12.polygon,
|
|
27831
27873
|
import_chains12.bsc,
|
|
@@ -28052,7 +28094,7 @@ var init_rainbowkit = __esm({
|
|
|
28052
28094
|
function RainbowKitProvider({ children }) {
|
|
28053
28095
|
const config = useProviderConfig().config;
|
|
28054
28096
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
28055
|
-
const rainbowConfig = (0,
|
|
28097
|
+
const rainbowConfig = (0, import_react92.useMemo)(
|
|
28056
28098
|
() => createRainbowConfig({
|
|
28057
28099
|
projectId: config.current?.wallet?.walletConnectProjectId,
|
|
28058
28100
|
allowedWallets: config.current?.wallet?.allowedWallets,
|
|
@@ -28066,7 +28108,7 @@ function RainbowKitProvider({ children }) {
|
|
|
28066
28108
|
config.current?.wallet?.walletConnectProjectId
|
|
28067
28109
|
]
|
|
28068
28110
|
);
|
|
28069
|
-
const customTheme = (0,
|
|
28111
|
+
const customTheme = (0, import_react92.useMemo)(() => {
|
|
28070
28112
|
if (!config.current?.wallet?.enabled) return {};
|
|
28071
28113
|
return colorMode === "dark" ? {
|
|
28072
28114
|
...(0, import_rainbowkit4.darkTheme)(),
|
|
@@ -28083,11 +28125,11 @@ function RainbowKitProvider({ children }) {
|
|
|
28083
28125
|
if (!config.current?.wallet?.enabled) return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(import_jsx_runtime124.Fragment, { children });
|
|
28084
28126
|
return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(import_wagmi8.WagmiProvider, { config: rainbowConfig, children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(import_rainbowkit4.RainbowKitProvider, { theme: customTheme, modalSize: "compact", showRecentTransactions: true, children }) });
|
|
28085
28127
|
}
|
|
28086
|
-
var import_rainbowkit4,
|
|
28128
|
+
var import_rainbowkit4, import_react92, import_wagmi8, import_styles, import_jsx_runtime124;
|
|
28087
28129
|
var init_RainbowKitContext = __esm({
|
|
28088
28130
|
"src/context/RainbowKitContext.tsx"() {
|
|
28089
28131
|
import_rainbowkit4 = require("@rainbow-me/rainbowkit");
|
|
28090
|
-
|
|
28132
|
+
import_react92 = require("react");
|
|
28091
28133
|
import_wagmi8 = require("wagmi");
|
|
28092
28134
|
init_rainbowkit();
|
|
28093
28135
|
init_useLayoutStore();
|
|
@@ -28131,19 +28173,19 @@ function buildTransport(urls) {
|
|
|
28131
28173
|
retryCount: 0
|
|
28132
28174
|
});
|
|
28133
28175
|
}
|
|
28134
|
-
var
|
|
28176
|
+
var import_read19, import_viem20, import_wagmi9, import_chains13, wagmiConfig;
|
|
28135
28177
|
var init_wagmi = __esm({
|
|
28136
28178
|
"src/config/wagmi.ts"() {
|
|
28137
|
-
|
|
28179
|
+
import_read19 = require("@embarkai/core/read");
|
|
28138
28180
|
import_viem20 = require("viem");
|
|
28139
28181
|
import_wagmi9 = require("wagmi");
|
|
28140
28182
|
import_chains13 = require("wagmi/chains");
|
|
28141
28183
|
wagmiConfig = (0, import_wagmi9.createConfig)({
|
|
28142
|
-
chains: [
|
|
28184
|
+
chains: [import_read19.lumiaMainnetChain, import_read19.lumiaTestnetChain, import_chains13.bsc, import_chains13.mainnet],
|
|
28143
28185
|
storage: (0, import_wagmi9.createStorage)({ key: "embark-wagmi-static-v2" }),
|
|
28144
28186
|
transports: {
|
|
28145
|
-
[
|
|
28146
|
-
[
|
|
28187
|
+
[import_read19.lumiaTestnetChain.id]: buildTransport(import_read19.lumiaTestnetChain.rpcUrls.default.http),
|
|
28188
|
+
[import_read19.lumiaMainnetChain.id]: buildTransport(import_read19.lumiaMainnetChain.rpcUrls.default.http),
|
|
28147
28189
|
[import_chains13.bsc.id]: (0, import_wagmi9.http)(),
|
|
28148
28190
|
[import_chains13.mainnet.id]: (0, import_wagmi9.http)()
|
|
28149
28191
|
}
|
|
@@ -28182,10 +28224,10 @@ function clearLegacyWagmiStorage() {
|
|
|
28182
28224
|
}
|
|
28183
28225
|
function Provider(props) {
|
|
28184
28226
|
const { children, projectId, initialConfig = {}, callbacks } = props;
|
|
28185
|
-
const callbacksRef = (0,
|
|
28186
|
-
(0,
|
|
28187
|
-
const config = (0,
|
|
28188
|
-
const updateConfig = (0,
|
|
28227
|
+
const callbacksRef = (0, import_react93.useRef)(callbacks);
|
|
28228
|
+
(0, import_react93.useEffect)(() => notifyNoProjetctId(projectId), [projectId]);
|
|
28229
|
+
const config = (0, import_react93.useRef)((0, import_lodash_es8.merge)({}, DEFAULT_PROVIDER_CONFIG, { projectId }, initialConfig));
|
|
28230
|
+
const updateConfig = (0, import_react93.useCallback)((updates) => {
|
|
28189
28231
|
const prev = config.current;
|
|
28190
28232
|
const next = { ...prev };
|
|
28191
28233
|
if (updates.projectId !== void 0) next.projectId = updates.projectId;
|
|
@@ -28219,12 +28261,12 @@ function Provider(props) {
|
|
|
28219
28261
|
if (updates.translations) next.translations = { ...next.translations, ...updates.translations };
|
|
28220
28262
|
config.current = next;
|
|
28221
28263
|
}, []);
|
|
28222
|
-
const updateCallbacks = (0,
|
|
28264
|
+
const updateCallbacks = (0, import_react93.useCallback)((updates) => {
|
|
28223
28265
|
const prev = callbacksRef.current;
|
|
28224
28266
|
const next = updates ? { ...prev, ...updates } : void 0;
|
|
28225
28267
|
callbacksRef.current = next;
|
|
28226
28268
|
}, []);
|
|
28227
|
-
(0,
|
|
28269
|
+
(0, import_react93.useEffect)(() => {
|
|
28228
28270
|
if (typeof window === "undefined" || !projectId) return;
|
|
28229
28271
|
const mergedConfig = (0, import_lodash_es8.merge)(DEFAULT_PROVIDER_CONFIG, initialConfig);
|
|
28230
28272
|
updateConfig(mergedConfig);
|
|
@@ -28245,7 +28287,7 @@ function Provider(props) {
|
|
|
28245
28287
|
useSession.getState().setActiveChainId(mergedConfig.network.chainId);
|
|
28246
28288
|
}
|
|
28247
28289
|
}, [projectId, initialConfig]);
|
|
28248
|
-
(0,
|
|
28290
|
+
(0, import_react93.useEffect)(() => {
|
|
28249
28291
|
if (typeof window === "undefined" || !projectId) return;
|
|
28250
28292
|
try {
|
|
28251
28293
|
(0, import_error_tracking4.initSdkErrorTracking)();
|
|
@@ -28274,7 +28316,7 @@ function Provider(props) {
|
|
|
28274
28316
|
console.error("[PROVIDER] Error setting up iframe manager:", error);
|
|
28275
28317
|
}
|
|
28276
28318
|
}, [projectId]);
|
|
28277
|
-
const contextValue = (0,
|
|
28319
|
+
const contextValue = (0, import_react93.useMemo)(
|
|
28278
28320
|
() => ({
|
|
28279
28321
|
config,
|
|
28280
28322
|
updateConfig,
|
|
@@ -28289,12 +28331,12 @@ function Provider(props) {
|
|
|
28289
28331
|
return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(UIContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(RainbowKitProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(SessionProvider, { children }) }) });
|
|
28290
28332
|
return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(WagmiProvider2, { children: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(UIContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(SessionProvider, { children }) }) });
|
|
28291
28333
|
}
|
|
28292
|
-
var import_error_tracking4, import_lodash_es8,
|
|
28334
|
+
var import_error_tracking4, import_lodash_es8, import_react93, import_jsx_runtime126, UIContext, useProviderConfig;
|
|
28293
28335
|
var init_ProviderContext = __esm({
|
|
28294
28336
|
"src/context/ProviderContext.tsx"() {
|
|
28295
28337
|
import_error_tracking4 = require("@embarkai/core/internal/error-tracking");
|
|
28296
28338
|
import_lodash_es8 = require("lodash-es");
|
|
28297
|
-
|
|
28339
|
+
import_react93 = require("react");
|
|
28298
28340
|
init_initial();
|
|
28299
28341
|
init_iframe_manager();
|
|
28300
28342
|
init_RainbowKitContext();
|
|
@@ -28302,9 +28344,9 @@ var init_ProviderContext = __esm({
|
|
|
28302
28344
|
init_utils11();
|
|
28303
28345
|
init_WagmiContext();
|
|
28304
28346
|
import_jsx_runtime126 = require("react/jsx-runtime");
|
|
28305
|
-
UIContext = (0,
|
|
28347
|
+
UIContext = (0, import_react93.createContext)(void 0);
|
|
28306
28348
|
useProviderConfig = () => {
|
|
28307
|
-
const ctx = (0,
|
|
28349
|
+
const ctx = (0, import_react93.useContext)(UIContext);
|
|
28308
28350
|
if (!ctx) throw new Error("useProviderConfig must be used within a Provider");
|
|
28309
28351
|
return ctx;
|
|
28310
28352
|
};
|
|
@@ -28409,7 +28451,7 @@ init_ProviderContext();
|
|
|
28409
28451
|
init_LumiaIcon3();
|
|
28410
28452
|
var import_react_query57 = require("@tanstack/react-query");
|
|
28411
28453
|
var import_lucide_react80 = require("lucide-react");
|
|
28412
|
-
var
|
|
28454
|
+
var import_react94 = require("react");
|
|
28413
28455
|
init_SessionContext();
|
|
28414
28456
|
init_auth();
|
|
28415
28457
|
init_profile();
|
|
@@ -28442,7 +28484,7 @@ function ConnectWalletButton(props) {
|
|
|
28442
28484
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
28443
28485
|
const { session, address, hasServerVault, isLoading, isIframeReady, status, setUsePaymaster } = useSession();
|
|
28444
28486
|
const connectButtonLabel = getFormattedStatus(label || "Connect", status, isIframeReady);
|
|
28445
|
-
(0,
|
|
28487
|
+
(0, import_react94.useEffect)(() => setUsePaymaster(usePaymaster), [setUsePaymaster, usePaymaster]);
|
|
28446
28488
|
const { data: profile, isLoading: isProfileLoading } = (0, import_react_query57.useQuery)({
|
|
28447
28489
|
retry: false,
|
|
28448
28490
|
enabled: !!address,
|
|
@@ -28450,7 +28492,7 @@ function ConnectWalletButton(props) {
|
|
|
28450
28492
|
queryFn: getUserProfile
|
|
28451
28493
|
});
|
|
28452
28494
|
const displayName = profile?.nicknameDisplay || profile?.displayName || import_auth21.jwtTokenManager.getDisplayName();
|
|
28453
|
-
const indicators = (0,
|
|
28495
|
+
const indicators = (0, import_react94.useMemo)(() => {
|
|
28454
28496
|
const userId = session?.mpcUserId;
|
|
28455
28497
|
if (!userId) return { server: false, local: false, backup: false };
|
|
28456
28498
|
const server = import_auth21.jwtTokenManager.getHasKeyshare() ?? false;
|
|
@@ -28632,7 +28674,7 @@ var useActiveChainId = () => useSession((st) => st.activeChainId);
|
|
|
28632
28674
|
var useHydrated = () => useSession((st) => st.hasHydrated);
|
|
28633
28675
|
|
|
28634
28676
|
// src/hooks/useOpenPage.ts
|
|
28635
|
-
var
|
|
28677
|
+
var import_react95 = require("react");
|
|
28636
28678
|
init_SessionContext();
|
|
28637
28679
|
init_useLayoutDataStore();
|
|
28638
28680
|
function useOpenPage() {
|
|
@@ -28640,7 +28682,7 @@ function useOpenPage() {
|
|
|
28640
28682
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
28641
28683
|
const setPageParams = useLayoutDataStore((st) => st.setPageParams);
|
|
28642
28684
|
const address = useSession((st) => st.address);
|
|
28643
|
-
const open = (0,
|
|
28685
|
+
const open = (0, import_react95.useCallback)(
|
|
28644
28686
|
(passportPage, params) => {
|
|
28645
28687
|
if (!address) return setPage("auth" /* AUTH */);
|
|
28646
28688
|
if (!!address && passportPage === "auth" /* AUTH */) return setPage("manage-wallet" /* MANAGE_WALLET */);
|
|
@@ -28649,7 +28691,7 @@ function useOpenPage() {
|
|
|
28649
28691
|
},
|
|
28650
28692
|
[setPage, setPageParams, address]
|
|
28651
28693
|
);
|
|
28652
|
-
const close = (0,
|
|
28694
|
+
const close = (0, import_react95.useCallback)(() => setPage(null), [setPage]);
|
|
28653
28695
|
return { open, close, isOpen: page !== null };
|
|
28654
28696
|
}
|
|
28655
28697
|
|
|
@@ -28725,10 +28767,10 @@ var React12 = __toESM(require("react"), 1);
|
|
|
28725
28767
|
// src/clients/bundler/getUserOperationByHash.ts
|
|
28726
28768
|
init_SessionContext();
|
|
28727
28769
|
var import_core3 = require("@embarkai/core");
|
|
28728
|
-
var
|
|
28770
|
+
var import_read20 = require("@embarkai/core/read");
|
|
28729
28771
|
async function getUserOperationByHash(userOpHash, chainId) {
|
|
28730
28772
|
const targetChainId = chainId ?? requireActiveChainId();
|
|
28731
|
-
const chainConfig = (0,
|
|
28773
|
+
const chainConfig = (0, import_read20.getChainConfig)(targetChainId);
|
|
28732
28774
|
if (!chainConfig) {
|
|
28733
28775
|
throw new Error(`Chain ${targetChainId} is not supported`);
|
|
28734
28776
|
}
|
|
@@ -28760,10 +28802,10 @@ async function getUserOperationByHash(userOpHash, chainId) {
|
|
|
28760
28802
|
// src/clients/bundler/getUserOperationReceipt.ts
|
|
28761
28803
|
init_SessionContext();
|
|
28762
28804
|
var import_core4 = require("@embarkai/core");
|
|
28763
|
-
var
|
|
28805
|
+
var import_read21 = require("@embarkai/core/read");
|
|
28764
28806
|
async function getUserOperationReceipt(userOpHash, chainId) {
|
|
28765
28807
|
const targetChainId = chainId ?? requireActiveChainId();
|
|
28766
|
-
const chainConfig = (0,
|
|
28808
|
+
const chainConfig = (0, import_read21.getChainConfig)(targetChainId);
|
|
28767
28809
|
if (!chainConfig) {
|
|
28768
28810
|
throw new Error(`Chain ${targetChainId} is not supported`);
|
|
28769
28811
|
}
|
|
@@ -29186,14 +29228,14 @@ var Hash = ({
|
|
|
29186
29228
|
};
|
|
29187
29229
|
|
|
29188
29230
|
// src/internal/components/TransactionsMenu/TransactionsList.tsx
|
|
29189
|
-
var
|
|
29231
|
+
var import_react96 = require("react");
|
|
29190
29232
|
init_base();
|
|
29191
29233
|
var import_jsx_runtime133 = require("react/jsx-runtime");
|
|
29192
29234
|
var TransactionsList = ({ address, itemsCount = 10 }) => {
|
|
29193
|
-
const [transactions, setTransactions] = (0,
|
|
29194
|
-
const [loading, setLoading] = (0,
|
|
29195
|
-
const [error, setError] = (0,
|
|
29196
|
-
(0,
|
|
29235
|
+
const [transactions, setTransactions] = (0, import_react96.useState)([]);
|
|
29236
|
+
const [loading, setLoading] = (0, import_react96.useState)(true);
|
|
29237
|
+
const [error, setError] = (0, import_react96.useState)(null);
|
|
29238
|
+
(0, import_react96.useEffect)(() => {
|
|
29197
29239
|
const fetchTransactions2 = async () => {
|
|
29198
29240
|
try {
|
|
29199
29241
|
setLoading(true);
|
|
@@ -29514,13 +29556,13 @@ function useUserOpStatus(options = {}) {
|
|
|
29514
29556
|
init_useErc3643Compliance();
|
|
29515
29557
|
|
|
29516
29558
|
// src/hooks/useWalletMode.ts
|
|
29517
|
-
var
|
|
29559
|
+
var import_react97 = require("react");
|
|
29518
29560
|
init_useExternalWalletStore();
|
|
29519
29561
|
function useWalletMode() {
|
|
29520
29562
|
const configMode = useExternalWalletStore((st) => st.configMode);
|
|
29521
29563
|
const activeMode = useExternalWalletStore((st) => st.activeMode);
|
|
29522
29564
|
const setActiveMode = useExternalWalletStore((st) => st.setActiveMode);
|
|
29523
|
-
const switchMode = (0,
|
|
29565
|
+
const switchMode = (0, import_react97.useCallback)(
|
|
29524
29566
|
(mode) => {
|
|
29525
29567
|
if (configMode !== "both") return;
|
|
29526
29568
|
setActiveMode(mode);
|
|
@@ -29536,7 +29578,7 @@ function useWalletMode() {
|
|
|
29536
29578
|
}
|
|
29537
29579
|
|
|
29538
29580
|
// src/hooks/useDirectWallet.ts
|
|
29539
|
-
var
|
|
29581
|
+
var import_react98 = require("react");
|
|
29540
29582
|
var import_rainbowkit6 = require("@rainbow-me/rainbowkit");
|
|
29541
29583
|
var import_wagmi12 = require("wagmi");
|
|
29542
29584
|
init_useExternalWalletStore();
|
|
@@ -29550,13 +29592,13 @@ function useDirectWallet() {
|
|
|
29550
29592
|
const { disconnect: wagmiDisconnect } = (0, import_wagmi12.useDisconnect)();
|
|
29551
29593
|
const { openConnectModal } = (0, import_rainbowkit6.useConnectModal)();
|
|
29552
29594
|
const setIsWalletLinking = useLayoutDataStore((st) => st.setIsWalletLinking);
|
|
29553
|
-
const connect = (0,
|
|
29595
|
+
const connect = (0, import_react98.useCallback)(() => {
|
|
29554
29596
|
setIsWalletLinking(true);
|
|
29555
29597
|
}, [setIsWalletLinking]);
|
|
29556
|
-
const reconnect = (0,
|
|
29598
|
+
const reconnect = (0, import_react98.useCallback)(() => {
|
|
29557
29599
|
if (openConnectModal) openConnectModal();
|
|
29558
29600
|
}, [openConnectModal]);
|
|
29559
|
-
const disconnect = (0,
|
|
29601
|
+
const disconnect = (0, import_react98.useCallback)(() => {
|
|
29560
29602
|
wagmiDisconnect();
|
|
29561
29603
|
clearExternalWallet();
|
|
29562
29604
|
}, [wagmiDisconnect, clearExternalWallet]);
|
|
@@ -29572,7 +29614,7 @@ function useDirectWallet() {
|
|
|
29572
29614
|
}
|
|
29573
29615
|
|
|
29574
29616
|
// src/hooks/useSendDirectTransaction.ts
|
|
29575
|
-
var
|
|
29617
|
+
var import_react99 = require("react");
|
|
29576
29618
|
var import_viem21 = require("viem");
|
|
29577
29619
|
var import_wagmi13 = require("wagmi");
|
|
29578
29620
|
init_useExternalWalletStore();
|
|
@@ -29581,10 +29623,10 @@ function useSendDirectTransaction() {
|
|
|
29581
29623
|
const externalChainId = useExternalWalletStore((st) => st.externalChainId);
|
|
29582
29624
|
const { sendTransactionAsync } = (0, import_wagmi13.useSendTransaction)();
|
|
29583
29625
|
const { switchChainAsync } = (0, import_wagmi13.useSwitchChain)();
|
|
29584
|
-
const [isPending, setIsPending] = (0,
|
|
29585
|
-
const [error, setError] = (0,
|
|
29586
|
-
const [txHash, setTxHash] = (0,
|
|
29587
|
-
const sendTransaction = (0,
|
|
29626
|
+
const [isPending, setIsPending] = (0, import_react99.useState)(false);
|
|
29627
|
+
const [error, setError] = (0, import_react99.useState)(null);
|
|
29628
|
+
const [txHash, setTxHash] = (0, import_react99.useState)(null);
|
|
29629
|
+
const sendTransaction = (0, import_react99.useCallback)(
|
|
29588
29630
|
async (params) => {
|
|
29589
29631
|
if (!isConnected) {
|
|
29590
29632
|
setError("No external wallet connected");
|
|
@@ -29618,7 +29660,7 @@ function useSendDirectTransaction() {
|
|
|
29618
29660
|
},
|
|
29619
29661
|
[isConnected, externalChainId, sendTransactionAsync, switchChainAsync]
|
|
29620
29662
|
);
|
|
29621
|
-
const reset = (0,
|
|
29663
|
+
const reset = (0, import_react99.useCallback)(() => {
|
|
29622
29664
|
setError(null);
|
|
29623
29665
|
setTxHash(null);
|
|
29624
29666
|
setIsPending(false);
|
|
@@ -29627,7 +29669,7 @@ function useSendDirectTransaction() {
|
|
|
29627
29669
|
}
|
|
29628
29670
|
|
|
29629
29671
|
// src/hooks/useTransferToLinkedWallet.ts
|
|
29630
|
-
var
|
|
29672
|
+
var import_react100 = require("react");
|
|
29631
29673
|
var import_viem22 = require("viem");
|
|
29632
29674
|
init_SessionContext();
|
|
29633
29675
|
init_account2();
|
|
@@ -29646,14 +29688,14 @@ var ERC20_TRANSFER_ABI2 = [
|
|
|
29646
29688
|
function useTransferToLinkedWallet() {
|
|
29647
29689
|
const session = useSession((st) => st.session);
|
|
29648
29690
|
const { profiles } = useLinkedProfiles();
|
|
29649
|
-
const [isPending, setIsPending] = (0,
|
|
29650
|
-
const [error, setError] = (0,
|
|
29651
|
-
const [userOpHash, setUserOpHash] = (0,
|
|
29652
|
-
const linkedWallets = (0,
|
|
29691
|
+
const [isPending, setIsPending] = (0, import_react100.useState)(false);
|
|
29692
|
+
const [error, setError] = (0, import_react100.useState)(null);
|
|
29693
|
+
const [userOpHash, setUserOpHash] = (0, import_react100.useState)(null);
|
|
29694
|
+
const linkedWallets = (0, import_react100.useMemo)(
|
|
29653
29695
|
() => (profiles || []).filter((p) => p.provider === "wallet" && p.externalId).map((p) => p.externalId),
|
|
29654
29696
|
[profiles]
|
|
29655
29697
|
);
|
|
29656
|
-
const transfer = (0,
|
|
29698
|
+
const transfer = (0, import_react100.useCallback)(
|
|
29657
29699
|
async (params) => {
|
|
29658
29700
|
if (!session) {
|
|
29659
29701
|
setError("No active session");
|
|
@@ -29704,7 +29746,7 @@ function useTransferToLinkedWallet() {
|
|
|
29704
29746
|
},
|
|
29705
29747
|
[session, linkedWallets]
|
|
29706
29748
|
);
|
|
29707
|
-
const reset = (0,
|
|
29749
|
+
const reset = (0, import_react100.useCallback)(() => {
|
|
29708
29750
|
setError(null);
|
|
29709
29751
|
setUserOpHash(null);
|
|
29710
29752
|
setIsPending(false);
|
|
@@ -29728,13 +29770,13 @@ function useNativeWalletSignature() {
|
|
|
29728
29770
|
|
|
29729
29771
|
// src/hooks/useLogout.ts
|
|
29730
29772
|
var import_auth23 = require("@embarkai/core/auth");
|
|
29731
|
-
var
|
|
29773
|
+
var import_react101 = require("react");
|
|
29732
29774
|
init_ProviderContext();
|
|
29733
29775
|
init_SessionContext();
|
|
29734
29776
|
function useLogout() {
|
|
29735
29777
|
const { setSession, setIsLoading, setAddress, setStatus, setError, address } = useSession();
|
|
29736
29778
|
const { callbacksRef } = useProviderConfig();
|
|
29737
|
-
const logout2 = (0,
|
|
29779
|
+
const logout2 = (0, import_react101.useCallback)(async () => {
|
|
29738
29780
|
const prevAddress = address;
|
|
29739
29781
|
let userId = null;
|
|
29740
29782
|
setIsLoading(true);
|
|
@@ -29780,12 +29822,12 @@ init_useBlockscoutAssets();
|
|
|
29780
29822
|
|
|
29781
29823
|
// src/modules/transactions.ts
|
|
29782
29824
|
init_SessionContext();
|
|
29783
|
-
var
|
|
29825
|
+
var import_read22 = require("@embarkai/core/read");
|
|
29784
29826
|
var import_viem23 = require("viem");
|
|
29785
29827
|
var import_wagmi15 = require("wagmi");
|
|
29786
29828
|
function useTransactions() {
|
|
29787
29829
|
const chainId = requireActiveChainId();
|
|
29788
|
-
const viemChain = (0,
|
|
29830
|
+
const viemChain = (0, import_read22.getViemChain)(chainId);
|
|
29789
29831
|
const publicClient = (0, import_wagmi15.usePublicClient)({ chainId });
|
|
29790
29832
|
const { data: walletClient } = (0, import_wagmi15.useWalletClient)();
|
|
29791
29833
|
const { address } = (0, import_wagmi15.useAccount)();
|
|
@@ -29846,7 +29888,7 @@ function useTransactions() {
|
|
|
29846
29888
|
|
|
29847
29889
|
// src/modules/assets.ts
|
|
29848
29890
|
init_SessionContext();
|
|
29849
|
-
var
|
|
29891
|
+
var import_react102 = __toESM(require("react"), 1);
|
|
29850
29892
|
var import_viem24 = require("viem");
|
|
29851
29893
|
var import_wagmi16 = require("wagmi");
|
|
29852
29894
|
var COMMON_TOKENS = [
|
|
@@ -30002,7 +30044,7 @@ function useTokenBalance(tokenAddress, userAddress) {
|
|
|
30002
30044
|
}
|
|
30003
30045
|
});
|
|
30004
30046
|
const { tokenInfo } = useTokenInfo(tokenAddress);
|
|
30005
|
-
const formattedBalance =
|
|
30047
|
+
const formattedBalance = import_react102.default.useMemo(() => {
|
|
30006
30048
|
if (!balance || !tokenInfo) return "0";
|
|
30007
30049
|
return (0, import_viem24.formatUnits)(balance, tokenInfo.decimals);
|
|
30008
30050
|
}, [balance, tokenInfo]);
|