@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.d.cts
CHANGED
|
@@ -1992,6 +1992,8 @@ declare function getExplorerUrl(): string;
|
|
|
1992
1992
|
interface UseBlockscoutAssetsOptions {
|
|
1993
1993
|
/** Wallet address to query */
|
|
1994
1994
|
address: Address$1 | undefined;
|
|
1995
|
+
/** Chain ID to query. Defaults to the active EmbarkAI chain. */
|
|
1996
|
+
chainId?: number;
|
|
1995
1997
|
/** Whether to enable the query (default: true when address provided) */
|
|
1996
1998
|
enabled?: boolean;
|
|
1997
1999
|
/** Whether to detect ERC3643 security tokens (default: true) */
|
package/dist/index.d.ts
CHANGED
|
@@ -1992,6 +1992,8 @@ declare function getExplorerUrl(): string;
|
|
|
1992
1992
|
interface UseBlockscoutAssetsOptions {
|
|
1993
1993
|
/** Wallet address to query */
|
|
1994
1994
|
address: Address$1 | undefined;
|
|
1995
|
+
/** Chain ID to query. Defaults to the active EmbarkAI chain. */
|
|
1996
|
+
chainId?: number;
|
|
1995
1997
|
/** Whether to enable the query (default: true when address provided) */
|
|
1996
1998
|
enabled?: boolean;
|
|
1997
1999
|
/** Whether to detect ERC3643 security tokens (default: true) */
|
package/dist/index.js
CHANGED
|
@@ -17569,27 +17569,71 @@ var init_NicknameMenu2 = __esm({
|
|
|
17569
17569
|
}
|
|
17570
17570
|
});
|
|
17571
17571
|
|
|
17572
|
+
// src/internal/hooks/useResolvedPublicClient.ts
|
|
17573
|
+
import { createPublicClientForChain as createPublicClientForChain5, getChainConfig as getChainConfig8 } from "@embarkai/core/read";
|
|
17574
|
+
import { useMemo as useMemo4 } from "react";
|
|
17575
|
+
function getCachedPublicClient(chainId) {
|
|
17576
|
+
const cachedClient = publicClientByChainId.get(chainId);
|
|
17577
|
+
if (cachedClient) return cachedClient;
|
|
17578
|
+
const publicClient = createPublicClientForChain5(chainId);
|
|
17579
|
+
publicClientByChainId.set(chainId, publicClient);
|
|
17580
|
+
return publicClient;
|
|
17581
|
+
}
|
|
17582
|
+
function useResolvedPublicClient(chainId, logScope = "useResolvedPublicClient") {
|
|
17583
|
+
const activePublicClient = useSession((st) => st.publicClient);
|
|
17584
|
+
const activeChainId = useSession((st) => st.activeChainId);
|
|
17585
|
+
const activeChainConfig = useSession((st) => st.chainConfig);
|
|
17586
|
+
const resolvedChainId = chainId ?? activeChainId;
|
|
17587
|
+
const shouldUseActiveClient = !chainId || chainId === activeChainId;
|
|
17588
|
+
const chainConfig = useMemo4(() => {
|
|
17589
|
+
if (shouldUseActiveClient) return activeChainConfig;
|
|
17590
|
+
return getChainConfig8(chainId);
|
|
17591
|
+
}, [activeChainConfig, chainId, shouldUseActiveClient]);
|
|
17592
|
+
const publicClient = useMemo4(() => {
|
|
17593
|
+
if (shouldUseActiveClient) return activePublicClient;
|
|
17594
|
+
if (!chainId) return activePublicClient;
|
|
17595
|
+
try {
|
|
17596
|
+
return getCachedPublicClient(chainId);
|
|
17597
|
+
} catch (error) {
|
|
17598
|
+
console.warn(`[${logScope}] Chain ${chainId} is not supported:`, error);
|
|
17599
|
+
return null;
|
|
17600
|
+
}
|
|
17601
|
+
}, [activePublicClient, chainId, logScope, shouldUseActiveClient]);
|
|
17602
|
+
return {
|
|
17603
|
+
activeChainId,
|
|
17604
|
+
chainConfig,
|
|
17605
|
+
publicClient,
|
|
17606
|
+
resolvedChainId
|
|
17607
|
+
};
|
|
17608
|
+
}
|
|
17609
|
+
var publicClientByChainId;
|
|
17610
|
+
var init_useResolvedPublicClient = __esm({
|
|
17611
|
+
"src/internal/hooks/useResolvedPublicClient.ts"() {
|
|
17612
|
+
init_SessionContext();
|
|
17613
|
+
publicClientByChainId = /* @__PURE__ */ new Map();
|
|
17614
|
+
}
|
|
17615
|
+
});
|
|
17616
|
+
|
|
17572
17617
|
// src/internal/hooks/useWatchTokens.ts
|
|
17573
17618
|
import { useQuery as useQuery15 } from "@tanstack/react-query";
|
|
17574
|
-
import { useMemo as
|
|
17619
|
+
import { useMemo as useMemo5 } from "react";
|
|
17575
17620
|
import { erc20Abi, formatUnits as formatUnits2 } from "viem";
|
|
17576
17621
|
function useWatchTokens(options) {
|
|
17577
|
-
const { address, enabled = true } = options;
|
|
17622
|
+
const { address, chainId, enabled = true } = options;
|
|
17578
17623
|
const { config } = useProviderConfig();
|
|
17579
|
-
const publicClient =
|
|
17580
|
-
const
|
|
17581
|
-
const watchTokens = useMemo4(() => {
|
|
17624
|
+
const { publicClient, resolvedChainId } = useResolvedPublicClient(chainId, "useWatchTokens");
|
|
17625
|
+
const watchTokens = useMemo5(() => {
|
|
17582
17626
|
const allWatchTokens = config.current.watchTokens;
|
|
17583
|
-
const tokensForChain =
|
|
17627
|
+
const tokensForChain = resolvedChainId ? allWatchTokens?.[resolvedChainId] || [] : [];
|
|
17584
17628
|
return tokensForChain;
|
|
17585
|
-
}, [config,
|
|
17629
|
+
}, [config, resolvedChainId]);
|
|
17586
17630
|
const {
|
|
17587
17631
|
data: assets,
|
|
17588
17632
|
isLoading,
|
|
17589
17633
|
error,
|
|
17590
17634
|
refetch
|
|
17591
17635
|
} = useQuery15({
|
|
17592
|
-
queryKey: [WATCH_TOKENS_QUERY_KEY,
|
|
17636
|
+
queryKey: [WATCH_TOKENS_QUERY_KEY, resolvedChainId, address, watchTokens.map((t) => t.address).join(",")],
|
|
17593
17637
|
queryFn: async () => {
|
|
17594
17638
|
if (!publicClient || !address || watchTokens.length === 0) {
|
|
17595
17639
|
return [];
|
|
@@ -17664,7 +17708,7 @@ var WATCH_TOKENS_QUERY_KEY;
|
|
|
17664
17708
|
var init_useWatchTokens = __esm({
|
|
17665
17709
|
"src/internal/hooks/useWatchTokens.ts"() {
|
|
17666
17710
|
init_ProviderContext();
|
|
17667
|
-
|
|
17711
|
+
init_useResolvedPublicClient();
|
|
17668
17712
|
WATCH_TOKENS_QUERY_KEY = "watch-tokens";
|
|
17669
17713
|
}
|
|
17670
17714
|
});
|
|
@@ -17672,7 +17716,7 @@ var init_useWatchTokens = __esm({
|
|
|
17672
17716
|
// src/internal/hooks/useBlockscoutAssets.ts
|
|
17673
17717
|
import { createBlockscoutClient } from "@embarkai/core/clients";
|
|
17674
17718
|
import { useQuery as useQuery16 } from "@tanstack/react-query";
|
|
17675
|
-
import { useCallback as useCallback19, useMemo as
|
|
17719
|
+
import { useCallback as useCallback19, useMemo as useMemo6, useRef as useRef16 } from "react";
|
|
17676
17720
|
import { formatEther, formatUnits as formatUnits3 } from "viem";
|
|
17677
17721
|
function resolveIpfsUri(uri) {
|
|
17678
17722
|
if (!uri) return "";
|
|
@@ -17798,15 +17842,13 @@ function createError(error) {
|
|
|
17798
17842
|
};
|
|
17799
17843
|
}
|
|
17800
17844
|
function useBlockscoutAssets(options) {
|
|
17801
|
-
const { address, enabled = true, detectSecurityTokens = true } = options;
|
|
17802
|
-
const publicClient =
|
|
17803
|
-
const activeChainId = useSession((st) => st.activeChainId);
|
|
17804
|
-
const chainConfig = useSession((st) => st.chainConfig);
|
|
17845
|
+
const { address, chainId, enabled = true, detectSecurityTokens = true } = options;
|
|
17846
|
+
const { chainConfig, publicClient, resolvedChainId } = useResolvedPublicClient(chainId, "useBlockscoutAssets");
|
|
17805
17847
|
const portfolioConfig = useProviderConfig().config.current.portfolio;
|
|
17806
17848
|
const customTokenBalancesQuery = portfolioConfig?.tokenBalancesQuery;
|
|
17807
17849
|
const customTokenBalancesQueryKey = portfolioConfig?.tokenBalancesQueryKey;
|
|
17808
17850
|
const blockscoutApiUrl = getBlockscoutApiUrl(chainConfig);
|
|
17809
|
-
const blockscoutClient =
|
|
17851
|
+
const blockscoutClient = useMemo6(
|
|
17810
17852
|
() => blockscoutApiUrl ? createBlockscoutClient({ baseUrl: blockscoutApiUrl }) : null,
|
|
17811
17853
|
[blockscoutApiUrl]
|
|
17812
17854
|
);
|
|
@@ -17815,13 +17857,13 @@ function useBlockscoutAssets(options) {
|
|
|
17815
17857
|
assets: watchTokenAssets,
|
|
17816
17858
|
isLoading: watchTokensLoading,
|
|
17817
17859
|
refetch: refetchWatchTokens
|
|
17818
|
-
} = useWatchTokens({ address, enabled });
|
|
17860
|
+
} = useWatchTokens({ address, chainId: resolvedChainId, enabled });
|
|
17819
17861
|
const {
|
|
17820
17862
|
data: nativeBalanceData,
|
|
17821
17863
|
isLoading: nativeLoading,
|
|
17822
17864
|
refetch: refetchNative
|
|
17823
17865
|
} = useQuery16({
|
|
17824
|
-
queryKey: ["native-balance",
|
|
17866
|
+
queryKey: ["native-balance", resolvedChainId, address],
|
|
17825
17867
|
queryFn: async () => {
|
|
17826
17868
|
if (!publicClient || !address) return null;
|
|
17827
17869
|
const balance = await publicClient.getBalance({ address });
|
|
@@ -17846,7 +17888,7 @@ function useBlockscoutAssets(options) {
|
|
|
17846
17888
|
refetch: refetchTokens,
|
|
17847
17889
|
dataUpdatedAt
|
|
17848
17890
|
} = useQuery16({
|
|
17849
|
-
queryKey: [BLOCKSCOUT_QUERY_KEY, address, blockscoutApiUrl, customTokenBalancesQueryKey],
|
|
17891
|
+
queryKey: [BLOCKSCOUT_QUERY_KEY, resolvedChainId, address, blockscoutApiUrl, customTokenBalancesQueryKey],
|
|
17850
17892
|
queryFn: async () => {
|
|
17851
17893
|
if (customTokenBalancesQuery) {
|
|
17852
17894
|
try {
|
|
@@ -17870,7 +17912,7 @@ function useBlockscoutAssets(options) {
|
|
|
17870
17912
|
isLoading: nftsLoading,
|
|
17871
17913
|
refetch: refetchNfts
|
|
17872
17914
|
} = useQuery16({
|
|
17873
|
-
queryKey: [BLOCKSCOUT_QUERY_KEY, "nfts", address, blockscoutApiUrl],
|
|
17915
|
+
queryKey: [BLOCKSCOUT_QUERY_KEY, "nfts", resolvedChainId, address, blockscoutApiUrl],
|
|
17874
17916
|
queryFn: () => blockscoutClient.getNfts(address),
|
|
17875
17917
|
enabled: !!address && enabled && !!blockscoutClient,
|
|
17876
17918
|
staleTime: BLOCKSCOUT_QUERY_STALE_TIME,
|
|
@@ -17879,12 +17921,12 @@ function useBlockscoutAssets(options) {
|
|
|
17879
17921
|
retry: 2,
|
|
17880
17922
|
retryDelay: 1e3
|
|
17881
17923
|
});
|
|
17882
|
-
const erc20TokenAddresses =
|
|
17924
|
+
const erc20TokenAddresses = useMemo6(() => {
|
|
17883
17925
|
if (!tokenBalances) return [];
|
|
17884
17926
|
return tokenBalances.filter((tb) => tb.token.type === "ERC-20").map((tb) => tb.token.address_hash);
|
|
17885
17927
|
}, [tokenBalances]);
|
|
17886
17928
|
const { data: erc3643Results } = useQuery16({
|
|
17887
|
-
queryKey: [ERC3643_DETECTION_QUERY_KEY, address, erc20TokenAddresses],
|
|
17929
|
+
queryKey: [ERC3643_DETECTION_QUERY_KEY, resolvedChainId, address, erc20TokenAddresses],
|
|
17888
17930
|
queryFn: async () => {
|
|
17889
17931
|
if (!publicClient || erc20TokenAddresses.length === 0) {
|
|
17890
17932
|
return /* @__PURE__ */ new Map();
|
|
@@ -17923,7 +17965,7 @@ function useBlockscoutAssets(options) {
|
|
|
17923
17965
|
gcTime: BLOCKSCOUT_QUERY_GC_TIME,
|
|
17924
17966
|
retry: 1
|
|
17925
17967
|
});
|
|
17926
|
-
const assets =
|
|
17968
|
+
const assets = useMemo6(() => {
|
|
17927
17969
|
const result = [];
|
|
17928
17970
|
const addedAddresses = /* @__PURE__ */ new Set();
|
|
17929
17971
|
if (nativeBalanceData) {
|
|
@@ -17969,7 +18011,7 @@ function useBlockscoutAssets(options) {
|
|
|
17969
18011
|
}
|
|
17970
18012
|
return result;
|
|
17971
18013
|
}, [nativeBalanceData, tokenBalances, nftItems, erc3643Results, watchTokenAssets, chainConfig]);
|
|
17972
|
-
const nativeBalance =
|
|
18014
|
+
const nativeBalance = useMemo6(() => {
|
|
17973
18015
|
if (!nativeBalanceData) return null;
|
|
17974
18016
|
return {
|
|
17975
18017
|
value: nativeBalanceData.value,
|
|
@@ -17977,7 +18019,7 @@ function useBlockscoutAssets(options) {
|
|
|
17977
18019
|
symbol: nativeBalanceData.symbol
|
|
17978
18020
|
};
|
|
17979
18021
|
}, [nativeBalanceData]);
|
|
17980
|
-
const error =
|
|
18022
|
+
const error = useMemo6(() => {
|
|
17981
18023
|
if (!tokensError) return null;
|
|
17982
18024
|
return createError(tokensError);
|
|
17983
18025
|
}, [tokensError]);
|
|
@@ -18011,9 +18053,9 @@ var BLOCKSCOUT_QUERY_KEY, ERC3643_DETECTION_QUERY_KEY, ERC3643_ABI;
|
|
|
18011
18053
|
var init_useBlockscoutAssets = __esm({
|
|
18012
18054
|
"src/internal/hooks/useBlockscoutAssets.ts"() {
|
|
18013
18055
|
init_ProviderContext();
|
|
18014
|
-
init_SessionContext();
|
|
18015
18056
|
init_initial();
|
|
18016
18057
|
init_constants();
|
|
18058
|
+
init_useResolvedPublicClient();
|
|
18017
18059
|
init_useWatchTokens();
|
|
18018
18060
|
BLOCKSCOUT_QUERY_KEY = "blockscout-token-balances";
|
|
18019
18061
|
ERC3643_DETECTION_QUERY_KEY = "erc3643-detection";
|
|
@@ -18444,7 +18486,7 @@ var init_nickname_fingerprint = __esm({
|
|
|
18444
18486
|
// src/internal/components/ReceiveMenu/ReceiveMenu.tsx
|
|
18445
18487
|
import { ArrowLeft as ArrowLeft17, CheckCircle2 as CheckCircle23, Copy as Copy3, Info as Info5, Loader as Loader28, Shield } from "lucide-react";
|
|
18446
18488
|
import QRCode from "qrcode";
|
|
18447
|
-
import { useCallback as useCallback21, useEffect as useEffect34, useMemo as
|
|
18489
|
+
import { useCallback as useCallback21, useEffect as useEffect34, useMemo as useMemo7, useState as useState23 } from "react";
|
|
18448
18490
|
import { Fragment as Fragment32, jsx as jsx83, jsxs as jsxs76 } from "react/jsx-runtime";
|
|
18449
18491
|
function ReceiveMenu() {
|
|
18450
18492
|
const session = useSession((st) => st.session);
|
|
@@ -18458,7 +18500,7 @@ function ReceiveMenu() {
|
|
|
18458
18500
|
const [qrCodeUrl, setQrCodeUrl] = useState23("");
|
|
18459
18501
|
const [copied, setCopied] = useState23(false);
|
|
18460
18502
|
const [fingerprintCopied, setFingerprintCopied] = useState23(false);
|
|
18461
|
-
const fingerprint =
|
|
18503
|
+
const fingerprint = useMemo7(() => {
|
|
18462
18504
|
if (!session?.ownerAddress) return null;
|
|
18463
18505
|
try {
|
|
18464
18506
|
return generateFingerprint(session.ownerAddress);
|
|
@@ -20405,11 +20447,11 @@ function SelectStep(props) {
|
|
|
20405
20447
|
/* @__PURE__ */ jsx95("span", { className: "text-[var(--ui-kit-fg-muted)]", children: t("passport:bridgeMenu.labels.selectToken") }),
|
|
20406
20448
|
/* @__PURE__ */ jsx95("span", { className: "w-4 h-4" }),
|
|
20407
20449
|
/* @__PURE__ */ jsxs86("span", { className: "flex items-center gap-[var(--ui-kit-gap)] leading-4", children: [
|
|
20408
|
-
isRouteTokenBalanceLoading && /* @__PURE__ */ jsx95(LoaderIcon10, { className: "w-4 h-4 animate-spin" }),
|
|
20409
20450
|
/* @__PURE__ */ jsxs86("span", { className: "text-[var(--ui-kit-fg-muted)]", children: [
|
|
20410
20451
|
t("passport:common.balance"),
|
|
20411
20452
|
": "
|
|
20412
20453
|
] }),
|
|
20454
|
+
isRouteTokenBalanceLoading && /* @__PURE__ */ jsx95(LoaderIcon10, { className: "w-4 h-4 animate-spin text-[var(--ui-kit-fg-muted)]" }),
|
|
20413
20455
|
!isRouteTokenBalanceLoading && /* @__PURE__ */ jsxs86("span", { className: "font-semibold", children: [
|
|
20414
20456
|
formatPrice(Number(routeTokenBalance || 0)),
|
|
20415
20457
|
" ",
|
|
@@ -21136,14 +21178,14 @@ var init_HistoryStep = __esm({
|
|
|
21136
21178
|
|
|
21137
21179
|
// src/internal/components/SendMenu/hyperbridge/steps/SelectAssetRoute.tsx
|
|
21138
21180
|
import { ArrowLeftRightIcon as ArrowLeftRightIcon2 } from "lucide-react";
|
|
21139
|
-
import { useMemo as
|
|
21181
|
+
import { useMemo as useMemo8, useState as useState28 } from "react";
|
|
21140
21182
|
import { Fragment as Fragment38, jsx as jsx100, jsxs as jsxs90 } from "react/jsx-runtime";
|
|
21141
21183
|
function SelectAssetRoute(props) {
|
|
21142
21184
|
const { hyperlaneWarpRoutes } = props;
|
|
21143
21185
|
const { t } = useT();
|
|
21144
21186
|
const [isTokenSymbolSelector, setIsTokenSymbolSelector] = useState28(false);
|
|
21145
21187
|
const selectedAssetSymbol = useBridgeStore((st) => st.bridgeAssetSymbol);
|
|
21146
|
-
const tokenList =
|
|
21188
|
+
const tokenList = useMemo8(() => {
|
|
21147
21189
|
const tokens = hyperlaneWarpRoutes.map((route) => route.symbol);
|
|
21148
21190
|
const uniqueTokens = Array.from(new Set(tokens));
|
|
21149
21191
|
return uniqueTokens.map((symbol) => ({
|
|
@@ -21425,7 +21467,7 @@ var init_useErc3643Compliance = __esm({
|
|
|
21425
21467
|
|
|
21426
21468
|
// src/hooks/useNicknameResolve.ts
|
|
21427
21469
|
import { useQuery as useQuery23 } from "@tanstack/react-query";
|
|
21428
|
-
import { useState as useState29, useEffect as useEffect41, useMemo as
|
|
21470
|
+
import { useState as useState29, useEffect as useEffect41, useMemo as useMemo9 } from "react";
|
|
21429
21471
|
function looksLikeNickname(input) {
|
|
21430
21472
|
if (!input) return false;
|
|
21431
21473
|
if (input.startsWith("0x")) return false;
|
|
@@ -21465,7 +21507,7 @@ function useNicknameResolve(input, options) {
|
|
|
21465
21507
|
const isNotFound = query.isError && query.error?.code === "NICKNAME_NOT_FOUND";
|
|
21466
21508
|
const isWalletNotSetup = !!query.data && query.data.resolvedTarget === null;
|
|
21467
21509
|
const isFrozen = query.data?.isFrozen ?? false;
|
|
21468
|
-
const fingerprintVerification =
|
|
21510
|
+
const fingerprintVerification = useMemo9(() => {
|
|
21469
21511
|
if (!query.data?.owner || !query.data?.fingerprint) {
|
|
21470
21512
|
return null;
|
|
21471
21513
|
}
|
|
@@ -22427,7 +22469,7 @@ var init_sendSteps = __esm({
|
|
|
22427
22469
|
|
|
22428
22470
|
// src/internal/components/SendMenu/send/SendMenu.tsx
|
|
22429
22471
|
import { CheckCircle2 as CheckCircle26, Loader as Loader33 } from "lucide-react";
|
|
22430
|
-
import { useEffect as useEffect42, useMemo as
|
|
22472
|
+
import { useEffect as useEffect42, useMemo as useMemo10 } from "react";
|
|
22431
22473
|
import { parseUnits as parseUnits2 } from "viem";
|
|
22432
22474
|
import { Fragment as Fragment43, jsx as jsx109, jsxs as jsxs98 } from "react/jsx-runtime";
|
|
22433
22475
|
function SendMenu() {
|
|
@@ -22488,7 +22530,7 @@ function SendMenu() {
|
|
|
22488
22530
|
const isNicknameInput = looksLikeNickname(recipient);
|
|
22489
22531
|
const resolvedNicknameData = useNicknameResolve(recipient, { enabled: isNicknameInput, chainId: activeChainId });
|
|
22490
22532
|
const effectiveAddress = isNicknameInput ? resolvedNicknameData?.resolvedAddress : recipient;
|
|
22491
|
-
const complianceAmount =
|
|
22533
|
+
const complianceAmount = useMemo10(() => {
|
|
22492
22534
|
if (!isSecurity || !amount || !selectedAsset) return void 0;
|
|
22493
22535
|
try {
|
|
22494
22536
|
return parseUnits2(amount, selectedAsset.decimals || 18);
|
|
@@ -22618,7 +22660,7 @@ function SelectorFlowButtons() {
|
|
|
22618
22660
|
Button,
|
|
22619
22661
|
{
|
|
22620
22662
|
size: "medium",
|
|
22621
|
-
variant: selectorFlow === "send" ? "
|
|
22663
|
+
variant: selectorFlow === "send" ? "default" : "ghost",
|
|
22622
22664
|
className: "flex-1 uppercase",
|
|
22623
22665
|
onClick: () => {
|
|
22624
22666
|
useFlowSelectorStore.getState().setError(null);
|
|
@@ -22634,7 +22676,7 @@ function SelectorFlowButtons() {
|
|
|
22634
22676
|
Button,
|
|
22635
22677
|
{
|
|
22636
22678
|
size: "medium",
|
|
22637
|
-
variant: selectorFlow === "bridge" ? "
|
|
22679
|
+
variant: selectorFlow === "bridge" ? "default" : "ghost",
|
|
22638
22680
|
className: "flex-1 uppercase",
|
|
22639
22681
|
onClick: () => {
|
|
22640
22682
|
useFlowSelectorStore.getState().setError(null);
|
|
@@ -24239,7 +24281,7 @@ var init_package = __esm({
|
|
|
24239
24281
|
"package.json"() {
|
|
24240
24282
|
package_default = {
|
|
24241
24283
|
name: "@embarkai/ui-kit",
|
|
24242
|
-
version: "0.4.
|
|
24284
|
+
version: "0.4.32",
|
|
24243
24285
|
description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
|
|
24244
24286
|
type: "module",
|
|
24245
24287
|
main: "./dist/index.cjs",
|
|
@@ -25245,9 +25287,9 @@ var init_DirectWalletHandler = __esm({
|
|
|
25245
25287
|
// src/context/SessionContext.tsx
|
|
25246
25288
|
import {
|
|
25247
25289
|
createBundlerClientForChain,
|
|
25248
|
-
createPublicClientForChain as
|
|
25290
|
+
createPublicClientForChain as createPublicClientForChain6,
|
|
25249
25291
|
DEFAULT_CHAIN_ID as DEFAULT_CHAIN_ID2,
|
|
25250
|
-
getChainConfig as
|
|
25292
|
+
getChainConfig as getChainConfig9,
|
|
25251
25293
|
getViemChain as getViemChain2
|
|
25252
25294
|
} from "@embarkai/core/read";
|
|
25253
25295
|
import { Fragment as Fragment46 } from "react";
|
|
@@ -25258,7 +25300,7 @@ function getChainParams(chainCfg) {
|
|
|
25258
25300
|
return {
|
|
25259
25301
|
activeChainId: chainCfg.id,
|
|
25260
25302
|
chainConfig: chainCfg,
|
|
25261
|
-
publicClient:
|
|
25303
|
+
publicClient: createPublicClientForChain6(chainCfg.id),
|
|
25262
25304
|
bundlerClient: createBundlerClientForChain(chainCfg.id),
|
|
25263
25305
|
viemChain: getViemChain2(chainCfg.id)
|
|
25264
25306
|
};
|
|
@@ -25356,7 +25398,7 @@ var init_SessionContext = __esm({
|
|
|
25356
25398
|
// Set default chainId after hydration if not persisted
|
|
25357
25399
|
onRehydrateStorage: () => (state) => {
|
|
25358
25400
|
if (!state) return;
|
|
25359
|
-
const hydartedChain = getChainParams(
|
|
25401
|
+
const hydartedChain = getChainParams(getChainConfig9(state.activeChainId || DEFAULT_CHAIN_ID2));
|
|
25360
25402
|
state.activeChainId = hydartedChain.activeChainId;
|
|
25361
25403
|
state.publicClient = hydartedChain.publicClient;
|
|
25362
25404
|
state.bundlerClient = hydartedChain.bundlerClient;
|
|
@@ -25403,7 +25445,7 @@ var init_env = __esm({
|
|
|
25403
25445
|
});
|
|
25404
25446
|
|
|
25405
25447
|
// src/internal/clients/base.ts
|
|
25406
|
-
import { getChainConfig as
|
|
25448
|
+
import { getChainConfig as getChainConfig10, getViemChain as getViemChain3, lumiaMainnetChain, lumiaTestnetChain } from "@embarkai/core/read";
|
|
25407
25449
|
import { http as http4 } from "viem";
|
|
25408
25450
|
import { createBundlerClient } from "viem/account-abstraction";
|
|
25409
25451
|
function getTssUrl2() {
|
|
@@ -25434,13 +25476,13 @@ function getExplorerUrl() {
|
|
|
25434
25476
|
const paramUrl = typeof window !== "undefined" ? new URLSearchParams(window.location.search).get("explorerUrl") || void 0 : void 0;
|
|
25435
25477
|
const net = getSelectedNetwork();
|
|
25436
25478
|
const chainId = requireActiveChainId();
|
|
25437
|
-
const chainConfig =
|
|
25479
|
+
const chainConfig = getChainConfig10(chainId);
|
|
25438
25480
|
console.log("[getExplorerUrl] ", paramUrl, chainConfig.blockExplorerUrl);
|
|
25439
25481
|
return paramUrl || chainConfig.blockExplorerUrl;
|
|
25440
25482
|
}
|
|
25441
25483
|
function getBundlerClient() {
|
|
25442
25484
|
const chainId = requireActiveChainId();
|
|
25443
|
-
const chainConfig =
|
|
25485
|
+
const chainConfig = getChainConfig10(chainId);
|
|
25444
25486
|
const viemChain = getViemChain3(chainId);
|
|
25445
25487
|
return createBundlerClient({
|
|
25446
25488
|
chain: viemChain,
|
|
@@ -27964,14 +28006,14 @@ var init_rainbowkit = __esm({
|
|
|
27964
28006
|
|
|
27965
28007
|
// src/context/RainbowKitContext.tsx
|
|
27966
28008
|
import { darkTheme, lightTheme, RainbowKitProvider as NativeRainbowKitProvider } from "@rainbow-me/rainbowkit";
|
|
27967
|
-
import { useMemo as
|
|
28009
|
+
import { useMemo as useMemo11 } from "react";
|
|
27968
28010
|
import { WagmiProvider } from "wagmi";
|
|
27969
28011
|
import "@rainbow-me/rainbowkit/styles.css";
|
|
27970
28012
|
import { Fragment as Fragment47, jsx as jsx124 } from "react/jsx-runtime";
|
|
27971
28013
|
function RainbowKitProvider({ children }) {
|
|
27972
28014
|
const config = useProviderConfig().config;
|
|
27973
28015
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
27974
|
-
const rainbowConfig =
|
|
28016
|
+
const rainbowConfig = useMemo11(
|
|
27975
28017
|
() => createRainbowConfig({
|
|
27976
28018
|
projectId: config.current?.wallet?.walletConnectProjectId,
|
|
27977
28019
|
allowedWallets: config.current?.wallet?.allowedWallets,
|
|
@@ -27985,7 +28027,7 @@ function RainbowKitProvider({ children }) {
|
|
|
27985
28027
|
config.current?.wallet?.walletConnectProjectId
|
|
27986
28028
|
]
|
|
27987
28029
|
);
|
|
27988
|
-
const customTheme =
|
|
28030
|
+
const customTheme = useMemo11(() => {
|
|
27989
28031
|
if (!config.current?.wallet?.enabled) return {};
|
|
27990
28032
|
return colorMode === "dark" ? {
|
|
27991
28033
|
...darkTheme(),
|
|
@@ -28085,7 +28127,7 @@ import {
|
|
|
28085
28127
|
useCallback as useCallback30,
|
|
28086
28128
|
useContext,
|
|
28087
28129
|
useEffect as useEffect50,
|
|
28088
|
-
useMemo as
|
|
28130
|
+
useMemo as useMemo12,
|
|
28089
28131
|
useRef as useRef21
|
|
28090
28132
|
} from "react";
|
|
28091
28133
|
import { jsx as jsx126 } from "react/jsx-runtime";
|
|
@@ -28198,7 +28240,7 @@ function Provider(props) {
|
|
|
28198
28240
|
console.error("[PROVIDER] Error setting up iframe manager:", error);
|
|
28199
28241
|
}
|
|
28200
28242
|
}, [projectId]);
|
|
28201
|
-
const contextValue =
|
|
28243
|
+
const contextValue = useMemo12(
|
|
28202
28244
|
() => ({
|
|
28203
28245
|
config,
|
|
28204
28246
|
updateConfig,
|
|
@@ -28251,7 +28293,7 @@ init_pro_mode();
|
|
|
28251
28293
|
init_utils2();
|
|
28252
28294
|
import { useQuery as useQuery28 } from "@tanstack/react-query";
|
|
28253
28295
|
import { Cloud as Cloud4, Laptop as Laptop2, Loader as Loader37, Shield as Shield3 } from "lucide-react";
|
|
28254
|
-
import { useEffect as useEffect51, useMemo as
|
|
28296
|
+
import { useEffect as useEffect51, useMemo as useMemo13 } from "react";
|
|
28255
28297
|
import { Fragment as Fragment48, jsx as jsx127, jsxs as jsxs110 } from "react/jsx-runtime";
|
|
28256
28298
|
function getFormattedStatus(label, status, showStatus) {
|
|
28257
28299
|
const isStatus = showStatus && status && status !== "idle" && status !== "ready";
|
|
@@ -28279,7 +28321,7 @@ function ConnectWalletButton(props) {
|
|
|
28279
28321
|
queryFn: getUserProfile
|
|
28280
28322
|
});
|
|
28281
28323
|
const displayName = profile?.nicknameDisplay || profile?.displayName || jwtTokenManager2.getDisplayName();
|
|
28282
|
-
const indicators =
|
|
28324
|
+
const indicators = useMemo13(() => {
|
|
28283
28325
|
const userId = session?.mpcUserId;
|
|
28284
28326
|
if (!userId) return { server: false, local: false, backup: false };
|
|
28285
28327
|
const server = jwtTokenManager2.getHasKeyshare() ?? false;
|
|
@@ -28557,10 +28599,10 @@ import * as React12 from "react";
|
|
|
28557
28599
|
// src/clients/bundler/getUserOperationByHash.ts
|
|
28558
28600
|
init_SessionContext();
|
|
28559
28601
|
import { bundlerRpc } from "@embarkai/core";
|
|
28560
|
-
import { getChainConfig as
|
|
28602
|
+
import { getChainConfig as getChainConfig11 } from "@embarkai/core/read";
|
|
28561
28603
|
async function getUserOperationByHash(userOpHash, chainId) {
|
|
28562
28604
|
const targetChainId = chainId ?? requireActiveChainId();
|
|
28563
|
-
const chainConfig =
|
|
28605
|
+
const chainConfig = getChainConfig11(targetChainId);
|
|
28564
28606
|
if (!chainConfig) {
|
|
28565
28607
|
throw new Error(`Chain ${targetChainId} is not supported`);
|
|
28566
28608
|
}
|
|
@@ -28592,10 +28634,10 @@ async function getUserOperationByHash(userOpHash, chainId) {
|
|
|
28592
28634
|
// src/clients/bundler/getUserOperationReceipt.ts
|
|
28593
28635
|
init_SessionContext();
|
|
28594
28636
|
import { bundlerRpc as bundlerRpc2 } from "@embarkai/core";
|
|
28595
|
-
import { getChainConfig as
|
|
28637
|
+
import { getChainConfig as getChainConfig12 } from "@embarkai/core/read";
|
|
28596
28638
|
async function getUserOperationReceipt(userOpHash, chainId) {
|
|
28597
28639
|
const targetChainId = chainId ?? requireActiveChainId();
|
|
28598
|
-
const chainConfig =
|
|
28640
|
+
const chainConfig = getChainConfig12(targetChainId);
|
|
28599
28641
|
if (!chainConfig) {
|
|
28600
28642
|
throw new Error(`Chain ${targetChainId} is not supported`);
|
|
28601
28643
|
}
|
|
@@ -29462,7 +29504,7 @@ function useSendDirectTransaction() {
|
|
|
29462
29504
|
init_SessionContext();
|
|
29463
29505
|
init_account2();
|
|
29464
29506
|
init_linkedProfiles();
|
|
29465
|
-
import { useCallback as useCallback37, useMemo as
|
|
29507
|
+
import { useCallback as useCallback37, useMemo as useMemo14, useState as useState40 } from "react";
|
|
29466
29508
|
import { encodeFunctionData as encodeFunctionData3, isAddress as isAddress4, parseEther as parseEther4, parseUnits as parseUnits3 } from "viem";
|
|
29467
29509
|
var ERC20_TRANSFER_ABI2 = [
|
|
29468
29510
|
{
|
|
@@ -29481,7 +29523,7 @@ function useTransferToLinkedWallet() {
|
|
|
29481
29523
|
const [isPending, setIsPending] = useState40(false);
|
|
29482
29524
|
const [error, setError] = useState40(null);
|
|
29483
29525
|
const [userOpHash, setUserOpHash] = useState40(null);
|
|
29484
|
-
const linkedWallets =
|
|
29526
|
+
const linkedWallets = useMemo14(
|
|
29485
29527
|
() => (profiles || []).filter((p) => p.provider === "wallet" && p.externalId).map((p) => p.externalId),
|
|
29486
29528
|
[profiles]
|
|
29487
29529
|
);
|