@meshsdk/react 1.9.0-beta.3 → 1.9.0-beta.31
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 +323 -128
- package/dist/index.d.cts +15 -6
- package/dist/index.d.ts +15 -6
- package/dist/index.js +314 -119
- 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,195 @@ 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
|
+
width: "24px",
|
|
24412
|
+
height: "24px"
|
|
24413
|
+
},
|
|
24414
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
24415
|
+
"path",
|
|
24416
|
+
{
|
|
24417
|
+
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
|
+
fill: "#5865F2"
|
|
24419
|
+
}
|
|
24420
|
+
)
|
|
24421
|
+
}
|
|
24422
|
+
);
|
|
24423
|
+
}
|
|
24424
|
+
|
|
24425
|
+
// src/common/icons/icon-google.tsx
|
|
24426
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
24427
|
+
function IconGoogle() {
|
|
24428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
24429
|
+
"svg",
|
|
24430
|
+
{
|
|
24431
|
+
viewBox: "0 0 262 262",
|
|
24432
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
24433
|
+
preserveAspectRatio: "xMidYMid",
|
|
24434
|
+
style: {
|
|
24435
|
+
width: "24px",
|
|
24436
|
+
height: "24px"
|
|
24437
|
+
},
|
|
24438
|
+
children: [
|
|
24439
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
24440
|
+
"path",
|
|
24441
|
+
{
|
|
24442
|
+
d: "M255.878 133.451c0-10.734-.871-18.567-2.756-26.69H130.55v48.448h71.947c-1.45 12.04-9.283 30.172-26.69 42.356l-.244 1.622 38.755 30.023 2.685.268c24.659-22.774 38.875-56.282 38.875-96.027",
|
|
24443
|
+
fill: "#4285F4"
|
|
24444
|
+
}
|
|
24445
|
+
),
|
|
24446
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
24447
|
+
"path",
|
|
24448
|
+
{
|
|
24449
|
+
d: "M130.55 261.1c35.248 0 64.839-11.605 86.453-31.622l-41.196-31.913c-11.024 7.688-25.82 13.055-45.257 13.055-34.523 0-63.824-22.773-74.269-54.25l-1.531.13-40.298 31.187-.527 1.465C35.393 231.798 79.49 261.1 130.55 261.1",
|
|
24450
|
+
fill: "#34A853"
|
|
24451
|
+
}
|
|
24452
|
+
),
|
|
24453
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
24454
|
+
"path",
|
|
24455
|
+
{
|
|
24456
|
+
d: "M56.281 156.37c-2.756-8.123-4.351-16.827-4.351-25.82 0-8.994 1.595-17.697 4.206-25.82l-.073-1.73L15.26 71.312l-1.335.635C5.077 89.644 0 109.517 0 130.55s5.077 40.905 13.925 58.602l42.356-32.782",
|
|
24457
|
+
fill: "#FBBC05"
|
|
24458
|
+
}
|
|
24459
|
+
),
|
|
24460
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
24461
|
+
"path",
|
|
24462
|
+
{
|
|
24463
|
+
d: "M130.55 50.479c24.514 0 41.05 10.589 50.479 19.438l36.844-35.974C195.245 12.91 165.798 0 130.55 0 79.49 0 35.393 29.301 13.925 71.947l42.211 32.783c10.59-31.477 39.891-54.251 74.414-54.251",
|
|
24464
|
+
fill: "#EB4335"
|
|
24465
|
+
}
|
|
24466
|
+
)
|
|
24467
|
+
]
|
|
24468
|
+
}
|
|
24469
|
+
);
|
|
24470
|
+
}
|
|
24471
|
+
|
|
24472
|
+
// src/common/icons/icon-twitter.tsx
|
|
24473
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
24474
|
+
function IconTwitter() {
|
|
24475
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
24476
|
+
"svg",
|
|
24477
|
+
{
|
|
24478
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
24479
|
+
version: "1.1",
|
|
24480
|
+
viewBox: "0 0 24 24",
|
|
24481
|
+
style: {
|
|
24482
|
+
width: "24px",
|
|
24483
|
+
height: "24px"
|
|
24484
|
+
},
|
|
24485
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M14.095479,10.316482L22.286354,1h-1.940718l-7.115352,8.087682L7.551414,1H1l8.589488,12.231093L1,23h1.940717 l7.509372-8.542861L16.448587,23H23L14.095479,10.316482z M11.436522,13.338465l-0.871624-1.218704l-6.924311-9.68815h2.981339 l5.58978,7.82155l0.867949,1.218704l7.26506,10.166271h-2.981339L11.436522,13.338465z" })
|
|
24486
|
+
}
|
|
24487
|
+
);
|
|
24488
|
+
}
|
|
24489
|
+
|
|
24490
|
+
// src/cardano-wallet/web3-services.tsx
|
|
24491
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
24492
|
+
function Web3Services({
|
|
24493
|
+
options,
|
|
24494
|
+
setOpen,
|
|
24495
|
+
persist
|
|
24496
|
+
}) {
|
|
24497
|
+
const { setWallet } = useWallet();
|
|
24498
|
+
const [loading, setLoading] = (0, import_react11.useState)(false);
|
|
24499
|
+
async function loadWallet() {
|
|
24500
|
+
setLoading(true);
|
|
24501
|
+
const _options = {
|
|
24502
|
+
networkId: 0,
|
|
24503
|
+
fetcher: options.fetcher,
|
|
24504
|
+
submitter: options.submitter,
|
|
24505
|
+
appUrl: options.appUrl,
|
|
24506
|
+
projectId: options.projectId
|
|
24507
|
+
};
|
|
24508
|
+
const wallet = await import_web3_sdk2.Web3Wallet.enable(_options);
|
|
24509
|
+
setWallet(
|
|
24510
|
+
wallet,
|
|
24511
|
+
"Mesh Web3 Services",
|
|
24512
|
+
persist ? {
|
|
24513
|
+
walletAddress: await wallet.getChangeAddress()
|
|
24514
|
+
} : void 0
|
|
24515
|
+
);
|
|
24516
|
+
setLoading(false);
|
|
24517
|
+
setOpen(false);
|
|
24518
|
+
}
|
|
24519
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
24520
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
24521
|
+
WalletIcon,
|
|
24522
|
+
{
|
|
24523
|
+
iconReactNode: IconGoogle(),
|
|
24524
|
+
name: `Google`,
|
|
24525
|
+
action: () => loadWallet(),
|
|
24526
|
+
loading
|
|
24527
|
+
}
|
|
24528
|
+
),
|
|
24529
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
24530
|
+
WalletIcon,
|
|
24531
|
+
{
|
|
24532
|
+
iconReactNode: IconDiscord(),
|
|
24533
|
+
name: `Discord`,
|
|
24534
|
+
action: () => loadWallet(),
|
|
24535
|
+
loading
|
|
24536
|
+
}
|
|
24537
|
+
),
|
|
24538
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
24539
|
+
WalletIcon,
|
|
24540
|
+
{
|
|
24541
|
+
iconReactNode: IconTwitter(),
|
|
24542
|
+
name: `Twitter`,
|
|
24543
|
+
action: () => loadWallet(),
|
|
24544
|
+
loading
|
|
24545
|
+
}
|
|
24546
|
+
)
|
|
24547
|
+
] });
|
|
24548
|
+
}
|
|
24549
|
+
|
|
24550
|
+
// src/cardano-wallet/screen-main.tsx
|
|
24551
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
24369
24552
|
function ScreenMain({
|
|
24370
24553
|
injectFn,
|
|
24371
|
-
extensions,
|
|
24372
24554
|
setOpen,
|
|
24373
24555
|
setScreen,
|
|
24374
24556
|
persist,
|
|
24375
24557
|
cardanoPeerConnect,
|
|
24376
24558
|
burnerWallet,
|
|
24377
|
-
webauthn
|
|
24559
|
+
webauthn,
|
|
24560
|
+
showDownload,
|
|
24561
|
+
web3Services
|
|
24378
24562
|
}) {
|
|
24379
24563
|
const wallets = useWalletList({ injectFn });
|
|
24380
24564
|
const { connect: connect2 } = useWallet();
|
|
24381
|
-
return /* @__PURE__ */ (0,
|
|
24382
|
-
wallets.map((wallet, index) => /* @__PURE__ */ (0,
|
|
24565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "mesh-grid mesh-gap-4 mesh-py-4 mesh-grid-cols-5 mesh-place-items-center mesh-gap-y-8", children: [
|
|
24566
|
+
wallets.map((wallet, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
24383
24567
|
WalletIcon,
|
|
24384
24568
|
{
|
|
24385
24569
|
icon: wallet.icon,
|
|
24386
24570
|
name: wallet.name,
|
|
24387
24571
|
action: () => {
|
|
24388
|
-
connect2(wallet.id,
|
|
24572
|
+
connect2(wallet.id, persist);
|
|
24389
24573
|
setOpen(false);
|
|
24390
24574
|
}
|
|
24391
24575
|
},
|
|
24392
24576
|
index
|
|
24393
24577
|
)),
|
|
24394
|
-
|
|
24578
|
+
web3Services && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
24579
|
+
Web3Services,
|
|
24580
|
+
{
|
|
24581
|
+
options: web3Services,
|
|
24582
|
+
setOpen,
|
|
24583
|
+
persist
|
|
24584
|
+
}
|
|
24585
|
+
),
|
|
24586
|
+
webauthn && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
24395
24587
|
WalletIcon,
|
|
24396
24588
|
{
|
|
24397
24589
|
iconReactNode: IconFingerprint(),
|
|
@@ -24401,7 +24593,7 @@ function ScreenMain({
|
|
|
24401
24593
|
}
|
|
24402
24594
|
}
|
|
24403
24595
|
),
|
|
24404
|
-
cardanoPeerConnect && /* @__PURE__ */ (0,
|
|
24596
|
+
cardanoPeerConnect && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
24405
24597
|
WalletIcon,
|
|
24406
24598
|
{
|
|
24407
24599
|
iconReactNode: IconMonitorSmartphone(),
|
|
@@ -24411,7 +24603,7 @@ function ScreenMain({
|
|
|
24411
24603
|
}
|
|
24412
24604
|
}
|
|
24413
24605
|
),
|
|
24414
|
-
burnerWallet && /* @__PURE__ */ (0,
|
|
24606
|
+
burnerWallet && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
24415
24607
|
WalletIcon,
|
|
24416
24608
|
{
|
|
24417
24609
|
iconReactNode: IconBookDashed(),
|
|
@@ -24421,7 +24613,7 @@ function ScreenMain({
|
|
|
24421
24613
|
}
|
|
24422
24614
|
}
|
|
24423
24615
|
),
|
|
24424
|
-
/* @__PURE__ */ (0,
|
|
24616
|
+
showDownload && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
24425
24617
|
WalletIcon,
|
|
24426
24618
|
{
|
|
24427
24619
|
iconReactNode: IconDownload(),
|
|
@@ -24438,19 +24630,19 @@ function ScreenMain({
|
|
|
24438
24630
|
}
|
|
24439
24631
|
|
|
24440
24632
|
// src/cardano-wallet/screen-p2p.tsx
|
|
24441
|
-
var
|
|
24633
|
+
var import_react12 = require("react");
|
|
24442
24634
|
var import_cardano_peer_connect = __toESM(require_dist(), 1);
|
|
24443
|
-
var
|
|
24635
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
24444
24636
|
function ScreenP2P({
|
|
24445
24637
|
cardanoPeerConnect,
|
|
24446
24638
|
setOpen
|
|
24447
24639
|
}) {
|
|
24448
|
-
const dAppConnect = (0,
|
|
24449
|
-
const qrCodeField = (0,
|
|
24450
|
-
const [address, setAddress] = (0,
|
|
24451
|
-
const [copied, setCopied] = (0,
|
|
24640
|
+
const dAppConnect = (0, import_react12.useRef)(null);
|
|
24641
|
+
const qrCodeField = (0, import_react12.useRef)(null);
|
|
24642
|
+
const [address, setAddress] = (0, import_react12.useState)("");
|
|
24643
|
+
const [copied, setCopied] = (0, import_react12.useState)(false);
|
|
24452
24644
|
const { connect: connect2 } = useWallet();
|
|
24453
|
-
(0,
|
|
24645
|
+
(0, import_react12.useEffect)(() => {
|
|
24454
24646
|
if (cardanoPeerConnect) {
|
|
24455
24647
|
if (dAppConnect.current === null) {
|
|
24456
24648
|
dAppConnect.current = new import_cardano_peer_connect.DAppPeerConnect({
|
|
@@ -24484,9 +24676,9 @@ function ScreenP2P({
|
|
|
24484
24676
|
}
|
|
24485
24677
|
}
|
|
24486
24678
|
}, []);
|
|
24487
|
-
return /* @__PURE__ */ (0,
|
|
24488
|
-
/* @__PURE__ */ (0,
|
|
24489
|
-
/* @__PURE__ */ (0,
|
|
24679
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "mesh-flex mesh-flex-col mesh-items-center mesh-justify-center", children: [
|
|
24680
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { style: { marginTop: 16, marginBottom: 16 }, ref: qrCodeField }),
|
|
24681
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
24490
24682
|
Button,
|
|
24491
24683
|
{
|
|
24492
24684
|
variant: "outline",
|
|
@@ -24501,15 +24693,15 @@ function ScreenP2P({
|
|
|
24501
24693
|
}
|
|
24502
24694
|
|
|
24503
24695
|
// src/cardano-wallet/screen-webauthn.tsx
|
|
24504
|
-
var
|
|
24696
|
+
var import_react13 = require("react");
|
|
24505
24697
|
var import_wallet4 = require("@meshsdk/wallet");
|
|
24506
24698
|
|
|
24507
24699
|
// src/common/input.tsx
|
|
24508
24700
|
var React5 = __toESM(require("react"), 1);
|
|
24509
|
-
var
|
|
24701
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
24510
24702
|
var Input = React5.forwardRef(
|
|
24511
24703
|
({ className, type, ...props }, ref) => {
|
|
24512
|
-
return /* @__PURE__ */ (0,
|
|
24704
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
24513
24705
|
"input",
|
|
24514
24706
|
{
|
|
24515
24707
|
type,
|
|
@@ -24529,11 +24721,11 @@ Input.displayName = "Input";
|
|
|
24529
24721
|
var React6 = __toESM(require("react"), 1);
|
|
24530
24722
|
var LabelPrimitive = __toESM(require("@radix-ui/react-label"), 1);
|
|
24531
24723
|
var import_class_variance_authority2 = require("class-variance-authority");
|
|
24532
|
-
var
|
|
24724
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
24533
24725
|
var labelVariants = (0, import_class_variance_authority2.cva)(
|
|
24534
24726
|
"mesh-text-sm mesh-font-medium mesh-leading-none peer-disabled:mesh-cursor-not-allowed peer-disabled:mesh-opacity-70"
|
|
24535
24727
|
);
|
|
24536
|
-
var Label2 = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
24728
|
+
var Label2 = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
24537
24729
|
LabelPrimitive.Root,
|
|
24538
24730
|
{
|
|
24539
24731
|
ref,
|
|
@@ -24544,16 +24736,16 @@ var Label2 = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
24544
24736
|
Label2.displayName = LabelPrimitive.Root.displayName;
|
|
24545
24737
|
|
|
24546
24738
|
// src/cardano-wallet/screen-webauthn.tsx
|
|
24547
|
-
var
|
|
24739
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
24548
24740
|
function ScreenWebauthn({
|
|
24549
24741
|
url,
|
|
24550
24742
|
networkId,
|
|
24551
24743
|
provider,
|
|
24552
24744
|
setOpen
|
|
24553
24745
|
}) {
|
|
24554
|
-
const [loading, setLoading] = (0,
|
|
24555
|
-
const [userName, setUserName] = (0,
|
|
24556
|
-
const [password, setPassword] = (0,
|
|
24746
|
+
const [loading, setLoading] = (0, import_react13.useState)(false);
|
|
24747
|
+
const [userName, setUserName] = (0, import_react13.useState)("");
|
|
24748
|
+
const [password, setPassword] = (0, import_react13.useState)("");
|
|
24557
24749
|
const { setWallet } = useWallet();
|
|
24558
24750
|
function createWallet(root) {
|
|
24559
24751
|
setTimeout(() => {
|
|
@@ -24578,10 +24770,10 @@ function ScreenWebauthn({
|
|
|
24578
24770
|
createWallet(res.wallet.bech32PrivateKey);
|
|
24579
24771
|
}
|
|
24580
24772
|
}
|
|
24581
|
-
return /* @__PURE__ */ (0,
|
|
24582
|
-
/* @__PURE__ */ (0,
|
|
24583
|
-
/* @__PURE__ */ (0,
|
|
24584
|
-
/* @__PURE__ */ (0,
|
|
24773
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "mesh-flex mesh-flex-row mesh-flex-gap-4 mesh-items-center mesh-justify-center", children: loading ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children: "Connecting wallet..." }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "mesh-flex mesh-flex-col mesh-gap-6 mesh-w-full mesh-mx-8", children: [
|
|
24774
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "mesh-grid mesh-gap-2", children: [
|
|
24775
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Label2, { htmlFor: "username", children: "Username" }),
|
|
24776
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
24585
24777
|
Input,
|
|
24586
24778
|
{
|
|
24587
24779
|
id: "username",
|
|
@@ -24591,11 +24783,11 @@ function ScreenWebauthn({
|
|
|
24591
24783
|
onChange: (e2) => setUserName(e2.target.value)
|
|
24592
24784
|
}
|
|
24593
24785
|
),
|
|
24594
|
-
/* @__PURE__ */ (0,
|
|
24786
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "mesh-text-gray-500 mesh-text-xs", children: "Unique to the application you are connecting." })
|
|
24595
24787
|
] }),
|
|
24596
|
-
/* @__PURE__ */ (0,
|
|
24597
|
-
/* @__PURE__ */ (0,
|
|
24598
|
-
/* @__PURE__ */ (0,
|
|
24788
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "mesh-grid mesh-gap-2", children: [
|
|
24789
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "mesh-flex mesh-items-center", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Label2, { htmlFor: "password", children: "Unique Code" }) }),
|
|
24790
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
24599
24791
|
Input,
|
|
24600
24792
|
{
|
|
24601
24793
|
id: "password",
|
|
@@ -24605,9 +24797,9 @@ function ScreenWebauthn({
|
|
|
24605
24797
|
onChange: (e2) => setPassword(e2.target.value)
|
|
24606
24798
|
}
|
|
24607
24799
|
),
|
|
24608
|
-
/* @__PURE__ */ (0,
|
|
24800
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "mesh-text-gray-500 mesh-text-xs", children: "Additional security to derive your wallet." })
|
|
24609
24801
|
] }),
|
|
24610
|
-
/* @__PURE__ */ (0,
|
|
24802
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
24611
24803
|
Button,
|
|
24612
24804
|
{
|
|
24613
24805
|
className: "mesh-w-full",
|
|
@@ -24620,59 +24812,62 @@ function ScreenWebauthn({
|
|
|
24620
24812
|
}
|
|
24621
24813
|
|
|
24622
24814
|
// src/cardano-wallet/index.tsx
|
|
24623
|
-
var
|
|
24815
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
24624
24816
|
var CardanoWallet = ({
|
|
24625
24817
|
label = "Connect Wallet",
|
|
24626
24818
|
onConnected = void 0,
|
|
24627
24819
|
isDark = false,
|
|
24628
24820
|
persist = false,
|
|
24629
|
-
extensions = [],
|
|
24630
24821
|
injectFn = void 0,
|
|
24631
24822
|
cardanoPeerConnect = void 0,
|
|
24632
24823
|
burnerWallet = void 0,
|
|
24633
|
-
webauthn = void 0
|
|
24824
|
+
webauthn = void 0,
|
|
24825
|
+
showDownload = true,
|
|
24826
|
+
web3Services = void 0
|
|
24634
24827
|
}) => {
|
|
24635
|
-
const [open, setOpen] = (0,
|
|
24636
|
-
const [screen, setScreen] = (0,
|
|
24637
|
-
const { wallet, connected, setPersist } = useWallet();
|
|
24638
|
-
(0,
|
|
24828
|
+
const [open, setOpen] = (0, import_react14.useState)(false);
|
|
24829
|
+
const [screen, setScreen] = (0, import_react14.useState)("main");
|
|
24830
|
+
const { wallet, connected, setPersist, setWeb3Services } = useWallet();
|
|
24831
|
+
(0, import_react14.useEffect)(() => {
|
|
24639
24832
|
setPersist(persist);
|
|
24640
|
-
|
|
24641
|
-
|
|
24833
|
+
if (web3Services) setWeb3Services(web3Services);
|
|
24834
|
+
}, []);
|
|
24835
|
+
(0, import_react14.useEffect)(() => {
|
|
24642
24836
|
if (connected) {
|
|
24643
24837
|
if (onConnected) onConnected();
|
|
24644
24838
|
}
|
|
24645
24839
|
}, [connected, wallet]);
|
|
24646
|
-
return /* @__PURE__ */ (0,
|
|
24647
|
-
/* @__PURE__ */ (0,
|
|
24648
|
-
/* @__PURE__ */ (0,
|
|
24840
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Dialog, { open, onOpenChange: setOpen, children: [
|
|
24841
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: isDark ? "mesh-dark" : "", children: !connected ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DialogTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Button, { variant: "outline", className: isDark ? "mesh-dark" : "", children: label }) }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ConnectedButton, {}) }),
|
|
24842
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
24649
24843
|
DialogContent,
|
|
24650
24844
|
{
|
|
24651
24845
|
className: "sm:mesh-max-w-[425px] mesh-dark",
|
|
24652
24846
|
onOpenAutoFocus: (event) => event.preventDefault(),
|
|
24653
24847
|
children: [
|
|
24654
|
-
/* @__PURE__ */ (0,
|
|
24655
|
-
screen == "main" && /* @__PURE__ */ (0,
|
|
24848
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Header, { screen, setScreen }),
|
|
24849
|
+
screen == "main" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
24656
24850
|
ScreenMain,
|
|
24657
24851
|
{
|
|
24658
24852
|
injectFn,
|
|
24659
|
-
extensions,
|
|
24660
24853
|
setOpen,
|
|
24661
24854
|
setScreen,
|
|
24662
24855
|
persist,
|
|
24663
24856
|
cardanoPeerConnect: cardanoPeerConnect != void 0,
|
|
24664
24857
|
burnerWallet: burnerWallet != void 0,
|
|
24665
|
-
webauthn: webauthn != void 0
|
|
24858
|
+
webauthn: webauthn != void 0,
|
|
24859
|
+
showDownload,
|
|
24860
|
+
web3Services
|
|
24666
24861
|
}
|
|
24667
24862
|
),
|
|
24668
|
-
screen == "p2p" && /* @__PURE__ */ (0,
|
|
24863
|
+
screen == "p2p" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
24669
24864
|
ScreenP2P,
|
|
24670
24865
|
{
|
|
24671
24866
|
cardanoPeerConnect,
|
|
24672
24867
|
setOpen
|
|
24673
24868
|
}
|
|
24674
24869
|
),
|
|
24675
|
-
screen == "burner" && burnerWallet && /* @__PURE__ */ (0,
|
|
24870
|
+
screen == "burner" && burnerWallet && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
24676
24871
|
ScreenBurner,
|
|
24677
24872
|
{
|
|
24678
24873
|
networkId: burnerWallet.networkId,
|
|
@@ -24680,7 +24875,7 @@ var CardanoWallet = ({
|
|
|
24680
24875
|
setOpen
|
|
24681
24876
|
}
|
|
24682
24877
|
),
|
|
24683
|
-
screen == "webauthn" && webauthn && /* @__PURE__ */ (0,
|
|
24878
|
+
screen == "webauthn" && webauthn && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
24684
24879
|
ScreenWebauthn,
|
|
24685
24880
|
{
|
|
24686
24881
|
url: webauthn.url,
|
|
@@ -24689,7 +24884,7 @@ var CardanoWallet = ({
|
|
|
24689
24884
|
setOpen
|
|
24690
24885
|
}
|
|
24691
24886
|
),
|
|
24692
|
-
/* @__PURE__ */ (0,
|
|
24887
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Footer, {})
|
|
24693
24888
|
]
|
|
24694
24889
|
}
|
|
24695
24890
|
)
|
|
@@ -24699,25 +24894,25 @@ function Header({
|
|
|
24699
24894
|
screen,
|
|
24700
24895
|
setScreen
|
|
24701
24896
|
}) {
|
|
24702
|
-
return /* @__PURE__ */ (0,
|
|
24703
|
-
/* @__PURE__ */ (0,
|
|
24704
|
-
screen != "main" ? /* @__PURE__ */ (0,
|
|
24705
|
-
/* @__PURE__ */ (0,
|
|
24706
|
-
/* @__PURE__ */ (0,
|
|
24897
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(DialogHeader, { children: [
|
|
24898
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(DialogTitle, { className: "mesh-flex mesh-justify-between", children: [
|
|
24899
|
+
screen != "main" ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { onClick: () => setScreen("main"), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(IconChevronRight, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { style: { width: "24px" } }),
|
|
24900
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: screens[screen].title }),
|
|
24901
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { style: { width: "24px" } })
|
|
24707
24902
|
] }),
|
|
24708
|
-
/* @__PURE__ */ (0,
|
|
24903
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DialogDescription, { children: screens[screen].subtitle && screens[screen].subtitle })
|
|
24709
24904
|
] });
|
|
24710
24905
|
}
|
|
24711
24906
|
function Footer() {
|
|
24712
|
-
return /* @__PURE__ */ (0,
|
|
24907
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DialogFooter, { className: "mesh-justify-center mesh-text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
24713
24908
|
"a",
|
|
24714
24909
|
{
|
|
24715
24910
|
href: "https://meshjs.dev/",
|
|
24716
24911
|
target: "_blank",
|
|
24717
24912
|
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
24913
|
children: [
|
|
24719
|
-
/* @__PURE__ */ (0,
|
|
24720
|
-
/* @__PURE__ */ (0,
|
|
24914
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "", children: "Powered by" }),
|
|
24915
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
24721
24916
|
"svg",
|
|
24722
24917
|
{
|
|
24723
24918
|
width: 24,
|
|
@@ -24725,31 +24920,31 @@ function Footer() {
|
|
|
24725
24920
|
enableBackground: "new 0 0 300 200",
|
|
24726
24921
|
viewBox: "0 0 300 200",
|
|
24727
24922
|
xmlns: "http://www.w3.org/2000/svg",
|
|
24728
|
-
children: /* @__PURE__ */ (0,
|
|
24923
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.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
24924
|
}
|
|
24730
24925
|
),
|
|
24731
|
-
/* @__PURE__ */ (0,
|
|
24926
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "", children: "Mesh SDK" })
|
|
24732
24927
|
]
|
|
24733
24928
|
}
|
|
24734
24929
|
) });
|
|
24735
24930
|
}
|
|
24736
24931
|
|
|
24737
24932
|
// src/mesh-badge/mesh-logo.tsx
|
|
24738
|
-
var
|
|
24739
|
-
var MeshLogo = () => /* @__PURE__ */ (0,
|
|
24933
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
24934
|
+
var MeshLogo = () => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
24740
24935
|
"svg",
|
|
24741
24936
|
{
|
|
24742
24937
|
className: "mesh-h-16 mesh-p-2",
|
|
24743
24938
|
fill: "currentColor",
|
|
24744
24939
|
viewBox: "0 0 300 200",
|
|
24745
24940
|
xmlns: "http://www.w3.org/2000/svg",
|
|
24746
|
-
children: /* @__PURE__ */ (0,
|
|
24941
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.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
24942
|
}
|
|
24748
24943
|
);
|
|
24749
24944
|
|
|
24750
24945
|
// src/mesh-badge/index.tsx
|
|
24751
|
-
var
|
|
24752
|
-
var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ (0,
|
|
24946
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
24947
|
+
var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
24753
24948
|
"a",
|
|
24754
24949
|
{
|
|
24755
24950
|
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 +24956,21 @@ var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ (0, import_jsx_runtime21
|
|
|
24761
24956
|
rel: "noopener noreferrer",
|
|
24762
24957
|
target: "_blank",
|
|
24763
24958
|
children: [
|
|
24764
|
-
/* @__PURE__ */ (0,
|
|
24959
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(MeshLogo, {}),
|
|
24765
24960
|
"Mesh"
|
|
24766
24961
|
]
|
|
24767
24962
|
}
|
|
24768
24963
|
);
|
|
24769
24964
|
|
|
24770
24965
|
// src/stake-button/index.tsx
|
|
24771
|
-
var
|
|
24966
|
+
var import_react16 = require("react");
|
|
24772
24967
|
var import_transaction = require("@meshsdk/transaction");
|
|
24773
24968
|
|
|
24774
24969
|
// src/cardano-wallet-dropdown/index.tsx
|
|
24775
|
-
var
|
|
24970
|
+
var import_react15 = require("react");
|
|
24776
24971
|
|
|
24777
24972
|
// src/common/button-dropdown.tsx
|
|
24778
|
-
var
|
|
24973
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
24779
24974
|
function ButtonDropdown({
|
|
24780
24975
|
children,
|
|
24781
24976
|
isDarkMode = false,
|
|
@@ -24784,7 +24979,7 @@ function ButtonDropdown({
|
|
|
24784
24979
|
onMouseEnter,
|
|
24785
24980
|
onMouseLeave
|
|
24786
24981
|
}) {
|
|
24787
|
-
return /* @__PURE__ */ (0,
|
|
24982
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
24788
24983
|
"button",
|
|
24789
24984
|
{
|
|
24790
24985
|
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 +24992,21 @@ function ButtonDropdown({
|
|
|
24797
24992
|
}
|
|
24798
24993
|
|
|
24799
24994
|
// src/cardano-wallet-dropdown/menu-item.tsx
|
|
24800
|
-
var
|
|
24995
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
24801
24996
|
function MenuItem({
|
|
24802
24997
|
icon,
|
|
24803
24998
|
label,
|
|
24804
24999
|
action,
|
|
24805
25000
|
active
|
|
24806
25001
|
}) {
|
|
24807
|
-
return /* @__PURE__ */ (0,
|
|
25002
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
24808
25003
|
"div",
|
|
24809
25004
|
{
|
|
24810
25005
|
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
25006
|
onClick: action,
|
|
24812
25007
|
children: [
|
|
24813
|
-
icon && /* @__PURE__ */ (0,
|
|
24814
|
-
/* @__PURE__ */ (0,
|
|
25008
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("img", { className: "mesh-pr-2 mesh-m-1 mesh-h-8", src: icon }),
|
|
25009
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.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
25010
|
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
24816
25011
|
}).join(" ") })
|
|
24817
25012
|
]
|
|
@@ -24820,8 +25015,8 @@ function MenuItem({
|
|
|
24820
25015
|
}
|
|
24821
25016
|
|
|
24822
25017
|
// src/cardano-wallet-dropdown/chevron-down.tsx
|
|
24823
|
-
var
|
|
24824
|
-
var ChevronDown = () => /* @__PURE__ */ (0,
|
|
25018
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
25019
|
+
var ChevronDown = () => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
24825
25020
|
"svg",
|
|
24826
25021
|
{
|
|
24827
25022
|
className: "mesh-m-2 mesh-h-6",
|
|
@@ -24830,7 +25025,7 @@ var ChevronDown = () => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
|
24830
25025
|
viewBox: "0 0 24 24",
|
|
24831
25026
|
stroke: "currentColor",
|
|
24832
25027
|
xmlns: "http://www.w3.org/2000/svg",
|
|
24833
|
-
children: /* @__PURE__ */ (0,
|
|
25028
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
24834
25029
|
"path",
|
|
24835
25030
|
{
|
|
24836
25031
|
strokeLinecap: "round",
|
|
@@ -24843,7 +25038,7 @@ var ChevronDown = () => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
|
24843
25038
|
);
|
|
24844
25039
|
|
|
24845
25040
|
// src/cardano-wallet-dropdown/wallet-balance.tsx
|
|
24846
|
-
var
|
|
25041
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
24847
25042
|
var WalletBalance = ({
|
|
24848
25043
|
connected,
|
|
24849
25044
|
connecting,
|
|
@@ -24851,22 +25046,22 @@ var WalletBalance = ({
|
|
|
24851
25046
|
wallet
|
|
24852
25047
|
}) => {
|
|
24853
25048
|
const lovelace = useLovelace();
|
|
24854
|
-
return connected && lovelace && wallet?.icon ? /* @__PURE__ */ (0,
|
|
24855
|
-
/* @__PURE__ */ (0,
|
|
25049
|
+
return connected && lovelace && wallet?.icon ? /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
25050
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("img", { className: "mesh-m-2 mesh-h-6", src: wallet.icon }),
|
|
24856
25051
|
"\u20B3",
|
|
24857
25052
|
" ",
|
|
24858
25053
|
parseInt((parseInt(lovelace, 10) / 1e6).toString(), 10),
|
|
24859
25054
|
".",
|
|
24860
|
-
/* @__PURE__ */ (0,
|
|
24861
|
-
] }) : connected && wallet?.icon ? /* @__PURE__ */ (0,
|
|
25055
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "mesh-text-xs", children: lovelace.substring(lovelace.length - 6) })
|
|
25056
|
+
] }) : connected && wallet?.icon ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("img", { className: "mesh-m-2 mesh-h-6", src: wallet.icon }) }) : connecting ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children: "Connecting..." }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
24862
25057
|
label,
|
|
24863
25058
|
" ",
|
|
24864
|
-
/* @__PURE__ */ (0,
|
|
25059
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChevronDown, {})
|
|
24865
25060
|
] });
|
|
24866
25061
|
};
|
|
24867
25062
|
|
|
24868
25063
|
// src/cardano-wallet-dropdown/index.tsx
|
|
24869
|
-
var
|
|
25064
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
24870
25065
|
var CardanoWallet2 = ({
|
|
24871
25066
|
label = "Connect Wallet",
|
|
24872
25067
|
onConnected = void 0,
|
|
@@ -24874,32 +25069,32 @@ var CardanoWallet2 = ({
|
|
|
24874
25069
|
extensions = [],
|
|
24875
25070
|
cardanoPeerConnect = void 0
|
|
24876
25071
|
}) => {
|
|
24877
|
-
const [isDarkMode, setIsDarkMode] = (0,
|
|
24878
|
-
const [hideMenuList, setHideMenuList] = (0,
|
|
25072
|
+
const [isDarkMode, setIsDarkMode] = (0, import_react15.useState)(false);
|
|
25073
|
+
const [hideMenuList, setHideMenuList] = (0, import_react15.useState)(true);
|
|
24879
25074
|
const { connect: connect2, connecting, connected, disconnect, name } = useWallet();
|
|
24880
25075
|
const wallets = useWalletList();
|
|
24881
|
-
(0,
|
|
25076
|
+
(0, import_react15.useEffect)(() => {
|
|
24882
25077
|
if (connected && onConnected) {
|
|
24883
25078
|
onConnected();
|
|
24884
25079
|
}
|
|
24885
25080
|
}, [connected]);
|
|
24886
|
-
(0,
|
|
25081
|
+
(0, import_react15.useEffect)(() => {
|
|
24887
25082
|
setIsDarkMode(isDark);
|
|
24888
25083
|
}, [isDark]);
|
|
24889
|
-
return /* @__PURE__ */ (0,
|
|
25084
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
24890
25085
|
"div",
|
|
24891
25086
|
{
|
|
24892
25087
|
onMouseEnter: () => setHideMenuList(false),
|
|
24893
25088
|
onMouseLeave: () => setHideMenuList(true),
|
|
24894
25089
|
style: { width: "min-content", zIndex: 50 },
|
|
24895
25090
|
children: [
|
|
24896
|
-
/* @__PURE__ */ (0,
|
|
25091
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
24897
25092
|
ButtonDropdown,
|
|
24898
25093
|
{
|
|
24899
25094
|
isDarkMode,
|
|
24900
25095
|
hideMenuList,
|
|
24901
25096
|
setHideMenuList,
|
|
24902
|
-
children: /* @__PURE__ */ (0,
|
|
25097
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
24903
25098
|
WalletBalance,
|
|
24904
25099
|
{
|
|
24905
25100
|
connected,
|
|
@@ -24910,12 +25105,12 @@ var CardanoWallet2 = ({
|
|
|
24910
25105
|
)
|
|
24911
25106
|
}
|
|
24912
25107
|
),
|
|
24913
|
-
/* @__PURE__ */ (0,
|
|
25108
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
24914
25109
|
"div",
|
|
24915
25110
|
{
|
|
24916
25111
|
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
25112
|
style: { zIndex: 50 },
|
|
24918
|
-
children: !connected && wallets.length > 0 ? /* @__PURE__ */ (0,
|
|
25113
|
+
children: !connected && wallets.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children: wallets.map((wallet, index) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
24919
25114
|
MenuItem,
|
|
24920
25115
|
{
|
|
24921
25116
|
icon: wallet.icon,
|
|
@@ -24927,7 +25122,7 @@ var CardanoWallet2 = ({
|
|
|
24927
25122
|
active: name === wallet.id
|
|
24928
25123
|
},
|
|
24929
25124
|
index
|
|
24930
|
-
)) }) : wallets.length === 0 ? /* @__PURE__ */ (0,
|
|
25125
|
+
)) }) : wallets.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "No Wallet Found" }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
24931
25126
|
MenuItem,
|
|
24932
25127
|
{
|
|
24933
25128
|
active: false,
|
|
@@ -24944,7 +25139,7 @@ var CardanoWallet2 = ({
|
|
|
24944
25139
|
};
|
|
24945
25140
|
|
|
24946
25141
|
// src/stake-button/index.tsx
|
|
24947
|
-
var
|
|
25142
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
24948
25143
|
var StakeButton = ({
|
|
24949
25144
|
label = "Stake your ADA",
|
|
24950
25145
|
isDark = false,
|
|
@@ -24952,19 +25147,19 @@ var StakeButton = ({
|
|
|
24952
25147
|
onCheck,
|
|
24953
25148
|
onDelegated = void 0
|
|
24954
25149
|
}) => {
|
|
24955
|
-
const [isDarkMode, setIsDarkMode] = (0,
|
|
25150
|
+
const [isDarkMode, setIsDarkMode] = (0, import_react16.useState)(false);
|
|
24956
25151
|
const { connected } = useWallet();
|
|
24957
|
-
(0,
|
|
25152
|
+
(0, import_react16.useEffect)(() => {
|
|
24958
25153
|
setIsDarkMode(isDark);
|
|
24959
25154
|
}, [isDark]);
|
|
24960
|
-
return /* @__PURE__ */ (0,
|
|
25155
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children: connected ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ButtonDropdown, { isDarkMode, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
24961
25156
|
Delegate,
|
|
24962
25157
|
{
|
|
24963
25158
|
poolId,
|
|
24964
25159
|
onCheck,
|
|
24965
25160
|
onDelegated
|
|
24966
25161
|
}
|
|
24967
|
-
) }) : /* @__PURE__ */ (0,
|
|
25162
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CardanoWallet2, { label, isDark }) });
|
|
24968
25163
|
};
|
|
24969
25164
|
var Delegate = ({
|
|
24970
25165
|
poolId,
|
|
@@ -24973,11 +25168,11 @@ var Delegate = ({
|
|
|
24973
25168
|
}) => {
|
|
24974
25169
|
const { wallet } = useWallet();
|
|
24975
25170
|
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,
|
|
25171
|
+
const [_, setError] = (0, import_react16.useState)();
|
|
25172
|
+
const [checking, setChecking] = (0, import_react16.useState)(false);
|
|
25173
|
+
const [accountInfo, setAccountInfo] = (0, import_react16.useState)();
|
|
25174
|
+
const [processing, setProcessing] = (0, import_react16.useState)(false);
|
|
25175
|
+
const [done, setDone] = (0, import_react16.useState)(false);
|
|
24981
25176
|
const checkAccountStatus = async () => {
|
|
24982
25177
|
try {
|
|
24983
25178
|
setChecking(true);
|
|
@@ -25028,22 +25223,22 @@ var Delegate = ({
|
|
|
25028
25223
|
}
|
|
25029
25224
|
setProcessing(false);
|
|
25030
25225
|
};
|
|
25031
|
-
(0,
|
|
25226
|
+
(0, import_react16.useEffect)(() => {
|
|
25032
25227
|
checkAccountStatus();
|
|
25033
25228
|
}, [rewardAddress]);
|
|
25034
25229
|
if (checking) {
|
|
25035
|
-
return /* @__PURE__ */ (0,
|
|
25230
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Checking..." });
|
|
25036
25231
|
}
|
|
25037
25232
|
if (processing) {
|
|
25038
|
-
return /* @__PURE__ */ (0,
|
|
25233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Loading..." });
|
|
25039
25234
|
}
|
|
25040
25235
|
if (done) {
|
|
25041
|
-
return /* @__PURE__ */ (0,
|
|
25236
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Stake Delegated" });
|
|
25042
25237
|
}
|
|
25043
25238
|
if (accountInfo?.active) {
|
|
25044
|
-
return accountInfo.poolId === poolId ? /* @__PURE__ */ (0,
|
|
25239
|
+
return accountInfo.poolId === poolId ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Stake Delegated" }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { onClick: delegateStake, children: "Begin Staking" });
|
|
25045
25240
|
}
|
|
25046
|
-
return /* @__PURE__ */ (0,
|
|
25241
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { onClick: registerAddress, children: "Begin Staking" });
|
|
25047
25242
|
};
|
|
25048
25243
|
// Annotate the CommonJS export names for ESM import in node:
|
|
25049
25244
|
0 && (module.exports = {
|