@meshsdk/react 1.8.5 → 1.8.7
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 +289 -107
- package/dist/index.css +66 -0
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +284 -102
- package/package.json +5 -4
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);
|
|
@@ -24057,6 +24057,10 @@ var screens = {
|
|
|
24057
24057
|
burner: {
|
|
24058
24058
|
title: "Burner Wallet",
|
|
24059
24059
|
subtitle: "Instantly create a new burner wallet. No seed phrase required, keys are generated on your device."
|
|
24060
|
+
},
|
|
24061
|
+
webauthn: {
|
|
24062
|
+
title: "Passkey",
|
|
24063
|
+
subtitle: "Derive self-custody wallet on Chrome, Safari, or Firefox browsers on Android, iOS, macOS, and Windows devices, or using password managers."
|
|
24060
24064
|
}
|
|
24061
24065
|
};
|
|
24062
24066
|
|
|
@@ -24209,10 +24213,47 @@ function IconDownload() {
|
|
|
24209
24213
|
);
|
|
24210
24214
|
}
|
|
24211
24215
|
|
|
24212
|
-
// src/common/icons/icon-
|
|
24216
|
+
// src/common/icons/icon-fingerprint.tsx
|
|
24213
24217
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
24214
|
-
function
|
|
24218
|
+
function IconFingerprint() {
|
|
24215
24219
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
24220
|
+
"svg",
|
|
24221
|
+
{
|
|
24222
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
24223
|
+
width: "24",
|
|
24224
|
+
height: "24",
|
|
24225
|
+
viewBox: "0 0 24 24",
|
|
24226
|
+
fill: "none",
|
|
24227
|
+
stroke: "currentColor",
|
|
24228
|
+
strokeWidth: "2",
|
|
24229
|
+
strokeLinecap: "round",
|
|
24230
|
+
strokeLinejoin: "round",
|
|
24231
|
+
style: {
|
|
24232
|
+
color: "#ffadff",
|
|
24233
|
+
width: "24px",
|
|
24234
|
+
height: "24px",
|
|
24235
|
+
strokeWidth: "1px"
|
|
24236
|
+
},
|
|
24237
|
+
className: "hover:mesh-fill-white",
|
|
24238
|
+
children: [
|
|
24239
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4" }),
|
|
24240
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M14 13.12c0 2.38 0 6.38-1 8.88" }),
|
|
24241
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M17.29 21.02c.12-.6.43-2.3.5-3.02" }),
|
|
24242
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M2 12a10 10 0 0 1 18-6" }),
|
|
24243
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M2 16h.01" }),
|
|
24244
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M21.8 16c.2-2 .131-5.354 0-6" }),
|
|
24245
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2" }),
|
|
24246
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M8.65 22c.21-.66.45-1.32.57-2" }),
|
|
24247
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M9 6.8a6 6 0 0 1 9 5.2v2" })
|
|
24248
|
+
]
|
|
24249
|
+
}
|
|
24250
|
+
);
|
|
24251
|
+
}
|
|
24252
|
+
|
|
24253
|
+
// src/common/icons/icon-monitor-smartphone.tsx
|
|
24254
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
24255
|
+
function IconMonitorSmartphone() {
|
|
24256
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
24216
24257
|
"svg",
|
|
24217
24258
|
{
|
|
24218
24259
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -24231,10 +24272,10 @@ function IconMonitorSmartphone() {
|
|
|
24231
24272
|
strokeWidth: "1px"
|
|
24232
24273
|
},
|
|
24233
24274
|
children: [
|
|
24234
|
-
/* @__PURE__ */ (0,
|
|
24235
|
-
/* @__PURE__ */ (0,
|
|
24236
|
-
/* @__PURE__ */ (0,
|
|
24237
|
-
/* @__PURE__ */ (0,
|
|
24275
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8" }),
|
|
24276
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M10 19v-3.96 3.15" }),
|
|
24277
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M7 19h5" }),
|
|
24278
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("rect", { width: "6", height: "10", x: "16", y: "12", rx: "2" })
|
|
24238
24279
|
]
|
|
24239
24280
|
}
|
|
24240
24281
|
);
|
|
@@ -24243,11 +24284,11 @@ function IconMonitorSmartphone() {
|
|
|
24243
24284
|
// src/common/tooltip.tsx
|
|
24244
24285
|
var React4 = __toESM(require("react"), 1);
|
|
24245
24286
|
var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"), 1);
|
|
24246
|
-
var
|
|
24287
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
24247
24288
|
var TooltipProvider = TooltipPrimitive.Provider;
|
|
24248
24289
|
var Tooltip = TooltipPrimitive.Root;
|
|
24249
24290
|
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
24250
|
-
var TooltipContent = React4.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ (0,
|
|
24291
|
+
var TooltipContent = React4.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
24251
24292
|
TooltipPrimitive.Content,
|
|
24252
24293
|
{
|
|
24253
24294
|
ref,
|
|
@@ -24262,55 +24303,66 @@ var TooltipContent = React4.forwardRef(({ className, sideOffset = 4, ...props },
|
|
|
24262
24303
|
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
24263
24304
|
|
|
24264
24305
|
// src/cardano-wallet/wallet-icon.tsx
|
|
24265
|
-
var
|
|
24306
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
24266
24307
|
function WalletIcon({
|
|
24267
24308
|
icon,
|
|
24268
24309
|
name,
|
|
24269
24310
|
action,
|
|
24270
24311
|
iconReactNode
|
|
24271
24312
|
}) {
|
|
24272
|
-
return /* @__PURE__ */ (0,
|
|
24273
|
-
/* @__PURE__ */ (0,
|
|
24313
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Tooltip, { delayDuration: 0, defaultOpen: false, children: [
|
|
24314
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
24274
24315
|
"button",
|
|
24275
24316
|
{
|
|
24276
24317
|
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",
|
|
24277
24318
|
onClick: action,
|
|
24278
24319
|
children: [
|
|
24279
|
-
icon && /* @__PURE__ */ (0,
|
|
24320
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("img", { src: icon, alt: name, className: "mesh-w-8 mesh-h-8" }),
|
|
24280
24321
|
iconReactNode && iconReactNode
|
|
24281
24322
|
]
|
|
24282
24323
|
}
|
|
24283
24324
|
) }),
|
|
24284
|
-
/* @__PURE__ */ (0,
|
|
24325
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TooltipContent, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { children: name }) })
|
|
24285
24326
|
] });
|
|
24286
24327
|
}
|
|
24287
24328
|
|
|
24288
24329
|
// src/cardano-wallet/screen-main.tsx
|
|
24289
|
-
var
|
|
24330
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
24290
24331
|
function ScreenMain({
|
|
24291
24332
|
metamask,
|
|
24292
24333
|
extensions,
|
|
24293
24334
|
setOpen,
|
|
24294
24335
|
setScreen,
|
|
24295
24336
|
cardanoPeerConnect,
|
|
24296
|
-
burnerWallet
|
|
24337
|
+
burnerWallet,
|
|
24338
|
+
webauthn
|
|
24297
24339
|
}) {
|
|
24298
24340
|
const wallets = useWalletList({ metamask });
|
|
24299
|
-
const { connect } = useWallet();
|
|
24300
|
-
return /* @__PURE__ */ (0,
|
|
24301
|
-
wallets.map((wallet, index) => /* @__PURE__ */ (0,
|
|
24341
|
+
const { connect: connect2 } = useWallet();
|
|
24342
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "mesh-grid mesh-gap-4 mesh-py-4 mesh-grid-cols-5 mesh-place-items-center mesh-gap-y-8", children: [
|
|
24343
|
+
wallets.map((wallet, index) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
24302
24344
|
WalletIcon,
|
|
24303
24345
|
{
|
|
24304
24346
|
icon: wallet.icon,
|
|
24305
24347
|
name: wallet.name,
|
|
24306
24348
|
action: () => {
|
|
24307
|
-
|
|
24349
|
+
connect2(wallet.id, extensions);
|
|
24308
24350
|
setOpen(false);
|
|
24309
24351
|
}
|
|
24310
24352
|
},
|
|
24311
24353
|
index
|
|
24312
24354
|
)),
|
|
24313
|
-
|
|
24355
|
+
webauthn && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
24356
|
+
WalletIcon,
|
|
24357
|
+
{
|
|
24358
|
+
iconReactNode: IconFingerprint(),
|
|
24359
|
+
name: screens.webauthn.title,
|
|
24360
|
+
action: () => {
|
|
24361
|
+
setScreen("webauthn");
|
|
24362
|
+
}
|
|
24363
|
+
}
|
|
24364
|
+
),
|
|
24365
|
+
cardanoPeerConnect && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
24314
24366
|
WalletIcon,
|
|
24315
24367
|
{
|
|
24316
24368
|
iconReactNode: IconMonitorSmartphone(),
|
|
@@ -24320,7 +24372,7 @@ function ScreenMain({
|
|
|
24320
24372
|
}
|
|
24321
24373
|
}
|
|
24322
24374
|
),
|
|
24323
|
-
burnerWallet && /* @__PURE__ */ (0,
|
|
24375
|
+
burnerWallet && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
24324
24376
|
WalletIcon,
|
|
24325
24377
|
{
|
|
24326
24378
|
iconReactNode: IconBookDashed(),
|
|
@@ -24330,7 +24382,7 @@ function ScreenMain({
|
|
|
24330
24382
|
}
|
|
24331
24383
|
}
|
|
24332
24384
|
),
|
|
24333
|
-
/* @__PURE__ */ (0,
|
|
24385
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
24334
24386
|
WalletIcon,
|
|
24335
24387
|
{
|
|
24336
24388
|
iconReactNode: IconDownload(),
|
|
@@ -24349,7 +24401,7 @@ function ScreenMain({
|
|
|
24349
24401
|
// src/cardano-wallet/screen-p2p.tsx
|
|
24350
24402
|
var import_react12 = require("react");
|
|
24351
24403
|
var import_cardano_peer_connect = __toESM(require_dist(), 1);
|
|
24352
|
-
var
|
|
24404
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
24353
24405
|
function ScreenP2P({
|
|
24354
24406
|
cardanoPeerConnect,
|
|
24355
24407
|
setOpen
|
|
@@ -24358,7 +24410,7 @@ function ScreenP2P({
|
|
|
24358
24410
|
const qrCodeField = (0, import_react12.useRef)(null);
|
|
24359
24411
|
const [address, setAddress] = (0, import_react12.useState)("");
|
|
24360
24412
|
const [copied, setCopied] = (0, import_react12.useState)(false);
|
|
24361
|
-
const { connect } = useWallet();
|
|
24413
|
+
const { connect: connect2 } = useWallet();
|
|
24362
24414
|
(0, import_react12.useEffect)(() => {
|
|
24363
24415
|
if (cardanoPeerConnect) {
|
|
24364
24416
|
if (dAppConnect.current === null) {
|
|
@@ -24369,7 +24421,7 @@ function ScreenP2P({
|
|
|
24369
24421
|
},
|
|
24370
24422
|
announce: cardanoPeerConnect.announce,
|
|
24371
24423
|
onApiInject: async (name, address2) => {
|
|
24372
|
-
await
|
|
24424
|
+
await connect2(name);
|
|
24373
24425
|
setOpen(false);
|
|
24374
24426
|
},
|
|
24375
24427
|
onApiEject: (name, address2) => {
|
|
@@ -24393,9 +24445,9 @@ function ScreenP2P({
|
|
|
24393
24445
|
}
|
|
24394
24446
|
}
|
|
24395
24447
|
}, []);
|
|
24396
|
-
return /* @__PURE__ */ (0,
|
|
24397
|
-
/* @__PURE__ */ (0,
|
|
24398
|
-
/* @__PURE__ */ (0,
|
|
24448
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "mesh-flex mesh-flex-col mesh-items-center mesh-justify-center", children: [
|
|
24449
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { marginTop: 16, marginBottom: 16 }, ref: qrCodeField }),
|
|
24450
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
24399
24451
|
Button,
|
|
24400
24452
|
{
|
|
24401
24453
|
variant: "outline",
|
|
@@ -24410,8 +24462,127 @@ function ScreenP2P({
|
|
|
24410
24462
|
] });
|
|
24411
24463
|
}
|
|
24412
24464
|
|
|
24465
|
+
// src/cardano-wallet/screen-webauthn.tsx
|
|
24466
|
+
var import_react13 = require("react");
|
|
24467
|
+
var import_wallet4 = require("@meshsdk/wallet");
|
|
24468
|
+
|
|
24469
|
+
// src/common/input.tsx
|
|
24470
|
+
var React5 = __toESM(require("react"), 1);
|
|
24471
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
24472
|
+
var Input = React5.forwardRef(
|
|
24473
|
+
({ className, type, ...props }, ref) => {
|
|
24474
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
24475
|
+
"input",
|
|
24476
|
+
{
|
|
24477
|
+
type,
|
|
24478
|
+
className: cn(
|
|
24479
|
+
"mesh-flex mesh-h-9 mesh-w-full mesh-rounded-md mesh-border mesh-border-zinc-200 mesh-bg-transparent mesh-px-3 mesh-py-1 mesh-text-sm mesh-shadow-sm mesh-transition-colors file:mesh-border-0 file:mesh-bg-transparent file:mesh-text-sm file:mesh-font-medium placeholder:mesh-text-zinc-500 focus-visible:mesh-outline-none focus-visible:mesh-ring-1 focus-visible:mesh-ring-zinc-950 disabled:mesh-cursor-not-allowed disabled:mesh-opacity-50 dark:mesh-border-zinc-800 dark:mesh-placeholder:text-zinc-400 dark:mesh-focus-visible:ring-zinc-300",
|
|
24480
|
+
className
|
|
24481
|
+
),
|
|
24482
|
+
ref,
|
|
24483
|
+
...props
|
|
24484
|
+
}
|
|
24485
|
+
);
|
|
24486
|
+
}
|
|
24487
|
+
);
|
|
24488
|
+
Input.displayName = "Input";
|
|
24489
|
+
|
|
24490
|
+
// src/common/label.tsx
|
|
24491
|
+
var React6 = __toESM(require("react"), 1);
|
|
24492
|
+
var LabelPrimitive = __toESM(require("@radix-ui/react-label"), 1);
|
|
24493
|
+
var import_class_variance_authority2 = require("class-variance-authority");
|
|
24494
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
24495
|
+
var labelVariants = (0, import_class_variance_authority2.cva)(
|
|
24496
|
+
"mesh-text-sm mesh-font-medium mesh-leading-none peer-disabled:mesh-cursor-not-allowed peer-disabled:mesh-opacity-70"
|
|
24497
|
+
);
|
|
24498
|
+
var Label2 = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
24499
|
+
LabelPrimitive.Root,
|
|
24500
|
+
{
|
|
24501
|
+
ref,
|
|
24502
|
+
className: cn(labelVariants(), className),
|
|
24503
|
+
...props
|
|
24504
|
+
}
|
|
24505
|
+
));
|
|
24506
|
+
Label2.displayName = LabelPrimitive.Root.displayName;
|
|
24507
|
+
|
|
24508
|
+
// src/cardano-wallet/screen-webauthn.tsx
|
|
24509
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
24510
|
+
function ScreenWebauthn({
|
|
24511
|
+
url,
|
|
24512
|
+
networkId,
|
|
24513
|
+
provider,
|
|
24514
|
+
setOpen
|
|
24515
|
+
}) {
|
|
24516
|
+
const [loading, setLoading] = (0, import_react13.useState)(false);
|
|
24517
|
+
const [userName, setUserName] = (0, import_react13.useState)("");
|
|
24518
|
+
const [password, setPassword] = (0, import_react13.useState)("");
|
|
24519
|
+
const { setWallet } = useWallet();
|
|
24520
|
+
function createWallet(root) {
|
|
24521
|
+
setTimeout(() => {
|
|
24522
|
+
const wallet = new import_wallet4.MeshWallet({
|
|
24523
|
+
networkId,
|
|
24524
|
+
fetcher: provider,
|
|
24525
|
+
submitter: provider,
|
|
24526
|
+
key: {
|
|
24527
|
+
type: "root",
|
|
24528
|
+
bech32: root
|
|
24529
|
+
}
|
|
24530
|
+
});
|
|
24531
|
+
setWallet(wallet, screens.webauthn.title);
|
|
24532
|
+
setLoading(false);
|
|
24533
|
+
setOpen(false);
|
|
24534
|
+
}, 500);
|
|
24535
|
+
}
|
|
24536
|
+
async function handleConnect() {
|
|
24537
|
+
setLoading(true);
|
|
24538
|
+
const res = await (0, import_wallet4.connect)({ username: userName, password, serverUrl: url });
|
|
24539
|
+
if (res.success && res.wallet) {
|
|
24540
|
+
createWallet(res.wallet.bech32PrivateKey);
|
|
24541
|
+
}
|
|
24542
|
+
}
|
|
24543
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "mesh-flex mesh-flex-row mesh-flex-gap-4 mesh-items-center mesh-justify-center", children: loading ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jsx_runtime18.Fragment, { children: "Connecting wallet..." }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jsx_runtime18.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "mesh-flex mesh-flex-col mesh-gap-6 mesh-w-full mesh-mx-8", children: [
|
|
24544
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "mesh-grid mesh-gap-2", children: [
|
|
24545
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Label2, { htmlFor: "username", children: "Username" }),
|
|
24546
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
24547
|
+
Input,
|
|
24548
|
+
{
|
|
24549
|
+
id: "username",
|
|
24550
|
+
type: "username",
|
|
24551
|
+
placeholder: "adalovelace",
|
|
24552
|
+
value: userName,
|
|
24553
|
+
onChange: (e2) => setUserName(e2.target.value)
|
|
24554
|
+
}
|
|
24555
|
+
),
|
|
24556
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "mesh-text-gray-500 mesh-text-xs", children: "Unique to the application you are connecting." })
|
|
24557
|
+
] }),
|
|
24558
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "mesh-grid mesh-gap-2", children: [
|
|
24559
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "mesh-flex mesh-items-center", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Label2, { htmlFor: "password", children: "Unique Code" }) }),
|
|
24560
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
24561
|
+
Input,
|
|
24562
|
+
{
|
|
24563
|
+
id: "password",
|
|
24564
|
+
type: "password",
|
|
24565
|
+
placeholder: "********",
|
|
24566
|
+
value: password,
|
|
24567
|
+
onChange: (e2) => setPassword(e2.target.value)
|
|
24568
|
+
}
|
|
24569
|
+
),
|
|
24570
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "mesh-text-gray-500 mesh-text-xs", children: "Additional security to derive your wallet." })
|
|
24571
|
+
] }),
|
|
24572
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
24573
|
+
Button,
|
|
24574
|
+
{
|
|
24575
|
+
className: "mesh-w-full",
|
|
24576
|
+
onClick: () => handleConnect(),
|
|
24577
|
+
disabled: !userName || userName.length < 6,
|
|
24578
|
+
children: "Connect"
|
|
24579
|
+
}
|
|
24580
|
+
)
|
|
24581
|
+
] }) }) });
|
|
24582
|
+
}
|
|
24583
|
+
|
|
24413
24584
|
// src/cardano-wallet/index.tsx
|
|
24414
|
-
var
|
|
24585
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
24415
24586
|
var CardanoWallet = ({
|
|
24416
24587
|
label = "Connect Wallet",
|
|
24417
24588
|
onConnected = void 0,
|
|
@@ -24419,26 +24590,27 @@ var CardanoWallet = ({
|
|
|
24419
24590
|
extensions = [],
|
|
24420
24591
|
metamask = void 0,
|
|
24421
24592
|
cardanoPeerConnect = void 0,
|
|
24422
|
-
burnerWallet = void 0
|
|
24593
|
+
burnerWallet = void 0,
|
|
24594
|
+
webauthn = void 0
|
|
24423
24595
|
}) => {
|
|
24424
|
-
const [open, setOpen] = (0,
|
|
24425
|
-
const [screen, setScreen] = (0,
|
|
24596
|
+
const [open, setOpen] = (0, import_react14.useState)(false);
|
|
24597
|
+
const [screen, setScreen] = (0, import_react14.useState)("main");
|
|
24426
24598
|
const { wallet, connected } = useWallet();
|
|
24427
|
-
(0,
|
|
24428
|
-
if (connected
|
|
24599
|
+
(0, import_react14.useEffect)(() => {
|
|
24600
|
+
if (connected) {
|
|
24429
24601
|
if (onConnected) onConnected();
|
|
24430
24602
|
}
|
|
24431
24603
|
}, [connected, wallet]);
|
|
24432
|
-
return /* @__PURE__ */ (0,
|
|
24433
|
-
!connected ? /* @__PURE__ */ (0,
|
|
24434
|
-
/* @__PURE__ */ (0,
|
|
24604
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Dialog, { open, onOpenChange: setOpen, children: [
|
|
24605
|
+
!connected ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DialogTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button, { variant: "outline", className: "mesh-text-white", children: label }) }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ConnectedButton, {}),
|
|
24606
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
24435
24607
|
DialogContent,
|
|
24436
24608
|
{
|
|
24437
24609
|
className: "sm:mesh-max-w-[425px]",
|
|
24438
24610
|
onOpenAutoFocus: (event) => event.preventDefault(),
|
|
24439
24611
|
children: [
|
|
24440
|
-
/* @__PURE__ */ (0,
|
|
24441
|
-
screen == "main" && /* @__PURE__ */ (0,
|
|
24612
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Header, { screen, setScreen }),
|
|
24613
|
+
screen == "main" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
24442
24614
|
ScreenMain,
|
|
24443
24615
|
{
|
|
24444
24616
|
metamask,
|
|
@@ -24446,17 +24618,18 @@ var CardanoWallet = ({
|
|
|
24446
24618
|
setOpen,
|
|
24447
24619
|
setScreen,
|
|
24448
24620
|
cardanoPeerConnect: cardanoPeerConnect != void 0,
|
|
24449
|
-
burnerWallet: burnerWallet != void 0
|
|
24621
|
+
burnerWallet: burnerWallet != void 0,
|
|
24622
|
+
webauthn: webauthn != void 0
|
|
24450
24623
|
}
|
|
24451
24624
|
),
|
|
24452
|
-
screen == "p2p" && /* @__PURE__ */ (0,
|
|
24625
|
+
screen == "p2p" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
24453
24626
|
ScreenP2P,
|
|
24454
24627
|
{
|
|
24455
24628
|
cardanoPeerConnect,
|
|
24456
24629
|
setOpen
|
|
24457
24630
|
}
|
|
24458
24631
|
),
|
|
24459
|
-
screen == "burner" && burnerWallet && /* @__PURE__ */ (0,
|
|
24632
|
+
screen == "burner" && burnerWallet && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
24460
24633
|
ScreenBurner,
|
|
24461
24634
|
{
|
|
24462
24635
|
networkId: burnerWallet.networkId,
|
|
@@ -24464,7 +24637,16 @@ var CardanoWallet = ({
|
|
|
24464
24637
|
setOpen
|
|
24465
24638
|
}
|
|
24466
24639
|
),
|
|
24467
|
-
/* @__PURE__ */ (0,
|
|
24640
|
+
screen == "webauthn" && webauthn && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
24641
|
+
ScreenWebauthn,
|
|
24642
|
+
{
|
|
24643
|
+
url: webauthn.url,
|
|
24644
|
+
networkId: webauthn.networkId,
|
|
24645
|
+
provider: webauthn.provider,
|
|
24646
|
+
setOpen
|
|
24647
|
+
}
|
|
24648
|
+
),
|
|
24649
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Footer, {})
|
|
24468
24650
|
]
|
|
24469
24651
|
}
|
|
24470
24652
|
)
|
|
@@ -24474,25 +24656,25 @@ function Header({
|
|
|
24474
24656
|
screen,
|
|
24475
24657
|
setScreen
|
|
24476
24658
|
}) {
|
|
24477
|
-
return /* @__PURE__ */ (0,
|
|
24478
|
-
/* @__PURE__ */ (0,
|
|
24479
|
-
screen != "main" ? /* @__PURE__ */ (0,
|
|
24480
|
-
/* @__PURE__ */ (0,
|
|
24481
|
-
/* @__PURE__ */ (0,
|
|
24659
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(DialogHeader, { children: [
|
|
24660
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(DialogTitle, { className: "mesh-flex mesh-justify-between", children: [
|
|
24661
|
+
screen != "main" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { onClick: () => setScreen("main"), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(IconChevronRight, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { style: { width: "24px" } }),
|
|
24662
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: screens[screen].title }),
|
|
24663
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { style: { width: "24px" } })
|
|
24482
24664
|
] }),
|
|
24483
|
-
/* @__PURE__ */ (0,
|
|
24665
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DialogDescription, { children: screens[screen].subtitle && screens[screen].subtitle })
|
|
24484
24666
|
] });
|
|
24485
24667
|
}
|
|
24486
24668
|
function Footer() {
|
|
24487
|
-
return /* @__PURE__ */ (0,
|
|
24669
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DialogFooter, { className: "mesh-justify-center mesh-text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
24488
24670
|
"a",
|
|
24489
24671
|
{
|
|
24490
24672
|
href: "https://meshjs.dev/",
|
|
24491
24673
|
target: "_blank",
|
|
24492
24674
|
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",
|
|
24493
24675
|
children: [
|
|
24494
|
-
/* @__PURE__ */ (0,
|
|
24495
|
-
/* @__PURE__ */ (0,
|
|
24676
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "", children: "Powered by" }),
|
|
24677
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
24496
24678
|
"svg",
|
|
24497
24679
|
{
|
|
24498
24680
|
width: 24,
|
|
@@ -24500,31 +24682,31 @@ function Footer() {
|
|
|
24500
24682
|
enableBackground: "new 0 0 300 200",
|
|
24501
24683
|
viewBox: "0 0 300 200",
|
|
24502
24684
|
xmlns: "http://www.w3.org/2000/svg",
|
|
24503
|
-
children: /* @__PURE__ */ (0,
|
|
24685
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.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" })
|
|
24504
24686
|
}
|
|
24505
24687
|
),
|
|
24506
|
-
/* @__PURE__ */ (0,
|
|
24688
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "", children: "Mesh SDK" })
|
|
24507
24689
|
]
|
|
24508
24690
|
}
|
|
24509
24691
|
) });
|
|
24510
24692
|
}
|
|
24511
24693
|
|
|
24512
24694
|
// src/mesh-badge/mesh-logo.tsx
|
|
24513
|
-
var
|
|
24514
|
-
var MeshLogo = () => /* @__PURE__ */ (0,
|
|
24695
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
24696
|
+
var MeshLogo = () => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
24515
24697
|
"svg",
|
|
24516
24698
|
{
|
|
24517
24699
|
className: "mesh-h-16 mesh-p-2",
|
|
24518
24700
|
fill: "currentColor",
|
|
24519
24701
|
viewBox: "0 0 300 200",
|
|
24520
24702
|
xmlns: "http://www.w3.org/2000/svg",
|
|
24521
|
-
children: /* @__PURE__ */ (0,
|
|
24703
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.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" })
|
|
24522
24704
|
}
|
|
24523
24705
|
);
|
|
24524
24706
|
|
|
24525
24707
|
// src/mesh-badge/index.tsx
|
|
24526
|
-
var
|
|
24527
|
-
var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ (0,
|
|
24708
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
24709
|
+
var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
24528
24710
|
"a",
|
|
24529
24711
|
{
|
|
24530
24712
|
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`}`,
|
|
@@ -24536,21 +24718,21 @@ var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ (0, import_jsx_runtime17
|
|
|
24536
24718
|
rel: "noopener noreferrer",
|
|
24537
24719
|
target: "_blank",
|
|
24538
24720
|
children: [
|
|
24539
|
-
/* @__PURE__ */ (0,
|
|
24721
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(MeshLogo, {}),
|
|
24540
24722
|
"Mesh"
|
|
24541
24723
|
]
|
|
24542
24724
|
}
|
|
24543
24725
|
);
|
|
24544
24726
|
|
|
24545
24727
|
// src/stake-button/index.tsx
|
|
24546
|
-
var
|
|
24728
|
+
var import_react16 = require("react");
|
|
24547
24729
|
var import_transaction = require("@meshsdk/transaction");
|
|
24548
24730
|
|
|
24549
24731
|
// src/cardano-wallet-dropdown/index.tsx
|
|
24550
|
-
var
|
|
24732
|
+
var import_react15 = require("react");
|
|
24551
24733
|
|
|
24552
24734
|
// src/common/button-dropdown.tsx
|
|
24553
|
-
var
|
|
24735
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
24554
24736
|
function ButtonDropdown({
|
|
24555
24737
|
children,
|
|
24556
24738
|
isDarkMode = false,
|
|
@@ -24559,7 +24741,7 @@ function ButtonDropdown({
|
|
|
24559
24741
|
onMouseEnter,
|
|
24560
24742
|
onMouseLeave
|
|
24561
24743
|
}) {
|
|
24562
|
-
return /* @__PURE__ */ (0,
|
|
24744
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
24563
24745
|
"button",
|
|
24564
24746
|
{
|
|
24565
24747
|
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`}`,
|
|
@@ -24572,21 +24754,21 @@ function ButtonDropdown({
|
|
|
24572
24754
|
}
|
|
24573
24755
|
|
|
24574
24756
|
// src/cardano-wallet-dropdown/menu-item.tsx
|
|
24575
|
-
var
|
|
24757
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
24576
24758
|
function MenuItem({
|
|
24577
24759
|
icon,
|
|
24578
24760
|
label,
|
|
24579
24761
|
action,
|
|
24580
24762
|
active
|
|
24581
24763
|
}) {
|
|
24582
|
-
return /* @__PURE__ */ (0,
|
|
24764
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
24583
24765
|
"div",
|
|
24584
24766
|
{
|
|
24585
24767
|
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",
|
|
24586
24768
|
onClick: action,
|
|
24587
24769
|
children: [
|
|
24588
|
-
icon && /* @__PURE__ */ (0,
|
|
24589
|
-
/* @__PURE__ */ (0,
|
|
24770
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("img", { className: "mesh-pr-2 mesh-m-1 mesh-h-8", src: icon }),
|
|
24771
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.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) => {
|
|
24590
24772
|
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
24591
24773
|
}).join(" ") })
|
|
24592
24774
|
]
|
|
@@ -24595,8 +24777,8 @@ function MenuItem({
|
|
|
24595
24777
|
}
|
|
24596
24778
|
|
|
24597
24779
|
// src/cardano-wallet-dropdown/chevron-down.tsx
|
|
24598
|
-
var
|
|
24599
|
-
var ChevronDown = () => /* @__PURE__ */ (0,
|
|
24780
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
24781
|
+
var ChevronDown = () => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
24600
24782
|
"svg",
|
|
24601
24783
|
{
|
|
24602
24784
|
className: "mesh-m-2 mesh-h-6",
|
|
@@ -24605,7 +24787,7 @@ var ChevronDown = () => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
|
24605
24787
|
viewBox: "0 0 24 24",
|
|
24606
24788
|
stroke: "currentColor",
|
|
24607
24789
|
xmlns: "http://www.w3.org/2000/svg",
|
|
24608
|
-
children: /* @__PURE__ */ (0,
|
|
24790
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
24609
24791
|
"path",
|
|
24610
24792
|
{
|
|
24611
24793
|
strokeLinecap: "round",
|
|
@@ -24618,7 +24800,7 @@ var ChevronDown = () => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
|
24618
24800
|
);
|
|
24619
24801
|
|
|
24620
24802
|
// src/cardano-wallet-dropdown/wallet-balance.tsx
|
|
24621
|
-
var
|
|
24803
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
24622
24804
|
var WalletBalance = ({
|
|
24623
24805
|
connected,
|
|
24624
24806
|
connecting,
|
|
@@ -24626,22 +24808,22 @@ var WalletBalance = ({
|
|
|
24626
24808
|
wallet
|
|
24627
24809
|
}) => {
|
|
24628
24810
|
const lovelace = useLovelace();
|
|
24629
|
-
return connected && lovelace && wallet?.icon ? /* @__PURE__ */ (0,
|
|
24630
|
-
/* @__PURE__ */ (0,
|
|
24811
|
+
return connected && lovelace && wallet?.icon ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
24812
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("img", { className: "mesh-m-2 mesh-h-6", src: wallet.icon }),
|
|
24631
24813
|
"\u20B3",
|
|
24632
24814
|
" ",
|
|
24633
24815
|
parseInt((parseInt(lovelace, 10) / 1e6).toString(), 10),
|
|
24634
24816
|
".",
|
|
24635
|
-
/* @__PURE__ */ (0,
|
|
24636
|
-
] }) : connected && wallet?.icon ? /* @__PURE__ */ (0,
|
|
24817
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "mesh-text-xs", children: lovelace.substring(lovelace.length - 6) })
|
|
24818
|
+
] }) : connected && wallet?.icon ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("img", { className: "mesh-m-2 mesh-h-6", src: wallet.icon }) }) : connecting ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: "Connecting..." }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
24637
24819
|
label,
|
|
24638
24820
|
" ",
|
|
24639
|
-
/* @__PURE__ */ (0,
|
|
24821
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ChevronDown, {})
|
|
24640
24822
|
] });
|
|
24641
24823
|
};
|
|
24642
24824
|
|
|
24643
24825
|
// src/cardano-wallet-dropdown/index.tsx
|
|
24644
|
-
var
|
|
24826
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
24645
24827
|
var CardanoWallet2 = ({
|
|
24646
24828
|
label = "Connect Wallet",
|
|
24647
24829
|
onConnected = void 0,
|
|
@@ -24650,32 +24832,32 @@ var CardanoWallet2 = ({
|
|
|
24650
24832
|
extensions = [],
|
|
24651
24833
|
cardanoPeerConnect = void 0
|
|
24652
24834
|
}) => {
|
|
24653
|
-
const [isDarkMode, setIsDarkMode] = (0,
|
|
24654
|
-
const [hideMenuList, setHideMenuList] = (0,
|
|
24655
|
-
const { connect, connecting, connected, disconnect, name } = useWallet();
|
|
24835
|
+
const [isDarkMode, setIsDarkMode] = (0, import_react15.useState)(false);
|
|
24836
|
+
const [hideMenuList, setHideMenuList] = (0, import_react15.useState)(true);
|
|
24837
|
+
const { connect: connect2, connecting, connected, disconnect, name } = useWallet();
|
|
24656
24838
|
const wallets = useWalletList({ metamask });
|
|
24657
|
-
(0,
|
|
24839
|
+
(0, import_react15.useEffect)(() => {
|
|
24658
24840
|
if (connected && onConnected) {
|
|
24659
24841
|
onConnected();
|
|
24660
24842
|
}
|
|
24661
24843
|
}, [connected]);
|
|
24662
|
-
(0,
|
|
24844
|
+
(0, import_react15.useEffect)(() => {
|
|
24663
24845
|
setIsDarkMode(isDark);
|
|
24664
24846
|
}, [isDark]);
|
|
24665
|
-
return /* @__PURE__ */ (0,
|
|
24847
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
24666
24848
|
"div",
|
|
24667
24849
|
{
|
|
24668
24850
|
onMouseEnter: () => setHideMenuList(false),
|
|
24669
24851
|
onMouseLeave: () => setHideMenuList(true),
|
|
24670
24852
|
style: { width: "min-content", zIndex: 50 },
|
|
24671
24853
|
children: [
|
|
24672
|
-
/* @__PURE__ */ (0,
|
|
24854
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
24673
24855
|
ButtonDropdown,
|
|
24674
24856
|
{
|
|
24675
24857
|
isDarkMode,
|
|
24676
24858
|
hideMenuList,
|
|
24677
24859
|
setHideMenuList,
|
|
24678
|
-
children: /* @__PURE__ */ (0,
|
|
24860
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
24679
24861
|
WalletBalance,
|
|
24680
24862
|
{
|
|
24681
24863
|
connected,
|
|
@@ -24686,24 +24868,24 @@ var CardanoWallet2 = ({
|
|
|
24686
24868
|
)
|
|
24687
24869
|
}
|
|
24688
24870
|
),
|
|
24689
|
-
/* @__PURE__ */ (0,
|
|
24871
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
24690
24872
|
"div",
|
|
24691
24873
|
{
|
|
24692
24874
|
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`}`,
|
|
24693
24875
|
style: { zIndex: 50 },
|
|
24694
|
-
children: !connected && wallets.length > 0 ? /* @__PURE__ */ (0,
|
|
24876
|
+
children: !connected && wallets.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: wallets.map((wallet, index) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
24695
24877
|
MenuItem,
|
|
24696
24878
|
{
|
|
24697
24879
|
icon: wallet.icon,
|
|
24698
24880
|
label: wallet.name,
|
|
24699
24881
|
action: () => {
|
|
24700
|
-
|
|
24882
|
+
connect2(wallet.id, extensions);
|
|
24701
24883
|
setHideMenuList(!hideMenuList);
|
|
24702
24884
|
},
|
|
24703
24885
|
active: name === wallet.id
|
|
24704
24886
|
},
|
|
24705
24887
|
index
|
|
24706
|
-
)) }) : wallets.length === 0 ? /* @__PURE__ */ (0,
|
|
24888
|
+
)) }) : wallets.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "No Wallet Found" }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
24707
24889
|
MenuItem,
|
|
24708
24890
|
{
|
|
24709
24891
|
active: false,
|
|
@@ -24720,7 +24902,7 @@ var CardanoWallet2 = ({
|
|
|
24720
24902
|
};
|
|
24721
24903
|
|
|
24722
24904
|
// src/stake-button/index.tsx
|
|
24723
|
-
var
|
|
24905
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
24724
24906
|
var StakeButton = ({
|
|
24725
24907
|
label = "Stake your ADA",
|
|
24726
24908
|
isDark = false,
|
|
@@ -24728,19 +24910,19 @@ var StakeButton = ({
|
|
|
24728
24910
|
onCheck,
|
|
24729
24911
|
onDelegated = void 0
|
|
24730
24912
|
}) => {
|
|
24731
|
-
const [isDarkMode, setIsDarkMode] = (0,
|
|
24913
|
+
const [isDarkMode, setIsDarkMode] = (0, import_react16.useState)(false);
|
|
24732
24914
|
const { connected } = useWallet();
|
|
24733
|
-
(0,
|
|
24915
|
+
(0, import_react16.useEffect)(() => {
|
|
24734
24916
|
setIsDarkMode(isDark);
|
|
24735
24917
|
}, [isDark]);
|
|
24736
|
-
return /* @__PURE__ */ (0,
|
|
24918
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, { children: connected ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ButtonDropdown, { isDarkMode, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
24737
24919
|
Delegate,
|
|
24738
24920
|
{
|
|
24739
24921
|
poolId,
|
|
24740
24922
|
onCheck,
|
|
24741
24923
|
onDelegated
|
|
24742
24924
|
}
|
|
24743
|
-
) }) : /* @__PURE__ */ (0,
|
|
24925
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CardanoWallet2, { label, isDark }) });
|
|
24744
24926
|
};
|
|
24745
24927
|
var Delegate = ({
|
|
24746
24928
|
poolId,
|
|
@@ -24749,11 +24931,11 @@ var Delegate = ({
|
|
|
24749
24931
|
}) => {
|
|
24750
24932
|
const { wallet } = useWallet();
|
|
24751
24933
|
const rewardAddress = useRewardAddress();
|
|
24752
|
-
const [_, setError] = (0,
|
|
24753
|
-
const [checking, setChecking] = (0,
|
|
24754
|
-
const [accountInfo, setAccountInfo] = (0,
|
|
24755
|
-
const [processing, setProcessing] = (0,
|
|
24756
|
-
const [done, setDone] = (0,
|
|
24934
|
+
const [_, setError] = (0, import_react16.useState)();
|
|
24935
|
+
const [checking, setChecking] = (0, import_react16.useState)(false);
|
|
24936
|
+
const [accountInfo, setAccountInfo] = (0, import_react16.useState)();
|
|
24937
|
+
const [processing, setProcessing] = (0, import_react16.useState)(false);
|
|
24938
|
+
const [done, setDone] = (0, import_react16.useState)(false);
|
|
24757
24939
|
const checkAccountStatus = async () => {
|
|
24758
24940
|
try {
|
|
24759
24941
|
setChecking(true);
|
|
@@ -24804,22 +24986,22 @@ var Delegate = ({
|
|
|
24804
24986
|
}
|
|
24805
24987
|
setProcessing(false);
|
|
24806
24988
|
};
|
|
24807
|
-
(0,
|
|
24989
|
+
(0, import_react16.useEffect)(() => {
|
|
24808
24990
|
checkAccountStatus();
|
|
24809
24991
|
}, [rewardAddress]);
|
|
24810
24992
|
if (checking) {
|
|
24811
|
-
return /* @__PURE__ */ (0,
|
|
24993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Checking..." });
|
|
24812
24994
|
}
|
|
24813
24995
|
if (processing) {
|
|
24814
|
-
return /* @__PURE__ */ (0,
|
|
24996
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Loading..." });
|
|
24815
24997
|
}
|
|
24816
24998
|
if (done) {
|
|
24817
|
-
return /* @__PURE__ */ (0,
|
|
24999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Stake Delegated" });
|
|
24818
25000
|
}
|
|
24819
25001
|
if (accountInfo?.active) {
|
|
24820
|
-
return accountInfo.poolId === poolId ? /* @__PURE__ */ (0,
|
|
25002
|
+
return accountInfo.poolId === poolId ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Stake Delegated" }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { onClick: delegateStake, children: "Begin Staking" });
|
|
24821
25003
|
}
|
|
24822
|
-
return /* @__PURE__ */ (0,
|
|
25004
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { onClick: registerAddress, children: "Begin Staking" });
|
|
24823
25005
|
};
|
|
24824
25006
|
// Annotate the CommonJS export names for ESM import in node:
|
|
24825
25007
|
0 && (module.exports = {
|