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