@mysten/dapp-kit 0.3.0 → 0.5.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 (69) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +4 -4
  3. package/dist/cjs/components/AccountDropdownMenu.d.ts +4 -0
  4. package/dist/cjs/components/AccountDropdownMenu.js +116 -42
  5. package/dist/cjs/components/AccountDropdownMenu.js.map +4 -4
  6. package/dist/cjs/components/ConnectButton.js +183 -110
  7. package/dist/cjs/components/ConnectButton.js.map +4 -4
  8. package/dist/cjs/components/SuiClientProvider.d.ts +4 -4
  9. package/dist/cjs/components/SuiClientProvider.js +1 -0
  10. package/dist/cjs/components/SuiClientProvider.js.map +2 -2
  11. package/dist/cjs/components/WalletProvider.js +1 -2
  12. package/dist/cjs/components/WalletProvider.js.map +2 -2
  13. package/dist/cjs/hooks/networkConfig.d.ts +10 -0
  14. package/dist/cjs/hooks/networkConfig.js +74 -0
  15. package/dist/cjs/hooks/networkConfig.js.map +7 -0
  16. package/dist/cjs/hooks/useResolveSuiNSNames.d.ts +107 -0
  17. package/dist/cjs/hooks/useResolveSuiNSNames.js +83 -0
  18. package/dist/cjs/hooks/useResolveSuiNSNames.js.map +7 -0
  19. package/dist/cjs/hooks/useSuiClient.js.map +2 -2
  20. package/dist/cjs/hooks/useSuiClientInfiniteQuery.js.map +2 -2
  21. package/dist/cjs/hooks/useSuiClientMutation.js.map +2 -2
  22. package/dist/cjs/hooks/useSuiClientQuery.js.map +2 -2
  23. package/dist/cjs/hooks/wallet/useSignAndExecuteTransactionBlock.js.map +2 -2
  24. package/dist/cjs/hooks/wallet/useUnsafeBurnerWallet.js.map +2 -2
  25. package/dist/cjs/index.css +127 -127
  26. package/dist/cjs/index.css.map +3 -3
  27. package/dist/cjs/index.d.ts +13 -10
  28. package/dist/cjs/index.js +594 -529
  29. package/dist/cjs/index.js.map +4 -4
  30. package/dist/cjs/walletStore.js +1 -2
  31. package/dist/cjs/walletStore.js.map +2 -2
  32. package/dist/esm/components/AccountDropdownMenu.d.ts +4 -0
  33. package/dist/esm/components/AccountDropdownMenu.js +106 -32
  34. package/dist/esm/components/AccountDropdownMenu.js.map +4 -4
  35. package/dist/esm/components/ConnectButton.js +156 -83
  36. package/dist/esm/components/ConnectButton.js.map +4 -4
  37. package/dist/esm/components/SuiClientProvider.d.ts +4 -4
  38. package/dist/esm/components/SuiClientProvider.js +1 -0
  39. package/dist/esm/components/SuiClientProvider.js.map +2 -2
  40. package/dist/esm/components/WalletProvider.js +1 -2
  41. package/dist/esm/components/WalletProvider.js.map +2 -2
  42. package/dist/esm/hooks/networkConfig.d.ts +10 -0
  43. package/dist/esm/hooks/networkConfig.js +51 -0
  44. package/dist/esm/hooks/networkConfig.js.map +7 -0
  45. package/dist/esm/hooks/useResolveSuiNSNames.d.ts +107 -0
  46. package/dist/esm/hooks/useResolveSuiNSNames.js +60 -0
  47. package/dist/esm/hooks/useResolveSuiNSNames.js.map +7 -0
  48. package/dist/esm/hooks/useSuiClient.js.map +2 -2
  49. package/dist/esm/hooks/useSuiClientInfiniteQuery.js.map +2 -2
  50. package/dist/esm/hooks/useSuiClientMutation.js.map +2 -2
  51. package/dist/esm/hooks/useSuiClientQuery.js.map +2 -2
  52. package/dist/esm/hooks/wallet/useSignAndExecuteTransactionBlock.js.map +2 -2
  53. package/dist/esm/hooks/wallet/useUnsafeBurnerWallet.js.map +2 -2
  54. package/dist/esm/index.css +127 -127
  55. package/dist/esm/index.css.map +3 -3
  56. package/dist/esm/index.d.ts +13 -10
  57. package/dist/esm/index.js +609 -544
  58. package/dist/esm/index.js.map +4 -4
  59. package/dist/esm/walletStore.js +1 -2
  60. package/dist/esm/walletStore.js.map +2 -2
  61. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  62. package/dist/tsconfig.tsbuildinfo +1 -1
  63. package/package.json +1 -1
  64. package/src/components/AccountDropdownMenu.tsx +31 -9
  65. package/src/components/SuiClientProvider.tsx +11 -2
  66. package/src/hooks/networkConfig.ts +45 -0
  67. package/src/hooks/useResolveSuiNSNames.ts +31 -0
  68. package/src/index.ts +13 -10
  69. package/src/walletStore.ts +3 -4
@@ -70,6 +70,63 @@ import { formatAddress } from "@mysten/sui.js/utils";
70
70
  import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
71
71
  import clsx3 from "clsx";
72
72
 
73
+ // src/hooks/useSuiClientQuery.ts
74
+ import { useQuery } from "@tanstack/react-query";
75
+
76
+ // src/hooks/useSuiClient.ts
77
+ import { useContext as useContext2 } from "react";
78
+
79
+ // src/components/SuiClientProvider.tsx
80
+ import { getFullnodeUrl, isSuiClient, SuiClient } from "@mysten/sui.js/client";
81
+ import { createContext as createContext2, useMemo, useState } from "react";
82
+ import { jsx } from "react/jsx-runtime";
83
+ var SuiClientContext = createContext2(null);
84
+ var DEFAULT_NETWORKS = {
85
+ localnet: { url: getFullnodeUrl("localnet") }
86
+ };
87
+
88
+ // src/hooks/useSuiClient.ts
89
+ function useSuiClientContext() {
90
+ const suiClient = useContext2(SuiClientContext);
91
+ if (!suiClient) {
92
+ throw new Error(
93
+ "Could not find SuiClientContext. Ensure that you have set up the SuiClientProvider"
94
+ );
95
+ }
96
+ return suiClient;
97
+ }
98
+
99
+ // src/hooks/useSuiClientQuery.ts
100
+ function useSuiClientQuery(...args) {
101
+ const [method, params, { queryKey = [], ...options } = {}] = args;
102
+ const suiContext = useSuiClientContext();
103
+ return useQuery({
104
+ ...options,
105
+ queryKey: [suiContext.network, method, params, ...queryKey],
106
+ queryFn: async () => {
107
+ return await suiContext.client[method](params);
108
+ }
109
+ });
110
+ }
111
+
112
+ // src/hooks/useResolveSuiNSNames.ts
113
+ function useResolveSuiNSName(address, options) {
114
+ const { data, ...rest } = useSuiClientQuery(
115
+ "resolveNameServiceNames",
116
+ {
117
+ address,
118
+ limit: 1
119
+ },
120
+ {
121
+ refetchOnWindowFocus: false,
122
+ retry: false,
123
+ ...options,
124
+ enabled: !!address && options?.enabled !== false
125
+ }
126
+ );
127
+ return { data: data?.data?.[0] ?? null, ...rest };
128
+ }
129
+
73
130
  // src/hooks/wallet/useAccounts.ts
74
131
  function useAccounts() {
75
132
  return useWalletStore((state) => state.accounts);
@@ -165,9 +222,9 @@ var separator = "AccountDropdownMenu_separator__div2ql4";
165
222
  var switchAccountMenuItem = "AccountDropdownMenu_switchAccountMenuItem__div2ql3";
166
223
 
167
224
  // src/components/icons/CheckIcon.tsx
168
- import { jsx } from "react/jsx-runtime";
225
+ import { jsx as jsx2 } from "react/jsx-runtime";
169
226
  function CheckIcon(props) {
170
- return /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, fill: "none", ...props, children: /* @__PURE__ */ jsx(
227
+ return /* @__PURE__ */ jsx2("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, fill: "none", ...props, children: /* @__PURE__ */ jsx2(
171
228
  "path",
172
229
  {
173
230
  fill: "currentColor",
@@ -177,9 +234,9 @@ function CheckIcon(props) {
177
234
  }
178
235
 
179
236
  // src/components/icons/ChevronIcon.tsx
180
- import { jsx as jsx2 } from "react/jsx-runtime";
237
+ import { jsx as jsx3 } from "react/jsx-runtime";
181
238
  function ChevronIcon(props) {
182
- return /* @__PURE__ */ jsx2("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, fill: "none", ...props, children: /* @__PURE__ */ jsx2(
239
+ return /* @__PURE__ */ jsx3("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, fill: "none", ...props, children: /* @__PURE__ */ jsx3(
183
240
  "path",
184
241
  {
185
242
  stroke: "#A0B6C3",
@@ -202,8 +259,8 @@ var styleDataAttribute = { [styleDataAttributeName]: "" };
202
259
 
203
260
  // src/components/styling/StyleMarker.tsx
204
261
  var import_StyleMarker_css = __toESM(require_StyleMarker_css());
205
- import { jsx as jsx3 } from "react/jsx-runtime";
206
- var StyleMarker = forwardRef(({ children }, forwardedRef) => /* @__PURE__ */ jsx3(Slot, { ref: forwardedRef, ...styleDataAttribute, children }));
262
+ import { jsx as jsx4 } from "react/jsx-runtime";
263
+ var StyleMarker = forwardRef(({ children }, forwardedRef) => /* @__PURE__ */ jsx4(Slot, { ref: forwardedRef, ...styleDataAttribute, children }));
207
264
  StyleMarker.displayName = "StyleMarker";
208
265
 
209
266
  // src/components/ui/Button.tsx
@@ -216,11 +273,11 @@ import { createRuntimeFn as _7a468 } from "@vanilla-extract/recipes/createRuntim
216
273
  var buttonVariants = _7a468({ defaultClassName: "Button_buttonVariants__x1s81q0", variantClassNames: { variant: { primary: "Button_buttonVariants_variant_primary__x1s81q1", outline: "Button_buttonVariants_variant_outline__x1s81q2" }, size: { md: "Button_buttonVariants_size_md__x1s81q3", lg: "Button_buttonVariants_size_lg__x1s81q4" } }, defaultVariants: { variant: "primary", size: "md" }, compoundVariants: [] });
217
274
 
218
275
  // src/components/ui/Button.tsx
219
- import { jsx as jsx4 } from "react/jsx-runtime";
276
+ import { jsx as jsx5 } from "react/jsx-runtime";
220
277
  var Button = forwardRef2(
221
278
  ({ className, variant, size, asChild = false, ...props }, forwardedRef) => {
222
279
  const Comp = asChild ? Slot2 : "button";
223
- return /* @__PURE__ */ jsx4(
280
+ return /* @__PURE__ */ jsx5(
224
281
  Comp,
225
282
  {
226
283
  ...props,
@@ -242,7 +299,7 @@ import { createRuntimeFn as _7a4682 } from "@vanilla-extract/recipes/createRunti
242
299
  var textVariants = _7a4682({ defaultClassName: "Text__2bv1ur0", variantClassNames: { size: { sm: "Text_textVariants_size_sm__2bv1ur1" }, weight: { normal: "Text_textVariants_weight_normal__2bv1ur2", medium: "Text_textVariants_weight_medium__2bv1ur3", bold: "Text_textVariants_weight_bold__2bv1ur4" }, color: { muted: "Text_textVariants_color_muted__2bv1ur5", danger: "Text_textVariants_color_danger__2bv1ur6" }, mono: { true: "Text_textVariants_mono_true__2bv1ur7" } }, defaultVariants: { size: "sm", weight: "normal" }, compoundVariants: [] });
243
300
 
244
301
  // src/components/ui/Text.tsx
245
- import { jsx as jsx5 } from "react/jsx-runtime";
302
+ import { jsx as jsx6 } from "react/jsx-runtime";
246
303
  var Text = forwardRef3(
247
304
  ({
248
305
  children,
@@ -255,13 +312,13 @@ var Text = forwardRef3(
255
312
  mono,
256
313
  ...textProps
257
314
  }, forwardedRef) => {
258
- return /* @__PURE__ */ jsx5(
315
+ return /* @__PURE__ */ jsx6(
259
316
  Slot3,
260
317
  {
261
318
  ...textProps,
262
319
  ref: forwardedRef,
263
320
  className: clsx2(textVariants({ size, weight, color, mono }), className),
264
- children: asChild ? children : /* @__PURE__ */ jsx5(Tag, { children })
321
+ children: asChild ? children : /* @__PURE__ */ jsx6(Tag, { children })
265
322
  }
266
323
  );
267
324
  }
@@ -269,31 +326,29 @@ var Text = forwardRef3(
269
326
  Text.displayName = "Text";
270
327
 
271
328
  // src/components/AccountDropdownMenu.tsx
272
- import { jsx as jsx6, jsxs } from "react/jsx-runtime";
329
+ import { jsx as jsx7, jsxs } from "react/jsx-runtime";
273
330
  function AccountDropdownMenu({ currentAccount }) {
274
331
  const { mutate: disconnectWallet } = useDisconnectWallet();
275
- const { mutate: switchAccount } = useSwitchAccount();
332
+ const { data: domain } = useResolveSuiNSName(
333
+ currentAccount.label ? null : currentAccount.address
334
+ );
276
335
  const accounts = useAccounts();
277
336
  return /* @__PURE__ */ jsxs(DropdownMenu.Root, { modal: false, children: [
278
- /* @__PURE__ */ jsx6(StyleMarker, { children: /* @__PURE__ */ jsx6(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { size: "lg", className: connectedAccount, children: [
279
- /* @__PURE__ */ jsx6(Text, { mono: true, weight: "bold", children: formatAddress(currentAccount.address) }),
280
- /* @__PURE__ */ jsx6(ChevronIcon, {})
337
+ /* @__PURE__ */ jsx7(StyleMarker, { children: /* @__PURE__ */ jsx7(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { size: "lg", className: connectedAccount, children: [
338
+ /* @__PURE__ */ jsx7(Text, { mono: true, weight: "bold", children: currentAccount.label ?? domain ?? formatAddress(currentAccount.address) }),
339
+ /* @__PURE__ */ jsx7(ChevronIcon, {})
281
340
  ] }) }) }),
282
- /* @__PURE__ */ jsx6(DropdownMenu.Portal, { children: /* @__PURE__ */ jsx6(StyleMarker, { children: /* @__PURE__ */ jsxs(DropdownMenu.Content, { className: menuContent, children: [
283
- accounts.map((account) => /* @__PURE__ */ jsxs(
284
- DropdownMenu.Item,
341
+ /* @__PURE__ */ jsx7(DropdownMenu.Portal, { children: /* @__PURE__ */ jsx7(StyleMarker, { children: /* @__PURE__ */ jsxs(DropdownMenu.Content, { className: menuContent, children: [
342
+ accounts.map((account) => /* @__PURE__ */ jsx7(
343
+ AccountDropdownMenuItem,
285
344
  {
286
- className: clsx3(menuItem, switchAccountMenuItem),
287
- onSelect: () => switchAccount({ account }),
288
- children: [
289
- /* @__PURE__ */ jsx6(Text, { mono: true, children: formatAddress(account.address) }),
290
- currentAccount.address === account.address ? /* @__PURE__ */ jsx6(CheckIcon, {}) : null
291
- ]
345
+ account,
346
+ active: currentAccount.address === account.address
292
347
  },
293
348
  account.address
294
349
  )),
295
- /* @__PURE__ */ jsx6(DropdownMenu.Separator, { className: separator }),
296
- /* @__PURE__ */ jsx6(
350
+ /* @__PURE__ */ jsx7(DropdownMenu.Separator, { className: separator }),
351
+ /* @__PURE__ */ jsx7(
297
352
  DropdownMenu.Item,
298
353
  {
299
354
  className: clsx3(menuItem),
@@ -304,11 +359,29 @@ function AccountDropdownMenu({ currentAccount }) {
304
359
  ] }) }) })
305
360
  ] });
306
361
  }
362
+ function AccountDropdownMenuItem({
363
+ account,
364
+ active
365
+ }) {
366
+ const { mutate: switchAccount } = useSwitchAccount();
367
+ const { data: domain } = useResolveSuiNSName(account.label ? null : account.address);
368
+ return /* @__PURE__ */ jsxs(
369
+ DropdownMenu.Item,
370
+ {
371
+ className: clsx3(menuItem, switchAccountMenuItem),
372
+ onSelect: () => switchAccount({ account }),
373
+ children: [
374
+ /* @__PURE__ */ jsx7(Text, { mono: true, children: account.label ?? domain ?? formatAddress(account.address) }),
375
+ active ? /* @__PURE__ */ jsx7(CheckIcon, {}) : null
376
+ ]
377
+ }
378
+ );
379
+ }
307
380
 
308
381
  // src/components/connect-modal/ConnectModal.tsx
309
382
  import * as Dialog from "@radix-ui/react-dialog";
310
383
  import clsx7 from "clsx";
311
- import { useState } from "react";
384
+ import { useState as useState2 } from "react";
312
385
 
313
386
  // src/hooks/wallet/useConnectWallet.ts
314
387
  import { useMutation as useMutation3 } from "@tanstack/react-query";
@@ -343,9 +416,9 @@ function getSelectedAccount(connectedAccounts, accountAddress) {
343
416
  }
344
417
 
345
418
  // src/components/icons/BackIcon.tsx
346
- import { jsx as jsx7 } from "react/jsx-runtime";
419
+ import { jsx as jsx8 } from "react/jsx-runtime";
347
420
  function BackIcon(props) {
348
- return /* @__PURE__ */ jsx7("svg", { width: 24, height: 24, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx7(
421
+ return /* @__PURE__ */ jsx8("svg", { width: 24, height: 24, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx8(
349
422
  "path",
350
423
  {
351
424
  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",
@@ -355,9 +428,9 @@ function BackIcon(props) {
355
428
  }
356
429
 
357
430
  // src/components/icons/CloseIcon.tsx
358
- import { jsx as jsx8 } from "react/jsx-runtime";
431
+ import { jsx as jsx9 } from "react/jsx-runtime";
359
432
  function CloseIcon(props) {
360
- return /* @__PURE__ */ jsx8("svg", { width: 10, height: 10, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx8(
433
+ return /* @__PURE__ */ jsx9("svg", { width: 10, height: 10, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx9(
361
434
  "path",
362
435
  {
363
436
  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",
@@ -376,7 +449,7 @@ import { createRuntimeFn as _7a4683 } from "@vanilla-extract/recipes/createRunti
376
449
  var headingVariants = _7a4683({ defaultClassName: "Heading__1aa835k0", variantClassNames: { size: { sm: "Heading_headingVariants_size_sm__1aa835k1", md: "Heading_headingVariants_size_md__1aa835k2", lg: "Heading_headingVariants_size_lg__1aa835k3", xl: "Heading_headingVariants_size_xl__1aa835k4" }, weight: { normal: "Heading_headingVariants_weight_normal__1aa835k5", bold: "Heading_headingVariants_weight_bold__1aa835k6" }, truncate: { true: "Heading_headingVariants_truncate_true__1aa835k7" } }, defaultVariants: { size: "lg", weight: "bold" }, compoundVariants: [] });
377
450
 
378
451
  // src/components/ui/Heading.tsx
379
- import { jsx as jsx9 } from "react/jsx-runtime";
452
+ import { jsx as jsx10 } from "react/jsx-runtime";
380
453
  var Heading = forwardRef4(
381
454
  ({
382
455
  children,
@@ -388,13 +461,13 @@ var Heading = forwardRef4(
388
461
  truncate,
389
462
  ...headingProps
390
463
  }, forwardedRef) => {
391
- return /* @__PURE__ */ jsx9(
464
+ return /* @__PURE__ */ jsx10(
392
465
  Slot4,
393
466
  {
394
467
  ...headingProps,
395
468
  ref: forwardedRef,
396
469
  className: clsx4(headingVariants({ size, weight, truncate }), className),
397
- children: asChild ? children : /* @__PURE__ */ jsx9(Tag, { children })
470
+ children: asChild ? children : /* @__PURE__ */ jsx10(Tag, { children })
398
471
  }
399
472
  );
400
473
  }
@@ -410,11 +483,11 @@ import { forwardRef as forwardRef5 } from "react";
410
483
  var container = "IconButton_container__s6n7bq0";
411
484
 
412
485
  // src/components/ui/IconButton.tsx
413
- import { jsx as jsx10 } from "react/jsx-runtime";
486
+ import { jsx as jsx11 } from "react/jsx-runtime";
414
487
  var IconButton = forwardRef5(
415
488
  ({ className, asChild = false, ...props }, forwardedRef) => {
416
489
  const Comp = asChild ? Slot5 : "button";
417
- return /* @__PURE__ */ jsx10(Comp, { ...props, className: clsx5(container, className), ref: forwardedRef });
490
+ return /* @__PURE__ */ jsx11(Comp, { ...props, className: clsx5(container, className), ref: forwardedRef });
418
491
  }
419
492
  );
420
493
  IconButton.displayName = "Button";
@@ -440,14 +513,14 @@ var title2 = "ConnectionStatus_title__nckm2d2";
440
513
  var walletIcon = "ConnectionStatus_walletIcon__nckm2d1";
441
514
 
442
515
  // src/components/connect-modal/views/ConnectionStatus.tsx
443
- import { jsx as jsx11, jsxs as jsxs2 } from "react/jsx-runtime";
516
+ import { jsx as jsx12, jsxs as jsxs2 } from "react/jsx-runtime";
444
517
  function ConnectionStatus({
445
518
  selectedWallet,
446
519
  hadConnectionError,
447
520
  onRetryConnection
448
521
  }) {
449
522
  return /* @__PURE__ */ jsxs2("div", { className: container2, children: [
450
- /* @__PURE__ */ jsx11(
523
+ /* @__PURE__ */ jsx12(
451
524
  "img",
452
525
  {
453
526
  className: walletIcon,
@@ -455,12 +528,12 @@ function ConnectionStatus({
455
528
  alt: `${selectedWallet.name} logo`
456
529
  }
457
530
  ),
458
- /* @__PURE__ */ jsx11("div", { className: title2, children: /* @__PURE__ */ jsxs2(Heading, { as: "h2", size: "xl", children: [
531
+ /* @__PURE__ */ jsx12("div", { className: title2, children: /* @__PURE__ */ jsxs2(Heading, { as: "h2", size: "xl", children: [
459
532
  "Opening ",
460
533
  selectedWallet.name
461
534
  ] }) }),
462
- /* @__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..." }) }),
463
- hadConnectionError ? /* @__PURE__ */ jsx11("div", { className: retryButtonContainer, children: /* @__PURE__ */ jsx11(Button, { type: "button", variant: "outline", onClick: () => onRetryConnection(selectedWallet), children: "Retry Connection" }) }) : null
535
+ /* @__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..." }) }),
536
+ hadConnectionError ? /* @__PURE__ */ jsx12("div", { className: retryButtonContainer, children: /* @__PURE__ */ jsx12(Button, { type: "button", variant: "outline", onClick: () => onRetryConnection(selectedWallet), children: "Retry Connection" }) }) : null
464
537
  ] });
465
538
  }
466
539
 
@@ -468,11 +541,11 @@ function ConnectionStatus({
468
541
  var container3 = "InfoSection_container__1wtioi70";
469
542
 
470
543
  // src/components/connect-modal/InfoSection.tsx
471
- import { jsx as jsx12, jsxs as jsxs3 } from "react/jsx-runtime";
544
+ import { jsx as jsx13, jsxs as jsxs3 } from "react/jsx-runtime";
472
545
  function InfoSection({ title: title3, children }) {
473
546
  return /* @__PURE__ */ jsxs3("section", { className: container3, children: [
474
- /* @__PURE__ */ jsx12(Heading, { as: "h3", size: "sm", weight: "normal", children: title3 }),
475
- /* @__PURE__ */ jsx12(Text, { weight: "medium", color: "muted", children })
547
+ /* @__PURE__ */ jsx13(Heading, { as: "h3", size: "sm", weight: "normal", children: title3 }),
548
+ /* @__PURE__ */ jsx13(Text, { weight: "medium", color: "muted", children })
476
549
  ] });
477
550
  }
478
551
 
@@ -482,15 +555,15 @@ var content2 = "GettingStarted_content__1fp07e11";
482
555
  var installButtonContainer = "GettingStarted_installButtonContainer__1fp07e12";
483
556
 
484
557
  // src/components/connect-modal/views/GettingStarted.tsx
485
- import { jsx as jsx13, jsxs as jsxs4 } from "react/jsx-runtime";
558
+ import { jsx as jsx14, jsxs as jsxs4 } from "react/jsx-runtime";
486
559
  function GettingStarted() {
487
560
  return /* @__PURE__ */ jsxs4("div", { className: container4, children: [
488
- /* @__PURE__ */ jsx13(Heading, { as: "h2", children: "Get Started with Sui" }),
561
+ /* @__PURE__ */ jsx14(Heading, { as: "h2", children: "Get Started with Sui" }),
489
562
  /* @__PURE__ */ jsxs4("div", { className: content2, children: [
490
- /* @__PURE__ */ jsx13(InfoSection, { title: "Install the Sui Wallet Extension", children: "We recommend pinning Sui Wallet to your taskbar for quicker access." }),
491
- /* @__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." }),
492
- /* @__PURE__ */ jsx13(InfoSection, { title: "Refresh Your Browser", children: "Once you set up your wallet, refresh this window browser to load up the extension." }),
493
- /* @__PURE__ */ jsx13("div", { className: installButtonContainer, children: /* @__PURE__ */ jsx13(Button, { variant: "outline", asChild: true, children: /* @__PURE__ */ jsx13(
563
+ /* @__PURE__ */ jsx14(InfoSection, { title: "Install the Sui Wallet Extension", children: "We recommend pinning Sui Wallet to your taskbar for quicker access." }),
564
+ /* @__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." }),
565
+ /* @__PURE__ */ jsx14(InfoSection, { title: "Refresh Your Browser", children: "Once you set up your wallet, refresh this window browser to load up the extension." }),
566
+ /* @__PURE__ */ jsx14("div", { className: installButtonContainer, children: /* @__PURE__ */ jsx14(Button, { variant: "outline", asChild: true, children: /* @__PURE__ */ jsx14(
494
567
  "a",
495
568
  {
496
569
  href: "https://chrome.google.com/webstore/detail/sui-wallet/opcgpfmipidbgpenhmajoajpbobppdil",
@@ -508,13 +581,13 @@ var container5 = "WhatIsAWallet_container__1ktpkq90";
508
581
  var content3 = "WhatIsAWallet_content__1ktpkq91";
509
582
 
510
583
  // src/components/connect-modal/views/WhatIsAWallet.tsx
511
- import { jsx as jsx14, jsxs as jsxs5 } from "react/jsx-runtime";
584
+ import { jsx as jsx15, jsxs as jsxs5 } from "react/jsx-runtime";
512
585
  function WhatIsAWallet() {
513
586
  return /* @__PURE__ */ jsxs5("div", { className: container5, children: [
514
- /* @__PURE__ */ jsx14(Heading, { as: "h2", children: "What is a Wallet" }),
587
+ /* @__PURE__ */ jsx15(Heading, { as: "h2", children: "What is a Wallet" }),
515
588
  /* @__PURE__ */ jsxs5("div", { className: content3, children: [
516
- /* @__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." }),
517
- /* @__PURE__ */ jsx14(InfoSection, { title: "Store your Digital Assets", children: "Send, receive, store, and display your digital assets like NFTs & coins." })
589
+ /* @__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." }),
590
+ /* @__PURE__ */ jsx15(InfoSection, { title: "Store your Digital Assets", children: "Send, receive, store, and display your digital assets like NFTs & coins." })
518
591
  ] })
519
592
  ] });
520
593
  }
@@ -525,11 +598,11 @@ function useWallets() {
525
598
  }
526
599
 
527
600
  // src/components/icons/SuiIcon.tsx
528
- import { jsx as jsx15, jsxs as jsxs6 } from "react/jsx-runtime";
601
+ import { jsx as jsx16, jsxs as jsxs6 } from "react/jsx-runtime";
529
602
  function SuiIcon(props) {
530
603
  return /* @__PURE__ */ jsxs6("svg", { width: 28, height: 28, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
531
- /* @__PURE__ */ jsx15("rect", { width: 28, height: 28, rx: 6, fill: "#6FBCF0" }),
532
- /* @__PURE__ */ jsx15(
604
+ /* @__PURE__ */ jsx16("rect", { width: 28, height: 28, rx: 6, fill: "#6FBCF0" }),
605
+ /* @__PURE__ */ jsx16(
533
606
  "path",
534
607
  {
535
608
  fillRule: "evenodd",
@@ -554,27 +627,27 @@ var walletIcon2 = "WalletListItem_walletIcon__1dqqtqs3";
554
627
  var walletItem = "WalletListItem_walletItem__1dqqtqs1";
555
628
 
556
629
  // src/components/connect-modal/wallet-list/WalletListItem.tsx
557
- import { jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
630
+ import { jsx as jsx17, jsxs as jsxs7 } from "react/jsx-runtime";
558
631
  function WalletListItem({ name, icon, onClick, isSelected = false }) {
559
- return /* @__PURE__ */ jsx16("li", { className: container7, children: /* @__PURE__ */ jsxs7(
632
+ return /* @__PURE__ */ jsx17("li", { className: container7, children: /* @__PURE__ */ jsxs7(
560
633
  "button",
561
634
  {
562
635
  className: clsx6(walletItem, { [selectedWalletItem]: isSelected }),
563
636
  type: "button",
564
637
  onClick,
565
638
  children: [
566
- typeof icon === "string" ? /* @__PURE__ */ jsx16("img", { className: walletIcon2, src: icon, alt: `${name} logo` }) : icon,
567
- /* @__PURE__ */ jsx16(Heading, { size: "md", truncate: true, asChild: true, children: /* @__PURE__ */ jsx16("div", { children: name }) })
639
+ typeof icon === "string" ? /* @__PURE__ */ jsx17("img", { className: walletIcon2, src: icon, alt: `${name} logo` }) : icon,
640
+ /* @__PURE__ */ jsx17(Heading, { size: "md", truncate: true, asChild: true, children: /* @__PURE__ */ jsx17("div", { children: name }) })
568
641
  ]
569
642
  }
570
643
  ) });
571
644
  }
572
645
 
573
646
  // src/components/connect-modal/wallet-list/WalletList.tsx
574
- import { jsx as jsx17 } from "react/jsx-runtime";
647
+ import { jsx as jsx18 } from "react/jsx-runtime";
575
648
  function WalletList({ selectedWalletName, onPlaceholderClick, onSelect }) {
576
649
  const wallets = useWallets();
577
- return /* @__PURE__ */ jsx17("ul", { className: container6, children: wallets.length > 0 ? wallets.map((wallet) => /* @__PURE__ */ jsx17(
650
+ return /* @__PURE__ */ jsx18("ul", { className: container6, children: wallets.length > 0 ? wallets.map((wallet) => /* @__PURE__ */ jsx18(
578
651
  WalletListItem,
579
652
  {
580
653
  name: wallet.name,
@@ -583,11 +656,11 @@ function WalletList({ selectedWalletName, onPlaceholderClick, onSelect }) {
583
656
  onClick: () => onSelect(wallet)
584
657
  },
585
658
  wallet.name
586
- )) : /* @__PURE__ */ jsx17(
659
+ )) : /* @__PURE__ */ jsx18(
587
660
  WalletListItem,
588
661
  {
589
662
  name: "Sui Wallet",
590
- icon: /* @__PURE__ */ jsx17(SuiIcon, {}),
663
+ icon: /* @__PURE__ */ jsx18(SuiIcon, {}),
591
664
  onClick: onPlaceholderClick,
592
665
  isSelected: true
593
666
  }
@@ -595,11 +668,11 @@ function WalletList({ selectedWalletName, onPlaceholderClick, onSelect }) {
595
668
  }
596
669
 
597
670
  // src/components/connect-modal/ConnectModal.tsx
598
- import { jsx as jsx18, jsxs as jsxs8 } from "react/jsx-runtime";
671
+ import { jsx as jsx19, jsxs as jsxs8 } from "react/jsx-runtime";
599
672
  function ConnectModal({ trigger, open, defaultOpen, onOpenChange }) {
600
- const [isModalOpen, setModalOpen] = useState(open ?? defaultOpen);
601
- const [currentView, setCurrentView] = useState();
602
- const [selectedWallet, setSelectedWallet] = useState();
673
+ const [isModalOpen, setModalOpen] = useState2(open ?? defaultOpen);
674
+ const [currentView, setCurrentView] = useState2();
675
+ const [selectedWallet, setSelectedWallet] = useState2();
603
676
  const { mutate, isError } = useConnectWallet();
604
677
  const resetSelection = () => {
605
678
  setSelectedWallet(void 0);
@@ -624,13 +697,13 @@ function ConnectModal({ trigger, open, defaultOpen, onOpenChange }) {
624
697
  let modalContent;
625
698
  switch (currentView) {
626
699
  case "what-is-a-wallet":
627
- modalContent = /* @__PURE__ */ jsx18(WhatIsAWallet, {});
700
+ modalContent = /* @__PURE__ */ jsx19(WhatIsAWallet, {});
628
701
  break;
629
702
  case "getting-started":
630
- modalContent = /* @__PURE__ */ jsx18(GettingStarted, {});
703
+ modalContent = /* @__PURE__ */ jsx19(GettingStarted, {});
631
704
  break;
632
705
  case "connection-status":
633
- modalContent = /* @__PURE__ */ jsx18(
706
+ modalContent = /* @__PURE__ */ jsx19(
634
707
  ConnectionStatus,
635
708
  {
636
709
  selectedWallet,
@@ -640,11 +713,11 @@ function ConnectModal({ trigger, open, defaultOpen, onOpenChange }) {
640
713
  );
641
714
  break;
642
715
  default:
643
- modalContent = /* @__PURE__ */ jsx18(WhatIsAWallet, {});
716
+ modalContent = /* @__PURE__ */ jsx19(WhatIsAWallet, {});
644
717
  }
645
718
  return /* @__PURE__ */ jsxs8(Dialog.Root, { open: open ?? isModalOpen, onOpenChange: handleOpenChange, children: [
646
- /* @__PURE__ */ jsx18(StyleMarker, { children: /* @__PURE__ */ jsx18(Dialog.Trigger, { asChild: true, children: trigger }) }),
647
- /* @__PURE__ */ jsx18(Dialog.Portal, { children: /* @__PURE__ */ jsx18(StyleMarker, { children: /* @__PURE__ */ jsx18(Dialog.Overlay, { className: overlay, children: /* @__PURE__ */ jsxs8(Dialog.Content, { className: content, "aria-describedby": void 0, children: [
719
+ /* @__PURE__ */ jsx19(StyleMarker, { children: /* @__PURE__ */ jsx19(Dialog.Trigger, { asChild: true, children: trigger }) }),
720
+ /* @__PURE__ */ jsx19(Dialog.Portal, { children: /* @__PURE__ */ jsx19(StyleMarker, { children: /* @__PURE__ */ jsx19(Dialog.Overlay, { className: overlay, children: /* @__PURE__ */ jsxs8(Dialog.Content, { className: content, "aria-describedby": void 0, children: [
648
721
  /* @__PURE__ */ jsxs8(
649
722
  "div",
650
723
  {
@@ -653,8 +726,8 @@ function ConnectModal({ trigger, open, defaultOpen, onOpenChange }) {
653
726
  }),
654
727
  children: [
655
728
  /* @__PURE__ */ jsxs8("div", { className: walletListContent, children: [
656
- /* @__PURE__ */ jsx18(Dialog.Title, { className: title, asChild: true, children: /* @__PURE__ */ jsx18(Heading, { as: "h2", children: "Connect a Wallet" }) }),
657
- /* @__PURE__ */ jsx18(
729
+ /* @__PURE__ */ jsx19(Dialog.Title, { className: title, asChild: true, children: /* @__PURE__ */ jsx19(Heading, { as: "h2", children: "Connect a Wallet" }) }),
730
+ /* @__PURE__ */ jsx19(
658
731
  WalletList,
659
732
  {
660
733
  selectedWalletName: selectedWallet?.name,
@@ -668,7 +741,7 @@ function ConnectModal({ trigger, open, defaultOpen, onOpenChange }) {
668
741
  }
669
742
  )
670
743
  ] }),
671
- /* @__PURE__ */ jsx18(
744
+ /* @__PURE__ */ jsx19(
672
745
  "button",
673
746
  {
674
747
  className: whatIsAWalletButton,
@@ -687,24 +760,24 @@ function ConnectModal({ trigger, open, defaultOpen, onOpenChange }) {
687
760
  [selectedViewContainer]: !!currentView
688
761
  }),
689
762
  children: [
690
- /* @__PURE__ */ jsx18("div", { className: backButtonContainer, children: /* @__PURE__ */ jsx18(IconButton, { type: "button", "aria-label": "Back", onClick: () => resetSelection(), children: /* @__PURE__ */ jsx18(BackIcon, {}) }) }),
763
+ /* @__PURE__ */ jsx19("div", { className: backButtonContainer, children: /* @__PURE__ */ jsx19(IconButton, { type: "button", "aria-label": "Back", onClick: () => resetSelection(), children: /* @__PURE__ */ jsx19(BackIcon, {}) }) }),
691
764
  modalContent
692
765
  ]
693
766
  }
694
767
  ),
695
- /* @__PURE__ */ jsx18(Dialog.Close, { className: closeButtonContainer, asChild: true, children: /* @__PURE__ */ jsx18(IconButton, { type: "button", "aria-label": "Close", children: /* @__PURE__ */ jsx18(CloseIcon, {}) }) })
768
+ /* @__PURE__ */ jsx19(Dialog.Close, { className: closeButtonContainer, asChild: true, children: /* @__PURE__ */ jsx19(IconButton, { type: "button", "aria-label": "Close", children: /* @__PURE__ */ jsx19(CloseIcon, {}) }) })
696
769
  ] }) }) }) })
697
770
  ] });
698
771
  }
699
772
 
700
773
  // src/components/ConnectButton.tsx
701
- import { jsx as jsx19 } from "react/jsx-runtime";
774
+ import { jsx as jsx20 } from "react/jsx-runtime";
702
775
  function ConnectButton({
703
776
  connectText = "Connect Wallet",
704
777
  ...buttonProps
705
778
  }) {
706
779
  const currentAccount = useCurrentAccount();
707
- return currentAccount ? /* @__PURE__ */ jsx19(AccountDropdownMenu, { currentAccount }) : /* @__PURE__ */ jsx19(ConnectModal, { trigger: /* @__PURE__ */ jsx19(Button, { ...buttonProps, children: connectText }) });
780
+ return currentAccount ? /* @__PURE__ */ jsx20(AccountDropdownMenu, { currentAccount }) : /* @__PURE__ */ jsx20(ConnectModal, { trigger: /* @__PURE__ */ jsx20(Button, { ...buttonProps, children: connectText }) });
708
781
  }
709
782
  export {
710
783
  ConnectButton