@embarkai/ui-kit 0.4.104 → 0.4.106

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.cjs CHANGED
@@ -7575,6 +7575,7 @@ var init_en = __esm({
7575
7575
  connectMenu: {
7576
7576
  connectWallet: "Connect Wallet Profile",
7577
7577
  noWallets: "No wallets available to connect",
7578
+ requestPending: "{{wallet}} already has a pending request from this site. Open {{wallet}}, reject or close that request, then try again.",
7578
7579
  instructions: {
7579
7580
  follow: "Watch your connecting wallet app.\nYou will be asked to:\n {{steps}}",
7580
7581
  confirm: "- 1. Confirm your wallet connection into embarkAI",
@@ -8167,6 +8168,7 @@ var init_ru = __esm({
8167
8168
  connectMenu: {
8168
8169
  connectWallet: "\u041F\u043E\u0434\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u043F\u0440\u043E\u0444\u0438\u043B\u044C \u043A\u043E\u0448\u0435\u043B\u044C\u043A\u0430",
8169
8170
  noWallets: "\u041D\u0435\u0442 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u0445 \u043A\u043E\u0448\u0435\u043B\u044C\u043A\u043E\u0432 \u0434\u043B\u044F \u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u044F",
8171
+ requestPending: "\u0412 {{wallet}} \u0443\u0436\u0435 \u0432\u0438\u0441\u0438\u0442 \u0437\u0430\u043F\u0440\u043E\u0441 \u043E\u0442 \u044D\u0442\u043E\u0433\u043E \u0441\u0430\u0439\u0442\u0430. \u041E\u0442\u043A\u0440\u043E\u0439\u0442\u0435 {{wallet}}, \u043E\u0442\u043A\u043B\u043E\u043D\u0438\u0442\u0435 \u0438\u043B\u0438 \u0437\u0430\u043A\u0440\u043E\u0439\u0442\u0435 \u044D\u0442\u043E\u0442 \u0437\u0430\u043F\u0440\u043E\u0441 \u0438 \u043F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0441\u043D\u043E\u0432\u0430.",
8170
8172
  instructions: {
8171
8173
  follow: "\u0421\u043B\u0435\u0434\u0438\u0442\u0435 \u0437\u0430 \u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0430\u0435\u043C\u044B\u043C \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u0435\u043C \u043A\u043E\u0448\u0435\u043B\u044C\u043A\u0430.\n\u0412\u0430\u043C \u0431\u0443\u0434\u0435\u0442 \u043F\u0440\u0435\u0434\u043B\u043E\u0436\u0435\u043D\u043E:\n {{steps}}",
8172
8174
  confirm: "- 1. \u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C \u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u0435 \u043A\u043E\u0448\u0435\u043B\u044C\u043A\u0430 \u043A embarkAI",
@@ -8759,6 +8761,7 @@ var init_zh = __esm({
8759
8761
  connectMenu: {
8760
8762
  connectWallet: "\u8FDE\u63A5\u94B1\u5305\u914D\u7F6E\u6587\u4EF6",
8761
8763
  noWallets: "\u6CA1\u6709\u53EF\u8FDE\u63A5\u7684\u94B1\u5305",
8764
+ requestPending: "{{wallet}} \u4E2D\u5DF2\u6709\u6765\u81EA\u672C\u7F51\u7AD9\u7684\u5F85\u5904\u7406\u8BF7\u6C42\u3002\u8BF7\u6253\u5F00 {{wallet}}\uFF0C\u62D2\u7EDD\u6216\u5173\u95ED\u8BE5\u8BF7\u6C42\uFF0C\u7136\u540E\u91CD\u8BD5\u3002",
8762
8765
  instructions: {
8763
8766
  follow: "\u8BF7\u67E5\u770B\u60A8\u6B63\u5728\u8FDE\u63A5\u7684\u94B1\u5305\u5E94\u7528\u3002\n\u60A8\u5C06\u88AB\u8981\u6C42\uFF1A\n {{steps}}",
8764
8767
  confirm: "- 1. \u786E\u8BA4\u5C06\u60A8\u7684\u94B1\u5305\u8FDE\u63A5\u5230 embarkAI",
@@ -16806,7 +16809,7 @@ function getProviderCaption(provider) {
16806
16809
  function ProviderCard(props) {
16807
16810
  const { provider, meta, externalId, disabled } = props;
16808
16811
  const { t } = useT();
16809
- const externalWalletAddress = useExternalWalletStore((st) => st.externalAddress);
16812
+ const connections = (0, import_wagmi.useConnections)();
16810
16813
  const {
16811
16814
  mutate: connectExternalWallet,
16812
16815
  disconnect: disconnectExternalWallet,
@@ -16828,7 +16831,7 @@ function ProviderCard(props) {
16828
16831
  };
16829
16832
  const info = getProviderDisplayInfo(provider);
16830
16833
  const allowUnlink = canUnlink(props);
16831
- const isWalletProviderConnected = !!externalWalletAddress && provider === "wallet" && externalWalletAddress === externalId;
16834
+ const isWalletProviderConnected = provider === "wallet" && connections.some((c) => c.accounts.includes(externalId));
16832
16835
  const IconComponent = provider === "wallet" ? WALLET_ICONS[meta?.walletType || "default"] || WALLET_ICONS.default : info.icon;
16833
16836
  return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "w-full flex items-center justify-between gap-[var(--ui-kit-gap)]", children: [
16834
16837
  /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
@@ -16915,15 +16918,15 @@ function ProviderCard(props) {
16915
16918
  ] })
16916
16919
  ] });
16917
16920
  }
16918
- var import_lucide_react30, import_jsx_runtime71;
16921
+ var import_lucide_react30, import_wagmi, import_jsx_runtime71;
16919
16922
  var init_ProviderCard = __esm({
16920
16923
  "src/internal/components/ManageWalletMenu/ProviderCard.tsx"() {
16921
16924
  init_useLayoutDataStore();
16922
16925
  init_useT();
16923
16926
  init_wallets();
16924
16927
  import_lucide_react30 = require("lucide-react");
16928
+ import_wagmi = require("wagmi");
16925
16929
  init_types();
16926
- init_useExternalWalletStore();
16927
16930
  init_cn();
16928
16931
  init_ConnectExternalWalletMenu2();
16929
16932
  init_button();
@@ -17139,7 +17142,7 @@ function UnlinkProviderMenu() {
17139
17142
  const qc = (0, import_react_query24.useQueryClient)();
17140
17143
  const address = useSession((st) => st.address);
17141
17144
  const { callbacksRef } = useProviderConfig();
17142
- const { disconnect: disconnectExternalWallet } = (0, import_wagmi.useDisconnect)();
17145
+ const { disconnect: disconnectExternalWallet } = (0, import_wagmi2.useDisconnect)();
17143
17146
  const isExternalConnected = useExternalWalletStore((st) => st.isExternalConnected);
17144
17147
  const { t } = useT();
17145
17148
  const setPage = useLayoutDataStore((st) => st.setPage);
@@ -17226,7 +17229,7 @@ function UnlinkProviderMenu() {
17226
17229
  ] })
17227
17230
  ] });
17228
17231
  }
17229
- var import_react_query24, import_lucide_react32, import_react43, import_wagmi, import_jsx_runtime73;
17232
+ var import_react_query24, import_lucide_react32, import_react43, import_wagmi2, import_jsx_runtime73;
17230
17233
  var init_UnlinkProviderMenu = __esm({
17231
17234
  "src/internal/components/ManageWalletMenu/UnlinkProviderMenu.tsx"() {
17232
17235
  init_useLayoutDataStore();
@@ -17237,7 +17240,7 @@ var init_UnlinkProviderMenu = __esm({
17237
17240
  import_react_query24 = require("@tanstack/react-query");
17238
17241
  import_lucide_react32 = require("lucide-react");
17239
17242
  import_react43 = require("react");
17240
- import_wagmi = require("wagmi");
17243
+ import_wagmi2 = require("wagmi");
17241
17244
  init_auth();
17242
17245
  init_useExternalWalletStore();
17243
17246
  init_button();
@@ -17323,19 +17326,50 @@ function getConnectFlowType(params) {
17323
17326
  if (!isEmbarkAI) return "auth";
17324
17327
  return connectFlow;
17325
17328
  }
17329
+ function someInErrorChain(error, predicate) {
17330
+ let current = error;
17331
+ for (let depth = 0; current && depth < 10; depth++) {
17332
+ if (predicate(current)) return true;
17333
+ current = current.cause;
17334
+ }
17335
+ return false;
17336
+ }
17326
17337
  function ConnectExternalWalletMenu() {
17327
17338
  const { config, callbacksRef } = useProviderConfig();
17328
17339
  const allowedWallets = config.current?.wallet?.allowedWallets;
17329
17340
  const walletMode = config.current?.wallet?.mode || "both";
17330
17341
  const qc = (0, import_react_query25.useQueryClient)();
17331
17342
  const { t } = useT();
17332
- const { address: embarkAiAddress } = useSession();
17333
- const { open: openEmbarkAI, close: closeEmbarkAI } = useOpenPage();
17343
+ const embarkAiAddress = useSession((st) => st.address);
17344
+ const { close: closeEmbarkAI } = useOpenPage();
17334
17345
  const menuParams = useConnectExternalWalletMenuParams();
17335
- const connectors = (0, import_wagmi2.useConnectors)();
17346
+ const connectors = (0, import_wagmi3.useConnectors)();
17336
17347
  const hasInjectedWallet2 = useHasInjectedWallet();
17337
- const { mutate: disconnect } = (0, import_wagmi2.useDisconnect)();
17338
- const { mutateAsync: signMessageAsync } = (0, import_wagmi2.useSignMessage)();
17348
+ const wagmiConfig3 = (0, import_wagmi3.useConfig)();
17349
+ const connections = (0, import_wagmi3.useConnections)();
17350
+ const { mutate: disconnect, mutateAsync: disconnectAsync } = (0, import_wagmi3.useDisconnect)();
17351
+ const { mutateAsync: signMessageAsync } = (0, import_wagmi3.useSignMessage)();
17352
+ const { mutateAsync: switchChainAsync } = (0, import_wagmi3.useSwitchChain)();
17353
+ const { mutateAsync: switchConnectionAsync } = (0, import_wagmi3.useSwitchConnection)();
17354
+ const [isPreparingConnect, setIsPreparingConnect] = (0, import_react46.useState)(false);
17355
+ const signOnSupportedChain = async (params) => {
17356
+ const { connector, account, message } = params;
17357
+ const signOnce = async (viaFallback = false) => {
17358
+ let chainId = await connector.getChainId();
17359
+ if (viaFallback) {
17360
+ await switchChainAsync({ connector, chainId: SIGN_FALLBACK_CHAIN_ID });
17361
+ chainId = SIGN_FALLBACK_CHAIN_ID;
17362
+ }
17363
+ const signature = await signMessageAsync({ connector, account, message });
17364
+ return { chainId, signature };
17365
+ };
17366
+ try {
17367
+ return await signOnce(false);
17368
+ } catch (error) {
17369
+ if (!isUnsupportedChainError(error)) throw error;
17370
+ return await signOnce(true);
17371
+ }
17372
+ };
17339
17373
  const walletMenuOpenedFrom = useLayoutDataStore((st) => st.walletMenuOpenedFrom);
17340
17374
  const { data: providers = [] } = (0, import_react_query25.useQuery)({
17341
17375
  retry: false,
@@ -17355,7 +17389,24 @@ function ConnectExternalWalletMenu() {
17355
17389
  callbacksRef.current?.onAccountUpdate?.({ providers: providers2 });
17356
17390
  }
17357
17391
  });
17358
- const { mutateAsync: loginOrLinkOrConnectWallet, isPending: isLoginOrLinkOrConnectWallet } = (0, import_react_query25.useMutation)({
17392
+ const keepOrReleaseExternalWallet = (connector, address, chainId) => {
17393
+ if (walletMode === "direct" || walletMode === "both") {
17394
+ useExternalWalletStore.getState().setExternalWallet({
17395
+ address,
17396
+ chainId,
17397
+ connectorName: connector.name || "Unknown Wallet"
17398
+ });
17399
+ } else {
17400
+ disconnect();
17401
+ const { externalAddress, clearExternalWallet } = useExternalWalletStore.getState();
17402
+ if (!!externalAddress) clearExternalWallet();
17403
+ }
17404
+ };
17405
+ const completeExternalConnect = (connector, address, chainId) => {
17406
+ useLayoutDataStore.getState().setPage(walletMenuOpenedFrom || "main-menu" /* MAIN_MENU */);
17407
+ keepOrReleaseExternalWallet(connector, address, chainId);
17408
+ };
17409
+ const { mutateAsync: loginOrLinkWallet, isPending: isLoginOrLinkWallet } = (0, import_react_query25.useMutation)({
17359
17410
  mutationFn: async (payload) => {
17360
17411
  const { walletData, connectFlowType } = payload;
17361
17412
  switch (connectFlowType) {
@@ -17367,16 +17418,12 @@ function ConnectExternalWalletMenu() {
17367
17418
  const skipLinkWalletProfile = providers.findIndex((p) => p.externalId === walletData.address) !== -1;
17368
17419
  if (skipLinkWalletProfile)
17369
17420
  return { linked: false, message: `Address ${walletData.address} already linked` };
17370
- return await linkWallet(walletData).then(async () => await onLinkingComplete(true)).catch((err) => {
17371
- throw err;
17372
- });
17373
- // Connect external wallet flow, only if embarkAI is connected
17374
- case "connect":
17375
- return null;
17421
+ await linkWallet(walletData);
17422
+ await onLinkingComplete(true);
17423
+ return { linked: true, message: `Address ${walletData.address} linked` };
17376
17424
  }
17377
17425
  },
17378
17426
  onSuccess: async (response, { walletData, connector, connectFlowType }) => {
17379
- let shouldKeepConnected = walletMode === "direct" || walletMode === "both";
17380
17427
  switch (connectFlowType) {
17381
17428
  case "auth":
17382
17429
  useLayoutDataStore.getState().setPendingWalletLogin(response);
@@ -17386,23 +17433,11 @@ function ConnectExternalWalletMenu() {
17386
17433
  const { linked, message } = response || {};
17387
17434
  if (!linked && message.includes("already linked")) {
17388
17435
  console.warn("[LINK STATUS] already linked", response);
17389
- useManageWalletStore.getState().setProviderType(null);
17390
- useLayoutDataStore.getState().setPage(walletMenuOpenedFrom || "manage-wallet" /* MANAGE_WALLET */);
17436
+ await onLinkingComplete(false);
17391
17437
  }
17392
17438
  break;
17393
- case "connect":
17394
- useLayoutDataStore.getState().setPage(walletMenuOpenedFrom || "main-menu" /* MAIN_MENU */);
17395
- break;
17396
- }
17397
- if (shouldKeepConnected && walletData.chainId && connector) {
17398
- useExternalWalletStore.getState().setExternalWallet({
17399
- address: walletData.address,
17400
- chainId: walletData.chainId,
17401
- connectorName: connector.name || "Unknown Wallet"
17402
- });
17403
- } else {
17404
- disconnect();
17405
17439
  }
17440
+ keepOrReleaseExternalWallet(connector, walletData.address, walletData.chainId);
17406
17441
  useLayoutStore.getState().setIsDialogForced(false);
17407
17442
  },
17408
17443
  onError: async (err, { walletData, connectFlowType }) => {
@@ -17417,9 +17452,6 @@ function ConnectExternalWalletMenu() {
17417
17452
  useManageWalletStore.getState().setAlert({ title: "Error", message: errorMsg });
17418
17453
  await onLinkingComplete(false);
17419
17454
  break;
17420
- case "connect":
17421
- openEmbarkAI(walletMenuOpenedFrom || "main-menu" /* MAIN_MENU */);
17422
- break;
17423
17455
  }
17424
17456
  }
17425
17457
  });
@@ -17427,77 +17459,77 @@ function ConnectExternalWalletMenu() {
17427
17459
  mutateAsync: connect,
17428
17460
  isPending: isConnectingExternalWallet,
17429
17461
  variables: pendingConnectVariables
17430
- } = (0, import_wagmi2.useConnect)({
17462
+ } = (0, import_wagmi3.useConnect)({
17431
17463
  mutation: {
17432
- onSuccess: async (connectionData, { connector }) => {
17433
- const { chainId, accounts } = connectionData;
17434
- const projectId = config.current?.projectId;
17435
- const projectName = projectId ? await fetchProjectName(projectId) : "EmbarkAI";
17464
+ onSuccess: async ({ chainId, accounts }, variables) => {
17465
+ const connector = variables.connector;
17436
17466
  const signingWalletAddress = accounts[0];
17437
17467
  const connectFlowType = getConnectFlowType({
17438
17468
  isEmbarkAI: !!embarkAiAddress,
17439
17469
  connectFlow: menuParams.current?.connectFlowType || "auth"
17440
17470
  });
17441
- let message;
17442
- let signature;
17443
- switch (connectFlowType) {
17444
- case "auth":
17445
- message = createLoginMessage(signingWalletAddress, projectName);
17446
- signature = await signMessageAsync({ message, account: signingWalletAddress });
17447
- break;
17448
- case "link":
17449
- message = createSignatureMessage(signingWalletAddress, projectName);
17450
- signature = await signMessageAsync({ message, account: signingWalletAddress });
17451
- break;
17452
- case "connect":
17453
- message = "UNUSED_MESSAGE";
17454
- signature = "0xUNUSED_SIGNATURE";
17455
- break;
17456
- }
17457
- if (!message || !signature) {
17458
- throw new Error("Failed to get sign message & signature");
17471
+ if (connectFlowType === "connect") {
17472
+ completeExternalConnect(connector, signingWalletAddress, chainId);
17473
+ useLayoutStore.getState().setIsDialogForced(false);
17474
+ return;
17459
17475
  }
17460
- await loginOrLinkOrConnectWallet({
17476
+ const projectId = config.current?.projectId;
17477
+ const projectName = projectId ? await fetchProjectName(projectId) : "EmbarkAI";
17478
+ const createMessage = connectFlowType === "auth" ? createLoginMessage : createSignatureMessage;
17479
+ const message = createMessage(signingWalletAddress, projectName);
17480
+ const { signature, chainId: signedChainId } = await signOnSupportedChain({
17481
+ connector,
17482
+ account: signingWalletAddress,
17483
+ message
17484
+ });
17485
+ await loginOrLinkWallet({
17461
17486
  connector,
17462
17487
  connectFlowType,
17463
17488
  walletData: {
17464
- chainId,
17489
+ chainId: signedChainId,
17465
17490
  address: signingWalletAddress,
17466
17491
  signature,
17467
17492
  message,
17468
- walletName: connector?.name || "Unknown Wallet",
17469
- // @ts-expect-error id exists
17470
- walletType: connector?.id || "unknown"
17493
+ walletName: connector.name || "Unknown Wallet",
17494
+ walletType: connector.id || "unknown"
17471
17495
  }
17472
17496
  });
17473
17497
  },
17474
- onError: (error, { connector }) => {
17475
- const connectFlowType = getConnectFlowType({
17476
- isEmbarkAI: !!embarkAiAddress,
17477
- connectFlow: menuParams.current?.connectFlowType || "auth"
17478
- });
17479
- const setPage = useLayoutDataStore.getState().setPage;
17480
- setTimeout(() => {
17481
- switch (connectFlowType) {
17482
- case "auth":
17483
- setConnectError(error?.message || "Failed to connect wallet");
17484
- break;
17485
- case "link":
17486
- setPage("manage-wallet" /* MANAGE_WALLET */);
17487
- useManageWalletStore.getState().setAlert({
17488
- title: `Failed to connect: ${connector.name}`,
17489
- message: error?.message || "Failed to connect wallet before linking"
17490
- });
17491
- break;
17492
- case "connect":
17493
- setConnectError(error?.message || "Failed to connect wallet");
17494
- break;
17495
- }
17496
- useLayoutStore.getState().setIsDialogForced(false);
17497
- }, 100);
17498
- }
17498
+ onError: (error, { connector }) => reportConnectError(error, connector)
17499
17499
  }
17500
17500
  });
17501
+ function reportConnectError(error, connector) {
17502
+ const connectFlowType = getConnectFlowType({
17503
+ isEmbarkAI: !!embarkAiAddress,
17504
+ connectFlow: menuParams.current?.connectFlowType || "auth"
17505
+ });
17506
+ const isRequestPending = isRequestPendingError(error);
17507
+ if (!isRequestPending && connectFlowType !== "connect" && wagmiConfig3.state.connections.has(connector.uid)) {
17508
+ disconnect({ connector });
17509
+ }
17510
+ const errorMessage = isRequestPending ? (
17511
+ // @ts-expect-error i18n typing
17512
+ t("passport:connectMenu.requestPending", { wallet: connector.name })
17513
+ ) : error?.message;
17514
+ setTimeout(() => {
17515
+ switch (connectFlowType) {
17516
+ case "auth":
17517
+ setConnectError(errorMessage || "Failed to connect wallet");
17518
+ break;
17519
+ case "link":
17520
+ useLayoutDataStore.getState().setPage("manage-wallet" /* MANAGE_WALLET */);
17521
+ useManageWalletStore.getState().setAlert({
17522
+ title: `Failed to connect: ${connector.name}`,
17523
+ message: errorMessage || "Failed to connect wallet before linking"
17524
+ });
17525
+ break;
17526
+ case "connect":
17527
+ setConnectError(errorMessage || "Failed to connect wallet");
17528
+ break;
17529
+ }
17530
+ useLayoutStore.getState().setIsDialogForced(false);
17531
+ }, 100);
17532
+ }
17501
17533
  const visibleConnectors = (0, import_react46.useMemo)(() => {
17502
17534
  const seen = /* @__PURE__ */ new Set();
17503
17535
  const unique = connectors.filter((connector) => {
@@ -17537,7 +17569,7 @@ function ConnectExternalWalletMenu() {
17537
17569
  variant: "ghost",
17538
17570
  size: "icon",
17539
17571
  title: t("passport:common.back"),
17540
- disabled: isConnectingExternalWallet || isLoginOrLinkOrConnectWallet,
17572
+ disabled: isConnectingExternalWallet || isLoginOrLinkWallet,
17541
17573
  onClick: () => useLayoutDataStore.getState().setPage(walletMenuOpenedFrom ?? "main-menu" /* MAIN_MENU */),
17542
17574
  children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_lucide_react33.ArrowLeft, { className: "h-4 w-4" })
17543
17575
  }
@@ -17554,14 +17586,32 @@ function ConnectExternalWalletMenu() {
17554
17586
  variant: "secondary",
17555
17587
  size: "large",
17556
17588
  className: "w-full justify-center",
17557
- disabled: isConnectingExternalWallet,
17589
+ disabled: isConnectingExternalWallet || isPreparingConnect || isLoginOrLinkWallet,
17558
17590
  onClick: async () => {
17559
17591
  if (connectError) setConnectError(null);
17592
+ const connectFlowType = getConnectFlowType({
17593
+ isEmbarkAI: !!embarkAiAddress,
17594
+ connectFlow: menuParams.current?.connectFlowType || "auth"
17595
+ });
17596
+ setIsPreparingConnect(true);
17560
17597
  try {
17561
- disconnect();
17562
- } catch {
17598
+ const existingConnection = connections.find((c) => c.connector.uid === connector.uid);
17599
+ if (connectFlowType === "connect" && existingConnection?.accounts[0]) {
17600
+ await switchConnectionAsync({ connector });
17601
+ completeExternalConnect(connector, existingConnection.accounts[0], existingConnection.chainId);
17602
+ useLayoutStore.getState().setIsDialogForced(false);
17603
+ return;
17604
+ }
17605
+ const connectionsToDrop = connections.filter((c) => c.connector.uid === connector.uid);
17606
+ for (const { connector: connectedConnector } of connectionsToDrop) {
17607
+ await disconnectAsync({ connector: connectedConnector });
17608
+ }
17609
+ } catch (error) {
17610
+ reportConnectError(error, connector);
17611
+ return;
17612
+ } finally {
17613
+ setIsPreparingConnect(false);
17563
17614
  }
17564
- await new Promise((resolve) => setTimeout(resolve, 500));
17565
17615
  switch (true) {
17566
17616
  case (connector.id === "metaMaskSDK" && !hasInjectedWallet2):
17567
17617
  closeEmbarkAI();
@@ -17613,7 +17663,7 @@ function ConnectExternalWalletMenu() {
17613
17663
  ] })
17614
17664
  ] });
17615
17665
  }
17616
- var import_react_query25, import_lucide_react33, import_react46, import_wagmi2, import_jsx_runtime74;
17666
+ var import_react_query25, import_lucide_react33, import_react46, import_wagmi3, import_chains, import_jsx_runtime74, SIGN_FALLBACK_CHAIN_ID, REQUEST_PENDING_ERROR_CODE, isRequestPendingError, isUnsupportedChainError;
17617
17667
  var init_ConnectExternalWalletMenu = __esm({
17618
17668
  "src/internal/components/ConnectExternalWalletMenu/ConnectExternalWalletMenu.tsx"() {
17619
17669
  init_ProviderContext();
@@ -17625,7 +17675,8 @@ var init_ConnectExternalWalletMenu = __esm({
17625
17675
  import_react_query25 = require("@tanstack/react-query");
17626
17676
  import_lucide_react33 = require("lucide-react");
17627
17677
  import_react46 = require("react");
17628
- import_wagmi2 = require("wagmi");
17678
+ import_wagmi3 = require("wagmi");
17679
+ import_chains = require("wagmi/chains");
17629
17680
  init_common();
17630
17681
  init_wallet();
17631
17682
  init_useLayoutDataStore();
@@ -17638,6 +17689,10 @@ var init_ConnectExternalWalletMenu = __esm({
17638
17689
  init_useConnectExternalWalletMenuParams();
17639
17690
  init_useHasInjectedWallet();
17640
17691
  import_jsx_runtime74 = require("react/jsx-runtime");
17692
+ SIGN_FALLBACK_CHAIN_ID = import_chains.mainnet.id;
17693
+ REQUEST_PENDING_ERROR_CODE = -32002;
17694
+ isRequestPendingError = (error) => someInErrorChain(error, (e) => e.code === REQUEST_PENDING_ERROR_CODE);
17695
+ isUnsupportedChainError = (error) => someInErrorChain(error, (e) => typeof e.message === "string" && e.message.includes("supportedNetworks"));
17641
17696
  }
17642
17697
  });
17643
17698
 
@@ -17645,9 +17700,9 @@ var init_ConnectExternalWalletMenu = __esm({
17645
17700
  function useExternalWalletConnnect() {
17646
17701
  const { config } = useProviderConfig();
17647
17702
  const walletMode = config.current?.wallet?.mode;
17648
- const connectors = (0, import_wagmi3.useConnectors)();
17649
- const { mutate: disconnect } = (0, import_wagmi3.useDisconnect)();
17650
- const { mutate: connect, ...restUseConnect } = (0, import_wagmi3.useConnect)({
17703
+ const connectors = (0, import_wagmi4.useConnectors)();
17704
+ const { mutate: disconnect } = (0, import_wagmi4.useDisconnect)();
17705
+ const { mutate: connect, ...restUseConnect } = (0, import_wagmi4.useConnect)({
17651
17706
  mutation: {
17652
17707
  onSuccess: (connectionData, { connector }) => {
17653
17708
  const { chainId, accounts } = connectionData;
@@ -17695,12 +17750,12 @@ function useExternalWalletConnnect() {
17695
17750
  ...restUseConnect
17696
17751
  };
17697
17752
  }
17698
- var import_react47, import_wagmi3;
17753
+ var import_react47, import_wagmi4;
17699
17754
  var init_useExternalWalletConnect = __esm({
17700
17755
  "src/internal/components/ConnectExternalWalletMenu/useExternalWalletConnect.ts"() {
17701
17756
  init_ProviderContext();
17702
17757
  import_react47 = require("react");
17703
- import_wagmi3 = require("wagmi");
17758
+ import_wagmi4 = require("wagmi");
17704
17759
  init_useLayoutStore();
17705
17760
  init_useExternalWalletStore();
17706
17761
  }
@@ -20723,7 +20778,7 @@ var init_methods = __esm({
20723
20778
  });
20724
20779
 
20725
20780
  // src/internal/components/KeyshareRestoreMenu/KeyshareRestoreMenu.tsx
20726
- var import_react_query31, import_lucide_react46, import_react60, import_wagmi4, import_jsx_runtime87, RESTORE_COMPONENTS, KeyshareRestoreMenu;
20781
+ var import_react_query31, import_lucide_react46, import_react60, import_wagmi5, import_jsx_runtime87, RESTORE_COMPONENTS, KeyshareRestoreMenu;
20727
20782
  var init_KeyshareRestoreMenu = __esm({
20728
20783
  "src/internal/components/KeyshareRestoreMenu/KeyshareRestoreMenu.tsx"() {
20729
20784
  init_ProviderContext();
@@ -20732,7 +20787,7 @@ var init_KeyshareRestoreMenu = __esm({
20732
20787
  import_react_query31 = require("@tanstack/react-query");
20733
20788
  import_lucide_react46 = require("lucide-react");
20734
20789
  import_react60 = require("react");
20735
- import_wagmi4 = require("wagmi");
20790
+ import_wagmi5 = require("wagmi");
20736
20791
  init_useLayoutDataStore();
20737
20792
  init_useLayoutStore();
20738
20793
  init_useExternalWalletStore();
@@ -20774,7 +20829,7 @@ var init_KeyshareRestoreMenu = __esm({
20774
20829
  setIsDialogForced(false);
20775
20830
  };
20776
20831
  }, []);
20777
- const { mutate: wagmiDisconnect } = (0, import_wagmi4.useDisconnect)({
20832
+ const { mutate: wagmiDisconnect } = (0, import_wagmi5.useDisconnect)({
20778
20833
  mutation: {
20779
20834
  onSuccess: () => {
20780
20835
  useExternalWalletStore.getState().clearExternalWallet();
@@ -25080,12 +25135,12 @@ var init_api5 = __esm({
25080
25135
  });
25081
25136
 
25082
25137
  // src/internal/components/SendMenu/hyperbridge/lib/chains.ts
25083
- var import_read17, import_chains, CHAINS_UI_META;
25138
+ var import_read17, import_chains2, CHAINS_UI_META;
25084
25139
  var init_chains = __esm({
25085
25140
  "src/internal/components/SendMenu/hyperbridge/lib/chains.ts"() {
25086
25141
  init_networks2();
25087
25142
  import_read17 = require("@embarkai/core/read");
25088
- import_chains = require("wagmi/chains");
25143
+ import_chains2 = require("wagmi/chains");
25089
25144
  CHAINS_UI_META = {
25090
25145
  lumiaprism: {
25091
25146
  chainID: import_read17.lumiaMainnetChain.id,
@@ -25097,22 +25152,22 @@ var init_chains = __esm({
25097
25152
  chain: import_read17.lumiaMainnetChain
25098
25153
  },
25099
25154
  bsc: {
25100
- chainID: import_chains.bsc.id,
25101
- chainLabel: import_chains.bsc.name,
25155
+ chainID: import_chains2.bsc.id,
25156
+ chainLabel: import_chains2.bsc.name,
25102
25157
  chainName: "bsc",
25103
25158
  // exact hyperlane registry chain name
25104
- Icon: NETWORKS_ICONS[import_chains.bsc.id],
25105
- explorerUrl: import_chains.bsc.blockExplorers.default.url,
25106
- chain: import_chains.bsc
25159
+ Icon: NETWORKS_ICONS[import_chains2.bsc.id],
25160
+ explorerUrl: import_chains2.bsc.blockExplorers.default.url,
25161
+ chain: import_chains2.bsc
25107
25162
  },
25108
25163
  ethereum: {
25109
- chainID: import_chains.mainnet.id,
25110
- chainLabel: import_chains.mainnet.name,
25164
+ chainID: import_chains2.mainnet.id,
25165
+ chainLabel: import_chains2.mainnet.name,
25111
25166
  chainName: "ethereum",
25112
25167
  // exact hyperlane registry chain name
25113
- Icon: NETWORKS_ICONS[import_chains.mainnet.id],
25114
- explorerUrl: import_chains.mainnet.blockExplorers.default.url,
25115
- chain: import_chains.mainnet
25168
+ Icon: NETWORKS_ICONS[import_chains2.mainnet.id],
25169
+ explorerUrl: import_chains2.mainnet.blockExplorers.default.url,
25170
+ chain: import_chains2.mainnet
25116
25171
  }
25117
25172
  };
25118
25173
  }
@@ -25436,8 +25491,8 @@ function useBridge() {
25436
25491
  const qc = (0, import_react_query50.useQueryClient)();
25437
25492
  const { t } = useT();
25438
25493
  const address = useSession((st) => st.address);
25439
- const { data: walletClient } = (0, import_wagmi5.useWalletClient)();
25440
- const { mutateAsync: switchChainAsync } = (0, import_wagmi5.useSwitchChain)();
25494
+ const { data: walletClient } = (0, import_wagmi6.useWalletClient)();
25495
+ const { mutateAsync: switchChainAsync } = (0, import_wagmi6.useSwitchChain)();
25441
25496
  const swapDirection = (0, import_react80.useCallback)(() => {
25442
25497
  const {
25443
25498
  // bridgeStep,
@@ -25624,14 +25679,14 @@ function useBridge() {
25624
25679
  isAssetBridging
25625
25680
  };
25626
25681
  }
25627
- var import_react_query50, import_react80, import_wagmi5;
25682
+ var import_react_query50, import_react80, import_wagmi6;
25628
25683
  var init_useBridge = __esm({
25629
25684
  "src/internal/components/SendMenu/hyperbridge/hooks/useBridge.ts"() {
25630
25685
  init_SessionContext();
25631
25686
  init_i18n();
25632
25687
  import_react_query50 = require("@tanstack/react-query");
25633
25688
  import_react80 = require("react");
25634
- import_wagmi5 = require("wagmi");
25689
+ import_wagmi6 = require("wagmi");
25635
25690
  init_useLayoutStore();
25636
25691
  init_useExternalWalletStore();
25637
25692
  init_useFlowSelector();
@@ -25918,7 +25973,7 @@ function useBridgeBalance(isLoadingWarpRoutes, hyperlaneWarpRoutes) {
25918
25973
  const activeChainId = useSession((st) => st.activeChainId);
25919
25974
  const directWalletAddress = useExternalWalletStore((st) => st.externalAddress);
25920
25975
  const directWalletChainId = useExternalWalletStore((st) => st.externalChainId);
25921
- const { mutateAsync: switchChainAsync } = (0, import_wagmi6.useSwitchChain)();
25976
+ const { mutateAsync: switchChainAsync } = (0, import_wagmi7.useSwitchChain)();
25922
25977
  const hyperRoute = useBridgeStore((st) => st.hyperRoute);
25923
25978
  const bridgeSender = useBridgeStore((st) => st.bridgeSender);
25924
25979
  const originChain = useBridgeStore((st) => st.originChain);
@@ -26045,7 +26100,7 @@ function useBridgeBalance(isLoadingWarpRoutes, hyperlaneWarpRoutes) {
26045
26100
  isRouteTokenBalanceLoading: isAssetsLoading || isExternalBalanceLoading || isExternalNativeBalanceLoading
26046
26101
  };
26047
26102
  }
26048
- var import_core8, import_react_query52, import_react83, import_viem15, import_wagmi6, EXTERNAL_WALLET_BRIDGING_BALANCE_QUERY, EXTERNAL_WALLET_BRIDGING_NATIVE_BALANCE_QUERY;
26103
+ var import_core8, import_react_query52, import_react83, import_viem15, import_wagmi7, EXTERNAL_WALLET_BRIDGING_BALANCE_QUERY, EXTERNAL_WALLET_BRIDGING_NATIVE_BALANCE_QUERY;
26049
26104
  var init_useBridgeBalance = __esm({
26050
26105
  "src/internal/components/SendMenu/hyperbridge/hooks/useBridgeBalance.ts"() {
26051
26106
  init_SessionContext();
@@ -26054,7 +26109,7 @@ var init_useBridgeBalance = __esm({
26054
26109
  import_react_query52 = require("@tanstack/react-query");
26055
26110
  import_react83 = require("react");
26056
26111
  import_viem15 = require("viem");
26057
- import_wagmi6 = require("wagmi");
26112
+ import_wagmi7 = require("wagmi");
26058
26113
  init_useBlockscoutAssets2();
26059
26114
  init_useExternalWalletStore();
26060
26115
  init_BalanceFeedProvider2();
@@ -27093,7 +27148,7 @@ function useErc3643Compliance(options) {
27093
27148
  isLoading,
27094
27149
  error: queryError,
27095
27150
  refetch
27096
- } = (0, import_wagmi7.useReadContract)({
27151
+ } = (0, import_wagmi8.useReadContract)({
27097
27152
  address: tokenAddress,
27098
27153
  abi: ERC3643_CAN_TRANSFER_ABI,
27099
27154
  functionName: "canTransfer",
@@ -27130,10 +27185,10 @@ function useErc3643Compliance(options) {
27130
27185
  refetch
27131
27186
  };
27132
27187
  }
27133
- var import_wagmi7, ERC3643_CAN_TRANSFER_ABI;
27188
+ var import_wagmi8, ERC3643_CAN_TRANSFER_ABI;
27134
27189
  var init_useErc3643Compliance = __esm({
27135
27190
  "src/hooks/useErc3643Compliance.ts"() {
27136
- import_wagmi7 = require("wagmi");
27191
+ import_wagmi8 = require("wagmi");
27137
27192
  ERC3643_CAN_TRANSFER_ABI = [
27138
27193
  {
27139
27194
  type: "function",
@@ -29956,7 +30011,7 @@ var init_package = __esm({
29956
30011
  "package.json"() {
29957
30012
  package_default = {
29958
30013
  name: "@embarkai/ui-kit",
29959
- version: "0.4.104",
30014
+ version: "0.4.106",
29960
30015
  description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
29961
30016
  type: "module",
29962
30017
  main: "./dist/index.cjs",
@@ -30067,7 +30122,7 @@ function Footer() {
30067
30122
  const address = useSession((st) => st.address);
30068
30123
  const chainConfig = useSession((st) => st.chainConfig);
30069
30124
  const isDialogForced = useLayoutStore((st) => st.isDialogForced);
30070
- const { mutate: wagmiDisconnect } = (0, import_wagmi8.useDisconnect)({
30125
+ const { mutate: wagmiDisconnect } = (0, import_wagmi9.useDisconnect)({
30071
30126
  mutation: {
30072
30127
  onSuccess: () => {
30073
30128
  useExternalWalletStore.getState().clearExternalWallet();
@@ -30173,7 +30228,7 @@ function Footer() {
30173
30228
  }
30174
30229
  );
30175
30230
  }
30176
- var import_react_query59, import_lucide_react83, import_wagmi8, import_jsx_runtime131, FOOTER_ONBOARDING_CHAIN_BUTTON, FOOTER_ONBOARDING_LOGOUT_BUTTON, FOOTER_TOUR;
30231
+ var import_react_query59, import_lucide_react83, import_wagmi9, import_jsx_runtime131, FOOTER_ONBOARDING_CHAIN_BUTTON, FOOTER_ONBOARDING_LOGOUT_BUTTON, FOOTER_TOUR;
30177
30232
  var init_Footer = __esm({
30178
30233
  "src/internal/components/Footer/Footer.tsx"() {
30179
30234
  init_package();
@@ -30183,7 +30238,7 @@ var init_Footer = __esm({
30183
30238
  init_i18n();
30184
30239
  import_react_query59 = require("@tanstack/react-query");
30185
30240
  import_lucide_react83 = require("lucide-react");
30186
- import_wagmi8 = require("wagmi");
30241
+ import_wagmi9 = require("wagmi");
30187
30242
  init_auth();
30188
30243
  init_base3();
30189
30244
  init_useLayoutDataStore();
@@ -30722,7 +30777,7 @@ function DirectWalletHandler() {
30722
30777
  const walletMode = useProviderConfig().config.current?.wallet?.mode || "both";
30723
30778
  const externalAddress = useExternalWalletStore((st) => st.externalAddress);
30724
30779
  const isExternalConnected = useExternalWalletStore((st) => st.isExternalConnected);
30725
- const { address, isConnected, chain, connector } = (0, import_wagmi9.useConnection)();
30780
+ const { address, isConnected, chain, connector } = (0, import_wagmi10.useConnection)();
30726
30781
  (0, import_react104.useEffect)(() => {
30727
30782
  const { setConfigMode, setActiveMode } = useExternalWalletStore.getState();
30728
30783
  setConfigMode(walletMode);
@@ -30743,11 +30798,11 @@ function DirectWalletHandler() {
30743
30798
  }, [isConnected, address, isExternalConnected, externalAddress, connector, chain]);
30744
30799
  return null;
30745
30800
  }
30746
- var import_react104, import_wagmi9;
30801
+ var import_react104, import_wagmi10;
30747
30802
  var init_DirectWalletHandler = __esm({
30748
30803
  "src/internal/components/DirectWalletHandler.tsx"() {
30749
30804
  import_react104 = require("react");
30750
- import_wagmi9 = require("wagmi");
30805
+ import_wagmi10 = require("wagmi");
30751
30806
  init_ProviderContext();
30752
30807
  init_useExternalWalletStore();
30753
30808
  }
@@ -33407,16 +33462,16 @@ function Provider(props) {
33407
33462
  }),
33408
33463
  [config, updateConfig, callbacks, updateCallbacks]
33409
33464
  );
33410
- return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(UIContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_wagmi10.WagmiProvider, { config: wagmiConfig3.current, children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(SessionProvider, { children }) }) });
33465
+ return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(UIContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_wagmi11.WagmiProvider, { config: wagmiConfig3.current, children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(SessionProvider, { children }) }) });
33411
33466
  }
33412
- var import_core9, import_error_tracking4, import_lodash_es17, import_react107, import_wagmi10, import_jsx_runtime137, UIContext, useProviderConfig;
33467
+ var import_core9, import_error_tracking4, import_lodash_es17, import_react107, import_wagmi11, import_jsx_runtime137, UIContext, useProviderConfig;
33413
33468
  var init_ProviderContext = __esm({
33414
33469
  "src/context/ProviderContext.tsx"() {
33415
33470
  import_core9 = require("@embarkai/core");
33416
33471
  import_error_tracking4 = require("@embarkai/core/internal/error-tracking");
33417
33472
  import_lodash_es17 = require("lodash-es");
33418
33473
  import_react107 = require("react");
33419
- import_wagmi10 = require("wagmi");
33474
+ import_wagmi11 = require("wagmi");
33420
33475
  init_initial();
33421
33476
  init_iframe_manager();
33422
33477
  init_SessionContext();
@@ -34544,7 +34599,7 @@ function useWalletMode() {
34544
34599
  // src/hooks/useDirectWallet.ts
34545
34600
  init_useOpenPage();
34546
34601
  var import_react111 = require("react");
34547
- var import_wagmi11 = require("wagmi");
34602
+ var import_wagmi12 = require("wagmi");
34548
34603
  init_useExternalWalletStore();
34549
34604
  function useDirectWallet() {
34550
34605
  const address = useExternalWalletStore((st) => st.externalAddress);
@@ -34552,7 +34607,7 @@ function useDirectWallet() {
34552
34607
  const isConnected = useExternalWalletStore((st) => st.isExternalConnected);
34553
34608
  const connectorName = useExternalWalletStore((st) => st.connectorName);
34554
34609
  const { open: openEmbarkAI } = useOpenPage();
34555
- const { mutate: wagmiDisconnect } = (0, import_wagmi11.useDisconnect)();
34610
+ const { mutate: wagmiDisconnect } = (0, import_wagmi12.useDisconnect)();
34556
34611
  const connect = (0, import_react111.useCallback)((connectFlowType = "connect") => {
34557
34612
  openEmbarkAI("connect-external-wallet" /* CONNECT_EXTERNAL_WALLET */, { connectFlowType });
34558
34613
  }, []);
@@ -34574,13 +34629,13 @@ function useDirectWallet() {
34574
34629
  // src/hooks/useSendDirectTransaction.ts
34575
34630
  var import_react112 = require("react");
34576
34631
  var import_viem23 = require("viem");
34577
- var import_wagmi12 = require("wagmi");
34632
+ var import_wagmi13 = require("wagmi");
34578
34633
  init_useExternalWalletStore();
34579
34634
  function useSendDirectTransaction() {
34580
34635
  const isConnected = useExternalWalletStore((st) => st.isExternalConnected);
34581
34636
  const externalChainId = useExternalWalletStore((st) => st.externalChainId);
34582
- const { sendTransactionAsync } = (0, import_wagmi12.useSendTransaction)();
34583
- const { switchChainAsync } = (0, import_wagmi12.useSwitchChain)();
34637
+ const { sendTransactionAsync } = (0, import_wagmi13.useSendTransaction)();
34638
+ const { switchChainAsync } = (0, import_wagmi13.useSwitchChain)();
34584
34639
  const [isPending, setIsPending] = (0, import_react112.useState)(false);
34585
34640
  const [error, setError] = (0, import_react112.useState)(null);
34586
34641
  const [txHash, setTxHash] = (0, import_react112.useState)(null);
@@ -34713,11 +34768,11 @@ function useTransferToLinkedWallet() {
34713
34768
  }
34714
34769
 
34715
34770
  // src/hooks/useNativeWalletSignature.ts
34716
- var import_wagmi13 = require("wagmi");
34771
+ var import_wagmi14 = require("wagmi");
34717
34772
  init_providers();
34718
34773
  function useNativeWalletSignature() {
34719
- const signMessage = (0, import_wagmi13.useSignMessage)();
34720
- const signTypedMessage = (0, import_wagmi13.useSignTypedData)();
34774
+ const signMessage = (0, import_wagmi14.useSignMessage)();
34775
+ const signTypedMessage = (0, import_wagmi14.useSignTypedData)();
34721
34776
  return {
34722
34777
  signMessage,
34723
34778
  /** EIP-712 signature */
@@ -34729,14 +34784,14 @@ function useNativeWalletSignature() {
34729
34784
  // src/hooks/useLogout.ts
34730
34785
  var import_auth27 = require("@embarkai/core/auth");
34731
34786
  var import_react114 = require("react");
34732
- var import_wagmi14 = require("wagmi");
34787
+ var import_wagmi15 = require("wagmi");
34733
34788
  init_ProviderContext();
34734
34789
  init_SessionContext();
34735
34790
  init_useExternalWalletStore();
34736
34791
  function useLogout() {
34737
34792
  const { callbacksRef } = useProviderConfig();
34738
34793
  const address = useSession((st) => st.address);
34739
- const { mutate: wagmiDisconnect } = (0, import_wagmi14.useDisconnect)({
34794
+ const { mutate: wagmiDisconnect } = (0, import_wagmi15.useDisconnect)({
34740
34795
  mutation: {
34741
34796
  onSuccess: () => {
34742
34797
  useExternalWalletStore.getState().clearExternalWallet();
@@ -34802,13 +34857,13 @@ init_useBlockscoutAssets2();
34802
34857
  init_SessionContext();
34803
34858
  var import_read24 = require("@embarkai/core/read");
34804
34859
  var import_viem25 = require("viem");
34805
- var import_wagmi15 = require("wagmi");
34860
+ var import_wagmi16 = require("wagmi");
34806
34861
  function useTransactions() {
34807
34862
  const chainId = requireActiveChainId();
34808
34863
  const viemChain = (0, import_read24.getViemChain)(chainId);
34809
- const publicClient = (0, import_wagmi15.usePublicClient)({ chainId });
34810
- const { data: walletClient } = (0, import_wagmi15.useWalletClient)();
34811
- const { address } = (0, import_wagmi15.useAccount)();
34864
+ const publicClient = (0, import_wagmi16.usePublicClient)({ chainId });
34865
+ const { data: walletClient } = (0, import_wagmi16.useWalletClient)();
34866
+ const { address } = (0, import_wagmi16.useAccount)();
34812
34867
  const sendTransaction = async (params) => {
34813
34868
  if (!walletClient) {
34814
34869
  throw new Error("Wallet not connected");
@@ -34868,7 +34923,7 @@ function useTransactions() {
34868
34923
  init_SessionContext();
34869
34924
  var import_react115 = __toESM(require("react"), 1);
34870
34925
  var import_viem26 = require("viem");
34871
- var import_wagmi16 = require("wagmi");
34926
+ var import_wagmi17 = require("wagmi");
34872
34927
  var COMMON_TOKENS = [
34873
34928
  // Add real token addresses here when available
34874
34929
  // {
@@ -34885,7 +34940,7 @@ function useAssets(address) {
34885
34940
  data: nativeBalance,
34886
34941
  isLoading: nativeBalanceLoading,
34887
34942
  refetch: refetchNativeBalance
34888
- } = (0, import_wagmi16.useBalance)({
34943
+ } = (0, import_wagmi17.useBalance)({
34889
34944
  address,
34890
34945
  chainId,
34891
34946
  query: {
@@ -34903,7 +34958,7 @@ function useAssets(address) {
34903
34958
  data: tokenBalances,
34904
34959
  isLoading: tokenBalancesLoading,
34905
34960
  refetch: refetchTokenBalances
34906
- } = (0, import_wagmi16.useReadContracts)({
34961
+ } = (0, import_wagmi17.useReadContracts)({
34907
34962
  contracts: tokenContracts,
34908
34963
  query: {
34909
34964
  enabled: !!address && COMMON_TOKENS.length > 0
@@ -34979,7 +35034,7 @@ function useAssets(address) {
34979
35034
  }
34980
35035
  function useTokenInfo(tokenAddress) {
34981
35036
  const chainId = requireActiveChainId();
34982
- const readContractsResult = (0, import_wagmi16.useReadContracts)({
35037
+ const readContractsResult = (0, import_wagmi17.useReadContracts)({
34983
35038
  contracts: [
34984
35039
  { address: tokenAddress, abi: import_viem26.erc20Abi, functionName: "name", chainId },
34985
35040
  { address: tokenAddress, abi: import_viem26.erc20Abi, functionName: "symbol", chainId },
@@ -35010,7 +35065,7 @@ function useTokenBalance2(tokenAddress, userAddress) {
35010
35065
  data: balance,
35011
35066
  isLoading,
35012
35067
  refetch
35013
- } = (0, import_wagmi16.useReadContract)({
35068
+ } = (0, import_wagmi17.useReadContract)({
35014
35069
  address: tokenAddress,
35015
35070
  abi: import_viem26.erc20Abi,
35016
35071
  functionName: "balanceOf",