@meshsdk/react 1.8.5 → 1.8.6
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.js
CHANGED
|
@@ -23432,7 +23432,7 @@ var require_dist = __commonJS({
|
|
|
23432
23432
|
});
|
|
23433
23433
|
|
|
23434
23434
|
// src/cardano-wallet/index.tsx
|
|
23435
|
-
import { useEffect as useEffect10, useState as
|
|
23435
|
+
import { useEffect as useEffect10, useState as useState13 } from "react";
|
|
23436
23436
|
|
|
23437
23437
|
// src/common/button.tsx
|
|
23438
23438
|
import * as React from "react";
|
|
@@ -24036,6 +24036,10 @@ var screens = {
|
|
|
24036
24036
|
burner: {
|
|
24037
24037
|
title: "Burner Wallet",
|
|
24038
24038
|
subtitle: "Instantly create a new burner wallet. No seed phrase required, keys are generated on your device."
|
|
24039
|
+
},
|
|
24040
|
+
webauthn: {
|
|
24041
|
+
title: "Passkey",
|
|
24042
|
+
subtitle: "Derive self-custody wallet on Chrome, Safari, or Firefox browsers on Android, iOS, macOS, and Windows devices, or using password managers."
|
|
24039
24043
|
}
|
|
24040
24044
|
};
|
|
24041
24045
|
|
|
@@ -24188,10 +24192,47 @@ function IconDownload() {
|
|
|
24188
24192
|
);
|
|
24189
24193
|
}
|
|
24190
24194
|
|
|
24191
|
-
// src/common/icons/icon-
|
|
24195
|
+
// src/common/icons/icon-fingerprint.tsx
|
|
24192
24196
|
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
24193
|
-
function
|
|
24197
|
+
function IconFingerprint() {
|
|
24194
24198
|
return /* @__PURE__ */ jsxs7(
|
|
24199
|
+
"svg",
|
|
24200
|
+
{
|
|
24201
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
24202
|
+
width: "24",
|
|
24203
|
+
height: "24",
|
|
24204
|
+
viewBox: "0 0 24 24",
|
|
24205
|
+
fill: "none",
|
|
24206
|
+
stroke: "currentColor",
|
|
24207
|
+
strokeWidth: "2",
|
|
24208
|
+
strokeLinecap: "round",
|
|
24209
|
+
strokeLinejoin: "round",
|
|
24210
|
+
style: {
|
|
24211
|
+
color: "#ffadff",
|
|
24212
|
+
width: "24px",
|
|
24213
|
+
height: "24px",
|
|
24214
|
+
strokeWidth: "1px"
|
|
24215
|
+
},
|
|
24216
|
+
className: "hover:mesh-fill-white",
|
|
24217
|
+
children: [
|
|
24218
|
+
/* @__PURE__ */ jsx10("path", { d: "M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4" }),
|
|
24219
|
+
/* @__PURE__ */ jsx10("path", { d: "M14 13.12c0 2.38 0 6.38-1 8.88" }),
|
|
24220
|
+
/* @__PURE__ */ jsx10("path", { d: "M17.29 21.02c.12-.6.43-2.3.5-3.02" }),
|
|
24221
|
+
/* @__PURE__ */ jsx10("path", { d: "M2 12a10 10 0 0 1 18-6" }),
|
|
24222
|
+
/* @__PURE__ */ jsx10("path", { d: "M2 16h.01" }),
|
|
24223
|
+
/* @__PURE__ */ jsx10("path", { d: "M21.8 16c.2-2 .131-5.354 0-6" }),
|
|
24224
|
+
/* @__PURE__ */ jsx10("path", { d: "M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2" }),
|
|
24225
|
+
/* @__PURE__ */ jsx10("path", { d: "M8.65 22c.21-.66.45-1.32.57-2" }),
|
|
24226
|
+
/* @__PURE__ */ jsx10("path", { d: "M9 6.8a6 6 0 0 1 9 5.2v2" })
|
|
24227
|
+
]
|
|
24228
|
+
}
|
|
24229
|
+
);
|
|
24230
|
+
}
|
|
24231
|
+
|
|
24232
|
+
// src/common/icons/icon-monitor-smartphone.tsx
|
|
24233
|
+
import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
24234
|
+
function IconMonitorSmartphone() {
|
|
24235
|
+
return /* @__PURE__ */ jsxs8(
|
|
24195
24236
|
"svg",
|
|
24196
24237
|
{
|
|
24197
24238
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -24210,10 +24251,10 @@ function IconMonitorSmartphone() {
|
|
|
24210
24251
|
strokeWidth: "1px"
|
|
24211
24252
|
},
|
|
24212
24253
|
children: [
|
|
24213
|
-
/* @__PURE__ */
|
|
24214
|
-
/* @__PURE__ */
|
|
24215
|
-
/* @__PURE__ */
|
|
24216
|
-
/* @__PURE__ */
|
|
24254
|
+
/* @__PURE__ */ jsx11("path", { d: "M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8" }),
|
|
24255
|
+
/* @__PURE__ */ jsx11("path", { d: "M10 19v-3.96 3.15" }),
|
|
24256
|
+
/* @__PURE__ */ jsx11("path", { d: "M7 19h5" }),
|
|
24257
|
+
/* @__PURE__ */ jsx11("rect", { width: "6", height: "10", x: "16", y: "12", rx: "2" })
|
|
24217
24258
|
]
|
|
24218
24259
|
}
|
|
24219
24260
|
);
|
|
@@ -24222,11 +24263,11 @@ function IconMonitorSmartphone() {
|
|
|
24222
24263
|
// src/common/tooltip.tsx
|
|
24223
24264
|
import * as React4 from "react";
|
|
24224
24265
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
24225
|
-
import { jsx as
|
|
24266
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
24226
24267
|
var TooltipProvider = TooltipPrimitive.Provider;
|
|
24227
24268
|
var Tooltip = TooltipPrimitive.Root;
|
|
24228
24269
|
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
24229
|
-
var TooltipContent = React4.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */
|
|
24270
|
+
var TooltipContent = React4.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx12(
|
|
24230
24271
|
TooltipPrimitive.Content,
|
|
24231
24272
|
{
|
|
24232
24273
|
ref,
|
|
@@ -24241,55 +24282,66 @@ var TooltipContent = React4.forwardRef(({ className, sideOffset = 4, ...props },
|
|
|
24241
24282
|
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
24242
24283
|
|
|
24243
24284
|
// src/cardano-wallet/wallet-icon.tsx
|
|
24244
|
-
import { jsx as
|
|
24285
|
+
import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
24245
24286
|
function WalletIcon({
|
|
24246
24287
|
icon,
|
|
24247
24288
|
name,
|
|
24248
24289
|
action,
|
|
24249
24290
|
iconReactNode
|
|
24250
24291
|
}) {
|
|
24251
|
-
return /* @__PURE__ */
|
|
24252
|
-
/* @__PURE__ */
|
|
24292
|
+
return /* @__PURE__ */ jsxs9(Tooltip, { delayDuration: 0, defaultOpen: false, children: [
|
|
24293
|
+
/* @__PURE__ */ jsx13(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs9(
|
|
24253
24294
|
"button",
|
|
24254
24295
|
{
|
|
24255
24296
|
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",
|
|
24256
24297
|
onClick: action,
|
|
24257
24298
|
children: [
|
|
24258
|
-
icon && /* @__PURE__ */
|
|
24299
|
+
icon && /* @__PURE__ */ jsx13("img", { src: icon, alt: name, className: "mesh-w-8 mesh-h-8" }),
|
|
24259
24300
|
iconReactNode && iconReactNode
|
|
24260
24301
|
]
|
|
24261
24302
|
}
|
|
24262
24303
|
) }),
|
|
24263
|
-
/* @__PURE__ */
|
|
24304
|
+
/* @__PURE__ */ jsx13(TooltipContent, { children: /* @__PURE__ */ jsx13("p", { children: name }) })
|
|
24264
24305
|
] });
|
|
24265
24306
|
}
|
|
24266
24307
|
|
|
24267
24308
|
// src/cardano-wallet/screen-main.tsx
|
|
24268
|
-
import { jsx as
|
|
24309
|
+
import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
24269
24310
|
function ScreenMain({
|
|
24270
24311
|
metamask,
|
|
24271
24312
|
extensions,
|
|
24272
24313
|
setOpen,
|
|
24273
24314
|
setScreen,
|
|
24274
24315
|
cardanoPeerConnect,
|
|
24275
|
-
burnerWallet
|
|
24316
|
+
burnerWallet,
|
|
24317
|
+
webauthn
|
|
24276
24318
|
}) {
|
|
24277
24319
|
const wallets = useWalletList({ metamask });
|
|
24278
|
-
const { connect } = useWallet();
|
|
24279
|
-
return /* @__PURE__ */
|
|
24280
|
-
wallets.map((wallet, index) => /* @__PURE__ */
|
|
24320
|
+
const { connect: connect2 } = useWallet();
|
|
24321
|
+
return /* @__PURE__ */ jsx14(TooltipProvider, { children: /* @__PURE__ */ jsxs10("div", { className: "mesh-grid mesh-gap-4 mesh-py-4 mesh-grid-cols-5 mesh-place-items-center mesh-gap-y-8", children: [
|
|
24322
|
+
wallets.map((wallet, index) => /* @__PURE__ */ jsx14(
|
|
24281
24323
|
WalletIcon,
|
|
24282
24324
|
{
|
|
24283
24325
|
icon: wallet.icon,
|
|
24284
24326
|
name: wallet.name,
|
|
24285
24327
|
action: () => {
|
|
24286
|
-
|
|
24328
|
+
connect2(wallet.id, extensions);
|
|
24287
24329
|
setOpen(false);
|
|
24288
24330
|
}
|
|
24289
24331
|
},
|
|
24290
24332
|
index
|
|
24291
24333
|
)),
|
|
24292
|
-
|
|
24334
|
+
webauthn && /* @__PURE__ */ jsx14(
|
|
24335
|
+
WalletIcon,
|
|
24336
|
+
{
|
|
24337
|
+
iconReactNode: IconFingerprint(),
|
|
24338
|
+
name: screens.webauthn.title,
|
|
24339
|
+
action: () => {
|
|
24340
|
+
setScreen("webauthn");
|
|
24341
|
+
}
|
|
24342
|
+
}
|
|
24343
|
+
),
|
|
24344
|
+
cardanoPeerConnect && /* @__PURE__ */ jsx14(
|
|
24293
24345
|
WalletIcon,
|
|
24294
24346
|
{
|
|
24295
24347
|
iconReactNode: IconMonitorSmartphone(),
|
|
@@ -24299,7 +24351,7 @@ function ScreenMain({
|
|
|
24299
24351
|
}
|
|
24300
24352
|
}
|
|
24301
24353
|
),
|
|
24302
|
-
burnerWallet && /* @__PURE__ */
|
|
24354
|
+
burnerWallet && /* @__PURE__ */ jsx14(
|
|
24303
24355
|
WalletIcon,
|
|
24304
24356
|
{
|
|
24305
24357
|
iconReactNode: IconBookDashed(),
|
|
@@ -24309,7 +24361,7 @@ function ScreenMain({
|
|
|
24309
24361
|
}
|
|
24310
24362
|
}
|
|
24311
24363
|
),
|
|
24312
|
-
/* @__PURE__ */
|
|
24364
|
+
/* @__PURE__ */ jsx14(
|
|
24313
24365
|
WalletIcon,
|
|
24314
24366
|
{
|
|
24315
24367
|
iconReactNode: IconDownload(),
|
|
@@ -24328,7 +24380,7 @@ function ScreenMain({
|
|
|
24328
24380
|
// src/cardano-wallet/screen-p2p.tsx
|
|
24329
24381
|
var import_cardano_peer_connect = __toESM(require_dist(), 1);
|
|
24330
24382
|
import { useEffect as useEffect9, useRef as useRef2, useState as useState11 } from "react";
|
|
24331
|
-
import { jsx as
|
|
24383
|
+
import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
24332
24384
|
function ScreenP2P({
|
|
24333
24385
|
cardanoPeerConnect,
|
|
24334
24386
|
setOpen
|
|
@@ -24337,7 +24389,7 @@ function ScreenP2P({
|
|
|
24337
24389
|
const qrCodeField = useRef2(null);
|
|
24338
24390
|
const [address, setAddress] = useState11("");
|
|
24339
24391
|
const [copied, setCopied] = useState11(false);
|
|
24340
|
-
const { connect } = useWallet();
|
|
24392
|
+
const { connect: connect2 } = useWallet();
|
|
24341
24393
|
useEffect9(() => {
|
|
24342
24394
|
if (cardanoPeerConnect) {
|
|
24343
24395
|
if (dAppConnect.current === null) {
|
|
@@ -24348,7 +24400,7 @@ function ScreenP2P({
|
|
|
24348
24400
|
},
|
|
24349
24401
|
announce: cardanoPeerConnect.announce,
|
|
24350
24402
|
onApiInject: async (name, address2) => {
|
|
24351
|
-
await
|
|
24403
|
+
await connect2(name);
|
|
24352
24404
|
setOpen(false);
|
|
24353
24405
|
},
|
|
24354
24406
|
onApiEject: (name, address2) => {
|
|
@@ -24372,9 +24424,9 @@ function ScreenP2P({
|
|
|
24372
24424
|
}
|
|
24373
24425
|
}
|
|
24374
24426
|
}, []);
|
|
24375
|
-
return /* @__PURE__ */
|
|
24376
|
-
/* @__PURE__ */
|
|
24377
|
-
/* @__PURE__ */
|
|
24427
|
+
return /* @__PURE__ */ jsxs11("div", { className: "mesh-flex mesh-flex-col mesh-items-center mesh-justify-center", children: [
|
|
24428
|
+
/* @__PURE__ */ jsx15("div", { style: { marginTop: 16, marginBottom: 16 }, ref: qrCodeField }),
|
|
24429
|
+
/* @__PURE__ */ jsx15(
|
|
24378
24430
|
Button,
|
|
24379
24431
|
{
|
|
24380
24432
|
variant: "outline",
|
|
@@ -24389,8 +24441,127 @@ function ScreenP2P({
|
|
|
24389
24441
|
] });
|
|
24390
24442
|
}
|
|
24391
24443
|
|
|
24444
|
+
// src/cardano-wallet/screen-webauthn.tsx
|
|
24445
|
+
import { useState as useState12 } from "react";
|
|
24446
|
+
import { connect, MeshWallet as MeshWallet2 } from "@meshsdk/wallet";
|
|
24447
|
+
|
|
24448
|
+
// src/common/input.tsx
|
|
24449
|
+
import * as React5 from "react";
|
|
24450
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
24451
|
+
var Input = React5.forwardRef(
|
|
24452
|
+
({ className, type, ...props }, ref) => {
|
|
24453
|
+
return /* @__PURE__ */ jsx16(
|
|
24454
|
+
"input",
|
|
24455
|
+
{
|
|
24456
|
+
type,
|
|
24457
|
+
className: cn(
|
|
24458
|
+
"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",
|
|
24459
|
+
className
|
|
24460
|
+
),
|
|
24461
|
+
ref,
|
|
24462
|
+
...props
|
|
24463
|
+
}
|
|
24464
|
+
);
|
|
24465
|
+
}
|
|
24466
|
+
);
|
|
24467
|
+
Input.displayName = "Input";
|
|
24468
|
+
|
|
24469
|
+
// src/common/label.tsx
|
|
24470
|
+
import * as React6 from "react";
|
|
24471
|
+
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
24472
|
+
import { cva as cva2 } from "class-variance-authority";
|
|
24473
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
24474
|
+
var labelVariants = cva2(
|
|
24475
|
+
"mesh-text-sm mesh-font-medium mesh-leading-none peer-disabled:mesh-cursor-not-allowed peer-disabled:mesh-opacity-70"
|
|
24476
|
+
);
|
|
24477
|
+
var Label2 = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx17(
|
|
24478
|
+
LabelPrimitive.Root,
|
|
24479
|
+
{
|
|
24480
|
+
ref,
|
|
24481
|
+
className: cn(labelVariants(), className),
|
|
24482
|
+
...props
|
|
24483
|
+
}
|
|
24484
|
+
));
|
|
24485
|
+
Label2.displayName = LabelPrimitive.Root.displayName;
|
|
24486
|
+
|
|
24487
|
+
// src/cardano-wallet/screen-webauthn.tsx
|
|
24488
|
+
import { Fragment as Fragment3, jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
24489
|
+
function ScreenWebauthn({
|
|
24490
|
+
url,
|
|
24491
|
+
networkId,
|
|
24492
|
+
provider,
|
|
24493
|
+
setOpen
|
|
24494
|
+
}) {
|
|
24495
|
+
const [loading, setLoading] = useState12(false);
|
|
24496
|
+
const [userName, setUserName] = useState12("");
|
|
24497
|
+
const [password, setPassword] = useState12("");
|
|
24498
|
+
const { setWallet } = useWallet();
|
|
24499
|
+
function createWallet(root) {
|
|
24500
|
+
setTimeout(() => {
|
|
24501
|
+
const wallet = new MeshWallet2({
|
|
24502
|
+
networkId,
|
|
24503
|
+
fetcher: provider,
|
|
24504
|
+
submitter: provider,
|
|
24505
|
+
key: {
|
|
24506
|
+
type: "root",
|
|
24507
|
+
bech32: root
|
|
24508
|
+
}
|
|
24509
|
+
});
|
|
24510
|
+
setWallet(wallet, screens.webauthn.title);
|
|
24511
|
+
setLoading(false);
|
|
24512
|
+
setOpen(false);
|
|
24513
|
+
}, 500);
|
|
24514
|
+
}
|
|
24515
|
+
async function handleConnect() {
|
|
24516
|
+
setLoading(true);
|
|
24517
|
+
const res = await connect({ username: userName, password, serverUrl: url });
|
|
24518
|
+
if (res.success && res.wallet) {
|
|
24519
|
+
createWallet(res.wallet.bech32PrivateKey);
|
|
24520
|
+
}
|
|
24521
|
+
}
|
|
24522
|
+
return /* @__PURE__ */ jsx18("div", { className: "mesh-flex mesh-flex-row mesh-flex-gap-4 mesh-items-center mesh-justify-center", children: loading ? /* @__PURE__ */ jsx18(Fragment3, { children: "Connecting wallet..." }) : /* @__PURE__ */ jsx18(Fragment3, { children: /* @__PURE__ */ jsxs12("div", { className: "mesh-flex mesh-flex-col mesh-gap-6 mesh-w-full mesh-mx-8", children: [
|
|
24523
|
+
/* @__PURE__ */ jsxs12("div", { className: "mesh-grid mesh-gap-2", children: [
|
|
24524
|
+
/* @__PURE__ */ jsx18(Label2, { htmlFor: "username", children: "Username" }),
|
|
24525
|
+
/* @__PURE__ */ jsx18(
|
|
24526
|
+
Input,
|
|
24527
|
+
{
|
|
24528
|
+
id: "username",
|
|
24529
|
+
type: "username",
|
|
24530
|
+
placeholder: "adalovelace",
|
|
24531
|
+
value: userName,
|
|
24532
|
+
onChange: (e2) => setUserName(e2.target.value)
|
|
24533
|
+
}
|
|
24534
|
+
),
|
|
24535
|
+
/* @__PURE__ */ jsx18("p", { className: "mesh-text-gray-500 mesh-text-xs", children: "Unique to the application you are connecting." })
|
|
24536
|
+
] }),
|
|
24537
|
+
/* @__PURE__ */ jsxs12("div", { className: "mesh-grid mesh-gap-2", children: [
|
|
24538
|
+
/* @__PURE__ */ jsx18("div", { className: "mesh-flex mesh-items-center", children: /* @__PURE__ */ jsx18(Label2, { htmlFor: "password", children: "Unique Code" }) }),
|
|
24539
|
+
/* @__PURE__ */ jsx18(
|
|
24540
|
+
Input,
|
|
24541
|
+
{
|
|
24542
|
+
id: "password",
|
|
24543
|
+
type: "password",
|
|
24544
|
+
placeholder: "********",
|
|
24545
|
+
value: password,
|
|
24546
|
+
onChange: (e2) => setPassword(e2.target.value)
|
|
24547
|
+
}
|
|
24548
|
+
),
|
|
24549
|
+
/* @__PURE__ */ jsx18("p", { className: "mesh-text-gray-500 mesh-text-xs", children: "Additional security to derive your wallet." })
|
|
24550
|
+
] }),
|
|
24551
|
+
/* @__PURE__ */ jsx18(
|
|
24552
|
+
Button,
|
|
24553
|
+
{
|
|
24554
|
+
className: "mesh-w-full",
|
|
24555
|
+
onClick: () => handleConnect(),
|
|
24556
|
+
disabled: !userName || userName.length < 6,
|
|
24557
|
+
children: "Connect"
|
|
24558
|
+
}
|
|
24559
|
+
)
|
|
24560
|
+
] }) }) });
|
|
24561
|
+
}
|
|
24562
|
+
|
|
24392
24563
|
// src/cardano-wallet/index.tsx
|
|
24393
|
-
import { jsx as
|
|
24564
|
+
import { jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
24394
24565
|
var CardanoWallet = ({
|
|
24395
24566
|
label = "Connect Wallet",
|
|
24396
24567
|
onConnected = void 0,
|
|
@@ -24398,26 +24569,27 @@ var CardanoWallet = ({
|
|
|
24398
24569
|
extensions = [],
|
|
24399
24570
|
metamask = void 0,
|
|
24400
24571
|
cardanoPeerConnect = void 0,
|
|
24401
|
-
burnerWallet = void 0
|
|
24572
|
+
burnerWallet = void 0,
|
|
24573
|
+
webauthn = void 0
|
|
24402
24574
|
}) => {
|
|
24403
|
-
const [open, setOpen] =
|
|
24404
|
-
const [screen, setScreen] =
|
|
24575
|
+
const [open, setOpen] = useState13(false);
|
|
24576
|
+
const [screen, setScreen] = useState13("main");
|
|
24405
24577
|
const { wallet, connected } = useWallet();
|
|
24406
24578
|
useEffect10(() => {
|
|
24407
|
-
if (connected
|
|
24579
|
+
if (connected) {
|
|
24408
24580
|
if (onConnected) onConnected();
|
|
24409
24581
|
}
|
|
24410
24582
|
}, [connected, wallet]);
|
|
24411
|
-
return /* @__PURE__ */
|
|
24412
|
-
!connected ? /* @__PURE__ */
|
|
24413
|
-
/* @__PURE__ */
|
|
24583
|
+
return /* @__PURE__ */ jsxs13(Dialog, { open, onOpenChange: setOpen, children: [
|
|
24584
|
+
!connected ? /* @__PURE__ */ jsx19(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsx19(Button, { variant: "outline", className: "mesh-text-white", children: label }) }) : /* @__PURE__ */ jsx19(ConnectedButton, {}),
|
|
24585
|
+
/* @__PURE__ */ jsxs13(
|
|
24414
24586
|
DialogContent,
|
|
24415
24587
|
{
|
|
24416
24588
|
className: "sm:mesh-max-w-[425px]",
|
|
24417
24589
|
onOpenAutoFocus: (event) => event.preventDefault(),
|
|
24418
24590
|
children: [
|
|
24419
|
-
/* @__PURE__ */
|
|
24420
|
-
screen == "main" && /* @__PURE__ */
|
|
24591
|
+
/* @__PURE__ */ jsx19(Header, { screen, setScreen }),
|
|
24592
|
+
screen == "main" && /* @__PURE__ */ jsx19(
|
|
24421
24593
|
ScreenMain,
|
|
24422
24594
|
{
|
|
24423
24595
|
metamask,
|
|
@@ -24425,17 +24597,18 @@ var CardanoWallet = ({
|
|
|
24425
24597
|
setOpen,
|
|
24426
24598
|
setScreen,
|
|
24427
24599
|
cardanoPeerConnect: cardanoPeerConnect != void 0,
|
|
24428
|
-
burnerWallet: burnerWallet != void 0
|
|
24600
|
+
burnerWallet: burnerWallet != void 0,
|
|
24601
|
+
webauthn: webauthn != void 0
|
|
24429
24602
|
}
|
|
24430
24603
|
),
|
|
24431
|
-
screen == "p2p" && /* @__PURE__ */
|
|
24604
|
+
screen == "p2p" && /* @__PURE__ */ jsx19(
|
|
24432
24605
|
ScreenP2P,
|
|
24433
24606
|
{
|
|
24434
24607
|
cardanoPeerConnect,
|
|
24435
24608
|
setOpen
|
|
24436
24609
|
}
|
|
24437
24610
|
),
|
|
24438
|
-
screen == "burner" && burnerWallet && /* @__PURE__ */
|
|
24611
|
+
screen == "burner" && burnerWallet && /* @__PURE__ */ jsx19(
|
|
24439
24612
|
ScreenBurner,
|
|
24440
24613
|
{
|
|
24441
24614
|
networkId: burnerWallet.networkId,
|
|
@@ -24443,7 +24616,16 @@ var CardanoWallet = ({
|
|
|
24443
24616
|
setOpen
|
|
24444
24617
|
}
|
|
24445
24618
|
),
|
|
24446
|
-
/* @__PURE__ */
|
|
24619
|
+
screen == "webauthn" && webauthn && /* @__PURE__ */ jsx19(
|
|
24620
|
+
ScreenWebauthn,
|
|
24621
|
+
{
|
|
24622
|
+
url: webauthn.url,
|
|
24623
|
+
networkId: webauthn.networkId,
|
|
24624
|
+
provider: webauthn.provider,
|
|
24625
|
+
setOpen
|
|
24626
|
+
}
|
|
24627
|
+
),
|
|
24628
|
+
/* @__PURE__ */ jsx19(Footer, {})
|
|
24447
24629
|
]
|
|
24448
24630
|
}
|
|
24449
24631
|
)
|
|
@@ -24453,25 +24635,25 @@ function Header({
|
|
|
24453
24635
|
screen,
|
|
24454
24636
|
setScreen
|
|
24455
24637
|
}) {
|
|
24456
|
-
return /* @__PURE__ */
|
|
24457
|
-
/* @__PURE__ */
|
|
24458
|
-
screen != "main" ? /* @__PURE__ */
|
|
24459
|
-
/* @__PURE__ */
|
|
24460
|
-
/* @__PURE__ */
|
|
24638
|
+
return /* @__PURE__ */ jsxs13(DialogHeader, { children: [
|
|
24639
|
+
/* @__PURE__ */ jsxs13(DialogTitle, { className: "mesh-flex mesh-justify-between", children: [
|
|
24640
|
+
screen != "main" ? /* @__PURE__ */ jsx19("button", { onClick: () => setScreen("main"), children: /* @__PURE__ */ jsx19(IconChevronRight, {}) }) : /* @__PURE__ */ jsx19("span", { style: { width: "24px" } }),
|
|
24641
|
+
/* @__PURE__ */ jsx19("span", { children: screens[screen].title }),
|
|
24642
|
+
/* @__PURE__ */ jsx19("span", { style: { width: "24px" } })
|
|
24461
24643
|
] }),
|
|
24462
|
-
/* @__PURE__ */
|
|
24644
|
+
/* @__PURE__ */ jsx19(DialogDescription, { children: screens[screen].subtitle && screens[screen].subtitle })
|
|
24463
24645
|
] });
|
|
24464
24646
|
}
|
|
24465
24647
|
function Footer() {
|
|
24466
|
-
return /* @__PURE__ */
|
|
24648
|
+
return /* @__PURE__ */ jsx19(DialogFooter, { className: "mesh-justify-center mesh-text-sm", children: /* @__PURE__ */ jsxs13(
|
|
24467
24649
|
"a",
|
|
24468
24650
|
{
|
|
24469
24651
|
href: "https://meshjs.dev/",
|
|
24470
24652
|
target: "_blank",
|
|
24471
24653
|
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",
|
|
24472
24654
|
children: [
|
|
24473
|
-
/* @__PURE__ */
|
|
24474
|
-
/* @__PURE__ */
|
|
24655
|
+
/* @__PURE__ */ jsx19("span", { className: "", children: "Powered by" }),
|
|
24656
|
+
/* @__PURE__ */ jsx19(
|
|
24475
24657
|
"svg",
|
|
24476
24658
|
{
|
|
24477
24659
|
width: 24,
|
|
@@ -24479,31 +24661,31 @@ function Footer() {
|
|
|
24479
24661
|
enableBackground: "new 0 0 300 200",
|
|
24480
24662
|
viewBox: "0 0 300 200",
|
|
24481
24663
|
xmlns: "http://www.w3.org/2000/svg",
|
|
24482
|
-
children: /* @__PURE__ */
|
|
24664
|
+
children: /* @__PURE__ */ jsx19("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" })
|
|
24483
24665
|
}
|
|
24484
24666
|
),
|
|
24485
|
-
/* @__PURE__ */
|
|
24667
|
+
/* @__PURE__ */ jsx19("span", { className: "", children: "Mesh SDK" })
|
|
24486
24668
|
]
|
|
24487
24669
|
}
|
|
24488
24670
|
) });
|
|
24489
24671
|
}
|
|
24490
24672
|
|
|
24491
24673
|
// src/mesh-badge/mesh-logo.tsx
|
|
24492
|
-
import { jsx as
|
|
24493
|
-
var MeshLogo = () => /* @__PURE__ */
|
|
24674
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
24675
|
+
var MeshLogo = () => /* @__PURE__ */ jsx20(
|
|
24494
24676
|
"svg",
|
|
24495
24677
|
{
|
|
24496
24678
|
className: "mesh-h-16 mesh-p-2",
|
|
24497
24679
|
fill: "currentColor",
|
|
24498
24680
|
viewBox: "0 0 300 200",
|
|
24499
24681
|
xmlns: "http://www.w3.org/2000/svg",
|
|
24500
|
-
children: /* @__PURE__ */
|
|
24682
|
+
children: /* @__PURE__ */ jsx20("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" })
|
|
24501
24683
|
}
|
|
24502
24684
|
);
|
|
24503
24685
|
|
|
24504
24686
|
// src/mesh-badge/index.tsx
|
|
24505
|
-
import { jsx as
|
|
24506
|
-
var MeshBadge = ({ isDark = false }) => /* @__PURE__ */
|
|
24687
|
+
import { jsx as jsx21, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
24688
|
+
var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ jsxs14(
|
|
24507
24689
|
"a",
|
|
24508
24690
|
{
|
|
24509
24691
|
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`}`,
|
|
@@ -24515,21 +24697,21 @@ var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ jsxs12(
|
|
|
24515
24697
|
rel: "noopener noreferrer",
|
|
24516
24698
|
target: "_blank",
|
|
24517
24699
|
children: [
|
|
24518
|
-
/* @__PURE__ */
|
|
24700
|
+
/* @__PURE__ */ jsx21(MeshLogo, {}),
|
|
24519
24701
|
"Mesh"
|
|
24520
24702
|
]
|
|
24521
24703
|
}
|
|
24522
24704
|
);
|
|
24523
24705
|
|
|
24524
24706
|
// src/stake-button/index.tsx
|
|
24525
|
-
import { useEffect as useEffect12, useState as
|
|
24707
|
+
import { useEffect as useEffect12, useState as useState15 } from "react";
|
|
24526
24708
|
import { Transaction } from "@meshsdk/transaction";
|
|
24527
24709
|
|
|
24528
24710
|
// src/cardano-wallet-dropdown/index.tsx
|
|
24529
|
-
import { useEffect as useEffect11, useState as
|
|
24711
|
+
import { useEffect as useEffect11, useState as useState14 } from "react";
|
|
24530
24712
|
|
|
24531
24713
|
// src/common/button-dropdown.tsx
|
|
24532
|
-
import { jsx as
|
|
24714
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
24533
24715
|
function ButtonDropdown({
|
|
24534
24716
|
children,
|
|
24535
24717
|
isDarkMode = false,
|
|
@@ -24538,7 +24720,7 @@ function ButtonDropdown({
|
|
|
24538
24720
|
onMouseEnter,
|
|
24539
24721
|
onMouseLeave
|
|
24540
24722
|
}) {
|
|
24541
|
-
return /* @__PURE__ */
|
|
24723
|
+
return /* @__PURE__ */ jsx22(
|
|
24542
24724
|
"button",
|
|
24543
24725
|
{
|
|
24544
24726
|
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`}`,
|
|
@@ -24551,21 +24733,21 @@ function ButtonDropdown({
|
|
|
24551
24733
|
}
|
|
24552
24734
|
|
|
24553
24735
|
// src/cardano-wallet-dropdown/menu-item.tsx
|
|
24554
|
-
import { jsx as
|
|
24736
|
+
import { jsx as jsx23, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
24555
24737
|
function MenuItem({
|
|
24556
24738
|
icon,
|
|
24557
24739
|
label,
|
|
24558
24740
|
action,
|
|
24559
24741
|
active
|
|
24560
24742
|
}) {
|
|
24561
|
-
return /* @__PURE__ */
|
|
24743
|
+
return /* @__PURE__ */ jsxs15(
|
|
24562
24744
|
"div",
|
|
24563
24745
|
{
|
|
24564
24746
|
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",
|
|
24565
24747
|
onClick: action,
|
|
24566
24748
|
children: [
|
|
24567
|
-
icon && /* @__PURE__ */
|
|
24568
|
-
/* @__PURE__ */
|
|
24749
|
+
icon && /* @__PURE__ */ jsx23("img", { className: "mesh-pr-2 mesh-m-1 mesh-h-8", src: icon }),
|
|
24750
|
+
/* @__PURE__ */ jsx23("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) => {
|
|
24569
24751
|
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
24570
24752
|
}).join(" ") })
|
|
24571
24753
|
]
|
|
@@ -24574,8 +24756,8 @@ function MenuItem({
|
|
|
24574
24756
|
}
|
|
24575
24757
|
|
|
24576
24758
|
// src/cardano-wallet-dropdown/chevron-down.tsx
|
|
24577
|
-
import { jsx as
|
|
24578
|
-
var ChevronDown = () => /* @__PURE__ */
|
|
24759
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
24760
|
+
var ChevronDown = () => /* @__PURE__ */ jsx24(
|
|
24579
24761
|
"svg",
|
|
24580
24762
|
{
|
|
24581
24763
|
className: "mesh-m-2 mesh-h-6",
|
|
@@ -24584,7 +24766,7 @@ var ChevronDown = () => /* @__PURE__ */ jsx20(
|
|
|
24584
24766
|
viewBox: "0 0 24 24",
|
|
24585
24767
|
stroke: "currentColor",
|
|
24586
24768
|
xmlns: "http://www.w3.org/2000/svg",
|
|
24587
|
-
children: /* @__PURE__ */
|
|
24769
|
+
children: /* @__PURE__ */ jsx24(
|
|
24588
24770
|
"path",
|
|
24589
24771
|
{
|
|
24590
24772
|
strokeLinecap: "round",
|
|
@@ -24597,7 +24779,7 @@ var ChevronDown = () => /* @__PURE__ */ jsx20(
|
|
|
24597
24779
|
);
|
|
24598
24780
|
|
|
24599
24781
|
// src/cardano-wallet-dropdown/wallet-balance.tsx
|
|
24600
|
-
import { Fragment as
|
|
24782
|
+
import { Fragment as Fragment4, jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
24601
24783
|
var WalletBalance = ({
|
|
24602
24784
|
connected,
|
|
24603
24785
|
connecting,
|
|
@@ -24605,22 +24787,22 @@ var WalletBalance = ({
|
|
|
24605
24787
|
wallet
|
|
24606
24788
|
}) => {
|
|
24607
24789
|
const lovelace = useLovelace();
|
|
24608
|
-
return connected && lovelace && wallet?.icon ? /* @__PURE__ */
|
|
24609
|
-
/* @__PURE__ */
|
|
24790
|
+
return connected && lovelace && wallet?.icon ? /* @__PURE__ */ jsxs16(Fragment4, { children: [
|
|
24791
|
+
/* @__PURE__ */ jsx25("img", { className: "mesh-m-2 mesh-h-6", src: wallet.icon }),
|
|
24610
24792
|
"\u20B3",
|
|
24611
24793
|
" ",
|
|
24612
24794
|
parseInt((parseInt(lovelace, 10) / 1e6).toString(), 10),
|
|
24613
24795
|
".",
|
|
24614
|
-
/* @__PURE__ */
|
|
24615
|
-
] }) : connected && wallet?.icon ? /* @__PURE__ */
|
|
24796
|
+
/* @__PURE__ */ jsx25("span", { className: "mesh-text-xs", children: lovelace.substring(lovelace.length - 6) })
|
|
24797
|
+
] }) : connected && wallet?.icon ? /* @__PURE__ */ jsx25(Fragment4, { children: /* @__PURE__ */ jsx25("img", { className: "mesh-m-2 mesh-h-6", src: wallet.icon }) }) : connecting ? /* @__PURE__ */ jsx25(Fragment4, { children: "Connecting..." }) : /* @__PURE__ */ jsxs16(Fragment4, { children: [
|
|
24616
24798
|
label,
|
|
24617
24799
|
" ",
|
|
24618
|
-
/* @__PURE__ */
|
|
24800
|
+
/* @__PURE__ */ jsx25(ChevronDown, {})
|
|
24619
24801
|
] });
|
|
24620
24802
|
};
|
|
24621
24803
|
|
|
24622
24804
|
// src/cardano-wallet-dropdown/index.tsx
|
|
24623
|
-
import { Fragment as
|
|
24805
|
+
import { Fragment as Fragment5, jsx as jsx26, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
24624
24806
|
var CardanoWallet2 = ({
|
|
24625
24807
|
label = "Connect Wallet",
|
|
24626
24808
|
onConnected = void 0,
|
|
@@ -24629,9 +24811,9 @@ var CardanoWallet2 = ({
|
|
|
24629
24811
|
extensions = [],
|
|
24630
24812
|
cardanoPeerConnect = void 0
|
|
24631
24813
|
}) => {
|
|
24632
|
-
const [isDarkMode, setIsDarkMode] =
|
|
24633
|
-
const [hideMenuList, setHideMenuList] =
|
|
24634
|
-
const { connect, connecting, connected, disconnect, name } = useWallet();
|
|
24814
|
+
const [isDarkMode, setIsDarkMode] = useState14(false);
|
|
24815
|
+
const [hideMenuList, setHideMenuList] = useState14(true);
|
|
24816
|
+
const { connect: connect2, connecting, connected, disconnect, name } = useWallet();
|
|
24635
24817
|
const wallets = useWalletList({ metamask });
|
|
24636
24818
|
useEffect11(() => {
|
|
24637
24819
|
if (connected && onConnected) {
|
|
@@ -24641,20 +24823,20 @@ var CardanoWallet2 = ({
|
|
|
24641
24823
|
useEffect11(() => {
|
|
24642
24824
|
setIsDarkMode(isDark);
|
|
24643
24825
|
}, [isDark]);
|
|
24644
|
-
return /* @__PURE__ */
|
|
24826
|
+
return /* @__PURE__ */ jsxs17(
|
|
24645
24827
|
"div",
|
|
24646
24828
|
{
|
|
24647
24829
|
onMouseEnter: () => setHideMenuList(false),
|
|
24648
24830
|
onMouseLeave: () => setHideMenuList(true),
|
|
24649
24831
|
style: { width: "min-content", zIndex: 50 },
|
|
24650
24832
|
children: [
|
|
24651
|
-
/* @__PURE__ */
|
|
24833
|
+
/* @__PURE__ */ jsx26(
|
|
24652
24834
|
ButtonDropdown,
|
|
24653
24835
|
{
|
|
24654
24836
|
isDarkMode,
|
|
24655
24837
|
hideMenuList,
|
|
24656
24838
|
setHideMenuList,
|
|
24657
|
-
children: /* @__PURE__ */
|
|
24839
|
+
children: /* @__PURE__ */ jsx26(
|
|
24658
24840
|
WalletBalance,
|
|
24659
24841
|
{
|
|
24660
24842
|
connected,
|
|
@@ -24665,24 +24847,24 @@ var CardanoWallet2 = ({
|
|
|
24665
24847
|
)
|
|
24666
24848
|
}
|
|
24667
24849
|
),
|
|
24668
|
-
/* @__PURE__ */
|
|
24850
|
+
/* @__PURE__ */ jsx26(
|
|
24669
24851
|
"div",
|
|
24670
24852
|
{
|
|
24671
24853
|
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`}`,
|
|
24672
24854
|
style: { zIndex: 50 },
|
|
24673
|
-
children: !connected && wallets.length > 0 ? /* @__PURE__ */
|
|
24855
|
+
children: !connected && wallets.length > 0 ? /* @__PURE__ */ jsx26(Fragment5, { children: wallets.map((wallet, index) => /* @__PURE__ */ jsx26(
|
|
24674
24856
|
MenuItem,
|
|
24675
24857
|
{
|
|
24676
24858
|
icon: wallet.icon,
|
|
24677
24859
|
label: wallet.name,
|
|
24678
24860
|
action: () => {
|
|
24679
|
-
|
|
24861
|
+
connect2(wallet.id, extensions);
|
|
24680
24862
|
setHideMenuList(!hideMenuList);
|
|
24681
24863
|
},
|
|
24682
24864
|
active: name === wallet.id
|
|
24683
24865
|
},
|
|
24684
24866
|
index
|
|
24685
|
-
)) }) : wallets.length === 0 ? /* @__PURE__ */
|
|
24867
|
+
)) }) : wallets.length === 0 ? /* @__PURE__ */ jsx26("span", { children: "No Wallet Found" }) : /* @__PURE__ */ jsx26(Fragment5, { children: /* @__PURE__ */ jsx26(
|
|
24686
24868
|
MenuItem,
|
|
24687
24869
|
{
|
|
24688
24870
|
active: false,
|
|
@@ -24699,7 +24881,7 @@ var CardanoWallet2 = ({
|
|
|
24699
24881
|
};
|
|
24700
24882
|
|
|
24701
24883
|
// src/stake-button/index.tsx
|
|
24702
|
-
import { Fragment as
|
|
24884
|
+
import { Fragment as Fragment6, jsx as jsx27 } from "react/jsx-runtime";
|
|
24703
24885
|
var StakeButton = ({
|
|
24704
24886
|
label = "Stake your ADA",
|
|
24705
24887
|
isDark = false,
|
|
@@ -24707,19 +24889,19 @@ var StakeButton = ({
|
|
|
24707
24889
|
onCheck,
|
|
24708
24890
|
onDelegated = void 0
|
|
24709
24891
|
}) => {
|
|
24710
|
-
const [isDarkMode, setIsDarkMode] =
|
|
24892
|
+
const [isDarkMode, setIsDarkMode] = useState15(false);
|
|
24711
24893
|
const { connected } = useWallet();
|
|
24712
24894
|
useEffect12(() => {
|
|
24713
24895
|
setIsDarkMode(isDark);
|
|
24714
24896
|
}, [isDark]);
|
|
24715
|
-
return /* @__PURE__ */
|
|
24897
|
+
return /* @__PURE__ */ jsx27(Fragment6, { children: connected ? /* @__PURE__ */ jsx27(ButtonDropdown, { isDarkMode, children: /* @__PURE__ */ jsx27(
|
|
24716
24898
|
Delegate,
|
|
24717
24899
|
{
|
|
24718
24900
|
poolId,
|
|
24719
24901
|
onCheck,
|
|
24720
24902
|
onDelegated
|
|
24721
24903
|
}
|
|
24722
|
-
) }) : /* @__PURE__ */
|
|
24904
|
+
) }) : /* @__PURE__ */ jsx27(CardanoWallet2, { label, isDark }) });
|
|
24723
24905
|
};
|
|
24724
24906
|
var Delegate = ({
|
|
24725
24907
|
poolId,
|
|
@@ -24728,11 +24910,11 @@ var Delegate = ({
|
|
|
24728
24910
|
}) => {
|
|
24729
24911
|
const { wallet } = useWallet();
|
|
24730
24912
|
const rewardAddress = useRewardAddress();
|
|
24731
|
-
const [_, setError] =
|
|
24732
|
-
const [checking, setChecking] =
|
|
24733
|
-
const [accountInfo, setAccountInfo] =
|
|
24734
|
-
const [processing, setProcessing] =
|
|
24735
|
-
const [done, setDone] =
|
|
24913
|
+
const [_, setError] = useState15();
|
|
24914
|
+
const [checking, setChecking] = useState15(false);
|
|
24915
|
+
const [accountInfo, setAccountInfo] = useState15();
|
|
24916
|
+
const [processing, setProcessing] = useState15(false);
|
|
24917
|
+
const [done, setDone] = useState15(false);
|
|
24736
24918
|
const checkAccountStatus = async () => {
|
|
24737
24919
|
try {
|
|
24738
24920
|
setChecking(true);
|
|
@@ -24787,18 +24969,18 @@ var Delegate = ({
|
|
|
24787
24969
|
checkAccountStatus();
|
|
24788
24970
|
}, [rewardAddress]);
|
|
24789
24971
|
if (checking) {
|
|
24790
|
-
return /* @__PURE__ */
|
|
24972
|
+
return /* @__PURE__ */ jsx27("span", { children: "Checking..." });
|
|
24791
24973
|
}
|
|
24792
24974
|
if (processing) {
|
|
24793
|
-
return /* @__PURE__ */
|
|
24975
|
+
return /* @__PURE__ */ jsx27("span", { children: "Loading..." });
|
|
24794
24976
|
}
|
|
24795
24977
|
if (done) {
|
|
24796
|
-
return /* @__PURE__ */
|
|
24978
|
+
return /* @__PURE__ */ jsx27("span", { children: "Stake Delegated" });
|
|
24797
24979
|
}
|
|
24798
24980
|
if (accountInfo?.active) {
|
|
24799
|
-
return accountInfo.poolId === poolId ? /* @__PURE__ */
|
|
24981
|
+
return accountInfo.poolId === poolId ? /* @__PURE__ */ jsx27("span", { children: "Stake Delegated" }) : /* @__PURE__ */ jsx27("span", { onClick: delegateStake, children: "Begin Staking" });
|
|
24800
24982
|
}
|
|
24801
|
-
return /* @__PURE__ */
|
|
24983
|
+
return /* @__PURE__ */ jsx27("span", { onClick: registerAddress, children: "Begin Staking" });
|
|
24802
24984
|
};
|
|
24803
24985
|
export {
|
|
24804
24986
|
CardanoWallet,
|