@meshsdk/react 1.8.13 → 1.9.0-beta-38
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 +369 -134
- package/dist/index.d.cts +26 -6
- package/dist/index.d.ts +26 -6
- package/dist/index.js +364 -125
- 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,22 +23613,32 @@ 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: {}
|
|
23619
23622
|
};
|
|
23620
|
-
var localstoragePersist = "mesh-persist";
|
|
23623
|
+
var localstoragePersist = "mesh-wallet-persist";
|
|
23621
23624
|
var useWalletStore = () => {
|
|
23622
23625
|
const [error, setError] = useState(void 0);
|
|
23626
|
+
const [state, setState] = useState("NOT_CONNECTED" /* NOT_CONNECTED */);
|
|
23623
23627
|
const [connectingWallet, setConnectingWallet] = useState(false);
|
|
23624
23628
|
const [persistSession, setPersistSession] = useState(false);
|
|
23625
23629
|
const [address, setAddress] = useState("");
|
|
23626
23630
|
const [connectedWalletInstance, setConnectedWalletInstance] = useState(INITIAL_STATE.walletInstance);
|
|
23627
23631
|
const [connectedWalletName, setConnectedWalletName] = useState(INITIAL_STATE.walletName);
|
|
23632
|
+
const [web3Services, setWeb3Services] = useState(void 0);
|
|
23633
|
+
const [web3UserData, setWeb3UserData] = useState(
|
|
23634
|
+
void 0
|
|
23635
|
+
);
|
|
23628
23636
|
const connectWallet = useCallback(
|
|
23629
|
-
async (walletName,
|
|
23637
|
+
async (walletName, persist) => {
|
|
23630
23638
|
setConnectingWallet(true);
|
|
23639
|
+
setState("CONNECTING" /* CONNECTING */);
|
|
23631
23640
|
try {
|
|
23641
|
+
const extensions = BrowserWallet.getSupportedExtensions(walletName);
|
|
23632
23642
|
const walletInstance = await BrowserWallet.enable(
|
|
23633
23643
|
walletName,
|
|
23634
23644
|
extensions
|
|
@@ -23642,8 +23652,12 @@ var useWalletStore = () => {
|
|
|
23642
23652
|
JSON.stringify({ walletName })
|
|
23643
23653
|
);
|
|
23644
23654
|
}
|
|
23655
|
+
setState("CONNECTED" /* CONNECTED */);
|
|
23645
23656
|
} catch (error2) {
|
|
23646
23657
|
setError(error2);
|
|
23658
|
+
setState("NOT_CONNECTED" /* NOT_CONNECTED */);
|
|
23659
|
+
setConnectedWalletName(INITIAL_STATE.walletName);
|
|
23660
|
+
setConnectedWalletInstance(INITIAL_STATE.walletInstance);
|
|
23647
23661
|
}
|
|
23648
23662
|
setConnectingWallet(false);
|
|
23649
23663
|
},
|
|
@@ -23652,12 +23666,20 @@ var useWalletStore = () => {
|
|
|
23652
23666
|
const disconnect = useCallback(() => {
|
|
23653
23667
|
setConnectedWalletName(INITIAL_STATE.walletName);
|
|
23654
23668
|
setConnectedWalletInstance(INITIAL_STATE.walletInstance);
|
|
23669
|
+
setState("NOT_CONNECTED" /* NOT_CONNECTED */);
|
|
23655
23670
|
localStorage.removeItem(localstoragePersist);
|
|
23656
23671
|
}, []);
|
|
23657
23672
|
const setWallet = useCallback(
|
|
23658
|
-
async (walletInstance, walletName) => {
|
|
23673
|
+
async (walletInstance, walletName, persist) => {
|
|
23659
23674
|
setConnectedWalletInstance(walletInstance);
|
|
23660
23675
|
setConnectedWalletName(walletName);
|
|
23676
|
+
setState("CONNECTED" /* CONNECTED */);
|
|
23677
|
+
if (persist) {
|
|
23678
|
+
localStorage.setItem(
|
|
23679
|
+
localstoragePersist,
|
|
23680
|
+
JSON.stringify({ walletName, ...persist })
|
|
23681
|
+
);
|
|
23682
|
+
}
|
|
23661
23683
|
},
|
|
23662
23684
|
[]
|
|
23663
23685
|
);
|
|
@@ -23681,7 +23703,23 @@ var useWalletStore = () => {
|
|
|
23681
23703
|
const persist2 = JSON.parse(
|
|
23682
23704
|
localStorage.getItem(localstoragePersist) || ""
|
|
23683
23705
|
);
|
|
23684
|
-
|
|
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
|
+
}
|
|
23685
23723
|
}
|
|
23686
23724
|
}, [persistSession]);
|
|
23687
23725
|
return {
|
|
@@ -23693,8 +23731,12 @@ var useWalletStore = () => {
|
|
|
23693
23731
|
disconnect,
|
|
23694
23732
|
setWallet,
|
|
23695
23733
|
setPersist,
|
|
23734
|
+
setWeb3Services,
|
|
23735
|
+
web3UserData,
|
|
23736
|
+
setWeb3UserData,
|
|
23696
23737
|
error,
|
|
23697
|
-
address
|
|
23738
|
+
address,
|
|
23739
|
+
state
|
|
23698
23740
|
};
|
|
23699
23741
|
};
|
|
23700
23742
|
var WalletContext = createContext({
|
|
@@ -23710,7 +23752,13 @@ var WalletContext = createContext({
|
|
|
23710
23752
|
},
|
|
23711
23753
|
setPersist: () => {
|
|
23712
23754
|
},
|
|
23713
|
-
|
|
23755
|
+
setWeb3Services: () => {
|
|
23756
|
+
},
|
|
23757
|
+
web3UserData: void 0,
|
|
23758
|
+
setWeb3UserData: () => {
|
|
23759
|
+
},
|
|
23760
|
+
address: "",
|
|
23761
|
+
state: "NOT_CONNECTED" /* NOT_CONNECTED */
|
|
23714
23762
|
});
|
|
23715
23763
|
|
|
23716
23764
|
// src/contexts/index.tsx
|
|
@@ -23830,8 +23878,12 @@ var useWallet = () => {
|
|
|
23830
23878
|
disconnect,
|
|
23831
23879
|
setWallet,
|
|
23832
23880
|
setPersist,
|
|
23881
|
+
setWeb3Services,
|
|
23882
|
+
web3UserData,
|
|
23883
|
+
setWeb3UserData,
|
|
23833
23884
|
error,
|
|
23834
|
-
address
|
|
23885
|
+
address,
|
|
23886
|
+
state
|
|
23835
23887
|
} = useContext6(WalletContext);
|
|
23836
23888
|
if (connectWallet === void 0 || disconnect === void 0) {
|
|
23837
23889
|
throw new Error(
|
|
@@ -23847,8 +23899,12 @@ var useWallet = () => {
|
|
|
23847
23899
|
disconnect,
|
|
23848
23900
|
setWallet,
|
|
23849
23901
|
setPersist,
|
|
23902
|
+
setWeb3Services,
|
|
23903
|
+
web3UserData,
|
|
23904
|
+
setWeb3UserData,
|
|
23850
23905
|
error,
|
|
23851
|
-
address
|
|
23906
|
+
address,
|
|
23907
|
+
state
|
|
23852
23908
|
};
|
|
23853
23909
|
};
|
|
23854
23910
|
|
|
@@ -24022,7 +24078,7 @@ DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
|
24022
24078
|
// src/cardano-wallet/connected-button.tsx
|
|
24023
24079
|
import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
24024
24080
|
function ConnectedButton() {
|
|
24025
|
-
const {
|
|
24081
|
+
const { name, disconnect, address } = useWallet();
|
|
24026
24082
|
return /* @__PURE__ */ jsxs3(DropdownMenu, { children: [
|
|
24027
24083
|
/* @__PURE__ */ jsx6(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs3(Button, { variant: "outline", children: [
|
|
24028
24084
|
address.slice(0, 6),
|
|
@@ -24030,6 +24086,7 @@ function ConnectedButton() {
|
|
|
24030
24086
|
address.slice(-6)
|
|
24031
24087
|
] }) }),
|
|
24032
24088
|
/* @__PURE__ */ jsxs3(DropdownMenuContent, { children: [
|
|
24089
|
+
/* @__PURE__ */ jsx6(DropdownMenuLabel, { children: "Wallet" }),
|
|
24033
24090
|
/* @__PURE__ */ jsx6(
|
|
24034
24091
|
DropdownMenuItem,
|
|
24035
24092
|
{
|
|
@@ -24039,6 +24096,16 @@ function ConnectedButton() {
|
|
|
24039
24096
|
children: "Copy Address"
|
|
24040
24097
|
}
|
|
24041
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, {}),
|
|
24042
24109
|
/* @__PURE__ */ jsx6(
|
|
24043
24110
|
DropdownMenuItem,
|
|
24044
24111
|
{
|
|
@@ -24208,7 +24275,6 @@ function IconDownload() {
|
|
|
24208
24275
|
height: "24px",
|
|
24209
24276
|
strokeWidth: "1px"
|
|
24210
24277
|
},
|
|
24211
|
-
className: "hover:mesh-fill-white",
|
|
24212
24278
|
children: [
|
|
24213
24279
|
/* @__PURE__ */ jsx9("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
24214
24280
|
/* @__PURE__ */ jsx9("polyline", { points: "7 10 12 15 17 10" }),
|
|
@@ -24313,7 +24379,8 @@ function WalletIcon({
|
|
|
24313
24379
|
icon,
|
|
24314
24380
|
name,
|
|
24315
24381
|
action,
|
|
24316
|
-
iconReactNode
|
|
24382
|
+
iconReactNode,
|
|
24383
|
+
loading = false
|
|
24317
24384
|
}) {
|
|
24318
24385
|
return /* @__PURE__ */ jsxs9(Tooltip, { delayDuration: 0, defaultOpen: false, children: [
|
|
24319
24386
|
/* @__PURE__ */ jsx13(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs9(
|
|
@@ -24321,9 +24388,11 @@ function WalletIcon({
|
|
|
24321
24388
|
{
|
|
24322
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",
|
|
24323
24390
|
onClick: action,
|
|
24391
|
+
disabled: loading,
|
|
24324
24392
|
children: [
|
|
24325
|
-
icon && /* @__PURE__ */ jsx13("img", { src: icon, alt: name, className: "mesh-w-8 mesh-h-8" }),
|
|
24326
|
-
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: "..." })
|
|
24327
24396
|
]
|
|
24328
24397
|
}
|
|
24329
24398
|
) }),
|
|
@@ -24331,34 +24400,201 @@ function WalletIcon({
|
|
|
24331
24400
|
] });
|
|
24332
24401
|
}
|
|
24333
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
|
+
|
|
24334
24561
|
// src/cardano-wallet/screen-main.tsx
|
|
24335
|
-
import { jsx as
|
|
24562
|
+
import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
24336
24563
|
function ScreenMain({
|
|
24337
24564
|
injectFn,
|
|
24338
|
-
extensions,
|
|
24339
24565
|
setOpen,
|
|
24340
24566
|
setScreen,
|
|
24341
24567
|
persist,
|
|
24342
24568
|
cardanoPeerConnect,
|
|
24343
24569
|
burnerWallet,
|
|
24344
|
-
webauthn
|
|
24570
|
+
webauthn,
|
|
24571
|
+
showDownload,
|
|
24572
|
+
web3Services
|
|
24345
24573
|
}) {
|
|
24346
24574
|
const wallets = useWalletList({ injectFn });
|
|
24347
24575
|
const { connect: connect2 } = useWallet();
|
|
24348
|
-
return /* @__PURE__ */
|
|
24349
|
-
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(
|
|
24350
24578
|
WalletIcon,
|
|
24351
24579
|
{
|
|
24352
24580
|
icon: wallet.icon,
|
|
24353
24581
|
name: wallet.name,
|
|
24354
24582
|
action: () => {
|
|
24355
|
-
connect2(wallet.id,
|
|
24583
|
+
connect2(wallet.id, persist);
|
|
24356
24584
|
setOpen(false);
|
|
24357
24585
|
}
|
|
24358
24586
|
},
|
|
24359
24587
|
index
|
|
24360
24588
|
)),
|
|
24361
|
-
|
|
24589
|
+
web3Services && /* @__PURE__ */ jsx18(
|
|
24590
|
+
Web3Services,
|
|
24591
|
+
{
|
|
24592
|
+
options: web3Services,
|
|
24593
|
+
setOpen,
|
|
24594
|
+
persist
|
|
24595
|
+
}
|
|
24596
|
+
),
|
|
24597
|
+
webauthn && /* @__PURE__ */ jsx18(
|
|
24362
24598
|
WalletIcon,
|
|
24363
24599
|
{
|
|
24364
24600
|
iconReactNode: IconFingerprint(),
|
|
@@ -24368,7 +24604,7 @@ function ScreenMain({
|
|
|
24368
24604
|
}
|
|
24369
24605
|
}
|
|
24370
24606
|
),
|
|
24371
|
-
cardanoPeerConnect && /* @__PURE__ */
|
|
24607
|
+
cardanoPeerConnect && /* @__PURE__ */ jsx18(
|
|
24372
24608
|
WalletIcon,
|
|
24373
24609
|
{
|
|
24374
24610
|
iconReactNode: IconMonitorSmartphone(),
|
|
@@ -24378,7 +24614,7 @@ function ScreenMain({
|
|
|
24378
24614
|
}
|
|
24379
24615
|
}
|
|
24380
24616
|
),
|
|
24381
|
-
burnerWallet && /* @__PURE__ */
|
|
24617
|
+
burnerWallet && /* @__PURE__ */ jsx18(
|
|
24382
24618
|
WalletIcon,
|
|
24383
24619
|
{
|
|
24384
24620
|
iconReactNode: IconBookDashed(),
|
|
@@ -24388,7 +24624,7 @@ function ScreenMain({
|
|
|
24388
24624
|
}
|
|
24389
24625
|
}
|
|
24390
24626
|
),
|
|
24391
|
-
/* @__PURE__ */
|
|
24627
|
+
showDownload && /* @__PURE__ */ jsx18(
|
|
24392
24628
|
WalletIcon,
|
|
24393
24629
|
{
|
|
24394
24630
|
iconReactNode: IconDownload(),
|
|
@@ -24406,16 +24642,16 @@ function ScreenMain({
|
|
|
24406
24642
|
|
|
24407
24643
|
// src/cardano-wallet/screen-p2p.tsx
|
|
24408
24644
|
var import_cardano_peer_connect = __toESM(require_dist(), 1);
|
|
24409
|
-
import { useEffect as useEffect9, useRef as useRef2, useState as
|
|
24410
|
-
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";
|
|
24411
24647
|
function ScreenP2P({
|
|
24412
24648
|
cardanoPeerConnect,
|
|
24413
24649
|
setOpen
|
|
24414
24650
|
}) {
|
|
24415
24651
|
const dAppConnect = useRef2(null);
|
|
24416
24652
|
const qrCodeField = useRef2(null);
|
|
24417
|
-
const [address, setAddress] =
|
|
24418
|
-
const [copied, setCopied] =
|
|
24653
|
+
const [address, setAddress] = useState11("");
|
|
24654
|
+
const [copied, setCopied] = useState11(false);
|
|
24419
24655
|
const { connect: connect2 } = useWallet();
|
|
24420
24656
|
useEffect9(() => {
|
|
24421
24657
|
if (cardanoPeerConnect) {
|
|
@@ -24451,9 +24687,9 @@ function ScreenP2P({
|
|
|
24451
24687
|
}
|
|
24452
24688
|
}
|
|
24453
24689
|
}, []);
|
|
24454
|
-
return /* @__PURE__ */
|
|
24455
|
-
/* @__PURE__ */
|
|
24456
|
-
/* @__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(
|
|
24457
24693
|
Button,
|
|
24458
24694
|
{
|
|
24459
24695
|
variant: "outline",
|
|
@@ -24468,15 +24704,15 @@ function ScreenP2P({
|
|
|
24468
24704
|
}
|
|
24469
24705
|
|
|
24470
24706
|
// src/cardano-wallet/screen-webauthn.tsx
|
|
24471
|
-
import { useState as
|
|
24707
|
+
import { useState as useState12 } from "react";
|
|
24472
24708
|
import { connect, MeshWallet as MeshWallet2 } from "@meshsdk/wallet";
|
|
24473
24709
|
|
|
24474
24710
|
// src/common/input.tsx
|
|
24475
24711
|
import * as React5 from "react";
|
|
24476
|
-
import { jsx as
|
|
24712
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
24477
24713
|
var Input = React5.forwardRef(
|
|
24478
24714
|
({ className, type, ...props }, ref) => {
|
|
24479
|
-
return /* @__PURE__ */
|
|
24715
|
+
return /* @__PURE__ */ jsx20(
|
|
24480
24716
|
"input",
|
|
24481
24717
|
{
|
|
24482
24718
|
type,
|
|
@@ -24496,11 +24732,11 @@ Input.displayName = "Input";
|
|
|
24496
24732
|
import * as React6 from "react";
|
|
24497
24733
|
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
24498
24734
|
import { cva as cva2 } from "class-variance-authority";
|
|
24499
|
-
import { jsx as
|
|
24735
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
24500
24736
|
var labelVariants = cva2(
|
|
24501
24737
|
"mesh-text-sm mesh-font-medium mesh-leading-none peer-disabled:mesh-cursor-not-allowed peer-disabled:mesh-opacity-70"
|
|
24502
24738
|
);
|
|
24503
|
-
var Label2 = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
24739
|
+
var Label2 = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx21(
|
|
24504
24740
|
LabelPrimitive.Root,
|
|
24505
24741
|
{
|
|
24506
24742
|
ref,
|
|
@@ -24511,16 +24747,16 @@ var Label2 = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
24511
24747
|
Label2.displayName = LabelPrimitive.Root.displayName;
|
|
24512
24748
|
|
|
24513
24749
|
// src/cardano-wallet/screen-webauthn.tsx
|
|
24514
|
-
import { Fragment as
|
|
24750
|
+
import { Fragment as Fragment4, jsx as jsx22, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
24515
24751
|
function ScreenWebauthn({
|
|
24516
24752
|
url,
|
|
24517
24753
|
networkId,
|
|
24518
24754
|
provider,
|
|
24519
24755
|
setOpen
|
|
24520
24756
|
}) {
|
|
24521
|
-
const [loading, setLoading] =
|
|
24522
|
-
const [userName, setUserName] =
|
|
24523
|
-
const [password, setPassword] =
|
|
24757
|
+
const [loading, setLoading] = useState12(false);
|
|
24758
|
+
const [userName, setUserName] = useState12("");
|
|
24759
|
+
const [password, setPassword] = useState12("");
|
|
24524
24760
|
const { setWallet } = useWallet();
|
|
24525
24761
|
function createWallet(root) {
|
|
24526
24762
|
setTimeout(() => {
|
|
@@ -24545,10 +24781,10 @@ function ScreenWebauthn({
|
|
|
24545
24781
|
createWallet(res.wallet.bech32PrivateKey);
|
|
24546
24782
|
}
|
|
24547
24783
|
}
|
|
24548
|
-
return /* @__PURE__ */
|
|
24549
|
-
/* @__PURE__ */
|
|
24550
|
-
/* @__PURE__ */
|
|
24551
|
-
/* @__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(
|
|
24552
24788
|
Input,
|
|
24553
24789
|
{
|
|
24554
24790
|
id: "username",
|
|
@@ -24558,11 +24794,11 @@ function ScreenWebauthn({
|
|
|
24558
24794
|
onChange: (e2) => setUserName(e2.target.value)
|
|
24559
24795
|
}
|
|
24560
24796
|
),
|
|
24561
|
-
/* @__PURE__ */
|
|
24797
|
+
/* @__PURE__ */ jsx22("p", { className: "mesh-text-gray-500 mesh-text-xs", children: "Unique to the application you are connecting." })
|
|
24562
24798
|
] }),
|
|
24563
|
-
/* @__PURE__ */
|
|
24564
|
-
/* @__PURE__ */
|
|
24565
|
-
/* @__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(
|
|
24566
24802
|
Input,
|
|
24567
24803
|
{
|
|
24568
24804
|
id: "password",
|
|
@@ -24572,9 +24808,9 @@ function ScreenWebauthn({
|
|
|
24572
24808
|
onChange: (e2) => setPassword(e2.target.value)
|
|
24573
24809
|
}
|
|
24574
24810
|
),
|
|
24575
|
-
/* @__PURE__ */
|
|
24811
|
+
/* @__PURE__ */ jsx22("p", { className: "mesh-text-gray-500 mesh-text-xs", children: "Additional security to derive your wallet." })
|
|
24576
24812
|
] }),
|
|
24577
|
-
/* @__PURE__ */
|
|
24813
|
+
/* @__PURE__ */ jsx22(
|
|
24578
24814
|
Button,
|
|
24579
24815
|
{
|
|
24580
24816
|
className: "mesh-w-full",
|
|
@@ -24587,59 +24823,62 @@ function ScreenWebauthn({
|
|
|
24587
24823
|
}
|
|
24588
24824
|
|
|
24589
24825
|
// src/cardano-wallet/index.tsx
|
|
24590
|
-
import { jsx as
|
|
24826
|
+
import { jsx as jsx23, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
24591
24827
|
var CardanoWallet = ({
|
|
24592
24828
|
label = "Connect Wallet",
|
|
24593
24829
|
onConnected = void 0,
|
|
24594
24830
|
isDark = false,
|
|
24595
24831
|
persist = false,
|
|
24596
|
-
extensions = [],
|
|
24597
24832
|
injectFn = void 0,
|
|
24598
24833
|
cardanoPeerConnect = void 0,
|
|
24599
24834
|
burnerWallet = void 0,
|
|
24600
|
-
webauthn = void 0
|
|
24835
|
+
webauthn = void 0,
|
|
24836
|
+
showDownload = true,
|
|
24837
|
+
web3Services = void 0
|
|
24601
24838
|
}) => {
|
|
24602
|
-
const [open, setOpen] =
|
|
24603
|
-
const [screen, setScreen] =
|
|
24604
|
-
const { wallet, connected, setPersist } = useWallet();
|
|
24839
|
+
const [open, setOpen] = useState13(false);
|
|
24840
|
+
const [screen, setScreen] = useState13("main");
|
|
24841
|
+
const { wallet, connected, setPersist, setWeb3Services } = useWallet();
|
|
24605
24842
|
useEffect10(() => {
|
|
24606
24843
|
setPersist(persist);
|
|
24607
|
-
|
|
24844
|
+
if (web3Services) setWeb3Services(web3Services);
|
|
24845
|
+
}, []);
|
|
24608
24846
|
useEffect10(() => {
|
|
24609
24847
|
if (connected) {
|
|
24610
24848
|
if (onConnected) onConnected();
|
|
24611
24849
|
}
|
|
24612
24850
|
}, [connected, wallet]);
|
|
24613
|
-
return /* @__PURE__ */
|
|
24614
|
-
/* @__PURE__ */
|
|
24615
|
-
/* @__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(
|
|
24616
24854
|
DialogContent,
|
|
24617
24855
|
{
|
|
24618
24856
|
className: "sm:mesh-max-w-[425px] mesh-dark",
|
|
24619
24857
|
onOpenAutoFocus: (event) => event.preventDefault(),
|
|
24620
24858
|
children: [
|
|
24621
|
-
/* @__PURE__ */
|
|
24622
|
-
screen == "main" && /* @__PURE__ */
|
|
24859
|
+
/* @__PURE__ */ jsx23(Header, { screen, setScreen }),
|
|
24860
|
+
screen == "main" && /* @__PURE__ */ jsx23(
|
|
24623
24861
|
ScreenMain,
|
|
24624
24862
|
{
|
|
24625
24863
|
injectFn,
|
|
24626
|
-
extensions,
|
|
24627
24864
|
setOpen,
|
|
24628
24865
|
setScreen,
|
|
24629
24866
|
persist,
|
|
24630
24867
|
cardanoPeerConnect: cardanoPeerConnect != void 0,
|
|
24631
24868
|
burnerWallet: burnerWallet != void 0,
|
|
24632
|
-
webauthn: webauthn != void 0
|
|
24869
|
+
webauthn: webauthn != void 0,
|
|
24870
|
+
showDownload,
|
|
24871
|
+
web3Services
|
|
24633
24872
|
}
|
|
24634
24873
|
),
|
|
24635
|
-
screen == "p2p" && /* @__PURE__ */
|
|
24874
|
+
screen == "p2p" && /* @__PURE__ */ jsx23(
|
|
24636
24875
|
ScreenP2P,
|
|
24637
24876
|
{
|
|
24638
24877
|
cardanoPeerConnect,
|
|
24639
24878
|
setOpen
|
|
24640
24879
|
}
|
|
24641
24880
|
),
|
|
24642
|
-
screen == "burner" && burnerWallet && /* @__PURE__ */
|
|
24881
|
+
screen == "burner" && burnerWallet && /* @__PURE__ */ jsx23(
|
|
24643
24882
|
ScreenBurner,
|
|
24644
24883
|
{
|
|
24645
24884
|
networkId: burnerWallet.networkId,
|
|
@@ -24647,7 +24886,7 @@ var CardanoWallet = ({
|
|
|
24647
24886
|
setOpen
|
|
24648
24887
|
}
|
|
24649
24888
|
),
|
|
24650
|
-
screen == "webauthn" && webauthn && /* @__PURE__ */
|
|
24889
|
+
screen == "webauthn" && webauthn && /* @__PURE__ */ jsx23(
|
|
24651
24890
|
ScreenWebauthn,
|
|
24652
24891
|
{
|
|
24653
24892
|
url: webauthn.url,
|
|
@@ -24656,7 +24895,7 @@ var CardanoWallet = ({
|
|
|
24656
24895
|
setOpen
|
|
24657
24896
|
}
|
|
24658
24897
|
),
|
|
24659
|
-
/* @__PURE__ */
|
|
24898
|
+
/* @__PURE__ */ jsx23(Footer, {})
|
|
24660
24899
|
]
|
|
24661
24900
|
}
|
|
24662
24901
|
)
|
|
@@ -24666,25 +24905,25 @@ function Header({
|
|
|
24666
24905
|
screen,
|
|
24667
24906
|
setScreen
|
|
24668
24907
|
}) {
|
|
24669
|
-
return /* @__PURE__ */
|
|
24670
|
-
/* @__PURE__ */
|
|
24671
|
-
screen != "main" ? /* @__PURE__ */
|
|
24672
|
-
/* @__PURE__ */
|
|
24673
|
-
/* @__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" } })
|
|
24674
24913
|
] }),
|
|
24675
|
-
/* @__PURE__ */
|
|
24914
|
+
/* @__PURE__ */ jsx23(DialogDescription, { children: screens[screen].subtitle && screens[screen].subtitle })
|
|
24676
24915
|
] });
|
|
24677
24916
|
}
|
|
24678
24917
|
function Footer() {
|
|
24679
|
-
return /* @__PURE__ */
|
|
24918
|
+
return /* @__PURE__ */ jsx23(DialogFooter, { className: "mesh-justify-center mesh-text-sm", children: /* @__PURE__ */ jsxs15(
|
|
24680
24919
|
"a",
|
|
24681
24920
|
{
|
|
24682
24921
|
href: "https://meshjs.dev/",
|
|
24683
24922
|
target: "_blank",
|
|
24684
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",
|
|
24685
24924
|
children: [
|
|
24686
|
-
/* @__PURE__ */
|
|
24687
|
-
/* @__PURE__ */
|
|
24925
|
+
/* @__PURE__ */ jsx23("span", { className: "", children: "Powered by" }),
|
|
24926
|
+
/* @__PURE__ */ jsx23(
|
|
24688
24927
|
"svg",
|
|
24689
24928
|
{
|
|
24690
24929
|
width: 24,
|
|
@@ -24692,31 +24931,31 @@ function Footer() {
|
|
|
24692
24931
|
enableBackground: "new 0 0 300 200",
|
|
24693
24932
|
viewBox: "0 0 300 200",
|
|
24694
24933
|
xmlns: "http://www.w3.org/2000/svg",
|
|
24695
|
-
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" })
|
|
24696
24935
|
}
|
|
24697
24936
|
),
|
|
24698
|
-
/* @__PURE__ */
|
|
24937
|
+
/* @__PURE__ */ jsx23("span", { className: "", children: "Mesh SDK" })
|
|
24699
24938
|
]
|
|
24700
24939
|
}
|
|
24701
24940
|
) });
|
|
24702
24941
|
}
|
|
24703
24942
|
|
|
24704
24943
|
// src/mesh-badge/mesh-logo.tsx
|
|
24705
|
-
import { jsx as
|
|
24706
|
-
var MeshLogo = () => /* @__PURE__ */
|
|
24944
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
24945
|
+
var MeshLogo = () => /* @__PURE__ */ jsx24(
|
|
24707
24946
|
"svg",
|
|
24708
24947
|
{
|
|
24709
24948
|
className: "mesh-h-16 mesh-p-2",
|
|
24710
24949
|
fill: "currentColor",
|
|
24711
24950
|
viewBox: "0 0 300 200",
|
|
24712
24951
|
xmlns: "http://www.w3.org/2000/svg",
|
|
24713
|
-
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" })
|
|
24714
24953
|
}
|
|
24715
24954
|
);
|
|
24716
24955
|
|
|
24717
24956
|
// src/mesh-badge/index.tsx
|
|
24718
|
-
import { jsx as
|
|
24719
|
-
var MeshBadge = ({ isDark = false }) => /* @__PURE__ */
|
|
24957
|
+
import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
24958
|
+
var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ jsxs16(
|
|
24720
24959
|
"a",
|
|
24721
24960
|
{
|
|
24722
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`}`,
|
|
@@ -24728,21 +24967,21 @@ var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ jsxs14(
|
|
|
24728
24967
|
rel: "noopener noreferrer",
|
|
24729
24968
|
target: "_blank",
|
|
24730
24969
|
children: [
|
|
24731
|
-
/* @__PURE__ */
|
|
24970
|
+
/* @__PURE__ */ jsx25(MeshLogo, {}),
|
|
24732
24971
|
"Mesh"
|
|
24733
24972
|
]
|
|
24734
24973
|
}
|
|
24735
24974
|
);
|
|
24736
24975
|
|
|
24737
24976
|
// src/stake-button/index.tsx
|
|
24738
|
-
import { useEffect as useEffect12, useState as
|
|
24977
|
+
import { useEffect as useEffect12, useState as useState15 } from "react";
|
|
24739
24978
|
import { Transaction } from "@meshsdk/transaction";
|
|
24740
24979
|
|
|
24741
24980
|
// src/cardano-wallet-dropdown/index.tsx
|
|
24742
|
-
import { useEffect as useEffect11, useState as
|
|
24981
|
+
import { useEffect as useEffect11, useState as useState14 } from "react";
|
|
24743
24982
|
|
|
24744
24983
|
// src/common/button-dropdown.tsx
|
|
24745
|
-
import { jsx as
|
|
24984
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
24746
24985
|
function ButtonDropdown({
|
|
24747
24986
|
children,
|
|
24748
24987
|
isDarkMode = false,
|
|
@@ -24751,7 +24990,7 @@ function ButtonDropdown({
|
|
|
24751
24990
|
onMouseEnter,
|
|
24752
24991
|
onMouseLeave
|
|
24753
24992
|
}) {
|
|
24754
|
-
return /* @__PURE__ */
|
|
24993
|
+
return /* @__PURE__ */ jsx26(
|
|
24755
24994
|
"button",
|
|
24756
24995
|
{
|
|
24757
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`}`,
|
|
@@ -24764,21 +25003,21 @@ function ButtonDropdown({
|
|
|
24764
25003
|
}
|
|
24765
25004
|
|
|
24766
25005
|
// src/cardano-wallet-dropdown/menu-item.tsx
|
|
24767
|
-
import { jsx as
|
|
25006
|
+
import { jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
24768
25007
|
function MenuItem({
|
|
24769
25008
|
icon,
|
|
24770
25009
|
label,
|
|
24771
25010
|
action,
|
|
24772
25011
|
active
|
|
24773
25012
|
}) {
|
|
24774
|
-
return /* @__PURE__ */
|
|
25013
|
+
return /* @__PURE__ */ jsxs17(
|
|
24775
25014
|
"div",
|
|
24776
25015
|
{
|
|
24777
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",
|
|
24778
25017
|
onClick: action,
|
|
24779
25018
|
children: [
|
|
24780
|
-
icon && /* @__PURE__ */
|
|
24781
|
-
/* @__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) => {
|
|
24782
25021
|
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
24783
25022
|
}).join(" ") })
|
|
24784
25023
|
]
|
|
@@ -24787,8 +25026,8 @@ function MenuItem({
|
|
|
24787
25026
|
}
|
|
24788
25027
|
|
|
24789
25028
|
// src/cardano-wallet-dropdown/chevron-down.tsx
|
|
24790
|
-
import { jsx as
|
|
24791
|
-
var ChevronDown = () => /* @__PURE__ */
|
|
25029
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
25030
|
+
var ChevronDown = () => /* @__PURE__ */ jsx28(
|
|
24792
25031
|
"svg",
|
|
24793
25032
|
{
|
|
24794
25033
|
className: "mesh-m-2 mesh-h-6",
|
|
@@ -24797,7 +25036,7 @@ var ChevronDown = () => /* @__PURE__ */ jsx24(
|
|
|
24797
25036
|
viewBox: "0 0 24 24",
|
|
24798
25037
|
stroke: "currentColor",
|
|
24799
25038
|
xmlns: "http://www.w3.org/2000/svg",
|
|
24800
|
-
children: /* @__PURE__ */
|
|
25039
|
+
children: /* @__PURE__ */ jsx28(
|
|
24801
25040
|
"path",
|
|
24802
25041
|
{
|
|
24803
25042
|
strokeLinecap: "round",
|
|
@@ -24810,7 +25049,7 @@ var ChevronDown = () => /* @__PURE__ */ jsx24(
|
|
|
24810
25049
|
);
|
|
24811
25050
|
|
|
24812
25051
|
// src/cardano-wallet-dropdown/wallet-balance.tsx
|
|
24813
|
-
import { Fragment as
|
|
25052
|
+
import { Fragment as Fragment5, jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
24814
25053
|
var WalletBalance = ({
|
|
24815
25054
|
connected,
|
|
24816
25055
|
connecting,
|
|
@@ -24818,22 +25057,22 @@ var WalletBalance = ({
|
|
|
24818
25057
|
wallet
|
|
24819
25058
|
}) => {
|
|
24820
25059
|
const lovelace = useLovelace();
|
|
24821
|
-
return connected && lovelace && wallet?.icon ? /* @__PURE__ */
|
|
24822
|
-
/* @__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 }),
|
|
24823
25062
|
"\u20B3",
|
|
24824
25063
|
" ",
|
|
24825
25064
|
parseInt((parseInt(lovelace, 10) / 1e6).toString(), 10),
|
|
24826
25065
|
".",
|
|
24827
|
-
/* @__PURE__ */
|
|
24828
|
-
] }) : 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: [
|
|
24829
25068
|
label,
|
|
24830
25069
|
" ",
|
|
24831
|
-
/* @__PURE__ */
|
|
25070
|
+
/* @__PURE__ */ jsx29(ChevronDown, {})
|
|
24832
25071
|
] });
|
|
24833
25072
|
};
|
|
24834
25073
|
|
|
24835
25074
|
// src/cardano-wallet-dropdown/index.tsx
|
|
24836
|
-
import { Fragment as
|
|
25075
|
+
import { Fragment as Fragment6, jsx as jsx30, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
24837
25076
|
var CardanoWallet2 = ({
|
|
24838
25077
|
label = "Connect Wallet",
|
|
24839
25078
|
onConnected = void 0,
|
|
@@ -24841,8 +25080,8 @@ var CardanoWallet2 = ({
|
|
|
24841
25080
|
extensions = [],
|
|
24842
25081
|
cardanoPeerConnect = void 0
|
|
24843
25082
|
}) => {
|
|
24844
|
-
const [isDarkMode, setIsDarkMode] =
|
|
24845
|
-
const [hideMenuList, setHideMenuList] =
|
|
25083
|
+
const [isDarkMode, setIsDarkMode] = useState14(false);
|
|
25084
|
+
const [hideMenuList, setHideMenuList] = useState14(true);
|
|
24846
25085
|
const { connect: connect2, connecting, connected, disconnect, name } = useWallet();
|
|
24847
25086
|
const wallets = useWalletList();
|
|
24848
25087
|
useEffect11(() => {
|
|
@@ -24853,20 +25092,20 @@ var CardanoWallet2 = ({
|
|
|
24853
25092
|
useEffect11(() => {
|
|
24854
25093
|
setIsDarkMode(isDark);
|
|
24855
25094
|
}, [isDark]);
|
|
24856
|
-
return /* @__PURE__ */
|
|
25095
|
+
return /* @__PURE__ */ jsxs19(
|
|
24857
25096
|
"div",
|
|
24858
25097
|
{
|
|
24859
25098
|
onMouseEnter: () => setHideMenuList(false),
|
|
24860
25099
|
onMouseLeave: () => setHideMenuList(true),
|
|
24861
25100
|
style: { width: "min-content", zIndex: 50 },
|
|
24862
25101
|
children: [
|
|
24863
|
-
/* @__PURE__ */
|
|
25102
|
+
/* @__PURE__ */ jsx30(
|
|
24864
25103
|
ButtonDropdown,
|
|
24865
25104
|
{
|
|
24866
25105
|
isDarkMode,
|
|
24867
25106
|
hideMenuList,
|
|
24868
25107
|
setHideMenuList,
|
|
24869
|
-
children: /* @__PURE__ */
|
|
25108
|
+
children: /* @__PURE__ */ jsx30(
|
|
24870
25109
|
WalletBalance,
|
|
24871
25110
|
{
|
|
24872
25111
|
connected,
|
|
@@ -24877,12 +25116,12 @@ var CardanoWallet2 = ({
|
|
|
24877
25116
|
)
|
|
24878
25117
|
}
|
|
24879
25118
|
),
|
|
24880
|
-
/* @__PURE__ */
|
|
25119
|
+
/* @__PURE__ */ jsx30(
|
|
24881
25120
|
"div",
|
|
24882
25121
|
{
|
|
24883
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`}`,
|
|
24884
25123
|
style: { zIndex: 50 },
|
|
24885
|
-
children: !connected && wallets.length > 0 ? /* @__PURE__ */
|
|
25124
|
+
children: !connected && wallets.length > 0 ? /* @__PURE__ */ jsx30(Fragment6, { children: wallets.map((wallet, index) => /* @__PURE__ */ jsx30(
|
|
24886
25125
|
MenuItem,
|
|
24887
25126
|
{
|
|
24888
25127
|
icon: wallet.icon,
|
|
@@ -24894,7 +25133,7 @@ var CardanoWallet2 = ({
|
|
|
24894
25133
|
active: name === wallet.id
|
|
24895
25134
|
},
|
|
24896
25135
|
index
|
|
24897
|
-
)) }) : wallets.length === 0 ? /* @__PURE__ */
|
|
25136
|
+
)) }) : wallets.length === 0 ? /* @__PURE__ */ jsx30("span", { children: "No Wallet Found" }) : /* @__PURE__ */ jsx30(Fragment6, { children: /* @__PURE__ */ jsx30(
|
|
24898
25137
|
MenuItem,
|
|
24899
25138
|
{
|
|
24900
25139
|
active: false,
|
|
@@ -24911,7 +25150,7 @@ var CardanoWallet2 = ({
|
|
|
24911
25150
|
};
|
|
24912
25151
|
|
|
24913
25152
|
// src/stake-button/index.tsx
|
|
24914
|
-
import { Fragment as
|
|
25153
|
+
import { Fragment as Fragment7, jsx as jsx31 } from "react/jsx-runtime";
|
|
24915
25154
|
var StakeButton = ({
|
|
24916
25155
|
label = "Stake your ADA",
|
|
24917
25156
|
isDark = false,
|
|
@@ -24919,19 +25158,19 @@ var StakeButton = ({
|
|
|
24919
25158
|
onCheck,
|
|
24920
25159
|
onDelegated = void 0
|
|
24921
25160
|
}) => {
|
|
24922
|
-
const [isDarkMode, setIsDarkMode] =
|
|
25161
|
+
const [isDarkMode, setIsDarkMode] = useState15(false);
|
|
24923
25162
|
const { connected } = useWallet();
|
|
24924
25163
|
useEffect12(() => {
|
|
24925
25164
|
setIsDarkMode(isDark);
|
|
24926
25165
|
}, [isDark]);
|
|
24927
|
-
return /* @__PURE__ */
|
|
25166
|
+
return /* @__PURE__ */ jsx31(Fragment7, { children: connected ? /* @__PURE__ */ jsx31(ButtonDropdown, { isDarkMode, children: /* @__PURE__ */ jsx31(
|
|
24928
25167
|
Delegate,
|
|
24929
25168
|
{
|
|
24930
25169
|
poolId,
|
|
24931
25170
|
onCheck,
|
|
24932
25171
|
onDelegated
|
|
24933
25172
|
}
|
|
24934
|
-
) }) : /* @__PURE__ */
|
|
25173
|
+
) }) : /* @__PURE__ */ jsx31(CardanoWallet2, { label, isDark }) });
|
|
24935
25174
|
};
|
|
24936
25175
|
var Delegate = ({
|
|
24937
25176
|
poolId,
|
|
@@ -24940,11 +25179,11 @@ var Delegate = ({
|
|
|
24940
25179
|
}) => {
|
|
24941
25180
|
const { wallet } = useWallet();
|
|
24942
25181
|
const rewardAddress = useRewardAddress();
|
|
24943
|
-
const [_, setError] =
|
|
24944
|
-
const [checking, setChecking] =
|
|
24945
|
-
const [accountInfo, setAccountInfo] =
|
|
24946
|
-
const [processing, setProcessing] =
|
|
24947
|
-
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);
|
|
24948
25187
|
const checkAccountStatus = async () => {
|
|
24949
25188
|
try {
|
|
24950
25189
|
setChecking(true);
|
|
@@ -24999,18 +25238,18 @@ var Delegate = ({
|
|
|
24999
25238
|
checkAccountStatus();
|
|
25000
25239
|
}, [rewardAddress]);
|
|
25001
25240
|
if (checking) {
|
|
25002
|
-
return /* @__PURE__ */
|
|
25241
|
+
return /* @__PURE__ */ jsx31("span", { children: "Checking..." });
|
|
25003
25242
|
}
|
|
25004
25243
|
if (processing) {
|
|
25005
|
-
return /* @__PURE__ */
|
|
25244
|
+
return /* @__PURE__ */ jsx31("span", { children: "Loading..." });
|
|
25006
25245
|
}
|
|
25007
25246
|
if (done) {
|
|
25008
|
-
return /* @__PURE__ */
|
|
25247
|
+
return /* @__PURE__ */ jsx31("span", { children: "Stake Delegated" });
|
|
25009
25248
|
}
|
|
25010
25249
|
if (accountInfo?.active) {
|
|
25011
|
-
return accountInfo.poolId === poolId ? /* @__PURE__ */
|
|
25250
|
+
return accountInfo.poolId === poolId ? /* @__PURE__ */ jsx31("span", { children: "Stake Delegated" }) : /* @__PURE__ */ jsx31("span", { onClick: delegateStake, children: "Begin Staking" });
|
|
25012
25251
|
}
|
|
25013
|
-
return /* @__PURE__ */
|
|
25252
|
+
return /* @__PURE__ */ jsx31("span", { onClick: registerAddress, children: "Begin Staking" });
|
|
25014
25253
|
};
|
|
25015
25254
|
export {
|
|
25016
25255
|
CardanoWallet,
|