@mysten/dapp-kit 0.3.0 → 0.4.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.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/components/AccountDropdownMenu.js +94 -35
- package/dist/cjs/components/AccountDropdownMenu.js.map +4 -4
- package/dist/cjs/components/ConnectButton.js +163 -104
- package/dist/cjs/components/ConnectButton.js.map +4 -4
- package/dist/cjs/components/WalletProvider.js +1 -2
- package/dist/cjs/components/WalletProvider.js.map +2 -2
- package/dist/cjs/hooks/useResolveSuiNSNames.d.ts +105 -0
- package/dist/cjs/hooks/useResolveSuiNSNames.js +82 -0
- package/dist/cjs/hooks/useResolveSuiNSNames.js.map +7 -0
- package/dist/cjs/index.js +51 -32
- package/dist/cjs/index.js.map +4 -4
- package/dist/cjs/walletStore.js +1 -2
- package/dist/cjs/walletStore.js.map +2 -2
- package/dist/esm/components/AccountDropdownMenu.js +83 -24
- package/dist/esm/components/AccountDropdownMenu.js.map +4 -4
- package/dist/esm/components/ConnectButton.js +135 -76
- package/dist/esm/components/ConnectButton.js.map +4 -4
- package/dist/esm/components/WalletProvider.js +1 -2
- package/dist/esm/components/WalletProvider.js.map +2 -2
- package/dist/esm/hooks/useResolveSuiNSNames.d.ts +105 -0
- package/dist/esm/hooks/useResolveSuiNSNames.js +59 -0
- package/dist/esm/hooks/useResolveSuiNSNames.js.map +7 -0
- package/dist/esm/index.js +37 -18
- package/dist/esm/index.js.map +3 -3
- package/dist/esm/walletStore.js +1 -2
- package/dist/esm/walletStore.js.map +2 -2
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/AccountDropdownMenu.tsx +6 -2
- package/src/hooks/useResolveSuiNSNames.ts +21 -0
- package/src/walletStore.ts +3 -4
|
@@ -70,6 +70,62 @@ 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) {
|
|
114
|
+
const { data, ...rest } = useSuiClientQuery(
|
|
115
|
+
"resolveNameServiceNames",
|
|
116
|
+
{
|
|
117
|
+
address,
|
|
118
|
+
limit: 1
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
enabled: !!address,
|
|
122
|
+
refetchOnWindowFocus: false,
|
|
123
|
+
retry: false
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
return { data: data?.data?.[0] ?? null, ...rest };
|
|
127
|
+
}
|
|
128
|
+
|
|
73
129
|
// src/hooks/wallet/useAccounts.ts
|
|
74
130
|
function useAccounts() {
|
|
75
131
|
return useWalletStore((state) => state.accounts);
|
|
@@ -165,9 +221,9 @@ var separator = "AccountDropdownMenu_separator__div2ql4";
|
|
|
165
221
|
var switchAccountMenuItem = "AccountDropdownMenu_switchAccountMenuItem__div2ql3";
|
|
166
222
|
|
|
167
223
|
// src/components/icons/CheckIcon.tsx
|
|
168
|
-
import { jsx } from "react/jsx-runtime";
|
|
224
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
169
225
|
function CheckIcon(props) {
|
|
170
|
-
return /* @__PURE__ */
|
|
226
|
+
return /* @__PURE__ */ jsx2("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, fill: "none", ...props, children: /* @__PURE__ */ jsx2(
|
|
171
227
|
"path",
|
|
172
228
|
{
|
|
173
229
|
fill: "currentColor",
|
|
@@ -177,9 +233,9 @@ function CheckIcon(props) {
|
|
|
177
233
|
}
|
|
178
234
|
|
|
179
235
|
// src/components/icons/ChevronIcon.tsx
|
|
180
|
-
import { jsx as
|
|
236
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
181
237
|
function ChevronIcon(props) {
|
|
182
|
-
return /* @__PURE__ */
|
|
238
|
+
return /* @__PURE__ */ jsx3("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, fill: "none", ...props, children: /* @__PURE__ */ jsx3(
|
|
183
239
|
"path",
|
|
184
240
|
{
|
|
185
241
|
stroke: "#A0B6C3",
|
|
@@ -202,8 +258,8 @@ var styleDataAttribute = { [styleDataAttributeName]: "" };
|
|
|
202
258
|
|
|
203
259
|
// src/components/styling/StyleMarker.tsx
|
|
204
260
|
var import_StyleMarker_css = __toESM(require_StyleMarker_css());
|
|
205
|
-
import { jsx as
|
|
206
|
-
var StyleMarker = forwardRef(({ children }, forwardedRef) => /* @__PURE__ */
|
|
261
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
262
|
+
var StyleMarker = forwardRef(({ children }, forwardedRef) => /* @__PURE__ */ jsx4(Slot, { ref: forwardedRef, ...styleDataAttribute, children }));
|
|
207
263
|
StyleMarker.displayName = "StyleMarker";
|
|
208
264
|
|
|
209
265
|
// src/components/ui/Button.tsx
|
|
@@ -216,11 +272,11 @@ import { createRuntimeFn as _7a468 } from "@vanilla-extract/recipes/createRuntim
|
|
|
216
272
|
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
273
|
|
|
218
274
|
// src/components/ui/Button.tsx
|
|
219
|
-
import { jsx as
|
|
275
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
220
276
|
var Button = forwardRef2(
|
|
221
277
|
({ className, variant, size, asChild = false, ...props }, forwardedRef) => {
|
|
222
278
|
const Comp = asChild ? Slot2 : "button";
|
|
223
|
-
return /* @__PURE__ */
|
|
279
|
+
return /* @__PURE__ */ jsx5(
|
|
224
280
|
Comp,
|
|
225
281
|
{
|
|
226
282
|
...props,
|
|
@@ -242,7 +298,7 @@ import { createRuntimeFn as _7a4682 } from "@vanilla-extract/recipes/createRunti
|
|
|
242
298
|
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
299
|
|
|
244
300
|
// src/components/ui/Text.tsx
|
|
245
|
-
import { jsx as
|
|
301
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
246
302
|
var Text = forwardRef3(
|
|
247
303
|
({
|
|
248
304
|
children,
|
|
@@ -255,13 +311,13 @@ var Text = forwardRef3(
|
|
|
255
311
|
mono,
|
|
256
312
|
...textProps
|
|
257
313
|
}, forwardedRef) => {
|
|
258
|
-
return /* @__PURE__ */
|
|
314
|
+
return /* @__PURE__ */ jsx6(
|
|
259
315
|
Slot3,
|
|
260
316
|
{
|
|
261
317
|
...textProps,
|
|
262
318
|
ref: forwardedRef,
|
|
263
319
|
className: clsx2(textVariants({ size, weight, color, mono }), className),
|
|
264
|
-
children: asChild ? children : /* @__PURE__ */
|
|
320
|
+
children: asChild ? children : /* @__PURE__ */ jsx6(Tag, { children })
|
|
265
321
|
}
|
|
266
322
|
);
|
|
267
323
|
}
|
|
@@ -269,31 +325,34 @@ var Text = forwardRef3(
|
|
|
269
325
|
Text.displayName = "Text";
|
|
270
326
|
|
|
271
327
|
// src/components/AccountDropdownMenu.tsx
|
|
272
|
-
import { jsx as
|
|
328
|
+
import { jsx as jsx7, jsxs } from "react/jsx-runtime";
|
|
273
329
|
function AccountDropdownMenu({ currentAccount }) {
|
|
274
330
|
const { mutate: disconnectWallet } = useDisconnectWallet();
|
|
275
331
|
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__ */
|
|
279
|
-
/* @__PURE__ */
|
|
280
|
-
/* @__PURE__ */
|
|
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__ */
|
|
341
|
+
/* @__PURE__ */ jsx7(DropdownMenu.Portal, { children: /* @__PURE__ */ jsx7(StyleMarker, { children: /* @__PURE__ */ jsxs(DropdownMenu.Content, { className: menuContent, children: [
|
|
283
342
|
accounts.map((account) => /* @__PURE__ */ jsxs(
|
|
284
343
|
DropdownMenu.Item,
|
|
285
344
|
{
|
|
286
345
|
className: clsx3(menuItem, switchAccountMenuItem),
|
|
287
346
|
onSelect: () => switchAccount({ account }),
|
|
288
347
|
children: [
|
|
289
|
-
/* @__PURE__ */
|
|
290
|
-
currentAccount.address === account.address ? /* @__PURE__ */
|
|
348
|
+
/* @__PURE__ */ jsx7(Text, { mono: true, children: account.label ?? formatAddress(account.address) }),
|
|
349
|
+
currentAccount.address === account.address ? /* @__PURE__ */ jsx7(CheckIcon, {}) : null
|
|
291
350
|
]
|
|
292
351
|
},
|
|
293
352
|
account.address
|
|
294
353
|
)),
|
|
295
|
-
/* @__PURE__ */
|
|
296
|
-
/* @__PURE__ */
|
|
354
|
+
/* @__PURE__ */ jsx7(DropdownMenu.Separator, { className: separator }),
|
|
355
|
+
/* @__PURE__ */ jsx7(
|
|
297
356
|
DropdownMenu.Item,
|
|
298
357
|
{
|
|
299
358
|
className: clsx3(menuItem),
|
|
@@ -308,7 +367,7 @@ function AccountDropdownMenu({ currentAccount }) {
|
|
|
308
367
|
// src/components/connect-modal/ConnectModal.tsx
|
|
309
368
|
import * as Dialog from "@radix-ui/react-dialog";
|
|
310
369
|
import clsx7 from "clsx";
|
|
311
|
-
import { useState } from "react";
|
|
370
|
+
import { useState as useState2 } from "react";
|
|
312
371
|
|
|
313
372
|
// src/hooks/wallet/useConnectWallet.ts
|
|
314
373
|
import { useMutation as useMutation3 } from "@tanstack/react-query";
|
|
@@ -343,9 +402,9 @@ function getSelectedAccount(connectedAccounts, accountAddress) {
|
|
|
343
402
|
}
|
|
344
403
|
|
|
345
404
|
// src/components/icons/BackIcon.tsx
|
|
346
|
-
import { jsx as
|
|
405
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
347
406
|
function BackIcon(props) {
|
|
348
|
-
return /* @__PURE__ */
|
|
407
|
+
return /* @__PURE__ */ jsx8("svg", { width: 24, height: 24, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx8(
|
|
349
408
|
"path",
|
|
350
409
|
{
|
|
351
410
|
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 +414,9 @@ function BackIcon(props) {
|
|
|
355
414
|
}
|
|
356
415
|
|
|
357
416
|
// src/components/icons/CloseIcon.tsx
|
|
358
|
-
import { jsx as
|
|
417
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
359
418
|
function CloseIcon(props) {
|
|
360
|
-
return /* @__PURE__ */
|
|
419
|
+
return /* @__PURE__ */ jsx9("svg", { width: 10, height: 10, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx9(
|
|
361
420
|
"path",
|
|
362
421
|
{
|
|
363
422
|
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 +435,7 @@ import { createRuntimeFn as _7a4683 } from "@vanilla-extract/recipes/createRunti
|
|
|
376
435
|
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
436
|
|
|
378
437
|
// src/components/ui/Heading.tsx
|
|
379
|
-
import { jsx as
|
|
438
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
380
439
|
var Heading = forwardRef4(
|
|
381
440
|
({
|
|
382
441
|
children,
|
|
@@ -388,13 +447,13 @@ var Heading = forwardRef4(
|
|
|
388
447
|
truncate,
|
|
389
448
|
...headingProps
|
|
390
449
|
}, forwardedRef) => {
|
|
391
|
-
return /* @__PURE__ */
|
|
450
|
+
return /* @__PURE__ */ jsx10(
|
|
392
451
|
Slot4,
|
|
393
452
|
{
|
|
394
453
|
...headingProps,
|
|
395
454
|
ref: forwardedRef,
|
|
396
455
|
className: clsx4(headingVariants({ size, weight, truncate }), className),
|
|
397
|
-
children: asChild ? children : /* @__PURE__ */
|
|
456
|
+
children: asChild ? children : /* @__PURE__ */ jsx10(Tag, { children })
|
|
398
457
|
}
|
|
399
458
|
);
|
|
400
459
|
}
|
|
@@ -410,11 +469,11 @@ import { forwardRef as forwardRef5 } from "react";
|
|
|
410
469
|
var container = "IconButton_container__s6n7bq0";
|
|
411
470
|
|
|
412
471
|
// src/components/ui/IconButton.tsx
|
|
413
|
-
import { jsx as
|
|
472
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
414
473
|
var IconButton = forwardRef5(
|
|
415
474
|
({ className, asChild = false, ...props }, forwardedRef) => {
|
|
416
475
|
const Comp = asChild ? Slot5 : "button";
|
|
417
|
-
return /* @__PURE__ */
|
|
476
|
+
return /* @__PURE__ */ jsx11(Comp, { ...props, className: clsx5(container, className), ref: forwardedRef });
|
|
418
477
|
}
|
|
419
478
|
);
|
|
420
479
|
IconButton.displayName = "Button";
|
|
@@ -440,14 +499,14 @@ var title2 = "ConnectionStatus_title__nckm2d2";
|
|
|
440
499
|
var walletIcon = "ConnectionStatus_walletIcon__nckm2d1";
|
|
441
500
|
|
|
442
501
|
// src/components/connect-modal/views/ConnectionStatus.tsx
|
|
443
|
-
import { jsx as
|
|
502
|
+
import { jsx as jsx12, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
444
503
|
function ConnectionStatus({
|
|
445
504
|
selectedWallet,
|
|
446
505
|
hadConnectionError,
|
|
447
506
|
onRetryConnection
|
|
448
507
|
}) {
|
|
449
508
|
return /* @__PURE__ */ jsxs2("div", { className: container2, children: [
|
|
450
|
-
/* @__PURE__ */
|
|
509
|
+
/* @__PURE__ */ jsx12(
|
|
451
510
|
"img",
|
|
452
511
|
{
|
|
453
512
|
className: walletIcon,
|
|
@@ -455,12 +514,12 @@ function ConnectionStatus({
|
|
|
455
514
|
alt: `${selectedWallet.name} logo`
|
|
456
515
|
}
|
|
457
516
|
),
|
|
458
|
-
/* @__PURE__ */
|
|
517
|
+
/* @__PURE__ */ jsx12("div", { className: title2, children: /* @__PURE__ */ jsxs2(Heading, { as: "h2", size: "xl", children: [
|
|
459
518
|
"Opening ",
|
|
460
519
|
selectedWallet.name
|
|
461
520
|
] }) }),
|
|
462
|
-
/* @__PURE__ */
|
|
463
|
-
hadConnectionError ? /* @__PURE__ */
|
|
521
|
+
/* @__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..." }) }),
|
|
522
|
+
hadConnectionError ? /* @__PURE__ */ jsx12("div", { className: retryButtonContainer, children: /* @__PURE__ */ jsx12(Button, { type: "button", variant: "outline", onClick: () => onRetryConnection(selectedWallet), children: "Retry Connection" }) }) : null
|
|
464
523
|
] });
|
|
465
524
|
}
|
|
466
525
|
|
|
@@ -468,11 +527,11 @@ function ConnectionStatus({
|
|
|
468
527
|
var container3 = "InfoSection_container__1wtioi70";
|
|
469
528
|
|
|
470
529
|
// src/components/connect-modal/InfoSection.tsx
|
|
471
|
-
import { jsx as
|
|
530
|
+
import { jsx as jsx13, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
472
531
|
function InfoSection({ title: title3, children }) {
|
|
473
532
|
return /* @__PURE__ */ jsxs3("section", { className: container3, children: [
|
|
474
|
-
/* @__PURE__ */
|
|
475
|
-
/* @__PURE__ */
|
|
533
|
+
/* @__PURE__ */ jsx13(Heading, { as: "h3", size: "sm", weight: "normal", children: title3 }),
|
|
534
|
+
/* @__PURE__ */ jsx13(Text, { weight: "medium", color: "muted", children })
|
|
476
535
|
] });
|
|
477
536
|
}
|
|
478
537
|
|
|
@@ -482,15 +541,15 @@ var content2 = "GettingStarted_content__1fp07e11";
|
|
|
482
541
|
var installButtonContainer = "GettingStarted_installButtonContainer__1fp07e12";
|
|
483
542
|
|
|
484
543
|
// src/components/connect-modal/views/GettingStarted.tsx
|
|
485
|
-
import { jsx as
|
|
544
|
+
import { jsx as jsx14, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
486
545
|
function GettingStarted() {
|
|
487
546
|
return /* @__PURE__ */ jsxs4("div", { className: container4, children: [
|
|
488
|
-
/* @__PURE__ */
|
|
547
|
+
/* @__PURE__ */ jsx14(Heading, { as: "h2", children: "Get Started with Sui" }),
|
|
489
548
|
/* @__PURE__ */ jsxs4("div", { className: content2, children: [
|
|
490
|
-
/* @__PURE__ */
|
|
491
|
-
/* @__PURE__ */
|
|
492
|
-
/* @__PURE__ */
|
|
493
|
-
/* @__PURE__ */
|
|
549
|
+
/* @__PURE__ */ jsx14(InfoSection, { title: "Install the Sui Wallet Extension", children: "We recommend pinning Sui Wallet to your taskbar for quicker access." }),
|
|
550
|
+
/* @__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." }),
|
|
551
|
+
/* @__PURE__ */ jsx14(InfoSection, { title: "Refresh Your Browser", children: "Once you set up your wallet, refresh this window browser to load up the extension." }),
|
|
552
|
+
/* @__PURE__ */ jsx14("div", { className: installButtonContainer, children: /* @__PURE__ */ jsx14(Button, { variant: "outline", asChild: true, children: /* @__PURE__ */ jsx14(
|
|
494
553
|
"a",
|
|
495
554
|
{
|
|
496
555
|
href: "https://chrome.google.com/webstore/detail/sui-wallet/opcgpfmipidbgpenhmajoajpbobppdil",
|
|
@@ -508,13 +567,13 @@ var container5 = "WhatIsAWallet_container__1ktpkq90";
|
|
|
508
567
|
var content3 = "WhatIsAWallet_content__1ktpkq91";
|
|
509
568
|
|
|
510
569
|
// src/components/connect-modal/views/WhatIsAWallet.tsx
|
|
511
|
-
import { jsx as
|
|
570
|
+
import { jsx as jsx15, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
512
571
|
function WhatIsAWallet() {
|
|
513
572
|
return /* @__PURE__ */ jsxs5("div", { className: container5, children: [
|
|
514
|
-
/* @__PURE__ */
|
|
573
|
+
/* @__PURE__ */ jsx15(Heading, { as: "h2", children: "What is a Wallet" }),
|
|
515
574
|
/* @__PURE__ */ jsxs5("div", { className: content3, children: [
|
|
516
|
-
/* @__PURE__ */
|
|
517
|
-
/* @__PURE__ */
|
|
575
|
+
/* @__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." }),
|
|
576
|
+
/* @__PURE__ */ jsx15(InfoSection, { title: "Store your Digital Assets", children: "Send, receive, store, and display your digital assets like NFTs & coins." })
|
|
518
577
|
] })
|
|
519
578
|
] });
|
|
520
579
|
}
|
|
@@ -525,11 +584,11 @@ function useWallets() {
|
|
|
525
584
|
}
|
|
526
585
|
|
|
527
586
|
// src/components/icons/SuiIcon.tsx
|
|
528
|
-
import { jsx as
|
|
587
|
+
import { jsx as jsx16, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
529
588
|
function SuiIcon(props) {
|
|
530
589
|
return /* @__PURE__ */ jsxs6("svg", { width: 28, height: 28, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
|
|
531
|
-
/* @__PURE__ */
|
|
532
|
-
/* @__PURE__ */
|
|
590
|
+
/* @__PURE__ */ jsx16("rect", { width: 28, height: 28, rx: 6, fill: "#6FBCF0" }),
|
|
591
|
+
/* @__PURE__ */ jsx16(
|
|
533
592
|
"path",
|
|
534
593
|
{
|
|
535
594
|
fillRule: "evenodd",
|
|
@@ -554,27 +613,27 @@ var walletIcon2 = "WalletListItem_walletIcon__1dqqtqs3";
|
|
|
554
613
|
var walletItem = "WalletListItem_walletItem__1dqqtqs1";
|
|
555
614
|
|
|
556
615
|
// src/components/connect-modal/wallet-list/WalletListItem.tsx
|
|
557
|
-
import { jsx as
|
|
616
|
+
import { jsx as jsx17, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
558
617
|
function WalletListItem({ name, icon, onClick, isSelected = false }) {
|
|
559
|
-
return /* @__PURE__ */
|
|
618
|
+
return /* @__PURE__ */ jsx17("li", { className: container7, children: /* @__PURE__ */ jsxs7(
|
|
560
619
|
"button",
|
|
561
620
|
{
|
|
562
621
|
className: clsx6(walletItem, { [selectedWalletItem]: isSelected }),
|
|
563
622
|
type: "button",
|
|
564
623
|
onClick,
|
|
565
624
|
children: [
|
|
566
|
-
typeof icon === "string" ? /* @__PURE__ */
|
|
567
|
-
/* @__PURE__ */
|
|
625
|
+
typeof icon === "string" ? /* @__PURE__ */ jsx17("img", { className: walletIcon2, src: icon, alt: `${name} logo` }) : icon,
|
|
626
|
+
/* @__PURE__ */ jsx17(Heading, { size: "md", truncate: true, asChild: true, children: /* @__PURE__ */ jsx17("div", { children: name }) })
|
|
568
627
|
]
|
|
569
628
|
}
|
|
570
629
|
) });
|
|
571
630
|
}
|
|
572
631
|
|
|
573
632
|
// src/components/connect-modal/wallet-list/WalletList.tsx
|
|
574
|
-
import { jsx as
|
|
633
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
575
634
|
function WalletList({ selectedWalletName, onPlaceholderClick, onSelect }) {
|
|
576
635
|
const wallets = useWallets();
|
|
577
|
-
return /* @__PURE__ */
|
|
636
|
+
return /* @__PURE__ */ jsx18("ul", { className: container6, children: wallets.length > 0 ? wallets.map((wallet) => /* @__PURE__ */ jsx18(
|
|
578
637
|
WalletListItem,
|
|
579
638
|
{
|
|
580
639
|
name: wallet.name,
|
|
@@ -583,11 +642,11 @@ function WalletList({ selectedWalletName, onPlaceholderClick, onSelect }) {
|
|
|
583
642
|
onClick: () => onSelect(wallet)
|
|
584
643
|
},
|
|
585
644
|
wallet.name
|
|
586
|
-
)) : /* @__PURE__ */
|
|
645
|
+
)) : /* @__PURE__ */ jsx18(
|
|
587
646
|
WalletListItem,
|
|
588
647
|
{
|
|
589
648
|
name: "Sui Wallet",
|
|
590
|
-
icon: /* @__PURE__ */
|
|
649
|
+
icon: /* @__PURE__ */ jsx18(SuiIcon, {}),
|
|
591
650
|
onClick: onPlaceholderClick,
|
|
592
651
|
isSelected: true
|
|
593
652
|
}
|
|
@@ -595,11 +654,11 @@ function WalletList({ selectedWalletName, onPlaceholderClick, onSelect }) {
|
|
|
595
654
|
}
|
|
596
655
|
|
|
597
656
|
// src/components/connect-modal/ConnectModal.tsx
|
|
598
|
-
import { jsx as
|
|
657
|
+
import { jsx as jsx19, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
599
658
|
function ConnectModal({ trigger, open, defaultOpen, onOpenChange }) {
|
|
600
|
-
const [isModalOpen, setModalOpen] =
|
|
601
|
-
const [currentView, setCurrentView] =
|
|
602
|
-
const [selectedWallet, setSelectedWallet] =
|
|
659
|
+
const [isModalOpen, setModalOpen] = useState2(open ?? defaultOpen);
|
|
660
|
+
const [currentView, setCurrentView] = useState2();
|
|
661
|
+
const [selectedWallet, setSelectedWallet] = useState2();
|
|
603
662
|
const { mutate, isError } = useConnectWallet();
|
|
604
663
|
const resetSelection = () => {
|
|
605
664
|
setSelectedWallet(void 0);
|
|
@@ -624,13 +683,13 @@ function ConnectModal({ trigger, open, defaultOpen, onOpenChange }) {
|
|
|
624
683
|
let modalContent;
|
|
625
684
|
switch (currentView) {
|
|
626
685
|
case "what-is-a-wallet":
|
|
627
|
-
modalContent = /* @__PURE__ */
|
|
686
|
+
modalContent = /* @__PURE__ */ jsx19(WhatIsAWallet, {});
|
|
628
687
|
break;
|
|
629
688
|
case "getting-started":
|
|
630
|
-
modalContent = /* @__PURE__ */
|
|
689
|
+
modalContent = /* @__PURE__ */ jsx19(GettingStarted, {});
|
|
631
690
|
break;
|
|
632
691
|
case "connection-status":
|
|
633
|
-
modalContent = /* @__PURE__ */
|
|
692
|
+
modalContent = /* @__PURE__ */ jsx19(
|
|
634
693
|
ConnectionStatus,
|
|
635
694
|
{
|
|
636
695
|
selectedWallet,
|
|
@@ -640,11 +699,11 @@ function ConnectModal({ trigger, open, defaultOpen, onOpenChange }) {
|
|
|
640
699
|
);
|
|
641
700
|
break;
|
|
642
701
|
default:
|
|
643
|
-
modalContent = /* @__PURE__ */
|
|
702
|
+
modalContent = /* @__PURE__ */ jsx19(WhatIsAWallet, {});
|
|
644
703
|
}
|
|
645
704
|
return /* @__PURE__ */ jsxs8(Dialog.Root, { open: open ?? isModalOpen, onOpenChange: handleOpenChange, children: [
|
|
646
|
-
/* @__PURE__ */
|
|
647
|
-
/* @__PURE__ */
|
|
705
|
+
/* @__PURE__ */ jsx19(StyleMarker, { children: /* @__PURE__ */ jsx19(Dialog.Trigger, { asChild: true, children: trigger }) }),
|
|
706
|
+
/* @__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
707
|
/* @__PURE__ */ jsxs8(
|
|
649
708
|
"div",
|
|
650
709
|
{
|
|
@@ -653,8 +712,8 @@ function ConnectModal({ trigger, open, defaultOpen, onOpenChange }) {
|
|
|
653
712
|
}),
|
|
654
713
|
children: [
|
|
655
714
|
/* @__PURE__ */ jsxs8("div", { className: walletListContent, children: [
|
|
656
|
-
/* @__PURE__ */
|
|
657
|
-
/* @__PURE__ */
|
|
715
|
+
/* @__PURE__ */ jsx19(Dialog.Title, { className: title, asChild: true, children: /* @__PURE__ */ jsx19(Heading, { as: "h2", children: "Connect a Wallet" }) }),
|
|
716
|
+
/* @__PURE__ */ jsx19(
|
|
658
717
|
WalletList,
|
|
659
718
|
{
|
|
660
719
|
selectedWalletName: selectedWallet?.name,
|
|
@@ -668,7 +727,7 @@ function ConnectModal({ trigger, open, defaultOpen, onOpenChange }) {
|
|
|
668
727
|
}
|
|
669
728
|
)
|
|
670
729
|
] }),
|
|
671
|
-
/* @__PURE__ */
|
|
730
|
+
/* @__PURE__ */ jsx19(
|
|
672
731
|
"button",
|
|
673
732
|
{
|
|
674
733
|
className: whatIsAWalletButton,
|
|
@@ -687,24 +746,24 @@ function ConnectModal({ trigger, open, defaultOpen, onOpenChange }) {
|
|
|
687
746
|
[selectedViewContainer]: !!currentView
|
|
688
747
|
}),
|
|
689
748
|
children: [
|
|
690
|
-
/* @__PURE__ */
|
|
749
|
+
/* @__PURE__ */ jsx19("div", { className: backButtonContainer, children: /* @__PURE__ */ jsx19(IconButton, { type: "button", "aria-label": "Back", onClick: () => resetSelection(), children: /* @__PURE__ */ jsx19(BackIcon, {}) }) }),
|
|
691
750
|
modalContent
|
|
692
751
|
]
|
|
693
752
|
}
|
|
694
753
|
),
|
|
695
|
-
/* @__PURE__ */
|
|
754
|
+
/* @__PURE__ */ jsx19(Dialog.Close, { className: closeButtonContainer, asChild: true, children: /* @__PURE__ */ jsx19(IconButton, { type: "button", "aria-label": "Close", children: /* @__PURE__ */ jsx19(CloseIcon, {}) }) })
|
|
696
755
|
] }) }) }) })
|
|
697
756
|
] });
|
|
698
757
|
}
|
|
699
758
|
|
|
700
759
|
// src/components/ConnectButton.tsx
|
|
701
|
-
import { jsx as
|
|
760
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
702
761
|
function ConnectButton({
|
|
703
762
|
connectText = "Connect Wallet",
|
|
704
763
|
...buttonProps
|
|
705
764
|
}) {
|
|
706
765
|
const currentAccount = useCurrentAccount();
|
|
707
|
-
return currentAccount ? /* @__PURE__ */
|
|
766
|
+
return currentAccount ? /* @__PURE__ */ jsx20(AccountDropdownMenu, { currentAccount }) : /* @__PURE__ */ jsx20(ConnectModal, { trigger: /* @__PURE__ */ jsx20(Button, { ...buttonProps, children: connectText }) });
|
|
708
767
|
}
|
|
709
768
|
export {
|
|
710
769
|
ConnectButton
|