@meshsdk/react 1.8.14 → 1.9.0-beta-39
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 +352 -129
- package/dist/index.d.cts +19 -6
- package/dist/index.d.ts +19 -6
- package/dist/index.js +347 -120
- package/package.json +9 -7
package/dist/index.js
CHANGED
|
@@ -23432,7 +23432,7 @@ var require_dist = __commonJS({
|
|
|
23432
23432
|
});
|
|
23433
23433
|
|
|
23434
23434
|
// src/cardano-wallet/index.tsx
|
|
23435
|
-
import { useEffect as useEffect10, useState as
|
|
23435
|
+
import { useEffect as useEffect10, useState as useState13 } from "react";
|
|
23436
23436
|
|
|
23437
23437
|
// src/common/button.tsx
|
|
23438
23438
|
import * as React from "react";
|
|
@@ -23613,6 +23613,9 @@ import { useContext, useEffect as useEffect2, useState as useState2 } from "reac
|
|
|
23613
23613
|
// src/contexts/WalletContext.ts
|
|
23614
23614
|
import { createContext, useCallback, useEffect, useState } from "react";
|
|
23615
23615
|
import { BrowserWallet } from "@meshsdk/wallet";
|
|
23616
|
+
import {
|
|
23617
|
+
Web3Wallet
|
|
23618
|
+
} from "@meshsdk/web3-sdk";
|
|
23616
23619
|
var INITIAL_STATE = {
|
|
23617
23620
|
walletName: void 0,
|
|
23618
23621
|
walletInstance: {}
|
|
@@ -23626,11 +23629,16 @@ var useWalletStore = () => {
|
|
|
23626
23629
|
const [address, setAddress] = useState("");
|
|
23627
23630
|
const [connectedWalletInstance, setConnectedWalletInstance] = useState(INITIAL_STATE.walletInstance);
|
|
23628
23631
|
const [connectedWalletName, setConnectedWalletName] = useState(INITIAL_STATE.walletName);
|
|
23632
|
+
const [web3Services, setWeb3Services] = useState(void 0);
|
|
23633
|
+
const [web3UserData, setWeb3UserData] = useState(
|
|
23634
|
+
void 0
|
|
23635
|
+
);
|
|
23629
23636
|
const connectWallet = useCallback(
|
|
23630
|
-
async (walletName,
|
|
23637
|
+
async (walletName, persist) => {
|
|
23631
23638
|
setConnectingWallet(true);
|
|
23632
23639
|
setState("CONNECTING" /* CONNECTING */);
|
|
23633
23640
|
try {
|
|
23641
|
+
const extensions = BrowserWallet.getSupportedExtensions(walletName);
|
|
23634
23642
|
const walletInstance = await BrowserWallet.enable(
|
|
23635
23643
|
walletName,
|
|
23636
23644
|
extensions
|
|
@@ -23662,10 +23670,16 @@ var useWalletStore = () => {
|
|
|
23662
23670
|
localStorage.removeItem(localstoragePersist);
|
|
23663
23671
|
}, []);
|
|
23664
23672
|
const setWallet = useCallback(
|
|
23665
|
-
async (walletInstance, walletName) => {
|
|
23673
|
+
async (walletInstance, walletName, persist) => {
|
|
23666
23674
|
setConnectedWalletInstance(walletInstance);
|
|
23667
23675
|
setConnectedWalletName(walletName);
|
|
23668
23676
|
setState("CONNECTED" /* CONNECTED */);
|
|
23677
|
+
if (persist) {
|
|
23678
|
+
localStorage.setItem(
|
|
23679
|
+
localstoragePersist,
|
|
23680
|
+
JSON.stringify({ walletName, ...persist })
|
|
23681
|
+
);
|
|
23682
|
+
}
|
|
23669
23683
|
},
|
|
23670
23684
|
[]
|
|
23671
23685
|
);
|
|
@@ -23689,7 +23703,23 @@ var useWalletStore = () => {
|
|
|
23689
23703
|
const persist2 = JSON.parse(
|
|
23690
23704
|
localStorage.getItem(localstoragePersist) || ""
|
|
23691
23705
|
);
|
|
23692
|
-
|
|
23706
|
+
if (persist2.walletName == "Mesh Web3 Services" && web3Services) {
|
|
23707
|
+
Web3Wallet.initWallet({
|
|
23708
|
+
networkId: web3Services.networkId,
|
|
23709
|
+
address: persist2.walletAddress,
|
|
23710
|
+
fetcher: web3Services.fetcher,
|
|
23711
|
+
submitter: web3Services.submitter,
|
|
23712
|
+
projectId: web3Services.projectId,
|
|
23713
|
+
appUrl: web3Services.appUrl
|
|
23714
|
+
}).then((wallet) => {
|
|
23715
|
+
setConnectedWalletInstance(wallet);
|
|
23716
|
+
setConnectedWalletName(persist2.walletName);
|
|
23717
|
+
setState("CONNECTED" /* CONNECTED */);
|
|
23718
|
+
});
|
|
23719
|
+
setWeb3UserData(persist2.user);
|
|
23720
|
+
} else {
|
|
23721
|
+
connectWallet(persist2.walletName);
|
|
23722
|
+
}
|
|
23693
23723
|
}
|
|
23694
23724
|
}, [persistSession]);
|
|
23695
23725
|
return {
|
|
@@ -23701,6 +23731,9 @@ var useWalletStore = () => {
|
|
|
23701
23731
|
disconnect,
|
|
23702
23732
|
setWallet,
|
|
23703
23733
|
setPersist,
|
|
23734
|
+
setWeb3Services,
|
|
23735
|
+
web3UserData,
|
|
23736
|
+
setWeb3UserData,
|
|
23704
23737
|
error,
|
|
23705
23738
|
address,
|
|
23706
23739
|
state
|
|
@@ -23719,6 +23752,11 @@ var WalletContext = createContext({
|
|
|
23719
23752
|
},
|
|
23720
23753
|
setPersist: () => {
|
|
23721
23754
|
},
|
|
23755
|
+
setWeb3Services: () => {
|
|
23756
|
+
},
|
|
23757
|
+
web3UserData: void 0,
|
|
23758
|
+
setWeb3UserData: () => {
|
|
23759
|
+
},
|
|
23722
23760
|
address: "",
|
|
23723
23761
|
state: "NOT_CONNECTED" /* NOT_CONNECTED */
|
|
23724
23762
|
});
|
|
@@ -23840,6 +23878,9 @@ var useWallet = () => {
|
|
|
23840
23878
|
disconnect,
|
|
23841
23879
|
setWallet,
|
|
23842
23880
|
setPersist,
|
|
23881
|
+
setWeb3Services,
|
|
23882
|
+
web3UserData,
|
|
23883
|
+
setWeb3UserData,
|
|
23843
23884
|
error,
|
|
23844
23885
|
address,
|
|
23845
23886
|
state
|
|
@@ -23858,6 +23899,9 @@ var useWallet = () => {
|
|
|
23858
23899
|
disconnect,
|
|
23859
23900
|
setWallet,
|
|
23860
23901
|
setPersist,
|
|
23902
|
+
setWeb3Services,
|
|
23903
|
+
web3UserData,
|
|
23904
|
+
setWeb3UserData,
|
|
23861
23905
|
error,
|
|
23862
23906
|
address,
|
|
23863
23907
|
state
|
|
@@ -24034,7 +24078,7 @@ DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
|
24034
24078
|
// src/cardano-wallet/connected-button.tsx
|
|
24035
24079
|
import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
24036
24080
|
function ConnectedButton() {
|
|
24037
|
-
const {
|
|
24081
|
+
const { name, disconnect, address } = useWallet();
|
|
24038
24082
|
return /* @__PURE__ */ jsxs3(DropdownMenu, { children: [
|
|
24039
24083
|
/* @__PURE__ */ jsx6(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs3(Button, { variant: "outline", children: [
|
|
24040
24084
|
address.slice(0, 6),
|
|
@@ -24042,6 +24086,7 @@ function ConnectedButton() {
|
|
|
24042
24086
|
address.slice(-6)
|
|
24043
24087
|
] }) }),
|
|
24044
24088
|
/* @__PURE__ */ jsxs3(DropdownMenuContent, { children: [
|
|
24089
|
+
/* @__PURE__ */ jsx6(DropdownMenuLabel, { children: "Wallet" }),
|
|
24045
24090
|
/* @__PURE__ */ jsx6(
|
|
24046
24091
|
DropdownMenuItem,
|
|
24047
24092
|
{
|
|
@@ -24051,6 +24096,16 @@ function ConnectedButton() {
|
|
|
24051
24096
|
children: "Copy Address"
|
|
24052
24097
|
}
|
|
24053
24098
|
),
|
|
24099
|
+
name == "Mesh Web3 Services" && /* @__PURE__ */ jsx6(
|
|
24100
|
+
DropdownMenuItem,
|
|
24101
|
+
{
|
|
24102
|
+
onClick: () => {
|
|
24103
|
+
window.open("https://web3.meshjs.dev/dashboard", "_blank");
|
|
24104
|
+
},
|
|
24105
|
+
children: "Open Web3 Wallet"
|
|
24106
|
+
}
|
|
24107
|
+
),
|
|
24108
|
+
/* @__PURE__ */ jsx6(DropdownMenuSeparator, {}),
|
|
24054
24109
|
/* @__PURE__ */ jsx6(
|
|
24055
24110
|
DropdownMenuItem,
|
|
24056
24111
|
{
|
|
@@ -24220,7 +24275,6 @@ function IconDownload() {
|
|
|
24220
24275
|
height: "24px",
|
|
24221
24276
|
strokeWidth: "1px"
|
|
24222
24277
|
},
|
|
24223
|
-
className: "hover:mesh-fill-white",
|
|
24224
24278
|
children: [
|
|
24225
24279
|
/* @__PURE__ */ jsx9("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
24226
24280
|
/* @__PURE__ */ jsx9("polyline", { points: "7 10 12 15 17 10" }),
|
|
@@ -24325,7 +24379,8 @@ function WalletIcon({
|
|
|
24325
24379
|
icon,
|
|
24326
24380
|
name,
|
|
24327
24381
|
action,
|
|
24328
|
-
iconReactNode
|
|
24382
|
+
iconReactNode,
|
|
24383
|
+
loading = false
|
|
24329
24384
|
}) {
|
|
24330
24385
|
return /* @__PURE__ */ jsxs9(Tooltip, { delayDuration: 0, defaultOpen: false, children: [
|
|
24331
24386
|
/* @__PURE__ */ jsx13(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs9(
|
|
@@ -24333,9 +24388,11 @@ function WalletIcon({
|
|
|
24333
24388
|
{
|
|
24334
24389
|
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",
|
|
24335
24390
|
onClick: action,
|
|
24391
|
+
disabled: loading,
|
|
24336
24392
|
children: [
|
|
24337
|
-
icon && /* @__PURE__ */ jsx13("img", { src: icon, alt: name, className: "mesh-w-8 mesh-h-8" }),
|
|
24338
|
-
iconReactNode && iconReactNode
|
|
24393
|
+
icon && !loading && /* @__PURE__ */ jsx13("img", { src: icon, alt: name, className: "mesh-w-8 mesh-h-8" }),
|
|
24394
|
+
!loading && iconReactNode && iconReactNode,
|
|
24395
|
+
loading && /* @__PURE__ */ jsx13("span", { className: "text-black", children: "..." })
|
|
24339
24396
|
]
|
|
24340
24397
|
}
|
|
24341
24398
|
) }),
|
|
@@ -24343,34 +24400,201 @@ function WalletIcon({
|
|
|
24343
24400
|
] });
|
|
24344
24401
|
}
|
|
24345
24402
|
|
|
24403
|
+
// src/cardano-wallet/web3-services.tsx
|
|
24404
|
+
import { useState as useState10 } from "react";
|
|
24405
|
+
import {
|
|
24406
|
+
Web3Wallet as Web3Wallet2
|
|
24407
|
+
} from "@meshsdk/web3-sdk";
|
|
24408
|
+
|
|
24409
|
+
// src/common/icons/icon-discord.tsx
|
|
24410
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
24411
|
+
function IconDiscord() {
|
|
24412
|
+
return /* @__PURE__ */ jsx14(
|
|
24413
|
+
"svg",
|
|
24414
|
+
{
|
|
24415
|
+
viewBox: "0 0 20 20",
|
|
24416
|
+
"aria-hidden": "true",
|
|
24417
|
+
style: {
|
|
24418
|
+
width: "24px",
|
|
24419
|
+
height: "24px"
|
|
24420
|
+
},
|
|
24421
|
+
children: /* @__PURE__ */ jsx14(
|
|
24422
|
+
"path",
|
|
24423
|
+
{
|
|
24424
|
+
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",
|
|
24425
|
+
fill: "#5865F2"
|
|
24426
|
+
}
|
|
24427
|
+
)
|
|
24428
|
+
}
|
|
24429
|
+
);
|
|
24430
|
+
}
|
|
24431
|
+
|
|
24432
|
+
// src/common/icons/icon-google.tsx
|
|
24433
|
+
import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
24434
|
+
function IconGoogle() {
|
|
24435
|
+
return /* @__PURE__ */ jsxs10(
|
|
24436
|
+
"svg",
|
|
24437
|
+
{
|
|
24438
|
+
viewBox: "0 0 262 262",
|
|
24439
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
24440
|
+
preserveAspectRatio: "xMidYMid",
|
|
24441
|
+
style: {
|
|
24442
|
+
width: "24px",
|
|
24443
|
+
height: "24px"
|
|
24444
|
+
},
|
|
24445
|
+
children: [
|
|
24446
|
+
/* @__PURE__ */ jsx15(
|
|
24447
|
+
"path",
|
|
24448
|
+
{
|
|
24449
|
+
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",
|
|
24450
|
+
fill: "#4285F4"
|
|
24451
|
+
}
|
|
24452
|
+
),
|
|
24453
|
+
/* @__PURE__ */ jsx15(
|
|
24454
|
+
"path",
|
|
24455
|
+
{
|
|
24456
|
+
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",
|
|
24457
|
+
fill: "#34A853"
|
|
24458
|
+
}
|
|
24459
|
+
),
|
|
24460
|
+
/* @__PURE__ */ jsx15(
|
|
24461
|
+
"path",
|
|
24462
|
+
{
|
|
24463
|
+
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",
|
|
24464
|
+
fill: "#FBBC05"
|
|
24465
|
+
}
|
|
24466
|
+
),
|
|
24467
|
+
/* @__PURE__ */ jsx15(
|
|
24468
|
+
"path",
|
|
24469
|
+
{
|
|
24470
|
+
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",
|
|
24471
|
+
fill: "#EB4335"
|
|
24472
|
+
}
|
|
24473
|
+
)
|
|
24474
|
+
]
|
|
24475
|
+
}
|
|
24476
|
+
);
|
|
24477
|
+
}
|
|
24478
|
+
|
|
24479
|
+
// src/common/icons/icon-twitter.tsx
|
|
24480
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
24481
|
+
function IconTwitter() {
|
|
24482
|
+
return /* @__PURE__ */ jsx16(
|
|
24483
|
+
"svg",
|
|
24484
|
+
{
|
|
24485
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
24486
|
+
version: "1.1",
|
|
24487
|
+
viewBox: "0 0 24 24",
|
|
24488
|
+
style: {
|
|
24489
|
+
width: "24px",
|
|
24490
|
+
height: "24px"
|
|
24491
|
+
},
|
|
24492
|
+
children: /* @__PURE__ */ jsx16("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" })
|
|
24493
|
+
}
|
|
24494
|
+
);
|
|
24495
|
+
}
|
|
24496
|
+
|
|
24497
|
+
// src/cardano-wallet/web3-services.tsx
|
|
24498
|
+
import { Fragment as Fragment3, jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
24499
|
+
function Web3Services({
|
|
24500
|
+
options,
|
|
24501
|
+
setOpen,
|
|
24502
|
+
persist
|
|
24503
|
+
}) {
|
|
24504
|
+
const { setWallet, setWeb3UserData } = useWallet();
|
|
24505
|
+
const [loading, setLoading] = useState10(false);
|
|
24506
|
+
async function loadWallet(directTo) {
|
|
24507
|
+
setLoading(true);
|
|
24508
|
+
const _options = {
|
|
24509
|
+
networkId: 0,
|
|
24510
|
+
fetcher: options.fetcher,
|
|
24511
|
+
submitter: options.submitter,
|
|
24512
|
+
appUrl: options.appUrl,
|
|
24513
|
+
projectId: options.projectId,
|
|
24514
|
+
directTo
|
|
24515
|
+
};
|
|
24516
|
+
const wallet = await Web3Wallet2.enable(_options);
|
|
24517
|
+
const user = wallet.getUser();
|
|
24518
|
+
setWeb3UserData(user);
|
|
24519
|
+
setWallet(
|
|
24520
|
+
wallet,
|
|
24521
|
+
"Mesh Web3 Services",
|
|
24522
|
+
persist ? {
|
|
24523
|
+
walletAddress: await wallet.getChangeAddress(),
|
|
24524
|
+
user
|
|
24525
|
+
} : void 0
|
|
24526
|
+
);
|
|
24527
|
+
setLoading(false);
|
|
24528
|
+
setOpen(false);
|
|
24529
|
+
}
|
|
24530
|
+
return /* @__PURE__ */ jsxs11(Fragment3, { children: [
|
|
24531
|
+
/* @__PURE__ */ jsx17(
|
|
24532
|
+
WalletIcon,
|
|
24533
|
+
{
|
|
24534
|
+
iconReactNode: IconGoogle(),
|
|
24535
|
+
name: `Google`,
|
|
24536
|
+
action: () => loadWallet("google"),
|
|
24537
|
+
loading
|
|
24538
|
+
}
|
|
24539
|
+
),
|
|
24540
|
+
/* @__PURE__ */ jsx17(
|
|
24541
|
+
WalletIcon,
|
|
24542
|
+
{
|
|
24543
|
+
iconReactNode: IconDiscord(),
|
|
24544
|
+
name: `Discord`,
|
|
24545
|
+
action: () => loadWallet("discord"),
|
|
24546
|
+
loading
|
|
24547
|
+
}
|
|
24548
|
+
),
|
|
24549
|
+
/* @__PURE__ */ jsx17(
|
|
24550
|
+
WalletIcon,
|
|
24551
|
+
{
|
|
24552
|
+
iconReactNode: IconTwitter(),
|
|
24553
|
+
name: `Twitter`,
|
|
24554
|
+
action: () => loadWallet("twitter"),
|
|
24555
|
+
loading
|
|
24556
|
+
}
|
|
24557
|
+
)
|
|
24558
|
+
] });
|
|
24559
|
+
}
|
|
24560
|
+
|
|
24346
24561
|
// src/cardano-wallet/screen-main.tsx
|
|
24347
|
-
import { jsx as
|
|
24562
|
+
import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
24348
24563
|
function ScreenMain({
|
|
24349
24564
|
injectFn,
|
|
24350
|
-
extensions,
|
|
24351
24565
|
setOpen,
|
|
24352
24566
|
setScreen,
|
|
24353
24567
|
persist,
|
|
24354
24568
|
cardanoPeerConnect,
|
|
24355
24569
|
burnerWallet,
|
|
24356
|
-
webauthn
|
|
24570
|
+
webauthn,
|
|
24571
|
+
showDownload,
|
|
24572
|
+
web3Services
|
|
24357
24573
|
}) {
|
|
24358
24574
|
const wallets = useWalletList({ injectFn });
|
|
24359
24575
|
const { connect: connect2 } = useWallet();
|
|
24360
|
-
return /* @__PURE__ */
|
|
24361
|
-
wallets.map((wallet, index) => /* @__PURE__ */
|
|
24576
|
+
return /* @__PURE__ */ jsx18(TooltipProvider, { children: /* @__PURE__ */ jsxs12("div", { className: "mesh-grid mesh-gap-4 mesh-py-4 mesh-grid-cols-5 mesh-place-items-center mesh-gap-y-8", children: [
|
|
24577
|
+
wallets.map((wallet, index) => /* @__PURE__ */ jsx18(
|
|
24362
24578
|
WalletIcon,
|
|
24363
24579
|
{
|
|
24364
24580
|
icon: wallet.icon,
|
|
24365
24581
|
name: wallet.name,
|
|
24366
24582
|
action: () => {
|
|
24367
|
-
connect2(wallet.id,
|
|
24583
|
+
connect2(wallet.id, persist);
|
|
24368
24584
|
setOpen(false);
|
|
24369
24585
|
}
|
|
24370
24586
|
},
|
|
24371
24587
|
index
|
|
24372
24588
|
)),
|
|
24373
|
-
|
|
24589
|
+
web3Services && /* @__PURE__ */ jsx18(
|
|
24590
|
+
Web3Services,
|
|
24591
|
+
{
|
|
24592
|
+
options: web3Services,
|
|
24593
|
+
setOpen,
|
|
24594
|
+
persist
|
|
24595
|
+
}
|
|
24596
|
+
),
|
|
24597
|
+
webauthn && /* @__PURE__ */ jsx18(
|
|
24374
24598
|
WalletIcon,
|
|
24375
24599
|
{
|
|
24376
24600
|
iconReactNode: IconFingerprint(),
|
|
@@ -24380,7 +24604,7 @@ function ScreenMain({
|
|
|
24380
24604
|
}
|
|
24381
24605
|
}
|
|
24382
24606
|
),
|
|
24383
|
-
cardanoPeerConnect && /* @__PURE__ */
|
|
24607
|
+
cardanoPeerConnect && /* @__PURE__ */ jsx18(
|
|
24384
24608
|
WalletIcon,
|
|
24385
24609
|
{
|
|
24386
24610
|
iconReactNode: IconMonitorSmartphone(),
|
|
@@ -24390,7 +24614,7 @@ function ScreenMain({
|
|
|
24390
24614
|
}
|
|
24391
24615
|
}
|
|
24392
24616
|
),
|
|
24393
|
-
burnerWallet && /* @__PURE__ */
|
|
24617
|
+
burnerWallet && /* @__PURE__ */ jsx18(
|
|
24394
24618
|
WalletIcon,
|
|
24395
24619
|
{
|
|
24396
24620
|
iconReactNode: IconBookDashed(),
|
|
@@ -24400,7 +24624,7 @@ function ScreenMain({
|
|
|
24400
24624
|
}
|
|
24401
24625
|
}
|
|
24402
24626
|
),
|
|
24403
|
-
/* @__PURE__ */
|
|
24627
|
+
showDownload && /* @__PURE__ */ jsx18(
|
|
24404
24628
|
WalletIcon,
|
|
24405
24629
|
{
|
|
24406
24630
|
iconReactNode: IconDownload(),
|
|
@@ -24418,16 +24642,16 @@ function ScreenMain({
|
|
|
24418
24642
|
|
|
24419
24643
|
// src/cardano-wallet/screen-p2p.tsx
|
|
24420
24644
|
var import_cardano_peer_connect = __toESM(require_dist(), 1);
|
|
24421
|
-
import { useEffect as useEffect9, useRef as useRef2, useState as
|
|
24422
|
-
import { jsx as
|
|
24645
|
+
import { useEffect as useEffect9, useRef as useRef2, useState as useState11 } from "react";
|
|
24646
|
+
import { jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
24423
24647
|
function ScreenP2P({
|
|
24424
24648
|
cardanoPeerConnect,
|
|
24425
24649
|
setOpen
|
|
24426
24650
|
}) {
|
|
24427
24651
|
const dAppConnect = useRef2(null);
|
|
24428
24652
|
const qrCodeField = useRef2(null);
|
|
24429
|
-
const [address, setAddress] =
|
|
24430
|
-
const [copied, setCopied] =
|
|
24653
|
+
const [address, setAddress] = useState11("");
|
|
24654
|
+
const [copied, setCopied] = useState11(false);
|
|
24431
24655
|
const { connect: connect2 } = useWallet();
|
|
24432
24656
|
useEffect9(() => {
|
|
24433
24657
|
if (cardanoPeerConnect) {
|
|
@@ -24463,9 +24687,9 @@ function ScreenP2P({
|
|
|
24463
24687
|
}
|
|
24464
24688
|
}
|
|
24465
24689
|
}, []);
|
|
24466
|
-
return /* @__PURE__ */
|
|
24467
|
-
/* @__PURE__ */
|
|
24468
|
-
/* @__PURE__ */
|
|
24690
|
+
return /* @__PURE__ */ jsxs13("div", { className: "mesh-flex mesh-flex-col mesh-items-center mesh-justify-center", children: [
|
|
24691
|
+
/* @__PURE__ */ jsx19("div", { style: { marginTop: 16, marginBottom: 16 }, ref: qrCodeField }),
|
|
24692
|
+
/* @__PURE__ */ jsx19(
|
|
24469
24693
|
Button,
|
|
24470
24694
|
{
|
|
24471
24695
|
variant: "outline",
|
|
@@ -24480,15 +24704,15 @@ function ScreenP2P({
|
|
|
24480
24704
|
}
|
|
24481
24705
|
|
|
24482
24706
|
// src/cardano-wallet/screen-webauthn.tsx
|
|
24483
|
-
import { useState as
|
|
24707
|
+
import { useState as useState12 } from "react";
|
|
24484
24708
|
import { connect, MeshWallet as MeshWallet2 } from "@meshsdk/wallet";
|
|
24485
24709
|
|
|
24486
24710
|
// src/common/input.tsx
|
|
24487
24711
|
import * as React5 from "react";
|
|
24488
|
-
import { jsx as
|
|
24712
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
24489
24713
|
var Input = React5.forwardRef(
|
|
24490
24714
|
({ className, type, ...props }, ref) => {
|
|
24491
|
-
return /* @__PURE__ */
|
|
24715
|
+
return /* @__PURE__ */ jsx20(
|
|
24492
24716
|
"input",
|
|
24493
24717
|
{
|
|
24494
24718
|
type,
|
|
@@ -24508,11 +24732,11 @@ Input.displayName = "Input";
|
|
|
24508
24732
|
import * as React6 from "react";
|
|
24509
24733
|
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
24510
24734
|
import { cva as cva2 } from "class-variance-authority";
|
|
24511
|
-
import { jsx as
|
|
24735
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
24512
24736
|
var labelVariants = cva2(
|
|
24513
24737
|
"mesh-text-sm mesh-font-medium mesh-leading-none peer-disabled:mesh-cursor-not-allowed peer-disabled:mesh-opacity-70"
|
|
24514
24738
|
);
|
|
24515
|
-
var Label2 = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
24739
|
+
var Label2 = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx21(
|
|
24516
24740
|
LabelPrimitive.Root,
|
|
24517
24741
|
{
|
|
24518
24742
|
ref,
|
|
@@ -24523,16 +24747,16 @@ var Label2 = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
24523
24747
|
Label2.displayName = LabelPrimitive.Root.displayName;
|
|
24524
24748
|
|
|
24525
24749
|
// src/cardano-wallet/screen-webauthn.tsx
|
|
24526
|
-
import { Fragment as
|
|
24750
|
+
import { Fragment as Fragment4, jsx as jsx22, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
24527
24751
|
function ScreenWebauthn({
|
|
24528
24752
|
url,
|
|
24529
24753
|
networkId,
|
|
24530
24754
|
provider,
|
|
24531
24755
|
setOpen
|
|
24532
24756
|
}) {
|
|
24533
|
-
const [loading, setLoading] =
|
|
24534
|
-
const [userName, setUserName] =
|
|
24535
|
-
const [password, setPassword] =
|
|
24757
|
+
const [loading, setLoading] = useState12(false);
|
|
24758
|
+
const [userName, setUserName] = useState12("");
|
|
24759
|
+
const [password, setPassword] = useState12("");
|
|
24536
24760
|
const { setWallet } = useWallet();
|
|
24537
24761
|
function createWallet(root) {
|
|
24538
24762
|
setTimeout(() => {
|
|
@@ -24557,10 +24781,10 @@ function ScreenWebauthn({
|
|
|
24557
24781
|
createWallet(res.wallet.bech32PrivateKey);
|
|
24558
24782
|
}
|
|
24559
24783
|
}
|
|
24560
|
-
return /* @__PURE__ */
|
|
24561
|
-
/* @__PURE__ */
|
|
24562
|
-
/* @__PURE__ */
|
|
24563
|
-
/* @__PURE__ */
|
|
24784
|
+
return /* @__PURE__ */ jsx22("div", { className: "mesh-flex mesh-flex-row mesh-flex-gap-4 mesh-items-center mesh-justify-center", children: loading ? /* @__PURE__ */ jsx22(Fragment4, { children: "Connecting wallet..." }) : /* @__PURE__ */ jsx22(Fragment4, { children: /* @__PURE__ */ jsxs14("div", { className: "mesh-flex mesh-flex-col mesh-gap-6 mesh-w-full mesh-mx-8", children: [
|
|
24785
|
+
/* @__PURE__ */ jsxs14("div", { className: "mesh-grid mesh-gap-2", children: [
|
|
24786
|
+
/* @__PURE__ */ jsx22(Label2, { htmlFor: "username", children: "Username" }),
|
|
24787
|
+
/* @__PURE__ */ jsx22(
|
|
24564
24788
|
Input,
|
|
24565
24789
|
{
|
|
24566
24790
|
id: "username",
|
|
@@ -24570,11 +24794,11 @@ function ScreenWebauthn({
|
|
|
24570
24794
|
onChange: (e2) => setUserName(e2.target.value)
|
|
24571
24795
|
}
|
|
24572
24796
|
),
|
|
24573
|
-
/* @__PURE__ */
|
|
24797
|
+
/* @__PURE__ */ jsx22("p", { className: "mesh-text-gray-500 mesh-text-xs", children: "Unique to the application you are connecting." })
|
|
24574
24798
|
] }),
|
|
24575
|
-
/* @__PURE__ */
|
|
24576
|
-
/* @__PURE__ */
|
|
24577
|
-
/* @__PURE__ */
|
|
24799
|
+
/* @__PURE__ */ jsxs14("div", { className: "mesh-grid mesh-gap-2", children: [
|
|
24800
|
+
/* @__PURE__ */ jsx22("div", { className: "mesh-flex mesh-items-center", children: /* @__PURE__ */ jsx22(Label2, { htmlFor: "password", children: "Unique Code" }) }),
|
|
24801
|
+
/* @__PURE__ */ jsx22(
|
|
24578
24802
|
Input,
|
|
24579
24803
|
{
|
|
24580
24804
|
id: "password",
|
|
@@ -24584,9 +24808,9 @@ function ScreenWebauthn({
|
|
|
24584
24808
|
onChange: (e2) => setPassword(e2.target.value)
|
|
24585
24809
|
}
|
|
24586
24810
|
),
|
|
24587
|
-
/* @__PURE__ */
|
|
24811
|
+
/* @__PURE__ */ jsx22("p", { className: "mesh-text-gray-500 mesh-text-xs", children: "Additional security to derive your wallet." })
|
|
24588
24812
|
] }),
|
|
24589
|
-
/* @__PURE__ */
|
|
24813
|
+
/* @__PURE__ */ jsx22(
|
|
24590
24814
|
Button,
|
|
24591
24815
|
{
|
|
24592
24816
|
className: "mesh-w-full",
|
|
@@ -24599,59 +24823,62 @@ function ScreenWebauthn({
|
|
|
24599
24823
|
}
|
|
24600
24824
|
|
|
24601
24825
|
// src/cardano-wallet/index.tsx
|
|
24602
|
-
import { jsx as
|
|
24826
|
+
import { jsx as jsx23, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
24603
24827
|
var CardanoWallet = ({
|
|
24604
24828
|
label = "Connect Wallet",
|
|
24605
24829
|
onConnected = void 0,
|
|
24606
24830
|
isDark = false,
|
|
24607
24831
|
persist = false,
|
|
24608
|
-
extensions = [],
|
|
24609
24832
|
injectFn = void 0,
|
|
24610
24833
|
cardanoPeerConnect = void 0,
|
|
24611
24834
|
burnerWallet = void 0,
|
|
24612
|
-
webauthn = void 0
|
|
24835
|
+
webauthn = void 0,
|
|
24836
|
+
showDownload = true,
|
|
24837
|
+
web3Services = void 0
|
|
24613
24838
|
}) => {
|
|
24614
|
-
const [open, setOpen] =
|
|
24615
|
-
const [screen, setScreen] =
|
|
24616
|
-
const { wallet, connected, setPersist } = useWallet();
|
|
24839
|
+
const [open, setOpen] = useState13(false);
|
|
24840
|
+
const [screen, setScreen] = useState13("main");
|
|
24841
|
+
const { wallet, connected, setPersist, setWeb3Services } = useWallet();
|
|
24617
24842
|
useEffect10(() => {
|
|
24618
24843
|
setPersist(persist);
|
|
24619
|
-
|
|
24844
|
+
if (web3Services) setWeb3Services(web3Services);
|
|
24845
|
+
}, []);
|
|
24620
24846
|
useEffect10(() => {
|
|
24621
24847
|
if (connected) {
|
|
24622
24848
|
if (onConnected) onConnected();
|
|
24623
24849
|
}
|
|
24624
24850
|
}, [connected, wallet]);
|
|
24625
|
-
return /* @__PURE__ */
|
|
24626
|
-
/* @__PURE__ */
|
|
24627
|
-
/* @__PURE__ */
|
|
24851
|
+
return /* @__PURE__ */ jsxs15(Dialog, { open, onOpenChange: setOpen, children: [
|
|
24852
|
+
/* @__PURE__ */ jsx23("div", { className: isDark ? "mesh-dark" : "", children: !connected ? /* @__PURE__ */ jsx23(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsx23(Button, { variant: "outline", className: isDark ? "mesh-dark" : "", children: label }) }) : /* @__PURE__ */ jsx23(ConnectedButton, {}) }),
|
|
24853
|
+
/* @__PURE__ */ jsxs15(
|
|
24628
24854
|
DialogContent,
|
|
24629
24855
|
{
|
|
24630
24856
|
className: "sm:mesh-max-w-[425px] mesh-dark",
|
|
24631
24857
|
onOpenAutoFocus: (event) => event.preventDefault(),
|
|
24632
24858
|
children: [
|
|
24633
|
-
/* @__PURE__ */
|
|
24634
|
-
screen == "main" && /* @__PURE__ */
|
|
24859
|
+
/* @__PURE__ */ jsx23(Header, { screen, setScreen }),
|
|
24860
|
+
screen == "main" && /* @__PURE__ */ jsx23(
|
|
24635
24861
|
ScreenMain,
|
|
24636
24862
|
{
|
|
24637
24863
|
injectFn,
|
|
24638
|
-
extensions,
|
|
24639
24864
|
setOpen,
|
|
24640
24865
|
setScreen,
|
|
24641
24866
|
persist,
|
|
24642
24867
|
cardanoPeerConnect: cardanoPeerConnect != void 0,
|
|
24643
24868
|
burnerWallet: burnerWallet != void 0,
|
|
24644
|
-
webauthn: webauthn != void 0
|
|
24869
|
+
webauthn: webauthn != void 0,
|
|
24870
|
+
showDownload,
|
|
24871
|
+
web3Services
|
|
24645
24872
|
}
|
|
24646
24873
|
),
|
|
24647
|
-
screen == "p2p" && /* @__PURE__ */
|
|
24874
|
+
screen == "p2p" && /* @__PURE__ */ jsx23(
|
|
24648
24875
|
ScreenP2P,
|
|
24649
24876
|
{
|
|
24650
24877
|
cardanoPeerConnect,
|
|
24651
24878
|
setOpen
|
|
24652
24879
|
}
|
|
24653
24880
|
),
|
|
24654
|
-
screen == "burner" && burnerWallet && /* @__PURE__ */
|
|
24881
|
+
screen == "burner" && burnerWallet && /* @__PURE__ */ jsx23(
|
|
24655
24882
|
ScreenBurner,
|
|
24656
24883
|
{
|
|
24657
24884
|
networkId: burnerWallet.networkId,
|
|
@@ -24659,7 +24886,7 @@ var CardanoWallet = ({
|
|
|
24659
24886
|
setOpen
|
|
24660
24887
|
}
|
|
24661
24888
|
),
|
|
24662
|
-
screen == "webauthn" && webauthn && /* @__PURE__ */
|
|
24889
|
+
screen == "webauthn" && webauthn && /* @__PURE__ */ jsx23(
|
|
24663
24890
|
ScreenWebauthn,
|
|
24664
24891
|
{
|
|
24665
24892
|
url: webauthn.url,
|
|
@@ -24668,7 +24895,7 @@ var CardanoWallet = ({
|
|
|
24668
24895
|
setOpen
|
|
24669
24896
|
}
|
|
24670
24897
|
),
|
|
24671
|
-
/* @__PURE__ */
|
|
24898
|
+
/* @__PURE__ */ jsx23(Footer, {})
|
|
24672
24899
|
]
|
|
24673
24900
|
}
|
|
24674
24901
|
)
|
|
@@ -24678,25 +24905,25 @@ function Header({
|
|
|
24678
24905
|
screen,
|
|
24679
24906
|
setScreen
|
|
24680
24907
|
}) {
|
|
24681
|
-
return /* @__PURE__ */
|
|
24682
|
-
/* @__PURE__ */
|
|
24683
|
-
screen != "main" ? /* @__PURE__ */
|
|
24684
|
-
/* @__PURE__ */
|
|
24685
|
-
/* @__PURE__ */
|
|
24908
|
+
return /* @__PURE__ */ jsxs15(DialogHeader, { children: [
|
|
24909
|
+
/* @__PURE__ */ jsxs15(DialogTitle, { className: "mesh-flex mesh-justify-between", children: [
|
|
24910
|
+
screen != "main" ? /* @__PURE__ */ jsx23("button", { onClick: () => setScreen("main"), children: /* @__PURE__ */ jsx23(IconChevronRight, {}) }) : /* @__PURE__ */ jsx23("span", { style: { width: "24px" } }),
|
|
24911
|
+
/* @__PURE__ */ jsx23("span", { children: screens[screen].title }),
|
|
24912
|
+
/* @__PURE__ */ jsx23("span", { style: { width: "24px" } })
|
|
24686
24913
|
] }),
|
|
24687
|
-
/* @__PURE__ */
|
|
24914
|
+
/* @__PURE__ */ jsx23(DialogDescription, { children: screens[screen].subtitle && screens[screen].subtitle })
|
|
24688
24915
|
] });
|
|
24689
24916
|
}
|
|
24690
24917
|
function Footer() {
|
|
24691
|
-
return /* @__PURE__ */
|
|
24918
|
+
return /* @__PURE__ */ jsx23(DialogFooter, { className: "mesh-justify-center mesh-text-sm", children: /* @__PURE__ */ jsxs15(
|
|
24692
24919
|
"a",
|
|
24693
24920
|
{
|
|
24694
24921
|
href: "https://meshjs.dev/",
|
|
24695
24922
|
target: "_blank",
|
|
24696
24923
|
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",
|
|
24697
24924
|
children: [
|
|
24698
|
-
/* @__PURE__ */
|
|
24699
|
-
/* @__PURE__ */
|
|
24925
|
+
/* @__PURE__ */ jsx23("span", { className: "", children: "Powered by" }),
|
|
24926
|
+
/* @__PURE__ */ jsx23(
|
|
24700
24927
|
"svg",
|
|
24701
24928
|
{
|
|
24702
24929
|
width: 24,
|
|
@@ -24704,31 +24931,31 @@ function Footer() {
|
|
|
24704
24931
|
enableBackground: "new 0 0 300 200",
|
|
24705
24932
|
viewBox: "0 0 300 200",
|
|
24706
24933
|
xmlns: "http://www.w3.org/2000/svg",
|
|
24707
|
-
children: /* @__PURE__ */
|
|
24934
|
+
children: /* @__PURE__ */ jsx23("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" })
|
|
24708
24935
|
}
|
|
24709
24936
|
),
|
|
24710
|
-
/* @__PURE__ */
|
|
24937
|
+
/* @__PURE__ */ jsx23("span", { className: "", children: "Mesh SDK" })
|
|
24711
24938
|
]
|
|
24712
24939
|
}
|
|
24713
24940
|
) });
|
|
24714
24941
|
}
|
|
24715
24942
|
|
|
24716
24943
|
// src/mesh-badge/mesh-logo.tsx
|
|
24717
|
-
import { jsx as
|
|
24718
|
-
var MeshLogo = () => /* @__PURE__ */
|
|
24944
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
24945
|
+
var MeshLogo = () => /* @__PURE__ */ jsx24(
|
|
24719
24946
|
"svg",
|
|
24720
24947
|
{
|
|
24721
24948
|
className: "mesh-h-16 mesh-p-2",
|
|
24722
24949
|
fill: "currentColor",
|
|
24723
24950
|
viewBox: "0 0 300 200",
|
|
24724
24951
|
xmlns: "http://www.w3.org/2000/svg",
|
|
24725
|
-
children: /* @__PURE__ */
|
|
24952
|
+
children: /* @__PURE__ */ jsx24("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" })
|
|
24726
24953
|
}
|
|
24727
24954
|
);
|
|
24728
24955
|
|
|
24729
24956
|
// src/mesh-badge/index.tsx
|
|
24730
|
-
import { jsx as
|
|
24731
|
-
var MeshBadge = ({ isDark = false }) => /* @__PURE__ */
|
|
24957
|
+
import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
24958
|
+
var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ jsxs16(
|
|
24732
24959
|
"a",
|
|
24733
24960
|
{
|
|
24734
24961
|
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`}`,
|
|
@@ -24740,21 +24967,21 @@ var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ jsxs14(
|
|
|
24740
24967
|
rel: "noopener noreferrer",
|
|
24741
24968
|
target: "_blank",
|
|
24742
24969
|
children: [
|
|
24743
|
-
/* @__PURE__ */
|
|
24970
|
+
/* @__PURE__ */ jsx25(MeshLogo, {}),
|
|
24744
24971
|
"Mesh"
|
|
24745
24972
|
]
|
|
24746
24973
|
}
|
|
24747
24974
|
);
|
|
24748
24975
|
|
|
24749
24976
|
// src/stake-button/index.tsx
|
|
24750
|
-
import { useEffect as useEffect12, useState as
|
|
24977
|
+
import { useEffect as useEffect12, useState as useState15 } from "react";
|
|
24751
24978
|
import { Transaction } from "@meshsdk/transaction";
|
|
24752
24979
|
|
|
24753
24980
|
// src/cardano-wallet-dropdown/index.tsx
|
|
24754
|
-
import { useEffect as useEffect11, useState as
|
|
24981
|
+
import { useEffect as useEffect11, useState as useState14 } from "react";
|
|
24755
24982
|
|
|
24756
24983
|
// src/common/button-dropdown.tsx
|
|
24757
|
-
import { jsx as
|
|
24984
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
24758
24985
|
function ButtonDropdown({
|
|
24759
24986
|
children,
|
|
24760
24987
|
isDarkMode = false,
|
|
@@ -24763,7 +24990,7 @@ function ButtonDropdown({
|
|
|
24763
24990
|
onMouseEnter,
|
|
24764
24991
|
onMouseLeave
|
|
24765
24992
|
}) {
|
|
24766
|
-
return /* @__PURE__ */
|
|
24993
|
+
return /* @__PURE__ */ jsx26(
|
|
24767
24994
|
"button",
|
|
24768
24995
|
{
|
|
24769
24996
|
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`}`,
|
|
@@ -24776,21 +25003,21 @@ function ButtonDropdown({
|
|
|
24776
25003
|
}
|
|
24777
25004
|
|
|
24778
25005
|
// src/cardano-wallet-dropdown/menu-item.tsx
|
|
24779
|
-
import { jsx as
|
|
25006
|
+
import { jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
24780
25007
|
function MenuItem({
|
|
24781
25008
|
icon,
|
|
24782
25009
|
label,
|
|
24783
25010
|
action,
|
|
24784
25011
|
active
|
|
24785
25012
|
}) {
|
|
24786
|
-
return /* @__PURE__ */
|
|
25013
|
+
return /* @__PURE__ */ jsxs17(
|
|
24787
25014
|
"div",
|
|
24788
25015
|
{
|
|
24789
25016
|
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",
|
|
24790
25017
|
onClick: action,
|
|
24791
25018
|
children: [
|
|
24792
|
-
icon && /* @__PURE__ */
|
|
24793
|
-
/* @__PURE__ */
|
|
25019
|
+
icon && /* @__PURE__ */ jsx27("img", { className: "mesh-pr-2 mesh-m-1 mesh-h-8", src: icon }),
|
|
25020
|
+
/* @__PURE__ */ jsx27("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) => {
|
|
24794
25021
|
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
24795
25022
|
}).join(" ") })
|
|
24796
25023
|
]
|
|
@@ -24799,8 +25026,8 @@ function MenuItem({
|
|
|
24799
25026
|
}
|
|
24800
25027
|
|
|
24801
25028
|
// src/cardano-wallet-dropdown/chevron-down.tsx
|
|
24802
|
-
import { jsx as
|
|
24803
|
-
var ChevronDown = () => /* @__PURE__ */
|
|
25029
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
25030
|
+
var ChevronDown = () => /* @__PURE__ */ jsx28(
|
|
24804
25031
|
"svg",
|
|
24805
25032
|
{
|
|
24806
25033
|
className: "mesh-m-2 mesh-h-6",
|
|
@@ -24809,7 +25036,7 @@ var ChevronDown = () => /* @__PURE__ */ jsx24(
|
|
|
24809
25036
|
viewBox: "0 0 24 24",
|
|
24810
25037
|
stroke: "currentColor",
|
|
24811
25038
|
xmlns: "http://www.w3.org/2000/svg",
|
|
24812
|
-
children: /* @__PURE__ */
|
|
25039
|
+
children: /* @__PURE__ */ jsx28(
|
|
24813
25040
|
"path",
|
|
24814
25041
|
{
|
|
24815
25042
|
strokeLinecap: "round",
|
|
@@ -24822,7 +25049,7 @@ var ChevronDown = () => /* @__PURE__ */ jsx24(
|
|
|
24822
25049
|
);
|
|
24823
25050
|
|
|
24824
25051
|
// src/cardano-wallet-dropdown/wallet-balance.tsx
|
|
24825
|
-
import { Fragment as
|
|
25052
|
+
import { Fragment as Fragment5, jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
24826
25053
|
var WalletBalance = ({
|
|
24827
25054
|
connected,
|
|
24828
25055
|
connecting,
|
|
@@ -24830,22 +25057,22 @@ var WalletBalance = ({
|
|
|
24830
25057
|
wallet
|
|
24831
25058
|
}) => {
|
|
24832
25059
|
const lovelace = useLovelace();
|
|
24833
|
-
return connected && lovelace && wallet?.icon ? /* @__PURE__ */
|
|
24834
|
-
/* @__PURE__ */
|
|
25060
|
+
return connected && lovelace && wallet?.icon ? /* @__PURE__ */ jsxs18(Fragment5, { children: [
|
|
25061
|
+
/* @__PURE__ */ jsx29("img", { className: "mesh-m-2 mesh-h-6", src: wallet.icon }),
|
|
24835
25062
|
"\u20B3",
|
|
24836
25063
|
" ",
|
|
24837
25064
|
parseInt((parseInt(lovelace, 10) / 1e6).toString(), 10),
|
|
24838
25065
|
".",
|
|
24839
|
-
/* @__PURE__ */
|
|
24840
|
-
] }) : connected && wallet?.icon ? /* @__PURE__ */
|
|
25066
|
+
/* @__PURE__ */ jsx29("span", { className: "mesh-text-xs", children: lovelace.substring(lovelace.length - 6) })
|
|
25067
|
+
] }) : connected && wallet?.icon ? /* @__PURE__ */ jsx29(Fragment5, { children: /* @__PURE__ */ jsx29("img", { className: "mesh-m-2 mesh-h-6", src: wallet.icon }) }) : connecting ? /* @__PURE__ */ jsx29(Fragment5, { children: "Connecting..." }) : /* @__PURE__ */ jsxs18(Fragment5, { children: [
|
|
24841
25068
|
label,
|
|
24842
25069
|
" ",
|
|
24843
|
-
/* @__PURE__ */
|
|
25070
|
+
/* @__PURE__ */ jsx29(ChevronDown, {})
|
|
24844
25071
|
] });
|
|
24845
25072
|
};
|
|
24846
25073
|
|
|
24847
25074
|
// src/cardano-wallet-dropdown/index.tsx
|
|
24848
|
-
import { Fragment as
|
|
25075
|
+
import { Fragment as Fragment6, jsx as jsx30, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
24849
25076
|
var CardanoWallet2 = ({
|
|
24850
25077
|
label = "Connect Wallet",
|
|
24851
25078
|
onConnected = void 0,
|
|
@@ -24853,8 +25080,8 @@ var CardanoWallet2 = ({
|
|
|
24853
25080
|
extensions = [],
|
|
24854
25081
|
cardanoPeerConnect = void 0
|
|
24855
25082
|
}) => {
|
|
24856
|
-
const [isDarkMode, setIsDarkMode] =
|
|
24857
|
-
const [hideMenuList, setHideMenuList] =
|
|
25083
|
+
const [isDarkMode, setIsDarkMode] = useState14(false);
|
|
25084
|
+
const [hideMenuList, setHideMenuList] = useState14(true);
|
|
24858
25085
|
const { connect: connect2, connecting, connected, disconnect, name } = useWallet();
|
|
24859
25086
|
const wallets = useWalletList();
|
|
24860
25087
|
useEffect11(() => {
|
|
@@ -24865,20 +25092,20 @@ var CardanoWallet2 = ({
|
|
|
24865
25092
|
useEffect11(() => {
|
|
24866
25093
|
setIsDarkMode(isDark);
|
|
24867
25094
|
}, [isDark]);
|
|
24868
|
-
return /* @__PURE__ */
|
|
25095
|
+
return /* @__PURE__ */ jsxs19(
|
|
24869
25096
|
"div",
|
|
24870
25097
|
{
|
|
24871
25098
|
onMouseEnter: () => setHideMenuList(false),
|
|
24872
25099
|
onMouseLeave: () => setHideMenuList(true),
|
|
24873
25100
|
style: { width: "min-content", zIndex: 50 },
|
|
24874
25101
|
children: [
|
|
24875
|
-
/* @__PURE__ */
|
|
25102
|
+
/* @__PURE__ */ jsx30(
|
|
24876
25103
|
ButtonDropdown,
|
|
24877
25104
|
{
|
|
24878
25105
|
isDarkMode,
|
|
24879
25106
|
hideMenuList,
|
|
24880
25107
|
setHideMenuList,
|
|
24881
|
-
children: /* @__PURE__ */
|
|
25108
|
+
children: /* @__PURE__ */ jsx30(
|
|
24882
25109
|
WalletBalance,
|
|
24883
25110
|
{
|
|
24884
25111
|
connected,
|
|
@@ -24889,12 +25116,12 @@ var CardanoWallet2 = ({
|
|
|
24889
25116
|
)
|
|
24890
25117
|
}
|
|
24891
25118
|
),
|
|
24892
|
-
/* @__PURE__ */
|
|
25119
|
+
/* @__PURE__ */ jsx30(
|
|
24893
25120
|
"div",
|
|
24894
25121
|
{
|
|
24895
25122
|
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`}`,
|
|
24896
25123
|
style: { zIndex: 50 },
|
|
24897
|
-
children: !connected && wallets.length > 0 ? /* @__PURE__ */
|
|
25124
|
+
children: !connected && wallets.length > 0 ? /* @__PURE__ */ jsx30(Fragment6, { children: wallets.map((wallet, index) => /* @__PURE__ */ jsx30(
|
|
24898
25125
|
MenuItem,
|
|
24899
25126
|
{
|
|
24900
25127
|
icon: wallet.icon,
|
|
@@ -24906,7 +25133,7 @@ var CardanoWallet2 = ({
|
|
|
24906
25133
|
active: name === wallet.id
|
|
24907
25134
|
},
|
|
24908
25135
|
index
|
|
24909
|
-
)) }) : wallets.length === 0 ? /* @__PURE__ */
|
|
25136
|
+
)) }) : wallets.length === 0 ? /* @__PURE__ */ jsx30("span", { children: "No Wallet Found" }) : /* @__PURE__ */ jsx30(Fragment6, { children: /* @__PURE__ */ jsx30(
|
|
24910
25137
|
MenuItem,
|
|
24911
25138
|
{
|
|
24912
25139
|
active: false,
|
|
@@ -24923,7 +25150,7 @@ var CardanoWallet2 = ({
|
|
|
24923
25150
|
};
|
|
24924
25151
|
|
|
24925
25152
|
// src/stake-button/index.tsx
|
|
24926
|
-
import { Fragment as
|
|
25153
|
+
import { Fragment as Fragment7, jsx as jsx31 } from "react/jsx-runtime";
|
|
24927
25154
|
var StakeButton = ({
|
|
24928
25155
|
label = "Stake your ADA",
|
|
24929
25156
|
isDark = false,
|
|
@@ -24931,19 +25158,19 @@ var StakeButton = ({
|
|
|
24931
25158
|
onCheck,
|
|
24932
25159
|
onDelegated = void 0
|
|
24933
25160
|
}) => {
|
|
24934
|
-
const [isDarkMode, setIsDarkMode] =
|
|
25161
|
+
const [isDarkMode, setIsDarkMode] = useState15(false);
|
|
24935
25162
|
const { connected } = useWallet();
|
|
24936
25163
|
useEffect12(() => {
|
|
24937
25164
|
setIsDarkMode(isDark);
|
|
24938
25165
|
}, [isDark]);
|
|
24939
|
-
return /* @__PURE__ */
|
|
25166
|
+
return /* @__PURE__ */ jsx31(Fragment7, { children: connected ? /* @__PURE__ */ jsx31(ButtonDropdown, { isDarkMode, children: /* @__PURE__ */ jsx31(
|
|
24940
25167
|
Delegate,
|
|
24941
25168
|
{
|
|
24942
25169
|
poolId,
|
|
24943
25170
|
onCheck,
|
|
24944
25171
|
onDelegated
|
|
24945
25172
|
}
|
|
24946
|
-
) }) : /* @__PURE__ */
|
|
25173
|
+
) }) : /* @__PURE__ */ jsx31(CardanoWallet2, { label, isDark }) });
|
|
24947
25174
|
};
|
|
24948
25175
|
var Delegate = ({
|
|
24949
25176
|
poolId,
|
|
@@ -24952,11 +25179,11 @@ var Delegate = ({
|
|
|
24952
25179
|
}) => {
|
|
24953
25180
|
const { wallet } = useWallet();
|
|
24954
25181
|
const rewardAddress = useRewardAddress();
|
|
24955
|
-
const [_, setError] =
|
|
24956
|
-
const [checking, setChecking] =
|
|
24957
|
-
const [accountInfo, setAccountInfo] =
|
|
24958
|
-
const [processing, setProcessing] =
|
|
24959
|
-
const [done, setDone] =
|
|
25182
|
+
const [_, setError] = useState15();
|
|
25183
|
+
const [checking, setChecking] = useState15(false);
|
|
25184
|
+
const [accountInfo, setAccountInfo] = useState15();
|
|
25185
|
+
const [processing, setProcessing] = useState15(false);
|
|
25186
|
+
const [done, setDone] = useState15(false);
|
|
24960
25187
|
const checkAccountStatus = async () => {
|
|
24961
25188
|
try {
|
|
24962
25189
|
setChecking(true);
|
|
@@ -25011,18 +25238,18 @@ var Delegate = ({
|
|
|
25011
25238
|
checkAccountStatus();
|
|
25012
25239
|
}, [rewardAddress]);
|
|
25013
25240
|
if (checking) {
|
|
25014
|
-
return /* @__PURE__ */
|
|
25241
|
+
return /* @__PURE__ */ jsx31("span", { children: "Checking..." });
|
|
25015
25242
|
}
|
|
25016
25243
|
if (processing) {
|
|
25017
|
-
return /* @__PURE__ */
|
|
25244
|
+
return /* @__PURE__ */ jsx31("span", { children: "Loading..." });
|
|
25018
25245
|
}
|
|
25019
25246
|
if (done) {
|
|
25020
|
-
return /* @__PURE__ */
|
|
25247
|
+
return /* @__PURE__ */ jsx31("span", { children: "Stake Delegated" });
|
|
25021
25248
|
}
|
|
25022
25249
|
if (accountInfo?.active) {
|
|
25023
|
-
return accountInfo.poolId === poolId ? /* @__PURE__ */
|
|
25250
|
+
return accountInfo.poolId === poolId ? /* @__PURE__ */ jsx31("span", { children: "Stake Delegated" }) : /* @__PURE__ */ jsx31("span", { onClick: delegateStake, children: "Begin Staking" });
|
|
25024
25251
|
}
|
|
25025
|
-
return /* @__PURE__ */
|
|
25252
|
+
return /* @__PURE__ */ jsx31("span", { onClick: registerAddress, children: "Begin Staking" });
|
|
25026
25253
|
};
|
|
25027
25254
|
export {
|
|
25028
25255
|
CardanoWallet,
|