@meshsdk/react 1.9.0-beta.7 → 1.9.0-beta.71
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 +415 -409
- package/dist/index.d.cts +27 -18
- package/dist/index.d.ts +27 -18
- package/dist/index.js +409 -398
- package/package.json +11 -8
package/dist/index.cjs
CHANGED
|
@@ -23443,7 +23443,6 @@ __export(index_exports, {
|
|
|
23443
23443
|
CardanoWallet: () => CardanoWallet,
|
|
23444
23444
|
MeshBadge: () => MeshBadge,
|
|
23445
23445
|
MeshProvider: () => MeshProvider,
|
|
23446
|
-
StakeButton: () => StakeButton,
|
|
23447
23446
|
WalletContext: () => WalletContext,
|
|
23448
23447
|
useAddress: () => useAddress,
|
|
23449
23448
|
useAssets: () => useAssets,
|
|
@@ -23457,7 +23456,7 @@ __export(index_exports, {
|
|
|
23457
23456
|
module.exports = __toCommonJS(index_exports);
|
|
23458
23457
|
|
|
23459
23458
|
// src/cardano-wallet/index.tsx
|
|
23460
|
-
var
|
|
23459
|
+
var import_react14 = require("react");
|
|
23461
23460
|
|
|
23462
23461
|
// src/common/button.tsx
|
|
23463
23462
|
var React = __toESM(require("react"), 1);
|
|
@@ -23638,6 +23637,7 @@ var import_react2 = require("react");
|
|
|
23638
23637
|
// src/contexts/WalletContext.ts
|
|
23639
23638
|
var import_react = require("react");
|
|
23640
23639
|
var import_wallet = require("@meshsdk/wallet");
|
|
23640
|
+
var import_web3_sdk = require("@meshsdk/web3-sdk");
|
|
23641
23641
|
var INITIAL_STATE = {
|
|
23642
23642
|
walletName: void 0,
|
|
23643
23643
|
walletInstance: {}
|
|
@@ -23651,11 +23651,17 @@ var useWalletStore = () => {
|
|
|
23651
23651
|
const [address, setAddress] = (0, import_react.useState)("");
|
|
23652
23652
|
const [connectedWalletInstance, setConnectedWalletInstance] = (0, import_react.useState)(INITIAL_STATE.walletInstance);
|
|
23653
23653
|
const [connectedWalletName, setConnectedWalletName] = (0, import_react.useState)(INITIAL_STATE.walletName);
|
|
23654
|
+
const [web3Services, setWeb3Services] = (0, import_react.useState)(void 0);
|
|
23655
|
+
const [web3UserData, setWeb3UserData] = (0, import_react.useState)(
|
|
23656
|
+
void 0
|
|
23657
|
+
);
|
|
23658
|
+
const [connectedBitcoinWallet, setConnectedBitcoinWallet] = (0, import_react.useState)({});
|
|
23654
23659
|
const connectWallet = (0, import_react.useCallback)(
|
|
23655
|
-
async (walletName,
|
|
23660
|
+
async (walletName, persist) => {
|
|
23656
23661
|
setConnectingWallet(true);
|
|
23657
23662
|
setState("CONNECTING" /* CONNECTING */);
|
|
23658
23663
|
try {
|
|
23664
|
+
const extensions = import_wallet.BrowserWallet.getSupportedExtensions(walletName);
|
|
23659
23665
|
const walletInstance = await import_wallet.BrowserWallet.enable(
|
|
23660
23666
|
walletName,
|
|
23661
23667
|
extensions
|
|
@@ -23687,10 +23693,24 @@ var useWalletStore = () => {
|
|
|
23687
23693
|
localStorage.removeItem(localstoragePersist);
|
|
23688
23694
|
}, []);
|
|
23689
23695
|
const setWallet = (0, import_react.useCallback)(
|
|
23690
|
-
async (walletInstance, walletName) => {
|
|
23696
|
+
async (walletInstance, walletName, persist) => {
|
|
23691
23697
|
setConnectedWalletInstance(walletInstance);
|
|
23692
23698
|
setConnectedWalletName(walletName);
|
|
23693
23699
|
setState("CONNECTED" /* CONNECTED */);
|
|
23700
|
+
if (persist) {
|
|
23701
|
+
localStorage.setItem(
|
|
23702
|
+
localstoragePersist,
|
|
23703
|
+
JSON.stringify({ walletName, ...persist })
|
|
23704
|
+
);
|
|
23705
|
+
}
|
|
23706
|
+
},
|
|
23707
|
+
[]
|
|
23708
|
+
);
|
|
23709
|
+
const setBitcoinWallet = (0, import_react.useCallback)(
|
|
23710
|
+
async (walletInstance, walletName) => {
|
|
23711
|
+
setConnectedBitcoinWallet(walletInstance);
|
|
23712
|
+
setConnectedWalletName(walletName);
|
|
23713
|
+
setState("CONNECTED" /* CONNECTED */);
|
|
23694
23714
|
},
|
|
23695
23715
|
[]
|
|
23696
23716
|
);
|
|
@@ -23705,27 +23725,52 @@ var useWalletStore = () => {
|
|
|
23705
23725
|
address2 = await connectedWalletInstance.getChangeAddress();
|
|
23706
23726
|
setAddress(address2);
|
|
23707
23727
|
}
|
|
23728
|
+
if (Object.keys(connectedBitcoinWallet).length > 0 && address.length === 0) {
|
|
23729
|
+
let address2 = await connectedBitcoinWallet.getChangeAddress();
|
|
23730
|
+
setAddress(address2);
|
|
23731
|
+
}
|
|
23708
23732
|
}
|
|
23709
23733
|
load();
|
|
23710
|
-
}, [connectedWalletInstance]);
|
|
23734
|
+
}, [connectedWalletInstance, connectedBitcoinWallet]);
|
|
23711
23735
|
(0, import_react.useEffect)(() => {
|
|
23712
23736
|
const persist = localStorage.getItem(localstoragePersist);
|
|
23713
23737
|
if (persistSession && persist) {
|
|
23714
23738
|
const persist2 = JSON.parse(
|
|
23715
23739
|
localStorage.getItem(localstoragePersist) || ""
|
|
23716
23740
|
);
|
|
23717
|
-
|
|
23741
|
+
if (persist2.walletName == "utxos" && web3Services) {
|
|
23742
|
+
import_web3_sdk.Web3Wallet.initWallet({
|
|
23743
|
+
networkId: web3Services.networkId,
|
|
23744
|
+
address: persist2.walletAddress,
|
|
23745
|
+
fetcher: web3Services.fetcher,
|
|
23746
|
+
submitter: web3Services.submitter,
|
|
23747
|
+
projectId: web3Services.projectId,
|
|
23748
|
+
appUrl: web3Services.appUrl
|
|
23749
|
+
}).then((wallet) => {
|
|
23750
|
+
setConnectedWalletInstance(wallet.cardano);
|
|
23751
|
+
setConnectedWalletName(persist2.walletName);
|
|
23752
|
+
setState("CONNECTED" /* CONNECTED */);
|
|
23753
|
+
});
|
|
23754
|
+
setWeb3UserData(persist2.user);
|
|
23755
|
+
} else {
|
|
23756
|
+
connectWallet(persist2.walletName);
|
|
23757
|
+
}
|
|
23718
23758
|
}
|
|
23719
23759
|
}, [persistSession]);
|
|
23720
23760
|
return {
|
|
23721
23761
|
hasConnectedWallet: INITIAL_STATE.walletName !== connectedWalletName,
|
|
23722
23762
|
connectedWalletInstance,
|
|
23763
|
+
connectedBitcoinWallet,
|
|
23723
23764
|
connectedWalletName,
|
|
23724
23765
|
connectingWallet,
|
|
23725
23766
|
connectWallet,
|
|
23726
23767
|
disconnect,
|
|
23727
23768
|
setWallet,
|
|
23769
|
+
setBitcoinWallet,
|
|
23728
23770
|
setPersist,
|
|
23771
|
+
setWeb3Services,
|
|
23772
|
+
web3UserData,
|
|
23773
|
+
setWeb3UserData,
|
|
23729
23774
|
error,
|
|
23730
23775
|
address,
|
|
23731
23776
|
state
|
|
@@ -23734,6 +23779,7 @@ var useWalletStore = () => {
|
|
|
23734
23779
|
var WalletContext = (0, import_react.createContext)({
|
|
23735
23780
|
hasConnectedWallet: false,
|
|
23736
23781
|
connectedWalletInstance: INITIAL_STATE.walletInstance,
|
|
23782
|
+
connectedBitcoinWallet: {},
|
|
23737
23783
|
connectedWalletName: INITIAL_STATE.walletName,
|
|
23738
23784
|
connectingWallet: false,
|
|
23739
23785
|
connectWallet: async () => {
|
|
@@ -23742,8 +23788,15 @@ var WalletContext = (0, import_react.createContext)({
|
|
|
23742
23788
|
},
|
|
23743
23789
|
setWallet: async () => {
|
|
23744
23790
|
},
|
|
23791
|
+
setBitcoinWallet: async () => {
|
|
23792
|
+
},
|
|
23745
23793
|
setPersist: () => {
|
|
23746
23794
|
},
|
|
23795
|
+
setWeb3Services: () => {
|
|
23796
|
+
},
|
|
23797
|
+
web3UserData: void 0,
|
|
23798
|
+
setWeb3UserData: () => {
|
|
23799
|
+
},
|
|
23747
23800
|
address: "",
|
|
23748
23801
|
state: "NOT_CONNECTED" /* NOT_CONNECTED */
|
|
23749
23802
|
});
|
|
@@ -23864,7 +23917,11 @@ var useWallet = () => {
|
|
|
23864
23917
|
connectWallet,
|
|
23865
23918
|
disconnect,
|
|
23866
23919
|
setWallet,
|
|
23920
|
+
setBitcoinWallet,
|
|
23867
23921
|
setPersist,
|
|
23922
|
+
setWeb3Services,
|
|
23923
|
+
web3UserData,
|
|
23924
|
+
setWeb3UserData,
|
|
23868
23925
|
error,
|
|
23869
23926
|
address,
|
|
23870
23927
|
state
|
|
@@ -23882,7 +23939,11 @@ var useWallet = () => {
|
|
|
23882
23939
|
connect: connectWallet,
|
|
23883
23940
|
disconnect,
|
|
23884
23941
|
setWallet,
|
|
23942
|
+
setBitcoinWallet,
|
|
23885
23943
|
setPersist,
|
|
23944
|
+
setWeb3Services,
|
|
23945
|
+
web3UserData,
|
|
23946
|
+
setWeb3UserData,
|
|
23886
23947
|
error,
|
|
23887
23948
|
address,
|
|
23888
23949
|
state
|
|
@@ -24055,7 +24116,7 @@ DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
|
24055
24116
|
// src/cardano-wallet/connected-button.tsx
|
|
24056
24117
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
24057
24118
|
function ConnectedButton() {
|
|
24058
|
-
const {
|
|
24119
|
+
const { name, disconnect, address } = useWallet();
|
|
24059
24120
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(DropdownMenu, { children: [
|
|
24060
24121
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Button, { variant: "outline", children: [
|
|
24061
24122
|
address.slice(0, 6),
|
|
@@ -24063,6 +24124,7 @@ function ConnectedButton() {
|
|
|
24063
24124
|
address.slice(-6)
|
|
24064
24125
|
] }) }),
|
|
24065
24126
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(DropdownMenuContent, { children: [
|
|
24127
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownMenuLabel, { children: "Wallet" }),
|
|
24066
24128
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
24067
24129
|
DropdownMenuItem,
|
|
24068
24130
|
{
|
|
@@ -24072,6 +24134,16 @@ function ConnectedButton() {
|
|
|
24072
24134
|
children: "Copy Address"
|
|
24073
24135
|
}
|
|
24074
24136
|
),
|
|
24137
|
+
name == "utxos" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
24138
|
+
DropdownMenuItem,
|
|
24139
|
+
{
|
|
24140
|
+
onClick: () => {
|
|
24141
|
+
window.open("https://utxos.dev/wallet", "_blank");
|
|
24142
|
+
},
|
|
24143
|
+
children: "Open Web3 Wallet"
|
|
24144
|
+
}
|
|
24145
|
+
),
|
|
24146
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownMenuSeparator, {}),
|
|
24075
24147
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
24076
24148
|
DropdownMenuItem,
|
|
24077
24149
|
{
|
|
@@ -24181,10 +24253,40 @@ function ScreenBurner({
|
|
|
24181
24253
|
] }) });
|
|
24182
24254
|
}
|
|
24183
24255
|
|
|
24184
|
-
// src/
|
|
24256
|
+
// src/cardano-wallet/screen-main.tsx
|
|
24257
|
+
var import_bitcoin = require("@meshsdk/bitcoin");
|
|
24258
|
+
|
|
24259
|
+
// src/common/icons/icon-bitcoin.tsx
|
|
24185
24260
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
24261
|
+
function IconBitcoin() {
|
|
24262
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
24263
|
+
"svg",
|
|
24264
|
+
{
|
|
24265
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
24266
|
+
width: "24",
|
|
24267
|
+
height: "24",
|
|
24268
|
+
viewBox: "0 0 24 24",
|
|
24269
|
+
fill: "none",
|
|
24270
|
+
stroke: "currentColor",
|
|
24271
|
+
strokeWidth: "2",
|
|
24272
|
+
strokeLinecap: "round",
|
|
24273
|
+
strokeLinejoin: "round",
|
|
24274
|
+
style: {
|
|
24275
|
+
color: "#CC9900",
|
|
24276
|
+
width: "24px",
|
|
24277
|
+
height: "24px",
|
|
24278
|
+
strokeWidth: "1px"
|
|
24279
|
+
},
|
|
24280
|
+
className: "hover:mesh-fill-white",
|
|
24281
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { d: "M11.767 19.089c4.924.868 6.14-6.025 1.216-6.894m-1.216 6.894L5.86 18.047m5.908 1.042-.347 1.97m1.563-8.864c4.924.869 6.14-6.025 1.215-6.893m-1.215 6.893-3.94-.694m5.155-6.2L8.29 4.26m5.908 1.042.348-1.97M7.48 20.364l3.126-17.727" })
|
|
24282
|
+
}
|
|
24283
|
+
);
|
|
24284
|
+
}
|
|
24285
|
+
|
|
24286
|
+
// src/common/icons/icon-book-dashed.tsx
|
|
24287
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
24186
24288
|
function IconBookDashed() {
|
|
24187
|
-
return /* @__PURE__ */ (0,
|
|
24289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
24188
24290
|
"svg",
|
|
24189
24291
|
{
|
|
24190
24292
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -24204,26 +24306,26 @@ function IconBookDashed() {
|
|
|
24204
24306
|
},
|
|
24205
24307
|
className: "hover:mesh-fill-white",
|
|
24206
24308
|
children: [
|
|
24207
|
-
/* @__PURE__ */ (0,
|
|
24208
|
-
/* @__PURE__ */ (0,
|
|
24209
|
-
/* @__PURE__ */ (0,
|
|
24210
|
-
/* @__PURE__ */ (0,
|
|
24211
|
-
/* @__PURE__ */ (0,
|
|
24212
|
-
/* @__PURE__ */ (0,
|
|
24213
|
-
/* @__PURE__ */ (0,
|
|
24214
|
-
/* @__PURE__ */ (0,
|
|
24215
|
-
/* @__PURE__ */ (0,
|
|
24216
|
-
/* @__PURE__ */ (0,
|
|
24217
|
-
/* @__PURE__ */ (0,
|
|
24309
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M12 17h2" }),
|
|
24310
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M12 22h2" }),
|
|
24311
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M12 2h2" }),
|
|
24312
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M18 22h1a1 1 0 0 0 1-1" }),
|
|
24313
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M18 2h1a1 1 0 0 1 1 1v1" }),
|
|
24314
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M20 15v2h-2" }),
|
|
24315
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M20 8v3" }),
|
|
24316
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M4 11V9" }),
|
|
24317
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M4 19.5V15" }),
|
|
24318
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M4 5v-.5A2.5 2.5 0 0 1 6.5 2H8" }),
|
|
24319
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M8 22H6.5a1 1 0 0 1 0-5H8" })
|
|
24218
24320
|
]
|
|
24219
24321
|
}
|
|
24220
24322
|
);
|
|
24221
24323
|
}
|
|
24222
24324
|
|
|
24223
24325
|
// src/common/icons/icon-download.tsx
|
|
24224
|
-
var
|
|
24326
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
24225
24327
|
function IconDownload() {
|
|
24226
|
-
return /* @__PURE__ */ (0,
|
|
24328
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
24227
24329
|
"svg",
|
|
24228
24330
|
{
|
|
24229
24331
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -24241,20 +24343,19 @@ function IconDownload() {
|
|
|
24241
24343
|
height: "24px",
|
|
24242
24344
|
strokeWidth: "1px"
|
|
24243
24345
|
},
|
|
24244
|
-
className: "hover:mesh-fill-white",
|
|
24245
24346
|
children: [
|
|
24246
|
-
/* @__PURE__ */ (0,
|
|
24247
|
-
/* @__PURE__ */ (0,
|
|
24248
|
-
/* @__PURE__ */ (0,
|
|
24347
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
24348
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("polyline", { points: "7 10 12 15 17 10" }),
|
|
24349
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "12", x2: "12", y1: "15", y2: "3" })
|
|
24249
24350
|
]
|
|
24250
24351
|
}
|
|
24251
24352
|
);
|
|
24252
24353
|
}
|
|
24253
24354
|
|
|
24254
24355
|
// src/common/icons/icon-fingerprint.tsx
|
|
24255
|
-
var
|
|
24356
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
24256
24357
|
function IconFingerprint() {
|
|
24257
|
-
return /* @__PURE__ */ (0,
|
|
24358
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
24258
24359
|
"svg",
|
|
24259
24360
|
{
|
|
24260
24361
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -24274,24 +24375,24 @@ function IconFingerprint() {
|
|
|
24274
24375
|
},
|
|
24275
24376
|
className: "hover:mesh-fill-white",
|
|
24276
24377
|
children: [
|
|
24277
|
-
/* @__PURE__ */ (0,
|
|
24278
|
-
/* @__PURE__ */ (0,
|
|
24279
|
-
/* @__PURE__ */ (0,
|
|
24280
|
-
/* @__PURE__ */ (0,
|
|
24281
|
-
/* @__PURE__ */ (0,
|
|
24282
|
-
/* @__PURE__ */ (0,
|
|
24283
|
-
/* @__PURE__ */ (0,
|
|
24284
|
-
/* @__PURE__ */ (0,
|
|
24285
|
-
/* @__PURE__ */ (0,
|
|
24378
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4" }),
|
|
24379
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M14 13.12c0 2.38 0 6.38-1 8.88" }),
|
|
24380
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M17.29 21.02c.12-.6.43-2.3.5-3.02" }),
|
|
24381
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M2 12a10 10 0 0 1 18-6" }),
|
|
24382
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M2 16h.01" }),
|
|
24383
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M21.8 16c.2-2 .131-5.354 0-6" }),
|
|
24384
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2" }),
|
|
24385
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M8.65 22c.21-.66.45-1.32.57-2" }),
|
|
24386
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M9 6.8a6 6 0 0 1 9 5.2v2" })
|
|
24286
24387
|
]
|
|
24287
24388
|
}
|
|
24288
24389
|
);
|
|
24289
24390
|
}
|
|
24290
24391
|
|
|
24291
24392
|
// src/common/icons/icon-monitor-smartphone.tsx
|
|
24292
|
-
var
|
|
24393
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
24293
24394
|
function IconMonitorSmartphone() {
|
|
24294
|
-
return /* @__PURE__ */ (0,
|
|
24395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
24295
24396
|
"svg",
|
|
24296
24397
|
{
|
|
24297
24398
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -24310,10 +24411,10 @@ function IconMonitorSmartphone() {
|
|
|
24310
24411
|
strokeWidth: "1px"
|
|
24311
24412
|
},
|
|
24312
24413
|
children: [
|
|
24313
|
-
/* @__PURE__ */ (0,
|
|
24314
|
-
/* @__PURE__ */ (0,
|
|
24315
|
-
/* @__PURE__ */ (0,
|
|
24316
|
-
/* @__PURE__ */ (0,
|
|
24414
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8" }),
|
|
24415
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M10 19v-3.96 3.15" }),
|
|
24416
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M7 19h5" }),
|
|
24417
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("rect", { width: "6", height: "10", x: "16", y: "12", rx: "2" })
|
|
24317
24418
|
]
|
|
24318
24419
|
}
|
|
24319
24420
|
);
|
|
@@ -24322,11 +24423,11 @@ function IconMonitorSmartphone() {
|
|
|
24322
24423
|
// src/common/tooltip.tsx
|
|
24323
24424
|
var React4 = __toESM(require("react"), 1);
|
|
24324
24425
|
var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"), 1);
|
|
24325
|
-
var
|
|
24426
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
24326
24427
|
var TooltipProvider = TooltipPrimitive.Provider;
|
|
24327
24428
|
var Tooltip = TooltipPrimitive.Root;
|
|
24328
24429
|
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
24329
|
-
var TooltipContent = React4.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ (0,
|
|
24430
|
+
var TooltipContent = React4.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
24330
24431
|
TooltipPrimitive.Content,
|
|
24331
24432
|
{
|
|
24332
24433
|
ref,
|
|
@@ -24341,57 +24442,225 @@ var TooltipContent = React4.forwardRef(({ className, sideOffset = 4, ...props },
|
|
|
24341
24442
|
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
24342
24443
|
|
|
24343
24444
|
// src/cardano-wallet/wallet-icon.tsx
|
|
24344
|
-
var
|
|
24445
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
24345
24446
|
function WalletIcon({
|
|
24346
24447
|
icon,
|
|
24347
24448
|
name,
|
|
24348
24449
|
action,
|
|
24349
|
-
iconReactNode
|
|
24450
|
+
iconReactNode,
|
|
24451
|
+
loading = false
|
|
24350
24452
|
}) {
|
|
24351
|
-
return /* @__PURE__ */ (0,
|
|
24352
|
-
/* @__PURE__ */ (0,
|
|
24453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Tooltip, { delayDuration: 0, defaultOpen: false, children: [
|
|
24454
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
24353
24455
|
"button",
|
|
24354
24456
|
{
|
|
24355
24457
|
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",
|
|
24356
24458
|
onClick: action,
|
|
24459
|
+
disabled: loading,
|
|
24357
24460
|
children: [
|
|
24358
|
-
icon && /* @__PURE__ */ (0,
|
|
24359
|
-
iconReactNode && iconReactNode
|
|
24461
|
+
icon && !loading && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("img", { src: icon, alt: name, className: "mesh-w-8 mesh-h-8" }),
|
|
24462
|
+
!loading && iconReactNode && iconReactNode,
|
|
24463
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-black", children: "..." })
|
|
24360
24464
|
]
|
|
24361
24465
|
}
|
|
24362
24466
|
) }),
|
|
24363
|
-
/* @__PURE__ */ (0,
|
|
24467
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TooltipContent, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: name }) })
|
|
24468
|
+
] });
|
|
24469
|
+
}
|
|
24470
|
+
|
|
24471
|
+
// src/cardano-wallet/web3-services.tsx
|
|
24472
|
+
var import_react11 = require("react");
|
|
24473
|
+
var import_web3_sdk2 = require("@meshsdk/web3-sdk");
|
|
24474
|
+
|
|
24475
|
+
// src/common/icons/icon-discord.tsx
|
|
24476
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
24477
|
+
function IconDiscord() {
|
|
24478
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
24479
|
+
"svg",
|
|
24480
|
+
{
|
|
24481
|
+
viewBox: "0 0 20 20",
|
|
24482
|
+
"aria-hidden": "true",
|
|
24483
|
+
style: {
|
|
24484
|
+
width: "24px",
|
|
24485
|
+
height: "24px"
|
|
24486
|
+
},
|
|
24487
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
24488
|
+
"path",
|
|
24489
|
+
{
|
|
24490
|
+
d: "M16.238 4.515a14.842 14.842 0 0 0-3.664-1.136.055.055 0 0 0-.059.027 10.35 10.35 0 0 0-.456.938 13.702 13.702 0 0 0-4.115 0 9.479 9.479 0 0 0-.464-.938.058.058 0 0 0-.058-.027c-1.266.218-2.497.6-3.664 1.136a.052.052 0 0 0-.024.02C1.4 8.023.76 11.424 1.074 14.782a.062.062 0 0 0 .024.042 14.923 14.923 0 0 0 4.494 2.272.058.058 0 0 0 .064-.02c.346-.473.654-.972.92-1.496a.057.057 0 0 0-.032-.08 9.83 9.83 0 0 1-1.404-.669.058.058 0 0 1-.029-.046.058.058 0 0 1 .023-.05c.094-.07.189-.144.279-.218a.056.056 0 0 1 .058-.008c2.946 1.345 6.135 1.345 9.046 0a.056.056 0 0 1 .059.007c.09.074.184.149.28.22a.058.058 0 0 1 .023.049.059.059 0 0 1-.028.046 9.224 9.224 0 0 1-1.405.669.058.058 0 0 0-.033.033.056.056 0 0 0 .002.047c.27.523.58 1.022.92 1.495a.056.056 0 0 0 .062.021 14.878 14.878 0 0 0 4.502-2.272.055.055 0 0 0 .016-.018.056.056 0 0 0 .008-.023c.375-3.883-.63-7.256-2.662-10.246a.046.046 0 0 0-.023-.021Zm-9.223 8.221c-.887 0-1.618-.814-1.618-1.814s.717-1.814 1.618-1.814c.908 0 1.632.821 1.618 1.814 0 1-.717 1.814-1.618 1.814Zm5.981 0c-.887 0-1.618-.814-1.618-1.814s.717-1.814 1.618-1.814c.908 0 1.632.821 1.618 1.814 0 1-.71 1.814-1.618 1.814Z",
|
|
24491
|
+
fill: "#5865F2"
|
|
24492
|
+
}
|
|
24493
|
+
)
|
|
24494
|
+
}
|
|
24495
|
+
);
|
|
24496
|
+
}
|
|
24497
|
+
|
|
24498
|
+
// src/common/icons/icon-google.tsx
|
|
24499
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
24500
|
+
function IconGoogle() {
|
|
24501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
24502
|
+
"svg",
|
|
24503
|
+
{
|
|
24504
|
+
viewBox: "0 0 262 262",
|
|
24505
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
24506
|
+
preserveAspectRatio: "xMidYMid",
|
|
24507
|
+
style: {
|
|
24508
|
+
width: "24px",
|
|
24509
|
+
height: "24px"
|
|
24510
|
+
},
|
|
24511
|
+
children: [
|
|
24512
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
24513
|
+
"path",
|
|
24514
|
+
{
|
|
24515
|
+
d: "M255.878 133.451c0-10.734-.871-18.567-2.756-26.69H130.55v48.448h71.947c-1.45 12.04-9.283 30.172-26.69 42.356l-.244 1.622 38.755 30.023 2.685.268c24.659-22.774 38.875-56.282 38.875-96.027",
|
|
24516
|
+
fill: "#4285F4"
|
|
24517
|
+
}
|
|
24518
|
+
),
|
|
24519
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
24520
|
+
"path",
|
|
24521
|
+
{
|
|
24522
|
+
d: "M130.55 261.1c35.248 0 64.839-11.605 86.453-31.622l-41.196-31.913c-11.024 7.688-25.82 13.055-45.257 13.055-34.523 0-63.824-22.773-74.269-54.25l-1.531.13-40.298 31.187-.527 1.465C35.393 231.798 79.49 261.1 130.55 261.1",
|
|
24523
|
+
fill: "#34A853"
|
|
24524
|
+
}
|
|
24525
|
+
),
|
|
24526
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
24527
|
+
"path",
|
|
24528
|
+
{
|
|
24529
|
+
d: "M56.281 156.37c-2.756-8.123-4.351-16.827-4.351-25.82 0-8.994 1.595-17.697 4.206-25.82l-.073-1.73L15.26 71.312l-1.335.635C5.077 89.644 0 109.517 0 130.55s5.077 40.905 13.925 58.602l42.356-32.782",
|
|
24530
|
+
fill: "#FBBC05"
|
|
24531
|
+
}
|
|
24532
|
+
),
|
|
24533
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
24534
|
+
"path",
|
|
24535
|
+
{
|
|
24536
|
+
d: "M130.55 50.479c24.514 0 41.05 10.589 50.479 19.438l36.844-35.974C195.245 12.91 165.798 0 130.55 0 79.49 0 35.393 29.301 13.925 71.947l42.211 32.783c10.59-31.477 39.891-54.251 74.414-54.251",
|
|
24537
|
+
fill: "#EB4335"
|
|
24538
|
+
}
|
|
24539
|
+
)
|
|
24540
|
+
]
|
|
24541
|
+
}
|
|
24542
|
+
);
|
|
24543
|
+
}
|
|
24544
|
+
|
|
24545
|
+
// src/common/icons/icon-twitter.tsx
|
|
24546
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
24547
|
+
function IconTwitter() {
|
|
24548
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
24549
|
+
"svg",
|
|
24550
|
+
{
|
|
24551
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
24552
|
+
version: "1.1",
|
|
24553
|
+
viewBox: "0 0 24 24",
|
|
24554
|
+
style: {
|
|
24555
|
+
width: "24px",
|
|
24556
|
+
height: "24px"
|
|
24557
|
+
},
|
|
24558
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M14.095479,10.316482L22.286354,1h-1.940718l-7.115352,8.087682L7.551414,1H1l8.589488,12.231093L1,23h1.940717 l7.509372-8.542861L16.448587,23H23L14.095479,10.316482z M11.436522,13.338465l-0.871624-1.218704l-6.924311-9.68815h2.981339 l5.58978,7.82155l0.867949,1.218704l7.26506,10.166271h-2.981339L11.436522,13.338465z" })
|
|
24559
|
+
}
|
|
24560
|
+
);
|
|
24561
|
+
}
|
|
24562
|
+
|
|
24563
|
+
// src/cardano-wallet/web3-services.tsx
|
|
24564
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
24565
|
+
function Web3Services({
|
|
24566
|
+
options,
|
|
24567
|
+
setOpen,
|
|
24568
|
+
persist
|
|
24569
|
+
}) {
|
|
24570
|
+
const { setWallet, setWeb3UserData } = useWallet();
|
|
24571
|
+
const [loading, setLoading] = (0, import_react11.useState)(false);
|
|
24572
|
+
async function loadWallet(directTo) {
|
|
24573
|
+
setLoading(true);
|
|
24574
|
+
const _options = {
|
|
24575
|
+
networkId: 0,
|
|
24576
|
+
fetcher: options.fetcher,
|
|
24577
|
+
submitter: options.submitter,
|
|
24578
|
+
appUrl: options.appUrl,
|
|
24579
|
+
projectId: options.projectId,
|
|
24580
|
+
directTo
|
|
24581
|
+
};
|
|
24582
|
+
const wallet = await import_web3_sdk2.Web3Wallet.enable(_options);
|
|
24583
|
+
const user = wallet.getUser();
|
|
24584
|
+
setWeb3UserData(user);
|
|
24585
|
+
setWallet(
|
|
24586
|
+
wallet.cardano,
|
|
24587
|
+
"utxos",
|
|
24588
|
+
persist ? {
|
|
24589
|
+
walletAddress: await wallet.getChangeAddress(),
|
|
24590
|
+
user
|
|
24591
|
+
} : void 0
|
|
24592
|
+
);
|
|
24593
|
+
setLoading(false);
|
|
24594
|
+
setOpen(false);
|
|
24595
|
+
}
|
|
24596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
24597
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
24598
|
+
WalletIcon,
|
|
24599
|
+
{
|
|
24600
|
+
iconReactNode: IconGoogle(),
|
|
24601
|
+
name: `Google`,
|
|
24602
|
+
action: () => loadWallet("google"),
|
|
24603
|
+
loading
|
|
24604
|
+
}
|
|
24605
|
+
),
|
|
24606
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
24607
|
+
WalletIcon,
|
|
24608
|
+
{
|
|
24609
|
+
iconReactNode: IconDiscord(),
|
|
24610
|
+
name: `Discord`,
|
|
24611
|
+
action: () => loadWallet("discord"),
|
|
24612
|
+
loading
|
|
24613
|
+
}
|
|
24614
|
+
),
|
|
24615
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
24616
|
+
WalletIcon,
|
|
24617
|
+
{
|
|
24618
|
+
iconReactNode: IconTwitter(),
|
|
24619
|
+
name: `Twitter`,
|
|
24620
|
+
action: () => loadWallet("twitter"),
|
|
24621
|
+
loading
|
|
24622
|
+
}
|
|
24623
|
+
)
|
|
24364
24624
|
] });
|
|
24365
24625
|
}
|
|
24366
24626
|
|
|
24367
24627
|
// src/cardano-wallet/screen-main.tsx
|
|
24368
|
-
var
|
|
24628
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
24369
24629
|
function ScreenMain({
|
|
24370
24630
|
injectFn,
|
|
24371
|
-
extensions,
|
|
24372
24631
|
setOpen,
|
|
24373
24632
|
setScreen,
|
|
24374
24633
|
persist,
|
|
24375
24634
|
cardanoPeerConnect,
|
|
24376
24635
|
burnerWallet,
|
|
24377
|
-
webauthn
|
|
24636
|
+
webauthn,
|
|
24637
|
+
showDownload,
|
|
24638
|
+
web3Services
|
|
24378
24639
|
}) {
|
|
24379
24640
|
const wallets = useWalletList({ injectFn });
|
|
24380
|
-
const { connect: connect2 } = useWallet();
|
|
24381
|
-
return /* @__PURE__ */ (0,
|
|
24382
|
-
wallets.map((wallet, index) => /* @__PURE__ */ (0,
|
|
24641
|
+
const { connect: connect2, setBitcoinWallet } = useWallet();
|
|
24642
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "mesh-grid mesh-gap-4 mesh-py-4 mesh-grid-cols-5 mesh-place-items-center mesh-gap-y-8", children: [
|
|
24643
|
+
wallets.map((wallet, index) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
24383
24644
|
WalletIcon,
|
|
24384
24645
|
{
|
|
24385
24646
|
icon: wallet.icon,
|
|
24386
24647
|
name: wallet.name,
|
|
24387
24648
|
action: () => {
|
|
24388
|
-
connect2(wallet.id,
|
|
24649
|
+
connect2(wallet.id, persist);
|
|
24389
24650
|
setOpen(false);
|
|
24390
24651
|
}
|
|
24391
24652
|
},
|
|
24392
24653
|
index
|
|
24393
24654
|
)),
|
|
24394
|
-
|
|
24655
|
+
web3Services && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
24656
|
+
Web3Services,
|
|
24657
|
+
{
|
|
24658
|
+
options: web3Services,
|
|
24659
|
+
setOpen,
|
|
24660
|
+
persist
|
|
24661
|
+
}
|
|
24662
|
+
),
|
|
24663
|
+
webauthn && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
24395
24664
|
WalletIcon,
|
|
24396
24665
|
{
|
|
24397
24666
|
iconReactNode: IconFingerprint(),
|
|
@@ -24401,7 +24670,7 @@ function ScreenMain({
|
|
|
24401
24670
|
}
|
|
24402
24671
|
}
|
|
24403
24672
|
),
|
|
24404
|
-
cardanoPeerConnect && /* @__PURE__ */ (0,
|
|
24673
|
+
cardanoPeerConnect && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
24405
24674
|
WalletIcon,
|
|
24406
24675
|
{
|
|
24407
24676
|
iconReactNode: IconMonitorSmartphone(),
|
|
@@ -24411,7 +24680,7 @@ function ScreenMain({
|
|
|
24411
24680
|
}
|
|
24412
24681
|
}
|
|
24413
24682
|
),
|
|
24414
|
-
burnerWallet && /* @__PURE__ */ (0,
|
|
24683
|
+
burnerWallet && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
24415
24684
|
WalletIcon,
|
|
24416
24685
|
{
|
|
24417
24686
|
iconReactNode: IconBookDashed(),
|
|
@@ -24421,7 +24690,7 @@ function ScreenMain({
|
|
|
24421
24690
|
}
|
|
24422
24691
|
}
|
|
24423
24692
|
),
|
|
24424
|
-
/* @__PURE__ */ (0,
|
|
24693
|
+
showDownload && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
24425
24694
|
WalletIcon,
|
|
24426
24695
|
{
|
|
24427
24696
|
iconReactNode: IconDownload(),
|
|
@@ -24433,24 +24702,38 @@ function ScreenMain({
|
|
|
24433
24702
|
);
|
|
24434
24703
|
}
|
|
24435
24704
|
}
|
|
24705
|
+
),
|
|
24706
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
24707
|
+
WalletIcon,
|
|
24708
|
+
{
|
|
24709
|
+
iconReactNode: IconBitcoin(),
|
|
24710
|
+
name: "Bitcoin",
|
|
24711
|
+
action: async () => {
|
|
24712
|
+
const wallet = await import_bitcoin.BrowserWallet.enable(
|
|
24713
|
+
"Mesh SDK want to connect"
|
|
24714
|
+
);
|
|
24715
|
+
setBitcoinWallet(wallet, "Bitcoin");
|
|
24716
|
+
setOpen(false);
|
|
24717
|
+
}
|
|
24718
|
+
}
|
|
24436
24719
|
)
|
|
24437
24720
|
] }) });
|
|
24438
24721
|
}
|
|
24439
24722
|
|
|
24440
24723
|
// src/cardano-wallet/screen-p2p.tsx
|
|
24441
|
-
var
|
|
24724
|
+
var import_react12 = require("react");
|
|
24442
24725
|
var import_cardano_peer_connect = __toESM(require_dist(), 1);
|
|
24443
|
-
var
|
|
24726
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
24444
24727
|
function ScreenP2P({
|
|
24445
24728
|
cardanoPeerConnect,
|
|
24446
24729
|
setOpen
|
|
24447
24730
|
}) {
|
|
24448
|
-
const dAppConnect = (0,
|
|
24449
|
-
const qrCodeField = (0,
|
|
24450
|
-
const [address, setAddress] = (0,
|
|
24451
|
-
const [copied, setCopied] = (0,
|
|
24731
|
+
const dAppConnect = (0, import_react12.useRef)(null);
|
|
24732
|
+
const qrCodeField = (0, import_react12.useRef)(null);
|
|
24733
|
+
const [address, setAddress] = (0, import_react12.useState)("");
|
|
24734
|
+
const [copied, setCopied] = (0, import_react12.useState)(false);
|
|
24452
24735
|
const { connect: connect2 } = useWallet();
|
|
24453
|
-
(0,
|
|
24736
|
+
(0, import_react12.useEffect)(() => {
|
|
24454
24737
|
if (cardanoPeerConnect) {
|
|
24455
24738
|
if (dAppConnect.current === null) {
|
|
24456
24739
|
dAppConnect.current = new import_cardano_peer_connect.DAppPeerConnect({
|
|
@@ -24484,9 +24767,9 @@ function ScreenP2P({
|
|
|
24484
24767
|
}
|
|
24485
24768
|
}
|
|
24486
24769
|
}, []);
|
|
24487
|
-
return /* @__PURE__ */ (0,
|
|
24488
|
-
/* @__PURE__ */ (0,
|
|
24489
|
-
/* @__PURE__ */ (0,
|
|
24770
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "mesh-flex mesh-flex-col mesh-items-center mesh-justify-center", children: [
|
|
24771
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { marginTop: 16, marginBottom: 16 }, ref: qrCodeField }),
|
|
24772
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
24490
24773
|
Button,
|
|
24491
24774
|
{
|
|
24492
24775
|
variant: "outline",
|
|
@@ -24501,15 +24784,15 @@ function ScreenP2P({
|
|
|
24501
24784
|
}
|
|
24502
24785
|
|
|
24503
24786
|
// src/cardano-wallet/screen-webauthn.tsx
|
|
24504
|
-
var
|
|
24787
|
+
var import_react13 = require("react");
|
|
24505
24788
|
var import_wallet4 = require("@meshsdk/wallet");
|
|
24506
24789
|
|
|
24507
24790
|
// src/common/input.tsx
|
|
24508
24791
|
var React5 = __toESM(require("react"), 1);
|
|
24509
|
-
var
|
|
24792
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
24510
24793
|
var Input = React5.forwardRef(
|
|
24511
24794
|
({ className, type, ...props }, ref) => {
|
|
24512
|
-
return /* @__PURE__ */ (0,
|
|
24795
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
24513
24796
|
"input",
|
|
24514
24797
|
{
|
|
24515
24798
|
type,
|
|
@@ -24529,11 +24812,11 @@ Input.displayName = "Input";
|
|
|
24529
24812
|
var React6 = __toESM(require("react"), 1);
|
|
24530
24813
|
var LabelPrimitive = __toESM(require("@radix-ui/react-label"), 1);
|
|
24531
24814
|
var import_class_variance_authority2 = require("class-variance-authority");
|
|
24532
|
-
var
|
|
24815
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
24533
24816
|
var labelVariants = (0, import_class_variance_authority2.cva)(
|
|
24534
24817
|
"mesh-text-sm mesh-font-medium mesh-leading-none peer-disabled:mesh-cursor-not-allowed peer-disabled:mesh-opacity-70"
|
|
24535
24818
|
);
|
|
24536
|
-
var Label2 = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
24819
|
+
var Label2 = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
24537
24820
|
LabelPrimitive.Root,
|
|
24538
24821
|
{
|
|
24539
24822
|
ref,
|
|
@@ -24544,16 +24827,16 @@ var Label2 = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
24544
24827
|
Label2.displayName = LabelPrimitive.Root.displayName;
|
|
24545
24828
|
|
|
24546
24829
|
// src/cardano-wallet/screen-webauthn.tsx
|
|
24547
|
-
var
|
|
24830
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
24548
24831
|
function ScreenWebauthn({
|
|
24549
24832
|
url,
|
|
24550
24833
|
networkId,
|
|
24551
24834
|
provider,
|
|
24552
24835
|
setOpen
|
|
24553
24836
|
}) {
|
|
24554
|
-
const [loading, setLoading] = (0,
|
|
24555
|
-
const [userName, setUserName] = (0,
|
|
24556
|
-
const [password, setPassword] = (0,
|
|
24837
|
+
const [loading, setLoading] = (0, import_react13.useState)(false);
|
|
24838
|
+
const [userName, setUserName] = (0, import_react13.useState)("");
|
|
24839
|
+
const [password, setPassword] = (0, import_react13.useState)("");
|
|
24557
24840
|
const { setWallet } = useWallet();
|
|
24558
24841
|
function createWallet(root) {
|
|
24559
24842
|
setTimeout(() => {
|
|
@@ -24578,10 +24861,10 @@ function ScreenWebauthn({
|
|
|
24578
24861
|
createWallet(res.wallet.bech32PrivateKey);
|
|
24579
24862
|
}
|
|
24580
24863
|
}
|
|
24581
|
-
return /* @__PURE__ */ (0,
|
|
24582
|
-
/* @__PURE__ */ (0,
|
|
24583
|
-
/* @__PURE__ */ (0,
|
|
24584
|
-
/* @__PURE__ */ (0,
|
|
24864
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "mesh-flex mesh-flex-row mesh-flex-gap-4 mesh-items-center mesh-justify-center", children: loading ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_jsx_runtime23.Fragment, { children: "Connecting wallet..." }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_jsx_runtime23.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "mesh-flex mesh-flex-col mesh-gap-6 mesh-w-full mesh-mx-8", children: [
|
|
24865
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "mesh-grid mesh-gap-2", children: [
|
|
24866
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Label2, { htmlFor: "username", children: "Username" }),
|
|
24867
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
24585
24868
|
Input,
|
|
24586
24869
|
{
|
|
24587
24870
|
id: "username",
|
|
@@ -24591,11 +24874,11 @@ function ScreenWebauthn({
|
|
|
24591
24874
|
onChange: (e2) => setUserName(e2.target.value)
|
|
24592
24875
|
}
|
|
24593
24876
|
),
|
|
24594
|
-
/* @__PURE__ */ (0,
|
|
24877
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "mesh-text-gray-500 mesh-text-xs", children: "Unique to the application you are connecting." })
|
|
24595
24878
|
] }),
|
|
24596
|
-
/* @__PURE__ */ (0,
|
|
24597
|
-
/* @__PURE__ */ (0,
|
|
24598
|
-
/* @__PURE__ */ (0,
|
|
24879
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "mesh-grid mesh-gap-2", children: [
|
|
24880
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "mesh-flex mesh-items-center", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Label2, { htmlFor: "password", children: "Unique Code" }) }),
|
|
24881
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
24599
24882
|
Input,
|
|
24600
24883
|
{
|
|
24601
24884
|
id: "password",
|
|
@@ -24605,9 +24888,9 @@ function ScreenWebauthn({
|
|
|
24605
24888
|
onChange: (e2) => setPassword(e2.target.value)
|
|
24606
24889
|
}
|
|
24607
24890
|
),
|
|
24608
|
-
/* @__PURE__ */ (0,
|
|
24891
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "mesh-text-gray-500 mesh-text-xs", children: "Additional security to derive your wallet." })
|
|
24609
24892
|
] }),
|
|
24610
|
-
/* @__PURE__ */ (0,
|
|
24893
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
24611
24894
|
Button,
|
|
24612
24895
|
{
|
|
24613
24896
|
className: "mesh-w-full",
|
|
@@ -24620,59 +24903,62 @@ function ScreenWebauthn({
|
|
|
24620
24903
|
}
|
|
24621
24904
|
|
|
24622
24905
|
// src/cardano-wallet/index.tsx
|
|
24623
|
-
var
|
|
24906
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
24624
24907
|
var CardanoWallet = ({
|
|
24625
24908
|
label = "Connect Wallet",
|
|
24626
24909
|
onConnected = void 0,
|
|
24627
24910
|
isDark = false,
|
|
24628
24911
|
persist = false,
|
|
24629
|
-
extensions = [],
|
|
24630
24912
|
injectFn = void 0,
|
|
24631
24913
|
cardanoPeerConnect = void 0,
|
|
24632
24914
|
burnerWallet = void 0,
|
|
24633
|
-
webauthn = void 0
|
|
24915
|
+
webauthn = void 0,
|
|
24916
|
+
showDownload = true,
|
|
24917
|
+
web3Services = void 0
|
|
24634
24918
|
}) => {
|
|
24635
|
-
const [open, setOpen] = (0,
|
|
24636
|
-
const [screen, setScreen] = (0,
|
|
24637
|
-
const { wallet, connected, setPersist } = useWallet();
|
|
24638
|
-
(0,
|
|
24919
|
+
const [open, setOpen] = (0, import_react14.useState)(false);
|
|
24920
|
+
const [screen, setScreen] = (0, import_react14.useState)("main");
|
|
24921
|
+
const { wallet, connected, setPersist, setWeb3Services } = useWallet();
|
|
24922
|
+
(0, import_react14.useEffect)(() => {
|
|
24639
24923
|
setPersist(persist);
|
|
24640
|
-
|
|
24641
|
-
|
|
24924
|
+
if (web3Services) setWeb3Services(web3Services);
|
|
24925
|
+
}, []);
|
|
24926
|
+
(0, import_react14.useEffect)(() => {
|
|
24642
24927
|
if (connected) {
|
|
24643
24928
|
if (onConnected) onConnected();
|
|
24644
24929
|
}
|
|
24645
24930
|
}, [connected, wallet]);
|
|
24646
|
-
return /* @__PURE__ */ (0,
|
|
24647
|
-
/* @__PURE__ */ (0,
|
|
24648
|
-
/* @__PURE__ */ (0,
|
|
24931
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Dialog, { open, onOpenChange: setOpen, children: [
|
|
24932
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: isDark ? "mesh-dark" : "", children: !connected ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DialogTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Button, { variant: "outline", className: isDark ? "mesh-dark" : "", children: label }) }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ConnectedButton, {}) }),
|
|
24933
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
24649
24934
|
DialogContent,
|
|
24650
24935
|
{
|
|
24651
24936
|
className: "sm:mesh-max-w-[425px] mesh-dark",
|
|
24652
24937
|
onOpenAutoFocus: (event) => event.preventDefault(),
|
|
24653
24938
|
children: [
|
|
24654
|
-
/* @__PURE__ */ (0,
|
|
24655
|
-
screen == "main" && /* @__PURE__ */ (0,
|
|
24939
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Header, { screen, setScreen }),
|
|
24940
|
+
screen == "main" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
24656
24941
|
ScreenMain,
|
|
24657
24942
|
{
|
|
24658
24943
|
injectFn,
|
|
24659
|
-
extensions,
|
|
24660
24944
|
setOpen,
|
|
24661
24945
|
setScreen,
|
|
24662
24946
|
persist,
|
|
24663
24947
|
cardanoPeerConnect: cardanoPeerConnect != void 0,
|
|
24664
24948
|
burnerWallet: burnerWallet != void 0,
|
|
24665
|
-
webauthn: webauthn != void 0
|
|
24949
|
+
webauthn: webauthn != void 0,
|
|
24950
|
+
showDownload,
|
|
24951
|
+
web3Services
|
|
24666
24952
|
}
|
|
24667
24953
|
),
|
|
24668
|
-
screen == "p2p" && /* @__PURE__ */ (0,
|
|
24954
|
+
screen == "p2p" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
24669
24955
|
ScreenP2P,
|
|
24670
24956
|
{
|
|
24671
24957
|
cardanoPeerConnect,
|
|
24672
24958
|
setOpen
|
|
24673
24959
|
}
|
|
24674
24960
|
),
|
|
24675
|
-
screen == "burner" && burnerWallet && /* @__PURE__ */ (0,
|
|
24961
|
+
screen == "burner" && burnerWallet && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
24676
24962
|
ScreenBurner,
|
|
24677
24963
|
{
|
|
24678
24964
|
networkId: burnerWallet.networkId,
|
|
@@ -24680,7 +24966,7 @@ var CardanoWallet = ({
|
|
|
24680
24966
|
setOpen
|
|
24681
24967
|
}
|
|
24682
24968
|
),
|
|
24683
|
-
screen == "webauthn" && webauthn && /* @__PURE__ */ (0,
|
|
24969
|
+
screen == "webauthn" && webauthn && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
24684
24970
|
ScreenWebauthn,
|
|
24685
24971
|
{
|
|
24686
24972
|
url: webauthn.url,
|
|
@@ -24689,7 +24975,7 @@ var CardanoWallet = ({
|
|
|
24689
24975
|
setOpen
|
|
24690
24976
|
}
|
|
24691
24977
|
),
|
|
24692
|
-
/* @__PURE__ */ (0,
|
|
24978
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Footer, {})
|
|
24693
24979
|
]
|
|
24694
24980
|
}
|
|
24695
24981
|
)
|
|
@@ -24699,25 +24985,25 @@ function Header({
|
|
|
24699
24985
|
screen,
|
|
24700
24986
|
setScreen
|
|
24701
24987
|
}) {
|
|
24702
|
-
return /* @__PURE__ */ (0,
|
|
24703
|
-
/* @__PURE__ */ (0,
|
|
24704
|
-
screen != "main" ? /* @__PURE__ */ (0,
|
|
24705
|
-
/* @__PURE__ */ (0,
|
|
24706
|
-
/* @__PURE__ */ (0,
|
|
24988
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(DialogHeader, { children: [
|
|
24989
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(DialogTitle, { className: "mesh-flex mesh-justify-between", children: [
|
|
24990
|
+
screen != "main" ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { onClick: () => setScreen("main"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(IconChevronRight, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { style: { width: "24px" } }),
|
|
24991
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: screens[screen].title }),
|
|
24992
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { style: { width: "24px" } })
|
|
24707
24993
|
] }),
|
|
24708
|
-
/* @__PURE__ */ (0,
|
|
24994
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DialogDescription, { children: screens[screen].subtitle && screens[screen].subtitle })
|
|
24709
24995
|
] });
|
|
24710
24996
|
}
|
|
24711
24997
|
function Footer() {
|
|
24712
|
-
return /* @__PURE__ */ (0,
|
|
24998
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DialogFooter, { className: "mesh-justify-center mesh-text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
24713
24999
|
"a",
|
|
24714
25000
|
{
|
|
24715
25001
|
href: "https://meshjs.dev/",
|
|
24716
25002
|
target: "_blank",
|
|
24717
25003
|
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",
|
|
24718
25004
|
children: [
|
|
24719
|
-
/* @__PURE__ */ (0,
|
|
24720
|
-
/* @__PURE__ */ (0,
|
|
25005
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "", children: "Powered by" }),
|
|
25006
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
24721
25007
|
"svg",
|
|
24722
25008
|
{
|
|
24723
25009
|
width: 24,
|
|
@@ -24725,31 +25011,31 @@ function Footer() {
|
|
|
24725
25011
|
enableBackground: "new 0 0 300 200",
|
|
24726
25012
|
viewBox: "0 0 300 200",
|
|
24727
25013
|
xmlns: "http://www.w3.org/2000/svg",
|
|
24728
|
-
children: /* @__PURE__ */ (0,
|
|
25014
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.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" })
|
|
24729
25015
|
}
|
|
24730
25016
|
),
|
|
24731
|
-
/* @__PURE__ */ (0,
|
|
25017
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "", children: "Mesh SDK" })
|
|
24732
25018
|
]
|
|
24733
25019
|
}
|
|
24734
25020
|
) });
|
|
24735
25021
|
}
|
|
24736
25022
|
|
|
24737
25023
|
// src/mesh-badge/mesh-logo.tsx
|
|
24738
|
-
var
|
|
24739
|
-
var MeshLogo = () => /* @__PURE__ */ (0,
|
|
25024
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
25025
|
+
var MeshLogo = () => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
24740
25026
|
"svg",
|
|
24741
25027
|
{
|
|
24742
25028
|
className: "mesh-h-16 mesh-p-2",
|
|
24743
25029
|
fill: "currentColor",
|
|
24744
25030
|
viewBox: "0 0 300 200",
|
|
24745
25031
|
xmlns: "http://www.w3.org/2000/svg",
|
|
24746
|
-
children: /* @__PURE__ */ (0,
|
|
25032
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.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" })
|
|
24747
25033
|
}
|
|
24748
25034
|
);
|
|
24749
25035
|
|
|
24750
25036
|
// src/mesh-badge/index.tsx
|
|
24751
|
-
var
|
|
24752
|
-
var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ (0,
|
|
25037
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
25038
|
+
var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
24753
25039
|
"a",
|
|
24754
25040
|
{
|
|
24755
25041
|
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`}`,
|
|
@@ -24761,296 +25047,16 @@ var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ (0, import_jsx_runtime21
|
|
|
24761
25047
|
rel: "noopener noreferrer",
|
|
24762
25048
|
target: "_blank",
|
|
24763
25049
|
children: [
|
|
24764
|
-
/* @__PURE__ */ (0,
|
|
25050
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MeshLogo, {}),
|
|
24765
25051
|
"Mesh"
|
|
24766
25052
|
]
|
|
24767
25053
|
}
|
|
24768
25054
|
);
|
|
24769
|
-
|
|
24770
|
-
// src/stake-button/index.tsx
|
|
24771
|
-
var import_react15 = require("react");
|
|
24772
|
-
var import_transaction = require("@meshsdk/transaction");
|
|
24773
|
-
|
|
24774
|
-
// src/cardano-wallet-dropdown/index.tsx
|
|
24775
|
-
var import_react14 = require("react");
|
|
24776
|
-
|
|
24777
|
-
// src/common/button-dropdown.tsx
|
|
24778
|
-
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
24779
|
-
function ButtonDropdown({
|
|
24780
|
-
children,
|
|
24781
|
-
isDarkMode = false,
|
|
24782
|
-
hideMenuList = false,
|
|
24783
|
-
setHideMenuList,
|
|
24784
|
-
onMouseEnter,
|
|
24785
|
-
onMouseLeave
|
|
24786
|
-
}) {
|
|
24787
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
24788
|
-
"button",
|
|
24789
|
-
{
|
|
24790
|
-
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`}`,
|
|
24791
|
-
onClick: () => setHideMenuList && setHideMenuList(!hideMenuList),
|
|
24792
|
-
onMouseEnter,
|
|
24793
|
-
onMouseLeave,
|
|
24794
|
-
children
|
|
24795
|
-
}
|
|
24796
|
-
);
|
|
24797
|
-
}
|
|
24798
|
-
|
|
24799
|
-
// src/cardano-wallet-dropdown/menu-item.tsx
|
|
24800
|
-
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
24801
|
-
function MenuItem({
|
|
24802
|
-
icon,
|
|
24803
|
-
label,
|
|
24804
|
-
action,
|
|
24805
|
-
active
|
|
24806
|
-
}) {
|
|
24807
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
24808
|
-
"div",
|
|
24809
|
-
{
|
|
24810
|
-
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",
|
|
24811
|
-
onClick: action,
|
|
24812
|
-
children: [
|
|
24813
|
-
icon && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("img", { className: "mesh-pr-2 mesh-m-1 mesh-h-8", src: icon }),
|
|
24814
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "mesh-mr-menu-item mesh-text-xl mesh-font-normal mesh-text-neutral-700 hover:mesh-text-black", children: label.split(" ").map((word) => {
|
|
24815
|
-
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
24816
|
-
}).join(" ") })
|
|
24817
|
-
]
|
|
24818
|
-
}
|
|
24819
|
-
);
|
|
24820
|
-
}
|
|
24821
|
-
|
|
24822
|
-
// src/cardano-wallet-dropdown/chevron-down.tsx
|
|
24823
|
-
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
24824
|
-
var ChevronDown = () => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
24825
|
-
"svg",
|
|
24826
|
-
{
|
|
24827
|
-
className: "mesh-m-2 mesh-h-6",
|
|
24828
|
-
fill: "none",
|
|
24829
|
-
"aria-hidden": "true",
|
|
24830
|
-
viewBox: "0 0 24 24",
|
|
24831
|
-
stroke: "currentColor",
|
|
24832
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
24833
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
24834
|
-
"path",
|
|
24835
|
-
{
|
|
24836
|
-
strokeLinecap: "round",
|
|
24837
|
-
strokeLinejoin: "round",
|
|
24838
|
-
strokeWidth: "2",
|
|
24839
|
-
d: "M19 9l-7 7-7-7"
|
|
24840
|
-
}
|
|
24841
|
-
)
|
|
24842
|
-
}
|
|
24843
|
-
);
|
|
24844
|
-
|
|
24845
|
-
// src/cardano-wallet-dropdown/wallet-balance.tsx
|
|
24846
|
-
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
24847
|
-
var WalletBalance = ({
|
|
24848
|
-
connected,
|
|
24849
|
-
connecting,
|
|
24850
|
-
label,
|
|
24851
|
-
wallet
|
|
24852
|
-
}) => {
|
|
24853
|
-
const lovelace = useLovelace();
|
|
24854
|
-
return connected && lovelace && wallet?.icon ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
24855
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("img", { className: "mesh-m-2 mesh-h-6", src: wallet.icon }),
|
|
24856
|
-
"\u20B3",
|
|
24857
|
-
" ",
|
|
24858
|
-
parseInt((parseInt(lovelace, 10) / 1e6).toString(), 10),
|
|
24859
|
-
".",
|
|
24860
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "mesh-text-xs", children: lovelace.substring(lovelace.length - 6) })
|
|
24861
|
-
] }) : connected && wallet?.icon ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("img", { className: "mesh-m-2 mesh-h-6", src: wallet.icon }) }) : connecting ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: "Connecting..." }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
24862
|
-
label,
|
|
24863
|
-
" ",
|
|
24864
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ChevronDown, {})
|
|
24865
|
-
] });
|
|
24866
|
-
};
|
|
24867
|
-
|
|
24868
|
-
// src/cardano-wallet-dropdown/index.tsx
|
|
24869
|
-
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
24870
|
-
var CardanoWallet2 = ({
|
|
24871
|
-
label = "Connect Wallet",
|
|
24872
|
-
onConnected = void 0,
|
|
24873
|
-
isDark = false,
|
|
24874
|
-
extensions = [],
|
|
24875
|
-
cardanoPeerConnect = void 0
|
|
24876
|
-
}) => {
|
|
24877
|
-
const [isDarkMode, setIsDarkMode] = (0, import_react14.useState)(false);
|
|
24878
|
-
const [hideMenuList, setHideMenuList] = (0, import_react14.useState)(true);
|
|
24879
|
-
const { connect: connect2, connecting, connected, disconnect, name } = useWallet();
|
|
24880
|
-
const wallets = useWalletList();
|
|
24881
|
-
(0, import_react14.useEffect)(() => {
|
|
24882
|
-
if (connected && onConnected) {
|
|
24883
|
-
onConnected();
|
|
24884
|
-
}
|
|
24885
|
-
}, [connected]);
|
|
24886
|
-
(0, import_react14.useEffect)(() => {
|
|
24887
|
-
setIsDarkMode(isDark);
|
|
24888
|
-
}, [isDark]);
|
|
24889
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
24890
|
-
"div",
|
|
24891
|
-
{
|
|
24892
|
-
onMouseEnter: () => setHideMenuList(false),
|
|
24893
|
-
onMouseLeave: () => setHideMenuList(true),
|
|
24894
|
-
style: { width: "min-content", zIndex: 50 },
|
|
24895
|
-
children: [
|
|
24896
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
24897
|
-
ButtonDropdown,
|
|
24898
|
-
{
|
|
24899
|
-
isDarkMode,
|
|
24900
|
-
hideMenuList,
|
|
24901
|
-
setHideMenuList,
|
|
24902
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
24903
|
-
WalletBalance,
|
|
24904
|
-
{
|
|
24905
|
-
connected,
|
|
24906
|
-
connecting,
|
|
24907
|
-
label,
|
|
24908
|
-
wallet: wallets.find((wallet) => wallet.id === name)
|
|
24909
|
-
}
|
|
24910
|
-
)
|
|
24911
|
-
}
|
|
24912
|
-
),
|
|
24913
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
24914
|
-
"div",
|
|
24915
|
-
{
|
|
24916
|
-
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`}`,
|
|
24917
|
-
style: { zIndex: 50 },
|
|
24918
|
-
children: !connected && wallets.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: wallets.map((wallet, index) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
24919
|
-
MenuItem,
|
|
24920
|
-
{
|
|
24921
|
-
icon: wallet.icon,
|
|
24922
|
-
label: wallet.name,
|
|
24923
|
-
action: () => {
|
|
24924
|
-
connect2(wallet.id, extensions);
|
|
24925
|
-
setHideMenuList(!hideMenuList);
|
|
24926
|
-
},
|
|
24927
|
-
active: name === wallet.id
|
|
24928
|
-
},
|
|
24929
|
-
index
|
|
24930
|
-
)) }) : wallets.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "No Wallet Found" }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
24931
|
-
MenuItem,
|
|
24932
|
-
{
|
|
24933
|
-
active: false,
|
|
24934
|
-
label: "disconnect",
|
|
24935
|
-
action: disconnect,
|
|
24936
|
-
icon: void 0
|
|
24937
|
-
}
|
|
24938
|
-
) })
|
|
24939
|
-
}
|
|
24940
|
-
)
|
|
24941
|
-
]
|
|
24942
|
-
}
|
|
24943
|
-
);
|
|
24944
|
-
};
|
|
24945
|
-
|
|
24946
|
-
// src/stake-button/index.tsx
|
|
24947
|
-
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
24948
|
-
var StakeButton = ({
|
|
24949
|
-
label = "Stake your ADA",
|
|
24950
|
-
isDark = false,
|
|
24951
|
-
poolId,
|
|
24952
|
-
onCheck,
|
|
24953
|
-
onDelegated = void 0
|
|
24954
|
-
}) => {
|
|
24955
|
-
const [isDarkMode, setIsDarkMode] = (0, import_react15.useState)(false);
|
|
24956
|
-
const { connected } = useWallet();
|
|
24957
|
-
(0, import_react15.useEffect)(() => {
|
|
24958
|
-
setIsDarkMode(isDark);
|
|
24959
|
-
}, [isDark]);
|
|
24960
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, { children: connected ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ButtonDropdown, { isDarkMode, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
24961
|
-
Delegate,
|
|
24962
|
-
{
|
|
24963
|
-
poolId,
|
|
24964
|
-
onCheck,
|
|
24965
|
-
onDelegated
|
|
24966
|
-
}
|
|
24967
|
-
) }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CardanoWallet2, { label, isDark }) });
|
|
24968
|
-
};
|
|
24969
|
-
var Delegate = ({
|
|
24970
|
-
poolId,
|
|
24971
|
-
onCheck,
|
|
24972
|
-
onDelegated
|
|
24973
|
-
}) => {
|
|
24974
|
-
const { wallet } = useWallet();
|
|
24975
|
-
const rewardAddress = useRewardAddress();
|
|
24976
|
-
const [_, setError] = (0, import_react15.useState)();
|
|
24977
|
-
const [checking, setChecking] = (0, import_react15.useState)(false);
|
|
24978
|
-
const [accountInfo, setAccountInfo] = (0, import_react15.useState)();
|
|
24979
|
-
const [processing, setProcessing] = (0, import_react15.useState)(false);
|
|
24980
|
-
const [done, setDone] = (0, import_react15.useState)(false);
|
|
24981
|
-
const checkAccountStatus = async () => {
|
|
24982
|
-
try {
|
|
24983
|
-
setChecking(true);
|
|
24984
|
-
if (rewardAddress) {
|
|
24985
|
-
const info = await onCheck(rewardAddress);
|
|
24986
|
-
setAccountInfo(info);
|
|
24987
|
-
}
|
|
24988
|
-
setChecking(false);
|
|
24989
|
-
} catch (error) {
|
|
24990
|
-
setError(error);
|
|
24991
|
-
}
|
|
24992
|
-
};
|
|
24993
|
-
const registerAddress = async () => {
|
|
24994
|
-
setProcessing(true);
|
|
24995
|
-
setDone(false);
|
|
24996
|
-
try {
|
|
24997
|
-
if (rewardAddress) {
|
|
24998
|
-
const tx = new import_transaction.Transaction({ initiator: wallet }).registerStake(rewardAddress).delegateStake(rewardAddress, poolId);
|
|
24999
|
-
const unsignedTx = await tx.build();
|
|
25000
|
-
const signedTx = await wallet.signTx(unsignedTx);
|
|
25001
|
-
await wallet.submitTx(signedTx);
|
|
25002
|
-
if (onDelegated) {
|
|
25003
|
-
onDelegated();
|
|
25004
|
-
}
|
|
25005
|
-
setDone(true);
|
|
25006
|
-
}
|
|
25007
|
-
} catch (error) {
|
|
25008
|
-
setError(error);
|
|
25009
|
-
}
|
|
25010
|
-
setProcessing(false);
|
|
25011
|
-
};
|
|
25012
|
-
const delegateStake = async () => {
|
|
25013
|
-
setProcessing(true);
|
|
25014
|
-
setDone(false);
|
|
25015
|
-
try {
|
|
25016
|
-
if (rewardAddress) {
|
|
25017
|
-
const tx = new import_transaction.Transaction({ initiator: wallet }).delegateStake(rewardAddress, poolId);
|
|
25018
|
-
const unsignedTx = await tx.build();
|
|
25019
|
-
const signedTx = await wallet.signTx(unsignedTx);
|
|
25020
|
-
await wallet.submitTx(signedTx);
|
|
25021
|
-
if (onDelegated) {
|
|
25022
|
-
onDelegated();
|
|
25023
|
-
}
|
|
25024
|
-
setDone(true);
|
|
25025
|
-
}
|
|
25026
|
-
} catch (error) {
|
|
25027
|
-
setError(error);
|
|
25028
|
-
}
|
|
25029
|
-
setProcessing(false);
|
|
25030
|
-
};
|
|
25031
|
-
(0, import_react15.useEffect)(() => {
|
|
25032
|
-
checkAccountStatus();
|
|
25033
|
-
}, [rewardAddress]);
|
|
25034
|
-
if (checking) {
|
|
25035
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Checking..." });
|
|
25036
|
-
}
|
|
25037
|
-
if (processing) {
|
|
25038
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Loading..." });
|
|
25039
|
-
}
|
|
25040
|
-
if (done) {
|
|
25041
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Stake Delegated" });
|
|
25042
|
-
}
|
|
25043
|
-
if (accountInfo?.active) {
|
|
25044
|
-
return accountInfo.poolId === poolId ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Stake Delegated" }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { onClick: delegateStake, children: "Begin Staking" });
|
|
25045
|
-
}
|
|
25046
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { onClick: registerAddress, children: "Begin Staking" });
|
|
25047
|
-
};
|
|
25048
25055
|
// Annotate the CommonJS export names for ESM import in node:
|
|
25049
25056
|
0 && (module.exports = {
|
|
25050
25057
|
CardanoWallet,
|
|
25051
25058
|
MeshBadge,
|
|
25052
25059
|
MeshProvider,
|
|
25053
|
-
StakeButton,
|
|
25054
25060
|
WalletContext,
|
|
25055
25061
|
useAddress,
|
|
25056
25062
|
useAssets,
|