@meshsdk/react 1.7.24 → 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 +9 -6
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/cardano-wallet/index.tsx
|
|
2
|
-
import { useEffect as
|
|
2
|
+
import { useEffect as useEffect10, useState as useState12 } from "react";
|
|
3
3
|
|
|
4
4
|
// src/common/button.tsx
|
|
5
5
|
import * as React3 from "react";
|
|
@@ -2770,16 +2770,14 @@ import { useContext, useEffect, useState as useState2 } from "react";
|
|
|
2770
2770
|
import { createContext, useCallback as useCallback2, useState } from "react";
|
|
2771
2771
|
import { BrowserWallet } from "@meshsdk/wallet";
|
|
2772
2772
|
var INITIAL_STATE = {
|
|
2773
|
-
walletName:
|
|
2773
|
+
walletName: void 0,
|
|
2774
2774
|
walletInstance: {}
|
|
2775
2775
|
};
|
|
2776
2776
|
var useWalletStore = () => {
|
|
2777
2777
|
const [error, setError] = useState(void 0);
|
|
2778
2778
|
const [connectingWallet, setConnectingWallet] = useState(false);
|
|
2779
2779
|
const [connectedWalletInstance, setConnectedWalletInstance] = useState(INITIAL_STATE.walletInstance);
|
|
2780
|
-
const [connectedWalletName, setConnectedWalletName] = useState(
|
|
2781
|
-
INITIAL_STATE.walletName
|
|
2782
|
-
);
|
|
2780
|
+
const [connectedWalletName, setConnectedWalletName] = useState(INITIAL_STATE.walletName);
|
|
2783
2781
|
const connectWallet = useCallback2(
|
|
2784
2782
|
async (walletName, extensions) => {
|
|
2785
2783
|
setConnectingWallet(true);
|
|
@@ -2802,6 +2800,13 @@ var useWalletStore = () => {
|
|
|
2802
2800
|
setConnectedWalletName(INITIAL_STATE.walletName);
|
|
2803
2801
|
setConnectedWalletInstance(INITIAL_STATE.walletInstance);
|
|
2804
2802
|
}, []);
|
|
2803
|
+
const setWallet = useCallback2(
|
|
2804
|
+
async (walletInstance, walletName) => {
|
|
2805
|
+
setConnectedWalletInstance(walletInstance);
|
|
2806
|
+
setConnectedWalletName(walletName);
|
|
2807
|
+
},
|
|
2808
|
+
[]
|
|
2809
|
+
);
|
|
2805
2810
|
return {
|
|
2806
2811
|
hasConnectedWallet: INITIAL_STATE.walletName !== connectedWalletName,
|
|
2807
2812
|
connectedWalletInstance,
|
|
@@ -2809,6 +2814,7 @@ var useWalletStore = () => {
|
|
|
2809
2814
|
connectingWallet,
|
|
2810
2815
|
connectWallet,
|
|
2811
2816
|
disconnect,
|
|
2817
|
+
setWallet,
|
|
2812
2818
|
error
|
|
2813
2819
|
};
|
|
2814
2820
|
};
|
|
@@ -2816,7 +2822,13 @@ var WalletContext = createContext({
|
|
|
2816
2822
|
hasConnectedWallet: false,
|
|
2817
2823
|
connectedWalletInstance: INITIAL_STATE.walletInstance,
|
|
2818
2824
|
connectedWalletName: INITIAL_STATE.walletName,
|
|
2819
|
-
connectingWallet: false
|
|
2825
|
+
connectingWallet: false,
|
|
2826
|
+
connectWallet: async () => {
|
|
2827
|
+
},
|
|
2828
|
+
disconnect: () => {
|
|
2829
|
+
},
|
|
2830
|
+
setWallet: async () => {
|
|
2831
|
+
}
|
|
2820
2832
|
});
|
|
2821
2833
|
|
|
2822
2834
|
// src/contexts/index.tsx
|
|
@@ -2829,7 +2841,7 @@ var MeshProvider = (props) => {
|
|
|
2829
2841
|
// src/hooks/useAddress.ts
|
|
2830
2842
|
var useAddress = (accountId = 0) => {
|
|
2831
2843
|
const [address, setAddress] = useState2();
|
|
2832
|
-
const { hasConnectedWallet,
|
|
2844
|
+
const { hasConnectedWallet, connectedWalletInstance } = useContext(WalletContext);
|
|
2833
2845
|
useEffect(() => {
|
|
2834
2846
|
if (hasConnectedWallet) {
|
|
2835
2847
|
connectedWalletInstance.getUsedAddresses().then((addresses) => {
|
|
@@ -2838,7 +2850,7 @@ var useAddress = (accountId = 0) => {
|
|
|
2838
2850
|
}
|
|
2839
2851
|
});
|
|
2840
2852
|
}
|
|
2841
|
-
}, [accountId,
|
|
2853
|
+
}, [accountId, hasConnectedWallet, connectedWalletInstance]);
|
|
2842
2854
|
return address;
|
|
2843
2855
|
};
|
|
2844
2856
|
|
|
@@ -2846,12 +2858,12 @@ var useAddress = (accountId = 0) => {
|
|
|
2846
2858
|
import { useContext as useContext2, useEffect as useEffect2, useState as useState3 } from "react";
|
|
2847
2859
|
var useAssets = () => {
|
|
2848
2860
|
const [assets, setAssets] = useState3();
|
|
2849
|
-
const { hasConnectedWallet,
|
|
2861
|
+
const { hasConnectedWallet, connectedWalletInstance } = useContext2(WalletContext);
|
|
2850
2862
|
useEffect2(() => {
|
|
2851
2863
|
if (hasConnectedWallet) {
|
|
2852
2864
|
connectedWalletInstance.getAssets().then(setAssets);
|
|
2853
2865
|
}
|
|
2854
|
-
}, [
|
|
2866
|
+
}, [hasConnectedWallet, connectedWalletInstance]);
|
|
2855
2867
|
return assets;
|
|
2856
2868
|
};
|
|
2857
2869
|
|
|
@@ -2879,12 +2891,12 @@ var useLovelace = () => {
|
|
|
2879
2891
|
const hasFetchedLovelace = useRef(false);
|
|
2880
2892
|
useEffect4(() => {
|
|
2881
2893
|
async function getLovelace() {
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
hasFetchedLovelace.current = true;
|
|
2894
|
+
if (hasConnectedWallet && !hasFetchedLovelace.current) {
|
|
2895
|
+
setLovelace(await connectedWalletInstance.getLovelace());
|
|
2896
|
+
hasFetchedLovelace.current = true;
|
|
2897
|
+
}
|
|
2887
2898
|
}
|
|
2899
|
+
getLovelace();
|
|
2888
2900
|
}, [hasConnectedWallet, connectedWalletInstance]);
|
|
2889
2901
|
const _lovelace = useMemo(() => {
|
|
2890
2902
|
return lovelace;
|
|
@@ -2896,14 +2908,14 @@ var useLovelace = () => {
|
|
|
2896
2908
|
import { useContext as useContext4, useEffect as useEffect5, useState as useState6 } from "react";
|
|
2897
2909
|
var useNetwork = () => {
|
|
2898
2910
|
const [networkId, setNetworkId] = useState6();
|
|
2899
|
-
const { hasConnectedWallet,
|
|
2911
|
+
const { hasConnectedWallet, connectedWalletInstance } = useContext4(WalletContext);
|
|
2900
2912
|
useEffect5(() => {
|
|
2901
2913
|
if (hasConnectedWallet) {
|
|
2902
2914
|
connectedWalletInstance.getNetworkId().then(setNetworkId);
|
|
2903
2915
|
} else {
|
|
2904
2916
|
setNetworkId(void 0);
|
|
2905
2917
|
}
|
|
2906
|
-
}, [
|
|
2918
|
+
}, [hasConnectedWallet, connectedWalletInstance]);
|
|
2907
2919
|
return networkId;
|
|
2908
2920
|
};
|
|
2909
2921
|
|
|
@@ -2911,7 +2923,7 @@ var useNetwork = () => {
|
|
|
2911
2923
|
import { useContext as useContext5, useEffect as useEffect6, useState as useState7 } from "react";
|
|
2912
2924
|
var useRewardAddress = (accountId = 0) => {
|
|
2913
2925
|
const [rewardAddress, setRewardAddress] = useState7();
|
|
2914
|
-
const { hasConnectedWallet,
|
|
2926
|
+
const { hasConnectedWallet, connectedWalletInstance } = useContext5(WalletContext);
|
|
2915
2927
|
useEffect6(() => {
|
|
2916
2928
|
if (hasConnectedWallet) {
|
|
2917
2929
|
connectedWalletInstance.getRewardAddresses().then((addresses) => {
|
|
@@ -2920,7 +2932,7 @@ var useRewardAddress = (accountId = 0) => {
|
|
|
2920
2932
|
}
|
|
2921
2933
|
});
|
|
2922
2934
|
}
|
|
2923
|
-
}, [accountId,
|
|
2935
|
+
}, [accountId, hasConnectedWallet, connectedWalletInstance]);
|
|
2924
2936
|
return rewardAddress;
|
|
2925
2937
|
};
|
|
2926
2938
|
|
|
@@ -2934,6 +2946,7 @@ var useWallet = () => {
|
|
|
2934
2946
|
connectingWallet,
|
|
2935
2947
|
connectWallet,
|
|
2936
2948
|
disconnect,
|
|
2949
|
+
setWallet,
|
|
2937
2950
|
error
|
|
2938
2951
|
} = useContext6(WalletContext);
|
|
2939
2952
|
if (connectWallet === void 0 || disconnect === void 0) {
|
|
@@ -2948,6 +2961,7 @@ var useWallet = () => {
|
|
|
2948
2961
|
wallet: connectedWalletInstance,
|
|
2949
2962
|
connect: connectWallet,
|
|
2950
2963
|
disconnect,
|
|
2964
|
+
setWallet,
|
|
2951
2965
|
error
|
|
2952
2966
|
};
|
|
2953
2967
|
};
|
|
@@ -2961,10 +2975,10 @@ var useWalletSubmit = () => {
|
|
|
2961
2975
|
const { hasConnectedWallet, connectedWalletInstance } = useContext7(WalletContext);
|
|
2962
2976
|
const submitTx = useCallback3(async (signedTx) => {
|
|
2963
2977
|
setSubmitting(true);
|
|
2978
|
+
setError(void 0);
|
|
2964
2979
|
try {
|
|
2965
2980
|
if (hasConnectedWallet) {
|
|
2966
2981
|
const txHash = await connectedWalletInstance.submitTx(signedTx);
|
|
2967
|
-
setError(void 0);
|
|
2968
2982
|
setResult(txHash);
|
|
2969
2983
|
}
|
|
2970
2984
|
throw new Error(
|
|
@@ -3168,10 +3182,143 @@ function ConnectedButton() {
|
|
|
3168
3182
|
] });
|
|
3169
3183
|
}
|
|
3170
3184
|
|
|
3185
|
+
// src/cardano-wallet/data.ts
|
|
3186
|
+
var screens = {
|
|
3187
|
+
main: {
|
|
3188
|
+
title: "Connect Wallet"
|
|
3189
|
+
},
|
|
3190
|
+
p2p: {
|
|
3191
|
+
title: "Peer Connect (CIP45)",
|
|
3192
|
+
subtitle: "Use wallet that supports CIP-45, scan this QR code to connect."
|
|
3193
|
+
},
|
|
3194
|
+
burner: {
|
|
3195
|
+
title: "Burner Wallet",
|
|
3196
|
+
subtitle: "Instantly create a new burner wallet. No seed phrase required, keys are generated on your device."
|
|
3197
|
+
}
|
|
3198
|
+
};
|
|
3199
|
+
|
|
3200
|
+
// src/cardano-wallet/screen-burner.tsx
|
|
3201
|
+
import { useEffect as useEffect8, useState as useState10 } from "react";
|
|
3202
|
+
import { MeshWallet } from "@meshsdk/wallet";
|
|
3203
|
+
import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
3204
|
+
var localstoragekey = "mesh-burnerwallet";
|
|
3205
|
+
function ScreenBurner({
|
|
3206
|
+
networkId,
|
|
3207
|
+
provider,
|
|
3208
|
+
setOpen
|
|
3209
|
+
}) {
|
|
3210
|
+
const [loading, setLoading] = useState10(false);
|
|
3211
|
+
const [hasKeyInStorage, setHasKeyInStorage] = useState10(false);
|
|
3212
|
+
const { setWallet } = useWallet();
|
|
3213
|
+
function getKeyFromStorage() {
|
|
3214
|
+
return localStorage.getItem(localstoragekey);
|
|
3215
|
+
}
|
|
3216
|
+
useEffect8(() => {
|
|
3217
|
+
const key = getKeyFromStorage();
|
|
3218
|
+
if (key) {
|
|
3219
|
+
setHasKeyInStorage(true);
|
|
3220
|
+
}
|
|
3221
|
+
}, []);
|
|
3222
|
+
function createWallet(key) {
|
|
3223
|
+
setTimeout(() => {
|
|
3224
|
+
const wallet = new MeshWallet({
|
|
3225
|
+
networkId,
|
|
3226
|
+
fetcher: provider,
|
|
3227
|
+
submitter: provider,
|
|
3228
|
+
key: {
|
|
3229
|
+
type: "root",
|
|
3230
|
+
bech32: key
|
|
3231
|
+
}
|
|
3232
|
+
});
|
|
3233
|
+
if (!hasKeyInStorage) {
|
|
3234
|
+
localStorage.setItem(localstoragekey, key);
|
|
3235
|
+
}
|
|
3236
|
+
setWallet(wallet, screens.burner.title);
|
|
3237
|
+
setLoading(false);
|
|
3238
|
+
setOpen(false);
|
|
3239
|
+
}, 500);
|
|
3240
|
+
}
|
|
3241
|
+
function handleRestoreWallet() {
|
|
3242
|
+
setLoading(true);
|
|
3243
|
+
const key = getKeyFromStorage();
|
|
3244
|
+
createWallet(key);
|
|
3245
|
+
}
|
|
3246
|
+
function handleCreateWallet() {
|
|
3247
|
+
setLoading(true);
|
|
3248
|
+
const key = MeshWallet.brew(true);
|
|
3249
|
+
createWallet(key);
|
|
3250
|
+
}
|
|
3251
|
+
return /* @__PURE__ */ jsx8("div", { className: "mesh-flex mesh-flex-row mesh-flex-gap-4 mesh-items-center mesh-justify-center", children: loading ? /* @__PURE__ */ jsx8(Fragment3, { children: "Setting up wallet..." }) : /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
3252
|
+
hasKeyInStorage && /* @__PURE__ */ jsx8(
|
|
3253
|
+
Button,
|
|
3254
|
+
{
|
|
3255
|
+
variant: "outline",
|
|
3256
|
+
className: "mesh-text-white",
|
|
3257
|
+
onClick: () => {
|
|
3258
|
+
handleRestoreWallet();
|
|
3259
|
+
},
|
|
3260
|
+
disabled: loading,
|
|
3261
|
+
children: "Restore wallet"
|
|
3262
|
+
}
|
|
3263
|
+
),
|
|
3264
|
+
/* @__PURE__ */ jsx8(
|
|
3265
|
+
Button,
|
|
3266
|
+
{
|
|
3267
|
+
variant: "outline",
|
|
3268
|
+
className: "mesh-text-white",
|
|
3269
|
+
onClick: () => {
|
|
3270
|
+
handleCreateWallet();
|
|
3271
|
+
},
|
|
3272
|
+
disabled: loading,
|
|
3273
|
+
children: "Create wallet"
|
|
3274
|
+
}
|
|
3275
|
+
)
|
|
3276
|
+
] }) });
|
|
3277
|
+
}
|
|
3278
|
+
|
|
3279
|
+
// src/common/icons/icon-book-dashed.tsx
|
|
3280
|
+
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
3281
|
+
function IconBookDashed() {
|
|
3282
|
+
return /* @__PURE__ */ jsxs5(
|
|
3283
|
+
"svg",
|
|
3284
|
+
{
|
|
3285
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3286
|
+
width: "24",
|
|
3287
|
+
height: "24",
|
|
3288
|
+
viewBox: "0 0 24 24",
|
|
3289
|
+
fill: "none",
|
|
3290
|
+
stroke: "gray",
|
|
3291
|
+
strokeWidth: "2",
|
|
3292
|
+
strokeLinecap: "round",
|
|
3293
|
+
strokeLinejoin: "round",
|
|
3294
|
+
style: {
|
|
3295
|
+
color: "#ffadff",
|
|
3296
|
+
width: "24px",
|
|
3297
|
+
height: "24px",
|
|
3298
|
+
strokeWidth: "1px"
|
|
3299
|
+
},
|
|
3300
|
+
className: "hover:mesh-fill-white",
|
|
3301
|
+
children: [
|
|
3302
|
+
/* @__PURE__ */ jsx9("path", { d: "M12 17h2" }),
|
|
3303
|
+
/* @__PURE__ */ jsx9("path", { d: "M12 22h2" }),
|
|
3304
|
+
/* @__PURE__ */ jsx9("path", { d: "M12 2h2" }),
|
|
3305
|
+
/* @__PURE__ */ jsx9("path", { d: "M18 22h1a1 1 0 0 0 1-1" }),
|
|
3306
|
+
/* @__PURE__ */ jsx9("path", { d: "M18 2h1a1 1 0 0 1 1 1v1" }),
|
|
3307
|
+
/* @__PURE__ */ jsx9("path", { d: "M20 15v2h-2" }),
|
|
3308
|
+
/* @__PURE__ */ jsx9("path", { d: "M20 8v3" }),
|
|
3309
|
+
/* @__PURE__ */ jsx9("path", { d: "M4 11V9" }),
|
|
3310
|
+
/* @__PURE__ */ jsx9("path", { d: "M4 19.5V15" }),
|
|
3311
|
+
/* @__PURE__ */ jsx9("path", { d: "M4 5v-.5A2.5 2.5 0 0 1 6.5 2H8" }),
|
|
3312
|
+
/* @__PURE__ */ jsx9("path", { d: "M8 22H6.5a1 1 0 0 1 0-5H8" })
|
|
3313
|
+
]
|
|
3314
|
+
}
|
|
3315
|
+
);
|
|
3316
|
+
}
|
|
3317
|
+
|
|
3171
3318
|
// src/common/icons/icon-download.tsx
|
|
3172
|
-
import { jsx as
|
|
3319
|
+
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
3173
3320
|
function IconDownload() {
|
|
3174
|
-
return /* @__PURE__ */
|
|
3321
|
+
return /* @__PURE__ */ jsxs6(
|
|
3175
3322
|
"svg",
|
|
3176
3323
|
{
|
|
3177
3324
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3191,18 +3338,18 @@ function IconDownload() {
|
|
|
3191
3338
|
},
|
|
3192
3339
|
className: "hover:mesh-fill-white",
|
|
3193
3340
|
children: [
|
|
3194
|
-
/* @__PURE__ */
|
|
3195
|
-
/* @__PURE__ */
|
|
3196
|
-
/* @__PURE__ */
|
|
3341
|
+
/* @__PURE__ */ jsx10("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
3342
|
+
/* @__PURE__ */ jsx10("polyline", { points: "7 10 12 15 17 10" }),
|
|
3343
|
+
/* @__PURE__ */ jsx10("line", { x1: "12", x2: "12", y1: "15", y2: "3" })
|
|
3197
3344
|
]
|
|
3198
3345
|
}
|
|
3199
3346
|
);
|
|
3200
3347
|
}
|
|
3201
3348
|
|
|
3202
3349
|
// src/common/icons/icon-monitor-smartphone.tsx
|
|
3203
|
-
import { jsx as
|
|
3350
|
+
import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3204
3351
|
function IconMonitorSmartphone() {
|
|
3205
|
-
return /* @__PURE__ */
|
|
3352
|
+
return /* @__PURE__ */ jsxs7(
|
|
3206
3353
|
"svg",
|
|
3207
3354
|
{
|
|
3208
3355
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3221,49 +3368,74 @@ function IconMonitorSmartphone() {
|
|
|
3221
3368
|
strokeWidth: "1px"
|
|
3222
3369
|
},
|
|
3223
3370
|
children: [
|
|
3224
|
-
/* @__PURE__ */
|
|
3225
|
-
/* @__PURE__ */
|
|
3226
|
-
/* @__PURE__ */
|
|
3227
|
-
/* @__PURE__ */
|
|
3371
|
+
/* @__PURE__ */ jsx11("path", { d: "M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8" }),
|
|
3372
|
+
/* @__PURE__ */ jsx11("path", { d: "M10 19v-3.96 3.15" }),
|
|
3373
|
+
/* @__PURE__ */ jsx11("path", { d: "M7 19h5" }),
|
|
3374
|
+
/* @__PURE__ */ jsx11("rect", { width: "6", height: "10", x: "16", y: "12", rx: "2" })
|
|
3228
3375
|
]
|
|
3229
3376
|
}
|
|
3230
3377
|
);
|
|
3231
3378
|
}
|
|
3232
3379
|
|
|
3233
|
-
// src/common/
|
|
3234
|
-
import
|
|
3380
|
+
// src/common/tooltip.tsx
|
|
3381
|
+
import * as React6 from "react";
|
|
3382
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
3383
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
3384
|
+
var TooltipProvider = TooltipPrimitive.Provider;
|
|
3385
|
+
var Tooltip = TooltipPrimitive.Root;
|
|
3386
|
+
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
3387
|
+
var TooltipContent = React6.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx12(
|
|
3388
|
+
TooltipPrimitive.Content,
|
|
3389
|
+
{
|
|
3390
|
+
ref,
|
|
3391
|
+
sideOffset,
|
|
3392
|
+
className: cn(
|
|
3393
|
+
"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",
|
|
3394
|
+
className
|
|
3395
|
+
),
|
|
3396
|
+
...props
|
|
3397
|
+
}
|
|
3398
|
+
));
|
|
3399
|
+
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
3400
|
+
|
|
3401
|
+
// src/cardano-wallet/wallet-icon.tsx
|
|
3402
|
+
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3235
3403
|
function WalletIcon({
|
|
3236
3404
|
icon,
|
|
3237
3405
|
name,
|
|
3238
3406
|
action,
|
|
3239
3407
|
iconReactNode
|
|
3240
3408
|
}) {
|
|
3241
|
-
return /* @__PURE__ */
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3409
|
+
return /* @__PURE__ */ jsxs8(Tooltip, { delayDuration: 0, defaultOpen: false, children: [
|
|
3410
|
+
/* @__PURE__ */ jsx13(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs8(
|
|
3411
|
+
"button",
|
|
3412
|
+
{
|
|
3413
|
+
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",
|
|
3414
|
+
onClick: action,
|
|
3415
|
+
children: [
|
|
3416
|
+
icon && /* @__PURE__ */ jsx13("img", { src: icon, alt: name, className: "mesh-w-8 mesh-h-8" }),
|
|
3417
|
+
iconReactNode && iconReactNode
|
|
3418
|
+
]
|
|
3419
|
+
}
|
|
3420
|
+
) }),
|
|
3421
|
+
/* @__PURE__ */ jsx13(TooltipContent, { children: /* @__PURE__ */ jsx13("p", { children: name }) })
|
|
3422
|
+
] });
|
|
3252
3423
|
}
|
|
3253
3424
|
|
|
3254
3425
|
// src/cardano-wallet/screen-main.tsx
|
|
3255
|
-
import { jsx as
|
|
3426
|
+
import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3256
3427
|
function ScreenMain({
|
|
3257
3428
|
metamask,
|
|
3258
3429
|
extensions,
|
|
3259
3430
|
setOpen,
|
|
3260
3431
|
setScreen,
|
|
3261
|
-
cardanoPeerConnect
|
|
3432
|
+
cardanoPeerConnect,
|
|
3433
|
+
burnerWallet
|
|
3262
3434
|
}) {
|
|
3263
3435
|
const wallets = useWalletList({ metamask });
|
|
3264
3436
|
const { connect } = useWallet();
|
|
3265
|
-
return /* @__PURE__ */
|
|
3266
|
-
wallets.map((wallet, index) => /* @__PURE__ */
|
|
3437
|
+
return /* @__PURE__ */ jsx14(TooltipProvider, { children: /* @__PURE__ */ jsxs9("div", { className: "mesh-grid mesh-gap-4 mesh-py-4 mesh-grid-cols-4 mesh-place-items-center", children: [
|
|
3438
|
+
wallets.map((wallet, index) => /* @__PURE__ */ jsx14(
|
|
3267
3439
|
WalletIcon,
|
|
3268
3440
|
{
|
|
3269
3441
|
icon: wallet.icon,
|
|
@@ -3275,17 +3447,27 @@ function ScreenMain({
|
|
|
3275
3447
|
},
|
|
3276
3448
|
index
|
|
3277
3449
|
)),
|
|
3278
|
-
cardanoPeerConnect && /* @__PURE__ */
|
|
3450
|
+
cardanoPeerConnect && /* @__PURE__ */ jsx14(
|
|
3279
3451
|
WalletIcon,
|
|
3280
3452
|
{
|
|
3281
3453
|
iconReactNode: IconMonitorSmartphone(),
|
|
3282
|
-
name:
|
|
3454
|
+
name: screens.p2p.title,
|
|
3283
3455
|
action: () => {
|
|
3284
3456
|
setScreen("p2p");
|
|
3285
3457
|
}
|
|
3286
3458
|
}
|
|
3287
3459
|
),
|
|
3288
|
-
/* @__PURE__ */
|
|
3460
|
+
burnerWallet && /* @__PURE__ */ jsx14(
|
|
3461
|
+
WalletIcon,
|
|
3462
|
+
{
|
|
3463
|
+
iconReactNode: IconBookDashed(),
|
|
3464
|
+
name: screens.burner.title,
|
|
3465
|
+
action: () => {
|
|
3466
|
+
setScreen("burner");
|
|
3467
|
+
}
|
|
3468
|
+
}
|
|
3469
|
+
),
|
|
3470
|
+
/* @__PURE__ */ jsx14(
|
|
3289
3471
|
WalletIcon,
|
|
3290
3472
|
{
|
|
3291
3473
|
iconReactNode: IconDownload(),
|
|
@@ -3298,11 +3480,11 @@ function ScreenMain({
|
|
|
3298
3480
|
}
|
|
3299
3481
|
}
|
|
3300
3482
|
)
|
|
3301
|
-
] });
|
|
3483
|
+
] }) });
|
|
3302
3484
|
}
|
|
3303
3485
|
|
|
3304
3486
|
// src/cardano-wallet/screen-p2p.tsx
|
|
3305
|
-
import { useEffect as
|
|
3487
|
+
import { useEffect as useEffect9, useRef as useRef2, useState as useState11 } from "react";
|
|
3306
3488
|
|
|
3307
3489
|
// src/common/cardano-peer-connect/index.ts
|
|
3308
3490
|
import * as cjsCardanopeerconnect from "@fabianbormann/cardano-peer-connect";
|
|
@@ -3311,15 +3493,15 @@ var exportedCardanopeerconnect = cardanopeerconnect?.default || cardanopeerconne
|
|
|
3311
3493
|
var DAppPeerConnect = exportedCardanopeerconnect.DAppPeerConnect;
|
|
3312
3494
|
|
|
3313
3495
|
// src/cardano-wallet/screen-p2p.tsx
|
|
3314
|
-
import { jsx as
|
|
3496
|
+
import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3315
3497
|
function ScreenP2P({
|
|
3316
3498
|
cardanoPeerConnect
|
|
3317
3499
|
}) {
|
|
3318
3500
|
const dAppConnect = useRef2(null);
|
|
3319
3501
|
const qrCodeField = useRef2(null);
|
|
3320
|
-
const [address, setAddress] =
|
|
3321
|
-
const [copied, setCopied] =
|
|
3322
|
-
|
|
3502
|
+
const [address, setAddress] = useState11("");
|
|
3503
|
+
const [copied, setCopied] = useState11(false);
|
|
3504
|
+
useEffect9(() => {
|
|
3323
3505
|
if (cardanoPeerConnect) {
|
|
3324
3506
|
if (dAppConnect.current === null) {
|
|
3325
3507
|
dAppConnect.current = new DAppPeerConnect({
|
|
@@ -3357,9 +3539,9 @@ function ScreenP2P({
|
|
|
3357
3539
|
}
|
|
3358
3540
|
}
|
|
3359
3541
|
}, []);
|
|
3360
|
-
return /* @__PURE__ */
|
|
3361
|
-
/* @__PURE__ */
|
|
3362
|
-
/* @__PURE__ */
|
|
3542
|
+
return /* @__PURE__ */ jsxs10("div", { className: "mesh-flex mesh-flex-col mesh-items-center mesh-justify-center", children: [
|
|
3543
|
+
/* @__PURE__ */ jsx15("div", { style: { marginTop: 16, marginBottom: 16 }, ref: qrCodeField }),
|
|
3544
|
+
/* @__PURE__ */ jsx15(
|
|
3363
3545
|
Button,
|
|
3364
3546
|
{
|
|
3365
3547
|
variant: "outline",
|
|
@@ -3375,68 +3557,82 @@ function ScreenP2P({
|
|
|
3375
3557
|
}
|
|
3376
3558
|
|
|
3377
3559
|
// src/cardano-wallet/index.tsx
|
|
3378
|
-
import { jsx as
|
|
3560
|
+
import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3379
3561
|
var CardanoWallet = ({
|
|
3380
3562
|
label = "Connect Wallet",
|
|
3381
3563
|
onConnected = void 0,
|
|
3382
3564
|
isDark = false,
|
|
3383
|
-
metamask = void 0,
|
|
3384
3565
|
extensions = [],
|
|
3385
|
-
|
|
3566
|
+
metamask = void 0,
|
|
3567
|
+
cardanoPeerConnect = void 0,
|
|
3568
|
+
burnerWallet = void 0
|
|
3386
3569
|
}) => {
|
|
3387
|
-
const [open, setOpen] =
|
|
3388
|
-
const [screen, setScreen] =
|
|
3570
|
+
const [open, setOpen] = useState12(false);
|
|
3571
|
+
const [screen, setScreen] = useState12("main");
|
|
3389
3572
|
const { wallet, connected } = useWallet();
|
|
3390
|
-
|
|
3573
|
+
useEffect10(() => {
|
|
3391
3574
|
if (connected && wallet) {
|
|
3392
3575
|
if (onConnected) onConnected();
|
|
3393
3576
|
}
|
|
3394
3577
|
}, [connected, wallet]);
|
|
3395
|
-
return /* @__PURE__ */
|
|
3396
|
-
!connected ? /* @__PURE__ */
|
|
3397
|
-
/* @__PURE__ */
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3578
|
+
return /* @__PURE__ */ jsxs11(Dialog, { open, onOpenChange: setOpen, children: [
|
|
3579
|
+
!connected ? /* @__PURE__ */ jsx16(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsx16(Button, { variant: "outline", className: "mesh-text-white", children: label }) }) : /* @__PURE__ */ jsx16(ConnectedButton, {}),
|
|
3580
|
+
/* @__PURE__ */ jsxs11(
|
|
3581
|
+
DialogContent,
|
|
3582
|
+
{
|
|
3583
|
+
className: "sm:mesh-max-w-[425px]",
|
|
3584
|
+
onOpenAutoFocus: (event) => event.preventDefault(),
|
|
3585
|
+
children: [
|
|
3586
|
+
/* @__PURE__ */ jsx16(Header, { screen, setScreen }),
|
|
3587
|
+
screen == "main" && /* @__PURE__ */ jsx16(
|
|
3588
|
+
ScreenMain,
|
|
3589
|
+
{
|
|
3590
|
+
metamask,
|
|
3591
|
+
extensions,
|
|
3592
|
+
setOpen,
|
|
3593
|
+
setScreen,
|
|
3594
|
+
cardanoPeerConnect: cardanoPeerConnect != void 0,
|
|
3595
|
+
burnerWallet: burnerWallet != void 0
|
|
3596
|
+
}
|
|
3597
|
+
),
|
|
3598
|
+
screen == "p2p" && /* @__PURE__ */ jsx16(ScreenP2P, { cardanoPeerConnect }),
|
|
3599
|
+
screen == "burner" && burnerWallet && /* @__PURE__ */ jsx16(
|
|
3600
|
+
ScreenBurner,
|
|
3601
|
+
{
|
|
3602
|
+
networkId: burnerWallet.networkId,
|
|
3603
|
+
provider: burnerWallet.provider,
|
|
3604
|
+
setOpen
|
|
3605
|
+
}
|
|
3606
|
+
),
|
|
3607
|
+
/* @__PURE__ */ jsx16(Footer, {})
|
|
3608
|
+
]
|
|
3609
|
+
}
|
|
3610
|
+
)
|
|
3412
3611
|
] });
|
|
3413
3612
|
};
|
|
3414
3613
|
function Header({
|
|
3415
3614
|
screen,
|
|
3416
3615
|
setScreen
|
|
3417
3616
|
}) {
|
|
3418
|
-
return /* @__PURE__ */
|
|
3419
|
-
/* @__PURE__ */
|
|
3420
|
-
screen != "main" ? /* @__PURE__ */
|
|
3421
|
-
/* @__PURE__ */
|
|
3422
|
-
|
|
3423
|
-
screen == "p2p" && "P2P Connect"
|
|
3424
|
-
] }),
|
|
3425
|
-
/* @__PURE__ */ jsx13("span", { style: { width: "24px" } })
|
|
3617
|
+
return /* @__PURE__ */ jsxs11(DialogHeader, { children: [
|
|
3618
|
+
/* @__PURE__ */ jsxs11(DialogTitle, { className: "mesh-flex mesh-justify-between", children: [
|
|
3619
|
+
screen != "main" ? /* @__PURE__ */ jsx16("button", { onClick: () => setScreen("main"), children: /* @__PURE__ */ jsx16(IconChevronRight, {}) }) : /* @__PURE__ */ jsx16("span", { style: { width: "24px" } }),
|
|
3620
|
+
/* @__PURE__ */ jsx16("span", { children: screens[screen].title }),
|
|
3621
|
+
/* @__PURE__ */ jsx16("span", { style: { width: "24px" } })
|
|
3426
3622
|
] }),
|
|
3427
|
-
/* @__PURE__ */
|
|
3623
|
+
/* @__PURE__ */ jsx16(DialogDescription, { children: screens[screen].subtitle && screens[screen].subtitle })
|
|
3428
3624
|
] });
|
|
3429
3625
|
}
|
|
3430
3626
|
function Footer() {
|
|
3431
|
-
return /* @__PURE__ */
|
|
3627
|
+
return /* @__PURE__ */ jsx16(DialogFooter, { className: "mesh-justify-center mesh-text-sm", children: /* @__PURE__ */ jsxs11(
|
|
3432
3628
|
"a",
|
|
3433
3629
|
{
|
|
3434
3630
|
href: "https://meshjs.dev/",
|
|
3435
3631
|
target: "_blank",
|
|
3436
3632
|
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",
|
|
3437
3633
|
children: [
|
|
3438
|
-
/* @__PURE__ */
|
|
3439
|
-
/* @__PURE__ */
|
|
3634
|
+
/* @__PURE__ */ jsx16("span", { className: "", children: "Powered by" }),
|
|
3635
|
+
/* @__PURE__ */ jsx16(
|
|
3440
3636
|
"svg",
|
|
3441
3637
|
{
|
|
3442
3638
|
width: 24,
|
|
@@ -3444,31 +3640,31 @@ function Footer() {
|
|
|
3444
3640
|
enableBackground: "new 0 0 300 200",
|
|
3445
3641
|
viewBox: "0 0 300 200",
|
|
3446
3642
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3447
|
-
children: /* @__PURE__ */
|
|
3643
|
+
children: /* @__PURE__ */ jsx16("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" })
|
|
3448
3644
|
}
|
|
3449
3645
|
),
|
|
3450
|
-
/* @__PURE__ */
|
|
3646
|
+
/* @__PURE__ */ jsx16("span", { className: "", children: "Mesh SDK" })
|
|
3451
3647
|
]
|
|
3452
3648
|
}
|
|
3453
3649
|
) });
|
|
3454
3650
|
}
|
|
3455
3651
|
|
|
3456
3652
|
// src/mesh-badge/mesh-logo.tsx
|
|
3457
|
-
import { jsx as
|
|
3458
|
-
var MeshLogo = () => /* @__PURE__ */
|
|
3653
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
3654
|
+
var MeshLogo = () => /* @__PURE__ */ jsx17(
|
|
3459
3655
|
"svg",
|
|
3460
3656
|
{
|
|
3461
3657
|
className: "mesh-h-16 mesh-p-2",
|
|
3462
3658
|
fill: "currentColor",
|
|
3463
3659
|
viewBox: "0 0 300 200",
|
|
3464
3660
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3465
|
-
children: /* @__PURE__ */
|
|
3661
|
+
children: /* @__PURE__ */ jsx17("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" })
|
|
3466
3662
|
}
|
|
3467
3663
|
);
|
|
3468
3664
|
|
|
3469
3665
|
// src/mesh-badge/index.tsx
|
|
3470
|
-
import { jsx as
|
|
3471
|
-
var MeshBadge = ({ isDark = false }) => /* @__PURE__ */
|
|
3666
|
+
import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3667
|
+
var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ jsxs12(
|
|
3472
3668
|
"a",
|
|
3473
3669
|
{
|
|
3474
3670
|
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`}`,
|
|
@@ -3480,21 +3676,21 @@ var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ jsxs10(
|
|
|
3480
3676
|
rel: "noopener noreferrer",
|
|
3481
3677
|
target: "_blank",
|
|
3482
3678
|
children: [
|
|
3483
|
-
/* @__PURE__ */
|
|
3679
|
+
/* @__PURE__ */ jsx18(MeshLogo, {}),
|
|
3484
3680
|
"Mesh"
|
|
3485
3681
|
]
|
|
3486
3682
|
}
|
|
3487
3683
|
);
|
|
3488
3684
|
|
|
3489
3685
|
// src/stake-button/index.tsx
|
|
3490
|
-
import { useEffect as
|
|
3686
|
+
import { useEffect as useEffect12, useState as useState14 } from "react";
|
|
3491
3687
|
import { Transaction } from "@meshsdk/transaction";
|
|
3492
3688
|
|
|
3493
3689
|
// src/cardano-wallet-dropdown/index.tsx
|
|
3494
|
-
import { useEffect as
|
|
3690
|
+
import { useEffect as useEffect11, useState as useState13 } from "react";
|
|
3495
3691
|
|
|
3496
3692
|
// src/common/button-dropdown.tsx
|
|
3497
|
-
import { jsx as
|
|
3693
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
3498
3694
|
function ButtonDropdown({
|
|
3499
3695
|
children,
|
|
3500
3696
|
isDarkMode = false,
|
|
@@ -3503,7 +3699,7 @@ function ButtonDropdown({
|
|
|
3503
3699
|
onMouseEnter,
|
|
3504
3700
|
onMouseLeave
|
|
3505
3701
|
}) {
|
|
3506
|
-
return /* @__PURE__ */
|
|
3702
|
+
return /* @__PURE__ */ jsx19(
|
|
3507
3703
|
"button",
|
|
3508
3704
|
{
|
|
3509
3705
|
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`}`,
|
|
@@ -3516,21 +3712,21 @@ function ButtonDropdown({
|
|
|
3516
3712
|
}
|
|
3517
3713
|
|
|
3518
3714
|
// src/cardano-wallet-dropdown/menu-item.tsx
|
|
3519
|
-
import { jsx as
|
|
3715
|
+
import { jsx as jsx20, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3520
3716
|
function MenuItem({
|
|
3521
3717
|
icon,
|
|
3522
3718
|
label,
|
|
3523
3719
|
action,
|
|
3524
3720
|
active
|
|
3525
3721
|
}) {
|
|
3526
|
-
return /* @__PURE__ */
|
|
3722
|
+
return /* @__PURE__ */ jsxs13(
|
|
3527
3723
|
"div",
|
|
3528
3724
|
{
|
|
3529
3725
|
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",
|
|
3530
3726
|
onClick: action,
|
|
3531
3727
|
children: [
|
|
3532
|
-
icon && /* @__PURE__ */
|
|
3533
|
-
/* @__PURE__ */
|
|
3728
|
+
icon && /* @__PURE__ */ jsx20("img", { className: "mesh-pr-2 mesh-m-1 mesh-h-8", src: icon }),
|
|
3729
|
+
/* @__PURE__ */ jsx20("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) => {
|
|
3534
3730
|
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
3535
3731
|
}).join(" ") })
|
|
3536
3732
|
]
|
|
@@ -3539,8 +3735,8 @@ function MenuItem({
|
|
|
3539
3735
|
}
|
|
3540
3736
|
|
|
3541
3737
|
// src/cardano-wallet-dropdown/chevron-down.tsx
|
|
3542
|
-
import { jsx as
|
|
3543
|
-
var ChevronDown = () => /* @__PURE__ */
|
|
3738
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
3739
|
+
var ChevronDown = () => /* @__PURE__ */ jsx21(
|
|
3544
3740
|
"svg",
|
|
3545
3741
|
{
|
|
3546
3742
|
className: "mesh-m-2 mesh-h-6",
|
|
@@ -3549,7 +3745,7 @@ var ChevronDown = () => /* @__PURE__ */ jsx18(
|
|
|
3549
3745
|
viewBox: "0 0 24 24",
|
|
3550
3746
|
stroke: "currentColor",
|
|
3551
3747
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3552
|
-
children: /* @__PURE__ */
|
|
3748
|
+
children: /* @__PURE__ */ jsx21(
|
|
3553
3749
|
"path",
|
|
3554
3750
|
{
|
|
3555
3751
|
strokeLinecap: "round",
|
|
@@ -3562,7 +3758,7 @@ var ChevronDown = () => /* @__PURE__ */ jsx18(
|
|
|
3562
3758
|
);
|
|
3563
3759
|
|
|
3564
3760
|
// src/cardano-wallet-dropdown/wallet-balance.tsx
|
|
3565
|
-
import { Fragment as
|
|
3761
|
+
import { Fragment as Fragment4, jsx as jsx22, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3566
3762
|
var WalletBalance = ({
|
|
3567
3763
|
connected,
|
|
3568
3764
|
connecting,
|
|
@@ -3570,22 +3766,22 @@ var WalletBalance = ({
|
|
|
3570
3766
|
wallet
|
|
3571
3767
|
}) => {
|
|
3572
3768
|
const lovelace = useLovelace();
|
|
3573
|
-
return connected && lovelace && wallet?.icon ? /* @__PURE__ */
|
|
3574
|
-
/* @__PURE__ */
|
|
3769
|
+
return connected && lovelace && wallet?.icon ? /* @__PURE__ */ jsxs14(Fragment4, { children: [
|
|
3770
|
+
/* @__PURE__ */ jsx22("img", { className: "mesh-m-2 mesh-h-6", src: wallet.icon }),
|
|
3575
3771
|
"\u20B3",
|
|
3576
3772
|
" ",
|
|
3577
3773
|
parseInt((parseInt(lovelace, 10) / 1e6).toString(), 10),
|
|
3578
3774
|
".",
|
|
3579
|
-
/* @__PURE__ */
|
|
3580
|
-
] }) : connected && wallet?.icon ? /* @__PURE__ */
|
|
3775
|
+
/* @__PURE__ */ jsx22("span", { className: "mesh-text-xs", children: lovelace.substring(lovelace.length - 6) })
|
|
3776
|
+
] }) : connected && wallet?.icon ? /* @__PURE__ */ jsx22(Fragment4, { children: /* @__PURE__ */ jsx22("img", { className: "mesh-m-2 mesh-h-6", src: wallet.icon }) }) : connecting ? /* @__PURE__ */ jsx22(Fragment4, { children: "Connecting..." }) : /* @__PURE__ */ jsxs14(Fragment4, { children: [
|
|
3581
3777
|
label,
|
|
3582
3778
|
" ",
|
|
3583
|
-
/* @__PURE__ */
|
|
3779
|
+
/* @__PURE__ */ jsx22(ChevronDown, {})
|
|
3584
3780
|
] });
|
|
3585
3781
|
};
|
|
3586
3782
|
|
|
3587
3783
|
// src/cardano-wallet-dropdown/index.tsx
|
|
3588
|
-
import { Fragment as
|
|
3784
|
+
import { Fragment as Fragment5, jsx as jsx23, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3589
3785
|
var CardanoWallet2 = ({
|
|
3590
3786
|
label = "Connect Wallet",
|
|
3591
3787
|
onConnected = void 0,
|
|
@@ -3594,32 +3790,32 @@ var CardanoWallet2 = ({
|
|
|
3594
3790
|
extensions = [],
|
|
3595
3791
|
cardanoPeerConnect = void 0
|
|
3596
3792
|
}) => {
|
|
3597
|
-
const [isDarkMode, setIsDarkMode] =
|
|
3598
|
-
const [hideMenuList, setHideMenuList] =
|
|
3793
|
+
const [isDarkMode, setIsDarkMode] = useState13(false);
|
|
3794
|
+
const [hideMenuList, setHideMenuList] = useState13(true);
|
|
3599
3795
|
const { connect, connecting, connected, disconnect, name } = useWallet();
|
|
3600
3796
|
const wallets = useWalletList({ metamask });
|
|
3601
|
-
|
|
3797
|
+
useEffect11(() => {
|
|
3602
3798
|
if (connected && onConnected) {
|
|
3603
3799
|
onConnected();
|
|
3604
3800
|
}
|
|
3605
3801
|
}, [connected]);
|
|
3606
|
-
|
|
3802
|
+
useEffect11(() => {
|
|
3607
3803
|
setIsDarkMode(isDark);
|
|
3608
3804
|
}, [isDark]);
|
|
3609
|
-
return /* @__PURE__ */
|
|
3805
|
+
return /* @__PURE__ */ jsxs15(
|
|
3610
3806
|
"div",
|
|
3611
3807
|
{
|
|
3612
3808
|
onMouseEnter: () => setHideMenuList(false),
|
|
3613
3809
|
onMouseLeave: () => setHideMenuList(true),
|
|
3614
3810
|
style: { width: "min-content", zIndex: 50 },
|
|
3615
3811
|
children: [
|
|
3616
|
-
/* @__PURE__ */
|
|
3812
|
+
/* @__PURE__ */ jsx23(
|
|
3617
3813
|
ButtonDropdown,
|
|
3618
3814
|
{
|
|
3619
3815
|
isDarkMode,
|
|
3620
3816
|
hideMenuList,
|
|
3621
3817
|
setHideMenuList,
|
|
3622
|
-
children: /* @__PURE__ */
|
|
3818
|
+
children: /* @__PURE__ */ jsx23(
|
|
3623
3819
|
WalletBalance,
|
|
3624
3820
|
{
|
|
3625
3821
|
connected,
|
|
@@ -3630,12 +3826,12 @@ var CardanoWallet2 = ({
|
|
|
3630
3826
|
)
|
|
3631
3827
|
}
|
|
3632
3828
|
),
|
|
3633
|
-
/* @__PURE__ */
|
|
3829
|
+
/* @__PURE__ */ jsx23(
|
|
3634
3830
|
"div",
|
|
3635
3831
|
{
|
|
3636
3832
|
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`}`,
|
|
3637
3833
|
style: { zIndex: 50 },
|
|
3638
|
-
children: !connected && wallets.length > 0 ? /* @__PURE__ */
|
|
3834
|
+
children: !connected && wallets.length > 0 ? /* @__PURE__ */ jsx23(Fragment5, { children: wallets.map((wallet, index) => /* @__PURE__ */ jsx23(
|
|
3639
3835
|
MenuItem,
|
|
3640
3836
|
{
|
|
3641
3837
|
icon: wallet.icon,
|
|
@@ -3647,7 +3843,7 @@ var CardanoWallet2 = ({
|
|
|
3647
3843
|
active: name === wallet.id
|
|
3648
3844
|
},
|
|
3649
3845
|
index
|
|
3650
|
-
)) }) : wallets.length === 0 ? /* @__PURE__ */
|
|
3846
|
+
)) }) : wallets.length === 0 ? /* @__PURE__ */ jsx23("span", { children: "No Wallet Found" }) : /* @__PURE__ */ jsx23(Fragment5, { children: /* @__PURE__ */ jsx23(
|
|
3651
3847
|
MenuItem,
|
|
3652
3848
|
{
|
|
3653
3849
|
active: false,
|
|
@@ -3664,7 +3860,7 @@ var CardanoWallet2 = ({
|
|
|
3664
3860
|
};
|
|
3665
3861
|
|
|
3666
3862
|
// src/stake-button/index.tsx
|
|
3667
|
-
import { Fragment as
|
|
3863
|
+
import { Fragment as Fragment6, jsx as jsx24 } from "react/jsx-runtime";
|
|
3668
3864
|
var StakeButton = ({
|
|
3669
3865
|
label = "Stake your ADA",
|
|
3670
3866
|
isDark = false,
|
|
@@ -3672,19 +3868,19 @@ var StakeButton = ({
|
|
|
3672
3868
|
onCheck,
|
|
3673
3869
|
onDelegated = void 0
|
|
3674
3870
|
}) => {
|
|
3675
|
-
const [isDarkMode, setIsDarkMode] =
|
|
3871
|
+
const [isDarkMode, setIsDarkMode] = useState14(false);
|
|
3676
3872
|
const { connected } = useWallet();
|
|
3677
|
-
|
|
3873
|
+
useEffect12(() => {
|
|
3678
3874
|
setIsDarkMode(isDark);
|
|
3679
3875
|
}, [isDark]);
|
|
3680
|
-
return /* @__PURE__ */
|
|
3876
|
+
return /* @__PURE__ */ jsx24(Fragment6, { children: connected ? /* @__PURE__ */ jsx24(ButtonDropdown, { isDarkMode, children: /* @__PURE__ */ jsx24(
|
|
3681
3877
|
Delegate,
|
|
3682
3878
|
{
|
|
3683
3879
|
poolId,
|
|
3684
3880
|
onCheck,
|
|
3685
3881
|
onDelegated
|
|
3686
3882
|
}
|
|
3687
|
-
) }) : /* @__PURE__ */
|
|
3883
|
+
) }) : /* @__PURE__ */ jsx24(CardanoWallet2, { label, isDark }) });
|
|
3688
3884
|
};
|
|
3689
3885
|
var Delegate = ({
|
|
3690
3886
|
poolId,
|
|
@@ -3693,11 +3889,11 @@ var Delegate = ({
|
|
|
3693
3889
|
}) => {
|
|
3694
3890
|
const { wallet } = useWallet();
|
|
3695
3891
|
const rewardAddress = useRewardAddress();
|
|
3696
|
-
const [_, setError] =
|
|
3697
|
-
const [checking, setChecking] =
|
|
3698
|
-
const [accountInfo, setAccountInfo] =
|
|
3699
|
-
const [processing, setProcessing] =
|
|
3700
|
-
const [done, setDone] =
|
|
3892
|
+
const [_, setError] = useState14();
|
|
3893
|
+
const [checking, setChecking] = useState14(false);
|
|
3894
|
+
const [accountInfo, setAccountInfo] = useState14();
|
|
3895
|
+
const [processing, setProcessing] = useState14(false);
|
|
3896
|
+
const [done, setDone] = useState14(false);
|
|
3701
3897
|
const checkAccountStatus = async () => {
|
|
3702
3898
|
try {
|
|
3703
3899
|
setChecking(true);
|
|
@@ -3748,22 +3944,22 @@ var Delegate = ({
|
|
|
3748
3944
|
}
|
|
3749
3945
|
setProcessing(false);
|
|
3750
3946
|
};
|
|
3751
|
-
|
|
3947
|
+
useEffect12(() => {
|
|
3752
3948
|
checkAccountStatus();
|
|
3753
3949
|
}, [rewardAddress]);
|
|
3754
3950
|
if (checking) {
|
|
3755
|
-
return /* @__PURE__ */
|
|
3951
|
+
return /* @__PURE__ */ jsx24("span", { children: "Checking..." });
|
|
3756
3952
|
}
|
|
3757
3953
|
if (processing) {
|
|
3758
|
-
return /* @__PURE__ */
|
|
3954
|
+
return /* @__PURE__ */ jsx24("span", { children: "Loading..." });
|
|
3759
3955
|
}
|
|
3760
3956
|
if (done) {
|
|
3761
|
-
return /* @__PURE__ */
|
|
3957
|
+
return /* @__PURE__ */ jsx24("span", { children: "Stake Delegated" });
|
|
3762
3958
|
}
|
|
3763
3959
|
if (accountInfo?.active) {
|
|
3764
|
-
return accountInfo.poolId === poolId ? /* @__PURE__ */
|
|
3960
|
+
return accountInfo.poolId === poolId ? /* @__PURE__ */ jsx24("span", { children: "Stake Delegated" }) : /* @__PURE__ */ jsx24("span", { onClick: delegateStake, children: "Begin Staking" });
|
|
3765
3961
|
}
|
|
3766
|
-
return /* @__PURE__ */
|
|
3962
|
+
return /* @__PURE__ */ jsx24("span", { onClick: registerAddress, children: "Begin Staking" });
|
|
3767
3963
|
};
|
|
3768
3964
|
export {
|
|
3769
3965
|
CardanoWallet,
|