@embarkai/ui-kit 0.4.35 → 0.4.37

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/index.js CHANGED
@@ -15691,38 +15691,33 @@ var init_MainMenu2 = __esm({
15691
15691
  // src/modules/linkedProfiles.ts
15692
15692
  import { useQuery as useQuery11, useQueryClient as useQueryClient11 } from "@tanstack/react-query";
15693
15693
  import { useCallback as useCallback16 } from "react";
15694
- async function getLinkProfilesData() {
15695
- const list = await getLinkedProviders();
15696
- const loadedProfiles = list.map((p) => {
15697
- const info = getProviderDisplayInfo(p.provider);
15698
- return { ...p, displayName: info.name, icon: info.icon };
15699
- });
15700
- let avatar = null;
15701
- try {
15702
- avatar = jwtTokenManager2.getAvatar() || null;
15703
- } catch {
15704
- avatar = null;
15705
- }
15706
- return { profiles: loadedProfiles, avatar };
15707
- }
15708
15694
  function useLinkedProfiles() {
15709
15695
  const qc = useQueryClient11();
15710
15696
  const address = useSession((st) => st.address);
15711
- const {
15712
- data,
15713
- isFetching: isLoading,
15714
- error
15715
- } = useQuery11({
15697
+ const { data, isFetching, isLoading, error } = useQuery11({
15716
15698
  retry: false,
15717
15699
  enabled: !!address,
15718
15700
  queryKey: [LINKED_PROFILES_QUERY_KEY, address],
15719
- queryFn: getLinkProfilesData
15701
+ queryFn: async () => {
15702
+ const list = await getLinkedProviders();
15703
+ const loadedProfiles = list.map((p) => {
15704
+ const info = getProviderDisplayInfo(p.provider);
15705
+ return { ...p, displayName: info.name, icon: info.icon };
15706
+ });
15707
+ let avatar2 = null;
15708
+ try {
15709
+ avatar2 = jwtTokenManager2.getAvatar() || null;
15710
+ } catch {
15711
+ avatar2 = null;
15712
+ }
15713
+ return { profiles: loadedProfiles, avatar: avatar2 };
15714
+ }
15720
15715
  });
15721
15716
  const { profiles = [], avatar = null } = data || {};
15722
15717
  const refresh = useCallback16(async () => {
15723
15718
  await qc.invalidateQueries({ queryKey: [LINKED_PROFILES_QUERY_KEY, address] });
15724
15719
  }, [qc, address]);
15725
- return { profiles, avatar, isLoading, error, refresh };
15720
+ return { profiles, avatar, isLoading, isFetching, error, refresh };
15726
15721
  }
15727
15722
  var LINKED_PROFILES_QUERY_KEY;
15728
15723
  var init_linkedProfiles = __esm({
@@ -16732,15 +16727,49 @@ var init_ManageWallet = __esm({
16732
16727
  }
16733
16728
  });
16734
16729
 
16730
+ // src/internal/stores/useExternalWalletStore.ts
16731
+ import { create as create8 } from "zustand";
16732
+ var useExternalWalletStore;
16733
+ var init_useExternalWalletStore = __esm({
16734
+ "src/internal/stores/useExternalWalletStore.ts"() {
16735
+ useExternalWalletStore = create8((set) => ({
16736
+ configMode: "linked",
16737
+ activeMode: "linked",
16738
+ externalAddress: null,
16739
+ externalChainId: null,
16740
+ isExternalConnected: false,
16741
+ connectorName: null,
16742
+ setConfigMode: (mode) => set({ configMode: mode }),
16743
+ setActiveMode: (mode) => set({ activeMode: mode }),
16744
+ setExternalWallet: ({ address, chainId, connectorName }) => set({
16745
+ externalAddress: address,
16746
+ externalChainId: chainId,
16747
+ isExternalConnected: true,
16748
+ connectorName
16749
+ }),
16750
+ clearExternalWallet: () => set({
16751
+ externalAddress: null,
16752
+ externalChainId: null,
16753
+ isExternalConnected: false,
16754
+ connectorName: null
16755
+ }),
16756
+ setExternalChainId: (chainId) => set({ externalChainId: chainId })
16757
+ }));
16758
+ }
16759
+ });
16760
+
16735
16761
  // src/internal/components/ManageWalletMenu/UnlinkProviderMenu.tsx
16736
16762
  import { useMutation as useMutation15, useQueryClient as useQueryClient16 } from "@tanstack/react-query";
16737
16763
  import { Key as Key6, Loader as Loader16 } from "lucide-react";
16738
16764
  import { useState as useState17 } from "react";
16765
+ import { useDisconnect } from "wagmi";
16739
16766
  import { jsx as jsx74, jsxs as jsxs68 } from "react/jsx-runtime";
16740
16767
  function UnlinkProviderMenu() {
16741
16768
  const qc = useQueryClient16();
16742
16769
  const address = useSession((st) => st.address);
16743
16770
  const { callbacksRef } = useProviderConfig();
16771
+ const { disconnect: disconnectExternalWallet } = useDisconnect();
16772
+ const isExternalConnected = useExternalWalletStore((st) => st.isExternalConnected);
16744
16773
  const { t } = useT();
16745
16774
  const setPage = useLayoutDataStore((st) => st.setPage);
16746
16775
  const { confirmUnlink, setConfirmUnlink, setAlert } = useManageWalletStore();
@@ -16751,6 +16780,13 @@ function UnlinkProviderMenu() {
16751
16780
  throw new Error("No provider to unlink");
16752
16781
  }
16753
16782
  const { provider, externalId } = confirmUnlink;
16783
+ if (provider === "wallet" && isExternalConnected) {
16784
+ await new Promise((resolve) => {
16785
+ disconnectExternalWallet();
16786
+ useExternalWalletStore.getState().clearExternalWallet();
16787
+ setTimeout(() => resolve(null), 1e3);
16788
+ });
16789
+ }
16754
16790
  await unlinkProvider(provider, externalId);
16755
16791
  },
16756
16792
  onSuccess: async () => {
@@ -16827,6 +16863,7 @@ var init_UnlinkProviderMenu = __esm({
16827
16863
  init_useT();
16828
16864
  init_linkedProfiles();
16829
16865
  init_auth();
16866
+ init_useExternalWalletStore();
16830
16867
  init_button();
16831
16868
  init_input();
16832
16869
  init_useProvidersList();
@@ -18972,37 +19009,6 @@ var init_wallet = __esm({
18972
19009
  }
18973
19010
  });
18974
19011
 
18975
- // src/internal/stores/useExternalWalletStore.ts
18976
- import { create as create8 } from "zustand";
18977
- var useExternalWalletStore;
18978
- var init_useExternalWalletStore = __esm({
18979
- "src/internal/stores/useExternalWalletStore.ts"() {
18980
- useExternalWalletStore = create8((set) => ({
18981
- configMode: "linked",
18982
- activeMode: "linked",
18983
- externalAddress: null,
18984
- externalChainId: null,
18985
- isExternalConnected: false,
18986
- connectorName: null,
18987
- setConfigMode: (mode) => set({ configMode: mode }),
18988
- setActiveMode: (mode) => set({ activeMode: mode }),
18989
- setExternalWallet: ({ address, chainId, connectorName }) => set({
18990
- externalAddress: address,
18991
- externalChainId: chainId,
18992
- isExternalConnected: true,
18993
- connectorName
18994
- }),
18995
- clearExternalWallet: () => set({
18996
- externalAddress: null,
18997
- externalChainId: null,
18998
- isExternalConnected: false,
18999
- connectorName: null
19000
- }),
19001
- setExternalChainId: (chainId) => set({ externalChainId: chainId })
19002
- }));
19003
- }
19004
- });
19005
-
19006
19012
  // src/internal/components/SendMenu/useFlowSelector.ts
19007
19013
  import { create as create9 } from "zustand";
19008
19014
  import { persist as persist2 } from "zustand/middleware";
@@ -19153,7 +19159,8 @@ import { useMutation as useMutation18 } from "@tanstack/react-query";
19153
19159
  import { useEffect as useEffect33, useRef as useRef17, useState as useState24 } from "react";
19154
19160
  import { useSignMessage } from "wagmi";
19155
19161
  import { jsx as jsx89, jsxs as jsxs83 } from "react/jsx-runtime";
19156
- function SenderSelector() {
19162
+ function SenderSelector(props) {
19163
+ const { directWalletProfile } = props;
19157
19164
  const { t } = useT();
19158
19165
  const config = useProviderConfig().config;
19159
19166
  const { signMessageAsync } = useSignMessage();
@@ -19161,7 +19168,6 @@ function SenderSelector() {
19161
19168
  const directWalletAddress = useExternalWalletStore((st) => st.externalAddress);
19162
19169
  const directWalletIsConnected = useExternalWalletStore((st) => st.isExternalConnected);
19163
19170
  const pendingWalletRef = useRef17(null);
19164
- const { profiles } = useLinkedProfiles();
19165
19171
  const originChain = useBridgeStore((st) => st.originChain);
19166
19172
  const bridgeSender = useBridgeStore((st) => st.bridgeSender);
19167
19173
  const bridgeSenders = useBridgeStore((st) => st.bridgeSenders);
@@ -19169,22 +19175,15 @@ function SenderSelector() {
19169
19175
  useEffect33(() => {
19170
19176
  useFlowSelectorStore.getState().setRenderKey(`sender-selected-${Date.now()}`);
19171
19177
  }, [walletMessage]);
19172
- useEffect33(() => {
19173
- const pending = pendingWalletRef.current;
19174
- if (!pending || !directWalletIsConnected || !directWalletAddress) return;
19175
- if (directWalletAddress.toLowerCase() !== pending.externalId?.toLowerCase()) return;
19176
- pendingWalletRef.current = null;
19177
- directWalletFlow(pending);
19178
- }, [directWalletIsConnected, directWalletAddress]);
19179
- const { mutate: directWalletFlow, isPending: isDirectWalletLogin } = useMutation18({
19180
- mutationFn: async (walletProfile2) => {
19181
- if (!walletProfile2?.meta?.walletName || !walletProfile2?.externalId || !walletProfile2?.meta?.walletType) {
19182
- console.error("[SENDER SELECTOR] Invalid wallet profile:", walletProfile2);
19178
+ const { mutate: loginDirectWallet, isPending: isDirectWalletLoggingIn } = useMutation18({
19179
+ mutationFn: async (walletProfile) => {
19180
+ if (!walletProfile?.meta?.walletName || !walletProfile?.externalId || !walletProfile?.meta?.walletType) {
19181
+ console.error("[SENDER SELECTOR] Invalid wallet profile:", walletProfile);
19183
19182
  setWalletMessage("Invalid wallet profile. Please try connecting your wallet again.");
19184
19183
  return;
19185
19184
  }
19186
19185
  const projectName = config.current?.projectId ? await fetchProjectName(config.current.projectId) : "EmbarkAI";
19187
- const signingWalletAddress = walletProfile2?.externalId;
19186
+ const signingWalletAddress = walletProfile?.externalId;
19188
19187
  const message = createLoginMessage(signingWalletAddress, projectName);
19189
19188
  const signature = await Promise.race([
19190
19189
  signMessageAsync({ message, account: signingWalletAddress }),
@@ -19208,19 +19207,17 @@ function SenderSelector() {
19208
19207
  address: signingWalletAddress,
19209
19208
  signature,
19210
19209
  message,
19211
- walletName: walletProfile2.meta.walletName,
19212
- walletType: walletProfile2.meta.walletType
19210
+ walletName: walletProfile.meta.walletName,
19211
+ walletType: walletProfile.meta.walletType
19213
19212
  };
19214
- console.log("[SENDER SELECTOR] Wallet login data prepared:", walletData);
19215
19213
  const loginData = await walletLogin(walletData);
19216
- return { fromChainId, loginData, walletProfile: walletProfile2 };
19214
+ return { fromChainId, loginData, walletProfile };
19217
19215
  },
19218
- onSuccess: ({ fromChainId, loginData, walletProfile: walletProfile2 }) => {
19219
- console.log("[SENDER SELECTOR] Wallet login successful:", loginData);
19216
+ onSuccess: ({ fromChainId, loginData, walletProfile }) => {
19220
19217
  useExternalWalletStore.getState().setExternalWallet({
19221
- address: walletProfile2?.externalId,
19218
+ address: walletProfile?.externalId,
19222
19219
  chainId: fromChainId,
19223
- connectorName: walletProfile2?.meta?.walletName || "Unknown Wallet"
19220
+ connectorName: walletProfile?.meta?.walletName || "Unknown Wallet"
19224
19221
  });
19225
19222
  setWalletMessage(null);
19226
19223
  useBridgeStore.getState().setBridgeSender("direct-wallet");
@@ -19231,7 +19228,13 @@ function SenderSelector() {
19231
19228
  setWalletMessage(error instanceof Error ? error.message : "Wallet login failed. Please try again.");
19232
19229
  }
19233
19230
  });
19234
- const walletProfile = profiles.filter((p) => p.provider === "wallet")[0] || null;
19231
+ useEffect33(() => {
19232
+ const pendingProfile = pendingWalletRef.current;
19233
+ if (!pendingProfile || !directWalletIsConnected || !directWalletAddress) return;
19234
+ if (directWalletAddress.toLowerCase() !== pendingProfile.externalId?.toLowerCase()) return;
19235
+ pendingWalletRef.current = null;
19236
+ loginDirectWallet(pendingProfile);
19237
+ }, [directWalletIsConnected, directWalletAddress]);
19235
19238
  return /* @__PURE__ */ jsxs83("div", { className: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: [
19236
19239
  bridgeSenders.map((sender) => /* @__PURE__ */ jsxs83(
19237
19240
  Button,
@@ -19283,14 +19286,14 @@ function SenderSelector() {
19283
19286
  variant: "default",
19284
19287
  size: "large",
19285
19288
  className: "w-full",
19286
- disabled: !walletProfile || isDirectWalletLogin,
19289
+ disabled: !directWalletProfile || isDirectWalletLoggingIn,
19287
19290
  onClick: () => {
19288
- const isConnectedToRightWallet = directWalletIsConnected && directWalletAddress?.toLowerCase() === walletProfile?.externalId?.toLowerCase();
19291
+ const isConnectedToRightWallet = directWalletIsConnected && directWalletAddress?.toLowerCase() === directWalletProfile?.externalId?.toLowerCase();
19289
19292
  if (isConnectedToRightWallet) {
19290
- directWalletFlow(walletProfile);
19293
+ loginDirectWallet(directWalletProfile);
19291
19294
  } else {
19292
19295
  useLayoutDataStore.getState().setPage(null);
19293
- pendingWalletRef.current = walletProfile;
19296
+ pendingWalletRef.current = directWalletProfile;
19294
19297
  openConnectModal?.();
19295
19298
  }
19296
19299
  },
@@ -19304,7 +19307,6 @@ var init_SenderSelector = __esm({
19304
19307
  "src/internal/components/SendMenu/hyperbridge/components/SenderSelector.tsx"() {
19305
19308
  init_ProviderContext();
19306
19309
  init_i18n();
19307
- init_linkedProfiles();
19308
19310
  init_wallet();
19309
19311
  init_useLayoutDataStore();
19310
19312
  init_useExternalWalletStore();
@@ -19316,6 +19318,149 @@ var init_SenderSelector = __esm({
19316
19318
  }
19317
19319
  });
19318
19320
 
19321
+ // src/internal/assets/wallets/MetaMaskIcon.tsx
19322
+ import { jsx as jsx90, jsxs as jsxs84 } from "react/jsx-runtime";
19323
+ function MetaMaskIcon(props) {
19324
+ const { width = "24", height = "24", ...svgProps } = props;
19325
+ return /* @__PURE__ */ jsxs84(
19326
+ "svg",
19327
+ {
19328
+ ...svgProps,
19329
+ width,
19330
+ height,
19331
+ version: "1.1",
19332
+ id: "Layer_1",
19333
+ xmlns: "http://www.w3.org/2000/svg",
19334
+ x: "0px",
19335
+ y: "0px",
19336
+ viewBox: "0 0 142 136.878",
19337
+ style: {
19338
+ // enableBackground: 'new 0 0 142 136.878',
19339
+ flexShrink: 0
19340
+ },
19341
+ xmlSpace: "preserve",
19342
+ children: [
19343
+ /* @__PURE__ */ jsx90(
19344
+ "path",
19345
+ {
19346
+ fill: "#FF5C16",
19347
+ d: "M132.682,132.192l-30.583-9.106l-23.063,13.787l-16.092-0.007l-23.077-13.78l-30.569,9.106L0,100.801\n l9.299-34.839L0,36.507L9.299,0l47.766,28.538h27.85L132.682,0l9.299,36.507l-9.299,29.455l9.299,34.839L132.682,132.192\n L132.682,132.192z"
19348
+ }
19349
+ ),
19350
+ /* @__PURE__ */ jsx90(
19351
+ "path",
19352
+ {
19353
+ fill: "#FF5C16",
19354
+ d: "M9.305,0l47.767,28.558l-1.899,19.599L9.305,0z M39.875,100.814l21.017,16.01l-21.017,6.261\n C39.875,123.085,39.875,100.814,39.875,100.814z M59.212,74.345l-4.039-26.174L29.317,65.97l-0.014-0.007v0.013l0.08,18.321\n l10.485-9.951L59.212,74.345L59.212,74.345z M132.682,0L84.915,28.558l1.893,19.599L132.682,0z M102.113,100.814l-21.018,16.01\n l21.018,6.261V100.814z M112.678,65.975h0.007H112.678v-0.013l-0.006,0.007L86.815,48.171l-4.039,26.174h19.336l10.492,9.95\n C112.604,84.295,112.678,65.975,112.678,65.975z"
19355
+ }
19356
+ ),
19357
+ /* @__PURE__ */ jsx90(
19358
+ "path",
19359
+ {
19360
+ fill: "#E34807",
19361
+ d: "M39.868,123.085l-30.569,9.106L0,100.814h39.868C39.868,100.814,39.868,123.085,39.868,123.085z\n M59.205,74.338l5.839,37.84l-8.093-21.04L29.37,84.295l10.491-9.956h19.344L59.205,74.338z M102.112,123.085l30.57,9.106\n l9.299-31.378h-39.869C102.112,100.814,102.112,123.085,102.112,123.085z M82.776,74.338l-5.839,37.84l8.092-21.04l27.583-6.843\n l-10.498-9.956H82.776V74.338z"
19362
+ }
19363
+ ),
19364
+ /* @__PURE__ */ jsx90(
19365
+ "path",
19366
+ {
19367
+ fill: "#FF8D5D",
19368
+ d: "M0,100.801l9.299-34.839h19.997l0.073,18.327l27.584,6.843l8.092,21.039l-4.16,4.633l-21.017-16.01H0\n V100.801z M141.981,100.801l-9.299-34.839h-19.998l-0.073,18.327l-27.582,6.843l-8.093,21.039l4.159,4.633l21.018-16.01h39.868\n V100.801z M84.915,28.538h-27.85l-1.891,19.599l9.872,64.013h11.891l9.878-64.013L84.915,28.538z"
19369
+ }
19370
+ ),
19371
+ /* @__PURE__ */ jsx90(
19372
+ "path",
19373
+ {
19374
+ fill: "#661800",
19375
+ d: "M9.299,0L0,36.507l9.299,29.455h19.997l25.87-17.804L9.299,0z M53.426,81.938h-9.059l-4.932,4.835\n l17.524,4.344l-3.533-9.186V81.938z M132.682,0l9.299,36.507l-9.299,29.455h-19.998L86.815,48.158L132.682,0z M88.568,81.938h9.072\n l4.932,4.841l-17.544,4.353l3.54-9.201V81.938z M79.029,124.385l2.067-7.567l-4.16-4.633h-11.9l-4.159,4.633l2.066,7.567"
19376
+ }
19377
+ ),
19378
+ /* @__PURE__ */ jsx90(
19379
+ "path",
19380
+ {
19381
+ fill: "#C0C4CD",
19382
+ d: "M79.029,124.384v12.495H62.945v-12.495L79.029,124.384L79.029,124.384z"
19383
+ }
19384
+ ),
19385
+ /* @__PURE__ */ jsx90(
19386
+ "path",
19387
+ {
19388
+ fill: "#E7EBF6",
19389
+ d: "M39.875,123.072l23.083,13.8v-12.495l-2.067-7.566C60.891,116.811,39.875,123.072,39.875,123.072z\n M102.113,123.072l-23.084,13.8v-12.495l2.067-7.566C81.096,116.811,102.113,123.072,102.113,123.072z"
19390
+ }
19391
+ )
19392
+ ]
19393
+ }
19394
+ );
19395
+ }
19396
+ var init_MetaMaskIcon = __esm({
19397
+ "src/internal/assets/wallets/MetaMaskIcon.tsx"() {
19398
+ }
19399
+ });
19400
+
19401
+ // src/internal/assets/wallets/index.tsx
19402
+ import { Wallet2Icon } from "lucide-react";
19403
+ import { jsx as jsx91 } from "react/jsx-runtime";
19404
+ var WALLET_ICONS;
19405
+ var init_wallets = __esm({
19406
+ "src/internal/assets/wallets/index.tsx"() {
19407
+ init_MetaMaskIcon();
19408
+ WALLET_ICONS = {
19409
+ metamask: MetaMaskIcon,
19410
+ default: (props) => /* @__PURE__ */ jsx91(Wallet2Icon, { ...props })
19411
+ };
19412
+ }
19413
+ });
19414
+
19415
+ // src/internal/components/SendMenu/hyperbridge/hooks/useAvailableSenders.ts
19416
+ import { useEffect as useEffect34, useRef as useRef18 } from "react";
19417
+ function useAvailableSenders() {
19418
+ const address = useSession((st) => st.address);
19419
+ const activeChainId = useSession((st) => st.activeChainId);
19420
+ const { profiles } = useLinkedProfiles();
19421
+ const lastCalcedSenders = useRef18([]);
19422
+ useEffect34(() => {
19423
+ const sendersAccumulator = [
19424
+ {
19425
+ type: "embarkai-wallet",
19426
+ name: "embarkAI",
19427
+ chainId: activeChainId,
19428
+ address,
19429
+ Icon: TOKENS_ICONS["EMBARKAI"]
19430
+ }
19431
+ ];
19432
+ const walletProfile = profiles.filter((p) => p.provider === "wallet")[0] || null;
19433
+ if (!!walletProfile) {
19434
+ sendersAccumulator.push({
19435
+ type: "direct-wallet",
19436
+ name: walletProfile?.meta?.walletName || "External wallet",
19437
+ chainId: null,
19438
+ address: walletProfile?.externalId,
19439
+ Icon: WALLET_ICONS[walletProfile?.meta?.walletName?.toLowerCase()] || WALLET_ICONS["default"]
19440
+ });
19441
+ }
19442
+ if (sendersAccumulator.map((s) => `${s.name}-${s.address}`).join(",") === lastCalcedSenders.current.join(",")) {
19443
+ return;
19444
+ }
19445
+ lastCalcedSenders.current = sendersAccumulator.map((s) => `${s.name}-${s.address}`);
19446
+ useBridgeStore.getState().setBridgeSenders(sendersAccumulator);
19447
+ useFlowSelectorStore.getState().setRenderKey(`sender-selected-${Date.now()}`);
19448
+ }, [address, profiles, activeChainId]);
19449
+ return {
19450
+ directWalletProfile: profiles.filter((p) => p.provider === "wallet")[0] || null
19451
+ };
19452
+ }
19453
+ var init_useAvailableSenders = __esm({
19454
+ "src/internal/components/SendMenu/hyperbridge/hooks/useAvailableSenders.ts"() {
19455
+ init_SessionContext();
19456
+ init_tokens();
19457
+ init_linkedProfiles();
19458
+ init_wallets();
19459
+ init_useFlowSelector();
19460
+ init_useBridgeStore();
19461
+ }
19462
+ });
19463
+
19319
19464
  // src/internal/components/SendMenu/hyperbridge/api.ts
19320
19465
  function iframe3() {
19321
19466
  const accessToken = jwtTokenManager2.getAccessToken();
@@ -19693,7 +19838,7 @@ var init_useBridge = __esm({
19693
19838
 
19694
19839
  // src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneRoutes.ts
19695
19840
  import { useQuery as useQuery19 } from "@tanstack/react-query";
19696
- import { useEffect as useEffect34 } from "react";
19841
+ import { useEffect as useEffect35 } from "react";
19697
19842
  function useHyperlaneRoutes() {
19698
19843
  const address = useSession((st) => st.address);
19699
19844
  const page = useLayoutDataStore((st) => st.page);
@@ -19709,7 +19854,7 @@ function useHyperlaneRoutes() {
19709
19854
  queryKey: [HYPERLANE_WARP_ROUTES_QUERY_KEY, address],
19710
19855
  queryFn: async () => getHyperlaneWarpRoutes()
19711
19856
  });
19712
- useEffect34(() => {
19857
+ useEffect35(() => {
19713
19858
  if (!errorWarpRoutes) return;
19714
19859
  useFlowSelectorStore.getState().setError(errorWarpRoutes.message);
19715
19860
  const { resetSelections, setRecipient, setOriginChain, setDestinationChain } = useBridgeStore.getState();
@@ -19718,7 +19863,7 @@ function useHyperlaneRoutes() {
19718
19863
  setOriginChain(null);
19719
19864
  setDestinationChain(null);
19720
19865
  }, [errorWarpRoutes]);
19721
- useEffect34(() => {
19866
+ useEffect35(() => {
19722
19867
  if (!!hyperRoute || !hyperlaneWarpRoutes.length) return;
19723
19868
  const warpRouteToAutoSelect = hyperlaneWarpRoutes.find((route) => route.routeId === hyperRoute);
19724
19869
  if (!warpRouteToAutoSelect) return;
@@ -19751,13 +19896,13 @@ var init_useHyperlaneRoutes = __esm({
19751
19896
  });
19752
19897
 
19753
19898
  // src/internal/components/SendMenu/hyperbridge/hooks/useMenuTitle.ts
19754
- import { useEffect as useEffect35 } from "react";
19899
+ import { useEffect as useEffect36 } from "react";
19755
19900
  function useMenuTitle(warpRoutes) {
19756
19901
  const { t } = useT();
19757
19902
  const bridgeStep = useBridgeStore((st) => st.bridgeStep);
19758
19903
  const hyperRoute = useBridgeStore((st) => st.hyperRoute);
19759
19904
  const hyperRouteMeta = warpRoutes?.length ? warpRoutes.find((route) => route.routeId === hyperRoute) : null;
19760
- useEffect35(() => {
19905
+ useEffect36(() => {
19761
19906
  const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
19762
19907
  switch (true) {
19763
19908
  case bridgeStep === "sender-selector":
@@ -19794,10 +19939,10 @@ var init_useMenuTitle = __esm({
19794
19939
  });
19795
19940
 
19796
19941
  // src/internal/components/SendMenu/hyperbridge/components/ResolveChainIcon.tsx
19797
- import { jsx as jsx90 } from "react/jsx-runtime";
19942
+ import { jsx as jsx92 } from "react/jsx-runtime";
19798
19943
  function ResolveChainIcon(props) {
19799
19944
  const Icon2 = CHAINS_UI_META[props.chainName]?.Icon || TOKENS_ICONS.EMBARKAI;
19800
- return /* @__PURE__ */ jsx90(Icon2, { className: props.className || "w-4 h-4" });
19945
+ return /* @__PURE__ */ jsx92(Icon2, { className: props.className || "w-4 h-4" });
19801
19946
  }
19802
19947
  var init_ResolveChainIcon = __esm({
19803
19948
  "src/internal/components/SendMenu/hyperbridge/components/ResolveChainIcon.tsx"() {
@@ -19806,148 +19951,6 @@ var init_ResolveChainIcon = __esm({
19806
19951
  }
19807
19952
  });
19808
19953
 
19809
- // src/internal/assets/wallets/MetaMaskIcon.tsx
19810
- import { jsx as jsx91, jsxs as jsxs84 } from "react/jsx-runtime";
19811
- function MetaMaskIcon(props) {
19812
- const { width = "24", height = "24", ...svgProps } = props;
19813
- return /* @__PURE__ */ jsxs84(
19814
- "svg",
19815
- {
19816
- ...svgProps,
19817
- width,
19818
- height,
19819
- version: "1.1",
19820
- id: "Layer_1",
19821
- xmlns: "http://www.w3.org/2000/svg",
19822
- x: "0px",
19823
- y: "0px",
19824
- viewBox: "0 0 142 136.878",
19825
- style: {
19826
- // enableBackground: 'new 0 0 142 136.878',
19827
- flexShrink: 0
19828
- },
19829
- xmlSpace: "preserve",
19830
- children: [
19831
- /* @__PURE__ */ jsx91(
19832
- "path",
19833
- {
19834
- fill: "#FF5C16",
19835
- d: "M132.682,132.192l-30.583-9.106l-23.063,13.787l-16.092-0.007l-23.077-13.78l-30.569,9.106L0,100.801\n l9.299-34.839L0,36.507L9.299,0l47.766,28.538h27.85L132.682,0l9.299,36.507l-9.299,29.455l9.299,34.839L132.682,132.192\n L132.682,132.192z"
19836
- }
19837
- ),
19838
- /* @__PURE__ */ jsx91(
19839
- "path",
19840
- {
19841
- fill: "#FF5C16",
19842
- d: "M9.305,0l47.767,28.558l-1.899,19.599L9.305,0z M39.875,100.814l21.017,16.01l-21.017,6.261\n C39.875,123.085,39.875,100.814,39.875,100.814z M59.212,74.345l-4.039-26.174L29.317,65.97l-0.014-0.007v0.013l0.08,18.321\n l10.485-9.951L59.212,74.345L59.212,74.345z M132.682,0L84.915,28.558l1.893,19.599L132.682,0z M102.113,100.814l-21.018,16.01\n l21.018,6.261V100.814z M112.678,65.975h0.007H112.678v-0.013l-0.006,0.007L86.815,48.171l-4.039,26.174h19.336l10.492,9.95\n C112.604,84.295,112.678,65.975,112.678,65.975z"
19843
- }
19844
- ),
19845
- /* @__PURE__ */ jsx91(
19846
- "path",
19847
- {
19848
- fill: "#E34807",
19849
- d: "M39.868,123.085l-30.569,9.106L0,100.814h39.868C39.868,100.814,39.868,123.085,39.868,123.085z\n M59.205,74.338l5.839,37.84l-8.093-21.04L29.37,84.295l10.491-9.956h19.344L59.205,74.338z M102.112,123.085l30.57,9.106\n l9.299-31.378h-39.869C102.112,100.814,102.112,123.085,102.112,123.085z M82.776,74.338l-5.839,37.84l8.092-21.04l27.583-6.843\n l-10.498-9.956H82.776V74.338z"
19850
- }
19851
- ),
19852
- /* @__PURE__ */ jsx91(
19853
- "path",
19854
- {
19855
- fill: "#FF8D5D",
19856
- d: "M0,100.801l9.299-34.839h19.997l0.073,18.327l27.584,6.843l8.092,21.039l-4.16,4.633l-21.017-16.01H0\n V100.801z M141.981,100.801l-9.299-34.839h-19.998l-0.073,18.327l-27.582,6.843l-8.093,21.039l4.159,4.633l21.018-16.01h39.868\n V100.801z M84.915,28.538h-27.85l-1.891,19.599l9.872,64.013h11.891l9.878-64.013L84.915,28.538z"
19857
- }
19858
- ),
19859
- /* @__PURE__ */ jsx91(
19860
- "path",
19861
- {
19862
- fill: "#661800",
19863
- d: "M9.299,0L0,36.507l9.299,29.455h19.997l25.87-17.804L9.299,0z M53.426,81.938h-9.059l-4.932,4.835\n l17.524,4.344l-3.533-9.186V81.938z M132.682,0l9.299,36.507l-9.299,29.455h-19.998L86.815,48.158L132.682,0z M88.568,81.938h9.072\n l4.932,4.841l-17.544,4.353l3.54-9.201V81.938z M79.029,124.385l2.067-7.567l-4.16-4.633h-11.9l-4.159,4.633l2.066,7.567"
19864
- }
19865
- ),
19866
- /* @__PURE__ */ jsx91(
19867
- "path",
19868
- {
19869
- fill: "#C0C4CD",
19870
- d: "M79.029,124.384v12.495H62.945v-12.495L79.029,124.384L79.029,124.384z"
19871
- }
19872
- ),
19873
- /* @__PURE__ */ jsx91(
19874
- "path",
19875
- {
19876
- fill: "#E7EBF6",
19877
- d: "M39.875,123.072l23.083,13.8v-12.495l-2.067-7.566C60.891,116.811,39.875,123.072,39.875,123.072z\n M102.113,123.072l-23.084,13.8v-12.495l2.067-7.566C81.096,116.811,102.113,123.072,102.113,123.072z"
19878
- }
19879
- )
19880
- ]
19881
- }
19882
- );
19883
- }
19884
- var init_MetaMaskIcon = __esm({
19885
- "src/internal/assets/wallets/MetaMaskIcon.tsx"() {
19886
- }
19887
- });
19888
-
19889
- // src/internal/assets/wallets/index.tsx
19890
- import { Wallet2Icon } from "lucide-react";
19891
- import { jsx as jsx92 } from "react/jsx-runtime";
19892
- var WALLET_ICONS;
19893
- var init_wallets = __esm({
19894
- "src/internal/assets/wallets/index.tsx"() {
19895
- init_MetaMaskIcon();
19896
- WALLET_ICONS = {
19897
- metamask: MetaMaskIcon,
19898
- default: (props) => /* @__PURE__ */ jsx92(Wallet2Icon, { ...props })
19899
- };
19900
- }
19901
- });
19902
-
19903
- // src/internal/components/SendMenu/hyperbridge/hooks/useAvailableSenders.ts
19904
- import { useEffect as useEffect36, useRef as useRef18 } from "react";
19905
- function useAvailableSenders() {
19906
- const address = useSession((st) => st.address);
19907
- const activeChainId = useSession((st) => st.activeChainId);
19908
- const { profiles } = useLinkedProfiles();
19909
- const walletProfiles = profiles.filter((p) => p.provider === "wallet");
19910
- const lastCalcedSenders = useRef18([]);
19911
- useEffect36(() => {
19912
- const sendersAccumulator = [
19913
- {
19914
- type: "embarkai-wallet",
19915
- name: "embarkAI",
19916
- chainId: activeChainId,
19917
- address,
19918
- Icon: TOKENS_ICONS["EMBARKAI"]
19919
- }
19920
- ];
19921
- if (!!walletProfiles.length) {
19922
- walletProfiles.forEach((wProfile) => {
19923
- sendersAccumulator.push({
19924
- type: "direct-wallet",
19925
- name: wProfile?.meta?.walletName || "External wallet",
19926
- chainId: null,
19927
- address: wProfile?.externalId,
19928
- Icon: WALLET_ICONS[wProfile?.meta?.walletName?.toLowerCase()] || WALLET_ICONS["default"]
19929
- });
19930
- });
19931
- }
19932
- if (sendersAccumulator.map((s) => `${s.name}-${s.address}`).join(",") === lastCalcedSenders.current.join(",")) {
19933
- return;
19934
- }
19935
- lastCalcedSenders.current = sendersAccumulator.map((s) => `${s.name}-${s.address}`);
19936
- useBridgeStore.getState().setBridgeSenders(sendersAccumulator);
19937
- useFlowSelectorStore.getState().setRenderKey(`sender-selected-${Date.now()}`);
19938
- }, [address, walletProfiles, activeChainId]);
19939
- }
19940
- var init_useAvailableSenders = __esm({
19941
- "src/internal/components/SendMenu/hyperbridge/hooks/useAvailableSenders.ts"() {
19942
- init_SessionContext();
19943
- init_tokens();
19944
- init_linkedProfiles();
19945
- init_wallets();
19946
- init_useFlowSelector();
19947
- init_useBridgeStore();
19948
- }
19949
- });
19950
-
19951
19954
  // src/internal/components/SendMenu/hyperbridge/hooks/useBridgeBalance.ts
19952
19955
  import { useQuery as useQuery20, useQueryClient as useQueryClient21 } from "@tanstack/react-query";
19953
19956
  import { useCallback as useCallback23, useEffect as useEffect37 } from "react";
@@ -20108,15 +20111,13 @@ function SelectStep(props) {
20108
20111
  destinationChain,
20109
20112
  hyperRoute,
20110
20113
  amount,
20111
- // bridgeSenders,
20112
20114
  isQuoteEstimating,
20113
20115
  recipient,
20114
20116
  setBridgeStep,
20115
20117
  setAmount,
20116
20118
  setRecipient
20117
20119
  } = useBridgeStore();
20118
- useAvailableSenders();
20119
- const selectedSender = useBridgeStore((st) => st.bridgeSenders.find((s) => s.type === st.bridgeSender));
20120
+ const selectedSender = useBridgeStore((st) => st.bridgeSenders?.find((s) => s.type === st.bridgeSender)) || null;
20120
20121
  const { routeTokenBalance, isRouteTokenBalanceLoading } = useBridgeBalance(hyperlaneWarpRoutes);
20121
20122
  const selectedWarpRoute = hyperlaneWarpRoutes.find((route) => {
20122
20123
  const { routeId, chainPair } = route;
@@ -20352,7 +20353,6 @@ var init_SelectStep = __esm({
20352
20353
  init_input();
20353
20354
  init_useFlowSelector();
20354
20355
  init_ResolveChainIcon();
20355
- init_useAvailableSenders();
20356
20356
  init_useBridgeBalance();
20357
20357
  init_chains();
20358
20358
  init_useBridgeStore();
@@ -20612,7 +20612,8 @@ var init_SuccessStep = __esm({
20612
20612
 
20613
20613
  // src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneHistory.ts
20614
20614
  import { useQuery as useQuery21 } from "@tanstack/react-query";
20615
- import { useEffect as useEffect38, useState as useState26 } from "react";
20615
+ import { debounce as debounce3 } from "lodash-es";
20616
+ import { useCallback as useCallback24, useEffect as useEffect38, useState as useState26 } from "react";
20616
20617
  function useHyperlaneHistory() {
20617
20618
  const address = useSession((st) => st.address);
20618
20619
  const page = useLayoutDataStore((st) => st.page);
@@ -20626,11 +20627,17 @@ function useHyperlaneHistory() {
20626
20627
  queryKey: [HYPERLANE_HISTORY_QUERY_KEY, address, currentPage],
20627
20628
  queryFn: async () => await getHyperlaneBridgeHistory({ page: currentPage, pageSize: TX_HISTORY_PAGE_SIZE })
20628
20629
  });
20630
+ const updateExpandable = useCallback24(
20631
+ debounce3(() => {
20632
+ useFlowSelectorStore.getState().setRenderKey(`hyperlane-history-loaded-${Date.now()}`);
20633
+ }, 500),
20634
+ []
20635
+ );
20629
20636
  useEffect38(() => {
20630
20637
  const { data, isLoading } = query;
20631
- if (isLoading || data.data.length === 0 || currentPage > 1) return;
20632
- useFlowSelectorStore.getState().setRenderKey(`hyperlane-history-loaded-${Date.now()}`);
20633
- }, [query, currentPage]);
20638
+ if (isLoading || data.data?.length === 0) return;
20639
+ updateExpandable();
20640
+ }, [query]);
20634
20641
  return {
20635
20642
  ...query,
20636
20643
  currentPage,
@@ -20646,7 +20653,7 @@ var init_useHyperlaneHistory = __esm({
20646
20653
  init_api3();
20647
20654
  init_useBridgeStore();
20648
20655
  HYPERLANE_HISTORY_QUERY_KEY = "hyperlane-tx-history-query-key";
20649
- TX_HISTORY_PAGE_SIZE = 3;
20656
+ TX_HISTORY_PAGE_SIZE = 6;
20650
20657
  TX_HISTORY_POLLING_INTERVAL = 1e3 * 45;
20651
20658
  }
20652
20659
  });
@@ -21037,6 +21044,7 @@ function HyperlaneBridge() {
21037
21044
  const bridgeStep = useBridgeStore((st) => st.bridgeStep);
21038
21045
  const { swapDirection, handleQuoteEstimation, bridgeAsset, isAssetBridging } = useBridge();
21039
21046
  const { hyperlaneWarpRoutes, isLoadingWarpRoutes } = useHyperlaneRoutes();
21047
+ const { directWalletProfile } = useAvailableSenders();
21040
21048
  useMenuTitle(hyperlaneWarpRoutes);
21041
21049
  useEffect39(
21042
21050
  () => () => {
@@ -21045,7 +21053,7 @@ function HyperlaneBridge() {
21045
21053
  []
21046
21054
  );
21047
21055
  return /* @__PURE__ */ jsxs90(Fragment38, { children: [
21048
- bridgeStep === "sender-selector" && /* @__PURE__ */ jsx99(SenderSelector, {}),
21056
+ bridgeStep === "sender-selector" && /* @__PURE__ */ jsx99(SenderSelector, { directWalletProfile }),
21049
21057
  bridgeStep === "select" && /* @__PURE__ */ jsx99(
21050
21058
  SelectStep,
21051
21059
  {
@@ -21075,6 +21083,7 @@ function HyperlaneBridge() {
21075
21083
  var init_HyperlaneBridge = __esm({
21076
21084
  "src/internal/components/SendMenu/hyperbridge/HyperlaneBridge.tsx"() {
21077
21085
  init_SenderSelector();
21086
+ init_useAvailableSenders();
21078
21087
  init_useBridge();
21079
21088
  init_useHyperlaneRoutes();
21080
21089
  init_useMenuTitle();
@@ -21266,7 +21275,7 @@ var init_useNicknameResolve = __esm({
21266
21275
  });
21267
21276
 
21268
21277
  // src/hooks/useSendTransaction.ts
21269
- import { useCallback as useCallback24, useState as useState29 } from "react";
21278
+ import { useCallback as useCallback25, useState as useState29 } from "react";
21270
21279
  import { encodeFunctionData as encodeFunctionData2, isAddress, parseEther as parseEther2, parseUnits } from "viem";
21271
21280
  function useSendTransaction() {
21272
21281
  const session = useSession((st) => st.session);
@@ -21274,7 +21283,7 @@ function useSendTransaction() {
21274
21283
  const [isLoading, setIsLoading] = useState29(false);
21275
21284
  const [error, setError] = useState29(null);
21276
21285
  const [userOpHash, setUserOpHash] = useState29(null);
21277
- const sendTransaction = useCallback24(
21286
+ const sendTransaction = useCallback25(
21278
21287
  async (params) => {
21279
21288
  if (!session || !address) {
21280
21289
  setError("No active session");
@@ -21371,7 +21380,7 @@ function useSendTransaction() {
21371
21380
  },
21372
21381
  [session, address]
21373
21382
  );
21374
- const reset = useCallback24(() => {
21383
+ const reset = useCallback25(() => {
21375
21384
  setError(null);
21376
21385
  setUserOpHash(null);
21377
21386
  setIsLoading(false);
@@ -23636,7 +23645,7 @@ var init_TransactionsGroup = __esm({
23636
23645
  // src/internal/components/TransactionsMenu/TransactionsMenu.tsx
23637
23646
  import { useQuery as useQuery24, useQueryClient as useQueryClient23 } from "@tanstack/react-query";
23638
23647
  import { ArrowLeft as ArrowLeft22, Loader as Loader33, RefreshCw as RefreshCw3, XCircle } from "lucide-react";
23639
- import { useCallback as useCallback25, useState as useState31 } from "react";
23648
+ import { useCallback as useCallback26, useState as useState31 } from "react";
23640
23649
  import { jsx as jsx114, jsxs as jsxs103 } from "react/jsx-runtime";
23641
23650
  function TransactionsMenu() {
23642
23651
  const qc = useQueryClient23();
@@ -23658,7 +23667,7 @@ function TransactionsMenu() {
23658
23667
  queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address],
23659
23668
  queryFn: () => getTransactionsListQuery({ address, chainConfig })
23660
23669
  });
23661
- const refreshTxHistory = useCallback25(
23670
+ const refreshTxHistory = useCallback26(
23662
23671
  () => qc.invalidateQueries({ queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address] }),
23663
23672
  [qc, chainConfig.id, address]
23664
23673
  );
@@ -23897,7 +23906,7 @@ var init_PageMap = __esm({
23897
23906
  });
23898
23907
 
23899
23908
  // src/internal/hooks/usePageMapper.tsx
23900
- import { useCallback as useCallback26, useEffect as useEffect44 } from "react";
23909
+ import { useCallback as useCallback27, useEffect as useEffect44 } from "react";
23901
23910
  import { jsx as jsx115 } from "react/jsx-runtime";
23902
23911
  function usePageMapper() {
23903
23912
  const page = useLayoutDataStore((st) => st.page);
@@ -23909,7 +23918,7 @@ function usePageMapper() {
23909
23918
  setIsDialogOpen,
23910
23919
  setIsDialogClosing
23911
23920
  } = useLayoutStore();
23912
- const closeDialog = useCallback26(() => {
23921
+ const closeDialog = useCallback27(() => {
23913
23922
  setIsDialogClosing(true);
23914
23923
  setTimeout(() => {
23915
23924
  setDialogContent(null);
@@ -23920,7 +23929,7 @@ function usePageMapper() {
23920
23929
  setIsDialogOpen(false);
23921
23930
  }, CLEAR_DIALOG_TIMEOUT);
23922
23931
  }, [setDialogContent, setDialogDescription, setDialogTitle, setIsDialogForced, setIsDialogOpen, setIsDialogClosing]);
23923
- const openDialog = useCallback26(
23932
+ const openDialog = useCallback27(
23924
23933
  (pageItem) => {
23925
23934
  const PageContentComponent = pageItem.component;
23926
23935
  setDialogTitle(pageItem.title);
@@ -24006,7 +24015,7 @@ var init_package = __esm({
24006
24015
  "package.json"() {
24007
24016
  package_default = {
24008
24017
  name: "@embarkai/ui-kit",
24009
- version: "0.4.35",
24018
+ version: "0.4.37",
24010
24019
  description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
24011
24020
  type: "module",
24012
24021
  main: "./dist/index.cjs",
@@ -24224,7 +24233,7 @@ var init_Footer2 = __esm({
24224
24233
  // src/internal/components/Header/Header.tsx
24225
24234
  import { useQuery as useQuery26 } from "@tanstack/react-query";
24226
24235
  import { Copy as Copy5, Loader as Loader35 } from "lucide-react";
24227
- import { useCallback as useCallback27, useRef as useRef20, useState as useState32 } from "react";
24236
+ import { useCallback as useCallback28, useRef as useRef20, useState as useState32 } from "react";
24228
24237
  import { Fragment as Fragment44, jsx as jsx117, jsxs as jsxs105 } from "react/jsx-runtime";
24229
24238
  function formatAddress2(addr) {
24230
24239
  if (!addr) return "";
@@ -24240,7 +24249,7 @@ function Header() {
24240
24249
  const [copied, setCopied] = useState32(false);
24241
24250
  const clickCountRef = useRef20(0);
24242
24251
  const clickTimerRef = useRef20(null);
24243
- const handleAvatarClick = useCallback27(() => {
24252
+ const handleAvatarClick = useCallback28(() => {
24244
24253
  clickCountRef.current += 1;
24245
24254
  if (clickTimerRef.current) {
24246
24255
  clearTimeout(clickTimerRef.current);
@@ -24620,7 +24629,7 @@ var init_Dialog2 = __esm({
24620
24629
  });
24621
24630
 
24622
24631
  // src/internal/components/TssManager.tsx
24623
- import React8, { useCallback as useCallback28 } from "react";
24632
+ import React8, { useCallback as useCallback29 } from "react";
24624
24633
  var TssManagerWithRef;
24625
24634
  var init_TssManager = __esm({
24626
24635
  "src/internal/components/TssManager.tsx"() {
@@ -24635,7 +24644,7 @@ var init_TssManager = __esm({
24635
24644
  const setStatus = useSession((st) => st.setStatus);
24636
24645
  const setSession = useSession((st) => st.setSession);
24637
24646
  const setAddress = useSession((st) => st.setAddress);
24638
- const onSessionCreated = useCallback28(
24647
+ const onSessionCreated = useCallback29(
24639
24648
  (session, address) => {
24640
24649
  setSession(session);
24641
24650
  setAddress(address);
@@ -24676,15 +24685,15 @@ var init_TssManager = __esm({
24676
24685
  // src/internal/components/WalletConnectHandler.tsx
24677
24686
  import { useConnectModal as useConnectModal2 } from "@rainbow-me/rainbowkit";
24678
24687
  import { useMutation as useMutation21, useQueryClient as useQueryClient25 } from "@tanstack/react-query";
24679
- import React9, { useCallback as useCallback29, useEffect as useEffect47 } from "react";
24680
- import { useAccount, useDisconnect, useSignMessage as useSignMessage2 } from "wagmi";
24688
+ import React9, { useCallback as useCallback30, useEffect as useEffect47 } from "react";
24689
+ import { useAccount, useDisconnect as useDisconnect2, useSignMessage as useSignMessage2 } from "wagmi";
24681
24690
  function WalletConnectHandler() {
24682
24691
  const qc = useQueryClient25();
24683
24692
  const { callbacksRef } = useProviderConfig();
24684
24693
  const passportWalletAddress = useSession((st) => st.address);
24685
24694
  const { address: walletAddress, isConnected, chain, connector } = useAccount();
24686
24695
  const { openConnectModal, connectModalOpen } = useConnectModal2();
24687
- const { disconnect } = useDisconnect();
24696
+ const { disconnect } = useDisconnect2();
24688
24697
  const { signMessageAsync } = useSignMessage2();
24689
24698
  const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
24690
24699
  const setPage = useLayoutDataStore((st) => st.setPage);
@@ -24699,7 +24708,7 @@ function WalletConnectHandler() {
24699
24708
  const projectId = providerConfig?.projectId;
24700
24709
  const setExternalWallet = useExternalWalletStore((st) => st.setExternalWallet);
24701
24710
  const setPendingWalletLogin = useLayoutDataStore((st) => st.setPendingWalletLogin);
24702
- const onLinkingComplete = useCallback29(
24711
+ const onLinkingComplete = useCallback30(
24703
24712
  async (success) => {
24704
24713
  setIsWalletLinking(false);
24705
24714
  if (!success && !passportWalletAddress) {
@@ -27849,7 +27858,7 @@ import { initSdkErrorTracking } from "@embarkai/core/internal/error-tracking";
27849
27858
  import { merge as merge3 } from "lodash-es";
27850
27859
  import {
27851
27860
  createContext,
27852
- useCallback as useCallback30,
27861
+ useCallback as useCallback31,
27853
27862
  useContext,
27854
27863
  useEffect as useEffect49,
27855
27864
  useMemo as useMemo12,
@@ -27876,7 +27885,7 @@ function Provider(props) {
27876
27885
  const callbacksRef = useRef21(callbacks);
27877
27886
  useEffect49(() => notifyNoProjetctId(projectId), [projectId]);
27878
27887
  const config = useRef21(merge3({}, DEFAULT_PROVIDER_CONFIG, { projectId }, initialConfig));
27879
- const updateConfig = useCallback30((updates) => {
27888
+ const updateConfig = useCallback31((updates) => {
27880
27889
  const prev = config.current;
27881
27890
  const next = { ...prev };
27882
27891
  if (updates.projectId !== void 0) next.projectId = updates.projectId;
@@ -27910,7 +27919,7 @@ function Provider(props) {
27910
27919
  if (updates.translations) next.translations = { ...next.translations, ...updates.translations };
27911
27920
  config.current = next;
27912
27921
  }, []);
27913
- const updateCallbacks = useCallback30((updates) => {
27922
+ const updateCallbacks = useCallback31((updates) => {
27914
27923
  const prev = callbacksRef.current;
27915
27924
  const next = updates ? { ...prev, ...updates } : void 0;
27916
27925
  callbacksRef.current = next;
@@ -28325,13 +28334,13 @@ var useHydrated = () => useSession((st) => st.hasHydrated);
28325
28334
  // src/hooks/useOpenPage.ts
28326
28335
  init_SessionContext();
28327
28336
  init_useLayoutDataStore();
28328
- import { useCallback as useCallback31 } from "react";
28337
+ import { useCallback as useCallback32 } from "react";
28329
28338
  function useOpenPage() {
28330
28339
  const page = useLayoutDataStore((st) => st.page);
28331
28340
  const setPage = useLayoutDataStore((st) => st.setPage);
28332
28341
  const setPageParams = useLayoutDataStore((st) => st.setPageParams);
28333
28342
  const address = useSession((st) => st.address);
28334
- const open = useCallback31(
28343
+ const open = useCallback32(
28335
28344
  (passportPage, params) => {
28336
28345
  if (!address) return setPage("auth" /* AUTH */);
28337
28346
  if (!!address && passportPage === "auth" /* AUTH */) return setPage("manage-wallet" /* MANAGE_WALLET */);
@@ -28340,7 +28349,7 @@ function useOpenPage() {
28340
28349
  },
28341
28350
  [setPage, setPageParams, address]
28342
28351
  );
28343
- const close = useCallback31(() => setPage(null), [setPage]);
28352
+ const close = useCallback32(() => setPage(null), [setPage]);
28344
28353
  return { open, close, isOpen: page !== null };
28345
28354
  }
28346
28355
 
@@ -29206,12 +29215,12 @@ init_useErc3643Compliance();
29206
29215
 
29207
29216
  // src/hooks/useWalletMode.ts
29208
29217
  init_useExternalWalletStore();
29209
- import { useCallback as useCallback34 } from "react";
29218
+ import { useCallback as useCallback35 } from "react";
29210
29219
  function useWalletMode() {
29211
29220
  const configMode = useExternalWalletStore((st) => st.configMode);
29212
29221
  const activeMode = useExternalWalletStore((st) => st.activeMode);
29213
29222
  const setActiveMode = useExternalWalletStore((st) => st.setActiveMode);
29214
- const switchMode = useCallback34(
29223
+ const switchMode = useCallback35(
29215
29224
  (mode) => {
29216
29225
  if (configMode !== "both") return;
29217
29226
  setActiveMode(mode);
@@ -29229,25 +29238,25 @@ function useWalletMode() {
29229
29238
  // src/hooks/useDirectWallet.ts
29230
29239
  init_useExternalWalletStore();
29231
29240
  init_useLayoutDataStore();
29232
- import { useCallback as useCallback35 } from "react";
29241
+ import { useCallback as useCallback36 } from "react";
29233
29242
  import { useConnectModal as useConnectModal3 } from "@rainbow-me/rainbowkit";
29234
- import { useDisconnect as useDisconnect2 } from "wagmi";
29243
+ import { useDisconnect as useDisconnect3 } from "wagmi";
29235
29244
  function useDirectWallet() {
29236
29245
  const address = useExternalWalletStore((st) => st.externalAddress);
29237
29246
  const chainId = useExternalWalletStore((st) => st.externalChainId);
29238
29247
  const isConnected = useExternalWalletStore((st) => st.isExternalConnected);
29239
29248
  const connectorName = useExternalWalletStore((st) => st.connectorName);
29240
29249
  const clearExternalWallet = useExternalWalletStore((st) => st.clearExternalWallet);
29241
- const { disconnect: wagmiDisconnect } = useDisconnect2();
29250
+ const { disconnect: wagmiDisconnect } = useDisconnect3();
29242
29251
  const { openConnectModal } = useConnectModal3();
29243
29252
  const setIsWalletLinking = useLayoutDataStore((st) => st.setIsWalletLinking);
29244
- const connect = useCallback35(() => {
29253
+ const connect = useCallback36(() => {
29245
29254
  setIsWalletLinking(true);
29246
29255
  }, [setIsWalletLinking]);
29247
- const reconnect = useCallback35(() => {
29256
+ const reconnect = useCallback36(() => {
29248
29257
  if (openConnectModal) openConnectModal();
29249
29258
  }, [openConnectModal]);
29250
- const disconnect = useCallback35(() => {
29259
+ const disconnect = useCallback36(() => {
29251
29260
  wagmiDisconnect();
29252
29261
  clearExternalWallet();
29253
29262
  }, [wagmiDisconnect, clearExternalWallet]);
@@ -29264,7 +29273,7 @@ function useDirectWallet() {
29264
29273
 
29265
29274
  // src/hooks/useSendDirectTransaction.ts
29266
29275
  init_useExternalWalletStore();
29267
- import { useCallback as useCallback36, useState as useState38 } from "react";
29276
+ import { useCallback as useCallback37, useState as useState38 } from "react";
29268
29277
  import { isAddress as isAddress3, parseEther as parseEther3 } from "viem";
29269
29278
  import { useSendTransaction as useWagmiSendTransaction, useSwitchChain as useSwitchChain3 } from "wagmi";
29270
29279
  function useSendDirectTransaction() {
@@ -29275,7 +29284,7 @@ function useSendDirectTransaction() {
29275
29284
  const [isPending, setIsPending] = useState38(false);
29276
29285
  const [error, setError] = useState38(null);
29277
29286
  const [txHash, setTxHash] = useState38(null);
29278
- const sendTransaction = useCallback36(
29287
+ const sendTransaction = useCallback37(
29279
29288
  async (params) => {
29280
29289
  if (!isConnected) {
29281
29290
  setError("No external wallet connected");
@@ -29309,7 +29318,7 @@ function useSendDirectTransaction() {
29309
29318
  },
29310
29319
  [isConnected, externalChainId, sendTransactionAsync, switchChainAsync]
29311
29320
  );
29312
- const reset = useCallback36(() => {
29321
+ const reset = useCallback37(() => {
29313
29322
  setError(null);
29314
29323
  setTxHash(null);
29315
29324
  setIsPending(false);
@@ -29321,7 +29330,7 @@ function useSendDirectTransaction() {
29321
29330
  init_SessionContext();
29322
29331
  init_account2();
29323
29332
  init_linkedProfiles();
29324
- import { useCallback as useCallback37, useMemo as useMemo14, useState as useState39 } from "react";
29333
+ import { useCallback as useCallback38, useMemo as useMemo14, useState as useState39 } from "react";
29325
29334
  import { encodeFunctionData as encodeFunctionData3, isAddress as isAddress4, parseEther as parseEther4, parseUnits as parseUnits3 } from "viem";
29326
29335
  var ERC20_TRANSFER_ABI2 = [
29327
29336
  {
@@ -29344,7 +29353,7 @@ function useTransferToLinkedWallet() {
29344
29353
  () => (profiles || []).filter((p) => p.provider === "wallet" && p.externalId).map((p) => p.externalId),
29345
29354
  [profiles]
29346
29355
  );
29347
- const transfer = useCallback37(
29356
+ const transfer = useCallback38(
29348
29357
  async (params) => {
29349
29358
  if (!session) {
29350
29359
  setError("No active session");
@@ -29395,7 +29404,7 @@ function useTransferToLinkedWallet() {
29395
29404
  },
29396
29405
  [session, linkedWallets]
29397
29406
  );
29398
- const reset = useCallback37(() => {
29407
+ const reset = useCallback38(() => {
29399
29408
  setError(null);
29400
29409
  setUserOpHash(null);
29401
29410
  setIsPending(false);
@@ -29421,11 +29430,11 @@ function useNativeWalletSignature() {
29421
29430
  init_ProviderContext();
29422
29431
  init_SessionContext();
29423
29432
  import { logout as coreLogout, jwtTokenManager as jwtTokenManager3 } from "@embarkai/core/auth";
29424
- import { useCallback as useCallback38 } from "react";
29433
+ import { useCallback as useCallback39 } from "react";
29425
29434
  function useLogout() {
29426
29435
  const { setSession, setIsLoading, setAddress, setStatus, setError, address } = useSession();
29427
29436
  const { callbacksRef } = useProviderConfig();
29428
- const logout2 = useCallback38(async () => {
29437
+ const logout2 = useCallback39(async () => {
29429
29438
  const prevAddress = address;
29430
29439
  let userId = null;
29431
29440
  setIsLoading(true);