@meshsdk/react 1.7.21 → 1.7.22
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 +73 -181
- package/dist/index.js +74 -182
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -48,7 +48,6 @@ module.exports = __toCommonJS(src_exports);
|
|
|
48
48
|
|
|
49
49
|
// src/cardano-wallet/index.tsx
|
|
50
50
|
var import_react10 = require("react");
|
|
51
|
-
var import_cardano_peer_connect = require("@fabianbormann/cardano-peer-connect");
|
|
52
51
|
|
|
53
52
|
// src/common/button.tsx
|
|
54
53
|
var React3 = __toESM(require("react"), 1);
|
|
@@ -2944,41 +2943,10 @@ function IconChevronRight() {
|
|
|
2944
2943
|
);
|
|
2945
2944
|
}
|
|
2946
2945
|
|
|
2947
|
-
// src/common/icons/icon-download.tsx
|
|
2948
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
2949
|
-
function IconDownload() {
|
|
2950
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
2951
|
-
"svg",
|
|
2952
|
-
{
|
|
2953
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
2954
|
-
width: "24",
|
|
2955
|
-
height: "24",
|
|
2956
|
-
viewBox: "0 0 24 24",
|
|
2957
|
-
fill: "none",
|
|
2958
|
-
stroke: "gray",
|
|
2959
|
-
strokeWidth: "2",
|
|
2960
|
-
strokeLinecap: "round",
|
|
2961
|
-
strokeLinejoin: "round",
|
|
2962
|
-
style: {
|
|
2963
|
-
color: "#ffadff",
|
|
2964
|
-
width: "24px",
|
|
2965
|
-
height: "24px",
|
|
2966
|
-
strokeWidth: "1px"
|
|
2967
|
-
},
|
|
2968
|
-
className: "hover:mesh-fill-white",
|
|
2969
|
-
children: [
|
|
2970
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
2971
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("polyline", { points: "7 10 12 15 17 10" }),
|
|
2972
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("line", { x1: "12", x2: "12", y1: "15", y2: "3" })
|
|
2973
|
-
]
|
|
2974
|
-
}
|
|
2975
|
-
);
|
|
2976
|
-
}
|
|
2977
|
-
|
|
2978
2946
|
// src/common/icons/icon-monitor-smartphone.tsx
|
|
2979
|
-
var
|
|
2947
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
2980
2948
|
function IconMonitorSmartphone() {
|
|
2981
|
-
return /* @__PURE__ */ (0,
|
|
2949
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
2982
2950
|
"svg",
|
|
2983
2951
|
{
|
|
2984
2952
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -2997,30 +2965,30 @@ function IconMonitorSmartphone() {
|
|
|
2997
2965
|
strokeWidth: "1px"
|
|
2998
2966
|
},
|
|
2999
2967
|
children: [
|
|
3000
|
-
/* @__PURE__ */ (0,
|
|
3001
|
-
/* @__PURE__ */ (0,
|
|
3002
|
-
/* @__PURE__ */ (0,
|
|
3003
|
-
/* @__PURE__ */ (0,
|
|
2968
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8" }),
|
|
2969
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M10 19v-3.96 3.15" }),
|
|
2970
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M7 19h5" }),
|
|
2971
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("rect", { width: "6", height: "10", x: "16", y: "12", rx: "2" })
|
|
3004
2972
|
]
|
|
3005
2973
|
}
|
|
3006
2974
|
);
|
|
3007
2975
|
}
|
|
3008
2976
|
|
|
3009
2977
|
// src/common/icons/wallet-icon.tsx
|
|
3010
|
-
var
|
|
2978
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
3011
2979
|
function WalletIcon({
|
|
3012
2980
|
icon,
|
|
3013
2981
|
name,
|
|
3014
2982
|
action,
|
|
3015
2983
|
iconReactNode
|
|
3016
2984
|
}) {
|
|
3017
|
-
return /* @__PURE__ */ (0,
|
|
2985
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
3018
2986
|
"button",
|
|
3019
2987
|
{
|
|
3020
2988
|
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",
|
|
3021
2989
|
onClick: action,
|
|
3022
2990
|
children: [
|
|
3023
|
-
icon && /* @__PURE__ */ (0,
|
|
2991
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("img", { src: icon, alt: name, className: "mesh-w-8 mesh-h-8" }),
|
|
3024
2992
|
iconReactNode && iconReactNode
|
|
3025
2993
|
]
|
|
3026
2994
|
}
|
|
@@ -3084,10 +3052,10 @@ var WalletContext = (0, import_react.createContext)({
|
|
|
3084
3052
|
});
|
|
3085
3053
|
|
|
3086
3054
|
// src/contexts/index.tsx
|
|
3087
|
-
var
|
|
3055
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
3088
3056
|
var MeshProvider = (props) => {
|
|
3089
3057
|
const store = useWalletStore();
|
|
3090
|
-
return /* @__PURE__ */ (0,
|
|
3058
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(WalletContext.Provider, { value: store, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: props.children }) });
|
|
3091
3059
|
};
|
|
3092
3060
|
|
|
3093
3061
|
// src/hooks/useAddress.ts
|
|
@@ -3248,7 +3216,7 @@ var useWalletSubmit = () => {
|
|
|
3248
3216
|
};
|
|
3249
3217
|
|
|
3250
3218
|
// src/cardano-wallet/index.tsx
|
|
3251
|
-
var
|
|
3219
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
3252
3220
|
var CardanoWallet = ({
|
|
3253
3221
|
label = "Connect Wallet",
|
|
3254
3222
|
onConnected = void 0,
|
|
@@ -3265,21 +3233,21 @@ var CardanoWallet = ({
|
|
|
3265
3233
|
if (onConnected) onConnected();
|
|
3266
3234
|
}
|
|
3267
3235
|
}, [connected, wallet]);
|
|
3268
|
-
return /* @__PURE__ */ (0,
|
|
3269
|
-
!connected ? /* @__PURE__ */ (0,
|
|
3270
|
-
/* @__PURE__ */ (0,
|
|
3271
|
-
/* @__PURE__ */ (0,
|
|
3272
|
-
/* @__PURE__ */ (0,
|
|
3273
|
-
screen != "main" ? /* @__PURE__ */ (0,
|
|
3274
|
-
/* @__PURE__ */ (0,
|
|
3236
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Dialog, { open, onOpenChange: setOpen, children: [
|
|
3237
|
+
!connected ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DialogTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Button, { variant: "outline", className: "mesh-text-white", children: label }) }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ConnectedDropdown, {}),
|
|
3238
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(DialogContent, { className: "sm:mesh-max-w-[425px]", children: [
|
|
3239
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(DialogHeader, { children: [
|
|
3240
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(DialogTitle, { className: "mesh-flex mesh-justify-between", children: [
|
|
3241
|
+
screen != "main" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { onClick: () => setScreen("main"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(IconChevronRight, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { style: { width: "24px" } }),
|
|
3242
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { children: [
|
|
3275
3243
|
screen == "main" && "Connect Wallet",
|
|
3276
3244
|
screen == "p2p" && "P2P Connect"
|
|
3277
3245
|
] }),
|
|
3278
|
-
/* @__PURE__ */ (0,
|
|
3246
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { style: { width: "24px" } })
|
|
3279
3247
|
] }),
|
|
3280
|
-
/* @__PURE__ */ (0,
|
|
3248
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DialogDescription, { children: screen == "p2p" && "Use wallet that supports CIP-45, scan this QR code to connect." })
|
|
3281
3249
|
] }),
|
|
3282
|
-
screen == "main" && /* @__PURE__ */ (0,
|
|
3250
|
+
screen == "main" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3283
3251
|
MainScreen,
|
|
3284
3252
|
{
|
|
3285
3253
|
metamask,
|
|
@@ -3288,16 +3256,15 @@ var CardanoWallet = ({
|
|
|
3288
3256
|
setScreen
|
|
3289
3257
|
}
|
|
3290
3258
|
),
|
|
3291
|
-
|
|
3292
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DialogFooter, { className: "mesh-justify-center mesh-text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
3259
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DialogFooter, { className: "mesh-justify-center mesh-text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3293
3260
|
"a",
|
|
3294
3261
|
{
|
|
3295
3262
|
href: "https://meshjs.dev/",
|
|
3296
3263
|
target: "_blank",
|
|
3297
3264
|
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",
|
|
3298
3265
|
children: [
|
|
3299
|
-
/* @__PURE__ */ (0,
|
|
3300
|
-
/* @__PURE__ */ (0,
|
|
3266
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "", children: "Powered by" }),
|
|
3267
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3301
3268
|
"svg",
|
|
3302
3269
|
{
|
|
3303
3270
|
width: 24,
|
|
@@ -3305,10 +3272,10 @@ var CardanoWallet = ({
|
|
|
3305
3272
|
enableBackground: "new 0 0 300 200",
|
|
3306
3273
|
viewBox: "0 0 300 200",
|
|
3307
3274
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3308
|
-
children: /* @__PURE__ */ (0,
|
|
3275
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.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" })
|
|
3309
3276
|
}
|
|
3310
3277
|
),
|
|
3311
|
-
/* @__PURE__ */ (0,
|
|
3278
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "", children: "Mesh SDK" })
|
|
3312
3279
|
]
|
|
3313
3280
|
}
|
|
3314
3281
|
) })
|
|
@@ -3328,16 +3295,16 @@ function ConnectedDropdown() {
|
|
|
3328
3295
|
afterConnectedWallet();
|
|
3329
3296
|
}
|
|
3330
3297
|
}, [connected, wallet]);
|
|
3331
|
-
return /* @__PURE__ */ (0,
|
|
3332
|
-
/* @__PURE__ */ (0,
|
|
3298
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(DropdownMenu, { children: [
|
|
3299
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropdownMenuTrigger, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Button, { variant: "outline", className: "mesh-text-white", children: [
|
|
3333
3300
|
address.slice(0, 6),
|
|
3334
3301
|
"...",
|
|
3335
3302
|
address.slice(-6)
|
|
3336
3303
|
] }) }),
|
|
3337
|
-
/* @__PURE__ */ (0,
|
|
3338
|
-
/* @__PURE__ */ (0,
|
|
3339
|
-
/* @__PURE__ */ (0,
|
|
3340
|
-
/* @__PURE__ */ (0,
|
|
3304
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(DropdownMenuContent, { children: [
|
|
3305
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropdownMenuLabel, { children: "Wallet" }),
|
|
3306
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropdownMenuSeparator, {}),
|
|
3307
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3341
3308
|
DropdownMenuItem,
|
|
3342
3309
|
{
|
|
3343
3310
|
onClick: () => {
|
|
@@ -3346,7 +3313,7 @@ function ConnectedDropdown() {
|
|
|
3346
3313
|
children: "Copy Address"
|
|
3347
3314
|
}
|
|
3348
3315
|
),
|
|
3349
|
-
/* @__PURE__ */ (0,
|
|
3316
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3350
3317
|
DropdownMenuItem,
|
|
3351
3318
|
{
|
|
3352
3319
|
onClick: () => {
|
|
@@ -3366,8 +3333,8 @@ function MainScreen({
|
|
|
3366
3333
|
}) {
|
|
3367
3334
|
const wallets = useWalletList({ metamask });
|
|
3368
3335
|
const { connect } = useWallet();
|
|
3369
|
-
return /* @__PURE__ */ (0,
|
|
3370
|
-
wallets.map((wallet, index) => /* @__PURE__ */ (0,
|
|
3336
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "mesh-grid mesh-gap-4 mesh-py-4 mesh-grid-cols-4 mesh-place-items-center", children: [
|
|
3337
|
+
wallets.map((wallet, index) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3371
3338
|
WalletIcon,
|
|
3372
3339
|
{
|
|
3373
3340
|
icon: wallet.icon,
|
|
@@ -3379,7 +3346,7 @@ function MainScreen({
|
|
|
3379
3346
|
},
|
|
3380
3347
|
index
|
|
3381
3348
|
)),
|
|
3382
|
-
/* @__PURE__ */ (0,
|
|
3349
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3383
3350
|
WalletIcon,
|
|
3384
3351
|
{
|
|
3385
3352
|
iconReactNode: IconMonitorSmartphone(),
|
|
@@ -3388,101 +3355,26 @@ function MainScreen({
|
|
|
3388
3355
|
setScreen("p2p");
|
|
3389
3356
|
}
|
|
3390
3357
|
}
|
|
3391
|
-
),
|
|
3392
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3393
|
-
WalletIcon,
|
|
3394
|
-
{
|
|
3395
|
-
iconReactNode: IconDownload(),
|
|
3396
|
-
name: `P2P`,
|
|
3397
|
-
action: () => {
|
|
3398
|
-
window.open(
|
|
3399
|
-
"https://developers.cardano.org/showcase/?tags=wallet",
|
|
3400
|
-
"_blank"
|
|
3401
|
-
);
|
|
3402
|
-
}
|
|
3403
|
-
}
|
|
3404
|
-
)
|
|
3405
|
-
] });
|
|
3406
|
-
}
|
|
3407
|
-
function P2PScreen({
|
|
3408
|
-
cardanoPeerConnect
|
|
3409
|
-
}) {
|
|
3410
|
-
const dAppConnect = (0, import_react10.useRef)(null);
|
|
3411
|
-
const qrCodeField = (0, import_react10.useRef)(null);
|
|
3412
|
-
const [address, setAddress] = (0, import_react10.useState)("");
|
|
3413
|
-
const [copied, setCopied] = (0, import_react10.useState)(false);
|
|
3414
|
-
const [connected, setConnected] = (0, import_react10.useState)(false);
|
|
3415
|
-
console.log("address", address);
|
|
3416
|
-
(0, import_react10.useEffect)(() => {
|
|
3417
|
-
if (cardanoPeerConnect) {
|
|
3418
|
-
if (dAppConnect.current === null) {
|
|
3419
|
-
dAppConnect.current = new import_cardano_peer_connect.DAppPeerConnect({
|
|
3420
|
-
dAppInfo: {
|
|
3421
|
-
name: cardanoPeerConnect.dAppInfo.name,
|
|
3422
|
-
url: cardanoPeerConnect.dAppInfo.url
|
|
3423
|
-
},
|
|
3424
|
-
announce: cardanoPeerConnect.announce,
|
|
3425
|
-
onApiInject: (name, address2) => {
|
|
3426
|
-
console.log("onApiInject", name, address2);
|
|
3427
|
-
},
|
|
3428
|
-
onApiEject: (name, address2) => {
|
|
3429
|
-
console.log("onApiEject", name, address2);
|
|
3430
|
-
},
|
|
3431
|
-
onConnect: (address2, walletInfo) => {
|
|
3432
|
-
console.log("Connected to wallet", address2, walletInfo);
|
|
3433
|
-
},
|
|
3434
|
-
onDisconnect: () => {
|
|
3435
|
-
console.log("Disconnected from wallet");
|
|
3436
|
-
},
|
|
3437
|
-
verifyConnection: (walletInfo, callback) => {
|
|
3438
|
-
console.log("verifyConnection", walletInfo);
|
|
3439
|
-
callback(true, true);
|
|
3440
|
-
},
|
|
3441
|
-
useWalletDiscovery: true
|
|
3442
|
-
});
|
|
3443
|
-
console.log(1, dAppConnect.current);
|
|
3444
|
-
if (dAppConnect.current) {
|
|
3445
|
-
setAddress(dAppConnect.current.getAddress());
|
|
3446
|
-
if (qrCodeField.current !== null) {
|
|
3447
|
-
dAppConnect.current.generateQRCode(qrCodeField.current);
|
|
3448
|
-
}
|
|
3449
|
-
}
|
|
3450
|
-
}
|
|
3451
|
-
}
|
|
3452
|
-
}, []);
|
|
3453
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mesh-flex mesh-flex-col mesh-items-center mesh-justify-center", children: [
|
|
3454
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { marginTop: 16, marginBottom: 16 }, ref: qrCodeField }),
|
|
3455
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3456
|
-
Button,
|
|
3457
|
-
{
|
|
3458
|
-
variant: "outline",
|
|
3459
|
-
className: "mesh-text-white",
|
|
3460
|
-
onClick: () => {
|
|
3461
|
-
navigator.clipboard.writeText(address);
|
|
3462
|
-
setCopied(true);
|
|
3463
|
-
},
|
|
3464
|
-
children: copied ? "Copied" : "Copy Address"
|
|
3465
|
-
}
|
|
3466
3358
|
)
|
|
3467
3359
|
] });
|
|
3468
3360
|
}
|
|
3469
3361
|
|
|
3470
3362
|
// src/mesh-badge/mesh-logo.tsx
|
|
3471
|
-
var
|
|
3472
|
-
var MeshLogo = () => /* @__PURE__ */ (0,
|
|
3363
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
3364
|
+
var MeshLogo = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3473
3365
|
"svg",
|
|
3474
3366
|
{
|
|
3475
3367
|
className: "mesh-h-16 mesh-p-2",
|
|
3476
3368
|
fill: "currentColor",
|
|
3477
3369
|
viewBox: "0 0 300 200",
|
|
3478
3370
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3479
|
-
children: /* @__PURE__ */ (0,
|
|
3371
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.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" })
|
|
3480
3372
|
}
|
|
3481
3373
|
);
|
|
3482
3374
|
|
|
3483
3375
|
// src/mesh-badge/index.tsx
|
|
3484
|
-
var
|
|
3485
|
-
var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ (0,
|
|
3376
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
3377
|
+
var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
3486
3378
|
"a",
|
|
3487
3379
|
{
|
|
3488
3380
|
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`}`,
|
|
@@ -3494,7 +3386,7 @@ var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ (0, import_jsx_runtime12
|
|
|
3494
3386
|
rel: "noopener noreferrer",
|
|
3495
3387
|
target: "_blank",
|
|
3496
3388
|
children: [
|
|
3497
|
-
/* @__PURE__ */ (0,
|
|
3389
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MeshLogo, {}),
|
|
3498
3390
|
"Mesh"
|
|
3499
3391
|
]
|
|
3500
3392
|
}
|
|
@@ -3508,7 +3400,7 @@ var import_transaction = require("@meshsdk/transaction");
|
|
|
3508
3400
|
var import_react11 = require("react");
|
|
3509
3401
|
|
|
3510
3402
|
// src/common/button-dropdown.tsx
|
|
3511
|
-
var
|
|
3403
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
3512
3404
|
function ButtonDropdown({
|
|
3513
3405
|
children,
|
|
3514
3406
|
isDarkMode = false,
|
|
@@ -3517,7 +3409,7 @@ function ButtonDropdown({
|
|
|
3517
3409
|
onMouseEnter,
|
|
3518
3410
|
onMouseLeave
|
|
3519
3411
|
}) {
|
|
3520
|
-
return /* @__PURE__ */ (0,
|
|
3412
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3521
3413
|
"button",
|
|
3522
3414
|
{
|
|
3523
3415
|
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`}`,
|
|
@@ -3530,21 +3422,21 @@ function ButtonDropdown({
|
|
|
3530
3422
|
}
|
|
3531
3423
|
|
|
3532
3424
|
// src/cardano-wallet-dropdown/menu-item.tsx
|
|
3533
|
-
var
|
|
3425
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
3534
3426
|
function MenuItem({
|
|
3535
3427
|
icon,
|
|
3536
3428
|
label,
|
|
3537
3429
|
action,
|
|
3538
3430
|
active
|
|
3539
3431
|
}) {
|
|
3540
|
-
return /* @__PURE__ */ (0,
|
|
3432
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
3541
3433
|
"div",
|
|
3542
3434
|
{
|
|
3543
3435
|
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",
|
|
3544
3436
|
onClick: action,
|
|
3545
3437
|
children: [
|
|
3546
|
-
icon && /* @__PURE__ */ (0,
|
|
3547
|
-
/* @__PURE__ */ (0,
|
|
3438
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("img", { className: "mesh-pr-2 mesh-m-1 mesh-h-8", src: icon }),
|
|
3439
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "mesh-mr-menu-item mesh-text-xl mesh-font-normal mesh-text-gray-700 hover:mesh-text-black", children: label.split(" ").map((word) => {
|
|
3548
3440
|
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
3549
3441
|
}).join(" ") })
|
|
3550
3442
|
]
|
|
@@ -3553,8 +3445,8 @@ function MenuItem({
|
|
|
3553
3445
|
}
|
|
3554
3446
|
|
|
3555
3447
|
// src/cardano-wallet-dropdown/chevron-down.tsx
|
|
3556
|
-
var
|
|
3557
|
-
var ChevronDown = () => /* @__PURE__ */ (0,
|
|
3448
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
3449
|
+
var ChevronDown = () => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3558
3450
|
"svg",
|
|
3559
3451
|
{
|
|
3560
3452
|
className: "mesh-m-2 mesh-h-6",
|
|
@@ -3563,7 +3455,7 @@ var ChevronDown = () => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
|
3563
3455
|
viewBox: "0 0 24 24",
|
|
3564
3456
|
stroke: "currentColor",
|
|
3565
3457
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3566
|
-
children: /* @__PURE__ */ (0,
|
|
3458
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3567
3459
|
"path",
|
|
3568
3460
|
{
|
|
3569
3461
|
strokeLinecap: "round",
|
|
@@ -3576,7 +3468,7 @@ var ChevronDown = () => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
|
3576
3468
|
);
|
|
3577
3469
|
|
|
3578
3470
|
// src/cardano-wallet-dropdown/wallet-balance.tsx
|
|
3579
|
-
var
|
|
3471
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
3580
3472
|
var WalletBalance = ({
|
|
3581
3473
|
connected,
|
|
3582
3474
|
connecting,
|
|
@@ -3584,22 +3476,22 @@ var WalletBalance = ({
|
|
|
3584
3476
|
wallet
|
|
3585
3477
|
}) => {
|
|
3586
3478
|
const lovelace = useLovelace();
|
|
3587
|
-
return connected && lovelace && wallet?.icon ? /* @__PURE__ */ (0,
|
|
3588
|
-
/* @__PURE__ */ (0,
|
|
3479
|
+
return connected && lovelace && wallet?.icon ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
3480
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("img", { className: "mesh-m-2 mesh-h-6", src: wallet.icon }),
|
|
3589
3481
|
"\u20B3",
|
|
3590
3482
|
" ",
|
|
3591
3483
|
parseInt((parseInt(lovelace, 10) / 1e6).toString(), 10),
|
|
3592
3484
|
".",
|
|
3593
|
-
/* @__PURE__ */ (0,
|
|
3594
|
-
] }) : connected && wallet?.icon ? /* @__PURE__ */ (0,
|
|
3485
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "mesh-text-xs", children: lovelace.substring(lovelace.length - 6) })
|
|
3486
|
+
] }) : connected && wallet?.icon ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("img", { className: "mesh-m-2 mesh-h-6", src: wallet.icon }) }) : connecting ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, { children: "Connecting..." }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
3595
3487
|
label,
|
|
3596
3488
|
" ",
|
|
3597
|
-
/* @__PURE__ */ (0,
|
|
3489
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChevronDown, {})
|
|
3598
3490
|
] });
|
|
3599
3491
|
};
|
|
3600
3492
|
|
|
3601
3493
|
// src/cardano-wallet-dropdown/index.tsx
|
|
3602
|
-
var
|
|
3494
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
3603
3495
|
var CardanoWallet2 = ({
|
|
3604
3496
|
label = "Connect Wallet",
|
|
3605
3497
|
onConnected = void 0,
|
|
@@ -3620,20 +3512,20 @@ var CardanoWallet2 = ({
|
|
|
3620
3512
|
(0, import_react11.useEffect)(() => {
|
|
3621
3513
|
setIsDarkMode(isDark);
|
|
3622
3514
|
}, [isDark]);
|
|
3623
|
-
return /* @__PURE__ */ (0,
|
|
3515
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
3624
3516
|
"div",
|
|
3625
3517
|
{
|
|
3626
3518
|
onMouseEnter: () => setHideMenuList(false),
|
|
3627
3519
|
onMouseLeave: () => setHideMenuList(true),
|
|
3628
3520
|
style: { width: "min-content", zIndex: 50 },
|
|
3629
3521
|
children: [
|
|
3630
|
-
/* @__PURE__ */ (0,
|
|
3522
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3631
3523
|
ButtonDropdown,
|
|
3632
3524
|
{
|
|
3633
3525
|
isDarkMode,
|
|
3634
3526
|
hideMenuList,
|
|
3635
3527
|
setHideMenuList,
|
|
3636
|
-
children: /* @__PURE__ */ (0,
|
|
3528
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3637
3529
|
WalletBalance,
|
|
3638
3530
|
{
|
|
3639
3531
|
connected,
|
|
@@ -3644,12 +3536,12 @@ var CardanoWallet2 = ({
|
|
|
3644
3536
|
)
|
|
3645
3537
|
}
|
|
3646
3538
|
),
|
|
3647
|
-
/* @__PURE__ */ (0,
|
|
3539
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3648
3540
|
"div",
|
|
3649
3541
|
{
|
|
3650
3542
|
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`}`,
|
|
3651
3543
|
style: { zIndex: 50 },
|
|
3652
|
-
children: !connected && wallets.length > 0 ? /* @__PURE__ */ (0,
|
|
3544
|
+
children: !connected && wallets.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_jsx_runtime16.Fragment, { children: wallets.map((wallet, index) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3653
3545
|
MenuItem,
|
|
3654
3546
|
{
|
|
3655
3547
|
icon: wallet.icon,
|
|
@@ -3661,7 +3553,7 @@ var CardanoWallet2 = ({
|
|
|
3661
3553
|
active: name === wallet.id
|
|
3662
3554
|
},
|
|
3663
3555
|
index
|
|
3664
|
-
)) }) : wallets.length === 0 ? /* @__PURE__ */ (0,
|
|
3556
|
+
)) }) : wallets.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: "No Wallet Found" }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_jsx_runtime16.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3665
3557
|
MenuItem,
|
|
3666
3558
|
{
|
|
3667
3559
|
active: false,
|
|
@@ -3678,7 +3570,7 @@ var CardanoWallet2 = ({
|
|
|
3678
3570
|
};
|
|
3679
3571
|
|
|
3680
3572
|
// src/stake-button/index.tsx
|
|
3681
|
-
var
|
|
3573
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3682
3574
|
var StakeButton = ({
|
|
3683
3575
|
label = "Stake your ADA",
|
|
3684
3576
|
isDark = false,
|
|
@@ -3691,14 +3583,14 @@ var StakeButton = ({
|
|
|
3691
3583
|
(0, import_react12.useEffect)(() => {
|
|
3692
3584
|
setIsDarkMode(isDark);
|
|
3693
3585
|
}, [isDark]);
|
|
3694
|
-
return /* @__PURE__ */ (0,
|
|
3586
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_jsx_runtime17.Fragment, { children: connected ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ButtonDropdown, { isDarkMode, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3695
3587
|
Delegate,
|
|
3696
3588
|
{
|
|
3697
3589
|
poolId,
|
|
3698
3590
|
onCheck,
|
|
3699
3591
|
onDelegated
|
|
3700
3592
|
}
|
|
3701
|
-
) }) : /* @__PURE__ */ (0,
|
|
3593
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CardanoWallet2, { label, isDark }) });
|
|
3702
3594
|
};
|
|
3703
3595
|
var Delegate = ({
|
|
3704
3596
|
poolId,
|
|
@@ -3766,18 +3658,18 @@ var Delegate = ({
|
|
|
3766
3658
|
checkAccountStatus();
|
|
3767
3659
|
}, [rewardAddress]);
|
|
3768
3660
|
if (checking) {
|
|
3769
|
-
return /* @__PURE__ */ (0,
|
|
3661
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: "Checking..." });
|
|
3770
3662
|
}
|
|
3771
3663
|
if (processing) {
|
|
3772
|
-
return /* @__PURE__ */ (0,
|
|
3664
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: "Loading..." });
|
|
3773
3665
|
}
|
|
3774
3666
|
if (done) {
|
|
3775
|
-
return /* @__PURE__ */ (0,
|
|
3667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: "Stake Delegated" });
|
|
3776
3668
|
}
|
|
3777
3669
|
if (accountInfo?.active) {
|
|
3778
|
-
return accountInfo.poolId === poolId ? /* @__PURE__ */ (0,
|
|
3670
|
+
return accountInfo.poolId === poolId ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: "Stake Delegated" }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { onClick: delegateStake, children: "Begin Staking" });
|
|
3779
3671
|
}
|
|
3780
|
-
return /* @__PURE__ */ (0,
|
|
3672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { onClick: registerAddress, children: "Begin Staking" });
|
|
3781
3673
|
};
|
|
3782
3674
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3783
3675
|
0 && (module.exports = {
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// src/cardano-wallet/index.tsx
|
|
2
|
-
import { useEffect as useEffect7,
|
|
3
|
-
import { DAppPeerConnect } from "@fabianbormann/cardano-peer-connect";
|
|
2
|
+
import { useEffect as useEffect7, useState as useState9 } from "react";
|
|
4
3
|
|
|
5
4
|
// src/common/button.tsx
|
|
6
5
|
import * as React3 from "react";
|
|
@@ -2900,41 +2899,10 @@ function IconChevronRight() {
|
|
|
2900
2899
|
);
|
|
2901
2900
|
}
|
|
2902
2901
|
|
|
2903
|
-
// src/common/icons/icon-download.tsx
|
|
2904
|
-
import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2905
|
-
function IconDownload() {
|
|
2906
|
-
return /* @__PURE__ */ jsxs3(
|
|
2907
|
-
"svg",
|
|
2908
|
-
{
|
|
2909
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
2910
|
-
width: "24",
|
|
2911
|
-
height: "24",
|
|
2912
|
-
viewBox: "0 0 24 24",
|
|
2913
|
-
fill: "none",
|
|
2914
|
-
stroke: "gray",
|
|
2915
|
-
strokeWidth: "2",
|
|
2916
|
-
strokeLinecap: "round",
|
|
2917
|
-
strokeLinejoin: "round",
|
|
2918
|
-
style: {
|
|
2919
|
-
color: "#ffadff",
|
|
2920
|
-
width: "24px",
|
|
2921
|
-
height: "24px",
|
|
2922
|
-
strokeWidth: "1px"
|
|
2923
|
-
},
|
|
2924
|
-
className: "hover:mesh-fill-white",
|
|
2925
|
-
children: [
|
|
2926
|
-
/* @__PURE__ */ jsx6("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
2927
|
-
/* @__PURE__ */ jsx6("polyline", { points: "7 10 12 15 17 10" }),
|
|
2928
|
-
/* @__PURE__ */ jsx6("line", { x1: "12", x2: "12", y1: "15", y2: "3" })
|
|
2929
|
-
]
|
|
2930
|
-
}
|
|
2931
|
-
);
|
|
2932
|
-
}
|
|
2933
|
-
|
|
2934
2902
|
// src/common/icons/icon-monitor-smartphone.tsx
|
|
2935
|
-
import { jsx as
|
|
2903
|
+
import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2936
2904
|
function IconMonitorSmartphone() {
|
|
2937
|
-
return /* @__PURE__ */
|
|
2905
|
+
return /* @__PURE__ */ jsxs3(
|
|
2938
2906
|
"svg",
|
|
2939
2907
|
{
|
|
2940
2908
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -2953,30 +2921,30 @@ function IconMonitorSmartphone() {
|
|
|
2953
2921
|
strokeWidth: "1px"
|
|
2954
2922
|
},
|
|
2955
2923
|
children: [
|
|
2956
|
-
/* @__PURE__ */
|
|
2957
|
-
/* @__PURE__ */
|
|
2958
|
-
/* @__PURE__ */
|
|
2959
|
-
/* @__PURE__ */
|
|
2924
|
+
/* @__PURE__ */ jsx6("path", { d: "M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8" }),
|
|
2925
|
+
/* @__PURE__ */ jsx6("path", { d: "M10 19v-3.96 3.15" }),
|
|
2926
|
+
/* @__PURE__ */ jsx6("path", { d: "M7 19h5" }),
|
|
2927
|
+
/* @__PURE__ */ jsx6("rect", { width: "6", height: "10", x: "16", y: "12", rx: "2" })
|
|
2960
2928
|
]
|
|
2961
2929
|
}
|
|
2962
2930
|
);
|
|
2963
2931
|
}
|
|
2964
2932
|
|
|
2965
2933
|
// src/common/icons/wallet-icon.tsx
|
|
2966
|
-
import { jsx as
|
|
2934
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2967
2935
|
function WalletIcon({
|
|
2968
2936
|
icon,
|
|
2969
2937
|
name,
|
|
2970
2938
|
action,
|
|
2971
2939
|
iconReactNode
|
|
2972
2940
|
}) {
|
|
2973
|
-
return /* @__PURE__ */
|
|
2941
|
+
return /* @__PURE__ */ jsxs4(
|
|
2974
2942
|
"button",
|
|
2975
2943
|
{
|
|
2976
2944
|
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",
|
|
2977
2945
|
onClick: action,
|
|
2978
2946
|
children: [
|
|
2979
|
-
icon && /* @__PURE__ */
|
|
2947
|
+
icon && /* @__PURE__ */ jsx7("img", { src: icon, alt: name, className: "mesh-w-8 mesh-h-8" }),
|
|
2980
2948
|
iconReactNode && iconReactNode
|
|
2981
2949
|
]
|
|
2982
2950
|
}
|
|
@@ -3040,10 +3008,10 @@ var WalletContext = createContext({
|
|
|
3040
3008
|
});
|
|
3041
3009
|
|
|
3042
3010
|
// src/contexts/index.tsx
|
|
3043
|
-
import { Fragment as Fragment2, jsx as
|
|
3011
|
+
import { Fragment as Fragment2, jsx as jsx8 } from "react/jsx-runtime";
|
|
3044
3012
|
var MeshProvider = (props) => {
|
|
3045
3013
|
const store = useWalletStore();
|
|
3046
|
-
return /* @__PURE__ */
|
|
3014
|
+
return /* @__PURE__ */ jsx8(WalletContext.Provider, { value: store, children: /* @__PURE__ */ jsx8(Fragment2, { children: props.children }) });
|
|
3047
3015
|
};
|
|
3048
3016
|
|
|
3049
3017
|
// src/hooks/useAddress.ts
|
|
@@ -3204,7 +3172,7 @@ var useWalletSubmit = () => {
|
|
|
3204
3172
|
};
|
|
3205
3173
|
|
|
3206
3174
|
// src/cardano-wallet/index.tsx
|
|
3207
|
-
import { jsx as
|
|
3175
|
+
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
3208
3176
|
var CardanoWallet = ({
|
|
3209
3177
|
label = "Connect Wallet",
|
|
3210
3178
|
onConnected = void 0,
|
|
@@ -3221,21 +3189,21 @@ var CardanoWallet = ({
|
|
|
3221
3189
|
if (onConnected) onConnected();
|
|
3222
3190
|
}
|
|
3223
3191
|
}, [connected, wallet]);
|
|
3224
|
-
return /* @__PURE__ */
|
|
3225
|
-
!connected ? /* @__PURE__ */
|
|
3226
|
-
/* @__PURE__ */
|
|
3227
|
-
/* @__PURE__ */
|
|
3228
|
-
/* @__PURE__ */
|
|
3229
|
-
screen != "main" ? /* @__PURE__ */
|
|
3230
|
-
/* @__PURE__ */
|
|
3192
|
+
return /* @__PURE__ */ jsxs5(Dialog, { open, onOpenChange: setOpen, children: [
|
|
3193
|
+
!connected ? /* @__PURE__ */ jsx9(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsx9(Button, { variant: "outline", className: "mesh-text-white", children: label }) }) : /* @__PURE__ */ jsx9(ConnectedDropdown, {}),
|
|
3194
|
+
/* @__PURE__ */ jsxs5(DialogContent, { className: "sm:mesh-max-w-[425px]", children: [
|
|
3195
|
+
/* @__PURE__ */ jsxs5(DialogHeader, { children: [
|
|
3196
|
+
/* @__PURE__ */ jsxs5(DialogTitle, { className: "mesh-flex mesh-justify-between", children: [
|
|
3197
|
+
screen != "main" ? /* @__PURE__ */ jsx9("button", { onClick: () => setScreen("main"), children: /* @__PURE__ */ jsx9(IconChevronRight, {}) }) : /* @__PURE__ */ jsx9("span", { style: { width: "24px" } }),
|
|
3198
|
+
/* @__PURE__ */ jsxs5("span", { children: [
|
|
3231
3199
|
screen == "main" && "Connect Wallet",
|
|
3232
3200
|
screen == "p2p" && "P2P Connect"
|
|
3233
3201
|
] }),
|
|
3234
|
-
/* @__PURE__ */
|
|
3202
|
+
/* @__PURE__ */ jsx9("span", { style: { width: "24px" } })
|
|
3235
3203
|
] }),
|
|
3236
|
-
/* @__PURE__ */
|
|
3204
|
+
/* @__PURE__ */ jsx9(DialogDescription, { children: screen == "p2p" && "Use wallet that supports CIP-45, scan this QR code to connect." })
|
|
3237
3205
|
] }),
|
|
3238
|
-
screen == "main" && /* @__PURE__ */
|
|
3206
|
+
screen == "main" && /* @__PURE__ */ jsx9(
|
|
3239
3207
|
MainScreen,
|
|
3240
3208
|
{
|
|
3241
3209
|
metamask,
|
|
@@ -3244,16 +3212,15 @@ var CardanoWallet = ({
|
|
|
3244
3212
|
setScreen
|
|
3245
3213
|
}
|
|
3246
3214
|
),
|
|
3247
|
-
|
|
3248
|
-
/* @__PURE__ */ jsx10(DialogFooter, { className: "mesh-justify-center mesh-text-sm", children: /* @__PURE__ */ jsxs6(
|
|
3215
|
+
/* @__PURE__ */ jsx9(DialogFooter, { className: "mesh-justify-center mesh-text-sm", children: /* @__PURE__ */ jsxs5(
|
|
3249
3216
|
"a",
|
|
3250
3217
|
{
|
|
3251
3218
|
href: "https://meshjs.dev/",
|
|
3252
3219
|
target: "_blank",
|
|
3253
3220
|
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",
|
|
3254
3221
|
children: [
|
|
3255
|
-
/* @__PURE__ */
|
|
3256
|
-
/* @__PURE__ */
|
|
3222
|
+
/* @__PURE__ */ jsx9("span", { className: "", children: "Powered by" }),
|
|
3223
|
+
/* @__PURE__ */ jsx9(
|
|
3257
3224
|
"svg",
|
|
3258
3225
|
{
|
|
3259
3226
|
width: 24,
|
|
@@ -3261,10 +3228,10 @@ var CardanoWallet = ({
|
|
|
3261
3228
|
enableBackground: "new 0 0 300 200",
|
|
3262
3229
|
viewBox: "0 0 300 200",
|
|
3263
3230
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3264
|
-
children: /* @__PURE__ */
|
|
3231
|
+
children: /* @__PURE__ */ jsx9("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" })
|
|
3265
3232
|
}
|
|
3266
3233
|
),
|
|
3267
|
-
/* @__PURE__ */
|
|
3234
|
+
/* @__PURE__ */ jsx9("span", { className: "", children: "Mesh SDK" })
|
|
3268
3235
|
]
|
|
3269
3236
|
}
|
|
3270
3237
|
) })
|
|
@@ -3284,16 +3251,16 @@ function ConnectedDropdown() {
|
|
|
3284
3251
|
afterConnectedWallet();
|
|
3285
3252
|
}
|
|
3286
3253
|
}, [connected, wallet]);
|
|
3287
|
-
return /* @__PURE__ */
|
|
3288
|
-
/* @__PURE__ */
|
|
3254
|
+
return /* @__PURE__ */ jsxs5(DropdownMenu, { children: [
|
|
3255
|
+
/* @__PURE__ */ jsx9(DropdownMenuTrigger, { children: /* @__PURE__ */ jsxs5(Button, { variant: "outline", className: "mesh-text-white", children: [
|
|
3289
3256
|
address.slice(0, 6),
|
|
3290
3257
|
"...",
|
|
3291
3258
|
address.slice(-6)
|
|
3292
3259
|
] }) }),
|
|
3293
|
-
/* @__PURE__ */
|
|
3294
|
-
/* @__PURE__ */
|
|
3295
|
-
/* @__PURE__ */
|
|
3296
|
-
/* @__PURE__ */
|
|
3260
|
+
/* @__PURE__ */ jsxs5(DropdownMenuContent, { children: [
|
|
3261
|
+
/* @__PURE__ */ jsx9(DropdownMenuLabel, { children: "Wallet" }),
|
|
3262
|
+
/* @__PURE__ */ jsx9(DropdownMenuSeparator, {}),
|
|
3263
|
+
/* @__PURE__ */ jsx9(
|
|
3297
3264
|
DropdownMenuItem,
|
|
3298
3265
|
{
|
|
3299
3266
|
onClick: () => {
|
|
@@ -3302,7 +3269,7 @@ function ConnectedDropdown() {
|
|
|
3302
3269
|
children: "Copy Address"
|
|
3303
3270
|
}
|
|
3304
3271
|
),
|
|
3305
|
-
/* @__PURE__ */
|
|
3272
|
+
/* @__PURE__ */ jsx9(
|
|
3306
3273
|
DropdownMenuItem,
|
|
3307
3274
|
{
|
|
3308
3275
|
onClick: () => {
|
|
@@ -3322,8 +3289,8 @@ function MainScreen({
|
|
|
3322
3289
|
}) {
|
|
3323
3290
|
const wallets = useWalletList({ metamask });
|
|
3324
3291
|
const { connect } = useWallet();
|
|
3325
|
-
return /* @__PURE__ */
|
|
3326
|
-
wallets.map((wallet, index) => /* @__PURE__ */
|
|
3292
|
+
return /* @__PURE__ */ jsxs5("div", { className: "mesh-grid mesh-gap-4 mesh-py-4 mesh-grid-cols-4 mesh-place-items-center", children: [
|
|
3293
|
+
wallets.map((wallet, index) => /* @__PURE__ */ jsx9(
|
|
3327
3294
|
WalletIcon,
|
|
3328
3295
|
{
|
|
3329
3296
|
icon: wallet.icon,
|
|
@@ -3335,7 +3302,7 @@ function MainScreen({
|
|
|
3335
3302
|
},
|
|
3336
3303
|
index
|
|
3337
3304
|
)),
|
|
3338
|
-
/* @__PURE__ */
|
|
3305
|
+
/* @__PURE__ */ jsx9(
|
|
3339
3306
|
WalletIcon,
|
|
3340
3307
|
{
|
|
3341
3308
|
iconReactNode: IconMonitorSmartphone(),
|
|
@@ -3344,101 +3311,26 @@ function MainScreen({
|
|
|
3344
3311
|
setScreen("p2p");
|
|
3345
3312
|
}
|
|
3346
3313
|
}
|
|
3347
|
-
),
|
|
3348
|
-
/* @__PURE__ */ jsx10(
|
|
3349
|
-
WalletIcon,
|
|
3350
|
-
{
|
|
3351
|
-
iconReactNode: IconDownload(),
|
|
3352
|
-
name: `P2P`,
|
|
3353
|
-
action: () => {
|
|
3354
|
-
window.open(
|
|
3355
|
-
"https://developers.cardano.org/showcase/?tags=wallet",
|
|
3356
|
-
"_blank"
|
|
3357
|
-
);
|
|
3358
|
-
}
|
|
3359
|
-
}
|
|
3360
|
-
)
|
|
3361
|
-
] });
|
|
3362
|
-
}
|
|
3363
|
-
function P2PScreen({
|
|
3364
|
-
cardanoPeerConnect
|
|
3365
|
-
}) {
|
|
3366
|
-
const dAppConnect = useRef2(null);
|
|
3367
|
-
const qrCodeField = useRef2(null);
|
|
3368
|
-
const [address, setAddress] = useState9("");
|
|
3369
|
-
const [copied, setCopied] = useState9(false);
|
|
3370
|
-
const [connected, setConnected] = useState9(false);
|
|
3371
|
-
console.log("address", address);
|
|
3372
|
-
useEffect7(() => {
|
|
3373
|
-
if (cardanoPeerConnect) {
|
|
3374
|
-
if (dAppConnect.current === null) {
|
|
3375
|
-
dAppConnect.current = new DAppPeerConnect({
|
|
3376
|
-
dAppInfo: {
|
|
3377
|
-
name: cardanoPeerConnect.dAppInfo.name,
|
|
3378
|
-
url: cardanoPeerConnect.dAppInfo.url
|
|
3379
|
-
},
|
|
3380
|
-
announce: cardanoPeerConnect.announce,
|
|
3381
|
-
onApiInject: (name, address2) => {
|
|
3382
|
-
console.log("onApiInject", name, address2);
|
|
3383
|
-
},
|
|
3384
|
-
onApiEject: (name, address2) => {
|
|
3385
|
-
console.log("onApiEject", name, address2);
|
|
3386
|
-
},
|
|
3387
|
-
onConnect: (address2, walletInfo) => {
|
|
3388
|
-
console.log("Connected to wallet", address2, walletInfo);
|
|
3389
|
-
},
|
|
3390
|
-
onDisconnect: () => {
|
|
3391
|
-
console.log("Disconnected from wallet");
|
|
3392
|
-
},
|
|
3393
|
-
verifyConnection: (walletInfo, callback) => {
|
|
3394
|
-
console.log("verifyConnection", walletInfo);
|
|
3395
|
-
callback(true, true);
|
|
3396
|
-
},
|
|
3397
|
-
useWalletDiscovery: true
|
|
3398
|
-
});
|
|
3399
|
-
console.log(1, dAppConnect.current);
|
|
3400
|
-
if (dAppConnect.current) {
|
|
3401
|
-
setAddress(dAppConnect.current.getAddress());
|
|
3402
|
-
if (qrCodeField.current !== null) {
|
|
3403
|
-
dAppConnect.current.generateQRCode(qrCodeField.current);
|
|
3404
|
-
}
|
|
3405
|
-
}
|
|
3406
|
-
}
|
|
3407
|
-
}
|
|
3408
|
-
}, []);
|
|
3409
|
-
return /* @__PURE__ */ jsxs6("div", { className: "mesh-flex mesh-flex-col mesh-items-center mesh-justify-center", children: [
|
|
3410
|
-
/* @__PURE__ */ jsx10("div", { style: { marginTop: 16, marginBottom: 16 }, ref: qrCodeField }),
|
|
3411
|
-
/* @__PURE__ */ jsx10(
|
|
3412
|
-
Button,
|
|
3413
|
-
{
|
|
3414
|
-
variant: "outline",
|
|
3415
|
-
className: "mesh-text-white",
|
|
3416
|
-
onClick: () => {
|
|
3417
|
-
navigator.clipboard.writeText(address);
|
|
3418
|
-
setCopied(true);
|
|
3419
|
-
},
|
|
3420
|
-
children: copied ? "Copied" : "Copy Address"
|
|
3421
|
-
}
|
|
3422
3314
|
)
|
|
3423
3315
|
] });
|
|
3424
3316
|
}
|
|
3425
3317
|
|
|
3426
3318
|
// src/mesh-badge/mesh-logo.tsx
|
|
3427
|
-
import { jsx as
|
|
3428
|
-
var MeshLogo = () => /* @__PURE__ */
|
|
3319
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
3320
|
+
var MeshLogo = () => /* @__PURE__ */ jsx10(
|
|
3429
3321
|
"svg",
|
|
3430
3322
|
{
|
|
3431
3323
|
className: "mesh-h-16 mesh-p-2",
|
|
3432
3324
|
fill: "currentColor",
|
|
3433
3325
|
viewBox: "0 0 300 200",
|
|
3434
3326
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3435
|
-
children: /* @__PURE__ */
|
|
3327
|
+
children: /* @__PURE__ */ jsx10("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" })
|
|
3436
3328
|
}
|
|
3437
3329
|
);
|
|
3438
3330
|
|
|
3439
3331
|
// src/mesh-badge/index.tsx
|
|
3440
|
-
import { jsx as
|
|
3441
|
-
var MeshBadge = ({ isDark = false }) => /* @__PURE__ */
|
|
3332
|
+
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
3333
|
+
var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ jsxs6(
|
|
3442
3334
|
"a",
|
|
3443
3335
|
{
|
|
3444
3336
|
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`}`,
|
|
@@ -3450,7 +3342,7 @@ var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ jsxs7(
|
|
|
3450
3342
|
rel: "noopener noreferrer",
|
|
3451
3343
|
target: "_blank",
|
|
3452
3344
|
children: [
|
|
3453
|
-
/* @__PURE__ */
|
|
3345
|
+
/* @__PURE__ */ jsx11(MeshLogo, {}),
|
|
3454
3346
|
"Mesh"
|
|
3455
3347
|
]
|
|
3456
3348
|
}
|
|
@@ -3464,7 +3356,7 @@ import { Transaction } from "@meshsdk/transaction";
|
|
|
3464
3356
|
import { useEffect as useEffect8, useState as useState10 } from "react";
|
|
3465
3357
|
|
|
3466
3358
|
// src/common/button-dropdown.tsx
|
|
3467
|
-
import { jsx as
|
|
3359
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
3468
3360
|
function ButtonDropdown({
|
|
3469
3361
|
children,
|
|
3470
3362
|
isDarkMode = false,
|
|
@@ -3473,7 +3365,7 @@ function ButtonDropdown({
|
|
|
3473
3365
|
onMouseEnter,
|
|
3474
3366
|
onMouseLeave
|
|
3475
3367
|
}) {
|
|
3476
|
-
return /* @__PURE__ */
|
|
3368
|
+
return /* @__PURE__ */ jsx12(
|
|
3477
3369
|
"button",
|
|
3478
3370
|
{
|
|
3479
3371
|
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`}`,
|
|
@@ -3486,21 +3378,21 @@ function ButtonDropdown({
|
|
|
3486
3378
|
}
|
|
3487
3379
|
|
|
3488
3380
|
// src/cardano-wallet-dropdown/menu-item.tsx
|
|
3489
|
-
import { jsx as
|
|
3381
|
+
import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3490
3382
|
function MenuItem({
|
|
3491
3383
|
icon,
|
|
3492
3384
|
label,
|
|
3493
3385
|
action,
|
|
3494
3386
|
active
|
|
3495
3387
|
}) {
|
|
3496
|
-
return /* @__PURE__ */
|
|
3388
|
+
return /* @__PURE__ */ jsxs7(
|
|
3497
3389
|
"div",
|
|
3498
3390
|
{
|
|
3499
3391
|
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",
|
|
3500
3392
|
onClick: action,
|
|
3501
3393
|
children: [
|
|
3502
|
-
icon && /* @__PURE__ */
|
|
3503
|
-
/* @__PURE__ */
|
|
3394
|
+
icon && /* @__PURE__ */ jsx13("img", { className: "mesh-pr-2 mesh-m-1 mesh-h-8", src: icon }),
|
|
3395
|
+
/* @__PURE__ */ jsx13("span", { className: "mesh-mr-menu-item mesh-text-xl mesh-font-normal mesh-text-gray-700 hover:mesh-text-black", children: label.split(" ").map((word) => {
|
|
3504
3396
|
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
3505
3397
|
}).join(" ") })
|
|
3506
3398
|
]
|
|
@@ -3509,8 +3401,8 @@ function MenuItem({
|
|
|
3509
3401
|
}
|
|
3510
3402
|
|
|
3511
3403
|
// src/cardano-wallet-dropdown/chevron-down.tsx
|
|
3512
|
-
import { jsx as
|
|
3513
|
-
var ChevronDown = () => /* @__PURE__ */
|
|
3404
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
3405
|
+
var ChevronDown = () => /* @__PURE__ */ jsx14(
|
|
3514
3406
|
"svg",
|
|
3515
3407
|
{
|
|
3516
3408
|
className: "mesh-m-2 mesh-h-6",
|
|
@@ -3519,7 +3411,7 @@ var ChevronDown = () => /* @__PURE__ */ jsx15(
|
|
|
3519
3411
|
viewBox: "0 0 24 24",
|
|
3520
3412
|
stroke: "currentColor",
|
|
3521
3413
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3522
|
-
children: /* @__PURE__ */
|
|
3414
|
+
children: /* @__PURE__ */ jsx14(
|
|
3523
3415
|
"path",
|
|
3524
3416
|
{
|
|
3525
3417
|
strokeLinecap: "round",
|
|
@@ -3532,7 +3424,7 @@ var ChevronDown = () => /* @__PURE__ */ jsx15(
|
|
|
3532
3424
|
);
|
|
3533
3425
|
|
|
3534
3426
|
// src/cardano-wallet-dropdown/wallet-balance.tsx
|
|
3535
|
-
import { Fragment as Fragment3, jsx as
|
|
3427
|
+
import { Fragment as Fragment3, jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3536
3428
|
var WalletBalance = ({
|
|
3537
3429
|
connected,
|
|
3538
3430
|
connecting,
|
|
@@ -3540,22 +3432,22 @@ var WalletBalance = ({
|
|
|
3540
3432
|
wallet
|
|
3541
3433
|
}) => {
|
|
3542
3434
|
const lovelace = useLovelace();
|
|
3543
|
-
return connected && lovelace && wallet?.icon ? /* @__PURE__ */
|
|
3544
|
-
/* @__PURE__ */
|
|
3435
|
+
return connected && lovelace && wallet?.icon ? /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
3436
|
+
/* @__PURE__ */ jsx15("img", { className: "mesh-m-2 mesh-h-6", src: wallet.icon }),
|
|
3545
3437
|
"\u20B3",
|
|
3546
3438
|
" ",
|
|
3547
3439
|
parseInt((parseInt(lovelace, 10) / 1e6).toString(), 10),
|
|
3548
3440
|
".",
|
|
3549
|
-
/* @__PURE__ */
|
|
3550
|
-
] }) : connected && wallet?.icon ? /* @__PURE__ */
|
|
3441
|
+
/* @__PURE__ */ jsx15("span", { className: "mesh-text-xs", children: lovelace.substring(lovelace.length - 6) })
|
|
3442
|
+
] }) : connected && wallet?.icon ? /* @__PURE__ */ jsx15(Fragment3, { children: /* @__PURE__ */ jsx15("img", { className: "mesh-m-2 mesh-h-6", src: wallet.icon }) }) : connecting ? /* @__PURE__ */ jsx15(Fragment3, { children: "Connecting..." }) : /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
3551
3443
|
label,
|
|
3552
3444
|
" ",
|
|
3553
|
-
/* @__PURE__ */
|
|
3445
|
+
/* @__PURE__ */ jsx15(ChevronDown, {})
|
|
3554
3446
|
] });
|
|
3555
3447
|
};
|
|
3556
3448
|
|
|
3557
3449
|
// src/cardano-wallet-dropdown/index.tsx
|
|
3558
|
-
import { Fragment as Fragment4, jsx as
|
|
3450
|
+
import { Fragment as Fragment4, jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3559
3451
|
var CardanoWallet2 = ({
|
|
3560
3452
|
label = "Connect Wallet",
|
|
3561
3453
|
onConnected = void 0,
|
|
@@ -3576,20 +3468,20 @@ var CardanoWallet2 = ({
|
|
|
3576
3468
|
useEffect8(() => {
|
|
3577
3469
|
setIsDarkMode(isDark);
|
|
3578
3470
|
}, [isDark]);
|
|
3579
|
-
return /* @__PURE__ */
|
|
3471
|
+
return /* @__PURE__ */ jsxs9(
|
|
3580
3472
|
"div",
|
|
3581
3473
|
{
|
|
3582
3474
|
onMouseEnter: () => setHideMenuList(false),
|
|
3583
3475
|
onMouseLeave: () => setHideMenuList(true),
|
|
3584
3476
|
style: { width: "min-content", zIndex: 50 },
|
|
3585
3477
|
children: [
|
|
3586
|
-
/* @__PURE__ */
|
|
3478
|
+
/* @__PURE__ */ jsx16(
|
|
3587
3479
|
ButtonDropdown,
|
|
3588
3480
|
{
|
|
3589
3481
|
isDarkMode,
|
|
3590
3482
|
hideMenuList,
|
|
3591
3483
|
setHideMenuList,
|
|
3592
|
-
children: /* @__PURE__ */
|
|
3484
|
+
children: /* @__PURE__ */ jsx16(
|
|
3593
3485
|
WalletBalance,
|
|
3594
3486
|
{
|
|
3595
3487
|
connected,
|
|
@@ -3600,12 +3492,12 @@ var CardanoWallet2 = ({
|
|
|
3600
3492
|
)
|
|
3601
3493
|
}
|
|
3602
3494
|
),
|
|
3603
|
-
/* @__PURE__ */
|
|
3495
|
+
/* @__PURE__ */ jsx16(
|
|
3604
3496
|
"div",
|
|
3605
3497
|
{
|
|
3606
3498
|
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`}`,
|
|
3607
3499
|
style: { zIndex: 50 },
|
|
3608
|
-
children: !connected && wallets.length > 0 ? /* @__PURE__ */
|
|
3500
|
+
children: !connected && wallets.length > 0 ? /* @__PURE__ */ jsx16(Fragment4, { children: wallets.map((wallet, index) => /* @__PURE__ */ jsx16(
|
|
3609
3501
|
MenuItem,
|
|
3610
3502
|
{
|
|
3611
3503
|
icon: wallet.icon,
|
|
@@ -3617,7 +3509,7 @@ var CardanoWallet2 = ({
|
|
|
3617
3509
|
active: name === wallet.id
|
|
3618
3510
|
},
|
|
3619
3511
|
index
|
|
3620
|
-
)) }) : wallets.length === 0 ? /* @__PURE__ */
|
|
3512
|
+
)) }) : wallets.length === 0 ? /* @__PURE__ */ jsx16("span", { children: "No Wallet Found" }) : /* @__PURE__ */ jsx16(Fragment4, { children: /* @__PURE__ */ jsx16(
|
|
3621
3513
|
MenuItem,
|
|
3622
3514
|
{
|
|
3623
3515
|
active: false,
|
|
@@ -3634,7 +3526,7 @@ var CardanoWallet2 = ({
|
|
|
3634
3526
|
};
|
|
3635
3527
|
|
|
3636
3528
|
// src/stake-button/index.tsx
|
|
3637
|
-
import { Fragment as Fragment5, jsx as
|
|
3529
|
+
import { Fragment as Fragment5, jsx as jsx17 } from "react/jsx-runtime";
|
|
3638
3530
|
var StakeButton = ({
|
|
3639
3531
|
label = "Stake your ADA",
|
|
3640
3532
|
isDark = false,
|
|
@@ -3647,14 +3539,14 @@ var StakeButton = ({
|
|
|
3647
3539
|
useEffect9(() => {
|
|
3648
3540
|
setIsDarkMode(isDark);
|
|
3649
3541
|
}, [isDark]);
|
|
3650
|
-
return /* @__PURE__ */
|
|
3542
|
+
return /* @__PURE__ */ jsx17(Fragment5, { children: connected ? /* @__PURE__ */ jsx17(ButtonDropdown, { isDarkMode, children: /* @__PURE__ */ jsx17(
|
|
3651
3543
|
Delegate,
|
|
3652
3544
|
{
|
|
3653
3545
|
poolId,
|
|
3654
3546
|
onCheck,
|
|
3655
3547
|
onDelegated
|
|
3656
3548
|
}
|
|
3657
|
-
) }) : /* @__PURE__ */
|
|
3549
|
+
) }) : /* @__PURE__ */ jsx17(CardanoWallet2, { label, isDark }) });
|
|
3658
3550
|
};
|
|
3659
3551
|
var Delegate = ({
|
|
3660
3552
|
poolId,
|
|
@@ -3722,18 +3614,18 @@ var Delegate = ({
|
|
|
3722
3614
|
checkAccountStatus();
|
|
3723
3615
|
}, [rewardAddress]);
|
|
3724
3616
|
if (checking) {
|
|
3725
|
-
return /* @__PURE__ */
|
|
3617
|
+
return /* @__PURE__ */ jsx17("span", { children: "Checking..." });
|
|
3726
3618
|
}
|
|
3727
3619
|
if (processing) {
|
|
3728
|
-
return /* @__PURE__ */
|
|
3620
|
+
return /* @__PURE__ */ jsx17("span", { children: "Loading..." });
|
|
3729
3621
|
}
|
|
3730
3622
|
if (done) {
|
|
3731
|
-
return /* @__PURE__ */
|
|
3623
|
+
return /* @__PURE__ */ jsx17("span", { children: "Stake Delegated" });
|
|
3732
3624
|
}
|
|
3733
3625
|
if (accountInfo?.active) {
|
|
3734
|
-
return accountInfo.poolId === poolId ? /* @__PURE__ */
|
|
3626
|
+
return accountInfo.poolId === poolId ? /* @__PURE__ */ jsx17("span", { children: "Stake Delegated" }) : /* @__PURE__ */ jsx17("span", { onClick: delegateStake, children: "Begin Staking" });
|
|
3735
3627
|
}
|
|
3736
|
-
return /* @__PURE__ */
|
|
3628
|
+
return /* @__PURE__ */ jsx17("span", { onClick: registerAddress, children: "Begin Staking" });
|
|
3737
3629
|
};
|
|
3738
3630
|
export {
|
|
3739
3631
|
CardanoWallet,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meshsdk/react",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.22",
|
|
4
4
|
"description": "React component library - https://meshjs.dev/react",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"browser": "./dist/index.js",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@fabianbormann/cardano-peer-connect": "^1.2.18",
|
|
32
|
-
"@meshsdk/common": "1.7.
|
|
33
|
-
"@meshsdk/transaction": "1.7.
|
|
34
|
-
"@meshsdk/wallet": "1.7.
|
|
32
|
+
"@meshsdk/common": "1.7.22",
|
|
33
|
+
"@meshsdk/transaction": "1.7.22",
|
|
34
|
+
"@meshsdk/wallet": "1.7.22",
|
|
35
35
|
"@radix-ui/react-dialog": "^1.1.2",
|
|
36
36
|
"@radix-ui/react-dropdown-menu": "^2.1.2",
|
|
37
37
|
"@radix-ui/react-icons": "^1.3.2",
|