@iota/dapp-kit 0.5.3 → 0.8.0

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.
Files changed (73) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/dist/cjs/components/AccountDropdownMenu.d.ts +4 -2
  3. package/dist/cjs/components/AccountDropdownMenu.js +81 -15
  4. package/dist/cjs/components/AccountDropdownMenu.js.map +4 -4
  5. package/dist/cjs/components/ConnectButton.d.ts +6 -1
  6. package/dist/cjs/components/ConnectButton.js +177 -91
  7. package/dist/cjs/components/ConnectButton.js.map +4 -4
  8. package/dist/cjs/components/WalletProvider.d.ts +3 -1
  9. package/dist/cjs/components/WalletProvider.js +9 -3
  10. package/dist/cjs/components/WalletProvider.js.map +2 -2
  11. package/dist/cjs/components/connect-modal/ConnectModal.d.ts +5 -1
  12. package/dist/cjs/components/connect-modal/ConnectModal.js +12 -2
  13. package/dist/cjs/components/connect-modal/ConnectModal.js.map +2 -2
  14. package/dist/cjs/hooks/useGetDefaultIotaName.d.ts +1 -0
  15. package/dist/cjs/hooks/useGetDefaultIotaName.js +80 -0
  16. package/dist/cjs/hooks/useGetDefaultIotaName.js.map +7 -0
  17. package/dist/cjs/hooks/wallet/useAutoConnectWallet.js +2 -0
  18. package/dist/cjs/hooks/wallet/useAutoConnectWallet.js.map +2 -2
  19. package/dist/cjs/hooks/wallet/useConnectWallet.d.ts +6 -2
  20. package/dist/cjs/hooks/wallet/useConnectWallet.js +2 -0
  21. package/dist/cjs/hooks/wallet/useConnectWallet.js.map +2 -2
  22. package/dist/cjs/hooks/wallet/useCurrentChain.d.ts +5 -0
  23. package/dist/cjs/hooks/wallet/useCurrentChain.js +50 -0
  24. package/dist/cjs/hooks/wallet/useCurrentChain.js.map +7 -0
  25. package/dist/cjs/hooks/wallet/useSignAndExecuteTransaction.js +8 -2
  26. package/dist/cjs/hooks/wallet/useSignAndExecuteTransaction.js.map +3 -3
  27. package/dist/cjs/index.js +193 -120
  28. package/dist/cjs/index.js.map +4 -4
  29. package/dist/cjs/walletStore.d.ts +4 -1
  30. package/dist/cjs/walletStore.js +3 -1
  31. package/dist/cjs/walletStore.js.map +2 -2
  32. package/dist/esm/components/AccountDropdownMenu.d.ts +4 -2
  33. package/dist/esm/components/AccountDropdownMenu.js +79 -13
  34. package/dist/esm/components/AccountDropdownMenu.js.map +4 -4
  35. package/dist/esm/components/ConnectButton.d.ts +6 -1
  36. package/dist/esm/components/ConnectButton.js +159 -73
  37. package/dist/esm/components/ConnectButton.js.map +4 -4
  38. package/dist/esm/components/WalletProvider.d.ts +3 -1
  39. package/dist/esm/components/WalletProvider.js +9 -3
  40. package/dist/esm/components/WalletProvider.js.map +2 -2
  41. package/dist/esm/components/connect-modal/ConnectModal.d.ts +5 -1
  42. package/dist/esm/components/connect-modal/ConnectModal.js +12 -2
  43. package/dist/esm/components/connect-modal/ConnectModal.js.map +2 -2
  44. package/dist/esm/hooks/useGetDefaultIotaName.d.ts +1 -0
  45. package/dist/esm/hooks/useGetDefaultIotaName.js +59 -0
  46. package/dist/esm/hooks/useGetDefaultIotaName.js.map +7 -0
  47. package/dist/esm/hooks/wallet/useAutoConnectWallet.js +2 -0
  48. package/dist/esm/hooks/wallet/useAutoConnectWallet.js.map +2 -2
  49. package/dist/esm/hooks/wallet/useConnectWallet.d.ts +6 -2
  50. package/dist/esm/hooks/wallet/useConnectWallet.js +2 -0
  51. package/dist/esm/hooks/wallet/useConnectWallet.js.map +2 -2
  52. package/dist/esm/hooks/wallet/useCurrentChain.d.ts +5 -0
  53. package/dist/esm/hooks/wallet/useCurrentChain.js +27 -0
  54. package/dist/esm/hooks/wallet/useCurrentChain.js.map +7 -0
  55. package/dist/esm/hooks/wallet/useSignAndExecuteTransaction.js +8 -2
  56. package/dist/esm/hooks/wallet/useSignAndExecuteTransaction.js.map +3 -3
  57. package/dist/esm/index.js +164 -91
  58. package/dist/esm/index.js.map +4 -4
  59. package/dist/esm/walletStore.d.ts +4 -1
  60. package/dist/esm/walletStore.js +3 -1
  61. package/dist/esm/walletStore.js.map +2 -2
  62. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  63. package/dist/tsconfig.tsbuildinfo +1 -1
  64. package/package.json +5 -3
  65. package/src/components/AccountDropdownMenu.tsx +17 -3
  66. package/src/components/ConnectButton.tsx +11 -1
  67. package/src/components/WalletProvider.tsx +5 -0
  68. package/src/components/connect-modal/ConnectModal.tsx +12 -2
  69. package/src/hooks/useGetDefaultIotaName.ts +43 -0
  70. package/src/hooks/wallet/useConnectWallet.ts +6 -1
  71. package/src/hooks/wallet/useCurrentChain.ts +12 -0
  72. package/src/hooks/wallet/useSignAndExecuteTransaction.ts +5 -2
  73. package/src/walletStore.ts +5 -0
@@ -307,27 +307,90 @@ var Text = forwardRef3(
307
307
  );
308
308
  Text.displayName = "Text";
309
309
 
310
+ // src/hooks/useGetDefaultIotaName.ts
311
+ import { getNetwork as getNetwork2 } from "@iota/iota-sdk/client";
312
+ import { useQuery } from "@tanstack/react-query";
313
+ import { IotaNamesClient, normalizeIotaName } from "@iota/iota-names-sdk";
314
+
315
+ // src/hooks/useIotaClient.ts
316
+ import { useContext as useContext2 } from "react";
317
+
318
+ // src/components/IotaClientProvider.tsx
319
+ import { getNetwork, isIotaClient, Network, IotaClient } from "@iota/iota-sdk/client";
320
+ import { createContext as createContext2, useMemo, useState } from "react";
321
+ import { jsx as jsx6 } from "react/jsx-runtime";
322
+ var IotaClientContext = createContext2(null);
323
+ var DEFAULT_NETWORKS = {
324
+ localnet: { url: getNetwork(Network.Localnet)?.url }
325
+ };
326
+
327
+ // src/hooks/useIotaClient.ts
328
+ function useIotaClientContext() {
329
+ const iotaClient = useContext2(IotaClientContext);
330
+ if (!iotaClient) {
331
+ throw new Error(
332
+ "Could not find IotaClientContext. Ensure that you have set up the IotaClientProvider"
333
+ );
334
+ }
335
+ return iotaClient;
336
+ }
337
+
338
+ // src/hooks/useGetDefaultIotaName.ts
339
+ import { useMemo as useMemo2 } from "react";
340
+ import { IotaGraphQLClient } from "@iota/iota-sdk/graphql";
341
+ function useGetDefaultIotaName(address, iotaNamesEnabled) {
342
+ const iotaContext = useIotaClientContext();
343
+ const network = getNetwork2(iotaContext.network);
344
+ const iotaNamesClient = useMemo2(() => {
345
+ const iotaGraphQLClient = new IotaGraphQLClient({
346
+ url: network.graphql
347
+ });
348
+ return new IotaNamesClient({
349
+ graphQlClient: iotaGraphQLClient,
350
+ network: network.id
351
+ });
352
+ }, [network.id]);
353
+ const iotaNamesSupported = !!iotaNamesClient.config;
354
+ return useQuery({
355
+ queryKey: ["iota-name", "default-name", address],
356
+ queryFn: async () => {
357
+ if (!address) return null;
358
+ const name = await iotaNamesClient?.getDefaultName(address);
359
+ return name ? normalizeIotaName(name) : name;
360
+ },
361
+ enabled: !!iotaNamesClient && !!address && iotaNamesEnabled && iotaNamesSupported,
362
+ staleTime: 1e3 * 60 * 10
363
+ });
364
+ }
365
+
310
366
  // src/components/AccountDropdownMenu.tsx
311
- import { jsx as jsx6, jsxs } from "react/jsx-runtime";
312
- function AccountDropdownMenu({ currentAccount, size = "lg" }) {
367
+ import { jsx as jsx7, jsxs } from "react/jsx-runtime";
368
+ function AccountDropdownMenu({
369
+ currentAccount,
370
+ size = "lg",
371
+ iotaNamesEnabled
372
+ }) {
313
373
  const { mutate: disconnectWallet } = useDisconnectWallet();
314
374
  const accounts = useAccounts();
375
+ const { data: iotaName } = useGetDefaultIotaName(currentAccount.address, iotaNamesEnabled);
376
+ const displayAccount = iotaName ?? currentAccount.label ?? formatAddress(currentAccount.address);
315
377
  return /* @__PURE__ */ jsxs(DropdownMenu.Root, { modal: false, children: [
316
- /* @__PURE__ */ jsx6(StyleMarker, { children: /* @__PURE__ */ jsx6(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { size, className: connectedAccount, children: [
317
- /* @__PURE__ */ jsx6(Text, { mono: true, weight: "bold", children: currentAccount.label ?? formatAddress(currentAccount.address) }),
318
- /* @__PURE__ */ jsx6(ChevronIcon, {})
378
+ /* @__PURE__ */ jsx7(StyleMarker, { children: /* @__PURE__ */ jsx7(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { size, className: connectedAccount, children: [
379
+ /* @__PURE__ */ jsx7(Text, { mono: true, weight: "bold", children: displayAccount }),
380
+ /* @__PURE__ */ jsx7(ChevronIcon, {})
319
381
  ] }) }) }),
320
- /* @__PURE__ */ jsx6(DropdownMenu.Portal, { children: /* @__PURE__ */ jsx6(StyleMarker, { className: menuContainer, children: /* @__PURE__ */ jsxs(DropdownMenu.Content, { className: menuContent, children: [
321
- /* @__PURE__ */ jsx6("div", { className: scrollableContent, children: accounts.map((account) => /* @__PURE__ */ jsx6(
382
+ /* @__PURE__ */ jsx7(DropdownMenu.Portal, { children: /* @__PURE__ */ jsx7(StyleMarker, { className: menuContainer, children: /* @__PURE__ */ jsxs(DropdownMenu.Content, { className: menuContent, children: [
383
+ /* @__PURE__ */ jsx7("div", { className: scrollableContent, children: accounts.map((account) => /* @__PURE__ */ jsx7(
322
384
  AccountDropdownMenuItem,
323
385
  {
324
386
  account,
325
- active: currentAccount.address === account.address
387
+ active: currentAccount.address === account.address,
388
+ iotaNamesEnabled
326
389
  },
327
390
  account.address
328
391
  )) }),
329
- /* @__PURE__ */ jsx6(DropdownMenu.Separator, { className: separator }),
330
- /* @__PURE__ */ jsx6(
392
+ /* @__PURE__ */ jsx7(DropdownMenu.Separator, { className: separator }),
393
+ /* @__PURE__ */ jsx7(
331
394
  DropdownMenu.Item,
332
395
  {
333
396
  className: clsx3(menuItem),
@@ -340,17 +403,20 @@ function AccountDropdownMenu({ currentAccount, size = "lg" }) {
340
403
  }
341
404
  function AccountDropdownMenuItem({
342
405
  account,
343
- active
406
+ active,
407
+ iotaNamesEnabled
344
408
  }) {
345
409
  const { mutate: switchAccount } = useSwitchAccount();
410
+ const { data: iotaName } = useGetDefaultIotaName(account.address, iotaNamesEnabled);
411
+ const displayAccount = iotaName ?? account.label ?? formatAddress(account.address);
346
412
  return /* @__PURE__ */ jsxs(
347
413
  DropdownMenu.Item,
348
414
  {
349
415
  className: clsx3(menuItem, switchAccountMenuItem),
350
416
  onSelect: () => switchAccount({ account }),
351
417
  children: [
352
- /* @__PURE__ */ jsx6(Text, { mono: true, children: account.label ?? formatAddress(account.address) }),
353
- active ? /* @__PURE__ */ jsx6(CheckIcon, {}) : null
418
+ /* @__PURE__ */ jsx7(Text, { mono: true, children: displayAccount }),
419
+ active ? /* @__PURE__ */ jsx7(CheckIcon, {}) : null
354
420
  ]
355
421
  }
356
422
  );
@@ -359,12 +425,13 @@ function AccountDropdownMenuItem({
359
425
  // src/components/connect-modal/ConnectModal.tsx
360
426
  import * as Dialog from "@radix-ui/react-dialog";
361
427
  import clsx7 from "clsx";
362
- import { useState } from "react";
428
+ import { useState as useState2 } from "react";
363
429
 
364
430
  // src/hooks/wallet/useConnectWallet.ts
365
431
  import { isSupportedChain } from "@iota/wallet-standard";
366
432
  import { useMutation as useMutation3 } from "@tanstack/react-query";
367
433
  function useConnectWallet({
434
+ onConnected,
368
435
  mutationKey,
369
436
  ...mutationOptions
370
437
  } = {}) {
@@ -386,6 +453,7 @@ function useConnectWallet({
386
453
  selectedAccount,
387
454
  connectResult.supportedIntents
388
455
  );
456
+ onConnected?.({ wallet });
389
457
  return { accounts: connectedIotaAccounts };
390
458
  } catch (error) {
391
459
  setConnectionStatus("disconnected");
@@ -415,9 +483,9 @@ function getWalletUniqueIdentifier(wallet) {
415
483
  }
416
484
 
417
485
  // src/components/icons/BackIcon.tsx
418
- import { jsx as jsx7 } from "react/jsx-runtime";
486
+ import { jsx as jsx8 } from "react/jsx-runtime";
419
487
  function BackIcon(props) {
420
- return /* @__PURE__ */ jsx7("svg", { width: 24, height: 24, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx7(
488
+ return /* @__PURE__ */ jsx8("svg", { width: 24, height: 24, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx8(
421
489
  "path",
422
490
  {
423
491
  d: "M7.57 12.262c0 .341.13.629.403.895l5.175 5.059c.204.205.45.307.751.307.609 0 1.101-.485 1.101-1.087 0-.293-.123-.574-.349-.8L10.14 12.27l4.511-4.375A1.13 1.13 0 0 0 15 7.087C15 6.485 14.508 6 13.9 6c-.295 0-.54.103-.752.308l-5.175 5.058c-.28.28-.404.56-.404.896Z",
@@ -427,9 +495,9 @@ function BackIcon(props) {
427
495
  }
428
496
 
429
497
  // src/components/icons/CloseIcon.tsx
430
- import { jsx as jsx8 } from "react/jsx-runtime";
498
+ import { jsx as jsx9 } from "react/jsx-runtime";
431
499
  function CloseIcon(props) {
432
- return /* @__PURE__ */ jsx8("svg", { width: 10, height: 10, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx8(
500
+ return /* @__PURE__ */ jsx9("svg", { width: 10, height: 10, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx9(
433
501
  "path",
434
502
  {
435
503
  d: "M9.708.292a.999.999 0 0 0-1.413 0l-3.289 3.29L1.717.291A.999.999 0 0 0 .305 1.705l3.289 3.289-3.29 3.289a.999.999 0 1 0 1.413 1.412l3.29-3.289 3.288 3.29a.999.999 0 0 0 1.413-1.413l-3.29-3.29 3.29-3.288a.999.999 0 0 0 0-1.413Z",
@@ -448,7 +516,7 @@ import { createRuntimeFn as _7a4683 } from "@vanilla-extract/recipes/createRunti
448
516
  var headingVariants = _7a4683({ defaultClassName: "Heading__12b5l8i0", variantClassNames: { size: { sm: "Heading_headingVariants_size_sm__12b5l8i1", md: "Heading_headingVariants_size_md__12b5l8i2", lg: "Heading_headingVariants_size_lg__12b5l8i3", xl: "Heading_headingVariants_size_xl__12b5l8i4" }, weight: { normal: "Heading_headingVariants_weight_normal__12b5l8i5", bold: "Heading_headingVariants_weight_bold__12b5l8i6" }, truncate: { true: "Heading_headingVariants_truncate_true__12b5l8i7" } }, defaultVariants: { size: "lg", weight: "bold" }, compoundVariants: [] });
449
517
 
450
518
  // src/components/ui/Heading.tsx
451
- import { jsx as jsx9 } from "react/jsx-runtime";
519
+ import { jsx as jsx10 } from "react/jsx-runtime";
452
520
  var Heading = forwardRef4(
453
521
  ({
454
522
  children,
@@ -460,13 +528,13 @@ var Heading = forwardRef4(
460
528
  truncate,
461
529
  ...headingProps
462
530
  }, forwardedRef) => {
463
- return /* @__PURE__ */ jsx9(
531
+ return /* @__PURE__ */ jsx10(
464
532
  Slot4,
465
533
  {
466
534
  ...headingProps,
467
535
  ref: forwardedRef,
468
536
  className: clsx4(headingVariants({ size, weight, truncate }), className),
469
- children: asChild ? children : /* @__PURE__ */ jsx9(Tag, { children })
537
+ children: asChild ? children : /* @__PURE__ */ jsx10(Tag, { children })
470
538
  }
471
539
  );
472
540
  }
@@ -482,11 +550,11 @@ import { forwardRef as forwardRef5 } from "react";
482
550
  var container = "IconButton_container__ap1qll0";
483
551
 
484
552
  // src/components/ui/IconButton.tsx
485
- import { jsx as jsx10 } from "react/jsx-runtime";
553
+ import { jsx as jsx11 } from "react/jsx-runtime";
486
554
  var IconButton = forwardRef5(
487
555
  ({ className, asChild = false, ...props }, forwardedRef) => {
488
556
  const Comp = asChild ? Slot5 : "button";
489
- return /* @__PURE__ */ jsx10(Comp, { ...props, className: clsx5(container, className), ref: forwardedRef });
557
+ return /* @__PURE__ */ jsx11(Comp, { ...props, className: clsx5(container, className), ref: forwardedRef });
490
558
  }
491
559
  );
492
560
  IconButton.displayName = "Button";
@@ -512,14 +580,14 @@ var title2 = "ConnectionStatus_title__c5q1ll2";
512
580
  var walletIcon = "ConnectionStatus_walletIcon__c5q1ll1";
513
581
 
514
582
  // src/components/connect-modal/views/ConnectionStatus.tsx
515
- import { jsx as jsx11, jsxs as jsxs2 } from "react/jsx-runtime";
583
+ import { jsx as jsx12, jsxs as jsxs2 } from "react/jsx-runtime";
516
584
  function ConnectionStatus({
517
585
  selectedWallet,
518
586
  hadConnectionError,
519
587
  onRetryConnection
520
588
  }) {
521
589
  return /* @__PURE__ */ jsxs2("div", { className: container2, children: [
522
- /* @__PURE__ */ jsx11(
590
+ /* @__PURE__ */ jsx12(
523
591
  "img",
524
592
  {
525
593
  className: walletIcon,
@@ -527,12 +595,12 @@ function ConnectionStatus({
527
595
  alt: `${selectedWallet.name} logo`
528
596
  }
529
597
  ),
530
- /* @__PURE__ */ jsx11("div", { className: title2, children: /* @__PURE__ */ jsxs2(Heading, { as: "h2", size: "xl", children: [
598
+ /* @__PURE__ */ jsx12("div", { className: title2, children: /* @__PURE__ */ jsxs2(Heading, { as: "h2", size: "xl", children: [
531
599
  "Opening ",
532
600
  selectedWallet.name
533
601
  ] }) }),
534
- /* @__PURE__ */ jsx11("div", { className: connectionStatus, children: hadConnectionError ? /* @__PURE__ */ jsx11(Text, { color: "danger", children: "Connection failed" }) : /* @__PURE__ */ jsx11(Text, { color: "muted", children: "Confirm connection in the wallet..." }) }),
535
- hadConnectionError ? /* @__PURE__ */ jsx11("div", { className: retryButtonContainer, children: /* @__PURE__ */ jsx11(
602
+ /* @__PURE__ */ jsx12("div", { className: connectionStatus, children: hadConnectionError ? /* @__PURE__ */ jsx12(Text, { color: "danger", children: "Connection failed" }) : /* @__PURE__ */ jsx12(Text, { color: "muted", children: "Confirm connection in the wallet..." }) }),
603
+ hadConnectionError ? /* @__PURE__ */ jsx12("div", { className: retryButtonContainer, children: /* @__PURE__ */ jsx12(
536
604
  Button,
537
605
  {
538
606
  type: "button",
@@ -548,11 +616,11 @@ function ConnectionStatus({
548
616
  var container3 = "InfoSection_container__1d1nrmt0";
549
617
 
550
618
  // src/components/connect-modal/InfoSection.tsx
551
- import { jsx as jsx12, jsxs as jsxs3 } from "react/jsx-runtime";
619
+ import { jsx as jsx13, jsxs as jsxs3 } from "react/jsx-runtime";
552
620
  function InfoSection({ title: title3, children }) {
553
621
  return /* @__PURE__ */ jsxs3("section", { className: container3, children: [
554
- /* @__PURE__ */ jsx12(Heading, { as: "h3", size: "sm", weight: "normal", children: title3 }),
555
- /* @__PURE__ */ jsx12(Text, { weight: "medium", color: "muted", children })
622
+ /* @__PURE__ */ jsx13(Heading, { as: "h3", size: "sm", weight: "normal", children: title3 }),
623
+ /* @__PURE__ */ jsx13(Text, { weight: "medium", color: "muted", children })
556
624
  ] });
557
625
  }
558
626
 
@@ -562,15 +630,15 @@ var content2 = "GettingStarted_content__qu36t91";
562
630
  var installButtonContainer = "GettingStarted_installButtonContainer__qu36t92";
563
631
 
564
632
  // src/components/connect-modal/views/GettingStarted.tsx
565
- import { jsx as jsx13, jsxs as jsxs4 } from "react/jsx-runtime";
633
+ import { jsx as jsx14, jsxs as jsxs4 } from "react/jsx-runtime";
566
634
  function GettingStarted() {
567
635
  return /* @__PURE__ */ jsxs4("div", { className: container4, children: [
568
- /* @__PURE__ */ jsx13(Heading, { as: "h2", children: "Get Started with IOTA" }),
636
+ /* @__PURE__ */ jsx14(Heading, { as: "h2", children: "Get Started with IOTA" }),
569
637
  /* @__PURE__ */ jsxs4("div", { className: content2, children: [
570
- /* @__PURE__ */ jsx13(InfoSection, { title: "Install the IOTA Wallet Extension", children: "We recommend pinning IOTA Wallet to your taskbar for quicker access." }),
571
- /* @__PURE__ */ jsx13(InfoSection, { title: "Create or Import a Wallet", children: "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone." }),
572
- /* @__PURE__ */ jsx13(InfoSection, { title: "Refresh Your Browser", children: "Once you set up your wallet, refresh this window browser to load up the extension." }),
573
- /* @__PURE__ */ jsx13("div", { className: installButtonContainer, children: /* @__PURE__ */ jsx13(Button, { variant: "primary", asChild: true, children: /* @__PURE__ */ jsx13(
638
+ /* @__PURE__ */ jsx14(InfoSection, { title: "Install the IOTA Wallet Extension", children: "We recommend pinning IOTA Wallet to your taskbar for quicker access." }),
639
+ /* @__PURE__ */ jsx14(InfoSection, { title: "Create or Import a Wallet", children: "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone." }),
640
+ /* @__PURE__ */ jsx14(InfoSection, { title: "Refresh Your Browser", children: "Once you set up your wallet, refresh this window browser to load up the extension." }),
641
+ /* @__PURE__ */ jsx14("div", { className: installButtonContainer, children: /* @__PURE__ */ jsx14(Button, { variant: "primary", asChild: true, children: /* @__PURE__ */ jsx14(
574
642
  "a",
575
643
  {
576
644
  href: "https://chrome.google.com/webstore/detail/iota-wallet/iidjkmdceolghepehaaddojmnjnkkija",
@@ -588,13 +656,13 @@ var container5 = "WhatIsAWallet_container__1kdcimq0";
588
656
  var content3 = "WhatIsAWallet_content__1kdcimq1";
589
657
 
590
658
  // src/components/connect-modal/views/WhatIsAWallet.tsx
591
- import { jsx as jsx14, jsxs as jsxs5 } from "react/jsx-runtime";
659
+ import { jsx as jsx15, jsxs as jsxs5 } from "react/jsx-runtime";
592
660
  function WhatIsAWallet() {
593
661
  return /* @__PURE__ */ jsxs5("div", { className: container5, children: [
594
- /* @__PURE__ */ jsx14(Heading, { as: "h2", children: "What is a Wallet" }),
662
+ /* @__PURE__ */ jsx15(Heading, { as: "h2", children: "What is a Wallet" }),
595
663
  /* @__PURE__ */ jsxs5("div", { className: content3, children: [
596
- /* @__PURE__ */ jsx14(InfoSection, { title: "Easy Login", children: "No need to create new accounts and passwords for every website. Just connect your wallet and get going." }),
597
- /* @__PURE__ */ jsx14(InfoSection, { title: "Store your Digital Assets", children: "Send, receive, store, and display your digital assets like NFTs & coins." })
664
+ /* @__PURE__ */ jsx15(InfoSection, { title: "Easy Login", children: "No need to create new accounts and passwords for every website. Just connect your wallet and get going." }),
665
+ /* @__PURE__ */ jsx15(InfoSection, { title: "Store your Digital Assets", children: "Send, receive, store, and display your digital assets like NFTs & coins." })
598
666
  ] })
599
667
  ] });
600
668
  }
@@ -605,9 +673,9 @@ function useWallets() {
605
673
  }
606
674
 
607
675
  // src/components/icons/IotaIcon.tsx
608
- import { jsx as jsx15 } from "react/jsx-runtime";
676
+ import { jsx as jsx16 } from "react/jsx-runtime";
609
677
  function IotaIcon(props) {
610
- return /* @__PURE__ */ jsx15(
678
+ return /* @__PURE__ */ jsx16(
611
679
  "svg",
612
680
  {
613
681
  xmlns: "http://www.w3.org/2000/svg",
@@ -616,7 +684,7 @@ function IotaIcon(props) {
616
684
  fill: "none",
617
685
  viewBox: "0 0 24 24",
618
686
  ...props,
619
- children: /* @__PURE__ */ jsx15(
687
+ children: /* @__PURE__ */ jsx16(
620
688
  "path",
621
689
  {
622
690
  fill: "#171d26",
@@ -641,27 +709,27 @@ var walletIcon2 = "WalletListItem_walletIcon__1vrvezk3";
641
709
  var walletItem = "WalletListItem_walletItem__1vrvezk1";
642
710
 
643
711
  // src/components/connect-modal/wallet-list/WalletListItem.tsx
644
- import { jsx as jsx16, jsxs as jsxs6 } from "react/jsx-runtime";
712
+ import { jsx as jsx17, jsxs as jsxs6 } from "react/jsx-runtime";
645
713
  function WalletListItem({ name, icon: icon2, onClick, isSelected = false }) {
646
- return /* @__PURE__ */ jsx16("li", { className: container7, children: /* @__PURE__ */ jsxs6(
714
+ return /* @__PURE__ */ jsx17("li", { className: container7, children: /* @__PURE__ */ jsxs6(
647
715
  "button",
648
716
  {
649
717
  className: clsx6(walletItem, { [selectedWalletItem]: isSelected }),
650
718
  type: "button",
651
719
  onClick,
652
720
  children: [
653
- typeof icon2 === "string" ? /* @__PURE__ */ jsx16("img", { className: walletIcon2, src: icon2, alt: `${name} logo` }) : icon2,
654
- /* @__PURE__ */ jsx16(Heading, { size: "md", truncate: true, asChild: true, children: /* @__PURE__ */ jsx16("div", { children: name }) })
721
+ typeof icon2 === "string" ? /* @__PURE__ */ jsx17("img", { className: walletIcon2, src: icon2, alt: `${name} logo` }) : icon2,
722
+ /* @__PURE__ */ jsx17(Heading, { size: "md", truncate: true, asChild: true, children: /* @__PURE__ */ jsx17("div", { children: name }) })
655
723
  ]
656
724
  }
657
725
  ) });
658
726
  }
659
727
 
660
728
  // src/components/connect-modal/wallet-list/WalletList.tsx
661
- import { jsx as jsx17 } from "react/jsx-runtime";
729
+ import { jsx as jsx18 } from "react/jsx-runtime";
662
730
  function WalletList({ selectedWalletName, onPlaceholderClick, onSelect }) {
663
731
  const wallets = useWallets();
664
- return /* @__PURE__ */ jsx17("ul", { className: container6, children: wallets.length > 0 ? wallets.map((wallet) => /* @__PURE__ */ jsx17(
732
+ return /* @__PURE__ */ jsx18("ul", { className: container6, children: wallets.length > 0 ? wallets.map((wallet) => /* @__PURE__ */ jsx18(
665
733
  WalletListItem,
666
734
  {
667
735
  name: wallet.name,
@@ -670,11 +738,11 @@ function WalletList({ selectedWalletName, onPlaceholderClick, onSelect }) {
670
738
  onClick: () => onSelect(wallet)
671
739
  },
672
740
  getWalletUniqueIdentifier(wallet)
673
- )) : /* @__PURE__ */ jsx17(
741
+ )) : /* @__PURE__ */ jsx18(
674
742
  WalletListItem,
675
743
  {
676
744
  name: "IOTA Wallet",
677
- icon: /* @__PURE__ */ jsx17(IotaIcon, { className: icon }),
745
+ icon: /* @__PURE__ */ jsx18(IotaIcon, { className: icon }),
678
746
  onClick: onPlaceholderClick,
679
747
  isSelected: true
680
748
  }
@@ -682,12 +750,20 @@ function WalletList({ selectedWalletName, onPlaceholderClick, onSelect }) {
682
750
  }
683
751
 
684
752
  // src/components/connect-modal/ConnectModal.tsx
685
- import { jsx as jsx18, jsxs as jsxs7 } from "react/jsx-runtime";
686
- function ConnectModal({ trigger, open, defaultOpen, onOpenChange }) {
687
- const [isModalOpen, setModalOpen] = useState(open ?? defaultOpen);
688
- const [currentView, setCurrentView] = useState();
689
- const [selectedWallet, setSelectedWallet] = useState();
690
- const { mutate, isError } = useConnectWallet();
753
+ import { jsx as jsx19, jsxs as jsxs7 } from "react/jsx-runtime";
754
+ function ConnectModal({
755
+ trigger,
756
+ open,
757
+ defaultOpen,
758
+ onOpenChange,
759
+ onConnected
760
+ }) {
761
+ const [isModalOpen, setModalOpen] = useState2(open ?? defaultOpen);
762
+ const [currentView, setCurrentView] = useState2();
763
+ const [selectedWallet, setSelectedWallet] = useState2();
764
+ const { mutate, isError } = useConnectWallet({
765
+ onConnected
766
+ });
691
767
  const resetSelection = () => {
692
768
  setSelectedWallet(void 0);
693
769
  setCurrentView(void 0);
@@ -711,13 +787,13 @@ function ConnectModal({ trigger, open, defaultOpen, onOpenChange }) {
711
787
  let modalContent;
712
788
  switch (currentView) {
713
789
  case "what-is-a-wallet":
714
- modalContent = /* @__PURE__ */ jsx18(WhatIsAWallet, {});
790
+ modalContent = /* @__PURE__ */ jsx19(WhatIsAWallet, {});
715
791
  break;
716
792
  case "getting-started":
717
- modalContent = /* @__PURE__ */ jsx18(GettingStarted, {});
793
+ modalContent = /* @__PURE__ */ jsx19(GettingStarted, {});
718
794
  break;
719
795
  case "connection-status":
720
- modalContent = /* @__PURE__ */ jsx18(
796
+ modalContent = /* @__PURE__ */ jsx19(
721
797
  ConnectionStatus,
722
798
  {
723
799
  selectedWallet,
@@ -727,11 +803,11 @@ function ConnectModal({ trigger, open, defaultOpen, onOpenChange }) {
727
803
  );
728
804
  break;
729
805
  default:
730
- modalContent = /* @__PURE__ */ jsx18(WhatIsAWallet, {});
806
+ modalContent = /* @__PURE__ */ jsx19(WhatIsAWallet, {});
731
807
  }
732
808
  return /* @__PURE__ */ jsxs7(Dialog.Root, { open: open ?? isModalOpen, onOpenChange: handleOpenChange, children: [
733
- /* @__PURE__ */ jsx18(Dialog.Trigger, { asChild: true, children: trigger }),
734
- /* @__PURE__ */ jsx18(Dialog.Portal, { children: /* @__PURE__ */ jsx18(StyleMarker, { children: /* @__PURE__ */ jsx18(Dialog.Overlay, { className: overlay, children: /* @__PURE__ */ jsxs7(Dialog.Content, { className: content, "aria-describedby": void 0, children: [
809
+ /* @__PURE__ */ jsx19(Dialog.Trigger, { asChild: true, children: trigger }),
810
+ /* @__PURE__ */ jsx19(Dialog.Portal, { children: /* @__PURE__ */ jsx19(StyleMarker, { children: /* @__PURE__ */ jsx19(Dialog.Overlay, { className: overlay, children: /* @__PURE__ */ jsxs7(Dialog.Content, { className: content, "aria-describedby": void 0, children: [
735
811
  /* @__PURE__ */ jsxs7(
736
812
  "div",
737
813
  {
@@ -740,8 +816,8 @@ function ConnectModal({ trigger, open, defaultOpen, onOpenChange }) {
740
816
  }),
741
817
  children: [
742
818
  /* @__PURE__ */ jsxs7("div", { className: walletListContent, children: [
743
- /* @__PURE__ */ jsx18(Dialog.Title, { className: title, asChild: true, children: /* @__PURE__ */ jsx18(Heading, { as: "h2", children: "Connect a Wallet" }) }),
744
- /* @__PURE__ */ jsx18(
819
+ /* @__PURE__ */ jsx19(Dialog.Title, { className: title, asChild: true, children: /* @__PURE__ */ jsx19(Heading, { as: "h2", children: "Connect a Wallet" }) }),
820
+ /* @__PURE__ */ jsx19(
745
821
  WalletList,
746
822
  {
747
823
  selectedWalletName: getWalletUniqueIdentifier(
@@ -757,7 +833,7 @@ function ConnectModal({ trigger, open, defaultOpen, onOpenChange }) {
757
833
  }
758
834
  )
759
835
  ] }),
760
- /* @__PURE__ */ jsx18(
836
+ /* @__PURE__ */ jsx19(
761
837
  "button",
762
838
  {
763
839
  className: whatIsAWalletButton,
@@ -776,36 +852,46 @@ function ConnectModal({ trigger, open, defaultOpen, onOpenChange }) {
776
852
  [selectedViewContainer]: !!currentView
777
853
  }),
778
854
  children: [
779
- /* @__PURE__ */ jsx18("div", { className: backButtonContainer, children: /* @__PURE__ */ jsx18(
855
+ /* @__PURE__ */ jsx19("div", { className: backButtonContainer, children: /* @__PURE__ */ jsx19(
780
856
  IconButton,
781
857
  {
782
858
  type: "button",
783
859
  "aria-label": "Back",
784
860
  onClick: () => resetSelection(),
785
- children: /* @__PURE__ */ jsx18(BackIcon, {})
861
+ children: /* @__PURE__ */ jsx19(BackIcon, {})
786
862
  }
787
863
  ) }),
788
864
  modalContent
789
865
  ]
790
866
  }
791
867
  ),
792
- /* @__PURE__ */ jsx18(Dialog.Close, { className: closeButtonContainer, asChild: true, children: /* @__PURE__ */ jsx18(IconButton, { type: "button", "aria-label": "Close", children: /* @__PURE__ */ jsx18(CloseIcon, {}) }) })
868
+ /* @__PURE__ */ jsx19(Dialog.Close, { className: closeButtonContainer, asChild: true, children: /* @__PURE__ */ jsx19(IconButton, { type: "button", "aria-label": "Close", children: /* @__PURE__ */ jsx19(CloseIcon, {}) }) })
793
869
  ] }) }) }) })
794
870
  ] });
795
871
  }
796
872
 
797
873
  // src/components/ConnectButton.tsx
798
- import { jsx as jsx19 } from "react/jsx-runtime";
874
+ import { jsx as jsx20 } from "react/jsx-runtime";
799
875
  function ConnectButton({
800
876
  connectText = "Connect Wallet",
801
877
  size,
878
+ iotaNamesEnabled = true,
879
+ onConnected,
802
880
  ...buttonProps
803
881
  }) {
804
882
  const currentAccount = useCurrentAccount();
805
- return currentAccount ? /* @__PURE__ */ jsx19(AccountDropdownMenu, { currentAccount, size }) : /* @__PURE__ */ jsx19(
883
+ return currentAccount ? /* @__PURE__ */ jsx20(
884
+ AccountDropdownMenu,
885
+ {
886
+ currentAccount,
887
+ size,
888
+ iotaNamesEnabled
889
+ }
890
+ ) : /* @__PURE__ */ jsx20(
806
891
  ConnectModal,
807
892
  {
808
- trigger: /* @__PURE__ */ jsx19(StyleMarker, { children: /* @__PURE__ */ jsx19(Button, { ...buttonProps, size, children: connectText }) })
893
+ onConnected,
894
+ trigger: /* @__PURE__ */ jsx20(StyleMarker, { children: /* @__PURE__ */ jsx20(Button, { ...buttonProps, size, children: connectText }) })
809
895
  }
810
896
  );
811
897
  }