@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.cjs
CHANGED
|
@@ -23457,7 +23457,7 @@ __export(index_exports, {
|
|
|
23457
23457
|
module.exports = __toCommonJS(index_exports);
|
|
23458
23458
|
|
|
23459
23459
|
// src/cardano-wallet/index.tsx
|
|
23460
|
-
var
|
|
23460
|
+
var import_react14 = require("react");
|
|
23461
23461
|
|
|
23462
23462
|
// src/common/button.tsx
|
|
23463
23463
|
var React = __toESM(require("react"), 1);
|
|
@@ -23638,22 +23638,30 @@ var import_react2 = require("react");
|
|
|
23638
23638
|
// src/contexts/WalletContext.ts
|
|
23639
23639
|
var import_react = require("react");
|
|
23640
23640
|
var import_wallet = require("@meshsdk/wallet");
|
|
23641
|
+
var import_web3_sdk = require("@meshsdk/web3-sdk");
|
|
23641
23642
|
var INITIAL_STATE = {
|
|
23642
23643
|
walletName: void 0,
|
|
23643
23644
|
walletInstance: {}
|
|
23644
23645
|
};
|
|
23645
|
-
var localstoragePersist = "mesh-persist";
|
|
23646
|
+
var localstoragePersist = "mesh-wallet-persist";
|
|
23646
23647
|
var useWalletStore = () => {
|
|
23647
23648
|
const [error, setError] = (0, import_react.useState)(void 0);
|
|
23649
|
+
const [state, setState] = (0, import_react.useState)("NOT_CONNECTED" /* NOT_CONNECTED */);
|
|
23648
23650
|
const [connectingWallet, setConnectingWallet] = (0, import_react.useState)(false);
|
|
23649
23651
|
const [persistSession, setPersistSession] = (0, import_react.useState)(false);
|
|
23650
23652
|
const [address, setAddress] = (0, import_react.useState)("");
|
|
23651
23653
|
const [connectedWalletInstance, setConnectedWalletInstance] = (0, import_react.useState)(INITIAL_STATE.walletInstance);
|
|
23652
23654
|
const [connectedWalletName, setConnectedWalletName] = (0, import_react.useState)(INITIAL_STATE.walletName);
|
|
23655
|
+
const [web3Services, setWeb3Services] = (0, import_react.useState)(void 0);
|
|
23656
|
+
const [web3UserData, setWeb3UserData] = (0, import_react.useState)(
|
|
23657
|
+
void 0
|
|
23658
|
+
);
|
|
23653
23659
|
const connectWallet = (0, import_react.useCallback)(
|
|
23654
|
-
async (walletName,
|
|
23660
|
+
async (walletName, persist) => {
|
|
23655
23661
|
setConnectingWallet(true);
|
|
23662
|
+
setState("CONNECTING" /* CONNECTING */);
|
|
23656
23663
|
try {
|
|
23664
|
+
const extensions = import_wallet.BrowserWallet.getSupportedExtensions(walletName);
|
|
23657
23665
|
const walletInstance = await import_wallet.BrowserWallet.enable(
|
|
23658
23666
|
walletName,
|
|
23659
23667
|
extensions
|
|
@@ -23667,8 +23675,12 @@ var useWalletStore = () => {
|
|
|
23667
23675
|
JSON.stringify({ walletName })
|
|
23668
23676
|
);
|
|
23669
23677
|
}
|
|
23678
|
+
setState("CONNECTED" /* CONNECTED */);
|
|
23670
23679
|
} catch (error2) {
|
|
23671
23680
|
setError(error2);
|
|
23681
|
+
setState("NOT_CONNECTED" /* NOT_CONNECTED */);
|
|
23682
|
+
setConnectedWalletName(INITIAL_STATE.walletName);
|
|
23683
|
+
setConnectedWalletInstance(INITIAL_STATE.walletInstance);
|
|
23672
23684
|
}
|
|
23673
23685
|
setConnectingWallet(false);
|
|
23674
23686
|
},
|
|
@@ -23677,12 +23689,20 @@ var useWalletStore = () => {
|
|
|
23677
23689
|
const disconnect = (0, import_react.useCallback)(() => {
|
|
23678
23690
|
setConnectedWalletName(INITIAL_STATE.walletName);
|
|
23679
23691
|
setConnectedWalletInstance(INITIAL_STATE.walletInstance);
|
|
23692
|
+
setState("NOT_CONNECTED" /* NOT_CONNECTED */);
|
|
23680
23693
|
localStorage.removeItem(localstoragePersist);
|
|
23681
23694
|
}, []);
|
|
23682
23695
|
const setWallet = (0, import_react.useCallback)(
|
|
23683
|
-
async (walletInstance, walletName) => {
|
|
23696
|
+
async (walletInstance, walletName, persist) => {
|
|
23684
23697
|
setConnectedWalletInstance(walletInstance);
|
|
23685
23698
|
setConnectedWalletName(walletName);
|
|
23699
|
+
setState("CONNECTED" /* CONNECTED */);
|
|
23700
|
+
if (persist) {
|
|
23701
|
+
localStorage.setItem(
|
|
23702
|
+
localstoragePersist,
|
|
23703
|
+
JSON.stringify({ walletName, ...persist })
|
|
23704
|
+
);
|
|
23705
|
+
}
|
|
23686
23706
|
},
|
|
23687
23707
|
[]
|
|
23688
23708
|
);
|
|
@@ -23706,7 +23726,23 @@ var useWalletStore = () => {
|
|
|
23706
23726
|
const persist2 = JSON.parse(
|
|
23707
23727
|
localStorage.getItem(localstoragePersist) || ""
|
|
23708
23728
|
);
|
|
23709
|
-
|
|
23729
|
+
if (persist2.walletName == "Mesh Web3 Services" && web3Services) {
|
|
23730
|
+
import_web3_sdk.Web3Wallet.initWallet({
|
|
23731
|
+
networkId: web3Services.networkId,
|
|
23732
|
+
address: persist2.walletAddress,
|
|
23733
|
+
fetcher: web3Services.fetcher,
|
|
23734
|
+
submitter: web3Services.submitter,
|
|
23735
|
+
projectId: web3Services.projectId,
|
|
23736
|
+
appUrl: web3Services.appUrl
|
|
23737
|
+
}).then((wallet) => {
|
|
23738
|
+
setConnectedWalletInstance(wallet);
|
|
23739
|
+
setConnectedWalletName(persist2.walletName);
|
|
23740
|
+
setState("CONNECTED" /* CONNECTED */);
|
|
23741
|
+
});
|
|
23742
|
+
setWeb3UserData(persist2.user);
|
|
23743
|
+
} else {
|
|
23744
|
+
connectWallet(persist2.walletName);
|
|
23745
|
+
}
|
|
23710
23746
|
}
|
|
23711
23747
|
}, [persistSession]);
|
|
23712
23748
|
return {
|
|
@@ -23718,8 +23754,12 @@ var useWalletStore = () => {
|
|
|
23718
23754
|
disconnect,
|
|
23719
23755
|
setWallet,
|
|
23720
23756
|
setPersist,
|
|
23757
|
+
setWeb3Services,
|
|
23758
|
+
web3UserData,
|
|
23759
|
+
setWeb3UserData,
|
|
23721
23760
|
error,
|
|
23722
|
-
address
|
|
23761
|
+
address,
|
|
23762
|
+
state
|
|
23723
23763
|
};
|
|
23724
23764
|
};
|
|
23725
23765
|
var WalletContext = (0, import_react.createContext)({
|
|
@@ -23735,7 +23775,13 @@ var WalletContext = (0, import_react.createContext)({
|
|
|
23735
23775
|
},
|
|
23736
23776
|
setPersist: () => {
|
|
23737
23777
|
},
|
|
23738
|
-
|
|
23778
|
+
setWeb3Services: () => {
|
|
23779
|
+
},
|
|
23780
|
+
web3UserData: void 0,
|
|
23781
|
+
setWeb3UserData: () => {
|
|
23782
|
+
},
|
|
23783
|
+
address: "",
|
|
23784
|
+
state: "NOT_CONNECTED" /* NOT_CONNECTED */
|
|
23739
23785
|
});
|
|
23740
23786
|
|
|
23741
23787
|
// src/contexts/index.tsx
|
|
@@ -23855,8 +23901,12 @@ var useWallet = () => {
|
|
|
23855
23901
|
disconnect,
|
|
23856
23902
|
setWallet,
|
|
23857
23903
|
setPersist,
|
|
23904
|
+
setWeb3Services,
|
|
23905
|
+
web3UserData,
|
|
23906
|
+
setWeb3UserData,
|
|
23858
23907
|
error,
|
|
23859
|
-
address
|
|
23908
|
+
address,
|
|
23909
|
+
state
|
|
23860
23910
|
} = (0, import_react8.useContext)(WalletContext);
|
|
23861
23911
|
if (connectWallet === void 0 || disconnect === void 0) {
|
|
23862
23912
|
throw new Error(
|
|
@@ -23872,8 +23922,12 @@ var useWallet = () => {
|
|
|
23872
23922
|
disconnect,
|
|
23873
23923
|
setWallet,
|
|
23874
23924
|
setPersist,
|
|
23925
|
+
setWeb3Services,
|
|
23926
|
+
web3UserData,
|
|
23927
|
+
setWeb3UserData,
|
|
23875
23928
|
error,
|
|
23876
|
-
address
|
|
23929
|
+
address,
|
|
23930
|
+
state
|
|
23877
23931
|
};
|
|
23878
23932
|
};
|
|
23879
23933
|
|
|
@@ -24043,7 +24097,7 @@ DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
|
24043
24097
|
// src/cardano-wallet/connected-button.tsx
|
|
24044
24098
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
24045
24099
|
function ConnectedButton() {
|
|
24046
|
-
const {
|
|
24100
|
+
const { name, disconnect, address } = useWallet();
|
|
24047
24101
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(DropdownMenu, { children: [
|
|
24048
24102
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Button, { variant: "outline", children: [
|
|
24049
24103
|
address.slice(0, 6),
|
|
@@ -24051,6 +24105,7 @@ function ConnectedButton() {
|
|
|
24051
24105
|
address.slice(-6)
|
|
24052
24106
|
] }) }),
|
|
24053
24107
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(DropdownMenuContent, { children: [
|
|
24108
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownMenuLabel, { children: "Wallet" }),
|
|
24054
24109
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
24055
24110
|
DropdownMenuItem,
|
|
24056
24111
|
{
|
|
@@ -24060,6 +24115,16 @@ function ConnectedButton() {
|
|
|
24060
24115
|
children: "Copy Address"
|
|
24061
24116
|
}
|
|
24062
24117
|
),
|
|
24118
|
+
name == "Mesh Web3 Services" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
24119
|
+
DropdownMenuItem,
|
|
24120
|
+
{
|
|
24121
|
+
onClick: () => {
|
|
24122
|
+
window.open("https://web3.meshjs.dev/dashboard", "_blank");
|
|
24123
|
+
},
|
|
24124
|
+
children: "Open Web3 Wallet"
|
|
24125
|
+
}
|
|
24126
|
+
),
|
|
24127
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownMenuSeparator, {}),
|
|
24063
24128
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
24064
24129
|
DropdownMenuItem,
|
|
24065
24130
|
{
|
|
@@ -24229,7 +24294,6 @@ function IconDownload() {
|
|
|
24229
24294
|
height: "24px",
|
|
24230
24295
|
strokeWidth: "1px"
|
|
24231
24296
|
},
|
|
24232
|
-
className: "hover:mesh-fill-white",
|
|
24233
24297
|
children: [
|
|
24234
24298
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
24235
24299
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("polyline", { points: "7 10 12 15 17 10" }),
|
|
@@ -24334,7 +24398,8 @@ function WalletIcon({
|
|
|
24334
24398
|
icon,
|
|
24335
24399
|
name,
|
|
24336
24400
|
action,
|
|
24337
|
-
iconReactNode
|
|
24401
|
+
iconReactNode,
|
|
24402
|
+
loading = false
|
|
24338
24403
|
}) {
|
|
24339
24404
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Tooltip, { delayDuration: 0, defaultOpen: false, children: [
|
|
24340
24405
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
@@ -24342,9 +24407,11 @@ function WalletIcon({
|
|
|
24342
24407
|
{
|
|
24343
24408
|
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",
|
|
24344
24409
|
onClick: action,
|
|
24410
|
+
disabled: loading,
|
|
24345
24411
|
children: [
|
|
24346
|
-
icon && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("img", { src: icon, alt: name, className: "mesh-w-8 mesh-h-8" }),
|
|
24347
|
-
iconReactNode && iconReactNode
|
|
24412
|
+
icon && !loading && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("img", { src: icon, alt: name, className: "mesh-w-8 mesh-h-8" }),
|
|
24413
|
+
!loading && iconReactNode && iconReactNode,
|
|
24414
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-black", children: "..." })
|
|
24348
24415
|
]
|
|
24349
24416
|
}
|
|
24350
24417
|
) }),
|
|
@@ -24352,34 +24419,199 @@ function WalletIcon({
|
|
|
24352
24419
|
] });
|
|
24353
24420
|
}
|
|
24354
24421
|
|
|
24355
|
-
// src/cardano-wallet/
|
|
24422
|
+
// src/cardano-wallet/web3-services.tsx
|
|
24423
|
+
var import_react11 = require("react");
|
|
24424
|
+
var import_web3_sdk2 = require("@meshsdk/web3-sdk");
|
|
24425
|
+
|
|
24426
|
+
// src/common/icons/icon-discord.tsx
|
|
24356
24427
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
24428
|
+
function IconDiscord() {
|
|
24429
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
24430
|
+
"svg",
|
|
24431
|
+
{
|
|
24432
|
+
viewBox: "0 0 20 20",
|
|
24433
|
+
"aria-hidden": "true",
|
|
24434
|
+
style: {
|
|
24435
|
+
width: "24px",
|
|
24436
|
+
height: "24px"
|
|
24437
|
+
},
|
|
24438
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
24439
|
+
"path",
|
|
24440
|
+
{
|
|
24441
|
+
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",
|
|
24442
|
+
fill: "#5865F2"
|
|
24443
|
+
}
|
|
24444
|
+
)
|
|
24445
|
+
}
|
|
24446
|
+
);
|
|
24447
|
+
}
|
|
24448
|
+
|
|
24449
|
+
// src/common/icons/icon-google.tsx
|
|
24450
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
24451
|
+
function IconGoogle() {
|
|
24452
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
24453
|
+
"svg",
|
|
24454
|
+
{
|
|
24455
|
+
viewBox: "0 0 262 262",
|
|
24456
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
24457
|
+
preserveAspectRatio: "xMidYMid",
|
|
24458
|
+
style: {
|
|
24459
|
+
width: "24px",
|
|
24460
|
+
height: "24px"
|
|
24461
|
+
},
|
|
24462
|
+
children: [
|
|
24463
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
24464
|
+
"path",
|
|
24465
|
+
{
|
|
24466
|
+
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",
|
|
24467
|
+
fill: "#4285F4"
|
|
24468
|
+
}
|
|
24469
|
+
),
|
|
24470
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
24471
|
+
"path",
|
|
24472
|
+
{
|
|
24473
|
+
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",
|
|
24474
|
+
fill: "#34A853"
|
|
24475
|
+
}
|
|
24476
|
+
),
|
|
24477
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
24478
|
+
"path",
|
|
24479
|
+
{
|
|
24480
|
+
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",
|
|
24481
|
+
fill: "#FBBC05"
|
|
24482
|
+
}
|
|
24483
|
+
),
|
|
24484
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
24485
|
+
"path",
|
|
24486
|
+
{
|
|
24487
|
+
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",
|
|
24488
|
+
fill: "#EB4335"
|
|
24489
|
+
}
|
|
24490
|
+
)
|
|
24491
|
+
]
|
|
24492
|
+
}
|
|
24493
|
+
);
|
|
24494
|
+
}
|
|
24495
|
+
|
|
24496
|
+
// src/common/icons/icon-twitter.tsx
|
|
24497
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
24498
|
+
function IconTwitter() {
|
|
24499
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
24500
|
+
"svg",
|
|
24501
|
+
{
|
|
24502
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
24503
|
+
version: "1.1",
|
|
24504
|
+
viewBox: "0 0 24 24",
|
|
24505
|
+
style: {
|
|
24506
|
+
width: "24px",
|
|
24507
|
+
height: "24px"
|
|
24508
|
+
},
|
|
24509
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M14.095479,10.316482L22.286354,1h-1.940718l-7.115352,8.087682L7.551414,1H1l8.589488,12.231093L1,23h1.940717 l7.509372-8.542861L16.448587,23H23L14.095479,10.316482z M11.436522,13.338465l-0.871624-1.218704l-6.924311-9.68815h2.981339 l5.58978,7.82155l0.867949,1.218704l7.26506,10.166271h-2.981339L11.436522,13.338465z" })
|
|
24510
|
+
}
|
|
24511
|
+
);
|
|
24512
|
+
}
|
|
24513
|
+
|
|
24514
|
+
// src/cardano-wallet/web3-services.tsx
|
|
24515
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
24516
|
+
function Web3Services({
|
|
24517
|
+
options,
|
|
24518
|
+
setOpen,
|
|
24519
|
+
persist
|
|
24520
|
+
}) {
|
|
24521
|
+
const { setWallet, setWeb3UserData } = useWallet();
|
|
24522
|
+
const [loading, setLoading] = (0, import_react11.useState)(false);
|
|
24523
|
+
async function loadWallet(directTo) {
|
|
24524
|
+
setLoading(true);
|
|
24525
|
+
const _options = {
|
|
24526
|
+
networkId: 0,
|
|
24527
|
+
fetcher: options.fetcher,
|
|
24528
|
+
submitter: options.submitter,
|
|
24529
|
+
appUrl: options.appUrl,
|
|
24530
|
+
projectId: options.projectId,
|
|
24531
|
+
directTo
|
|
24532
|
+
};
|
|
24533
|
+
const wallet = await import_web3_sdk2.Web3Wallet.enable(_options);
|
|
24534
|
+
const user = wallet.getUser();
|
|
24535
|
+
setWeb3UserData(user);
|
|
24536
|
+
setWallet(
|
|
24537
|
+
wallet,
|
|
24538
|
+
"Mesh Web3 Services",
|
|
24539
|
+
persist ? {
|
|
24540
|
+
walletAddress: await wallet.getChangeAddress(),
|
|
24541
|
+
user
|
|
24542
|
+
} : void 0
|
|
24543
|
+
);
|
|
24544
|
+
setLoading(false);
|
|
24545
|
+
setOpen(false);
|
|
24546
|
+
}
|
|
24547
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
24548
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
24549
|
+
WalletIcon,
|
|
24550
|
+
{
|
|
24551
|
+
iconReactNode: IconGoogle(),
|
|
24552
|
+
name: `Google`,
|
|
24553
|
+
action: () => loadWallet("google"),
|
|
24554
|
+
loading
|
|
24555
|
+
}
|
|
24556
|
+
),
|
|
24557
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
24558
|
+
WalletIcon,
|
|
24559
|
+
{
|
|
24560
|
+
iconReactNode: IconDiscord(),
|
|
24561
|
+
name: `Discord`,
|
|
24562
|
+
action: () => loadWallet("discord"),
|
|
24563
|
+
loading
|
|
24564
|
+
}
|
|
24565
|
+
),
|
|
24566
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
24567
|
+
WalletIcon,
|
|
24568
|
+
{
|
|
24569
|
+
iconReactNode: IconTwitter(),
|
|
24570
|
+
name: `Twitter`,
|
|
24571
|
+
action: () => loadWallet("twitter"),
|
|
24572
|
+
loading
|
|
24573
|
+
}
|
|
24574
|
+
)
|
|
24575
|
+
] });
|
|
24576
|
+
}
|
|
24577
|
+
|
|
24578
|
+
// src/cardano-wallet/screen-main.tsx
|
|
24579
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
24357
24580
|
function ScreenMain({
|
|
24358
24581
|
injectFn,
|
|
24359
|
-
extensions,
|
|
24360
24582
|
setOpen,
|
|
24361
24583
|
setScreen,
|
|
24362
24584
|
persist,
|
|
24363
24585
|
cardanoPeerConnect,
|
|
24364
24586
|
burnerWallet,
|
|
24365
|
-
webauthn
|
|
24587
|
+
webauthn,
|
|
24588
|
+
showDownload,
|
|
24589
|
+
web3Services
|
|
24366
24590
|
}) {
|
|
24367
24591
|
const wallets = useWalletList({ injectFn });
|
|
24368
24592
|
const { connect: connect2 } = useWallet();
|
|
24369
|
-
return /* @__PURE__ */ (0,
|
|
24370
|
-
wallets.map((wallet, index) => /* @__PURE__ */ (0,
|
|
24593
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "mesh-grid mesh-gap-4 mesh-py-4 mesh-grid-cols-5 mesh-place-items-center mesh-gap-y-8", children: [
|
|
24594
|
+
wallets.map((wallet, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
24371
24595
|
WalletIcon,
|
|
24372
24596
|
{
|
|
24373
24597
|
icon: wallet.icon,
|
|
24374
24598
|
name: wallet.name,
|
|
24375
24599
|
action: () => {
|
|
24376
|
-
connect2(wallet.id,
|
|
24600
|
+
connect2(wallet.id, persist);
|
|
24377
24601
|
setOpen(false);
|
|
24378
24602
|
}
|
|
24379
24603
|
},
|
|
24380
24604
|
index
|
|
24381
24605
|
)),
|
|
24382
|
-
|
|
24606
|
+
web3Services && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
24607
|
+
Web3Services,
|
|
24608
|
+
{
|
|
24609
|
+
options: web3Services,
|
|
24610
|
+
setOpen,
|
|
24611
|
+
persist
|
|
24612
|
+
}
|
|
24613
|
+
),
|
|
24614
|
+
webauthn && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
24383
24615
|
WalletIcon,
|
|
24384
24616
|
{
|
|
24385
24617
|
iconReactNode: IconFingerprint(),
|
|
@@ -24389,7 +24621,7 @@ function ScreenMain({
|
|
|
24389
24621
|
}
|
|
24390
24622
|
}
|
|
24391
24623
|
),
|
|
24392
|
-
cardanoPeerConnect && /* @__PURE__ */ (0,
|
|
24624
|
+
cardanoPeerConnect && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
24393
24625
|
WalletIcon,
|
|
24394
24626
|
{
|
|
24395
24627
|
iconReactNode: IconMonitorSmartphone(),
|
|
@@ -24399,7 +24631,7 @@ function ScreenMain({
|
|
|
24399
24631
|
}
|
|
24400
24632
|
}
|
|
24401
24633
|
),
|
|
24402
|
-
burnerWallet && /* @__PURE__ */ (0,
|
|
24634
|
+
burnerWallet && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
24403
24635
|
WalletIcon,
|
|
24404
24636
|
{
|
|
24405
24637
|
iconReactNode: IconBookDashed(),
|
|
@@ -24409,7 +24641,7 @@ function ScreenMain({
|
|
|
24409
24641
|
}
|
|
24410
24642
|
}
|
|
24411
24643
|
),
|
|
24412
|
-
/* @__PURE__ */ (0,
|
|
24644
|
+
showDownload && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
24413
24645
|
WalletIcon,
|
|
24414
24646
|
{
|
|
24415
24647
|
iconReactNode: IconDownload(),
|
|
@@ -24426,19 +24658,19 @@ function ScreenMain({
|
|
|
24426
24658
|
}
|
|
24427
24659
|
|
|
24428
24660
|
// src/cardano-wallet/screen-p2p.tsx
|
|
24429
|
-
var
|
|
24661
|
+
var import_react12 = require("react");
|
|
24430
24662
|
var import_cardano_peer_connect = __toESM(require_dist(), 1);
|
|
24431
|
-
var
|
|
24663
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
24432
24664
|
function ScreenP2P({
|
|
24433
24665
|
cardanoPeerConnect,
|
|
24434
24666
|
setOpen
|
|
24435
24667
|
}) {
|
|
24436
|
-
const dAppConnect = (0,
|
|
24437
|
-
const qrCodeField = (0,
|
|
24438
|
-
const [address, setAddress] = (0,
|
|
24439
|
-
const [copied, setCopied] = (0,
|
|
24668
|
+
const dAppConnect = (0, import_react12.useRef)(null);
|
|
24669
|
+
const qrCodeField = (0, import_react12.useRef)(null);
|
|
24670
|
+
const [address, setAddress] = (0, import_react12.useState)("");
|
|
24671
|
+
const [copied, setCopied] = (0, import_react12.useState)(false);
|
|
24440
24672
|
const { connect: connect2 } = useWallet();
|
|
24441
|
-
(0,
|
|
24673
|
+
(0, import_react12.useEffect)(() => {
|
|
24442
24674
|
if (cardanoPeerConnect) {
|
|
24443
24675
|
if (dAppConnect.current === null) {
|
|
24444
24676
|
dAppConnect.current = new import_cardano_peer_connect.DAppPeerConnect({
|
|
@@ -24472,9 +24704,9 @@ function ScreenP2P({
|
|
|
24472
24704
|
}
|
|
24473
24705
|
}
|
|
24474
24706
|
}, []);
|
|
24475
|
-
return /* @__PURE__ */ (0,
|
|
24476
|
-
/* @__PURE__ */ (0,
|
|
24477
|
-
/* @__PURE__ */ (0,
|
|
24707
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "mesh-flex mesh-flex-col mesh-items-center mesh-justify-center", children: [
|
|
24708
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { style: { marginTop: 16, marginBottom: 16 }, ref: qrCodeField }),
|
|
24709
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
24478
24710
|
Button,
|
|
24479
24711
|
{
|
|
24480
24712
|
variant: "outline",
|
|
@@ -24489,15 +24721,15 @@ function ScreenP2P({
|
|
|
24489
24721
|
}
|
|
24490
24722
|
|
|
24491
24723
|
// src/cardano-wallet/screen-webauthn.tsx
|
|
24492
|
-
var
|
|
24724
|
+
var import_react13 = require("react");
|
|
24493
24725
|
var import_wallet4 = require("@meshsdk/wallet");
|
|
24494
24726
|
|
|
24495
24727
|
// src/common/input.tsx
|
|
24496
24728
|
var React5 = __toESM(require("react"), 1);
|
|
24497
|
-
var
|
|
24729
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
24498
24730
|
var Input = React5.forwardRef(
|
|
24499
24731
|
({ className, type, ...props }, ref) => {
|
|
24500
|
-
return /* @__PURE__ */ (0,
|
|
24732
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
24501
24733
|
"input",
|
|
24502
24734
|
{
|
|
24503
24735
|
type,
|
|
@@ -24517,11 +24749,11 @@ Input.displayName = "Input";
|
|
|
24517
24749
|
var React6 = __toESM(require("react"), 1);
|
|
24518
24750
|
var LabelPrimitive = __toESM(require("@radix-ui/react-label"), 1);
|
|
24519
24751
|
var import_class_variance_authority2 = require("class-variance-authority");
|
|
24520
|
-
var
|
|
24752
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
24521
24753
|
var labelVariants = (0, import_class_variance_authority2.cva)(
|
|
24522
24754
|
"mesh-text-sm mesh-font-medium mesh-leading-none peer-disabled:mesh-cursor-not-allowed peer-disabled:mesh-opacity-70"
|
|
24523
24755
|
);
|
|
24524
|
-
var Label2 = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
24756
|
+
var Label2 = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
24525
24757
|
LabelPrimitive.Root,
|
|
24526
24758
|
{
|
|
24527
24759
|
ref,
|
|
@@ -24532,16 +24764,16 @@ var Label2 = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
24532
24764
|
Label2.displayName = LabelPrimitive.Root.displayName;
|
|
24533
24765
|
|
|
24534
24766
|
// src/cardano-wallet/screen-webauthn.tsx
|
|
24535
|
-
var
|
|
24767
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
24536
24768
|
function ScreenWebauthn({
|
|
24537
24769
|
url,
|
|
24538
24770
|
networkId,
|
|
24539
24771
|
provider,
|
|
24540
24772
|
setOpen
|
|
24541
24773
|
}) {
|
|
24542
|
-
const [loading, setLoading] = (0,
|
|
24543
|
-
const [userName, setUserName] = (0,
|
|
24544
|
-
const [password, setPassword] = (0,
|
|
24774
|
+
const [loading, setLoading] = (0, import_react13.useState)(false);
|
|
24775
|
+
const [userName, setUserName] = (0, import_react13.useState)("");
|
|
24776
|
+
const [password, setPassword] = (0, import_react13.useState)("");
|
|
24545
24777
|
const { setWallet } = useWallet();
|
|
24546
24778
|
function createWallet(root) {
|
|
24547
24779
|
setTimeout(() => {
|
|
@@ -24566,10 +24798,10 @@ function ScreenWebauthn({
|
|
|
24566
24798
|
createWallet(res.wallet.bech32PrivateKey);
|
|
24567
24799
|
}
|
|
24568
24800
|
}
|
|
24569
|
-
return /* @__PURE__ */ (0,
|
|
24570
|
-
/* @__PURE__ */ (0,
|
|
24571
|
-
/* @__PURE__ */ (0,
|
|
24572
|
-
/* @__PURE__ */ (0,
|
|
24801
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "mesh-flex mesh-flex-row mesh-flex-gap-4 mesh-items-center mesh-justify-center", children: loading ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children: "Connecting wallet..." }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "mesh-flex mesh-flex-col mesh-gap-6 mesh-w-full mesh-mx-8", children: [
|
|
24802
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "mesh-grid mesh-gap-2", children: [
|
|
24803
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Label2, { htmlFor: "username", children: "Username" }),
|
|
24804
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
24573
24805
|
Input,
|
|
24574
24806
|
{
|
|
24575
24807
|
id: "username",
|
|
@@ -24579,11 +24811,11 @@ function ScreenWebauthn({
|
|
|
24579
24811
|
onChange: (e2) => setUserName(e2.target.value)
|
|
24580
24812
|
}
|
|
24581
24813
|
),
|
|
24582
|
-
/* @__PURE__ */ (0,
|
|
24814
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "mesh-text-gray-500 mesh-text-xs", children: "Unique to the application you are connecting." })
|
|
24583
24815
|
] }),
|
|
24584
|
-
/* @__PURE__ */ (0,
|
|
24585
|
-
/* @__PURE__ */ (0,
|
|
24586
|
-
/* @__PURE__ */ (0,
|
|
24816
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "mesh-grid mesh-gap-2", children: [
|
|
24817
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "mesh-flex mesh-items-center", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Label2, { htmlFor: "password", children: "Unique Code" }) }),
|
|
24818
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
24587
24819
|
Input,
|
|
24588
24820
|
{
|
|
24589
24821
|
id: "password",
|
|
@@ -24593,9 +24825,9 @@ function ScreenWebauthn({
|
|
|
24593
24825
|
onChange: (e2) => setPassword(e2.target.value)
|
|
24594
24826
|
}
|
|
24595
24827
|
),
|
|
24596
|
-
/* @__PURE__ */ (0,
|
|
24828
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "mesh-text-gray-500 mesh-text-xs", children: "Additional security to derive your wallet." })
|
|
24597
24829
|
] }),
|
|
24598
|
-
/* @__PURE__ */ (0,
|
|
24830
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
24599
24831
|
Button,
|
|
24600
24832
|
{
|
|
24601
24833
|
className: "mesh-w-full",
|
|
@@ -24608,59 +24840,62 @@ function ScreenWebauthn({
|
|
|
24608
24840
|
}
|
|
24609
24841
|
|
|
24610
24842
|
// src/cardano-wallet/index.tsx
|
|
24611
|
-
var
|
|
24843
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
24612
24844
|
var CardanoWallet = ({
|
|
24613
24845
|
label = "Connect Wallet",
|
|
24614
24846
|
onConnected = void 0,
|
|
24615
24847
|
isDark = false,
|
|
24616
24848
|
persist = false,
|
|
24617
|
-
extensions = [],
|
|
24618
24849
|
injectFn = void 0,
|
|
24619
24850
|
cardanoPeerConnect = void 0,
|
|
24620
24851
|
burnerWallet = void 0,
|
|
24621
|
-
webauthn = void 0
|
|
24852
|
+
webauthn = void 0,
|
|
24853
|
+
showDownload = true,
|
|
24854
|
+
web3Services = void 0
|
|
24622
24855
|
}) => {
|
|
24623
|
-
const [open, setOpen] = (0,
|
|
24624
|
-
const [screen, setScreen] = (0,
|
|
24625
|
-
const { wallet, connected, setPersist } = useWallet();
|
|
24626
|
-
(0,
|
|
24856
|
+
const [open, setOpen] = (0, import_react14.useState)(false);
|
|
24857
|
+
const [screen, setScreen] = (0, import_react14.useState)("main");
|
|
24858
|
+
const { wallet, connected, setPersist, setWeb3Services } = useWallet();
|
|
24859
|
+
(0, import_react14.useEffect)(() => {
|
|
24627
24860
|
setPersist(persist);
|
|
24628
|
-
|
|
24629
|
-
|
|
24861
|
+
if (web3Services) setWeb3Services(web3Services);
|
|
24862
|
+
}, []);
|
|
24863
|
+
(0, import_react14.useEffect)(() => {
|
|
24630
24864
|
if (connected) {
|
|
24631
24865
|
if (onConnected) onConnected();
|
|
24632
24866
|
}
|
|
24633
24867
|
}, [connected, wallet]);
|
|
24634
|
-
return /* @__PURE__ */ (0,
|
|
24635
|
-
/* @__PURE__ */ (0,
|
|
24636
|
-
/* @__PURE__ */ (0,
|
|
24868
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Dialog, { open, onOpenChange: setOpen, children: [
|
|
24869
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: isDark ? "mesh-dark" : "", children: !connected ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DialogTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Button, { variant: "outline", className: isDark ? "mesh-dark" : "", children: label }) }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ConnectedButton, {}) }),
|
|
24870
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
24637
24871
|
DialogContent,
|
|
24638
24872
|
{
|
|
24639
24873
|
className: "sm:mesh-max-w-[425px] mesh-dark",
|
|
24640
24874
|
onOpenAutoFocus: (event) => event.preventDefault(),
|
|
24641
24875
|
children: [
|
|
24642
|
-
/* @__PURE__ */ (0,
|
|
24643
|
-
screen == "main" && /* @__PURE__ */ (0,
|
|
24876
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Header, { screen, setScreen }),
|
|
24877
|
+
screen == "main" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
24644
24878
|
ScreenMain,
|
|
24645
24879
|
{
|
|
24646
24880
|
injectFn,
|
|
24647
|
-
extensions,
|
|
24648
24881
|
setOpen,
|
|
24649
24882
|
setScreen,
|
|
24650
24883
|
persist,
|
|
24651
24884
|
cardanoPeerConnect: cardanoPeerConnect != void 0,
|
|
24652
24885
|
burnerWallet: burnerWallet != void 0,
|
|
24653
|
-
webauthn: webauthn != void 0
|
|
24886
|
+
webauthn: webauthn != void 0,
|
|
24887
|
+
showDownload,
|
|
24888
|
+
web3Services
|
|
24654
24889
|
}
|
|
24655
24890
|
),
|
|
24656
|
-
screen == "p2p" && /* @__PURE__ */ (0,
|
|
24891
|
+
screen == "p2p" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
24657
24892
|
ScreenP2P,
|
|
24658
24893
|
{
|
|
24659
24894
|
cardanoPeerConnect,
|
|
24660
24895
|
setOpen
|
|
24661
24896
|
}
|
|
24662
24897
|
),
|
|
24663
|
-
screen == "burner" && burnerWallet && /* @__PURE__ */ (0,
|
|
24898
|
+
screen == "burner" && burnerWallet && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
24664
24899
|
ScreenBurner,
|
|
24665
24900
|
{
|
|
24666
24901
|
networkId: burnerWallet.networkId,
|
|
@@ -24668,7 +24903,7 @@ var CardanoWallet = ({
|
|
|
24668
24903
|
setOpen
|
|
24669
24904
|
}
|
|
24670
24905
|
),
|
|
24671
|
-
screen == "webauthn" && webauthn && /* @__PURE__ */ (0,
|
|
24906
|
+
screen == "webauthn" && webauthn && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
24672
24907
|
ScreenWebauthn,
|
|
24673
24908
|
{
|
|
24674
24909
|
url: webauthn.url,
|
|
@@ -24677,7 +24912,7 @@ var CardanoWallet = ({
|
|
|
24677
24912
|
setOpen
|
|
24678
24913
|
}
|
|
24679
24914
|
),
|
|
24680
|
-
/* @__PURE__ */ (0,
|
|
24915
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Footer, {})
|
|
24681
24916
|
]
|
|
24682
24917
|
}
|
|
24683
24918
|
)
|
|
@@ -24687,25 +24922,25 @@ function Header({
|
|
|
24687
24922
|
screen,
|
|
24688
24923
|
setScreen
|
|
24689
24924
|
}) {
|
|
24690
|
-
return /* @__PURE__ */ (0,
|
|
24691
|
-
/* @__PURE__ */ (0,
|
|
24692
|
-
screen != "main" ? /* @__PURE__ */ (0,
|
|
24693
|
-
/* @__PURE__ */ (0,
|
|
24694
|
-
/* @__PURE__ */ (0,
|
|
24925
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(DialogHeader, { children: [
|
|
24926
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(DialogTitle, { className: "mesh-flex mesh-justify-between", children: [
|
|
24927
|
+
screen != "main" ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { onClick: () => setScreen("main"), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(IconChevronRight, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { style: { width: "24px" } }),
|
|
24928
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: screens[screen].title }),
|
|
24929
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { style: { width: "24px" } })
|
|
24695
24930
|
] }),
|
|
24696
|
-
/* @__PURE__ */ (0,
|
|
24931
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DialogDescription, { children: screens[screen].subtitle && screens[screen].subtitle })
|
|
24697
24932
|
] });
|
|
24698
24933
|
}
|
|
24699
24934
|
function Footer() {
|
|
24700
|
-
return /* @__PURE__ */ (0,
|
|
24935
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DialogFooter, { className: "mesh-justify-center mesh-text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
24701
24936
|
"a",
|
|
24702
24937
|
{
|
|
24703
24938
|
href: "https://meshjs.dev/",
|
|
24704
24939
|
target: "_blank",
|
|
24705
24940
|
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",
|
|
24706
24941
|
children: [
|
|
24707
|
-
/* @__PURE__ */ (0,
|
|
24708
|
-
/* @__PURE__ */ (0,
|
|
24942
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "", children: "Powered by" }),
|
|
24943
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
24709
24944
|
"svg",
|
|
24710
24945
|
{
|
|
24711
24946
|
width: 24,
|
|
@@ -24713,31 +24948,31 @@ function Footer() {
|
|
|
24713
24948
|
enableBackground: "new 0 0 300 200",
|
|
24714
24949
|
viewBox: "0 0 300 200",
|
|
24715
24950
|
xmlns: "http://www.w3.org/2000/svg",
|
|
24716
|
-
children: /* @__PURE__ */ (0,
|
|
24951
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "m289 127-45-60-45-60c-.9-1.3-2.4-2-4-2s-3.1.7-4 2l-37 49.3c-2 2.7-6 2.7-8 0l-37-49.3c-.9-1.3-2.4-2-4-2s-3.1.7-4 2l-45 60-45 60c-1.3 1.8-1.3 4.2 0 6l45 60c.9 1.3 2.4 2 4 2s3.1-.7 4-2l37-49.3c2-2.7 6-2.7 8 0l37 49.3c.9 1.3 2.4 2 4 2s3.1-.7 4-2l37-49.3c2-2.7 6-2.7 8 0l37 49.3c.9 1.3 2.4 2 4 2s3.1-.7 4-2l45-60c1.3-1.8 1.3-4.2 0-6zm-90-103.3 32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0l-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0zm-90 0 32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0l-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0zm-53 152.6-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0l32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0zm90 0-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0l32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0zm90 0-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0l32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0z" })
|
|
24717
24952
|
}
|
|
24718
24953
|
),
|
|
24719
|
-
/* @__PURE__ */ (0,
|
|
24954
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "", children: "Mesh SDK" })
|
|
24720
24955
|
]
|
|
24721
24956
|
}
|
|
24722
24957
|
) });
|
|
24723
24958
|
}
|
|
24724
24959
|
|
|
24725
24960
|
// src/mesh-badge/mesh-logo.tsx
|
|
24726
|
-
var
|
|
24727
|
-
var MeshLogo = () => /* @__PURE__ */ (0,
|
|
24961
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
24962
|
+
var MeshLogo = () => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
24728
24963
|
"svg",
|
|
24729
24964
|
{
|
|
24730
24965
|
className: "mesh-h-16 mesh-p-2",
|
|
24731
24966
|
fill: "currentColor",
|
|
24732
24967
|
viewBox: "0 0 300 200",
|
|
24733
24968
|
xmlns: "http://www.w3.org/2000/svg",
|
|
24734
|
-
children: /* @__PURE__ */ (0,
|
|
24969
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("path", { d: "m289 127-45-60-45-60c-.9-1.3-2.4-2-4-2s-3.1.7-4 2l-37 49.3c-2 2.7-6 2.7-8 0l-37-49.3c-.9-1.3-2.4-2-4-2s-3.1.7-4 2l-45 60-45 60c-1.3 1.8-1.3 4.2 0 6l45 60c.9 1.3 2.4 2 4 2s3.1-.7 4-2l37-49.3c2-2.7 6-2.7 8 0l37 49.3c.9 1.3 2.4 2 4 2s3.1-.7 4-2l37-49.3c2-2.7 6-2.7 8 0l37 49.3c.9 1.3 2.4 2 4 2s3.1-.7 4-2l45-60c1.3-1.8 1.3-4.2 0-6zm-90-103.3 32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0l-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0zm-90 0 32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0l-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0zm-53 152.6-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0l32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0zm90 0-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0l32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0zm90 0-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0l32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0z" })
|
|
24735
24970
|
}
|
|
24736
24971
|
);
|
|
24737
24972
|
|
|
24738
24973
|
// src/mesh-badge/index.tsx
|
|
24739
|
-
var
|
|
24740
|
-
var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ (0,
|
|
24974
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
24975
|
+
var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
24741
24976
|
"a",
|
|
24742
24977
|
{
|
|
24743
24978
|
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`}`,
|
|
@@ -24749,21 +24984,21 @@ var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ (0, import_jsx_runtime21
|
|
|
24749
24984
|
rel: "noopener noreferrer",
|
|
24750
24985
|
target: "_blank",
|
|
24751
24986
|
children: [
|
|
24752
|
-
/* @__PURE__ */ (0,
|
|
24987
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(MeshLogo, {}),
|
|
24753
24988
|
"Mesh"
|
|
24754
24989
|
]
|
|
24755
24990
|
}
|
|
24756
24991
|
);
|
|
24757
24992
|
|
|
24758
24993
|
// src/stake-button/index.tsx
|
|
24759
|
-
var
|
|
24994
|
+
var import_react16 = require("react");
|
|
24760
24995
|
var import_transaction = require("@meshsdk/transaction");
|
|
24761
24996
|
|
|
24762
24997
|
// src/cardano-wallet-dropdown/index.tsx
|
|
24763
|
-
var
|
|
24998
|
+
var import_react15 = require("react");
|
|
24764
24999
|
|
|
24765
25000
|
// src/common/button-dropdown.tsx
|
|
24766
|
-
var
|
|
25001
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
24767
25002
|
function ButtonDropdown({
|
|
24768
25003
|
children,
|
|
24769
25004
|
isDarkMode = false,
|
|
@@ -24772,7 +25007,7 @@ function ButtonDropdown({
|
|
|
24772
25007
|
onMouseEnter,
|
|
24773
25008
|
onMouseLeave
|
|
24774
25009
|
}) {
|
|
24775
|
-
return /* @__PURE__ */ (0,
|
|
25010
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
24776
25011
|
"button",
|
|
24777
25012
|
{
|
|
24778
25013
|
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`}`,
|
|
@@ -24785,21 +25020,21 @@ function ButtonDropdown({
|
|
|
24785
25020
|
}
|
|
24786
25021
|
|
|
24787
25022
|
// src/cardano-wallet-dropdown/menu-item.tsx
|
|
24788
|
-
var
|
|
25023
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
24789
25024
|
function MenuItem({
|
|
24790
25025
|
icon,
|
|
24791
25026
|
label,
|
|
24792
25027
|
action,
|
|
24793
25028
|
active
|
|
24794
25029
|
}) {
|
|
24795
|
-
return /* @__PURE__ */ (0,
|
|
25030
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
24796
25031
|
"div",
|
|
24797
25032
|
{
|
|
24798
25033
|
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",
|
|
24799
25034
|
onClick: action,
|
|
24800
25035
|
children: [
|
|
24801
|
-
icon && /* @__PURE__ */ (0,
|
|
24802
|
-
/* @__PURE__ */ (0,
|
|
25036
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("img", { className: "mesh-pr-2 mesh-m-1 mesh-h-8", src: icon }),
|
|
25037
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "mesh-mr-menu-item mesh-text-xl mesh-font-normal mesh-text-neutral-700 hover:mesh-text-black", children: label.split(" ").map((word) => {
|
|
24803
25038
|
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
24804
25039
|
}).join(" ") })
|
|
24805
25040
|
]
|
|
@@ -24808,8 +25043,8 @@ function MenuItem({
|
|
|
24808
25043
|
}
|
|
24809
25044
|
|
|
24810
25045
|
// src/cardano-wallet-dropdown/chevron-down.tsx
|
|
24811
|
-
var
|
|
24812
|
-
var ChevronDown = () => /* @__PURE__ */ (0,
|
|
25046
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
25047
|
+
var ChevronDown = () => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
24813
25048
|
"svg",
|
|
24814
25049
|
{
|
|
24815
25050
|
className: "mesh-m-2 mesh-h-6",
|
|
@@ -24818,7 +25053,7 @@ var ChevronDown = () => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
|
24818
25053
|
viewBox: "0 0 24 24",
|
|
24819
25054
|
stroke: "currentColor",
|
|
24820
25055
|
xmlns: "http://www.w3.org/2000/svg",
|
|
24821
|
-
children: /* @__PURE__ */ (0,
|
|
25056
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
24822
25057
|
"path",
|
|
24823
25058
|
{
|
|
24824
25059
|
strokeLinecap: "round",
|
|
@@ -24831,7 +25066,7 @@ var ChevronDown = () => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
|
24831
25066
|
);
|
|
24832
25067
|
|
|
24833
25068
|
// src/cardano-wallet-dropdown/wallet-balance.tsx
|
|
24834
|
-
var
|
|
25069
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
24835
25070
|
var WalletBalance = ({
|
|
24836
25071
|
connected,
|
|
24837
25072
|
connecting,
|
|
@@ -24839,22 +25074,22 @@ var WalletBalance = ({
|
|
|
24839
25074
|
wallet
|
|
24840
25075
|
}) => {
|
|
24841
25076
|
const lovelace = useLovelace();
|
|
24842
|
-
return connected && lovelace && wallet?.icon ? /* @__PURE__ */ (0,
|
|
24843
|
-
/* @__PURE__ */ (0,
|
|
25077
|
+
return connected && lovelace && wallet?.icon ? /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
25078
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("img", { className: "mesh-m-2 mesh-h-6", src: wallet.icon }),
|
|
24844
25079
|
"\u20B3",
|
|
24845
25080
|
" ",
|
|
24846
25081
|
parseInt((parseInt(lovelace, 10) / 1e6).toString(), 10),
|
|
24847
25082
|
".",
|
|
24848
|
-
/* @__PURE__ */ (0,
|
|
24849
|
-
] }) : connected && wallet?.icon ? /* @__PURE__ */ (0,
|
|
25083
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "mesh-text-xs", children: lovelace.substring(lovelace.length - 6) })
|
|
25084
|
+
] }) : connected && wallet?.icon ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("img", { className: "mesh-m-2 mesh-h-6", src: wallet.icon }) }) : connecting ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children: "Connecting..." }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
24850
25085
|
label,
|
|
24851
25086
|
" ",
|
|
24852
|
-
/* @__PURE__ */ (0,
|
|
25087
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChevronDown, {})
|
|
24853
25088
|
] });
|
|
24854
25089
|
};
|
|
24855
25090
|
|
|
24856
25091
|
// src/cardano-wallet-dropdown/index.tsx
|
|
24857
|
-
var
|
|
25092
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
24858
25093
|
var CardanoWallet2 = ({
|
|
24859
25094
|
label = "Connect Wallet",
|
|
24860
25095
|
onConnected = void 0,
|
|
@@ -24862,32 +25097,32 @@ var CardanoWallet2 = ({
|
|
|
24862
25097
|
extensions = [],
|
|
24863
25098
|
cardanoPeerConnect = void 0
|
|
24864
25099
|
}) => {
|
|
24865
|
-
const [isDarkMode, setIsDarkMode] = (0,
|
|
24866
|
-
const [hideMenuList, setHideMenuList] = (0,
|
|
25100
|
+
const [isDarkMode, setIsDarkMode] = (0, import_react15.useState)(false);
|
|
25101
|
+
const [hideMenuList, setHideMenuList] = (0, import_react15.useState)(true);
|
|
24867
25102
|
const { connect: connect2, connecting, connected, disconnect, name } = useWallet();
|
|
24868
25103
|
const wallets = useWalletList();
|
|
24869
|
-
(0,
|
|
25104
|
+
(0, import_react15.useEffect)(() => {
|
|
24870
25105
|
if (connected && onConnected) {
|
|
24871
25106
|
onConnected();
|
|
24872
25107
|
}
|
|
24873
25108
|
}, [connected]);
|
|
24874
|
-
(0,
|
|
25109
|
+
(0, import_react15.useEffect)(() => {
|
|
24875
25110
|
setIsDarkMode(isDark);
|
|
24876
25111
|
}, [isDark]);
|
|
24877
|
-
return /* @__PURE__ */ (0,
|
|
25112
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
24878
25113
|
"div",
|
|
24879
25114
|
{
|
|
24880
25115
|
onMouseEnter: () => setHideMenuList(false),
|
|
24881
25116
|
onMouseLeave: () => setHideMenuList(true),
|
|
24882
25117
|
style: { width: "min-content", zIndex: 50 },
|
|
24883
25118
|
children: [
|
|
24884
|
-
/* @__PURE__ */ (0,
|
|
25119
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
24885
25120
|
ButtonDropdown,
|
|
24886
25121
|
{
|
|
24887
25122
|
isDarkMode,
|
|
24888
25123
|
hideMenuList,
|
|
24889
25124
|
setHideMenuList,
|
|
24890
|
-
children: /* @__PURE__ */ (0,
|
|
25125
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
24891
25126
|
WalletBalance,
|
|
24892
25127
|
{
|
|
24893
25128
|
connected,
|
|
@@ -24898,12 +25133,12 @@ var CardanoWallet2 = ({
|
|
|
24898
25133
|
)
|
|
24899
25134
|
}
|
|
24900
25135
|
),
|
|
24901
|
-
/* @__PURE__ */ (0,
|
|
25136
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
24902
25137
|
"div",
|
|
24903
25138
|
{
|
|
24904
25139
|
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`}`,
|
|
24905
25140
|
style: { zIndex: 50 },
|
|
24906
|
-
children: !connected && wallets.length > 0 ? /* @__PURE__ */ (0,
|
|
25141
|
+
children: !connected && wallets.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children: wallets.map((wallet, index) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
24907
25142
|
MenuItem,
|
|
24908
25143
|
{
|
|
24909
25144
|
icon: wallet.icon,
|
|
@@ -24915,7 +25150,7 @@ var CardanoWallet2 = ({
|
|
|
24915
25150
|
active: name === wallet.id
|
|
24916
25151
|
},
|
|
24917
25152
|
index
|
|
24918
|
-
)) }) : wallets.length === 0 ? /* @__PURE__ */ (0,
|
|
25153
|
+
)) }) : wallets.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "No Wallet Found" }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
24919
25154
|
MenuItem,
|
|
24920
25155
|
{
|
|
24921
25156
|
active: false,
|
|
@@ -24932,7 +25167,7 @@ var CardanoWallet2 = ({
|
|
|
24932
25167
|
};
|
|
24933
25168
|
|
|
24934
25169
|
// src/stake-button/index.tsx
|
|
24935
|
-
var
|
|
25170
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
24936
25171
|
var StakeButton = ({
|
|
24937
25172
|
label = "Stake your ADA",
|
|
24938
25173
|
isDark = false,
|
|
@@ -24940,19 +25175,19 @@ var StakeButton = ({
|
|
|
24940
25175
|
onCheck,
|
|
24941
25176
|
onDelegated = void 0
|
|
24942
25177
|
}) => {
|
|
24943
|
-
const [isDarkMode, setIsDarkMode] = (0,
|
|
25178
|
+
const [isDarkMode, setIsDarkMode] = (0, import_react16.useState)(false);
|
|
24944
25179
|
const { connected } = useWallet();
|
|
24945
|
-
(0,
|
|
25180
|
+
(0, import_react16.useEffect)(() => {
|
|
24946
25181
|
setIsDarkMode(isDark);
|
|
24947
25182
|
}, [isDark]);
|
|
24948
|
-
return /* @__PURE__ */ (0,
|
|
25183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children: connected ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ButtonDropdown, { isDarkMode, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
24949
25184
|
Delegate,
|
|
24950
25185
|
{
|
|
24951
25186
|
poolId,
|
|
24952
25187
|
onCheck,
|
|
24953
25188
|
onDelegated
|
|
24954
25189
|
}
|
|
24955
|
-
) }) : /* @__PURE__ */ (0,
|
|
25190
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CardanoWallet2, { label, isDark }) });
|
|
24956
25191
|
};
|
|
24957
25192
|
var Delegate = ({
|
|
24958
25193
|
poolId,
|
|
@@ -24961,11 +25196,11 @@ var Delegate = ({
|
|
|
24961
25196
|
}) => {
|
|
24962
25197
|
const { wallet } = useWallet();
|
|
24963
25198
|
const rewardAddress = useRewardAddress();
|
|
24964
|
-
const [_, setError] = (0,
|
|
24965
|
-
const [checking, setChecking] = (0,
|
|
24966
|
-
const [accountInfo, setAccountInfo] = (0,
|
|
24967
|
-
const [processing, setProcessing] = (0,
|
|
24968
|
-
const [done, setDone] = (0,
|
|
25199
|
+
const [_, setError] = (0, import_react16.useState)();
|
|
25200
|
+
const [checking, setChecking] = (0, import_react16.useState)(false);
|
|
25201
|
+
const [accountInfo, setAccountInfo] = (0, import_react16.useState)();
|
|
25202
|
+
const [processing, setProcessing] = (0, import_react16.useState)(false);
|
|
25203
|
+
const [done, setDone] = (0, import_react16.useState)(false);
|
|
24969
25204
|
const checkAccountStatus = async () => {
|
|
24970
25205
|
try {
|
|
24971
25206
|
setChecking(true);
|
|
@@ -25016,22 +25251,22 @@ var Delegate = ({
|
|
|
25016
25251
|
}
|
|
25017
25252
|
setProcessing(false);
|
|
25018
25253
|
};
|
|
25019
|
-
(0,
|
|
25254
|
+
(0, import_react16.useEffect)(() => {
|
|
25020
25255
|
checkAccountStatus();
|
|
25021
25256
|
}, [rewardAddress]);
|
|
25022
25257
|
if (checking) {
|
|
25023
|
-
return /* @__PURE__ */ (0,
|
|
25258
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Checking..." });
|
|
25024
25259
|
}
|
|
25025
25260
|
if (processing) {
|
|
25026
|
-
return /* @__PURE__ */ (0,
|
|
25261
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Loading..." });
|
|
25027
25262
|
}
|
|
25028
25263
|
if (done) {
|
|
25029
|
-
return /* @__PURE__ */ (0,
|
|
25264
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Stake Delegated" });
|
|
25030
25265
|
}
|
|
25031
25266
|
if (accountInfo?.active) {
|
|
25032
|
-
return accountInfo.poolId === poolId ? /* @__PURE__ */ (0,
|
|
25267
|
+
return accountInfo.poolId === poolId ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Stake Delegated" }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { onClick: delegateStake, children: "Begin Staking" });
|
|
25033
25268
|
}
|
|
25034
|
-
return /* @__PURE__ */ (0,
|
|
25269
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { onClick: registerAddress, children: "Begin Staking" });
|
|
25035
25270
|
};
|
|
25036
25271
|
// Annotate the CommonJS export names for ESM import in node:
|
|
25037
25272
|
0 && (module.exports = {
|