@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.js
CHANGED
|
@@ -23432,7 +23432,7 @@ var require_dist = __commonJS({
|
|
|
23432
23432
|
});
|
|
23433
23433
|
|
|
23434
23434
|
// src/cardano-wallet/index.tsx
|
|
23435
|
-
import { useEffect as useEffect10, useState as
|
|
23435
|
+
import { useEffect as useEffect10, useState as useState13 } from "react";
|
|
23436
23436
|
|
|
23437
23437
|
// src/common/button.tsx
|
|
23438
23438
|
import * as React from "react";
|
|
@@ -23613,6 +23613,9 @@ import { useContext, useEffect as useEffect2, useState as useState2 } from "reac
|
|
|
23613
23613
|
// src/contexts/WalletContext.ts
|
|
23614
23614
|
import { createContext, useCallback, useEffect, useState } from "react";
|
|
23615
23615
|
import { BrowserWallet } from "@meshsdk/wallet";
|
|
23616
|
+
import {
|
|
23617
|
+
Web3Wallet
|
|
23618
|
+
} from "@meshsdk/web3-sdk";
|
|
23616
23619
|
var INITIAL_STATE = {
|
|
23617
23620
|
walletName: void 0,
|
|
23618
23621
|
walletInstance: {}
|
|
@@ -23626,11 +23629,17 @@ var useWalletStore = () => {
|
|
|
23626
23629
|
const [address, setAddress] = useState("");
|
|
23627
23630
|
const [connectedWalletInstance, setConnectedWalletInstance] = useState(INITIAL_STATE.walletInstance);
|
|
23628
23631
|
const [connectedWalletName, setConnectedWalletName] = useState(INITIAL_STATE.walletName);
|
|
23632
|
+
const [web3Services, setWeb3Services] = useState(void 0);
|
|
23633
|
+
const [web3UserData, setWeb3UserData] = useState(
|
|
23634
|
+
void 0
|
|
23635
|
+
);
|
|
23636
|
+
const [connectedBitcoinWallet, setConnectedBitcoinWallet] = useState({});
|
|
23629
23637
|
const connectWallet = useCallback(
|
|
23630
|
-
async (walletName,
|
|
23638
|
+
async (walletName, persist) => {
|
|
23631
23639
|
setConnectingWallet(true);
|
|
23632
23640
|
setState("CONNECTING" /* CONNECTING */);
|
|
23633
23641
|
try {
|
|
23642
|
+
const extensions = BrowserWallet.getSupportedExtensions(walletName);
|
|
23634
23643
|
const walletInstance = await BrowserWallet.enable(
|
|
23635
23644
|
walletName,
|
|
23636
23645
|
extensions
|
|
@@ -23662,10 +23671,24 @@ var useWalletStore = () => {
|
|
|
23662
23671
|
localStorage.removeItem(localstoragePersist);
|
|
23663
23672
|
}, []);
|
|
23664
23673
|
const setWallet = useCallback(
|
|
23665
|
-
async (walletInstance, walletName) => {
|
|
23674
|
+
async (walletInstance, walletName, persist) => {
|
|
23666
23675
|
setConnectedWalletInstance(walletInstance);
|
|
23667
23676
|
setConnectedWalletName(walletName);
|
|
23668
23677
|
setState("CONNECTED" /* CONNECTED */);
|
|
23678
|
+
if (persist) {
|
|
23679
|
+
localStorage.setItem(
|
|
23680
|
+
localstoragePersist,
|
|
23681
|
+
JSON.stringify({ walletName, ...persist })
|
|
23682
|
+
);
|
|
23683
|
+
}
|
|
23684
|
+
},
|
|
23685
|
+
[]
|
|
23686
|
+
);
|
|
23687
|
+
const setBitcoinWallet = useCallback(
|
|
23688
|
+
async (walletInstance, walletName) => {
|
|
23689
|
+
setConnectedBitcoinWallet(walletInstance);
|
|
23690
|
+
setConnectedWalletName(walletName);
|
|
23691
|
+
setState("CONNECTED" /* CONNECTED */);
|
|
23669
23692
|
},
|
|
23670
23693
|
[]
|
|
23671
23694
|
);
|
|
@@ -23680,27 +23703,52 @@ var useWalletStore = () => {
|
|
|
23680
23703
|
address2 = await connectedWalletInstance.getChangeAddress();
|
|
23681
23704
|
setAddress(address2);
|
|
23682
23705
|
}
|
|
23706
|
+
if (Object.keys(connectedBitcoinWallet).length > 0 && address.length === 0) {
|
|
23707
|
+
let address2 = await connectedBitcoinWallet.getChangeAddress();
|
|
23708
|
+
setAddress(address2);
|
|
23709
|
+
}
|
|
23683
23710
|
}
|
|
23684
23711
|
load();
|
|
23685
|
-
}, [connectedWalletInstance]);
|
|
23712
|
+
}, [connectedWalletInstance, connectedBitcoinWallet]);
|
|
23686
23713
|
useEffect(() => {
|
|
23687
23714
|
const persist = localStorage.getItem(localstoragePersist);
|
|
23688
23715
|
if (persistSession && persist) {
|
|
23689
23716
|
const persist2 = JSON.parse(
|
|
23690
23717
|
localStorage.getItem(localstoragePersist) || ""
|
|
23691
23718
|
);
|
|
23692
|
-
|
|
23719
|
+
if (persist2.walletName == "utxos" && web3Services) {
|
|
23720
|
+
Web3Wallet.initWallet({
|
|
23721
|
+
networkId: web3Services.networkId,
|
|
23722
|
+
address: persist2.walletAddress,
|
|
23723
|
+
fetcher: web3Services.fetcher,
|
|
23724
|
+
submitter: web3Services.submitter,
|
|
23725
|
+
projectId: web3Services.projectId,
|
|
23726
|
+
appUrl: web3Services.appUrl
|
|
23727
|
+
}).then((wallet) => {
|
|
23728
|
+
setConnectedWalletInstance(wallet.cardano);
|
|
23729
|
+
setConnectedWalletName(persist2.walletName);
|
|
23730
|
+
setState("CONNECTED" /* CONNECTED */);
|
|
23731
|
+
});
|
|
23732
|
+
setWeb3UserData(persist2.user);
|
|
23733
|
+
} else {
|
|
23734
|
+
connectWallet(persist2.walletName);
|
|
23735
|
+
}
|
|
23693
23736
|
}
|
|
23694
23737
|
}, [persistSession]);
|
|
23695
23738
|
return {
|
|
23696
23739
|
hasConnectedWallet: INITIAL_STATE.walletName !== connectedWalletName,
|
|
23697
23740
|
connectedWalletInstance,
|
|
23741
|
+
connectedBitcoinWallet,
|
|
23698
23742
|
connectedWalletName,
|
|
23699
23743
|
connectingWallet,
|
|
23700
23744
|
connectWallet,
|
|
23701
23745
|
disconnect,
|
|
23702
23746
|
setWallet,
|
|
23747
|
+
setBitcoinWallet,
|
|
23703
23748
|
setPersist,
|
|
23749
|
+
setWeb3Services,
|
|
23750
|
+
web3UserData,
|
|
23751
|
+
setWeb3UserData,
|
|
23704
23752
|
error,
|
|
23705
23753
|
address,
|
|
23706
23754
|
state
|
|
@@ -23709,6 +23757,7 @@ var useWalletStore = () => {
|
|
|
23709
23757
|
var WalletContext = createContext({
|
|
23710
23758
|
hasConnectedWallet: false,
|
|
23711
23759
|
connectedWalletInstance: INITIAL_STATE.walletInstance,
|
|
23760
|
+
connectedBitcoinWallet: {},
|
|
23712
23761
|
connectedWalletName: INITIAL_STATE.walletName,
|
|
23713
23762
|
connectingWallet: false,
|
|
23714
23763
|
connectWallet: async () => {
|
|
@@ -23717,8 +23766,15 @@ var WalletContext = createContext({
|
|
|
23717
23766
|
},
|
|
23718
23767
|
setWallet: async () => {
|
|
23719
23768
|
},
|
|
23769
|
+
setBitcoinWallet: async () => {
|
|
23770
|
+
},
|
|
23720
23771
|
setPersist: () => {
|
|
23721
23772
|
},
|
|
23773
|
+
setWeb3Services: () => {
|
|
23774
|
+
},
|
|
23775
|
+
web3UserData: void 0,
|
|
23776
|
+
setWeb3UserData: () => {
|
|
23777
|
+
},
|
|
23722
23778
|
address: "",
|
|
23723
23779
|
state: "NOT_CONNECTED" /* NOT_CONNECTED */
|
|
23724
23780
|
});
|
|
@@ -23839,7 +23895,11 @@ var useWallet = () => {
|
|
|
23839
23895
|
connectWallet,
|
|
23840
23896
|
disconnect,
|
|
23841
23897
|
setWallet,
|
|
23898
|
+
setBitcoinWallet,
|
|
23842
23899
|
setPersist,
|
|
23900
|
+
setWeb3Services,
|
|
23901
|
+
web3UserData,
|
|
23902
|
+
setWeb3UserData,
|
|
23843
23903
|
error,
|
|
23844
23904
|
address,
|
|
23845
23905
|
state
|
|
@@ -23857,7 +23917,11 @@ var useWallet = () => {
|
|
|
23857
23917
|
connect: connectWallet,
|
|
23858
23918
|
disconnect,
|
|
23859
23919
|
setWallet,
|
|
23920
|
+
setBitcoinWallet,
|
|
23860
23921
|
setPersist,
|
|
23922
|
+
setWeb3Services,
|
|
23923
|
+
web3UserData,
|
|
23924
|
+
setWeb3UserData,
|
|
23861
23925
|
error,
|
|
23862
23926
|
address,
|
|
23863
23927
|
state
|
|
@@ -24034,7 +24098,7 @@ DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
|
24034
24098
|
// src/cardano-wallet/connected-button.tsx
|
|
24035
24099
|
import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
24036
24100
|
function ConnectedButton() {
|
|
24037
|
-
const {
|
|
24101
|
+
const { name, disconnect, address } = useWallet();
|
|
24038
24102
|
return /* @__PURE__ */ jsxs3(DropdownMenu, { children: [
|
|
24039
24103
|
/* @__PURE__ */ jsx6(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs3(Button, { variant: "outline", children: [
|
|
24040
24104
|
address.slice(0, 6),
|
|
@@ -24042,6 +24106,7 @@ function ConnectedButton() {
|
|
|
24042
24106
|
address.slice(-6)
|
|
24043
24107
|
] }) }),
|
|
24044
24108
|
/* @__PURE__ */ jsxs3(DropdownMenuContent, { children: [
|
|
24109
|
+
/* @__PURE__ */ jsx6(DropdownMenuLabel, { children: "Wallet" }),
|
|
24045
24110
|
/* @__PURE__ */ jsx6(
|
|
24046
24111
|
DropdownMenuItem,
|
|
24047
24112
|
{
|
|
@@ -24051,6 +24116,16 @@ function ConnectedButton() {
|
|
|
24051
24116
|
children: "Copy Address"
|
|
24052
24117
|
}
|
|
24053
24118
|
),
|
|
24119
|
+
name == "utxos" && /* @__PURE__ */ jsx6(
|
|
24120
|
+
DropdownMenuItem,
|
|
24121
|
+
{
|
|
24122
|
+
onClick: () => {
|
|
24123
|
+
window.open("https://utxos.dev/wallet", "_blank");
|
|
24124
|
+
},
|
|
24125
|
+
children: "Open Web3 Wallet"
|
|
24126
|
+
}
|
|
24127
|
+
),
|
|
24128
|
+
/* @__PURE__ */ jsx6(DropdownMenuSeparator, {}),
|
|
24054
24129
|
/* @__PURE__ */ jsx6(
|
|
24055
24130
|
DropdownMenuItem,
|
|
24056
24131
|
{
|
|
@@ -24160,8 +24235,38 @@ function ScreenBurner({
|
|
|
24160
24235
|
] }) });
|
|
24161
24236
|
}
|
|
24162
24237
|
|
|
24238
|
+
// src/cardano-wallet/screen-main.tsx
|
|
24239
|
+
import { BrowserWallet as BrowserWallet3 } from "@meshsdk/bitcoin";
|
|
24240
|
+
|
|
24241
|
+
// src/common/icons/icon-bitcoin.tsx
|
|
24242
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
24243
|
+
function IconBitcoin() {
|
|
24244
|
+
return /* @__PURE__ */ jsx8(
|
|
24245
|
+
"svg",
|
|
24246
|
+
{
|
|
24247
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
24248
|
+
width: "24",
|
|
24249
|
+
height: "24",
|
|
24250
|
+
viewBox: "0 0 24 24",
|
|
24251
|
+
fill: "none",
|
|
24252
|
+
stroke: "currentColor",
|
|
24253
|
+
strokeWidth: "2",
|
|
24254
|
+
strokeLinecap: "round",
|
|
24255
|
+
strokeLinejoin: "round",
|
|
24256
|
+
style: {
|
|
24257
|
+
color: "#CC9900",
|
|
24258
|
+
width: "24px",
|
|
24259
|
+
height: "24px",
|
|
24260
|
+
strokeWidth: "1px"
|
|
24261
|
+
},
|
|
24262
|
+
className: "hover:mesh-fill-white",
|
|
24263
|
+
children: /* @__PURE__ */ jsx8("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" })
|
|
24264
|
+
}
|
|
24265
|
+
);
|
|
24266
|
+
}
|
|
24267
|
+
|
|
24163
24268
|
// src/common/icons/icon-book-dashed.tsx
|
|
24164
|
-
import { jsx as
|
|
24269
|
+
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
24165
24270
|
function IconBookDashed() {
|
|
24166
24271
|
return /* @__PURE__ */ jsxs5(
|
|
24167
24272
|
"svg",
|
|
@@ -24183,24 +24288,24 @@ function IconBookDashed() {
|
|
|
24183
24288
|
},
|
|
24184
24289
|
className: "hover:mesh-fill-white",
|
|
24185
24290
|
children: [
|
|
24186
|
-
/* @__PURE__ */
|
|
24187
|
-
/* @__PURE__ */
|
|
24188
|
-
/* @__PURE__ */
|
|
24189
|
-
/* @__PURE__ */
|
|
24190
|
-
/* @__PURE__ */
|
|
24191
|
-
/* @__PURE__ */
|
|
24192
|
-
/* @__PURE__ */
|
|
24193
|
-
/* @__PURE__ */
|
|
24194
|
-
/* @__PURE__ */
|
|
24195
|
-
/* @__PURE__ */
|
|
24196
|
-
/* @__PURE__ */
|
|
24291
|
+
/* @__PURE__ */ jsx9("path", { d: "M12 17h2" }),
|
|
24292
|
+
/* @__PURE__ */ jsx9("path", { d: "M12 22h2" }),
|
|
24293
|
+
/* @__PURE__ */ jsx9("path", { d: "M12 2h2" }),
|
|
24294
|
+
/* @__PURE__ */ jsx9("path", { d: "M18 22h1a1 1 0 0 0 1-1" }),
|
|
24295
|
+
/* @__PURE__ */ jsx9("path", { d: "M18 2h1a1 1 0 0 1 1 1v1" }),
|
|
24296
|
+
/* @__PURE__ */ jsx9("path", { d: "M20 15v2h-2" }),
|
|
24297
|
+
/* @__PURE__ */ jsx9("path", { d: "M20 8v3" }),
|
|
24298
|
+
/* @__PURE__ */ jsx9("path", { d: "M4 11V9" }),
|
|
24299
|
+
/* @__PURE__ */ jsx9("path", { d: "M4 19.5V15" }),
|
|
24300
|
+
/* @__PURE__ */ jsx9("path", { d: "M4 5v-.5A2.5 2.5 0 0 1 6.5 2H8" }),
|
|
24301
|
+
/* @__PURE__ */ jsx9("path", { d: "M8 22H6.5a1 1 0 0 1 0-5H8" })
|
|
24197
24302
|
]
|
|
24198
24303
|
}
|
|
24199
24304
|
);
|
|
24200
24305
|
}
|
|
24201
24306
|
|
|
24202
24307
|
// src/common/icons/icon-download.tsx
|
|
24203
|
-
import { jsx as
|
|
24308
|
+
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
24204
24309
|
function IconDownload() {
|
|
24205
24310
|
return /* @__PURE__ */ jsxs6(
|
|
24206
24311
|
"svg",
|
|
@@ -24220,18 +24325,17 @@ function IconDownload() {
|
|
|
24220
24325
|
height: "24px",
|
|
24221
24326
|
strokeWidth: "1px"
|
|
24222
24327
|
},
|
|
24223
|
-
className: "hover:mesh-fill-white",
|
|
24224
24328
|
children: [
|
|
24225
|
-
/* @__PURE__ */
|
|
24226
|
-
/* @__PURE__ */
|
|
24227
|
-
/* @__PURE__ */
|
|
24329
|
+
/* @__PURE__ */ jsx10("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
24330
|
+
/* @__PURE__ */ jsx10("polyline", { points: "7 10 12 15 17 10" }),
|
|
24331
|
+
/* @__PURE__ */ jsx10("line", { x1: "12", x2: "12", y1: "15", y2: "3" })
|
|
24228
24332
|
]
|
|
24229
24333
|
}
|
|
24230
24334
|
);
|
|
24231
24335
|
}
|
|
24232
24336
|
|
|
24233
24337
|
// src/common/icons/icon-fingerprint.tsx
|
|
24234
|
-
import { jsx as
|
|
24338
|
+
import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
24235
24339
|
function IconFingerprint() {
|
|
24236
24340
|
return /* @__PURE__ */ jsxs7(
|
|
24237
24341
|
"svg",
|
|
@@ -24253,22 +24357,22 @@ function IconFingerprint() {
|
|
|
24253
24357
|
},
|
|
24254
24358
|
className: "hover:mesh-fill-white",
|
|
24255
24359
|
children: [
|
|
24256
|
-
/* @__PURE__ */
|
|
24257
|
-
/* @__PURE__ */
|
|
24258
|
-
/* @__PURE__ */
|
|
24259
|
-
/* @__PURE__ */
|
|
24260
|
-
/* @__PURE__ */
|
|
24261
|
-
/* @__PURE__ */
|
|
24262
|
-
/* @__PURE__ */
|
|
24263
|
-
/* @__PURE__ */
|
|
24264
|
-
/* @__PURE__ */
|
|
24360
|
+
/* @__PURE__ */ jsx11("path", { d: "M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4" }),
|
|
24361
|
+
/* @__PURE__ */ jsx11("path", { d: "M14 13.12c0 2.38 0 6.38-1 8.88" }),
|
|
24362
|
+
/* @__PURE__ */ jsx11("path", { d: "M17.29 21.02c.12-.6.43-2.3.5-3.02" }),
|
|
24363
|
+
/* @__PURE__ */ jsx11("path", { d: "M2 12a10 10 0 0 1 18-6" }),
|
|
24364
|
+
/* @__PURE__ */ jsx11("path", { d: "M2 16h.01" }),
|
|
24365
|
+
/* @__PURE__ */ jsx11("path", { d: "M21.8 16c.2-2 .131-5.354 0-6" }),
|
|
24366
|
+
/* @__PURE__ */ jsx11("path", { d: "M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2" }),
|
|
24367
|
+
/* @__PURE__ */ jsx11("path", { d: "M8.65 22c.21-.66.45-1.32.57-2" }),
|
|
24368
|
+
/* @__PURE__ */ jsx11("path", { d: "M9 6.8a6 6 0 0 1 9 5.2v2" })
|
|
24265
24369
|
]
|
|
24266
24370
|
}
|
|
24267
24371
|
);
|
|
24268
24372
|
}
|
|
24269
24373
|
|
|
24270
24374
|
// src/common/icons/icon-monitor-smartphone.tsx
|
|
24271
|
-
import { jsx as
|
|
24375
|
+
import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
24272
24376
|
function IconMonitorSmartphone() {
|
|
24273
24377
|
return /* @__PURE__ */ jsxs8(
|
|
24274
24378
|
"svg",
|
|
@@ -24289,10 +24393,10 @@ function IconMonitorSmartphone() {
|
|
|
24289
24393
|
strokeWidth: "1px"
|
|
24290
24394
|
},
|
|
24291
24395
|
children: [
|
|
24292
|
-
/* @__PURE__ */
|
|
24293
|
-
/* @__PURE__ */
|
|
24294
|
-
/* @__PURE__ */
|
|
24295
|
-
/* @__PURE__ */
|
|
24396
|
+
/* @__PURE__ */ jsx12("path", { d: "M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8" }),
|
|
24397
|
+
/* @__PURE__ */ jsx12("path", { d: "M10 19v-3.96 3.15" }),
|
|
24398
|
+
/* @__PURE__ */ jsx12("path", { d: "M7 19h5" }),
|
|
24399
|
+
/* @__PURE__ */ jsx12("rect", { width: "6", height: "10", x: "16", y: "12", rx: "2" })
|
|
24296
24400
|
]
|
|
24297
24401
|
}
|
|
24298
24402
|
);
|
|
@@ -24301,11 +24405,11 @@ function IconMonitorSmartphone() {
|
|
|
24301
24405
|
// src/common/tooltip.tsx
|
|
24302
24406
|
import * as React4 from "react";
|
|
24303
24407
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
24304
|
-
import { jsx as
|
|
24408
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
24305
24409
|
var TooltipProvider = TooltipPrimitive.Provider;
|
|
24306
24410
|
var Tooltip = TooltipPrimitive.Root;
|
|
24307
24411
|
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
24308
|
-
var TooltipContent = React4.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */
|
|
24412
|
+
var TooltipContent = React4.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx13(
|
|
24309
24413
|
TooltipPrimitive.Content,
|
|
24310
24414
|
{
|
|
24311
24415
|
ref,
|
|
@@ -24320,57 +24424,227 @@ var TooltipContent = React4.forwardRef(({ className, sideOffset = 4, ...props },
|
|
|
24320
24424
|
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
24321
24425
|
|
|
24322
24426
|
// src/cardano-wallet/wallet-icon.tsx
|
|
24323
|
-
import { jsx as
|
|
24427
|
+
import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
24324
24428
|
function WalletIcon({
|
|
24325
24429
|
icon,
|
|
24326
24430
|
name,
|
|
24327
24431
|
action,
|
|
24328
|
-
iconReactNode
|
|
24432
|
+
iconReactNode,
|
|
24433
|
+
loading = false
|
|
24329
24434
|
}) {
|
|
24330
24435
|
return /* @__PURE__ */ jsxs9(Tooltip, { delayDuration: 0, defaultOpen: false, children: [
|
|
24331
|
-
/* @__PURE__ */
|
|
24436
|
+
/* @__PURE__ */ jsx14(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs9(
|
|
24332
24437
|
"button",
|
|
24333
24438
|
{
|
|
24334
24439
|
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",
|
|
24335
24440
|
onClick: action,
|
|
24441
|
+
disabled: loading,
|
|
24336
24442
|
children: [
|
|
24337
|
-
icon && /* @__PURE__ */
|
|
24338
|
-
iconReactNode && iconReactNode
|
|
24443
|
+
icon && !loading && /* @__PURE__ */ jsx14("img", { src: icon, alt: name, className: "mesh-w-8 mesh-h-8" }),
|
|
24444
|
+
!loading && iconReactNode && iconReactNode,
|
|
24445
|
+
loading && /* @__PURE__ */ jsx14("span", { className: "text-black", children: "..." })
|
|
24339
24446
|
]
|
|
24340
24447
|
}
|
|
24341
24448
|
) }),
|
|
24342
|
-
/* @__PURE__ */
|
|
24449
|
+
/* @__PURE__ */ jsx14(TooltipContent, { children: /* @__PURE__ */ jsx14("p", { children: name }) })
|
|
24450
|
+
] });
|
|
24451
|
+
}
|
|
24452
|
+
|
|
24453
|
+
// src/cardano-wallet/web3-services.tsx
|
|
24454
|
+
import { useState as useState10 } from "react";
|
|
24455
|
+
import {
|
|
24456
|
+
Web3Wallet as Web3Wallet2
|
|
24457
|
+
} from "@meshsdk/web3-sdk";
|
|
24458
|
+
|
|
24459
|
+
// src/common/icons/icon-discord.tsx
|
|
24460
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
24461
|
+
function IconDiscord() {
|
|
24462
|
+
return /* @__PURE__ */ jsx15(
|
|
24463
|
+
"svg",
|
|
24464
|
+
{
|
|
24465
|
+
viewBox: "0 0 20 20",
|
|
24466
|
+
"aria-hidden": "true",
|
|
24467
|
+
style: {
|
|
24468
|
+
width: "24px",
|
|
24469
|
+
height: "24px"
|
|
24470
|
+
},
|
|
24471
|
+
children: /* @__PURE__ */ jsx15(
|
|
24472
|
+
"path",
|
|
24473
|
+
{
|
|
24474
|
+
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",
|
|
24475
|
+
fill: "#5865F2"
|
|
24476
|
+
}
|
|
24477
|
+
)
|
|
24478
|
+
}
|
|
24479
|
+
);
|
|
24480
|
+
}
|
|
24481
|
+
|
|
24482
|
+
// src/common/icons/icon-google.tsx
|
|
24483
|
+
import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
24484
|
+
function IconGoogle() {
|
|
24485
|
+
return /* @__PURE__ */ jsxs10(
|
|
24486
|
+
"svg",
|
|
24487
|
+
{
|
|
24488
|
+
viewBox: "0 0 262 262",
|
|
24489
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
24490
|
+
preserveAspectRatio: "xMidYMid",
|
|
24491
|
+
style: {
|
|
24492
|
+
width: "24px",
|
|
24493
|
+
height: "24px"
|
|
24494
|
+
},
|
|
24495
|
+
children: [
|
|
24496
|
+
/* @__PURE__ */ jsx16(
|
|
24497
|
+
"path",
|
|
24498
|
+
{
|
|
24499
|
+
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",
|
|
24500
|
+
fill: "#4285F4"
|
|
24501
|
+
}
|
|
24502
|
+
),
|
|
24503
|
+
/* @__PURE__ */ jsx16(
|
|
24504
|
+
"path",
|
|
24505
|
+
{
|
|
24506
|
+
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",
|
|
24507
|
+
fill: "#34A853"
|
|
24508
|
+
}
|
|
24509
|
+
),
|
|
24510
|
+
/* @__PURE__ */ jsx16(
|
|
24511
|
+
"path",
|
|
24512
|
+
{
|
|
24513
|
+
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",
|
|
24514
|
+
fill: "#FBBC05"
|
|
24515
|
+
}
|
|
24516
|
+
),
|
|
24517
|
+
/* @__PURE__ */ jsx16(
|
|
24518
|
+
"path",
|
|
24519
|
+
{
|
|
24520
|
+
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",
|
|
24521
|
+
fill: "#EB4335"
|
|
24522
|
+
}
|
|
24523
|
+
)
|
|
24524
|
+
]
|
|
24525
|
+
}
|
|
24526
|
+
);
|
|
24527
|
+
}
|
|
24528
|
+
|
|
24529
|
+
// src/common/icons/icon-twitter.tsx
|
|
24530
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
24531
|
+
function IconTwitter() {
|
|
24532
|
+
return /* @__PURE__ */ jsx17(
|
|
24533
|
+
"svg",
|
|
24534
|
+
{
|
|
24535
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
24536
|
+
version: "1.1",
|
|
24537
|
+
viewBox: "0 0 24 24",
|
|
24538
|
+
style: {
|
|
24539
|
+
width: "24px",
|
|
24540
|
+
height: "24px"
|
|
24541
|
+
},
|
|
24542
|
+
children: /* @__PURE__ */ jsx17("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" })
|
|
24543
|
+
}
|
|
24544
|
+
);
|
|
24545
|
+
}
|
|
24546
|
+
|
|
24547
|
+
// src/cardano-wallet/web3-services.tsx
|
|
24548
|
+
import { Fragment as Fragment3, jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
24549
|
+
function Web3Services({
|
|
24550
|
+
options,
|
|
24551
|
+
setOpen,
|
|
24552
|
+
persist
|
|
24553
|
+
}) {
|
|
24554
|
+
const { setWallet, setWeb3UserData } = useWallet();
|
|
24555
|
+
const [loading, setLoading] = useState10(false);
|
|
24556
|
+
async function loadWallet(directTo) {
|
|
24557
|
+
setLoading(true);
|
|
24558
|
+
const _options = {
|
|
24559
|
+
networkId: 0,
|
|
24560
|
+
fetcher: options.fetcher,
|
|
24561
|
+
submitter: options.submitter,
|
|
24562
|
+
appUrl: options.appUrl,
|
|
24563
|
+
projectId: options.projectId,
|
|
24564
|
+
directTo
|
|
24565
|
+
};
|
|
24566
|
+
const wallet = await Web3Wallet2.enable(_options);
|
|
24567
|
+
const user = wallet.getUser();
|
|
24568
|
+
setWeb3UserData(user);
|
|
24569
|
+
setWallet(
|
|
24570
|
+
wallet.cardano,
|
|
24571
|
+
"utxos",
|
|
24572
|
+
persist ? {
|
|
24573
|
+
walletAddress: await wallet.getChangeAddress(),
|
|
24574
|
+
user
|
|
24575
|
+
} : void 0
|
|
24576
|
+
);
|
|
24577
|
+
setLoading(false);
|
|
24578
|
+
setOpen(false);
|
|
24579
|
+
}
|
|
24580
|
+
return /* @__PURE__ */ jsxs11(Fragment3, { children: [
|
|
24581
|
+
/* @__PURE__ */ jsx18(
|
|
24582
|
+
WalletIcon,
|
|
24583
|
+
{
|
|
24584
|
+
iconReactNode: IconGoogle(),
|
|
24585
|
+
name: `Google`,
|
|
24586
|
+
action: () => loadWallet("google"),
|
|
24587
|
+
loading
|
|
24588
|
+
}
|
|
24589
|
+
),
|
|
24590
|
+
/* @__PURE__ */ jsx18(
|
|
24591
|
+
WalletIcon,
|
|
24592
|
+
{
|
|
24593
|
+
iconReactNode: IconDiscord(),
|
|
24594
|
+
name: `Discord`,
|
|
24595
|
+
action: () => loadWallet("discord"),
|
|
24596
|
+
loading
|
|
24597
|
+
}
|
|
24598
|
+
),
|
|
24599
|
+
/* @__PURE__ */ jsx18(
|
|
24600
|
+
WalletIcon,
|
|
24601
|
+
{
|
|
24602
|
+
iconReactNode: IconTwitter(),
|
|
24603
|
+
name: `Twitter`,
|
|
24604
|
+
action: () => loadWallet("twitter"),
|
|
24605
|
+
loading
|
|
24606
|
+
}
|
|
24607
|
+
)
|
|
24343
24608
|
] });
|
|
24344
24609
|
}
|
|
24345
24610
|
|
|
24346
24611
|
// src/cardano-wallet/screen-main.tsx
|
|
24347
|
-
import { jsx as
|
|
24612
|
+
import { jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
24348
24613
|
function ScreenMain({
|
|
24349
24614
|
injectFn,
|
|
24350
|
-
extensions,
|
|
24351
24615
|
setOpen,
|
|
24352
24616
|
setScreen,
|
|
24353
24617
|
persist,
|
|
24354
24618
|
cardanoPeerConnect,
|
|
24355
24619
|
burnerWallet,
|
|
24356
|
-
webauthn
|
|
24620
|
+
webauthn,
|
|
24621
|
+
showDownload,
|
|
24622
|
+
web3Services
|
|
24357
24623
|
}) {
|
|
24358
24624
|
const wallets = useWalletList({ injectFn });
|
|
24359
|
-
const { connect: connect2 } = useWallet();
|
|
24360
|
-
return /* @__PURE__ */
|
|
24361
|
-
wallets.map((wallet, index) => /* @__PURE__ */
|
|
24625
|
+
const { connect: connect2, setBitcoinWallet } = useWallet();
|
|
24626
|
+
return /* @__PURE__ */ jsx19(TooltipProvider, { children: /* @__PURE__ */ jsxs12("div", { className: "mesh-grid mesh-gap-4 mesh-py-4 mesh-grid-cols-5 mesh-place-items-center mesh-gap-y-8", children: [
|
|
24627
|
+
wallets.map((wallet, index) => /* @__PURE__ */ jsx19(
|
|
24362
24628
|
WalletIcon,
|
|
24363
24629
|
{
|
|
24364
24630
|
icon: wallet.icon,
|
|
24365
24631
|
name: wallet.name,
|
|
24366
24632
|
action: () => {
|
|
24367
|
-
connect2(wallet.id,
|
|
24633
|
+
connect2(wallet.id, persist);
|
|
24368
24634
|
setOpen(false);
|
|
24369
24635
|
}
|
|
24370
24636
|
},
|
|
24371
24637
|
index
|
|
24372
24638
|
)),
|
|
24373
|
-
|
|
24639
|
+
web3Services && /* @__PURE__ */ jsx19(
|
|
24640
|
+
Web3Services,
|
|
24641
|
+
{
|
|
24642
|
+
options: web3Services,
|
|
24643
|
+
setOpen,
|
|
24644
|
+
persist
|
|
24645
|
+
}
|
|
24646
|
+
),
|
|
24647
|
+
webauthn && /* @__PURE__ */ jsx19(
|
|
24374
24648
|
WalletIcon,
|
|
24375
24649
|
{
|
|
24376
24650
|
iconReactNode: IconFingerprint(),
|
|
@@ -24380,7 +24654,7 @@ function ScreenMain({
|
|
|
24380
24654
|
}
|
|
24381
24655
|
}
|
|
24382
24656
|
),
|
|
24383
|
-
cardanoPeerConnect && /* @__PURE__ */
|
|
24657
|
+
cardanoPeerConnect && /* @__PURE__ */ jsx19(
|
|
24384
24658
|
WalletIcon,
|
|
24385
24659
|
{
|
|
24386
24660
|
iconReactNode: IconMonitorSmartphone(),
|
|
@@ -24390,7 +24664,7 @@ function ScreenMain({
|
|
|
24390
24664
|
}
|
|
24391
24665
|
}
|
|
24392
24666
|
),
|
|
24393
|
-
burnerWallet && /* @__PURE__ */
|
|
24667
|
+
burnerWallet && /* @__PURE__ */ jsx19(
|
|
24394
24668
|
WalletIcon,
|
|
24395
24669
|
{
|
|
24396
24670
|
iconReactNode: IconBookDashed(),
|
|
@@ -24400,7 +24674,7 @@ function ScreenMain({
|
|
|
24400
24674
|
}
|
|
24401
24675
|
}
|
|
24402
24676
|
),
|
|
24403
|
-
/* @__PURE__ */
|
|
24677
|
+
showDownload && /* @__PURE__ */ jsx19(
|
|
24404
24678
|
WalletIcon,
|
|
24405
24679
|
{
|
|
24406
24680
|
iconReactNode: IconDownload(),
|
|
@@ -24412,22 +24686,36 @@ function ScreenMain({
|
|
|
24412
24686
|
);
|
|
24413
24687
|
}
|
|
24414
24688
|
}
|
|
24689
|
+
),
|
|
24690
|
+
/* @__PURE__ */ jsx19(
|
|
24691
|
+
WalletIcon,
|
|
24692
|
+
{
|
|
24693
|
+
iconReactNode: IconBitcoin(),
|
|
24694
|
+
name: "Bitcoin",
|
|
24695
|
+
action: async () => {
|
|
24696
|
+
const wallet = await BrowserWallet3.enable(
|
|
24697
|
+
"Mesh SDK want to connect"
|
|
24698
|
+
);
|
|
24699
|
+
setBitcoinWallet(wallet, "Bitcoin");
|
|
24700
|
+
setOpen(false);
|
|
24701
|
+
}
|
|
24702
|
+
}
|
|
24415
24703
|
)
|
|
24416
24704
|
] }) });
|
|
24417
24705
|
}
|
|
24418
24706
|
|
|
24419
24707
|
// src/cardano-wallet/screen-p2p.tsx
|
|
24420
24708
|
var import_cardano_peer_connect = __toESM(require_dist(), 1);
|
|
24421
|
-
import { useEffect as useEffect9, useRef as useRef2, useState as
|
|
24422
|
-
import { jsx as
|
|
24709
|
+
import { useEffect as useEffect9, useRef as useRef2, useState as useState11 } from "react";
|
|
24710
|
+
import { jsx as jsx20, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
24423
24711
|
function ScreenP2P({
|
|
24424
24712
|
cardanoPeerConnect,
|
|
24425
24713
|
setOpen
|
|
24426
24714
|
}) {
|
|
24427
24715
|
const dAppConnect = useRef2(null);
|
|
24428
24716
|
const qrCodeField = useRef2(null);
|
|
24429
|
-
const [address, setAddress] =
|
|
24430
|
-
const [copied, setCopied] =
|
|
24717
|
+
const [address, setAddress] = useState11("");
|
|
24718
|
+
const [copied, setCopied] = useState11(false);
|
|
24431
24719
|
const { connect: connect2 } = useWallet();
|
|
24432
24720
|
useEffect9(() => {
|
|
24433
24721
|
if (cardanoPeerConnect) {
|
|
@@ -24463,9 +24751,9 @@ function ScreenP2P({
|
|
|
24463
24751
|
}
|
|
24464
24752
|
}
|
|
24465
24753
|
}, []);
|
|
24466
|
-
return /* @__PURE__ */
|
|
24467
|
-
/* @__PURE__ */
|
|
24468
|
-
/* @__PURE__ */
|
|
24754
|
+
return /* @__PURE__ */ jsxs13("div", { className: "mesh-flex mesh-flex-col mesh-items-center mesh-justify-center", children: [
|
|
24755
|
+
/* @__PURE__ */ jsx20("div", { style: { marginTop: 16, marginBottom: 16 }, ref: qrCodeField }),
|
|
24756
|
+
/* @__PURE__ */ jsx20(
|
|
24469
24757
|
Button,
|
|
24470
24758
|
{
|
|
24471
24759
|
variant: "outline",
|
|
@@ -24480,15 +24768,15 @@ function ScreenP2P({
|
|
|
24480
24768
|
}
|
|
24481
24769
|
|
|
24482
24770
|
// src/cardano-wallet/screen-webauthn.tsx
|
|
24483
|
-
import { useState as
|
|
24771
|
+
import { useState as useState12 } from "react";
|
|
24484
24772
|
import { connect, MeshWallet as MeshWallet2 } from "@meshsdk/wallet";
|
|
24485
24773
|
|
|
24486
24774
|
// src/common/input.tsx
|
|
24487
24775
|
import * as React5 from "react";
|
|
24488
|
-
import { jsx as
|
|
24776
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
24489
24777
|
var Input = React5.forwardRef(
|
|
24490
24778
|
({ className, type, ...props }, ref) => {
|
|
24491
|
-
return /* @__PURE__ */
|
|
24779
|
+
return /* @__PURE__ */ jsx21(
|
|
24492
24780
|
"input",
|
|
24493
24781
|
{
|
|
24494
24782
|
type,
|
|
@@ -24508,11 +24796,11 @@ Input.displayName = "Input";
|
|
|
24508
24796
|
import * as React6 from "react";
|
|
24509
24797
|
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
24510
24798
|
import { cva as cva2 } from "class-variance-authority";
|
|
24511
|
-
import { jsx as
|
|
24799
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
24512
24800
|
var labelVariants = cva2(
|
|
24513
24801
|
"mesh-text-sm mesh-font-medium mesh-leading-none peer-disabled:mesh-cursor-not-allowed peer-disabled:mesh-opacity-70"
|
|
24514
24802
|
);
|
|
24515
|
-
var Label2 = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
24803
|
+
var Label2 = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx22(
|
|
24516
24804
|
LabelPrimitive.Root,
|
|
24517
24805
|
{
|
|
24518
24806
|
ref,
|
|
@@ -24523,16 +24811,16 @@ var Label2 = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
24523
24811
|
Label2.displayName = LabelPrimitive.Root.displayName;
|
|
24524
24812
|
|
|
24525
24813
|
// src/cardano-wallet/screen-webauthn.tsx
|
|
24526
|
-
import { Fragment as
|
|
24814
|
+
import { Fragment as Fragment4, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
24527
24815
|
function ScreenWebauthn({
|
|
24528
24816
|
url,
|
|
24529
24817
|
networkId,
|
|
24530
24818
|
provider,
|
|
24531
24819
|
setOpen
|
|
24532
24820
|
}) {
|
|
24533
|
-
const [loading, setLoading] =
|
|
24534
|
-
const [userName, setUserName] =
|
|
24535
|
-
const [password, setPassword] =
|
|
24821
|
+
const [loading, setLoading] = useState12(false);
|
|
24822
|
+
const [userName, setUserName] = useState12("");
|
|
24823
|
+
const [password, setPassword] = useState12("");
|
|
24536
24824
|
const { setWallet } = useWallet();
|
|
24537
24825
|
function createWallet(root) {
|
|
24538
24826
|
setTimeout(() => {
|
|
@@ -24557,10 +24845,10 @@ function ScreenWebauthn({
|
|
|
24557
24845
|
createWallet(res.wallet.bech32PrivateKey);
|
|
24558
24846
|
}
|
|
24559
24847
|
}
|
|
24560
|
-
return /* @__PURE__ */
|
|
24561
|
-
/* @__PURE__ */
|
|
24562
|
-
/* @__PURE__ */
|
|
24563
|
-
/* @__PURE__ */
|
|
24848
|
+
return /* @__PURE__ */ jsx23("div", { className: "mesh-flex mesh-flex-row mesh-flex-gap-4 mesh-items-center mesh-justify-center", children: loading ? /* @__PURE__ */ jsx23(Fragment4, { children: "Connecting wallet..." }) : /* @__PURE__ */ jsx23(Fragment4, { children: /* @__PURE__ */ jsxs14("div", { className: "mesh-flex mesh-flex-col mesh-gap-6 mesh-w-full mesh-mx-8", children: [
|
|
24849
|
+
/* @__PURE__ */ jsxs14("div", { className: "mesh-grid mesh-gap-2", children: [
|
|
24850
|
+
/* @__PURE__ */ jsx23(Label2, { htmlFor: "username", children: "Username" }),
|
|
24851
|
+
/* @__PURE__ */ jsx23(
|
|
24564
24852
|
Input,
|
|
24565
24853
|
{
|
|
24566
24854
|
id: "username",
|
|
@@ -24570,11 +24858,11 @@ function ScreenWebauthn({
|
|
|
24570
24858
|
onChange: (e2) => setUserName(e2.target.value)
|
|
24571
24859
|
}
|
|
24572
24860
|
),
|
|
24573
|
-
/* @__PURE__ */
|
|
24861
|
+
/* @__PURE__ */ jsx23("p", { className: "mesh-text-gray-500 mesh-text-xs", children: "Unique to the application you are connecting." })
|
|
24574
24862
|
] }),
|
|
24575
|
-
/* @__PURE__ */
|
|
24576
|
-
/* @__PURE__ */
|
|
24577
|
-
/* @__PURE__ */
|
|
24863
|
+
/* @__PURE__ */ jsxs14("div", { className: "mesh-grid mesh-gap-2", children: [
|
|
24864
|
+
/* @__PURE__ */ jsx23("div", { className: "mesh-flex mesh-items-center", children: /* @__PURE__ */ jsx23(Label2, { htmlFor: "password", children: "Unique Code" }) }),
|
|
24865
|
+
/* @__PURE__ */ jsx23(
|
|
24578
24866
|
Input,
|
|
24579
24867
|
{
|
|
24580
24868
|
id: "password",
|
|
@@ -24584,9 +24872,9 @@ function ScreenWebauthn({
|
|
|
24584
24872
|
onChange: (e2) => setPassword(e2.target.value)
|
|
24585
24873
|
}
|
|
24586
24874
|
),
|
|
24587
|
-
/* @__PURE__ */
|
|
24875
|
+
/* @__PURE__ */ jsx23("p", { className: "mesh-text-gray-500 mesh-text-xs", children: "Additional security to derive your wallet." })
|
|
24588
24876
|
] }),
|
|
24589
|
-
/* @__PURE__ */
|
|
24877
|
+
/* @__PURE__ */ jsx23(
|
|
24590
24878
|
Button,
|
|
24591
24879
|
{
|
|
24592
24880
|
className: "mesh-w-full",
|
|
@@ -24599,59 +24887,62 @@ function ScreenWebauthn({
|
|
|
24599
24887
|
}
|
|
24600
24888
|
|
|
24601
24889
|
// src/cardano-wallet/index.tsx
|
|
24602
|
-
import { jsx as
|
|
24890
|
+
import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
24603
24891
|
var CardanoWallet = ({
|
|
24604
24892
|
label = "Connect Wallet",
|
|
24605
24893
|
onConnected = void 0,
|
|
24606
24894
|
isDark = false,
|
|
24607
24895
|
persist = false,
|
|
24608
|
-
extensions = [],
|
|
24609
24896
|
injectFn = void 0,
|
|
24610
24897
|
cardanoPeerConnect = void 0,
|
|
24611
24898
|
burnerWallet = void 0,
|
|
24612
|
-
webauthn = void 0
|
|
24899
|
+
webauthn = void 0,
|
|
24900
|
+
showDownload = true,
|
|
24901
|
+
web3Services = void 0
|
|
24613
24902
|
}) => {
|
|
24614
|
-
const [open, setOpen] =
|
|
24615
|
-
const [screen, setScreen] =
|
|
24616
|
-
const { wallet, connected, setPersist } = useWallet();
|
|
24903
|
+
const [open, setOpen] = useState13(false);
|
|
24904
|
+
const [screen, setScreen] = useState13("main");
|
|
24905
|
+
const { wallet, connected, setPersist, setWeb3Services } = useWallet();
|
|
24617
24906
|
useEffect10(() => {
|
|
24618
24907
|
setPersist(persist);
|
|
24619
|
-
|
|
24908
|
+
if (web3Services) setWeb3Services(web3Services);
|
|
24909
|
+
}, []);
|
|
24620
24910
|
useEffect10(() => {
|
|
24621
24911
|
if (connected) {
|
|
24622
24912
|
if (onConnected) onConnected();
|
|
24623
24913
|
}
|
|
24624
24914
|
}, [connected, wallet]);
|
|
24625
|
-
return /* @__PURE__ */
|
|
24626
|
-
/* @__PURE__ */
|
|
24627
|
-
/* @__PURE__ */
|
|
24915
|
+
return /* @__PURE__ */ jsxs15(Dialog, { open, onOpenChange: setOpen, children: [
|
|
24916
|
+
/* @__PURE__ */ jsx24("div", { className: isDark ? "mesh-dark" : "", children: !connected ? /* @__PURE__ */ jsx24(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsx24(Button, { variant: "outline", className: isDark ? "mesh-dark" : "", children: label }) }) : /* @__PURE__ */ jsx24(ConnectedButton, {}) }),
|
|
24917
|
+
/* @__PURE__ */ jsxs15(
|
|
24628
24918
|
DialogContent,
|
|
24629
24919
|
{
|
|
24630
24920
|
className: "sm:mesh-max-w-[425px] mesh-dark",
|
|
24631
24921
|
onOpenAutoFocus: (event) => event.preventDefault(),
|
|
24632
24922
|
children: [
|
|
24633
|
-
/* @__PURE__ */
|
|
24634
|
-
screen == "main" && /* @__PURE__ */
|
|
24923
|
+
/* @__PURE__ */ jsx24(Header, { screen, setScreen }),
|
|
24924
|
+
screen == "main" && /* @__PURE__ */ jsx24(
|
|
24635
24925
|
ScreenMain,
|
|
24636
24926
|
{
|
|
24637
24927
|
injectFn,
|
|
24638
|
-
extensions,
|
|
24639
24928
|
setOpen,
|
|
24640
24929
|
setScreen,
|
|
24641
24930
|
persist,
|
|
24642
24931
|
cardanoPeerConnect: cardanoPeerConnect != void 0,
|
|
24643
24932
|
burnerWallet: burnerWallet != void 0,
|
|
24644
|
-
webauthn: webauthn != void 0
|
|
24933
|
+
webauthn: webauthn != void 0,
|
|
24934
|
+
showDownload,
|
|
24935
|
+
web3Services
|
|
24645
24936
|
}
|
|
24646
24937
|
),
|
|
24647
|
-
screen == "p2p" && /* @__PURE__ */
|
|
24938
|
+
screen == "p2p" && /* @__PURE__ */ jsx24(
|
|
24648
24939
|
ScreenP2P,
|
|
24649
24940
|
{
|
|
24650
24941
|
cardanoPeerConnect,
|
|
24651
24942
|
setOpen
|
|
24652
24943
|
}
|
|
24653
24944
|
),
|
|
24654
|
-
screen == "burner" && burnerWallet && /* @__PURE__ */
|
|
24945
|
+
screen == "burner" && burnerWallet && /* @__PURE__ */ jsx24(
|
|
24655
24946
|
ScreenBurner,
|
|
24656
24947
|
{
|
|
24657
24948
|
networkId: burnerWallet.networkId,
|
|
@@ -24659,7 +24950,7 @@ var CardanoWallet = ({
|
|
|
24659
24950
|
setOpen
|
|
24660
24951
|
}
|
|
24661
24952
|
),
|
|
24662
|
-
screen == "webauthn" && webauthn && /* @__PURE__ */
|
|
24953
|
+
screen == "webauthn" && webauthn && /* @__PURE__ */ jsx24(
|
|
24663
24954
|
ScreenWebauthn,
|
|
24664
24955
|
{
|
|
24665
24956
|
url: webauthn.url,
|
|
@@ -24668,7 +24959,7 @@ var CardanoWallet = ({
|
|
|
24668
24959
|
setOpen
|
|
24669
24960
|
}
|
|
24670
24961
|
),
|
|
24671
|
-
/* @__PURE__ */
|
|
24962
|
+
/* @__PURE__ */ jsx24(Footer, {})
|
|
24672
24963
|
]
|
|
24673
24964
|
}
|
|
24674
24965
|
)
|
|
@@ -24678,25 +24969,25 @@ function Header({
|
|
|
24678
24969
|
screen,
|
|
24679
24970
|
setScreen
|
|
24680
24971
|
}) {
|
|
24681
|
-
return /* @__PURE__ */
|
|
24682
|
-
/* @__PURE__ */
|
|
24683
|
-
screen != "main" ? /* @__PURE__ */
|
|
24684
|
-
/* @__PURE__ */
|
|
24685
|
-
/* @__PURE__ */
|
|
24972
|
+
return /* @__PURE__ */ jsxs15(DialogHeader, { children: [
|
|
24973
|
+
/* @__PURE__ */ jsxs15(DialogTitle, { className: "mesh-flex mesh-justify-between", children: [
|
|
24974
|
+
screen != "main" ? /* @__PURE__ */ jsx24("button", { onClick: () => setScreen("main"), children: /* @__PURE__ */ jsx24(IconChevronRight, {}) }) : /* @__PURE__ */ jsx24("span", { style: { width: "24px" } }),
|
|
24975
|
+
/* @__PURE__ */ jsx24("span", { children: screens[screen].title }),
|
|
24976
|
+
/* @__PURE__ */ jsx24("span", { style: { width: "24px" } })
|
|
24686
24977
|
] }),
|
|
24687
|
-
/* @__PURE__ */
|
|
24978
|
+
/* @__PURE__ */ jsx24(DialogDescription, { children: screens[screen].subtitle && screens[screen].subtitle })
|
|
24688
24979
|
] });
|
|
24689
24980
|
}
|
|
24690
24981
|
function Footer() {
|
|
24691
|
-
return /* @__PURE__ */
|
|
24982
|
+
return /* @__PURE__ */ jsx24(DialogFooter, { className: "mesh-justify-center mesh-text-sm", children: /* @__PURE__ */ jsxs15(
|
|
24692
24983
|
"a",
|
|
24693
24984
|
{
|
|
24694
24985
|
href: "https://meshjs.dev/",
|
|
24695
24986
|
target: "_blank",
|
|
24696
24987
|
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",
|
|
24697
24988
|
children: [
|
|
24698
|
-
/* @__PURE__ */
|
|
24699
|
-
/* @__PURE__ */
|
|
24989
|
+
/* @__PURE__ */ jsx24("span", { className: "", children: "Powered by" }),
|
|
24990
|
+
/* @__PURE__ */ jsx24(
|
|
24700
24991
|
"svg",
|
|
24701
24992
|
{
|
|
24702
24993
|
width: 24,
|
|
@@ -24704,31 +24995,31 @@ function Footer() {
|
|
|
24704
24995
|
enableBackground: "new 0 0 300 200",
|
|
24705
24996
|
viewBox: "0 0 300 200",
|
|
24706
24997
|
xmlns: "http://www.w3.org/2000/svg",
|
|
24707
|
-
children: /* @__PURE__ */
|
|
24998
|
+
children: /* @__PURE__ */ jsx24("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" })
|
|
24708
24999
|
}
|
|
24709
25000
|
),
|
|
24710
|
-
/* @__PURE__ */
|
|
25001
|
+
/* @__PURE__ */ jsx24("span", { className: "", children: "Mesh SDK" })
|
|
24711
25002
|
]
|
|
24712
25003
|
}
|
|
24713
25004
|
) });
|
|
24714
25005
|
}
|
|
24715
25006
|
|
|
24716
25007
|
// src/mesh-badge/mesh-logo.tsx
|
|
24717
|
-
import { jsx as
|
|
24718
|
-
var MeshLogo = () => /* @__PURE__ */
|
|
25008
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
25009
|
+
var MeshLogo = () => /* @__PURE__ */ jsx25(
|
|
24719
25010
|
"svg",
|
|
24720
25011
|
{
|
|
24721
25012
|
className: "mesh-h-16 mesh-p-2",
|
|
24722
25013
|
fill: "currentColor",
|
|
24723
25014
|
viewBox: "0 0 300 200",
|
|
24724
25015
|
xmlns: "http://www.w3.org/2000/svg",
|
|
24725
|
-
children: /* @__PURE__ */
|
|
25016
|
+
children: /* @__PURE__ */ jsx25("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" })
|
|
24726
25017
|
}
|
|
24727
25018
|
);
|
|
24728
25019
|
|
|
24729
25020
|
// src/mesh-badge/index.tsx
|
|
24730
|
-
import { jsx as
|
|
24731
|
-
var MeshBadge = ({ isDark = false }) => /* @__PURE__ */
|
|
25021
|
+
import { jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
25022
|
+
var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ jsxs16(
|
|
24732
25023
|
"a",
|
|
24733
25024
|
{
|
|
24734
25025
|
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`}`,
|
|
@@ -24740,295 +25031,15 @@ var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ jsxs14(
|
|
|
24740
25031
|
rel: "noopener noreferrer",
|
|
24741
25032
|
target: "_blank",
|
|
24742
25033
|
children: [
|
|
24743
|
-
/* @__PURE__ */
|
|
25034
|
+
/* @__PURE__ */ jsx26(MeshLogo, {}),
|
|
24744
25035
|
"Mesh"
|
|
24745
25036
|
]
|
|
24746
25037
|
}
|
|
24747
25038
|
);
|
|
24748
|
-
|
|
24749
|
-
// src/stake-button/index.tsx
|
|
24750
|
-
import { useEffect as useEffect12, useState as useState14 } from "react";
|
|
24751
|
-
import { Transaction } from "@meshsdk/transaction";
|
|
24752
|
-
|
|
24753
|
-
// src/cardano-wallet-dropdown/index.tsx
|
|
24754
|
-
import { useEffect as useEffect11, useState as useState13 } from "react";
|
|
24755
|
-
|
|
24756
|
-
// src/common/button-dropdown.tsx
|
|
24757
|
-
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
24758
|
-
function ButtonDropdown({
|
|
24759
|
-
children,
|
|
24760
|
-
isDarkMode = false,
|
|
24761
|
-
hideMenuList = false,
|
|
24762
|
-
setHideMenuList,
|
|
24763
|
-
onMouseEnter,
|
|
24764
|
-
onMouseLeave
|
|
24765
|
-
}) {
|
|
24766
|
-
return /* @__PURE__ */ jsx22(
|
|
24767
|
-
"button",
|
|
24768
|
-
{
|
|
24769
|
-
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`}`,
|
|
24770
|
-
onClick: () => setHideMenuList && setHideMenuList(!hideMenuList),
|
|
24771
|
-
onMouseEnter,
|
|
24772
|
-
onMouseLeave,
|
|
24773
|
-
children
|
|
24774
|
-
}
|
|
24775
|
-
);
|
|
24776
|
-
}
|
|
24777
|
-
|
|
24778
|
-
// src/cardano-wallet-dropdown/menu-item.tsx
|
|
24779
|
-
import { jsx as jsx23, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
24780
|
-
function MenuItem({
|
|
24781
|
-
icon,
|
|
24782
|
-
label,
|
|
24783
|
-
action,
|
|
24784
|
-
active
|
|
24785
|
-
}) {
|
|
24786
|
-
return /* @__PURE__ */ jsxs15(
|
|
24787
|
-
"div",
|
|
24788
|
-
{
|
|
24789
|
-
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",
|
|
24790
|
-
onClick: action,
|
|
24791
|
-
children: [
|
|
24792
|
-
icon && /* @__PURE__ */ jsx23("img", { className: "mesh-pr-2 mesh-m-1 mesh-h-8", src: icon }),
|
|
24793
|
-
/* @__PURE__ */ jsx23("span", { className: "mesh-mr-menu-item mesh-text-xl mesh-font-normal mesh-text-neutral-700 hover:mesh-text-black", children: label.split(" ").map((word) => {
|
|
24794
|
-
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
24795
|
-
}).join(" ") })
|
|
24796
|
-
]
|
|
24797
|
-
}
|
|
24798
|
-
);
|
|
24799
|
-
}
|
|
24800
|
-
|
|
24801
|
-
// src/cardano-wallet-dropdown/chevron-down.tsx
|
|
24802
|
-
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
24803
|
-
var ChevronDown = () => /* @__PURE__ */ jsx24(
|
|
24804
|
-
"svg",
|
|
24805
|
-
{
|
|
24806
|
-
className: "mesh-m-2 mesh-h-6",
|
|
24807
|
-
fill: "none",
|
|
24808
|
-
"aria-hidden": "true",
|
|
24809
|
-
viewBox: "0 0 24 24",
|
|
24810
|
-
stroke: "currentColor",
|
|
24811
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
24812
|
-
children: /* @__PURE__ */ jsx24(
|
|
24813
|
-
"path",
|
|
24814
|
-
{
|
|
24815
|
-
strokeLinecap: "round",
|
|
24816
|
-
strokeLinejoin: "round",
|
|
24817
|
-
strokeWidth: "2",
|
|
24818
|
-
d: "M19 9l-7 7-7-7"
|
|
24819
|
-
}
|
|
24820
|
-
)
|
|
24821
|
-
}
|
|
24822
|
-
);
|
|
24823
|
-
|
|
24824
|
-
// src/cardano-wallet-dropdown/wallet-balance.tsx
|
|
24825
|
-
import { Fragment as Fragment4, jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
24826
|
-
var WalletBalance = ({
|
|
24827
|
-
connected,
|
|
24828
|
-
connecting,
|
|
24829
|
-
label,
|
|
24830
|
-
wallet
|
|
24831
|
-
}) => {
|
|
24832
|
-
const lovelace = useLovelace();
|
|
24833
|
-
return connected && lovelace && wallet?.icon ? /* @__PURE__ */ jsxs16(Fragment4, { children: [
|
|
24834
|
-
/* @__PURE__ */ jsx25("img", { className: "mesh-m-2 mesh-h-6", src: wallet.icon }),
|
|
24835
|
-
"\u20B3",
|
|
24836
|
-
" ",
|
|
24837
|
-
parseInt((parseInt(lovelace, 10) / 1e6).toString(), 10),
|
|
24838
|
-
".",
|
|
24839
|
-
/* @__PURE__ */ jsx25("span", { className: "mesh-text-xs", children: lovelace.substring(lovelace.length - 6) })
|
|
24840
|
-
] }) : connected && wallet?.icon ? /* @__PURE__ */ jsx25(Fragment4, { children: /* @__PURE__ */ jsx25("img", { className: "mesh-m-2 mesh-h-6", src: wallet.icon }) }) : connecting ? /* @__PURE__ */ jsx25(Fragment4, { children: "Connecting..." }) : /* @__PURE__ */ jsxs16(Fragment4, { children: [
|
|
24841
|
-
label,
|
|
24842
|
-
" ",
|
|
24843
|
-
/* @__PURE__ */ jsx25(ChevronDown, {})
|
|
24844
|
-
] });
|
|
24845
|
-
};
|
|
24846
|
-
|
|
24847
|
-
// src/cardano-wallet-dropdown/index.tsx
|
|
24848
|
-
import { Fragment as Fragment5, jsx as jsx26, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
24849
|
-
var CardanoWallet2 = ({
|
|
24850
|
-
label = "Connect Wallet",
|
|
24851
|
-
onConnected = void 0,
|
|
24852
|
-
isDark = false,
|
|
24853
|
-
extensions = [],
|
|
24854
|
-
cardanoPeerConnect = void 0
|
|
24855
|
-
}) => {
|
|
24856
|
-
const [isDarkMode, setIsDarkMode] = useState13(false);
|
|
24857
|
-
const [hideMenuList, setHideMenuList] = useState13(true);
|
|
24858
|
-
const { connect: connect2, connecting, connected, disconnect, name } = useWallet();
|
|
24859
|
-
const wallets = useWalletList();
|
|
24860
|
-
useEffect11(() => {
|
|
24861
|
-
if (connected && onConnected) {
|
|
24862
|
-
onConnected();
|
|
24863
|
-
}
|
|
24864
|
-
}, [connected]);
|
|
24865
|
-
useEffect11(() => {
|
|
24866
|
-
setIsDarkMode(isDark);
|
|
24867
|
-
}, [isDark]);
|
|
24868
|
-
return /* @__PURE__ */ jsxs17(
|
|
24869
|
-
"div",
|
|
24870
|
-
{
|
|
24871
|
-
onMouseEnter: () => setHideMenuList(false),
|
|
24872
|
-
onMouseLeave: () => setHideMenuList(true),
|
|
24873
|
-
style: { width: "min-content", zIndex: 50 },
|
|
24874
|
-
children: [
|
|
24875
|
-
/* @__PURE__ */ jsx26(
|
|
24876
|
-
ButtonDropdown,
|
|
24877
|
-
{
|
|
24878
|
-
isDarkMode,
|
|
24879
|
-
hideMenuList,
|
|
24880
|
-
setHideMenuList,
|
|
24881
|
-
children: /* @__PURE__ */ jsx26(
|
|
24882
|
-
WalletBalance,
|
|
24883
|
-
{
|
|
24884
|
-
connected,
|
|
24885
|
-
connecting,
|
|
24886
|
-
label,
|
|
24887
|
-
wallet: wallets.find((wallet) => wallet.id === name)
|
|
24888
|
-
}
|
|
24889
|
-
)
|
|
24890
|
-
}
|
|
24891
|
-
),
|
|
24892
|
-
/* @__PURE__ */ jsx26(
|
|
24893
|
-
"div",
|
|
24894
|
-
{
|
|
24895
|
-
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`}`,
|
|
24896
|
-
style: { zIndex: 50 },
|
|
24897
|
-
children: !connected && wallets.length > 0 ? /* @__PURE__ */ jsx26(Fragment5, { children: wallets.map((wallet, index) => /* @__PURE__ */ jsx26(
|
|
24898
|
-
MenuItem,
|
|
24899
|
-
{
|
|
24900
|
-
icon: wallet.icon,
|
|
24901
|
-
label: wallet.name,
|
|
24902
|
-
action: () => {
|
|
24903
|
-
connect2(wallet.id, extensions);
|
|
24904
|
-
setHideMenuList(!hideMenuList);
|
|
24905
|
-
},
|
|
24906
|
-
active: name === wallet.id
|
|
24907
|
-
},
|
|
24908
|
-
index
|
|
24909
|
-
)) }) : wallets.length === 0 ? /* @__PURE__ */ jsx26("span", { children: "No Wallet Found" }) : /* @__PURE__ */ jsx26(Fragment5, { children: /* @__PURE__ */ jsx26(
|
|
24910
|
-
MenuItem,
|
|
24911
|
-
{
|
|
24912
|
-
active: false,
|
|
24913
|
-
label: "disconnect",
|
|
24914
|
-
action: disconnect,
|
|
24915
|
-
icon: void 0
|
|
24916
|
-
}
|
|
24917
|
-
) })
|
|
24918
|
-
}
|
|
24919
|
-
)
|
|
24920
|
-
]
|
|
24921
|
-
}
|
|
24922
|
-
);
|
|
24923
|
-
};
|
|
24924
|
-
|
|
24925
|
-
// src/stake-button/index.tsx
|
|
24926
|
-
import { Fragment as Fragment6, jsx as jsx27 } from "react/jsx-runtime";
|
|
24927
|
-
var StakeButton = ({
|
|
24928
|
-
label = "Stake your ADA",
|
|
24929
|
-
isDark = false,
|
|
24930
|
-
poolId,
|
|
24931
|
-
onCheck,
|
|
24932
|
-
onDelegated = void 0
|
|
24933
|
-
}) => {
|
|
24934
|
-
const [isDarkMode, setIsDarkMode] = useState14(false);
|
|
24935
|
-
const { connected } = useWallet();
|
|
24936
|
-
useEffect12(() => {
|
|
24937
|
-
setIsDarkMode(isDark);
|
|
24938
|
-
}, [isDark]);
|
|
24939
|
-
return /* @__PURE__ */ jsx27(Fragment6, { children: connected ? /* @__PURE__ */ jsx27(ButtonDropdown, { isDarkMode, children: /* @__PURE__ */ jsx27(
|
|
24940
|
-
Delegate,
|
|
24941
|
-
{
|
|
24942
|
-
poolId,
|
|
24943
|
-
onCheck,
|
|
24944
|
-
onDelegated
|
|
24945
|
-
}
|
|
24946
|
-
) }) : /* @__PURE__ */ jsx27(CardanoWallet2, { label, isDark }) });
|
|
24947
|
-
};
|
|
24948
|
-
var Delegate = ({
|
|
24949
|
-
poolId,
|
|
24950
|
-
onCheck,
|
|
24951
|
-
onDelegated
|
|
24952
|
-
}) => {
|
|
24953
|
-
const { wallet } = useWallet();
|
|
24954
|
-
const rewardAddress = useRewardAddress();
|
|
24955
|
-
const [_, setError] = useState14();
|
|
24956
|
-
const [checking, setChecking] = useState14(false);
|
|
24957
|
-
const [accountInfo, setAccountInfo] = useState14();
|
|
24958
|
-
const [processing, setProcessing] = useState14(false);
|
|
24959
|
-
const [done, setDone] = useState14(false);
|
|
24960
|
-
const checkAccountStatus = async () => {
|
|
24961
|
-
try {
|
|
24962
|
-
setChecking(true);
|
|
24963
|
-
if (rewardAddress) {
|
|
24964
|
-
const info = await onCheck(rewardAddress);
|
|
24965
|
-
setAccountInfo(info);
|
|
24966
|
-
}
|
|
24967
|
-
setChecking(false);
|
|
24968
|
-
} catch (error) {
|
|
24969
|
-
setError(error);
|
|
24970
|
-
}
|
|
24971
|
-
};
|
|
24972
|
-
const registerAddress = async () => {
|
|
24973
|
-
setProcessing(true);
|
|
24974
|
-
setDone(false);
|
|
24975
|
-
try {
|
|
24976
|
-
if (rewardAddress) {
|
|
24977
|
-
const tx = new Transaction({ initiator: wallet }).registerStake(rewardAddress).delegateStake(rewardAddress, poolId);
|
|
24978
|
-
const unsignedTx = await tx.build();
|
|
24979
|
-
const signedTx = await wallet.signTx(unsignedTx);
|
|
24980
|
-
await wallet.submitTx(signedTx);
|
|
24981
|
-
if (onDelegated) {
|
|
24982
|
-
onDelegated();
|
|
24983
|
-
}
|
|
24984
|
-
setDone(true);
|
|
24985
|
-
}
|
|
24986
|
-
} catch (error) {
|
|
24987
|
-
setError(error);
|
|
24988
|
-
}
|
|
24989
|
-
setProcessing(false);
|
|
24990
|
-
};
|
|
24991
|
-
const delegateStake = async () => {
|
|
24992
|
-
setProcessing(true);
|
|
24993
|
-
setDone(false);
|
|
24994
|
-
try {
|
|
24995
|
-
if (rewardAddress) {
|
|
24996
|
-
const tx = new Transaction({ initiator: wallet }).delegateStake(rewardAddress, poolId);
|
|
24997
|
-
const unsignedTx = await tx.build();
|
|
24998
|
-
const signedTx = await wallet.signTx(unsignedTx);
|
|
24999
|
-
await wallet.submitTx(signedTx);
|
|
25000
|
-
if (onDelegated) {
|
|
25001
|
-
onDelegated();
|
|
25002
|
-
}
|
|
25003
|
-
setDone(true);
|
|
25004
|
-
}
|
|
25005
|
-
} catch (error) {
|
|
25006
|
-
setError(error);
|
|
25007
|
-
}
|
|
25008
|
-
setProcessing(false);
|
|
25009
|
-
};
|
|
25010
|
-
useEffect12(() => {
|
|
25011
|
-
checkAccountStatus();
|
|
25012
|
-
}, [rewardAddress]);
|
|
25013
|
-
if (checking) {
|
|
25014
|
-
return /* @__PURE__ */ jsx27("span", { children: "Checking..." });
|
|
25015
|
-
}
|
|
25016
|
-
if (processing) {
|
|
25017
|
-
return /* @__PURE__ */ jsx27("span", { children: "Loading..." });
|
|
25018
|
-
}
|
|
25019
|
-
if (done) {
|
|
25020
|
-
return /* @__PURE__ */ jsx27("span", { children: "Stake Delegated" });
|
|
25021
|
-
}
|
|
25022
|
-
if (accountInfo?.active) {
|
|
25023
|
-
return accountInfo.poolId === poolId ? /* @__PURE__ */ jsx27("span", { children: "Stake Delegated" }) : /* @__PURE__ */ jsx27("span", { onClick: delegateStake, children: "Begin Staking" });
|
|
25024
|
-
}
|
|
25025
|
-
return /* @__PURE__ */ jsx27("span", { onClick: registerAddress, children: "Begin Staking" });
|
|
25026
|
-
};
|
|
25027
25039
|
export {
|
|
25028
25040
|
CardanoWallet,
|
|
25029
25041
|
MeshBadge,
|
|
25030
25042
|
MeshProvider,
|
|
25031
|
-
StakeButton,
|
|
25032
25043
|
WalletContext,
|
|
25033
25044
|
useAddress,
|
|
25034
25045
|
useAssets,
|