@iota/dapp-kit 0.5.3 → 0.7.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 +34 -0
- package/dist/cjs/components/AccountDropdownMenu.d.ts +4 -2
- package/dist/cjs/components/AccountDropdownMenu.js +81 -15
- package/dist/cjs/components/AccountDropdownMenu.js.map +4 -4
- package/dist/cjs/components/ConnectButton.d.ts +2 -1
- package/dist/cjs/components/ConnectButton.js +163 -89
- package/dist/cjs/components/ConnectButton.js.map +4 -4
- package/dist/cjs/components/WalletProvider.d.ts +3 -1
- package/dist/cjs/components/WalletProvider.js +7 -3
- package/dist/cjs/components/WalletProvider.js.map +2 -2
- package/dist/cjs/hooks/useGetDefaultIotaName.d.ts +1 -0
- package/dist/cjs/hooks/useGetDefaultIotaName.js +80 -0
- package/dist/cjs/hooks/useGetDefaultIotaName.js.map +7 -0
- package/dist/cjs/hooks/wallet/useCurrentChain.d.ts +5 -0
- package/dist/cjs/hooks/wallet/useCurrentChain.js +50 -0
- package/dist/cjs/hooks/wallet/useCurrentChain.js.map +7 -0
- package/dist/cjs/hooks/wallet/useSignAndExecuteTransaction.js +8 -2
- package/dist/cjs/hooks/wallet/useSignAndExecuteTransaction.js.map +3 -3
- package/dist/cjs/index.js +179 -118
- package/dist/cjs/index.js.map +4 -4
- package/dist/cjs/walletStore.d.ts +4 -1
- package/dist/cjs/walletStore.js +3 -1
- package/dist/cjs/walletStore.js.map +2 -2
- package/dist/esm/components/AccountDropdownMenu.d.ts +4 -2
- package/dist/esm/components/AccountDropdownMenu.js +79 -13
- package/dist/esm/components/AccountDropdownMenu.js.map +4 -4
- package/dist/esm/components/ConnectButton.d.ts +2 -1
- package/dist/esm/components/ConnectButton.js +145 -71
- package/dist/esm/components/ConnectButton.js.map +4 -4
- package/dist/esm/components/WalletProvider.d.ts +3 -1
- package/dist/esm/components/WalletProvider.js +7 -3
- package/dist/esm/components/WalletProvider.js.map +2 -2
- package/dist/esm/hooks/useGetDefaultIotaName.d.ts +1 -0
- package/dist/esm/hooks/useGetDefaultIotaName.js +59 -0
- package/dist/esm/hooks/useGetDefaultIotaName.js.map +7 -0
- package/dist/esm/hooks/wallet/useCurrentChain.d.ts +5 -0
- package/dist/esm/hooks/wallet/useCurrentChain.js +27 -0
- package/dist/esm/hooks/wallet/useCurrentChain.js.map +7 -0
- package/dist/esm/hooks/wallet/useSignAndExecuteTransaction.js +8 -2
- package/dist/esm/hooks/wallet/useSignAndExecuteTransaction.js.map +3 -3
- package/dist/esm/index.js +150 -89
- package/dist/esm/index.js.map +4 -4
- package/dist/esm/walletStore.d.ts +4 -1
- package/dist/esm/walletStore.js +3 -1
- package/dist/esm/walletStore.js.map +2 -2
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -3
- package/src/components/AccountDropdownMenu.tsx +17 -3
- package/src/components/ConnectButton.tsx +7 -1
- package/src/components/WalletProvider.tsx +5 -0
- package/src/hooks/useGetDefaultIotaName.ts +43 -0
- package/src/hooks/wallet/useCurrentChain.ts +12 -0
- package/src/hooks/wallet/useSignAndExecuteTransaction.ts +5 -2
- package/src/walletStore.ts +5 -0
|
@@ -320,27 +320,90 @@ var Text = (0, import_react5.forwardRef)(
|
|
|
320
320
|
);
|
|
321
321
|
Text.displayName = "Text";
|
|
322
322
|
|
|
323
|
-
// src/
|
|
323
|
+
// src/hooks/useGetDefaultIotaName.ts
|
|
324
|
+
var import_client2 = require("@iota/iota-sdk/client");
|
|
325
|
+
var import_react_query3 = require("@tanstack/react-query");
|
|
326
|
+
var import_iota_names_sdk = require("@iota/iota-names-sdk");
|
|
327
|
+
|
|
328
|
+
// src/hooks/useIotaClient.ts
|
|
329
|
+
var import_react7 = require("react");
|
|
330
|
+
|
|
331
|
+
// src/components/IotaClientProvider.tsx
|
|
332
|
+
var import_client = require("@iota/iota-sdk/client");
|
|
333
|
+
var import_react6 = require("react");
|
|
324
334
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
325
|
-
|
|
335
|
+
var IotaClientContext = (0, import_react6.createContext)(null);
|
|
336
|
+
var DEFAULT_NETWORKS = {
|
|
337
|
+
localnet: { url: (0, import_client.getNetwork)(import_client.Network.Localnet)?.url }
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
// src/hooks/useIotaClient.ts
|
|
341
|
+
function useIotaClientContext() {
|
|
342
|
+
const iotaClient = (0, import_react7.useContext)(IotaClientContext);
|
|
343
|
+
if (!iotaClient) {
|
|
344
|
+
throw new Error(
|
|
345
|
+
"Could not find IotaClientContext. Ensure that you have set up the IotaClientProvider"
|
|
346
|
+
);
|
|
347
|
+
}
|
|
348
|
+
return iotaClient;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
// src/hooks/useGetDefaultIotaName.ts
|
|
352
|
+
var import_react8 = require("react");
|
|
353
|
+
var import_graphql = require("@iota/iota-sdk/graphql");
|
|
354
|
+
function useGetDefaultIotaName(address, iotaNamesEnabled) {
|
|
355
|
+
const iotaContext = useIotaClientContext();
|
|
356
|
+
const network = (0, import_client2.getNetwork)(iotaContext.network);
|
|
357
|
+
const iotaNamesClient = (0, import_react8.useMemo)(() => {
|
|
358
|
+
const iotaGraphQLClient = new import_graphql.IotaGraphQLClient({
|
|
359
|
+
url: network.graphql
|
|
360
|
+
});
|
|
361
|
+
return new import_iota_names_sdk.IotaNamesClient({
|
|
362
|
+
graphQlClient: iotaGraphQLClient,
|
|
363
|
+
network: network.id
|
|
364
|
+
});
|
|
365
|
+
}, [network.id]);
|
|
366
|
+
const iotaNamesSupported = !!iotaNamesClient.config;
|
|
367
|
+
return (0, import_react_query3.useQuery)({
|
|
368
|
+
queryKey: ["iota-name", "default-name", address],
|
|
369
|
+
queryFn: async () => {
|
|
370
|
+
if (!address) return null;
|
|
371
|
+
const name = await iotaNamesClient?.getDefaultName(address);
|
|
372
|
+
return name ? (0, import_iota_names_sdk.normalizeIotaName)(name) : name;
|
|
373
|
+
},
|
|
374
|
+
enabled: !!iotaNamesClient && !!address && iotaNamesEnabled && iotaNamesSupported,
|
|
375
|
+
staleTime: 1e3 * 60 * 10
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// src/components/AccountDropdownMenu.tsx
|
|
380
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
381
|
+
function AccountDropdownMenu({
|
|
382
|
+
currentAccount,
|
|
383
|
+
size = "lg",
|
|
384
|
+
iotaNamesEnabled
|
|
385
|
+
}) {
|
|
326
386
|
const { mutate: disconnectWallet } = useDisconnectWallet();
|
|
327
387
|
const accounts = useAccounts();
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
388
|
+
const { data: iotaName } = useGetDefaultIotaName(currentAccount.address, iotaNamesEnabled);
|
|
389
|
+
const displayAccount = iotaName ?? currentAccount.label ?? (0, import_utils.formatAddress)(currentAccount.address);
|
|
390
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(DropdownMenu.Root, { modal: false, children: [
|
|
391
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(StyleMarker, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Button, { size, className: connectedAccount, children: [
|
|
392
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { mono: true, weight: "bold", children: displayAccount }),
|
|
393
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ChevronIcon, {})
|
|
332
394
|
] }) }) }),
|
|
333
|
-
/* @__PURE__ */ (0,
|
|
334
|
-
/* @__PURE__ */ (0,
|
|
395
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenu.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(StyleMarker, { className: menuContainer, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(DropdownMenu.Content, { className: menuContent, children: [
|
|
396
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: scrollableContent, children: accounts.map((account) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
335
397
|
AccountDropdownMenuItem,
|
|
336
398
|
{
|
|
337
399
|
account,
|
|
338
|
-
active: currentAccount.address === account.address
|
|
400
|
+
active: currentAccount.address === account.address,
|
|
401
|
+
iotaNamesEnabled
|
|
339
402
|
},
|
|
340
403
|
account.address
|
|
341
404
|
)) }),
|
|
342
|
-
/* @__PURE__ */ (0,
|
|
343
|
-
/* @__PURE__ */ (0,
|
|
405
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenu.Separator, { className: separator }),
|
|
406
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
344
407
|
DropdownMenu.Item,
|
|
345
408
|
{
|
|
346
409
|
className: (0, import_clsx3.default)(menuItem),
|
|
@@ -353,17 +416,20 @@ function AccountDropdownMenu({ currentAccount, size = "lg" }) {
|
|
|
353
416
|
}
|
|
354
417
|
function AccountDropdownMenuItem({
|
|
355
418
|
account,
|
|
356
|
-
active
|
|
419
|
+
active,
|
|
420
|
+
iotaNamesEnabled
|
|
357
421
|
}) {
|
|
358
422
|
const { mutate: switchAccount } = useSwitchAccount();
|
|
359
|
-
|
|
423
|
+
const { data: iotaName } = useGetDefaultIotaName(account.address, iotaNamesEnabled);
|
|
424
|
+
const displayAccount = iotaName ?? account.label ?? (0, import_utils.formatAddress)(account.address);
|
|
425
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
360
426
|
DropdownMenu.Item,
|
|
361
427
|
{
|
|
362
428
|
className: (0, import_clsx3.default)(menuItem, switchAccountMenuItem),
|
|
363
429
|
onSelect: () => switchAccount({ account }),
|
|
364
430
|
children: [
|
|
365
|
-
/* @__PURE__ */ (0,
|
|
366
|
-
active ? /* @__PURE__ */ (0,
|
|
431
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { mono: true, children: displayAccount }),
|
|
432
|
+
active ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CheckIcon, {}) : null
|
|
367
433
|
]
|
|
368
434
|
}
|
|
369
435
|
);
|
|
@@ -372,18 +438,18 @@ function AccountDropdownMenuItem({
|
|
|
372
438
|
// src/components/connect-modal/ConnectModal.tsx
|
|
373
439
|
var Dialog = __toESM(require("@radix-ui/react-dialog"));
|
|
374
440
|
var import_clsx7 = __toESM(require("clsx"));
|
|
375
|
-
var
|
|
441
|
+
var import_react11 = require("react");
|
|
376
442
|
|
|
377
443
|
// src/hooks/wallet/useConnectWallet.ts
|
|
378
444
|
var import_wallet_standard = require("@iota/wallet-standard");
|
|
379
|
-
var
|
|
445
|
+
var import_react_query4 = require("@tanstack/react-query");
|
|
380
446
|
function useConnectWallet({
|
|
381
447
|
mutationKey,
|
|
382
448
|
...mutationOptions
|
|
383
449
|
} = {}) {
|
|
384
450
|
const setWalletConnected = useWalletStore((state) => state.setWalletConnected);
|
|
385
451
|
const setConnectionStatus = useWalletStore((state) => state.setConnectionStatus);
|
|
386
|
-
return (0,
|
|
452
|
+
return (0, import_react_query4.useMutation)({
|
|
387
453
|
mutationKey: walletMutationKeys.connectWallet(mutationKey),
|
|
388
454
|
mutationFn: async ({ wallet, accountAddress, ...connectArgs }) => {
|
|
389
455
|
try {
|
|
@@ -428,9 +494,9 @@ function getWalletUniqueIdentifier(wallet) {
|
|
|
428
494
|
}
|
|
429
495
|
|
|
430
496
|
// src/components/icons/BackIcon.tsx
|
|
431
|
-
var
|
|
497
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
432
498
|
function BackIcon(props) {
|
|
433
|
-
return /* @__PURE__ */ (0,
|
|
499
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("svg", { width: 24, height: 24, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
434
500
|
"path",
|
|
435
501
|
{
|
|
436
502
|
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",
|
|
@@ -440,9 +506,9 @@ function BackIcon(props) {
|
|
|
440
506
|
}
|
|
441
507
|
|
|
442
508
|
// src/components/icons/CloseIcon.tsx
|
|
443
|
-
var
|
|
509
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
444
510
|
function CloseIcon(props) {
|
|
445
|
-
return /* @__PURE__ */ (0,
|
|
511
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("svg", { width: 10, height: 10, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
446
512
|
"path",
|
|
447
513
|
{
|
|
448
514
|
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",
|
|
@@ -454,15 +520,15 @@ function CloseIcon(props) {
|
|
|
454
520
|
// src/components/ui/Heading.tsx
|
|
455
521
|
var import_react_slot4 = require("@radix-ui/react-slot");
|
|
456
522
|
var import_clsx4 = __toESM(require("clsx"));
|
|
457
|
-
var
|
|
523
|
+
var import_react9 = require("react");
|
|
458
524
|
|
|
459
525
|
// src/components/ui/Heading.css.ts
|
|
460
526
|
var import_createRuntimeFn3 = require("@vanilla-extract/recipes/createRuntimeFn");
|
|
461
527
|
var headingVariants = (0, import_createRuntimeFn3.createRuntimeFn)({ 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: [] });
|
|
462
528
|
|
|
463
529
|
// src/components/ui/Heading.tsx
|
|
464
|
-
var
|
|
465
|
-
var Heading = (0,
|
|
530
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
531
|
+
var Heading = (0, import_react9.forwardRef)(
|
|
466
532
|
({
|
|
467
533
|
children,
|
|
468
534
|
className,
|
|
@@ -473,13 +539,13 @@ var Heading = (0, import_react6.forwardRef)(
|
|
|
473
539
|
truncate,
|
|
474
540
|
...headingProps
|
|
475
541
|
}, forwardedRef) => {
|
|
476
|
-
return /* @__PURE__ */ (0,
|
|
542
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
477
543
|
import_react_slot4.Slot,
|
|
478
544
|
{
|
|
479
545
|
...headingProps,
|
|
480
546
|
ref: forwardedRef,
|
|
481
547
|
className: (0, import_clsx4.default)(headingVariants({ size, weight, truncate }), className),
|
|
482
|
-
children: asChild ? children : /* @__PURE__ */ (0,
|
|
548
|
+
children: asChild ? children : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Tag, { children })
|
|
483
549
|
}
|
|
484
550
|
);
|
|
485
551
|
}
|
|
@@ -489,17 +555,17 @@ Heading.displayName = "Heading";
|
|
|
489
555
|
// src/components/ui/IconButton.tsx
|
|
490
556
|
var import_react_slot5 = require("@radix-ui/react-slot");
|
|
491
557
|
var import_clsx5 = __toESM(require("clsx"));
|
|
492
|
-
var
|
|
558
|
+
var import_react10 = require("react");
|
|
493
559
|
|
|
494
560
|
// src/components/ui/IconButton.css.ts
|
|
495
561
|
var container = "IconButton_container__ap1qll0";
|
|
496
562
|
|
|
497
563
|
// src/components/ui/IconButton.tsx
|
|
498
|
-
var
|
|
499
|
-
var IconButton = (0,
|
|
564
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
565
|
+
var IconButton = (0, import_react10.forwardRef)(
|
|
500
566
|
({ className, asChild = false, ...props }, forwardedRef) => {
|
|
501
567
|
const Comp = asChild ? import_react_slot5.Slot : "button";
|
|
502
|
-
return /* @__PURE__ */ (0,
|
|
568
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Comp, { ...props, className: (0, import_clsx5.default)(container, className), ref: forwardedRef });
|
|
503
569
|
}
|
|
504
570
|
);
|
|
505
571
|
IconButton.displayName = "Button";
|
|
@@ -525,14 +591,14 @@ var title2 = "ConnectionStatus_title__c5q1ll2";
|
|
|
525
591
|
var walletIcon = "ConnectionStatus_walletIcon__c5q1ll1";
|
|
526
592
|
|
|
527
593
|
// src/components/connect-modal/views/ConnectionStatus.tsx
|
|
528
|
-
var
|
|
594
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
529
595
|
function ConnectionStatus({
|
|
530
596
|
selectedWallet,
|
|
531
597
|
hadConnectionError,
|
|
532
598
|
onRetryConnection
|
|
533
599
|
}) {
|
|
534
|
-
return /* @__PURE__ */ (0,
|
|
535
|
-
/* @__PURE__ */ (0,
|
|
600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: container2, children: [
|
|
601
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
536
602
|
"img",
|
|
537
603
|
{
|
|
538
604
|
className: walletIcon,
|
|
@@ -540,12 +606,12 @@ function ConnectionStatus({
|
|
|
540
606
|
alt: `${selectedWallet.name} logo`
|
|
541
607
|
}
|
|
542
608
|
),
|
|
543
|
-
/* @__PURE__ */ (0,
|
|
609
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: title2, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Heading, { as: "h2", size: "xl", children: [
|
|
544
610
|
"Opening ",
|
|
545
611
|
selectedWallet.name
|
|
546
612
|
] }) }),
|
|
547
|
-
/* @__PURE__ */ (0,
|
|
548
|
-
hadConnectionError ? /* @__PURE__ */ (0,
|
|
613
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: connectionStatus, children: hadConnectionError ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { color: "danger", children: "Connection failed" }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { color: "muted", children: "Confirm connection in the wallet..." }) }),
|
|
614
|
+
hadConnectionError ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: retryButtonContainer, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
549
615
|
Button,
|
|
550
616
|
{
|
|
551
617
|
type: "button",
|
|
@@ -561,11 +627,11 @@ function ConnectionStatus({
|
|
|
561
627
|
var container3 = "InfoSection_container__1d1nrmt0";
|
|
562
628
|
|
|
563
629
|
// src/components/connect-modal/InfoSection.tsx
|
|
564
|
-
var
|
|
630
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
565
631
|
function InfoSection({ title: title3, children }) {
|
|
566
|
-
return /* @__PURE__ */ (0,
|
|
567
|
-
/* @__PURE__ */ (0,
|
|
568
|
-
/* @__PURE__ */ (0,
|
|
632
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("section", { className: container3, children: [
|
|
633
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Heading, { as: "h3", size: "sm", weight: "normal", children: title3 }),
|
|
634
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Text, { weight: "medium", color: "muted", children })
|
|
569
635
|
] });
|
|
570
636
|
}
|
|
571
637
|
|
|
@@ -575,15 +641,15 @@ var content2 = "GettingStarted_content__qu36t91";
|
|
|
575
641
|
var installButtonContainer = "GettingStarted_installButtonContainer__qu36t92";
|
|
576
642
|
|
|
577
643
|
// src/components/connect-modal/views/GettingStarted.tsx
|
|
578
|
-
var
|
|
644
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
579
645
|
function GettingStarted() {
|
|
580
|
-
return /* @__PURE__ */ (0,
|
|
581
|
-
/* @__PURE__ */ (0,
|
|
582
|
-
/* @__PURE__ */ (0,
|
|
583
|
-
/* @__PURE__ */ (0,
|
|
584
|
-
/* @__PURE__ */ (0,
|
|
585
|
-
/* @__PURE__ */ (0,
|
|
586
|
-
/* @__PURE__ */ (0,
|
|
646
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: container4, children: [
|
|
647
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Heading, { as: "h2", children: "Get Started with IOTA" }),
|
|
648
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: content2, children: [
|
|
649
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(InfoSection, { title: "Install the IOTA Wallet Extension", children: "We recommend pinning IOTA Wallet to your taskbar for quicker access." }),
|
|
650
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(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." }),
|
|
651
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(InfoSection, { title: "Refresh Your Browser", children: "Once you set up your wallet, refresh this window browser to load up the extension." }),
|
|
652
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: installButtonContainer, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Button, { variant: "primary", asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
587
653
|
"a",
|
|
588
654
|
{
|
|
589
655
|
href: "https://chrome.google.com/webstore/detail/iota-wallet/iidjkmdceolghepehaaddojmnjnkkija",
|
|
@@ -601,13 +667,13 @@ var container5 = "WhatIsAWallet_container__1kdcimq0";
|
|
|
601
667
|
var content3 = "WhatIsAWallet_content__1kdcimq1";
|
|
602
668
|
|
|
603
669
|
// src/components/connect-modal/views/WhatIsAWallet.tsx
|
|
604
|
-
var
|
|
670
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
605
671
|
function WhatIsAWallet() {
|
|
606
|
-
return /* @__PURE__ */ (0,
|
|
607
|
-
/* @__PURE__ */ (0,
|
|
608
|
-
/* @__PURE__ */ (0,
|
|
609
|
-
/* @__PURE__ */ (0,
|
|
610
|
-
/* @__PURE__ */ (0,
|
|
672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: container5, children: [
|
|
673
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Heading, { as: "h2", children: "What is a Wallet" }),
|
|
674
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: content3, children: [
|
|
675
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(InfoSection, { title: "Easy Login", children: "No need to create new accounts and passwords for every website. Just connect your wallet and get going." }),
|
|
676
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(InfoSection, { title: "Store your Digital Assets", children: "Send, receive, store, and display your digital assets like NFTs & coins." })
|
|
611
677
|
] })
|
|
612
678
|
] });
|
|
613
679
|
}
|
|
@@ -618,9 +684,9 @@ function useWallets() {
|
|
|
618
684
|
}
|
|
619
685
|
|
|
620
686
|
// src/components/icons/IotaIcon.tsx
|
|
621
|
-
var
|
|
687
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
622
688
|
function IotaIcon(props) {
|
|
623
|
-
return /* @__PURE__ */ (0,
|
|
689
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
624
690
|
"svg",
|
|
625
691
|
{
|
|
626
692
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -629,7 +695,7 @@ function IotaIcon(props) {
|
|
|
629
695
|
fill: "none",
|
|
630
696
|
viewBox: "0 0 24 24",
|
|
631
697
|
...props,
|
|
632
|
-
children: /* @__PURE__ */ (0,
|
|
698
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
633
699
|
"path",
|
|
634
700
|
{
|
|
635
701
|
fill: "#171d26",
|
|
@@ -654,27 +720,27 @@ var walletIcon2 = "WalletListItem_walletIcon__1vrvezk3";
|
|
|
654
720
|
var walletItem = "WalletListItem_walletItem__1vrvezk1";
|
|
655
721
|
|
|
656
722
|
// src/components/connect-modal/wallet-list/WalletListItem.tsx
|
|
657
|
-
var
|
|
723
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
658
724
|
function WalletListItem({ name, icon: icon2, onClick, isSelected = false }) {
|
|
659
|
-
return /* @__PURE__ */ (0,
|
|
725
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("li", { className: container7, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
660
726
|
"button",
|
|
661
727
|
{
|
|
662
728
|
className: (0, import_clsx6.clsx)(walletItem, { [selectedWalletItem]: isSelected }),
|
|
663
729
|
type: "button",
|
|
664
730
|
onClick,
|
|
665
731
|
children: [
|
|
666
|
-
typeof icon2 === "string" ? /* @__PURE__ */ (0,
|
|
667
|
-
/* @__PURE__ */ (0,
|
|
732
|
+
typeof icon2 === "string" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("img", { className: walletIcon2, src: icon2, alt: `${name} logo` }) : icon2,
|
|
733
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Heading, { size: "md", truncate: true, asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { children: name }) })
|
|
668
734
|
]
|
|
669
735
|
}
|
|
670
736
|
) });
|
|
671
737
|
}
|
|
672
738
|
|
|
673
739
|
// src/components/connect-modal/wallet-list/WalletList.tsx
|
|
674
|
-
var
|
|
740
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
675
741
|
function WalletList({ selectedWalletName, onPlaceholderClick, onSelect }) {
|
|
676
742
|
const wallets = useWallets();
|
|
677
|
-
return /* @__PURE__ */ (0,
|
|
743
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("ul", { className: container6, children: wallets.length > 0 ? wallets.map((wallet) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
678
744
|
WalletListItem,
|
|
679
745
|
{
|
|
680
746
|
name: wallet.name,
|
|
@@ -683,11 +749,11 @@ function WalletList({ selectedWalletName, onPlaceholderClick, onSelect }) {
|
|
|
683
749
|
onClick: () => onSelect(wallet)
|
|
684
750
|
},
|
|
685
751
|
getWalletUniqueIdentifier(wallet)
|
|
686
|
-
)) : /* @__PURE__ */ (0,
|
|
752
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
687
753
|
WalletListItem,
|
|
688
754
|
{
|
|
689
755
|
name: "IOTA Wallet",
|
|
690
|
-
icon: /* @__PURE__ */ (0,
|
|
756
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(IotaIcon, { className: icon }),
|
|
691
757
|
onClick: onPlaceholderClick,
|
|
692
758
|
isSelected: true
|
|
693
759
|
}
|
|
@@ -695,11 +761,11 @@ function WalletList({ selectedWalletName, onPlaceholderClick, onSelect }) {
|
|
|
695
761
|
}
|
|
696
762
|
|
|
697
763
|
// src/components/connect-modal/ConnectModal.tsx
|
|
698
|
-
var
|
|
764
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
699
765
|
function ConnectModal({ trigger, open, defaultOpen, onOpenChange }) {
|
|
700
|
-
const [isModalOpen, setModalOpen] = (0,
|
|
701
|
-
const [currentView, setCurrentView] = (0,
|
|
702
|
-
const [selectedWallet, setSelectedWallet] = (0,
|
|
766
|
+
const [isModalOpen, setModalOpen] = (0, import_react11.useState)(open ?? defaultOpen);
|
|
767
|
+
const [currentView, setCurrentView] = (0, import_react11.useState)();
|
|
768
|
+
const [selectedWallet, setSelectedWallet] = (0, import_react11.useState)();
|
|
703
769
|
const { mutate, isError } = useConnectWallet();
|
|
704
770
|
const resetSelection = () => {
|
|
705
771
|
setSelectedWallet(void 0);
|
|
@@ -724,13 +790,13 @@ function ConnectModal({ trigger, open, defaultOpen, onOpenChange }) {
|
|
|
724
790
|
let modalContent;
|
|
725
791
|
switch (currentView) {
|
|
726
792
|
case "what-is-a-wallet":
|
|
727
|
-
modalContent = /* @__PURE__ */ (0,
|
|
793
|
+
modalContent = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(WhatIsAWallet, {});
|
|
728
794
|
break;
|
|
729
795
|
case "getting-started":
|
|
730
|
-
modalContent = /* @__PURE__ */ (0,
|
|
796
|
+
modalContent = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(GettingStarted, {});
|
|
731
797
|
break;
|
|
732
798
|
case "connection-status":
|
|
733
|
-
modalContent = /* @__PURE__ */ (0,
|
|
799
|
+
modalContent = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
734
800
|
ConnectionStatus,
|
|
735
801
|
{
|
|
736
802
|
selectedWallet,
|
|
@@ -740,21 +806,21 @@ function ConnectModal({ trigger, open, defaultOpen, onOpenChange }) {
|
|
|
740
806
|
);
|
|
741
807
|
break;
|
|
742
808
|
default:
|
|
743
|
-
modalContent = /* @__PURE__ */ (0,
|
|
809
|
+
modalContent = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(WhatIsAWallet, {});
|
|
744
810
|
}
|
|
745
|
-
return /* @__PURE__ */ (0,
|
|
746
|
-
/* @__PURE__ */ (0,
|
|
747
|
-
/* @__PURE__ */ (0,
|
|
748
|
-
/* @__PURE__ */ (0,
|
|
811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Dialog.Root, { open: open ?? isModalOpen, onOpenChange: handleOpenChange, children: [
|
|
812
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Dialog.Trigger, { asChild: true, children: trigger }),
|
|
813
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Dialog.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(StyleMarker, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Dialog.Overlay, { className: overlay, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Dialog.Content, { className: content, "aria-describedby": void 0, children: [
|
|
814
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
749
815
|
"div",
|
|
750
816
|
{
|
|
751
817
|
className: (0, import_clsx7.default)(walletListContainer, {
|
|
752
818
|
[walletListContainerWithViewSelected]: !!currentView
|
|
753
819
|
}),
|
|
754
820
|
children: [
|
|
755
|
-
/* @__PURE__ */ (0,
|
|
756
|
-
/* @__PURE__ */ (0,
|
|
757
|
-
/* @__PURE__ */ (0,
|
|
821
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: walletListContent, children: [
|
|
822
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Dialog.Title, { className: title, asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Heading, { as: "h2", children: "Connect a Wallet" }) }),
|
|
823
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
758
824
|
WalletList,
|
|
759
825
|
{
|
|
760
826
|
selectedWalletName: getWalletUniqueIdentifier(
|
|
@@ -770,7 +836,7 @@ function ConnectModal({ trigger, open, defaultOpen, onOpenChange }) {
|
|
|
770
836
|
}
|
|
771
837
|
)
|
|
772
838
|
] }),
|
|
773
|
-
/* @__PURE__ */ (0,
|
|
839
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
774
840
|
"button",
|
|
775
841
|
{
|
|
776
842
|
className: whatIsAWalletButton,
|
|
@@ -782,43 +848,51 @@ function ConnectModal({ trigger, open, defaultOpen, onOpenChange }) {
|
|
|
782
848
|
]
|
|
783
849
|
}
|
|
784
850
|
),
|
|
785
|
-
/* @__PURE__ */ (0,
|
|
851
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
786
852
|
"div",
|
|
787
853
|
{
|
|
788
854
|
className: (0, import_clsx7.default)(viewContainer, {
|
|
789
855
|
[selectedViewContainer]: !!currentView
|
|
790
856
|
}),
|
|
791
857
|
children: [
|
|
792
|
-
/* @__PURE__ */ (0,
|
|
858
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: backButtonContainer, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
793
859
|
IconButton,
|
|
794
860
|
{
|
|
795
861
|
type: "button",
|
|
796
862
|
"aria-label": "Back",
|
|
797
863
|
onClick: () => resetSelection(),
|
|
798
|
-
children: /* @__PURE__ */ (0,
|
|
864
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(BackIcon, {})
|
|
799
865
|
}
|
|
800
866
|
) }),
|
|
801
867
|
modalContent
|
|
802
868
|
]
|
|
803
869
|
}
|
|
804
870
|
),
|
|
805
|
-
/* @__PURE__ */ (0,
|
|
871
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Dialog.Close, { className: closeButtonContainer, asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(IconButton, { type: "button", "aria-label": "Close", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CloseIcon, {}) }) })
|
|
806
872
|
] }) }) }) })
|
|
807
873
|
] });
|
|
808
874
|
}
|
|
809
875
|
|
|
810
876
|
// src/components/ConnectButton.tsx
|
|
811
|
-
var
|
|
877
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
812
878
|
function ConnectButton({
|
|
813
879
|
connectText = "Connect Wallet",
|
|
814
880
|
size,
|
|
881
|
+
iotaNamesEnabled = true,
|
|
815
882
|
...buttonProps
|
|
816
883
|
}) {
|
|
817
884
|
const currentAccount = useCurrentAccount();
|
|
818
|
-
return currentAccount ? /* @__PURE__ */ (0,
|
|
885
|
+
return currentAccount ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
886
|
+
AccountDropdownMenu,
|
|
887
|
+
{
|
|
888
|
+
currentAccount,
|
|
889
|
+
size,
|
|
890
|
+
iotaNamesEnabled
|
|
891
|
+
}
|
|
892
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
819
893
|
ConnectModal,
|
|
820
894
|
{
|
|
821
|
-
trigger: /* @__PURE__ */ (0,
|
|
895
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(StyleMarker, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Button, { ...buttonProps, size, children: connectText }) })
|
|
822
896
|
}
|
|
823
897
|
);
|
|
824
898
|
}
|