@meshsdk/react 1.7.25 → 1.7.26
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 +345 -149
- package/dist/index.css +22 -0
- package/dist/index.d.cts +16 -11
- package/dist/index.d.ts +16 -11
- package/dist/index.js +343 -147
- package/package.json +5 -4
package/dist/index.cjs
CHANGED
|
@@ -47,7 +47,7 @@ __export(src_exports, {
|
|
|
47
47
|
module.exports = __toCommonJS(src_exports);
|
|
48
48
|
|
|
49
49
|
// src/cardano-wallet/index.tsx
|
|
50
|
-
var
|
|
50
|
+
var import_react13 = require("react");
|
|
51
51
|
|
|
52
52
|
// src/common/button.tsx
|
|
53
53
|
var React3 = __toESM(require("react"), 1);
|
|
@@ -2818,16 +2818,14 @@ var import_react2 = require("react");
|
|
|
2818
2818
|
var import_react = require("react");
|
|
2819
2819
|
var import_wallet = require("@meshsdk/wallet");
|
|
2820
2820
|
var INITIAL_STATE = {
|
|
2821
|
-
walletName:
|
|
2821
|
+
walletName: void 0,
|
|
2822
2822
|
walletInstance: {}
|
|
2823
2823
|
};
|
|
2824
2824
|
var useWalletStore = () => {
|
|
2825
2825
|
const [error, setError] = (0, import_react.useState)(void 0);
|
|
2826
2826
|
const [connectingWallet, setConnectingWallet] = (0, import_react.useState)(false);
|
|
2827
2827
|
const [connectedWalletInstance, setConnectedWalletInstance] = (0, import_react.useState)(INITIAL_STATE.walletInstance);
|
|
2828
|
-
const [connectedWalletName, setConnectedWalletName] = (0, import_react.useState)(
|
|
2829
|
-
INITIAL_STATE.walletName
|
|
2830
|
-
);
|
|
2828
|
+
const [connectedWalletName, setConnectedWalletName] = (0, import_react.useState)(INITIAL_STATE.walletName);
|
|
2831
2829
|
const connectWallet = (0, import_react.useCallback)(
|
|
2832
2830
|
async (walletName, extensions) => {
|
|
2833
2831
|
setConnectingWallet(true);
|
|
@@ -2850,6 +2848,13 @@ var useWalletStore = () => {
|
|
|
2850
2848
|
setConnectedWalletName(INITIAL_STATE.walletName);
|
|
2851
2849
|
setConnectedWalletInstance(INITIAL_STATE.walletInstance);
|
|
2852
2850
|
}, []);
|
|
2851
|
+
const setWallet = (0, import_react.useCallback)(
|
|
2852
|
+
async (walletInstance, walletName) => {
|
|
2853
|
+
setConnectedWalletInstance(walletInstance);
|
|
2854
|
+
setConnectedWalletName(walletName);
|
|
2855
|
+
},
|
|
2856
|
+
[]
|
|
2857
|
+
);
|
|
2853
2858
|
return {
|
|
2854
2859
|
hasConnectedWallet: INITIAL_STATE.walletName !== connectedWalletName,
|
|
2855
2860
|
connectedWalletInstance,
|
|
@@ -2857,6 +2862,7 @@ var useWalletStore = () => {
|
|
|
2857
2862
|
connectingWallet,
|
|
2858
2863
|
connectWallet,
|
|
2859
2864
|
disconnect,
|
|
2865
|
+
setWallet,
|
|
2860
2866
|
error
|
|
2861
2867
|
};
|
|
2862
2868
|
};
|
|
@@ -2864,7 +2870,13 @@ var WalletContext = (0, import_react.createContext)({
|
|
|
2864
2870
|
hasConnectedWallet: false,
|
|
2865
2871
|
connectedWalletInstance: INITIAL_STATE.walletInstance,
|
|
2866
2872
|
connectedWalletName: INITIAL_STATE.walletName,
|
|
2867
|
-
connectingWallet: false
|
|
2873
|
+
connectingWallet: false,
|
|
2874
|
+
connectWallet: async () => {
|
|
2875
|
+
},
|
|
2876
|
+
disconnect: () => {
|
|
2877
|
+
},
|
|
2878
|
+
setWallet: async () => {
|
|
2879
|
+
}
|
|
2868
2880
|
});
|
|
2869
2881
|
|
|
2870
2882
|
// src/contexts/index.tsx
|
|
@@ -2877,7 +2889,7 @@ var MeshProvider = (props) => {
|
|
|
2877
2889
|
// src/hooks/useAddress.ts
|
|
2878
2890
|
var useAddress = (accountId = 0) => {
|
|
2879
2891
|
const [address, setAddress] = (0, import_react2.useState)();
|
|
2880
|
-
const { hasConnectedWallet,
|
|
2892
|
+
const { hasConnectedWallet, connectedWalletInstance } = (0, import_react2.useContext)(WalletContext);
|
|
2881
2893
|
(0, import_react2.useEffect)(() => {
|
|
2882
2894
|
if (hasConnectedWallet) {
|
|
2883
2895
|
connectedWalletInstance.getUsedAddresses().then((addresses) => {
|
|
@@ -2886,7 +2898,7 @@ var useAddress = (accountId = 0) => {
|
|
|
2886
2898
|
}
|
|
2887
2899
|
});
|
|
2888
2900
|
}
|
|
2889
|
-
}, [accountId,
|
|
2901
|
+
}, [accountId, hasConnectedWallet, connectedWalletInstance]);
|
|
2890
2902
|
return address;
|
|
2891
2903
|
};
|
|
2892
2904
|
|
|
@@ -2894,12 +2906,12 @@ var useAddress = (accountId = 0) => {
|
|
|
2894
2906
|
var import_react3 = require("react");
|
|
2895
2907
|
var useAssets = () => {
|
|
2896
2908
|
const [assets, setAssets] = (0, import_react3.useState)();
|
|
2897
|
-
const { hasConnectedWallet,
|
|
2909
|
+
const { hasConnectedWallet, connectedWalletInstance } = (0, import_react3.useContext)(WalletContext);
|
|
2898
2910
|
(0, import_react3.useEffect)(() => {
|
|
2899
2911
|
if (hasConnectedWallet) {
|
|
2900
2912
|
connectedWalletInstance.getAssets().then(setAssets);
|
|
2901
2913
|
}
|
|
2902
|
-
}, [
|
|
2914
|
+
}, [hasConnectedWallet, connectedWalletInstance]);
|
|
2903
2915
|
return assets;
|
|
2904
2916
|
};
|
|
2905
2917
|
|
|
@@ -2927,12 +2939,12 @@ var useLovelace = () => {
|
|
|
2927
2939
|
const hasFetchedLovelace = (0, import_react5.useRef)(false);
|
|
2928
2940
|
(0, import_react5.useEffect)(() => {
|
|
2929
2941
|
async function getLovelace() {
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
hasFetchedLovelace.current = true;
|
|
2942
|
+
if (hasConnectedWallet && !hasFetchedLovelace.current) {
|
|
2943
|
+
setLovelace(await connectedWalletInstance.getLovelace());
|
|
2944
|
+
hasFetchedLovelace.current = true;
|
|
2945
|
+
}
|
|
2935
2946
|
}
|
|
2947
|
+
getLovelace();
|
|
2936
2948
|
}, [hasConnectedWallet, connectedWalletInstance]);
|
|
2937
2949
|
const _lovelace = (0, import_react5.useMemo)(() => {
|
|
2938
2950
|
return lovelace;
|
|
@@ -2944,14 +2956,14 @@ var useLovelace = () => {
|
|
|
2944
2956
|
var import_react6 = require("react");
|
|
2945
2957
|
var useNetwork = () => {
|
|
2946
2958
|
const [networkId, setNetworkId] = (0, import_react6.useState)();
|
|
2947
|
-
const { hasConnectedWallet,
|
|
2959
|
+
const { hasConnectedWallet, connectedWalletInstance } = (0, import_react6.useContext)(WalletContext);
|
|
2948
2960
|
(0, import_react6.useEffect)(() => {
|
|
2949
2961
|
if (hasConnectedWallet) {
|
|
2950
2962
|
connectedWalletInstance.getNetworkId().then(setNetworkId);
|
|
2951
2963
|
} else {
|
|
2952
2964
|
setNetworkId(void 0);
|
|
2953
2965
|
}
|
|
2954
|
-
}, [
|
|
2966
|
+
}, [hasConnectedWallet, connectedWalletInstance]);
|
|
2955
2967
|
return networkId;
|
|
2956
2968
|
};
|
|
2957
2969
|
|
|
@@ -2959,7 +2971,7 @@ var useNetwork = () => {
|
|
|
2959
2971
|
var import_react7 = require("react");
|
|
2960
2972
|
var useRewardAddress = (accountId = 0) => {
|
|
2961
2973
|
const [rewardAddress, setRewardAddress] = (0, import_react7.useState)();
|
|
2962
|
-
const { hasConnectedWallet,
|
|
2974
|
+
const { hasConnectedWallet, connectedWalletInstance } = (0, import_react7.useContext)(WalletContext);
|
|
2963
2975
|
(0, import_react7.useEffect)(() => {
|
|
2964
2976
|
if (hasConnectedWallet) {
|
|
2965
2977
|
connectedWalletInstance.getRewardAddresses().then((addresses) => {
|
|
@@ -2968,7 +2980,7 @@ var useRewardAddress = (accountId = 0) => {
|
|
|
2968
2980
|
}
|
|
2969
2981
|
});
|
|
2970
2982
|
}
|
|
2971
|
-
}, [accountId,
|
|
2983
|
+
}, [accountId, hasConnectedWallet, connectedWalletInstance]);
|
|
2972
2984
|
return rewardAddress;
|
|
2973
2985
|
};
|
|
2974
2986
|
|
|
@@ -2982,6 +2994,7 @@ var useWallet = () => {
|
|
|
2982
2994
|
connectingWallet,
|
|
2983
2995
|
connectWallet,
|
|
2984
2996
|
disconnect,
|
|
2997
|
+
setWallet,
|
|
2985
2998
|
error
|
|
2986
2999
|
} = (0, import_react8.useContext)(WalletContext);
|
|
2987
3000
|
if (connectWallet === void 0 || disconnect === void 0) {
|
|
@@ -2996,6 +3009,7 @@ var useWallet = () => {
|
|
|
2996
3009
|
wallet: connectedWalletInstance,
|
|
2997
3010
|
connect: connectWallet,
|
|
2998
3011
|
disconnect,
|
|
3012
|
+
setWallet,
|
|
2999
3013
|
error
|
|
3000
3014
|
};
|
|
3001
3015
|
};
|
|
@@ -3009,10 +3023,10 @@ var useWalletSubmit = () => {
|
|
|
3009
3023
|
const { hasConnectedWallet, connectedWalletInstance } = (0, import_react9.useContext)(WalletContext);
|
|
3010
3024
|
const submitTx = (0, import_react9.useCallback)(async (signedTx) => {
|
|
3011
3025
|
setSubmitting(true);
|
|
3026
|
+
setError(void 0);
|
|
3012
3027
|
try {
|
|
3013
3028
|
if (hasConnectedWallet) {
|
|
3014
3029
|
const txHash = await connectedWalletInstance.submitTx(signedTx);
|
|
3015
|
-
setError(void 0);
|
|
3016
3030
|
setResult(txHash);
|
|
3017
3031
|
}
|
|
3018
3032
|
throw new Error(
|
|
@@ -3212,10 +3226,143 @@ function ConnectedButton() {
|
|
|
3212
3226
|
] });
|
|
3213
3227
|
}
|
|
3214
3228
|
|
|
3215
|
-
// src/
|
|
3229
|
+
// src/cardano-wallet/data.ts
|
|
3230
|
+
var screens = {
|
|
3231
|
+
main: {
|
|
3232
|
+
title: "Connect Wallet"
|
|
3233
|
+
},
|
|
3234
|
+
p2p: {
|
|
3235
|
+
title: "Peer Connect (CIP45)",
|
|
3236
|
+
subtitle: "Use wallet that supports CIP-45, scan this QR code to connect."
|
|
3237
|
+
},
|
|
3238
|
+
burner: {
|
|
3239
|
+
title: "Burner Wallet",
|
|
3240
|
+
subtitle: "Instantly create a new burner wallet. No seed phrase required, keys are generated on your device."
|
|
3241
|
+
}
|
|
3242
|
+
};
|
|
3243
|
+
|
|
3244
|
+
// src/cardano-wallet/screen-burner.tsx
|
|
3245
|
+
var import_react11 = require("react");
|
|
3246
|
+
var import_wallet3 = require("@meshsdk/wallet");
|
|
3216
3247
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
3248
|
+
var localstoragekey = "mesh-burnerwallet";
|
|
3249
|
+
function ScreenBurner({
|
|
3250
|
+
networkId,
|
|
3251
|
+
provider,
|
|
3252
|
+
setOpen
|
|
3253
|
+
}) {
|
|
3254
|
+
const [loading, setLoading] = (0, import_react11.useState)(false);
|
|
3255
|
+
const [hasKeyInStorage, setHasKeyInStorage] = (0, import_react11.useState)(false);
|
|
3256
|
+
const { setWallet } = useWallet();
|
|
3257
|
+
function getKeyFromStorage() {
|
|
3258
|
+
return localStorage.getItem(localstoragekey);
|
|
3259
|
+
}
|
|
3260
|
+
(0, import_react11.useEffect)(() => {
|
|
3261
|
+
const key = getKeyFromStorage();
|
|
3262
|
+
if (key) {
|
|
3263
|
+
setHasKeyInStorage(true);
|
|
3264
|
+
}
|
|
3265
|
+
}, []);
|
|
3266
|
+
function createWallet(key) {
|
|
3267
|
+
setTimeout(() => {
|
|
3268
|
+
const wallet = new import_wallet3.MeshWallet({
|
|
3269
|
+
networkId,
|
|
3270
|
+
fetcher: provider,
|
|
3271
|
+
submitter: provider,
|
|
3272
|
+
key: {
|
|
3273
|
+
type: "root",
|
|
3274
|
+
bech32: key
|
|
3275
|
+
}
|
|
3276
|
+
});
|
|
3277
|
+
if (!hasKeyInStorage) {
|
|
3278
|
+
localStorage.setItem(localstoragekey, key);
|
|
3279
|
+
}
|
|
3280
|
+
setWallet(wallet, screens.burner.title);
|
|
3281
|
+
setLoading(false);
|
|
3282
|
+
setOpen(false);
|
|
3283
|
+
}, 500);
|
|
3284
|
+
}
|
|
3285
|
+
function handleRestoreWallet() {
|
|
3286
|
+
setLoading(true);
|
|
3287
|
+
const key = getKeyFromStorage();
|
|
3288
|
+
createWallet(key);
|
|
3289
|
+
}
|
|
3290
|
+
function handleCreateWallet() {
|
|
3291
|
+
setLoading(true);
|
|
3292
|
+
const key = import_wallet3.MeshWallet.brew(true);
|
|
3293
|
+
createWallet(key);
|
|
3294
|
+
}
|
|
3295
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "mesh-flex mesh-flex-row mesh-flex-gap-4 mesh-items-center mesh-justify-center", children: loading ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: "Setting up wallet..." }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
3296
|
+
hasKeyInStorage && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3297
|
+
Button,
|
|
3298
|
+
{
|
|
3299
|
+
variant: "outline",
|
|
3300
|
+
className: "mesh-text-white",
|
|
3301
|
+
onClick: () => {
|
|
3302
|
+
handleRestoreWallet();
|
|
3303
|
+
},
|
|
3304
|
+
disabled: loading,
|
|
3305
|
+
children: "Restore wallet"
|
|
3306
|
+
}
|
|
3307
|
+
),
|
|
3308
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3309
|
+
Button,
|
|
3310
|
+
{
|
|
3311
|
+
variant: "outline",
|
|
3312
|
+
className: "mesh-text-white",
|
|
3313
|
+
onClick: () => {
|
|
3314
|
+
handleCreateWallet();
|
|
3315
|
+
},
|
|
3316
|
+
disabled: loading,
|
|
3317
|
+
children: "Create wallet"
|
|
3318
|
+
}
|
|
3319
|
+
)
|
|
3320
|
+
] }) });
|
|
3321
|
+
}
|
|
3322
|
+
|
|
3323
|
+
// src/common/icons/icon-book-dashed.tsx
|
|
3324
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
3325
|
+
function IconBookDashed() {
|
|
3326
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3327
|
+
"svg",
|
|
3328
|
+
{
|
|
3329
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3330
|
+
width: "24",
|
|
3331
|
+
height: "24",
|
|
3332
|
+
viewBox: "0 0 24 24",
|
|
3333
|
+
fill: "none",
|
|
3334
|
+
stroke: "gray",
|
|
3335
|
+
strokeWidth: "2",
|
|
3336
|
+
strokeLinecap: "round",
|
|
3337
|
+
strokeLinejoin: "round",
|
|
3338
|
+
style: {
|
|
3339
|
+
color: "#ffadff",
|
|
3340
|
+
width: "24px",
|
|
3341
|
+
height: "24px",
|
|
3342
|
+
strokeWidth: "1px"
|
|
3343
|
+
},
|
|
3344
|
+
className: "hover:mesh-fill-white",
|
|
3345
|
+
children: [
|
|
3346
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M12 17h2" }),
|
|
3347
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M12 22h2" }),
|
|
3348
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M12 2h2" }),
|
|
3349
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M18 22h1a1 1 0 0 0 1-1" }),
|
|
3350
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M18 2h1a1 1 0 0 1 1 1v1" }),
|
|
3351
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M20 15v2h-2" }),
|
|
3352
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M20 8v3" }),
|
|
3353
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M4 11V9" }),
|
|
3354
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M4 19.5V15" }),
|
|
3355
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M4 5v-.5A2.5 2.5 0 0 1 6.5 2H8" }),
|
|
3356
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M8 22H6.5a1 1 0 0 1 0-5H8" })
|
|
3357
|
+
]
|
|
3358
|
+
}
|
|
3359
|
+
);
|
|
3360
|
+
}
|
|
3361
|
+
|
|
3362
|
+
// src/common/icons/icon-download.tsx
|
|
3363
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
3217
3364
|
function IconDownload() {
|
|
3218
|
-
return /* @__PURE__ */ (0,
|
|
3365
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
3219
3366
|
"svg",
|
|
3220
3367
|
{
|
|
3221
3368
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3235,18 +3382,18 @@ function IconDownload() {
|
|
|
3235
3382
|
},
|
|
3236
3383
|
className: "hover:mesh-fill-white",
|
|
3237
3384
|
children: [
|
|
3238
|
-
/* @__PURE__ */ (0,
|
|
3239
|
-
/* @__PURE__ */ (0,
|
|
3240
|
-
/* @__PURE__ */ (0,
|
|
3385
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
3386
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("polyline", { points: "7 10 12 15 17 10" }),
|
|
3387
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "12", x2: "12", y1: "15", y2: "3" })
|
|
3241
3388
|
]
|
|
3242
3389
|
}
|
|
3243
3390
|
);
|
|
3244
3391
|
}
|
|
3245
3392
|
|
|
3246
3393
|
// src/common/icons/icon-monitor-smartphone.tsx
|
|
3247
|
-
var
|
|
3394
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
3248
3395
|
function IconMonitorSmartphone() {
|
|
3249
|
-
return /* @__PURE__ */ (0,
|
|
3396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
3250
3397
|
"svg",
|
|
3251
3398
|
{
|
|
3252
3399
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3265,49 +3412,74 @@ function IconMonitorSmartphone() {
|
|
|
3265
3412
|
strokeWidth: "1px"
|
|
3266
3413
|
},
|
|
3267
3414
|
children: [
|
|
3268
|
-
/* @__PURE__ */ (0,
|
|
3269
|
-
/* @__PURE__ */ (0,
|
|
3270
|
-
/* @__PURE__ */ (0,
|
|
3271
|
-
/* @__PURE__ */ (0,
|
|
3415
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8" }),
|
|
3416
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M10 19v-3.96 3.15" }),
|
|
3417
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M7 19h5" }),
|
|
3418
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("rect", { width: "6", height: "10", x: "16", y: "12", rx: "2" })
|
|
3272
3419
|
]
|
|
3273
3420
|
}
|
|
3274
3421
|
);
|
|
3275
3422
|
}
|
|
3276
3423
|
|
|
3277
|
-
// src/common/
|
|
3278
|
-
var
|
|
3424
|
+
// src/common/tooltip.tsx
|
|
3425
|
+
var React6 = __toESM(require("react"), 1);
|
|
3426
|
+
var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"), 1);
|
|
3427
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
3428
|
+
var TooltipProvider = TooltipPrimitive.Provider;
|
|
3429
|
+
var Tooltip = TooltipPrimitive.Root;
|
|
3430
|
+
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
3431
|
+
var TooltipContent = React6.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3432
|
+
TooltipPrimitive.Content,
|
|
3433
|
+
{
|
|
3434
|
+
ref,
|
|
3435
|
+
sideOffset,
|
|
3436
|
+
className: cn(
|
|
3437
|
+
"mesh-z-50 mesh-overflow-hidden mesh-rounded-md mesh-bg-primary mesh-px-3 mesh-py-1.5 mesh-text-xs mesh-text-primary-foreground mesh-animate-in mesh-fade-in-0 mesh-zoom-in-95 data-[state=closed]:mesh-animate-out data-[state=closed]:mesh-fade-out-0 data-[state=closed]:mesh-zoom-out-95 data-[side=bottom]:mesh-slide-in-from-top-2 data-[side=left]:mesh-slide-in-from-right-2 data-[side=right]:mesh-slide-in-from-left-2 data-[side=top]:mesh-slide-in-from-bottom-2",
|
|
3438
|
+
className
|
|
3439
|
+
),
|
|
3440
|
+
...props
|
|
3441
|
+
}
|
|
3442
|
+
));
|
|
3443
|
+
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
3444
|
+
|
|
3445
|
+
// src/cardano-wallet/wallet-icon.tsx
|
|
3446
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
3279
3447
|
function WalletIcon({
|
|
3280
3448
|
icon,
|
|
3281
3449
|
name,
|
|
3282
3450
|
action,
|
|
3283
3451
|
iconReactNode
|
|
3284
3452
|
}) {
|
|
3285
|
-
return /* @__PURE__ */ (0,
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Tooltip, { delayDuration: 0, defaultOpen: false, children: [
|
|
3454
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
3455
|
+
"button",
|
|
3456
|
+
{
|
|
3457
|
+
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",
|
|
3458
|
+
onClick: action,
|
|
3459
|
+
children: [
|
|
3460
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("img", { src: icon, alt: name, className: "mesh-w-8 mesh-h-8" }),
|
|
3461
|
+
iconReactNode && iconReactNode
|
|
3462
|
+
]
|
|
3463
|
+
}
|
|
3464
|
+
) }),
|
|
3465
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TooltipContent, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { children: name }) })
|
|
3466
|
+
] });
|
|
3296
3467
|
}
|
|
3297
3468
|
|
|
3298
3469
|
// src/cardano-wallet/screen-main.tsx
|
|
3299
|
-
var
|
|
3470
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
3300
3471
|
function ScreenMain({
|
|
3301
3472
|
metamask,
|
|
3302
3473
|
extensions,
|
|
3303
3474
|
setOpen,
|
|
3304
3475
|
setScreen,
|
|
3305
|
-
cardanoPeerConnect
|
|
3476
|
+
cardanoPeerConnect,
|
|
3477
|
+
burnerWallet
|
|
3306
3478
|
}) {
|
|
3307
3479
|
const wallets = useWalletList({ metamask });
|
|
3308
3480
|
const { connect } = useWallet();
|
|
3309
|
-
return /* @__PURE__ */ (0,
|
|
3310
|
-
wallets.map((wallet, index) => /* @__PURE__ */ (0,
|
|
3481
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "mesh-grid mesh-gap-4 mesh-py-4 mesh-grid-cols-4 mesh-place-items-center", children: [
|
|
3482
|
+
wallets.map((wallet, index) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3311
3483
|
WalletIcon,
|
|
3312
3484
|
{
|
|
3313
3485
|
icon: wallet.icon,
|
|
@@ -3319,17 +3491,27 @@ function ScreenMain({
|
|
|
3319
3491
|
},
|
|
3320
3492
|
index
|
|
3321
3493
|
)),
|
|
3322
|
-
cardanoPeerConnect && /* @__PURE__ */ (0,
|
|
3494
|
+
cardanoPeerConnect && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3323
3495
|
WalletIcon,
|
|
3324
3496
|
{
|
|
3325
3497
|
iconReactNode: IconMonitorSmartphone(),
|
|
3326
|
-
name:
|
|
3498
|
+
name: screens.p2p.title,
|
|
3327
3499
|
action: () => {
|
|
3328
3500
|
setScreen("p2p");
|
|
3329
3501
|
}
|
|
3330
3502
|
}
|
|
3331
3503
|
),
|
|
3332
|
-
/* @__PURE__ */ (0,
|
|
3504
|
+
burnerWallet && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3505
|
+
WalletIcon,
|
|
3506
|
+
{
|
|
3507
|
+
iconReactNode: IconBookDashed(),
|
|
3508
|
+
name: screens.burner.title,
|
|
3509
|
+
action: () => {
|
|
3510
|
+
setScreen("burner");
|
|
3511
|
+
}
|
|
3512
|
+
}
|
|
3513
|
+
),
|
|
3514
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3333
3515
|
WalletIcon,
|
|
3334
3516
|
{
|
|
3335
3517
|
iconReactNode: IconDownload(),
|
|
@@ -3342,11 +3524,11 @@ function ScreenMain({
|
|
|
3342
3524
|
}
|
|
3343
3525
|
}
|
|
3344
3526
|
)
|
|
3345
|
-
] });
|
|
3527
|
+
] }) });
|
|
3346
3528
|
}
|
|
3347
3529
|
|
|
3348
3530
|
// src/cardano-wallet/screen-p2p.tsx
|
|
3349
|
-
var
|
|
3531
|
+
var import_react12 = require("react");
|
|
3350
3532
|
|
|
3351
3533
|
// src/common/cardano-peer-connect/index.ts
|
|
3352
3534
|
var cjsCardanopeerconnect = __toESM(require("@fabianbormann/cardano-peer-connect"), 1);
|
|
@@ -3355,15 +3537,15 @@ var exportedCardanopeerconnect = cardanopeerconnect?.default || cardanopeerconne
|
|
|
3355
3537
|
var DAppPeerConnect = exportedCardanopeerconnect.DAppPeerConnect;
|
|
3356
3538
|
|
|
3357
3539
|
// src/cardano-wallet/screen-p2p.tsx
|
|
3358
|
-
var
|
|
3540
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
3359
3541
|
function ScreenP2P({
|
|
3360
3542
|
cardanoPeerConnect
|
|
3361
3543
|
}) {
|
|
3362
|
-
const dAppConnect = (0,
|
|
3363
|
-
const qrCodeField = (0,
|
|
3364
|
-
const [address, setAddress] = (0,
|
|
3365
|
-
const [copied, setCopied] = (0,
|
|
3366
|
-
(0,
|
|
3544
|
+
const dAppConnect = (0, import_react12.useRef)(null);
|
|
3545
|
+
const qrCodeField = (0, import_react12.useRef)(null);
|
|
3546
|
+
const [address, setAddress] = (0, import_react12.useState)("");
|
|
3547
|
+
const [copied, setCopied] = (0, import_react12.useState)(false);
|
|
3548
|
+
(0, import_react12.useEffect)(() => {
|
|
3367
3549
|
if (cardanoPeerConnect) {
|
|
3368
3550
|
if (dAppConnect.current === null) {
|
|
3369
3551
|
dAppConnect.current = new DAppPeerConnect({
|
|
@@ -3401,9 +3583,9 @@ function ScreenP2P({
|
|
|
3401
3583
|
}
|
|
3402
3584
|
}
|
|
3403
3585
|
}, []);
|
|
3404
|
-
return /* @__PURE__ */ (0,
|
|
3405
|
-
/* @__PURE__ */ (0,
|
|
3406
|
-
/* @__PURE__ */ (0,
|
|
3586
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "mesh-flex mesh-flex-col mesh-items-center mesh-justify-center", children: [
|
|
3587
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { marginTop: 16, marginBottom: 16 }, ref: qrCodeField }),
|
|
3588
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3407
3589
|
Button,
|
|
3408
3590
|
{
|
|
3409
3591
|
variant: "outline",
|
|
@@ -3419,68 +3601,82 @@ function ScreenP2P({
|
|
|
3419
3601
|
}
|
|
3420
3602
|
|
|
3421
3603
|
// src/cardano-wallet/index.tsx
|
|
3422
|
-
var
|
|
3604
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
3423
3605
|
var CardanoWallet = ({
|
|
3424
3606
|
label = "Connect Wallet",
|
|
3425
3607
|
onConnected = void 0,
|
|
3426
3608
|
isDark = false,
|
|
3427
|
-
metamask = void 0,
|
|
3428
3609
|
extensions = [],
|
|
3429
|
-
|
|
3610
|
+
metamask = void 0,
|
|
3611
|
+
cardanoPeerConnect = void 0,
|
|
3612
|
+
burnerWallet = void 0
|
|
3430
3613
|
}) => {
|
|
3431
|
-
const [open, setOpen] = (0,
|
|
3432
|
-
const [screen, setScreen] = (0,
|
|
3614
|
+
const [open, setOpen] = (0, import_react13.useState)(false);
|
|
3615
|
+
const [screen, setScreen] = (0, import_react13.useState)("main");
|
|
3433
3616
|
const { wallet, connected } = useWallet();
|
|
3434
|
-
(0,
|
|
3617
|
+
(0, import_react13.useEffect)(() => {
|
|
3435
3618
|
if (connected && wallet) {
|
|
3436
3619
|
if (onConnected) onConnected();
|
|
3437
3620
|
}
|
|
3438
3621
|
}, [connected, wallet]);
|
|
3439
|
-
return /* @__PURE__ */ (0,
|
|
3440
|
-
!connected ? /* @__PURE__ */ (0,
|
|
3441
|
-
/* @__PURE__ */ (0,
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3622
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Dialog, { open, onOpenChange: setOpen, children: [
|
|
3623
|
+
!connected ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DialogTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Button, { variant: "outline", className: "mesh-text-white", children: label }) }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ConnectedButton, {}),
|
|
3624
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
3625
|
+
DialogContent,
|
|
3626
|
+
{
|
|
3627
|
+
className: "sm:mesh-max-w-[425px]",
|
|
3628
|
+
onOpenAutoFocus: (event) => event.preventDefault(),
|
|
3629
|
+
children: [
|
|
3630
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Header, { screen, setScreen }),
|
|
3631
|
+
screen == "main" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3632
|
+
ScreenMain,
|
|
3633
|
+
{
|
|
3634
|
+
metamask,
|
|
3635
|
+
extensions,
|
|
3636
|
+
setOpen,
|
|
3637
|
+
setScreen,
|
|
3638
|
+
cardanoPeerConnect: cardanoPeerConnect != void 0,
|
|
3639
|
+
burnerWallet: burnerWallet != void 0
|
|
3640
|
+
}
|
|
3641
|
+
),
|
|
3642
|
+
screen == "p2p" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ScreenP2P, { cardanoPeerConnect }),
|
|
3643
|
+
screen == "burner" && burnerWallet && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3644
|
+
ScreenBurner,
|
|
3645
|
+
{
|
|
3646
|
+
networkId: burnerWallet.networkId,
|
|
3647
|
+
provider: burnerWallet.provider,
|
|
3648
|
+
setOpen
|
|
3649
|
+
}
|
|
3650
|
+
),
|
|
3651
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Footer, {})
|
|
3652
|
+
]
|
|
3653
|
+
}
|
|
3654
|
+
)
|
|
3456
3655
|
] });
|
|
3457
3656
|
};
|
|
3458
3657
|
function Header({
|
|
3459
3658
|
screen,
|
|
3460
3659
|
setScreen
|
|
3461
3660
|
}) {
|
|
3462
|
-
return /* @__PURE__ */ (0,
|
|
3463
|
-
/* @__PURE__ */ (0,
|
|
3464
|
-
screen != "main" ? /* @__PURE__ */ (0,
|
|
3465
|
-
/* @__PURE__ */ (0,
|
|
3466
|
-
|
|
3467
|
-
screen == "p2p" && "P2P Connect"
|
|
3468
|
-
] }),
|
|
3469
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { width: "24px" } })
|
|
3661
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(DialogHeader, { children: [
|
|
3662
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(DialogTitle, { className: "mesh-flex mesh-justify-between", children: [
|
|
3663
|
+
screen != "main" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { onClick: () => setScreen("main"), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(IconChevronRight, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { style: { width: "24px" } }),
|
|
3664
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: screens[screen].title }),
|
|
3665
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { style: { width: "24px" } })
|
|
3470
3666
|
] }),
|
|
3471
|
-
/* @__PURE__ */ (0,
|
|
3667
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DialogDescription, { children: screens[screen].subtitle && screens[screen].subtitle })
|
|
3472
3668
|
] });
|
|
3473
3669
|
}
|
|
3474
3670
|
function Footer() {
|
|
3475
|
-
return /* @__PURE__ */ (0,
|
|
3671
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DialogFooter, { className: "mesh-justify-center mesh-text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
3476
3672
|
"a",
|
|
3477
3673
|
{
|
|
3478
3674
|
href: "https://meshjs.dev/",
|
|
3479
3675
|
target: "_blank",
|
|
3480
3676
|
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",
|
|
3481
3677
|
children: [
|
|
3482
|
-
/* @__PURE__ */ (0,
|
|
3483
|
-
/* @__PURE__ */ (0,
|
|
3678
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "", children: "Powered by" }),
|
|
3679
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3484
3680
|
"svg",
|
|
3485
3681
|
{
|
|
3486
3682
|
width: 24,
|
|
@@ -3488,31 +3684,31 @@ function Footer() {
|
|
|
3488
3684
|
enableBackground: "new 0 0 300 200",
|
|
3489
3685
|
viewBox: "0 0 300 200",
|
|
3490
3686
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3491
|
-
children: /* @__PURE__ */ (0,
|
|
3687
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.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" })
|
|
3492
3688
|
}
|
|
3493
3689
|
),
|
|
3494
|
-
/* @__PURE__ */ (0,
|
|
3690
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "", children: "Mesh SDK" })
|
|
3495
3691
|
]
|
|
3496
3692
|
}
|
|
3497
3693
|
) });
|
|
3498
3694
|
}
|
|
3499
3695
|
|
|
3500
3696
|
// src/mesh-badge/mesh-logo.tsx
|
|
3501
|
-
var
|
|
3502
|
-
var MeshLogo = () => /* @__PURE__ */ (0,
|
|
3697
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3698
|
+
var MeshLogo = () => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3503
3699
|
"svg",
|
|
3504
3700
|
{
|
|
3505
3701
|
className: "mesh-h-16 mesh-p-2",
|
|
3506
3702
|
fill: "currentColor",
|
|
3507
3703
|
viewBox: "0 0 300 200",
|
|
3508
3704
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3509
|
-
children: /* @__PURE__ */ (0,
|
|
3705
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.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" })
|
|
3510
3706
|
}
|
|
3511
3707
|
);
|
|
3512
3708
|
|
|
3513
3709
|
// src/mesh-badge/index.tsx
|
|
3514
|
-
var
|
|
3515
|
-
var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ (0,
|
|
3710
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3711
|
+
var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3516
3712
|
"a",
|
|
3517
3713
|
{
|
|
3518
3714
|
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`}`,
|
|
@@ -3524,21 +3720,21 @@ var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ (0, import_jsx_runtime15
|
|
|
3524
3720
|
rel: "noopener noreferrer",
|
|
3525
3721
|
target: "_blank",
|
|
3526
3722
|
children: [
|
|
3527
|
-
/* @__PURE__ */ (0,
|
|
3723
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(MeshLogo, {}),
|
|
3528
3724
|
"Mesh"
|
|
3529
3725
|
]
|
|
3530
3726
|
}
|
|
3531
3727
|
);
|
|
3532
3728
|
|
|
3533
3729
|
// src/stake-button/index.tsx
|
|
3534
|
-
var
|
|
3730
|
+
var import_react15 = require("react");
|
|
3535
3731
|
var import_transaction = require("@meshsdk/transaction");
|
|
3536
3732
|
|
|
3537
3733
|
// src/cardano-wallet-dropdown/index.tsx
|
|
3538
|
-
var
|
|
3734
|
+
var import_react14 = require("react");
|
|
3539
3735
|
|
|
3540
3736
|
// src/common/button-dropdown.tsx
|
|
3541
|
-
var
|
|
3737
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3542
3738
|
function ButtonDropdown({
|
|
3543
3739
|
children,
|
|
3544
3740
|
isDarkMode = false,
|
|
@@ -3547,7 +3743,7 @@ function ButtonDropdown({
|
|
|
3547
3743
|
onMouseEnter,
|
|
3548
3744
|
onMouseLeave
|
|
3549
3745
|
}) {
|
|
3550
|
-
return /* @__PURE__ */ (0,
|
|
3746
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3551
3747
|
"button",
|
|
3552
3748
|
{
|
|
3553
3749
|
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`}`,
|
|
@@ -3560,21 +3756,21 @@ function ButtonDropdown({
|
|
|
3560
3756
|
}
|
|
3561
3757
|
|
|
3562
3758
|
// src/cardano-wallet-dropdown/menu-item.tsx
|
|
3563
|
-
var
|
|
3759
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3564
3760
|
function MenuItem({
|
|
3565
3761
|
icon,
|
|
3566
3762
|
label,
|
|
3567
3763
|
action,
|
|
3568
3764
|
active
|
|
3569
3765
|
}) {
|
|
3570
|
-
return /* @__PURE__ */ (0,
|
|
3766
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
3571
3767
|
"div",
|
|
3572
3768
|
{
|
|
3573
3769
|
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",
|
|
3574
3770
|
onClick: action,
|
|
3575
3771
|
children: [
|
|
3576
|
-
icon && /* @__PURE__ */ (0,
|
|
3577
|
-
/* @__PURE__ */ (0,
|
|
3772
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("img", { className: "mesh-pr-2 mesh-m-1 mesh-h-8", src: icon }),
|
|
3773
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.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) => {
|
|
3578
3774
|
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
3579
3775
|
}).join(" ") })
|
|
3580
3776
|
]
|
|
@@ -3583,8 +3779,8 @@ function MenuItem({
|
|
|
3583
3779
|
}
|
|
3584
3780
|
|
|
3585
3781
|
// src/cardano-wallet-dropdown/chevron-down.tsx
|
|
3586
|
-
var
|
|
3587
|
-
var ChevronDown = () => /* @__PURE__ */ (0,
|
|
3782
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3783
|
+
var ChevronDown = () => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3588
3784
|
"svg",
|
|
3589
3785
|
{
|
|
3590
3786
|
className: "mesh-m-2 mesh-h-6",
|
|
@@ -3593,7 +3789,7 @@ var ChevronDown = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
|
3593
3789
|
viewBox: "0 0 24 24",
|
|
3594
3790
|
stroke: "currentColor",
|
|
3595
3791
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3596
|
-
children: /* @__PURE__ */ (0,
|
|
3792
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3597
3793
|
"path",
|
|
3598
3794
|
{
|
|
3599
3795
|
strokeLinecap: "round",
|
|
@@ -3606,7 +3802,7 @@ var ChevronDown = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
|
3606
3802
|
);
|
|
3607
3803
|
|
|
3608
3804
|
// src/cardano-wallet-dropdown/wallet-balance.tsx
|
|
3609
|
-
var
|
|
3805
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3610
3806
|
var WalletBalance = ({
|
|
3611
3807
|
connected,
|
|
3612
3808
|
connecting,
|
|
@@ -3614,22 +3810,22 @@ var WalletBalance = ({
|
|
|
3614
3810
|
wallet
|
|
3615
3811
|
}) => {
|
|
3616
3812
|
const lovelace = useLovelace();
|
|
3617
|
-
return connected && lovelace && wallet?.icon ? /* @__PURE__ */ (0,
|
|
3618
|
-
/* @__PURE__ */ (0,
|
|
3813
|
+
return connected && lovelace && wallet?.icon ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
3814
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("img", { className: "mesh-m-2 mesh-h-6", src: wallet.icon }),
|
|
3619
3815
|
"\u20B3",
|
|
3620
3816
|
" ",
|
|
3621
3817
|
parseInt((parseInt(lovelace, 10) / 1e6).toString(), 10),
|
|
3622
3818
|
".",
|
|
3623
|
-
/* @__PURE__ */ (0,
|
|
3624
|
-
] }) : connected && wallet?.icon ? /* @__PURE__ */ (0,
|
|
3819
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "mesh-text-xs", children: lovelace.substring(lovelace.length - 6) })
|
|
3820
|
+
] }) : connected && wallet?.icon ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("img", { className: "mesh-m-2 mesh-h-6", src: wallet.icon }) }) : connecting ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children: "Connecting..." }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
3625
3821
|
label,
|
|
3626
3822
|
" ",
|
|
3627
|
-
/* @__PURE__ */ (0,
|
|
3823
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ChevronDown, {})
|
|
3628
3824
|
] });
|
|
3629
3825
|
};
|
|
3630
3826
|
|
|
3631
3827
|
// src/cardano-wallet-dropdown/index.tsx
|
|
3632
|
-
var
|
|
3828
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3633
3829
|
var CardanoWallet2 = ({
|
|
3634
3830
|
label = "Connect Wallet",
|
|
3635
3831
|
onConnected = void 0,
|
|
@@ -3638,32 +3834,32 @@ var CardanoWallet2 = ({
|
|
|
3638
3834
|
extensions = [],
|
|
3639
3835
|
cardanoPeerConnect = void 0
|
|
3640
3836
|
}) => {
|
|
3641
|
-
const [isDarkMode, setIsDarkMode] = (0,
|
|
3642
|
-
const [hideMenuList, setHideMenuList] = (0,
|
|
3837
|
+
const [isDarkMode, setIsDarkMode] = (0, import_react14.useState)(false);
|
|
3838
|
+
const [hideMenuList, setHideMenuList] = (0, import_react14.useState)(true);
|
|
3643
3839
|
const { connect, connecting, connected, disconnect, name } = useWallet();
|
|
3644
3840
|
const wallets = useWalletList({ metamask });
|
|
3645
|
-
(0,
|
|
3841
|
+
(0, import_react14.useEffect)(() => {
|
|
3646
3842
|
if (connected && onConnected) {
|
|
3647
3843
|
onConnected();
|
|
3648
3844
|
}
|
|
3649
3845
|
}, [connected]);
|
|
3650
|
-
(0,
|
|
3846
|
+
(0, import_react14.useEffect)(() => {
|
|
3651
3847
|
setIsDarkMode(isDark);
|
|
3652
3848
|
}, [isDark]);
|
|
3653
|
-
return /* @__PURE__ */ (0,
|
|
3849
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3654
3850
|
"div",
|
|
3655
3851
|
{
|
|
3656
3852
|
onMouseEnter: () => setHideMenuList(false),
|
|
3657
3853
|
onMouseLeave: () => setHideMenuList(true),
|
|
3658
3854
|
style: { width: "min-content", zIndex: 50 },
|
|
3659
3855
|
children: [
|
|
3660
|
-
/* @__PURE__ */ (0,
|
|
3856
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3661
3857
|
ButtonDropdown,
|
|
3662
3858
|
{
|
|
3663
3859
|
isDarkMode,
|
|
3664
3860
|
hideMenuList,
|
|
3665
3861
|
setHideMenuList,
|
|
3666
|
-
children: /* @__PURE__ */ (0,
|
|
3862
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3667
3863
|
WalletBalance,
|
|
3668
3864
|
{
|
|
3669
3865
|
connected,
|
|
@@ -3674,12 +3870,12 @@ var CardanoWallet2 = ({
|
|
|
3674
3870
|
)
|
|
3675
3871
|
}
|
|
3676
3872
|
),
|
|
3677
|
-
/* @__PURE__ */ (0,
|
|
3873
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3678
3874
|
"div",
|
|
3679
3875
|
{
|
|
3680
3876
|
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`}`,
|
|
3681
3877
|
style: { zIndex: 50 },
|
|
3682
|
-
children: !connected && wallets.length > 0 ? /* @__PURE__ */ (0,
|
|
3878
|
+
children: !connected && wallets.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_jsx_runtime23.Fragment, { children: wallets.map((wallet, index) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3683
3879
|
MenuItem,
|
|
3684
3880
|
{
|
|
3685
3881
|
icon: wallet.icon,
|
|
@@ -3691,7 +3887,7 @@ var CardanoWallet2 = ({
|
|
|
3691
3887
|
active: name === wallet.id
|
|
3692
3888
|
},
|
|
3693
3889
|
index
|
|
3694
|
-
)) }) : wallets.length === 0 ? /* @__PURE__ */ (0,
|
|
3890
|
+
)) }) : wallets.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "No Wallet Found" }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_jsx_runtime23.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3695
3891
|
MenuItem,
|
|
3696
3892
|
{
|
|
3697
3893
|
active: false,
|
|
@@ -3708,7 +3904,7 @@ var CardanoWallet2 = ({
|
|
|
3708
3904
|
};
|
|
3709
3905
|
|
|
3710
3906
|
// src/stake-button/index.tsx
|
|
3711
|
-
var
|
|
3907
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3712
3908
|
var StakeButton = ({
|
|
3713
3909
|
label = "Stake your ADA",
|
|
3714
3910
|
isDark = false,
|
|
@@ -3716,19 +3912,19 @@ var StakeButton = ({
|
|
|
3716
3912
|
onCheck,
|
|
3717
3913
|
onDelegated = void 0
|
|
3718
3914
|
}) => {
|
|
3719
|
-
const [isDarkMode, setIsDarkMode] = (0,
|
|
3915
|
+
const [isDarkMode, setIsDarkMode] = (0, import_react15.useState)(false);
|
|
3720
3916
|
const { connected } = useWallet();
|
|
3721
|
-
(0,
|
|
3917
|
+
(0, import_react15.useEffect)(() => {
|
|
3722
3918
|
setIsDarkMode(isDark);
|
|
3723
3919
|
}, [isDark]);
|
|
3724
|
-
return /* @__PURE__ */ (0,
|
|
3920
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: connected ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ButtonDropdown, { isDarkMode, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3725
3921
|
Delegate,
|
|
3726
3922
|
{
|
|
3727
3923
|
poolId,
|
|
3728
3924
|
onCheck,
|
|
3729
3925
|
onDelegated
|
|
3730
3926
|
}
|
|
3731
|
-
) }) : /* @__PURE__ */ (0,
|
|
3927
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CardanoWallet2, { label, isDark }) });
|
|
3732
3928
|
};
|
|
3733
3929
|
var Delegate = ({
|
|
3734
3930
|
poolId,
|
|
@@ -3737,11 +3933,11 @@ var Delegate = ({
|
|
|
3737
3933
|
}) => {
|
|
3738
3934
|
const { wallet } = useWallet();
|
|
3739
3935
|
const rewardAddress = useRewardAddress();
|
|
3740
|
-
const [_, setError] = (0,
|
|
3741
|
-
const [checking, setChecking] = (0,
|
|
3742
|
-
const [accountInfo, setAccountInfo] = (0,
|
|
3743
|
-
const [processing, setProcessing] = (0,
|
|
3744
|
-
const [done, setDone] = (0,
|
|
3936
|
+
const [_, setError] = (0, import_react15.useState)();
|
|
3937
|
+
const [checking, setChecking] = (0, import_react15.useState)(false);
|
|
3938
|
+
const [accountInfo, setAccountInfo] = (0, import_react15.useState)();
|
|
3939
|
+
const [processing, setProcessing] = (0, import_react15.useState)(false);
|
|
3940
|
+
const [done, setDone] = (0, import_react15.useState)(false);
|
|
3745
3941
|
const checkAccountStatus = async () => {
|
|
3746
3942
|
try {
|
|
3747
3943
|
setChecking(true);
|
|
@@ -3792,22 +3988,22 @@ var Delegate = ({
|
|
|
3792
3988
|
}
|
|
3793
3989
|
setProcessing(false);
|
|
3794
3990
|
};
|
|
3795
|
-
(0,
|
|
3991
|
+
(0, import_react15.useEffect)(() => {
|
|
3796
3992
|
checkAccountStatus();
|
|
3797
3993
|
}, [rewardAddress]);
|
|
3798
3994
|
if (checking) {
|
|
3799
|
-
return /* @__PURE__ */ (0,
|
|
3995
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: "Checking..." });
|
|
3800
3996
|
}
|
|
3801
3997
|
if (processing) {
|
|
3802
|
-
return /* @__PURE__ */ (0,
|
|
3998
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: "Loading..." });
|
|
3803
3999
|
}
|
|
3804
4000
|
if (done) {
|
|
3805
|
-
return /* @__PURE__ */ (0,
|
|
4001
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: "Stake Delegated" });
|
|
3806
4002
|
}
|
|
3807
4003
|
if (accountInfo?.active) {
|
|
3808
|
-
return accountInfo.poolId === poolId ? /* @__PURE__ */ (0,
|
|
4004
|
+
return accountInfo.poolId === poolId ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: "Stake Delegated" }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { onClick: delegateStake, children: "Begin Staking" });
|
|
3809
4005
|
}
|
|
3810
|
-
return /* @__PURE__ */ (0,
|
|
4006
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { onClick: registerAddress, children: "Begin Staking" });
|
|
3811
4007
|
};
|
|
3812
4008
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3813
4009
|
0 && (module.exports = {
|