@meshsdk/react 1.9.0-beta.3 → 1.9.0-beta.30
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/dist/index.cjs +235 -128
- package/dist/index.d.cts +15 -6
- package/dist/index.d.ts +15 -6
- package/dist/index.js +215 -108
- package/package.json +7 -6
package/dist/index.cjs
CHANGED
|
@@ -23457,7 +23457,7 @@ __export(index_exports, {
|
|
|
23457
23457
|
module.exports = __toCommonJS(index_exports);
|
|
23458
23458
|
|
|
23459
23459
|
// src/cardano-wallet/index.tsx
|
|
23460
|
-
var
|
|
23460
|
+
var import_react14 = require("react");
|
|
23461
23461
|
|
|
23462
23462
|
// src/common/button.tsx
|
|
23463
23463
|
var React = __toESM(require("react"), 1);
|
|
@@ -23638,6 +23638,7 @@ var import_react2 = require("react");
|
|
|
23638
23638
|
// src/contexts/WalletContext.ts
|
|
23639
23639
|
var import_react = require("react");
|
|
23640
23640
|
var import_wallet = require("@meshsdk/wallet");
|
|
23641
|
+
var import_web3_sdk = require("@meshsdk/web3-sdk");
|
|
23641
23642
|
var INITIAL_STATE = {
|
|
23642
23643
|
walletName: void 0,
|
|
23643
23644
|
walletInstance: {}
|
|
@@ -23651,11 +23652,13 @@ var useWalletStore = () => {
|
|
|
23651
23652
|
const [address, setAddress] = (0, import_react.useState)("");
|
|
23652
23653
|
const [connectedWalletInstance, setConnectedWalletInstance] = (0, import_react.useState)(INITIAL_STATE.walletInstance);
|
|
23653
23654
|
const [connectedWalletName, setConnectedWalletName] = (0, import_react.useState)(INITIAL_STATE.walletName);
|
|
23655
|
+
const [web3Services, setWeb3Services] = (0, import_react.useState)(void 0);
|
|
23654
23656
|
const connectWallet = (0, import_react.useCallback)(
|
|
23655
|
-
async (walletName,
|
|
23657
|
+
async (walletName, persist) => {
|
|
23656
23658
|
setConnectingWallet(true);
|
|
23657
23659
|
setState("CONNECTING" /* CONNECTING */);
|
|
23658
23660
|
try {
|
|
23661
|
+
const extensions = import_wallet.BrowserWallet.getSupportedExtensions(walletName);
|
|
23659
23662
|
const walletInstance = await import_wallet.BrowserWallet.enable(
|
|
23660
23663
|
walletName,
|
|
23661
23664
|
extensions
|
|
@@ -23687,10 +23690,16 @@ var useWalletStore = () => {
|
|
|
23687
23690
|
localStorage.removeItem(localstoragePersist);
|
|
23688
23691
|
}, []);
|
|
23689
23692
|
const setWallet = (0, import_react.useCallback)(
|
|
23690
|
-
async (walletInstance, walletName) => {
|
|
23693
|
+
async (walletInstance, walletName, persist) => {
|
|
23691
23694
|
setConnectedWalletInstance(walletInstance);
|
|
23692
23695
|
setConnectedWalletName(walletName);
|
|
23693
23696
|
setState("CONNECTED" /* CONNECTED */);
|
|
23697
|
+
if (persist) {
|
|
23698
|
+
localStorage.setItem(
|
|
23699
|
+
localstoragePersist,
|
|
23700
|
+
JSON.stringify({ walletName, ...persist })
|
|
23701
|
+
);
|
|
23702
|
+
}
|
|
23694
23703
|
},
|
|
23695
23704
|
[]
|
|
23696
23705
|
);
|
|
@@ -23714,7 +23723,22 @@ var useWalletStore = () => {
|
|
|
23714
23723
|
const persist2 = JSON.parse(
|
|
23715
23724
|
localStorage.getItem(localstoragePersist) || ""
|
|
23716
23725
|
);
|
|
23717
|
-
|
|
23726
|
+
if (persist2.walletName == "Mesh Web3 Services" && web3Services) {
|
|
23727
|
+
import_web3_sdk.Web3Wallet.initWallet({
|
|
23728
|
+
networkId: web3Services.networkId,
|
|
23729
|
+
address: persist2.walletAddress,
|
|
23730
|
+
fetcher: web3Services.fetcher,
|
|
23731
|
+
submitter: web3Services.submitter,
|
|
23732
|
+
projectId: web3Services.projectId,
|
|
23733
|
+
appUrl: web3Services.appUrl
|
|
23734
|
+
}).then((wallet) => {
|
|
23735
|
+
setConnectedWalletInstance(wallet);
|
|
23736
|
+
setConnectedWalletName(persist2.walletName);
|
|
23737
|
+
setState("CONNECTED" /* CONNECTED */);
|
|
23738
|
+
});
|
|
23739
|
+
} else {
|
|
23740
|
+
connectWallet(persist2.walletName);
|
|
23741
|
+
}
|
|
23718
23742
|
}
|
|
23719
23743
|
}, [persistSession]);
|
|
23720
23744
|
return {
|
|
@@ -23726,6 +23750,7 @@ var useWalletStore = () => {
|
|
|
23726
23750
|
disconnect,
|
|
23727
23751
|
setWallet,
|
|
23728
23752
|
setPersist,
|
|
23753
|
+
setWeb3Services,
|
|
23729
23754
|
error,
|
|
23730
23755
|
address,
|
|
23731
23756
|
state
|
|
@@ -23744,6 +23769,8 @@ var WalletContext = (0, import_react.createContext)({
|
|
|
23744
23769
|
},
|
|
23745
23770
|
setPersist: () => {
|
|
23746
23771
|
},
|
|
23772
|
+
setWeb3Services: () => {
|
|
23773
|
+
},
|
|
23747
23774
|
address: "",
|
|
23748
23775
|
state: "NOT_CONNECTED" /* NOT_CONNECTED */
|
|
23749
23776
|
});
|
|
@@ -23865,6 +23892,7 @@ var useWallet = () => {
|
|
|
23865
23892
|
disconnect,
|
|
23866
23893
|
setWallet,
|
|
23867
23894
|
setPersist,
|
|
23895
|
+
setWeb3Services,
|
|
23868
23896
|
error,
|
|
23869
23897
|
address,
|
|
23870
23898
|
state
|
|
@@ -23883,6 +23911,7 @@ var useWallet = () => {
|
|
|
23883
23911
|
disconnect,
|
|
23884
23912
|
setWallet,
|
|
23885
23913
|
setPersist,
|
|
23914
|
+
setWeb3Services,
|
|
23886
23915
|
error,
|
|
23887
23916
|
address,
|
|
23888
23917
|
state
|
|
@@ -24241,7 +24270,6 @@ function IconDownload() {
|
|
|
24241
24270
|
height: "24px",
|
|
24242
24271
|
strokeWidth: "1px"
|
|
24243
24272
|
},
|
|
24244
|
-
className: "hover:mesh-fill-white",
|
|
24245
24273
|
children: [
|
|
24246
24274
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
24247
24275
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("polyline", { points: "7 10 12 15 17 10" }),
|
|
@@ -24346,7 +24374,8 @@ function WalletIcon({
|
|
|
24346
24374
|
icon,
|
|
24347
24375
|
name,
|
|
24348
24376
|
action,
|
|
24349
|
-
iconReactNode
|
|
24377
|
+
iconReactNode,
|
|
24378
|
+
loading = false
|
|
24350
24379
|
}) {
|
|
24351
24380
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Tooltip, { delayDuration: 0, defaultOpen: false, children: [
|
|
24352
24381
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
@@ -24354,9 +24383,11 @@ function WalletIcon({
|
|
|
24354
24383
|
{
|
|
24355
24384
|
className: "mesh-flex mesh-items-center mesh-justify-center mesh-rounded-lg mesh-w-10 mesh-h-10 mesh-bg-neutral-50 mesh-border mesh-border-zinc-700 hover:mesh-border-zinc-200 mesh-cursor-pointer",
|
|
24356
24385
|
onClick: action,
|
|
24386
|
+
disabled: loading,
|
|
24357
24387
|
children: [
|
|
24358
|
-
icon && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("img", { src: icon, alt: name, className: "mesh-w-8 mesh-h-8" }),
|
|
24359
|
-
iconReactNode && iconReactNode
|
|
24388
|
+
icon && !loading && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("img", { src: icon, alt: name, className: "mesh-w-8 mesh-h-8" }),
|
|
24389
|
+
!loading && iconReactNode && iconReactNode,
|
|
24390
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-black", children: "..." })
|
|
24360
24391
|
]
|
|
24361
24392
|
}
|
|
24362
24393
|
) }),
|
|
@@ -24364,34 +24395,107 @@ function WalletIcon({
|
|
|
24364
24395
|
] });
|
|
24365
24396
|
}
|
|
24366
24397
|
|
|
24367
|
-
// src/cardano-wallet/
|
|
24398
|
+
// src/cardano-wallet/web3-services.tsx
|
|
24399
|
+
var import_react11 = require("react");
|
|
24400
|
+
var import_web3_sdk2 = require("@meshsdk/web3-sdk");
|
|
24401
|
+
|
|
24402
|
+
// src/common/icons/icon-discord.tsx
|
|
24368
24403
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
24404
|
+
function IconDiscord() {
|
|
24405
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
24406
|
+
"svg",
|
|
24407
|
+
{
|
|
24408
|
+
viewBox: "0 0 20 20",
|
|
24409
|
+
"aria-hidden": "true",
|
|
24410
|
+
style: {
|
|
24411
|
+
color: "#ffadff",
|
|
24412
|
+
width: "24px",
|
|
24413
|
+
height: "24px",
|
|
24414
|
+
strokeWidth: "1px",
|
|
24415
|
+
fill: "#5865F2"
|
|
24416
|
+
},
|
|
24417
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M16.238 4.515a14.842 14.842 0 0 0-3.664-1.136.055.055 0 0 0-.059.027 10.35 10.35 0 0 0-.456.938 13.702 13.702 0 0 0-4.115 0 9.479 9.479 0 0 0-.464-.938.058.058 0 0 0-.058-.027c-1.266.218-2.497.6-3.664 1.136a.052.052 0 0 0-.024.02C1.4 8.023.76 11.424 1.074 14.782a.062.062 0 0 0 .024.042 14.923 14.923 0 0 0 4.494 2.272.058.058 0 0 0 .064-.02c.346-.473.654-.972.92-1.496a.057.057 0 0 0-.032-.08 9.83 9.83 0 0 1-1.404-.669.058.058 0 0 1-.029-.046.058.058 0 0 1 .023-.05c.094-.07.189-.144.279-.218a.056.056 0 0 1 .058-.008c2.946 1.345 6.135 1.345 9.046 0a.056.056 0 0 1 .059.007c.09.074.184.149.28.22a.058.058 0 0 1 .023.049.059.059 0 0 1-.028.046 9.224 9.224 0 0 1-1.405.669.058.058 0 0 0-.033.033.056.056 0 0 0 .002.047c.27.523.58 1.022.92 1.495a.056.056 0 0 0 .062.021 14.878 14.878 0 0 0 4.502-2.272.055.055 0 0 0 .016-.018.056.056 0 0 0 .008-.023c.375-3.883-.63-7.256-2.662-10.246a.046.046 0 0 0-.023-.021Zm-9.223 8.221c-.887 0-1.618-.814-1.618-1.814s.717-1.814 1.618-1.814c.908 0 1.632.821 1.618 1.814 0 1-.717 1.814-1.618 1.814Zm5.981 0c-.887 0-1.618-.814-1.618-1.814s.717-1.814 1.618-1.814c.908 0 1.632.821 1.618 1.814 0 1-.71 1.814-1.618 1.814Z" })
|
|
24418
|
+
}
|
|
24419
|
+
);
|
|
24420
|
+
}
|
|
24421
|
+
|
|
24422
|
+
// src/cardano-wallet/web3-services.tsx
|
|
24423
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
24424
|
+
function Web3Services({
|
|
24425
|
+
options,
|
|
24426
|
+
setOpen,
|
|
24427
|
+
persist
|
|
24428
|
+
}) {
|
|
24429
|
+
const { setWallet } = useWallet();
|
|
24430
|
+
const [loading, setLoading] = (0, import_react11.useState)(false);
|
|
24431
|
+
async function loadWallet() {
|
|
24432
|
+
setLoading(true);
|
|
24433
|
+
const _options = {
|
|
24434
|
+
networkId: 0,
|
|
24435
|
+
fetcher: options.fetcher,
|
|
24436
|
+
submitter: options.submitter,
|
|
24437
|
+
appUrl: options.appUrl,
|
|
24438
|
+
projectId: options.projectId
|
|
24439
|
+
};
|
|
24440
|
+
const wallet = await import_web3_sdk2.Web3Wallet.enable(_options);
|
|
24441
|
+
setWallet(
|
|
24442
|
+
wallet,
|
|
24443
|
+
"Mesh Web3 Services",
|
|
24444
|
+
persist ? {
|
|
24445
|
+
walletAddress: await wallet.getChangeAddress()
|
|
24446
|
+
} : void 0
|
|
24447
|
+
);
|
|
24448
|
+
setLoading(false);
|
|
24449
|
+
setOpen(false);
|
|
24450
|
+
}
|
|
24451
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
24452
|
+
WalletIcon,
|
|
24453
|
+
{
|
|
24454
|
+
iconReactNode: IconDiscord(),
|
|
24455
|
+
name: `Discord`,
|
|
24456
|
+
action: () => loadWallet(),
|
|
24457
|
+
loading
|
|
24458
|
+
}
|
|
24459
|
+
);
|
|
24460
|
+
}
|
|
24461
|
+
|
|
24462
|
+
// src/cardano-wallet/screen-main.tsx
|
|
24463
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
24369
24464
|
function ScreenMain({
|
|
24370
24465
|
injectFn,
|
|
24371
|
-
extensions,
|
|
24372
24466
|
setOpen,
|
|
24373
24467
|
setScreen,
|
|
24374
24468
|
persist,
|
|
24375
24469
|
cardanoPeerConnect,
|
|
24376
24470
|
burnerWallet,
|
|
24377
|
-
webauthn
|
|
24471
|
+
webauthn,
|
|
24472
|
+
showDownload,
|
|
24473
|
+
web3Services
|
|
24378
24474
|
}) {
|
|
24379
24475
|
const wallets = useWalletList({ injectFn });
|
|
24380
24476
|
const { connect: connect2 } = useWallet();
|
|
24381
|
-
return /* @__PURE__ */ (0,
|
|
24382
|
-
wallets.map((wallet, index) => /* @__PURE__ */ (0,
|
|
24477
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "mesh-grid mesh-gap-4 mesh-py-4 mesh-grid-cols-5 mesh-place-items-center mesh-gap-y-8", children: [
|
|
24478
|
+
wallets.map((wallet, index) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
24383
24479
|
WalletIcon,
|
|
24384
24480
|
{
|
|
24385
24481
|
icon: wallet.icon,
|
|
24386
24482
|
name: wallet.name,
|
|
24387
24483
|
action: () => {
|
|
24388
|
-
connect2(wallet.id,
|
|
24484
|
+
connect2(wallet.id, persist);
|
|
24389
24485
|
setOpen(false);
|
|
24390
24486
|
}
|
|
24391
24487
|
},
|
|
24392
24488
|
index
|
|
24393
24489
|
)),
|
|
24394
|
-
|
|
24490
|
+
web3Services && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
24491
|
+
Web3Services,
|
|
24492
|
+
{
|
|
24493
|
+
options: web3Services,
|
|
24494
|
+
setOpen,
|
|
24495
|
+
persist
|
|
24496
|
+
}
|
|
24497
|
+
),
|
|
24498
|
+
webauthn && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
24395
24499
|
WalletIcon,
|
|
24396
24500
|
{
|
|
24397
24501
|
iconReactNode: IconFingerprint(),
|
|
@@ -24401,7 +24505,7 @@ function ScreenMain({
|
|
|
24401
24505
|
}
|
|
24402
24506
|
}
|
|
24403
24507
|
),
|
|
24404
|
-
cardanoPeerConnect && /* @__PURE__ */ (0,
|
|
24508
|
+
cardanoPeerConnect && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
24405
24509
|
WalletIcon,
|
|
24406
24510
|
{
|
|
24407
24511
|
iconReactNode: IconMonitorSmartphone(),
|
|
@@ -24411,7 +24515,7 @@ function ScreenMain({
|
|
|
24411
24515
|
}
|
|
24412
24516
|
}
|
|
24413
24517
|
),
|
|
24414
|
-
burnerWallet && /* @__PURE__ */ (0,
|
|
24518
|
+
burnerWallet && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
24415
24519
|
WalletIcon,
|
|
24416
24520
|
{
|
|
24417
24521
|
iconReactNode: IconBookDashed(),
|
|
@@ -24421,7 +24525,7 @@ function ScreenMain({
|
|
|
24421
24525
|
}
|
|
24422
24526
|
}
|
|
24423
24527
|
),
|
|
24424
|
-
/* @__PURE__ */ (0,
|
|
24528
|
+
showDownload && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
24425
24529
|
WalletIcon,
|
|
24426
24530
|
{
|
|
24427
24531
|
iconReactNode: IconDownload(),
|
|
@@ -24438,19 +24542,19 @@ function ScreenMain({
|
|
|
24438
24542
|
}
|
|
24439
24543
|
|
|
24440
24544
|
// src/cardano-wallet/screen-p2p.tsx
|
|
24441
|
-
var
|
|
24545
|
+
var import_react12 = require("react");
|
|
24442
24546
|
var import_cardano_peer_connect = __toESM(require_dist(), 1);
|
|
24443
|
-
var
|
|
24547
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
24444
24548
|
function ScreenP2P({
|
|
24445
24549
|
cardanoPeerConnect,
|
|
24446
24550
|
setOpen
|
|
24447
24551
|
}) {
|
|
24448
|
-
const dAppConnect = (0,
|
|
24449
|
-
const qrCodeField = (0,
|
|
24450
|
-
const [address, setAddress] = (0,
|
|
24451
|
-
const [copied, setCopied] = (0,
|
|
24552
|
+
const dAppConnect = (0, import_react12.useRef)(null);
|
|
24553
|
+
const qrCodeField = (0, import_react12.useRef)(null);
|
|
24554
|
+
const [address, setAddress] = (0, import_react12.useState)("");
|
|
24555
|
+
const [copied, setCopied] = (0, import_react12.useState)(false);
|
|
24452
24556
|
const { connect: connect2 } = useWallet();
|
|
24453
|
-
(0,
|
|
24557
|
+
(0, import_react12.useEffect)(() => {
|
|
24454
24558
|
if (cardanoPeerConnect) {
|
|
24455
24559
|
if (dAppConnect.current === null) {
|
|
24456
24560
|
dAppConnect.current = new import_cardano_peer_connect.DAppPeerConnect({
|
|
@@ -24484,9 +24588,9 @@ function ScreenP2P({
|
|
|
24484
24588
|
}
|
|
24485
24589
|
}
|
|
24486
24590
|
}, []);
|
|
24487
|
-
return /* @__PURE__ */ (0,
|
|
24488
|
-
/* @__PURE__ */ (0,
|
|
24489
|
-
/* @__PURE__ */ (0,
|
|
24591
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "mesh-flex mesh-flex-col mesh-items-center mesh-justify-center", children: [
|
|
24592
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { marginTop: 16, marginBottom: 16 }, ref: qrCodeField }),
|
|
24593
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
24490
24594
|
Button,
|
|
24491
24595
|
{
|
|
24492
24596
|
variant: "outline",
|
|
@@ -24501,15 +24605,15 @@ function ScreenP2P({
|
|
|
24501
24605
|
}
|
|
24502
24606
|
|
|
24503
24607
|
// src/cardano-wallet/screen-webauthn.tsx
|
|
24504
|
-
var
|
|
24608
|
+
var import_react13 = require("react");
|
|
24505
24609
|
var import_wallet4 = require("@meshsdk/wallet");
|
|
24506
24610
|
|
|
24507
24611
|
// src/common/input.tsx
|
|
24508
24612
|
var React5 = __toESM(require("react"), 1);
|
|
24509
|
-
var
|
|
24613
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
24510
24614
|
var Input = React5.forwardRef(
|
|
24511
24615
|
({ className, type, ...props }, ref) => {
|
|
24512
|
-
return /* @__PURE__ */ (0,
|
|
24616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
24513
24617
|
"input",
|
|
24514
24618
|
{
|
|
24515
24619
|
type,
|
|
@@ -24529,11 +24633,11 @@ Input.displayName = "Input";
|
|
|
24529
24633
|
var React6 = __toESM(require("react"), 1);
|
|
24530
24634
|
var LabelPrimitive = __toESM(require("@radix-ui/react-label"), 1);
|
|
24531
24635
|
var import_class_variance_authority2 = require("class-variance-authority");
|
|
24532
|
-
var
|
|
24636
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
24533
24637
|
var labelVariants = (0, import_class_variance_authority2.cva)(
|
|
24534
24638
|
"mesh-text-sm mesh-font-medium mesh-leading-none peer-disabled:mesh-cursor-not-allowed peer-disabled:mesh-opacity-70"
|
|
24535
24639
|
);
|
|
24536
|
-
var Label2 = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
24640
|
+
var Label2 = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
24537
24641
|
LabelPrimitive.Root,
|
|
24538
24642
|
{
|
|
24539
24643
|
ref,
|
|
@@ -24544,16 +24648,16 @@ var Label2 = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
24544
24648
|
Label2.displayName = LabelPrimitive.Root.displayName;
|
|
24545
24649
|
|
|
24546
24650
|
// src/cardano-wallet/screen-webauthn.tsx
|
|
24547
|
-
var
|
|
24651
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
24548
24652
|
function ScreenWebauthn({
|
|
24549
24653
|
url,
|
|
24550
24654
|
networkId,
|
|
24551
24655
|
provider,
|
|
24552
24656
|
setOpen
|
|
24553
24657
|
}) {
|
|
24554
|
-
const [loading, setLoading] = (0,
|
|
24555
|
-
const [userName, setUserName] = (0,
|
|
24556
|
-
const [password, setPassword] = (0,
|
|
24658
|
+
const [loading, setLoading] = (0, import_react13.useState)(false);
|
|
24659
|
+
const [userName, setUserName] = (0, import_react13.useState)("");
|
|
24660
|
+
const [password, setPassword] = (0, import_react13.useState)("");
|
|
24557
24661
|
const { setWallet } = useWallet();
|
|
24558
24662
|
function createWallet(root) {
|
|
24559
24663
|
setTimeout(() => {
|
|
@@ -24578,10 +24682,10 @@ function ScreenWebauthn({
|
|
|
24578
24682
|
createWallet(res.wallet.bech32PrivateKey);
|
|
24579
24683
|
}
|
|
24580
24684
|
}
|
|
24581
|
-
return /* @__PURE__ */ (0,
|
|
24582
|
-
/* @__PURE__ */ (0,
|
|
24583
|
-
/* @__PURE__ */ (0,
|
|
24584
|
-
/* @__PURE__ */ (0,
|
|
24685
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "mesh-flex mesh-flex-row mesh-flex-gap-4 mesh-items-center mesh-justify-center", children: loading ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children: "Connecting wallet..." }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "mesh-flex mesh-flex-col mesh-gap-6 mesh-w-full mesh-mx-8", children: [
|
|
24686
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "mesh-grid mesh-gap-2", children: [
|
|
24687
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Label2, { htmlFor: "username", children: "Username" }),
|
|
24688
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
24585
24689
|
Input,
|
|
24586
24690
|
{
|
|
24587
24691
|
id: "username",
|
|
@@ -24591,11 +24695,11 @@ function ScreenWebauthn({
|
|
|
24591
24695
|
onChange: (e2) => setUserName(e2.target.value)
|
|
24592
24696
|
}
|
|
24593
24697
|
),
|
|
24594
|
-
/* @__PURE__ */ (0,
|
|
24698
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "mesh-text-gray-500 mesh-text-xs", children: "Unique to the application you are connecting." })
|
|
24595
24699
|
] }),
|
|
24596
|
-
/* @__PURE__ */ (0,
|
|
24597
|
-
/* @__PURE__ */ (0,
|
|
24598
|
-
/* @__PURE__ */ (0,
|
|
24700
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "mesh-grid mesh-gap-2", children: [
|
|
24701
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "mesh-flex mesh-items-center", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Label2, { htmlFor: "password", children: "Unique Code" }) }),
|
|
24702
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
24599
24703
|
Input,
|
|
24600
24704
|
{
|
|
24601
24705
|
id: "password",
|
|
@@ -24605,9 +24709,9 @@ function ScreenWebauthn({
|
|
|
24605
24709
|
onChange: (e2) => setPassword(e2.target.value)
|
|
24606
24710
|
}
|
|
24607
24711
|
),
|
|
24608
|
-
/* @__PURE__ */ (0,
|
|
24712
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "mesh-text-gray-500 mesh-text-xs", children: "Additional security to derive your wallet." })
|
|
24609
24713
|
] }),
|
|
24610
|
-
/* @__PURE__ */ (0,
|
|
24714
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
24611
24715
|
Button,
|
|
24612
24716
|
{
|
|
24613
24717
|
className: "mesh-w-full",
|
|
@@ -24620,59 +24724,62 @@ function ScreenWebauthn({
|
|
|
24620
24724
|
}
|
|
24621
24725
|
|
|
24622
24726
|
// src/cardano-wallet/index.tsx
|
|
24623
|
-
var
|
|
24727
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
24624
24728
|
var CardanoWallet = ({
|
|
24625
24729
|
label = "Connect Wallet",
|
|
24626
24730
|
onConnected = void 0,
|
|
24627
24731
|
isDark = false,
|
|
24628
24732
|
persist = false,
|
|
24629
|
-
extensions = [],
|
|
24630
24733
|
injectFn = void 0,
|
|
24631
24734
|
cardanoPeerConnect = void 0,
|
|
24632
24735
|
burnerWallet = void 0,
|
|
24633
|
-
webauthn = void 0
|
|
24736
|
+
webauthn = void 0,
|
|
24737
|
+
showDownload = true,
|
|
24738
|
+
web3Services = void 0
|
|
24634
24739
|
}) => {
|
|
24635
|
-
const [open, setOpen] = (0,
|
|
24636
|
-
const [screen, setScreen] = (0,
|
|
24637
|
-
const { wallet, connected, setPersist } = useWallet();
|
|
24638
|
-
(0,
|
|
24740
|
+
const [open, setOpen] = (0, import_react14.useState)(false);
|
|
24741
|
+
const [screen, setScreen] = (0, import_react14.useState)("main");
|
|
24742
|
+
const { wallet, connected, setPersist, setWeb3Services } = useWallet();
|
|
24743
|
+
(0, import_react14.useEffect)(() => {
|
|
24639
24744
|
setPersist(persist);
|
|
24640
|
-
|
|
24641
|
-
|
|
24745
|
+
if (web3Services) setWeb3Services(web3Services);
|
|
24746
|
+
}, []);
|
|
24747
|
+
(0, import_react14.useEffect)(() => {
|
|
24642
24748
|
if (connected) {
|
|
24643
24749
|
if (onConnected) onConnected();
|
|
24644
24750
|
}
|
|
24645
24751
|
}, [connected, wallet]);
|
|
24646
|
-
return /* @__PURE__ */ (0,
|
|
24647
|
-
/* @__PURE__ */ (0,
|
|
24648
|
-
/* @__PURE__ */ (0,
|
|
24752
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Dialog, { open, onOpenChange: setOpen, children: [
|
|
24753
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: isDark ? "mesh-dark" : "", children: !connected ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Button, { variant: "outline", className: isDark ? "mesh-dark" : "", children: label }) }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ConnectedButton, {}) }),
|
|
24754
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
24649
24755
|
DialogContent,
|
|
24650
24756
|
{
|
|
24651
24757
|
className: "sm:mesh-max-w-[425px] mesh-dark",
|
|
24652
24758
|
onOpenAutoFocus: (event) => event.preventDefault(),
|
|
24653
24759
|
children: [
|
|
24654
|
-
/* @__PURE__ */ (0,
|
|
24655
|
-
screen == "main" && /* @__PURE__ */ (0,
|
|
24760
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Header, { screen, setScreen }),
|
|
24761
|
+
screen == "main" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
24656
24762
|
ScreenMain,
|
|
24657
24763
|
{
|
|
24658
24764
|
injectFn,
|
|
24659
|
-
extensions,
|
|
24660
24765
|
setOpen,
|
|
24661
24766
|
setScreen,
|
|
24662
24767
|
persist,
|
|
24663
24768
|
cardanoPeerConnect: cardanoPeerConnect != void 0,
|
|
24664
24769
|
burnerWallet: burnerWallet != void 0,
|
|
24665
|
-
webauthn: webauthn != void 0
|
|
24770
|
+
webauthn: webauthn != void 0,
|
|
24771
|
+
showDownload,
|
|
24772
|
+
web3Services
|
|
24666
24773
|
}
|
|
24667
24774
|
),
|
|
24668
|
-
screen == "p2p" && /* @__PURE__ */ (0,
|
|
24775
|
+
screen == "p2p" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
24669
24776
|
ScreenP2P,
|
|
24670
24777
|
{
|
|
24671
24778
|
cardanoPeerConnect,
|
|
24672
24779
|
setOpen
|
|
24673
24780
|
}
|
|
24674
24781
|
),
|
|
24675
|
-
screen == "burner" && burnerWallet && /* @__PURE__ */ (0,
|
|
24782
|
+
screen == "burner" && burnerWallet && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
24676
24783
|
ScreenBurner,
|
|
24677
24784
|
{
|
|
24678
24785
|
networkId: burnerWallet.networkId,
|
|
@@ -24680,7 +24787,7 @@ var CardanoWallet = ({
|
|
|
24680
24787
|
setOpen
|
|
24681
24788
|
}
|
|
24682
24789
|
),
|
|
24683
|
-
screen == "webauthn" && webauthn && /* @__PURE__ */ (0,
|
|
24790
|
+
screen == "webauthn" && webauthn && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
24684
24791
|
ScreenWebauthn,
|
|
24685
24792
|
{
|
|
24686
24793
|
url: webauthn.url,
|
|
@@ -24689,7 +24796,7 @@ var CardanoWallet = ({
|
|
|
24689
24796
|
setOpen
|
|
24690
24797
|
}
|
|
24691
24798
|
),
|
|
24692
|
-
/* @__PURE__ */ (0,
|
|
24799
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Footer, {})
|
|
24693
24800
|
]
|
|
24694
24801
|
}
|
|
24695
24802
|
)
|
|
@@ -24699,25 +24806,25 @@ function Header({
|
|
|
24699
24806
|
screen,
|
|
24700
24807
|
setScreen
|
|
24701
24808
|
}) {
|
|
24702
|
-
return /* @__PURE__ */ (0,
|
|
24703
|
-
/* @__PURE__ */ (0,
|
|
24704
|
-
screen != "main" ? /* @__PURE__ */ (0,
|
|
24705
|
-
/* @__PURE__ */ (0,
|
|
24706
|
-
/* @__PURE__ */ (0,
|
|
24809
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DialogHeader, { children: [
|
|
24810
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DialogTitle, { className: "mesh-flex mesh-justify-between", children: [
|
|
24811
|
+
screen != "main" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { onClick: () => setScreen("main"), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(IconChevronRight, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: { width: "24px" } }),
|
|
24812
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: screens[screen].title }),
|
|
24813
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: { width: "24px" } })
|
|
24707
24814
|
] }),
|
|
24708
|
-
/* @__PURE__ */ (0,
|
|
24815
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogDescription, { children: screens[screen].subtitle && screens[screen].subtitle })
|
|
24709
24816
|
] });
|
|
24710
24817
|
}
|
|
24711
24818
|
function Footer() {
|
|
24712
|
-
return /* @__PURE__ */ (0,
|
|
24819
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogFooter, { className: "mesh-justify-center mesh-text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
24713
24820
|
"a",
|
|
24714
24821
|
{
|
|
24715
24822
|
href: "https://meshjs.dev/",
|
|
24716
24823
|
target: "_blank",
|
|
24717
24824
|
className: "mesh-grow mesh-flex mesh-gap-1 mesh-items-center mesh-justify-center mesh-text-zinc-500 hover:mesh-text-white mesh-fill-zinc-500 hover:mesh-fill-white",
|
|
24718
24825
|
children: [
|
|
24719
|
-
/* @__PURE__ */ (0,
|
|
24720
|
-
/* @__PURE__ */ (0,
|
|
24826
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "", children: "Powered by" }),
|
|
24827
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
24721
24828
|
"svg",
|
|
24722
24829
|
{
|
|
24723
24830
|
width: 24,
|
|
@@ -24725,31 +24832,31 @@ function Footer() {
|
|
|
24725
24832
|
enableBackground: "new 0 0 300 200",
|
|
24726
24833
|
viewBox: "0 0 300 200",
|
|
24727
24834
|
xmlns: "http://www.w3.org/2000/svg",
|
|
24728
|
-
children: /* @__PURE__ */ (0,
|
|
24835
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "m289 127-45-60-45-60c-.9-1.3-2.4-2-4-2s-3.1.7-4 2l-37 49.3c-2 2.7-6 2.7-8 0l-37-49.3c-.9-1.3-2.4-2-4-2s-3.1.7-4 2l-45 60-45 60c-1.3 1.8-1.3 4.2 0 6l45 60c.9 1.3 2.4 2 4 2s3.1-.7 4-2l37-49.3c2-2.7 6-2.7 8 0l37 49.3c.9 1.3 2.4 2 4 2s3.1-.7 4-2l37-49.3c2-2.7 6-2.7 8 0l37 49.3c.9 1.3 2.4 2 4 2s3.1-.7 4-2l45-60c1.3-1.8 1.3-4.2 0-6zm-90-103.3 32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0l-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0zm-90 0 32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0l-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0zm-53 152.6-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0l32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0zm90 0-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0l32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0zm90 0-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0l32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0z" })
|
|
24729
24836
|
}
|
|
24730
24837
|
),
|
|
24731
|
-
/* @__PURE__ */ (0,
|
|
24838
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "", children: "Mesh SDK" })
|
|
24732
24839
|
]
|
|
24733
24840
|
}
|
|
24734
24841
|
) });
|
|
24735
24842
|
}
|
|
24736
24843
|
|
|
24737
24844
|
// src/mesh-badge/mesh-logo.tsx
|
|
24738
|
-
var
|
|
24739
|
-
var MeshLogo = () => /* @__PURE__ */ (0,
|
|
24845
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
24846
|
+
var MeshLogo = () => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
24740
24847
|
"svg",
|
|
24741
24848
|
{
|
|
24742
24849
|
className: "mesh-h-16 mesh-p-2",
|
|
24743
24850
|
fill: "currentColor",
|
|
24744
24851
|
viewBox: "0 0 300 200",
|
|
24745
24852
|
xmlns: "http://www.w3.org/2000/svg",
|
|
24746
|
-
children: /* @__PURE__ */ (0,
|
|
24853
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "m289 127-45-60-45-60c-.9-1.3-2.4-2-4-2s-3.1.7-4 2l-37 49.3c-2 2.7-6 2.7-8 0l-37-49.3c-.9-1.3-2.4-2-4-2s-3.1.7-4 2l-45 60-45 60c-1.3 1.8-1.3 4.2 0 6l45 60c.9 1.3 2.4 2 4 2s3.1-.7 4-2l37-49.3c2-2.7 6-2.7 8 0l37 49.3c.9 1.3 2.4 2 4 2s3.1-.7 4-2l37-49.3c2-2.7 6-2.7 8 0l37 49.3c.9 1.3 2.4 2 4 2s3.1-.7 4-2l45-60c1.3-1.8 1.3-4.2 0-6zm-90-103.3 32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0l-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0zm-90 0 32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0l-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0zm-53 152.6-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0l32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0zm90 0-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0l32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0zm90 0-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0l32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0z" })
|
|
24747
24854
|
}
|
|
24748
24855
|
);
|
|
24749
24856
|
|
|
24750
24857
|
// src/mesh-badge/index.tsx
|
|
24751
|
-
var
|
|
24752
|
-
var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ (0,
|
|
24858
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
24859
|
+
var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
24753
24860
|
"a",
|
|
24754
24861
|
{
|
|
24755
24862
|
className: `mesh-flex mesh-max-w-fit mesh-flex-col mesh-items-center mesh-rounded-md mesh-border mesh-border-solid mesh-border-current mesh-p-1 mesh-text-xl mesh-font-semibold mesh-no-underline ${isDark ? `mesh-bg-neutral-950 mesh-text-neutral-50` : `mesh-bg-neutral-50 mesh-text-neutral-950`}`,
|
|
@@ -24761,21 +24868,21 @@ var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ (0, import_jsx_runtime21
|
|
|
24761
24868
|
rel: "noopener noreferrer",
|
|
24762
24869
|
target: "_blank",
|
|
24763
24870
|
children: [
|
|
24764
|
-
/* @__PURE__ */ (0,
|
|
24871
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MeshLogo, {}),
|
|
24765
24872
|
"Mesh"
|
|
24766
24873
|
]
|
|
24767
24874
|
}
|
|
24768
24875
|
);
|
|
24769
24876
|
|
|
24770
24877
|
// src/stake-button/index.tsx
|
|
24771
|
-
var
|
|
24878
|
+
var import_react16 = require("react");
|
|
24772
24879
|
var import_transaction = require("@meshsdk/transaction");
|
|
24773
24880
|
|
|
24774
24881
|
// src/cardano-wallet-dropdown/index.tsx
|
|
24775
|
-
var
|
|
24882
|
+
var import_react15 = require("react");
|
|
24776
24883
|
|
|
24777
24884
|
// src/common/button-dropdown.tsx
|
|
24778
|
-
var
|
|
24885
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
24779
24886
|
function ButtonDropdown({
|
|
24780
24887
|
children,
|
|
24781
24888
|
isDarkMode = false,
|
|
@@ -24784,7 +24891,7 @@ function ButtonDropdown({
|
|
|
24784
24891
|
onMouseEnter,
|
|
24785
24892
|
onMouseLeave
|
|
24786
24893
|
}) {
|
|
24787
|
-
return /* @__PURE__ */ (0,
|
|
24894
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
24788
24895
|
"button",
|
|
24789
24896
|
{
|
|
24790
24897
|
className: `mesh-mr-menu-list mesh-flex mesh-w-60 mesh-items-center mesh-justify-center mesh-rounded-t-md mesh-border mesh-px-4 mesh-py-2 mesh-text-lg mesh-font-normal mesh-shadow-sm ${isDarkMode ? `mesh-bg-neutral-950 mesh-text-neutral-50` : `mesh-bg-neutral-50 mesh-text-neutral-950`}`,
|
|
@@ -24797,21 +24904,21 @@ function ButtonDropdown({
|
|
|
24797
24904
|
}
|
|
24798
24905
|
|
|
24799
24906
|
// src/cardano-wallet-dropdown/menu-item.tsx
|
|
24800
|
-
var
|
|
24907
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
24801
24908
|
function MenuItem({
|
|
24802
24909
|
icon,
|
|
24803
24910
|
label,
|
|
24804
24911
|
action,
|
|
24805
24912
|
active
|
|
24806
24913
|
}) {
|
|
24807
|
-
return /* @__PURE__ */ (0,
|
|
24914
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
24808
24915
|
"div",
|
|
24809
24916
|
{
|
|
24810
24917
|
className: "mesh-flex mesh-cursor-pointer mesh-items-center mesh-px-4 mesh-py-2 mesh-opacity-80 hover:mesh-opacity-100 mesh-h-16",
|
|
24811
24918
|
onClick: action,
|
|
24812
24919
|
children: [
|
|
24813
|
-
icon && /* @__PURE__ */ (0,
|
|
24814
|
-
/* @__PURE__ */ (0,
|
|
24920
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("img", { className: "mesh-pr-2 mesh-m-1 mesh-h-8", src: icon }),
|
|
24921
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "mesh-mr-menu-item mesh-text-xl mesh-font-normal mesh-text-neutral-700 hover:mesh-text-black", children: label.split(" ").map((word) => {
|
|
24815
24922
|
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
24816
24923
|
}).join(" ") })
|
|
24817
24924
|
]
|
|
@@ -24820,8 +24927,8 @@ function MenuItem({
|
|
|
24820
24927
|
}
|
|
24821
24928
|
|
|
24822
24929
|
// src/cardano-wallet-dropdown/chevron-down.tsx
|
|
24823
|
-
var
|
|
24824
|
-
var ChevronDown = () => /* @__PURE__ */ (0,
|
|
24930
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
24931
|
+
var ChevronDown = () => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
24825
24932
|
"svg",
|
|
24826
24933
|
{
|
|
24827
24934
|
className: "mesh-m-2 mesh-h-6",
|
|
@@ -24830,7 +24937,7 @@ var ChevronDown = () => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
|
24830
24937
|
viewBox: "0 0 24 24",
|
|
24831
24938
|
stroke: "currentColor",
|
|
24832
24939
|
xmlns: "http://www.w3.org/2000/svg",
|
|
24833
|
-
children: /* @__PURE__ */ (0,
|
|
24940
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
24834
24941
|
"path",
|
|
24835
24942
|
{
|
|
24836
24943
|
strokeLinecap: "round",
|
|
@@ -24843,7 +24950,7 @@ var ChevronDown = () => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
|
24843
24950
|
);
|
|
24844
24951
|
|
|
24845
24952
|
// src/cardano-wallet-dropdown/wallet-balance.tsx
|
|
24846
|
-
var
|
|
24953
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
24847
24954
|
var WalletBalance = ({
|
|
24848
24955
|
connected,
|
|
24849
24956
|
connecting,
|
|
@@ -24851,22 +24958,22 @@ var WalletBalance = ({
|
|
|
24851
24958
|
wallet
|
|
24852
24959
|
}) => {
|
|
24853
24960
|
const lovelace = useLovelace();
|
|
24854
|
-
return connected && lovelace && wallet?.icon ? /* @__PURE__ */ (0,
|
|
24855
|
-
/* @__PURE__ */ (0,
|
|
24961
|
+
return connected && lovelace && wallet?.icon ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
24962
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("img", { className: "mesh-m-2 mesh-h-6", src: wallet.icon }),
|
|
24856
24963
|
"\u20B3",
|
|
24857
24964
|
" ",
|
|
24858
24965
|
parseInt((parseInt(lovelace, 10) / 1e6).toString(), 10),
|
|
24859
24966
|
".",
|
|
24860
|
-
/* @__PURE__ */ (0,
|
|
24861
|
-
] }) : connected && wallet?.icon ? /* @__PURE__ */ (0,
|
|
24967
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "mesh-text-xs", children: lovelace.substring(lovelace.length - 6) })
|
|
24968
|
+
] }) : connected && wallet?.icon ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("img", { className: "mesh-m-2 mesh-h-6", src: wallet.icon }) }) : connecting ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, { children: "Connecting..." }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
24862
24969
|
label,
|
|
24863
24970
|
" ",
|
|
24864
|
-
/* @__PURE__ */ (0,
|
|
24971
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ChevronDown, {})
|
|
24865
24972
|
] });
|
|
24866
24973
|
};
|
|
24867
24974
|
|
|
24868
24975
|
// src/cardano-wallet-dropdown/index.tsx
|
|
24869
|
-
var
|
|
24976
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
24870
24977
|
var CardanoWallet2 = ({
|
|
24871
24978
|
label = "Connect Wallet",
|
|
24872
24979
|
onConnected = void 0,
|
|
@@ -24874,32 +24981,32 @@ var CardanoWallet2 = ({
|
|
|
24874
24981
|
extensions = [],
|
|
24875
24982
|
cardanoPeerConnect = void 0
|
|
24876
24983
|
}) => {
|
|
24877
|
-
const [isDarkMode, setIsDarkMode] = (0,
|
|
24878
|
-
const [hideMenuList, setHideMenuList] = (0,
|
|
24984
|
+
const [isDarkMode, setIsDarkMode] = (0, import_react15.useState)(false);
|
|
24985
|
+
const [hideMenuList, setHideMenuList] = (0, import_react15.useState)(true);
|
|
24879
24986
|
const { connect: connect2, connecting, connected, disconnect, name } = useWallet();
|
|
24880
24987
|
const wallets = useWalletList();
|
|
24881
|
-
(0,
|
|
24988
|
+
(0, import_react15.useEffect)(() => {
|
|
24882
24989
|
if (connected && onConnected) {
|
|
24883
24990
|
onConnected();
|
|
24884
24991
|
}
|
|
24885
24992
|
}, [connected]);
|
|
24886
|
-
(0,
|
|
24993
|
+
(0, import_react15.useEffect)(() => {
|
|
24887
24994
|
setIsDarkMode(isDark);
|
|
24888
24995
|
}, [isDark]);
|
|
24889
|
-
return /* @__PURE__ */ (0,
|
|
24996
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
24890
24997
|
"div",
|
|
24891
24998
|
{
|
|
24892
24999
|
onMouseEnter: () => setHideMenuList(false),
|
|
24893
25000
|
onMouseLeave: () => setHideMenuList(true),
|
|
24894
25001
|
style: { width: "min-content", zIndex: 50 },
|
|
24895
25002
|
children: [
|
|
24896
|
-
/* @__PURE__ */ (0,
|
|
25003
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
24897
25004
|
ButtonDropdown,
|
|
24898
25005
|
{
|
|
24899
25006
|
isDarkMode,
|
|
24900
25007
|
hideMenuList,
|
|
24901
25008
|
setHideMenuList,
|
|
24902
|
-
children: /* @__PURE__ */ (0,
|
|
25009
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
24903
25010
|
WalletBalance,
|
|
24904
25011
|
{
|
|
24905
25012
|
connected,
|
|
@@ -24910,12 +25017,12 @@ var CardanoWallet2 = ({
|
|
|
24910
25017
|
)
|
|
24911
25018
|
}
|
|
24912
25019
|
),
|
|
24913
|
-
/* @__PURE__ */ (0,
|
|
25020
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
24914
25021
|
"div",
|
|
24915
25022
|
{
|
|
24916
25023
|
className: `mesh-mr-menu-list mesh-absolute mesh-w-60 mesh-rounded-b-md mesh-border mesh-text-center mesh-shadow-sm mesh-backdrop-blur ${hideMenuList && "mesh-hidden"} ${isDarkMode ? `mesh-bg-neutral-950 mesh-text-neutral-50` : `mesh-bg-neutral-50 mesh-text-neutral-950`}`,
|
|
24917
25024
|
style: { zIndex: 50 },
|
|
24918
|
-
children: !connected && wallets.length > 0 ? /* @__PURE__ */ (0,
|
|
25025
|
+
children: !connected && wallets.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_jsx_runtime28.Fragment, { children: wallets.map((wallet, index) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
24919
25026
|
MenuItem,
|
|
24920
25027
|
{
|
|
24921
25028
|
icon: wallet.icon,
|
|
@@ -24927,7 +25034,7 @@ var CardanoWallet2 = ({
|
|
|
24927
25034
|
active: name === wallet.id
|
|
24928
25035
|
},
|
|
24929
25036
|
index
|
|
24930
|
-
)) }) : wallets.length === 0 ? /* @__PURE__ */ (0,
|
|
25037
|
+
)) }) : wallets.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "No Wallet Found" }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_jsx_runtime28.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
24931
25038
|
MenuItem,
|
|
24932
25039
|
{
|
|
24933
25040
|
active: false,
|
|
@@ -24944,7 +25051,7 @@ var CardanoWallet2 = ({
|
|
|
24944
25051
|
};
|
|
24945
25052
|
|
|
24946
25053
|
// src/stake-button/index.tsx
|
|
24947
|
-
var
|
|
25054
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
24948
25055
|
var StakeButton = ({
|
|
24949
25056
|
label = "Stake your ADA",
|
|
24950
25057
|
isDark = false,
|
|
@@ -24952,19 +25059,19 @@ var StakeButton = ({
|
|
|
24952
25059
|
onCheck,
|
|
24953
25060
|
onDelegated = void 0
|
|
24954
25061
|
}) => {
|
|
24955
|
-
const [isDarkMode, setIsDarkMode] = (0,
|
|
25062
|
+
const [isDarkMode, setIsDarkMode] = (0, import_react16.useState)(false);
|
|
24956
25063
|
const { connected } = useWallet();
|
|
24957
|
-
(0,
|
|
25064
|
+
(0, import_react16.useEffect)(() => {
|
|
24958
25065
|
setIsDarkMode(isDark);
|
|
24959
25066
|
}, [isDark]);
|
|
24960
|
-
return /* @__PURE__ */ (0,
|
|
25067
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children: connected ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ButtonDropdown, { isDarkMode, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
24961
25068
|
Delegate,
|
|
24962
25069
|
{
|
|
24963
25070
|
poolId,
|
|
24964
25071
|
onCheck,
|
|
24965
25072
|
onDelegated
|
|
24966
25073
|
}
|
|
24967
|
-
) }) : /* @__PURE__ */ (0,
|
|
25074
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CardanoWallet2, { label, isDark }) });
|
|
24968
25075
|
};
|
|
24969
25076
|
var Delegate = ({
|
|
24970
25077
|
poolId,
|
|
@@ -24973,11 +25080,11 @@ var Delegate = ({
|
|
|
24973
25080
|
}) => {
|
|
24974
25081
|
const { wallet } = useWallet();
|
|
24975
25082
|
const rewardAddress = useRewardAddress();
|
|
24976
|
-
const [_, setError] = (0,
|
|
24977
|
-
const [checking, setChecking] = (0,
|
|
24978
|
-
const [accountInfo, setAccountInfo] = (0,
|
|
24979
|
-
const [processing, setProcessing] = (0,
|
|
24980
|
-
const [done, setDone] = (0,
|
|
25083
|
+
const [_, setError] = (0, import_react16.useState)();
|
|
25084
|
+
const [checking, setChecking] = (0, import_react16.useState)(false);
|
|
25085
|
+
const [accountInfo, setAccountInfo] = (0, import_react16.useState)();
|
|
25086
|
+
const [processing, setProcessing] = (0, import_react16.useState)(false);
|
|
25087
|
+
const [done, setDone] = (0, import_react16.useState)(false);
|
|
24981
25088
|
const checkAccountStatus = async () => {
|
|
24982
25089
|
try {
|
|
24983
25090
|
setChecking(true);
|
|
@@ -25028,22 +25135,22 @@ var Delegate = ({
|
|
|
25028
25135
|
}
|
|
25029
25136
|
setProcessing(false);
|
|
25030
25137
|
};
|
|
25031
|
-
(0,
|
|
25138
|
+
(0, import_react16.useEffect)(() => {
|
|
25032
25139
|
checkAccountStatus();
|
|
25033
25140
|
}, [rewardAddress]);
|
|
25034
25141
|
if (checking) {
|
|
25035
|
-
return /* @__PURE__ */ (0,
|
|
25142
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children: "Checking..." });
|
|
25036
25143
|
}
|
|
25037
25144
|
if (processing) {
|
|
25038
|
-
return /* @__PURE__ */ (0,
|
|
25145
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children: "Loading..." });
|
|
25039
25146
|
}
|
|
25040
25147
|
if (done) {
|
|
25041
|
-
return /* @__PURE__ */ (0,
|
|
25148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children: "Stake Delegated" });
|
|
25042
25149
|
}
|
|
25043
25150
|
if (accountInfo?.active) {
|
|
25044
|
-
return accountInfo.poolId === poolId ? /* @__PURE__ */ (0,
|
|
25151
|
+
return accountInfo.poolId === poolId ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children: "Stake Delegated" }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { onClick: delegateStake, children: "Begin Staking" });
|
|
25045
25152
|
}
|
|
25046
|
-
return /* @__PURE__ */ (0,
|
|
25153
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { onClick: registerAddress, children: "Begin Staking" });
|
|
25047
25154
|
};
|
|
25048
25155
|
// Annotate the CommonJS export names for ESM import in node:
|
|
25049
25156
|
0 && (module.exports = {
|