@meshsdk/react 1.8.7 → 1.8.9
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 +11 -12
- package/dist/index.d.cts +4 -8
- package/dist/index.d.ts +4 -8
- package/dist/index.js +11 -12
- package/package.json +6 -5
package/dist/index.cjs
CHANGED
|
@@ -60,12 +60,12 @@ var require_dist = __commonJS({
|
|
|
60
60
|
return e5;
|
|
61
61
|
}, Math.permutation = (t4, e5) => Math.factorial(t4) / Math.factorial(t4 - e5), Math.combination = (t4, e5) => Math.factorial(t4) / (Math.factorial(e5) * Math.factorial(t4 - e5)), Array.times = (t4, e5) => Array(e5).fill(0).map((e6, r3) => t4(r3)), Array.range = (t4) => Array.times((t5) => t5, t4), Array.zip = (t4, e5) => t4.map((t5, r3) => [t5, e5[r3]]), Object.defineProperty(Array.prototype, "at", { value: function(t4) {
|
|
62
62
|
const e5 = this.length;
|
|
63
|
-
return this[t4
|
|
64
|
-
} }), Object.defineProperty(Array.prototype, "chunk", { value: function(t4) {
|
|
63
|
+
if (e5) return this[(t4 % e5 + e5) % e5];
|
|
64
|
+
}, writable: true, configurable: true, enumerable: false }), Array.prototype.chunk || Object.defineProperty(Array.prototype, "chunk", { value: function(t4) {
|
|
65
65
|
return Array.times((e5) => this.slice(e5 * t4, e5 * t4 + t4), Math.ceil(this.length / t4));
|
|
66
|
-
} }), Object.defineProperty(Array.prototype, "shuffle", { value: function() {
|
|
66
|
+
}, writable: true, configurable: true, enumerable: false }), Array.prototype.shuffle || Object.defineProperty(Array.prototype, "shuffle", { value: function() {
|
|
67
67
|
return this.map((t4) => [Math.random(), t4]).sort((t4, e5) => t4[0] - e5[0]).map((t4) => t4[1]);
|
|
68
|
-
} });
|
|
68
|
+
}, writable: true, configurable: true, enumerable: false });
|
|
69
69
|
const e4 = (t4, e5) => t4 || e5 ? "object" == typeof t4 ? { x: t4.x || 0, y: t4.y || 0 } : null == e5 ? { x: t4, y: t4 } : { x: t4, y: e5 } : { x: 0, y: 0 };
|
|
70
70
|
e4.components = (t4) => [t4.x, t4.y], e4.ux = () => e4(1, 0), e4.uy = () => e4(0, 1), e4.add = (t4, e5) => ({ x: t4.x + e5.x, y: t4.y + e5.y }), e4.mul = (t4, e5) => ({ x: t4.x * e5, y: t4.y * e5 }), e4.sub = (t4, e5) => ({ x: t4.x - e5.x, y: t4.y - e5.y }), e4.len = (t4) => Math.sqrt(t4.x * t4.x + t4.y * t4.y), e4.manhattan = (t4) => Math.abs(t4.x) + Math.abs(t4.y), e4.nor = (t4) => {
|
|
71
71
|
let r3 = e4.len(t4);
|
|
@@ -23740,12 +23740,12 @@ var useAssets = () => {
|
|
|
23740
23740
|
var import_react4 = require("react");
|
|
23741
23741
|
var import_wallet2 = require("@meshsdk/wallet");
|
|
23742
23742
|
var useWalletList = ({
|
|
23743
|
-
|
|
23743
|
+
injectFn = void 0
|
|
23744
23744
|
} = {}) => {
|
|
23745
23745
|
const [wallets, setWallets] = (0, import_react4.useState)([]);
|
|
23746
23746
|
(0, import_react4.useEffect)(() => {
|
|
23747
23747
|
async function get() {
|
|
23748
|
-
setWallets(await import_wallet2.BrowserWallet.getAvailableWallets({
|
|
23748
|
+
setWallets(await import_wallet2.BrowserWallet.getAvailableWallets({ injectFn }));
|
|
23749
23749
|
}
|
|
23750
23750
|
get();
|
|
23751
23751
|
}, []);
|
|
@@ -24329,7 +24329,7 @@ function WalletIcon({
|
|
|
24329
24329
|
// src/cardano-wallet/screen-main.tsx
|
|
24330
24330
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
24331
24331
|
function ScreenMain({
|
|
24332
|
-
|
|
24332
|
+
injectFn,
|
|
24333
24333
|
extensions,
|
|
24334
24334
|
setOpen,
|
|
24335
24335
|
setScreen,
|
|
@@ -24337,7 +24337,7 @@ function ScreenMain({
|
|
|
24337
24337
|
burnerWallet,
|
|
24338
24338
|
webauthn
|
|
24339
24339
|
}) {
|
|
24340
|
-
const wallets = useWalletList({
|
|
24340
|
+
const wallets = useWalletList({ injectFn });
|
|
24341
24341
|
const { connect: connect2 } = useWallet();
|
|
24342
24342
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "mesh-grid mesh-gap-4 mesh-py-4 mesh-grid-cols-5 mesh-place-items-center mesh-gap-y-8", children: [
|
|
24343
24343
|
wallets.map((wallet, index) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
@@ -24588,7 +24588,7 @@ var CardanoWallet = ({
|
|
|
24588
24588
|
onConnected = void 0,
|
|
24589
24589
|
isDark = false,
|
|
24590
24590
|
extensions = [],
|
|
24591
|
-
|
|
24591
|
+
injectFn = void 0,
|
|
24592
24592
|
cardanoPeerConnect = void 0,
|
|
24593
24593
|
burnerWallet = void 0,
|
|
24594
24594
|
webauthn = void 0
|
|
@@ -24613,7 +24613,7 @@ var CardanoWallet = ({
|
|
|
24613
24613
|
screen == "main" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
24614
24614
|
ScreenMain,
|
|
24615
24615
|
{
|
|
24616
|
-
|
|
24616
|
+
injectFn,
|
|
24617
24617
|
extensions,
|
|
24618
24618
|
setOpen,
|
|
24619
24619
|
setScreen,
|
|
@@ -24828,14 +24828,13 @@ var CardanoWallet2 = ({
|
|
|
24828
24828
|
label = "Connect Wallet",
|
|
24829
24829
|
onConnected = void 0,
|
|
24830
24830
|
isDark = false,
|
|
24831
|
-
metamask = void 0,
|
|
24832
24831
|
extensions = [],
|
|
24833
24832
|
cardanoPeerConnect = void 0
|
|
24834
24833
|
}) => {
|
|
24835
24834
|
const [isDarkMode, setIsDarkMode] = (0, import_react15.useState)(false);
|
|
24836
24835
|
const [hideMenuList, setHideMenuList] = (0, import_react15.useState)(true);
|
|
24837
24836
|
const { connect: connect2, connecting, connected, disconnect, name } = useWallet();
|
|
24838
|
-
const wallets = useWalletList(
|
|
24837
|
+
const wallets = useWalletList();
|
|
24839
24838
|
(0, import_react15.useEffect)(() => {
|
|
24840
24839
|
if (connected && onConnected) {
|
|
24841
24840
|
onConnected();
|
package/dist/index.d.cts
CHANGED
|
@@ -8,9 +8,7 @@ interface ButtonProps$1 {
|
|
|
8
8
|
onConnected?: Function;
|
|
9
9
|
isDark?: boolean;
|
|
10
10
|
extensions?: number[];
|
|
11
|
-
|
|
12
|
-
network: string;
|
|
13
|
-
};
|
|
11
|
+
injectFn?: () => Promise<void>;
|
|
14
12
|
cardanoPeerConnect?: {
|
|
15
13
|
dAppInfo: {
|
|
16
14
|
name: string;
|
|
@@ -28,7 +26,7 @@ interface ButtonProps$1 {
|
|
|
28
26
|
url: string;
|
|
29
27
|
};
|
|
30
28
|
}
|
|
31
|
-
declare const CardanoWallet: ({ label, onConnected, isDark, extensions,
|
|
29
|
+
declare const CardanoWallet: ({ label, onConnected, isDark, extensions, injectFn, cardanoPeerConnect, burnerWallet, webauthn, }: ButtonProps$1) => react_jsx_runtime.JSX.Element;
|
|
32
30
|
|
|
33
31
|
interface WalletContext {
|
|
34
32
|
hasConnectedWallet: boolean;
|
|
@@ -51,10 +49,8 @@ declare const useAddress: (accountId?: number) => string | undefined;
|
|
|
51
49
|
|
|
52
50
|
declare const useAssets: () => Asset[] | undefined;
|
|
53
51
|
|
|
54
|
-
declare const useWalletList: ({
|
|
55
|
-
|
|
56
|
-
network: string;
|
|
57
|
-
};
|
|
52
|
+
declare const useWalletList: ({ injectFn, }?: {
|
|
53
|
+
injectFn?: () => Promise<void>;
|
|
58
54
|
}) => Wallet[];
|
|
59
55
|
|
|
60
56
|
declare const useLovelace: () => string | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -8,9 +8,7 @@ interface ButtonProps$1 {
|
|
|
8
8
|
onConnected?: Function;
|
|
9
9
|
isDark?: boolean;
|
|
10
10
|
extensions?: number[];
|
|
11
|
-
|
|
12
|
-
network: string;
|
|
13
|
-
};
|
|
11
|
+
injectFn?: () => Promise<void>;
|
|
14
12
|
cardanoPeerConnect?: {
|
|
15
13
|
dAppInfo: {
|
|
16
14
|
name: string;
|
|
@@ -28,7 +26,7 @@ interface ButtonProps$1 {
|
|
|
28
26
|
url: string;
|
|
29
27
|
};
|
|
30
28
|
}
|
|
31
|
-
declare const CardanoWallet: ({ label, onConnected, isDark, extensions,
|
|
29
|
+
declare const CardanoWallet: ({ label, onConnected, isDark, extensions, injectFn, cardanoPeerConnect, burnerWallet, webauthn, }: ButtonProps$1) => react_jsx_runtime.JSX.Element;
|
|
32
30
|
|
|
33
31
|
interface WalletContext {
|
|
34
32
|
hasConnectedWallet: boolean;
|
|
@@ -51,10 +49,8 @@ declare const useAddress: (accountId?: number) => string | undefined;
|
|
|
51
49
|
|
|
52
50
|
declare const useAssets: () => Asset[] | undefined;
|
|
53
51
|
|
|
54
|
-
declare const useWalletList: ({
|
|
55
|
-
|
|
56
|
-
network: string;
|
|
57
|
-
};
|
|
52
|
+
declare const useWalletList: ({ injectFn, }?: {
|
|
53
|
+
injectFn?: () => Promise<void>;
|
|
58
54
|
}) => Wallet[];
|
|
59
55
|
|
|
60
56
|
declare const useLovelace: () => string | undefined;
|
package/dist/index.js
CHANGED
|
@@ -54,12 +54,12 @@ var require_dist = __commonJS({
|
|
|
54
54
|
return e5;
|
|
55
55
|
}, Math.permutation = (t4, e5) => Math.factorial(t4) / Math.factorial(t4 - e5), Math.combination = (t4, e5) => Math.factorial(t4) / (Math.factorial(e5) * Math.factorial(t4 - e5)), Array.times = (t4, e5) => Array(e5).fill(0).map((e6, r3) => t4(r3)), Array.range = (t4) => Array.times((t5) => t5, t4), Array.zip = (t4, e5) => t4.map((t5, r3) => [t5, e5[r3]]), Object.defineProperty(Array.prototype, "at", { value: function(t4) {
|
|
56
56
|
const e5 = this.length;
|
|
57
|
-
return this[t4
|
|
58
|
-
} }), Object.defineProperty(Array.prototype, "chunk", { value: function(t4) {
|
|
57
|
+
if (e5) return this[(t4 % e5 + e5) % e5];
|
|
58
|
+
}, writable: true, configurable: true, enumerable: false }), Array.prototype.chunk || Object.defineProperty(Array.prototype, "chunk", { value: function(t4) {
|
|
59
59
|
return Array.times((e5) => this.slice(e5 * t4, e5 * t4 + t4), Math.ceil(this.length / t4));
|
|
60
|
-
} }), Object.defineProperty(Array.prototype, "shuffle", { value: function() {
|
|
60
|
+
}, writable: true, configurable: true, enumerable: false }), Array.prototype.shuffle || Object.defineProperty(Array.prototype, "shuffle", { value: function() {
|
|
61
61
|
return this.map((t4) => [Math.random(), t4]).sort((t4, e5) => t4[0] - e5[0]).map((t4) => t4[1]);
|
|
62
|
-
} });
|
|
62
|
+
}, writable: true, configurable: true, enumerable: false });
|
|
63
63
|
const e4 = (t4, e5) => t4 || e5 ? "object" == typeof t4 ? { x: t4.x || 0, y: t4.y || 0 } : null == e5 ? { x: t4, y: t4 } : { x: t4, y: e5 } : { x: 0, y: 0 };
|
|
64
64
|
e4.components = (t4) => [t4.x, t4.y], e4.ux = () => e4(1, 0), e4.uy = () => e4(0, 1), e4.add = (t4, e5) => ({ x: t4.x + e5.x, y: t4.y + e5.y }), e4.mul = (t4, e5) => ({ x: t4.x * e5, y: t4.y * e5 }), e4.sub = (t4, e5) => ({ x: t4.x - e5.x, y: t4.y - e5.y }), e4.len = (t4) => Math.sqrt(t4.x * t4.x + t4.y * t4.y), e4.manhattan = (t4) => Math.abs(t4.x) + Math.abs(t4.y), e4.nor = (t4) => {
|
|
65
65
|
let r3 = e4.len(t4);
|
|
@@ -23715,12 +23715,12 @@ var useAssets = () => {
|
|
|
23715
23715
|
import { useEffect as useEffect3, useState as useState4 } from "react";
|
|
23716
23716
|
import { BrowserWallet as BrowserWallet2 } from "@meshsdk/wallet";
|
|
23717
23717
|
var useWalletList = ({
|
|
23718
|
-
|
|
23718
|
+
injectFn = void 0
|
|
23719
23719
|
} = {}) => {
|
|
23720
23720
|
const [wallets, setWallets] = useState4([]);
|
|
23721
23721
|
useEffect3(() => {
|
|
23722
23722
|
async function get() {
|
|
23723
|
-
setWallets(await BrowserWallet2.getAvailableWallets({
|
|
23723
|
+
setWallets(await BrowserWallet2.getAvailableWallets({ injectFn }));
|
|
23724
23724
|
}
|
|
23725
23725
|
get();
|
|
23726
23726
|
}, []);
|
|
@@ -24308,7 +24308,7 @@ function WalletIcon({
|
|
|
24308
24308
|
// src/cardano-wallet/screen-main.tsx
|
|
24309
24309
|
import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
24310
24310
|
function ScreenMain({
|
|
24311
|
-
|
|
24311
|
+
injectFn,
|
|
24312
24312
|
extensions,
|
|
24313
24313
|
setOpen,
|
|
24314
24314
|
setScreen,
|
|
@@ -24316,7 +24316,7 @@ function ScreenMain({
|
|
|
24316
24316
|
burnerWallet,
|
|
24317
24317
|
webauthn
|
|
24318
24318
|
}) {
|
|
24319
|
-
const wallets = useWalletList({
|
|
24319
|
+
const wallets = useWalletList({ injectFn });
|
|
24320
24320
|
const { connect: connect2 } = useWallet();
|
|
24321
24321
|
return /* @__PURE__ */ jsx14(TooltipProvider, { children: /* @__PURE__ */ jsxs10("div", { className: "mesh-grid mesh-gap-4 mesh-py-4 mesh-grid-cols-5 mesh-place-items-center mesh-gap-y-8", children: [
|
|
24322
24322
|
wallets.map((wallet, index) => /* @__PURE__ */ jsx14(
|
|
@@ -24567,7 +24567,7 @@ var CardanoWallet = ({
|
|
|
24567
24567
|
onConnected = void 0,
|
|
24568
24568
|
isDark = false,
|
|
24569
24569
|
extensions = [],
|
|
24570
|
-
|
|
24570
|
+
injectFn = void 0,
|
|
24571
24571
|
cardanoPeerConnect = void 0,
|
|
24572
24572
|
burnerWallet = void 0,
|
|
24573
24573
|
webauthn = void 0
|
|
@@ -24592,7 +24592,7 @@ var CardanoWallet = ({
|
|
|
24592
24592
|
screen == "main" && /* @__PURE__ */ jsx19(
|
|
24593
24593
|
ScreenMain,
|
|
24594
24594
|
{
|
|
24595
|
-
|
|
24595
|
+
injectFn,
|
|
24596
24596
|
extensions,
|
|
24597
24597
|
setOpen,
|
|
24598
24598
|
setScreen,
|
|
@@ -24807,14 +24807,13 @@ var CardanoWallet2 = ({
|
|
|
24807
24807
|
label = "Connect Wallet",
|
|
24808
24808
|
onConnected = void 0,
|
|
24809
24809
|
isDark = false,
|
|
24810
|
-
metamask = void 0,
|
|
24811
24810
|
extensions = [],
|
|
24812
24811
|
cardanoPeerConnect = void 0
|
|
24813
24812
|
}) => {
|
|
24814
24813
|
const [isDarkMode, setIsDarkMode] = useState14(false);
|
|
24815
24814
|
const [hideMenuList, setHideMenuList] = useState14(true);
|
|
24816
24815
|
const { connect: connect2, connecting, connected, disconnect, name } = useWallet();
|
|
24817
|
-
const wallets = useWalletList(
|
|
24816
|
+
const wallets = useWalletList();
|
|
24818
24817
|
useEffect11(() => {
|
|
24819
24818
|
if (connected && onConnected) {
|
|
24820
24819
|
onConnected();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meshsdk/react",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.9",
|
|
4
4
|
"description": "React component library - https://meshjs.dev/react",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"browser": "./dist/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"scripts": {
|
|
22
22
|
"build:mesh_old": "tsup src/index.ts --format esm,cjs --cjsInterop --dts && tailwindcss -i ./src/styles.css -o ./dist/index.css",
|
|
23
23
|
"build:mesh": "tsup && tailwindcss -i ./src/styles.css -o ./dist/index.css",
|
|
24
|
-
"dev": "tsup src/index.ts --format esm,cjs --watch --dts",
|
|
24
|
+
"dev": "concurrently \"tsup src/index.ts --format esm,cjs --watch --dts\" \"tailwindcss -i ./src/styles.css -o ./dist/index.css --watch\"",
|
|
25
25
|
"clean": "rm -rf .turbo && rm -rf dist && rm -rf node_modules",
|
|
26
26
|
"format": "prettier --check . --ignore-path ../../.gitignore",
|
|
27
27
|
"lint": "eslint",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@fabianbormann/cardano-peer-connect": "^1.2.18",
|
|
33
|
-
"@meshsdk/common": "1.8.
|
|
34
|
-
"@meshsdk/transaction": "1.8.
|
|
35
|
-
"@meshsdk/wallet": "1.8.
|
|
33
|
+
"@meshsdk/common": "1.8.9",
|
|
34
|
+
"@meshsdk/transaction": "1.8.9",
|
|
35
|
+
"@meshsdk/wallet": "1.8.9",
|
|
36
36
|
"@radix-ui/react-dialog": "^1.1.2",
|
|
37
37
|
"@radix-ui/react-dropdown-menu": "^2.1.2",
|
|
38
38
|
"@radix-ui/react-icons": "^1.3.2",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"@meshsdk/configs": "*",
|
|
47
47
|
"@types/react": "^18.2.61",
|
|
48
48
|
"autoprefixer": "^10.4.18",
|
|
49
|
+
"concurrently": "^8.0.1",
|
|
49
50
|
"postcss": "^8.4.35",
|
|
50
51
|
"tailwindcss": "^3.4.1",
|
|
51
52
|
"typescript": "latest"
|