@multiversx/sdk-dapp-liquidity 2.3.0-alpha.5 → 2.3.0-alpha.6
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/package.json +1 -1
- package/reactjs/components/Connect/BridgeAccountDisplay.js +1 -1
- package/reactjs/components/Connect/BridgeAccountDisplay.mjs +16 -15
- package/reactjs/components/Connect/BridgeConnectButton.js +1 -1
- package/reactjs/components/Connect/BridgeConnectButton.mjs +26 -19
- package/reactjs/components/Connect/CustomConnectButton.d.ts +4 -1
- package/reactjs/components/Connect/CustomConnectButton.js +1 -1
- package/reactjs/components/Connect/CustomConnectButton.mjs +18 -16
- package/reactjs/components/Connect/SwitchChainButton.d.ts +3 -1
- package/reactjs/components/Connect/SwitchChainButton.js +1 -1
- package/reactjs/components/Connect/SwitchChainButton.mjs +19 -14
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"author": "MultiversX",
|
|
4
4
|
"description": "A complete toolkit for bridging assets between MultiversX, Ethereum, BNB Chain and Sui",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "2.3.0-alpha.
|
|
6
|
+
"version": "2.3.0-alpha.6",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/multiversx/mx-sdk-dapp-liquidity.git"
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),p=require("@fortawesome/free-solid-svg-icons/faPowerOff"),y=require("@fortawesome/react-fontawesome"),g=require("@reown/appkit/react"),i=require("../../../helpers/getDisplayName.js"),j=require("./SwitchChainButton.js"),n=require("../../../types/chainType.js"),f=require("../../hooks/useAccount.js"),N=require("../../hooks/useNamespaceAddress.js"),b=require("../../hooks/useSuiConnect.js");require("clsx");require("tailwind-merge");require("../base/MxCard/MxCard.js");const _=require("../base/MxLink/MxLink.js");require("../base/MxSearch/MxSearch.js");require("@fortawesome/free-solid-svg-icons/faClose");require("@headlessui/react");require("react");require("react-dom");require("react-popper");require("../base/MxTooltip/components/TooltipContainer/TooltipContainer.js");require("../../constants/index.js");const w=require("../CopyButton/CopyButton.js"),T=require("../TrimAddress/TrimAddress.js"),k=({activeChain:e,disabled:t})=>{var d;const o=f.useAccount(),{disconnect:u}=g.useDisconnect(),l=b.useSuiConnect(),c=N.useNamespaceAddress(e==null?void 0:e.chainType),q=(e==null?void 0:e.chainType)===n.ChainType.sui,r=(e==null?void 0:e.chainType)===n.ChainType.evm||(e==null?void 0:e.chainType)===n.ChainType.sui?c:c??o.address,m=async a=>{try{a.preventDefault(),q?await l.disconnect():await u()}catch(x){console.error("Failed to disconnect:",x)}};return r?s.jsxs(s.Fragment,{children:[s.jsx("img",{src:e==null?void 0:e.pngUrl,alt:"",className:"liq-w-6 liq-h-6 liq-rounded-lg"}),s.jsx("span",{className:"liq-truncate liq-text-gray-400",children:i.getDisplayName(e)}),s.jsx("span",{className:"liq-ml-[-5px]",children:":"}),s.jsx("div",{className:"liq-flex liq-items-center liq-justify-between",children:s.jsxs("div",{className:"liq-flex liq-max-w-[10rem] liq-items-center liq-gap-1",children:[s.jsx(_.MxLink,{to:`${(d=e==null?void 0:e.blockExplorerUrls)==null?void 0:d[0]}/address/${r}`,target:"_blank",showExternalIcon:!1,className:"!liq-relative",children:s.jsx("div",{className:"liq-flex liq-min-w-0 liq-flex-grow liq-overflow-hidden liq-leading-none liq-max-w-[10rem]",children:s.jsx(T.TrimAddress,{address:r,"data-testid":"evm-address"})})}),s.jsx(w.CopyButton,{text:r,className:"liq-text-sm","data-testid":"evm-copy-button"})]})}),s.jsx("div",{className:"liq-ml-auto liq-mr-0 liq-flex liq-items-center liq-gap-1",children:s.jsx("button",{className:"focus-primary liq-flex liq-items-center liq-gap-1 liq-rounded-xl liq-px-0 liq-py-2 liq-text-sm liq-font-semibold liq-text-neutral-400 liq-transition-colors liq-duration-200 hover:enabled:liq-text-white disabled:liq-opacity-50",onClick:m,"data-testid":"evm-disconnect-button",children:s.jsx(y.FontAwesomeIcon,{icon:p.faPowerOff})})})]}):q?s.jsxs("div",{className:"liq-flex liq-max-w-full liq-items-center liq-gap-2",children:[s.jsx("button",{disabled:t||l.isConnecting,onClick:()=>l.connect(),className:"liq-rounded-lg liq-font-semibold liq-transition-colors liq-duration-200 disabled:liq-opacity-50 liq-bg-neutral-750 !liq-text-primary-200 hover:enabled:liq-bg-primary liq-px-2",children:s.jsx("div",{className:"liq-flex liq-items-center",children:s.jsxs("div",{className:"liq-flex liq-justify-center liq-items-center liq-gap-2",children:[s.jsx("div",{children:l.isConnecting?"Connecting...":"Connect"}),s.jsx("img",{src:e==null?void 0:e.pngUrl,alt:"",className:"liq-w-4 liq-h-4 liq-rounded-sm"}),s.jsx("div",{className:"liq-truncate md:liq-text-clip",children:i.getDisplayName(e)})]})})}),l.isConnecting&&s.jsx("button",{type:"button",onClick:()=>void l.cancelPendingConnection(),className:"liq-shrink-0 liq-rounded-lg liq-px-2 liq-py-1 liq-text-xs liq-font-medium liq-text-neutral-400 hover:liq-text-white",children:"Cancel"})]}):s.jsx(j.SwitchChainButton,{disabled:t,chainType:e==null?void 0:e.chainType,className:"liq-rounded-lg liq-font-semibold liq-transition-colors liq-duration-200 disabled:liq-opacity-50 liq-bg-neutral-750 !liq-text-primary-200 hover:enabled:liq-bg-primary liq-px-2",children:s.jsx("div",{className:"liq-flex liq-items-center",children:s.jsxs("div",{className:"liq-flex liq-justify-center liq-items-center liq-gap-2",children:[s.jsx("div",{children:o.isConnecting?"Connecting...":"Connect"}),s.jsx("img",{src:e==null?void 0:e.pngUrl,alt:"",className:"liq-w-4 liq-h-4 liq-rounded-sm"}),s.jsx("div",{className:"liq-truncate md:liq-text-clip",children:i.getDisplayName(e)})]})})})};exports.BridgeAccountDisplay=k;
|
|
@@ -2,16 +2,16 @@ import { jsxs as r, Fragment as x, jsx as e } from "react/jsx-runtime";
|
|
|
2
2
|
import { faPowerOff as g } from "@fortawesome/free-solid-svg-icons/faPowerOff";
|
|
3
3
|
import { FontAwesomeIcon as y } from "@fortawesome/react-fontawesome";
|
|
4
4
|
import { useDisconnect as N } from "@reown/appkit/react";
|
|
5
|
-
import { getDisplayName as
|
|
5
|
+
import { getDisplayName as o } from "../../../helpers/getDisplayName.mjs";
|
|
6
6
|
import { SwitchChainButton as b } from "./SwitchChainButton.mjs";
|
|
7
|
-
import { ChainType as
|
|
7
|
+
import { ChainType as t } from "../../../types/chainType.mjs";
|
|
8
8
|
import { useAccount as w } from "../../hooks/useAccount.mjs";
|
|
9
|
-
import { useNamespaceAddress as
|
|
10
|
-
import { useSuiConnect as
|
|
9
|
+
import { useNamespaceAddress as T } from "../../hooks/useNamespaceAddress.mjs";
|
|
10
|
+
import { useSuiConnect as k } from "../../hooks/useSuiConnect.mjs";
|
|
11
11
|
import "clsx";
|
|
12
12
|
import "tailwind-merge";
|
|
13
13
|
import "../base/MxCard/MxCard.mjs";
|
|
14
|
-
import { MxLink as
|
|
14
|
+
import { MxLink as A } from "../base/MxLink/MxLink.mjs";
|
|
15
15
|
import "../base/MxSearch/MxSearch.mjs";
|
|
16
16
|
import "@fortawesome/free-solid-svg-icons/faClose";
|
|
17
17
|
import "@headlessui/react";
|
|
@@ -26,10 +26,10 @@ const v = ({
|
|
|
26
26
|
activeChain: l,
|
|
27
27
|
disabled: n
|
|
28
28
|
}) => {
|
|
29
|
-
var
|
|
30
|
-
const m = w(), { disconnect: p } = N(), i =
|
|
29
|
+
var c;
|
|
30
|
+
const m = w(), { disconnect: p } = N(), i = k(), d = T(l == null ? void 0 : l.chainType), q = (l == null ? void 0 : l.chainType) === t.sui, s = (l == null ? void 0 : l.chainType) === t.evm || (l == null ? void 0 : l.chainType) === t.sui ? d : d ?? m.address, u = async (a) => {
|
|
31
31
|
try {
|
|
32
|
-
|
|
32
|
+
a.preventDefault(), q ? await i.disconnect() : await p();
|
|
33
33
|
} catch (f) {
|
|
34
34
|
console.error("Failed to disconnect:", f);
|
|
35
35
|
}
|
|
@@ -43,13 +43,13 @@ const v = ({
|
|
|
43
43
|
className: "liq-w-6 liq-h-6 liq-rounded-lg"
|
|
44
44
|
}
|
|
45
45
|
),
|
|
46
|
-
/* @__PURE__ */ e("span", { className: "liq-truncate liq-text-gray-400", children:
|
|
46
|
+
/* @__PURE__ */ e("span", { className: "liq-truncate liq-text-gray-400", children: o(l) }),
|
|
47
47
|
/* @__PURE__ */ e("span", { className: "liq-ml-[-5px]", children: ":" }),
|
|
48
48
|
/* @__PURE__ */ e("div", { className: "liq-flex liq-items-center liq-justify-between", children: /* @__PURE__ */ r("div", { className: "liq-flex liq-max-w-[10rem] liq-items-center liq-gap-1", children: [
|
|
49
49
|
/* @__PURE__ */ e(
|
|
50
|
-
|
|
50
|
+
A,
|
|
51
51
|
{
|
|
52
|
-
to: `${(
|
|
52
|
+
to: `${(c = l == null ? void 0 : l.blockExplorerUrls) == null ? void 0 : c[0]}/address/${s}`,
|
|
53
53
|
target: "_blank",
|
|
54
54
|
showExternalIcon: !1,
|
|
55
55
|
className: "!liq-relative",
|
|
@@ -75,12 +75,12 @@ const v = ({
|
|
|
75
75
|
"button",
|
|
76
76
|
{
|
|
77
77
|
className: "focus-primary liq-flex liq-items-center liq-gap-1 liq-rounded-xl liq-px-0 liq-py-2 liq-text-sm liq-font-semibold liq-text-neutral-400 liq-transition-colors liq-duration-200 hover:enabled:liq-text-white disabled:liq-opacity-50",
|
|
78
|
-
onClick:
|
|
78
|
+
onClick: u,
|
|
79
79
|
"data-testid": "evm-disconnect-button",
|
|
80
80
|
children: /* @__PURE__ */ e(y, { icon: g })
|
|
81
81
|
}
|
|
82
82
|
) })
|
|
83
|
-
] }) :
|
|
83
|
+
] }) : q ? /* @__PURE__ */ r("div", { className: "liq-flex liq-max-w-full liq-items-center liq-gap-2", children: [
|
|
84
84
|
/* @__PURE__ */ e(
|
|
85
85
|
"button",
|
|
86
86
|
{
|
|
@@ -97,7 +97,7 @@ const v = ({
|
|
|
97
97
|
className: "liq-w-4 liq-h-4 liq-rounded-sm"
|
|
98
98
|
}
|
|
99
99
|
),
|
|
100
|
-
/* @__PURE__ */ e("div", { className: "liq-truncate md:liq-text-clip", children:
|
|
100
|
+
/* @__PURE__ */ e("div", { className: "liq-truncate md:liq-text-clip", children: o(l) })
|
|
101
101
|
] }) })
|
|
102
102
|
}
|
|
103
103
|
),
|
|
@@ -114,6 +114,7 @@ const v = ({
|
|
|
114
114
|
b,
|
|
115
115
|
{
|
|
116
116
|
disabled: n,
|
|
117
|
+
chainType: l == null ? void 0 : l.chainType,
|
|
117
118
|
className: "liq-rounded-lg liq-font-semibold liq-transition-colors liq-duration-200 disabled:liq-opacity-50 liq-bg-neutral-750 !liq-text-primary-200 hover:enabled:liq-bg-primary liq-px-2",
|
|
118
119
|
children: /* @__PURE__ */ e("div", { className: "liq-flex liq-items-center", children: /* @__PURE__ */ r("div", { className: "liq-flex liq-justify-center liq-items-center liq-gap-2", children: [
|
|
119
120
|
/* @__PURE__ */ e("div", { children: m.isConnecting ? "Connecting..." : "Connect" }),
|
|
@@ -125,7 +126,7 @@ const v = ({
|
|
|
125
126
|
className: "liq-w-4 liq-h-4 liq-rounded-sm"
|
|
126
127
|
}
|
|
127
128
|
),
|
|
128
|
-
/* @__PURE__ */ e("div", { className: "liq-truncate md:liq-text-clip", children:
|
|
129
|
+
/* @__PURE__ */ e("div", { className: "liq-truncate md:liq-text-clip", children: o(l) })
|
|
129
130
|
] }) })
|
|
130
131
|
}
|
|
131
132
|
);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),o=require("./CustomConnectButton.js"),i=require("../../../helpers/getDisplayName.js"),c=require("../../../helpers/safeImageUrl.js");require("@solana/web3.js");require("bitcoinjs-lib");require("viem");const r=require("../../../types/chainType.js"),u=require("../../hooks/useAccount.js"),m=e=>{if(e===r.ChainType.evm)return"eip155";if(e===r.ChainType.sui)return"sui"},q=({activeChain:e,disabled:t,className:l})=>{const s=u.useAccount();return n.jsx(o.CustomConnectButton,{className:l,disabled:t,namespace:m(e==null?void 0:e.chainType),"data-testid":"evm-network-connect-button",children:s.isConnected?null:n.jsxs("div",{className:"liq-flex liq-items-center liq-justify-center liq-gap-1",children:[!s.isConnected&&n.jsx("div",{className:"liq-ml-2 liq-flex liq-items-center liq-gap-1",children:n.jsx("span",{className:"liq-text-primary-200",children:s.isConnecting?"Connecting...":"Connect"})}),e&&n.jsx("img",{src:c.safeImageUrl(e.pngUrl),alt:"",className:"liq-z-10 liq-flex liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg"}),(e==null?void 0:e.networkName)&&n.jsx("span",{className:"liq-inline liq-truncate",children:i.getDisplayName(e)})]})})};exports.BridgeConnectButton=q;
|
|
@@ -1,38 +1,45 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { CustomConnectButton as
|
|
3
|
-
import { getDisplayName as
|
|
4
|
-
import { safeImageUrl as
|
|
1
|
+
import { jsx as r, jsxs as m } from "react/jsx-runtime";
|
|
2
|
+
import { CustomConnectButton as s } from "./CustomConnectButton.mjs";
|
|
3
|
+
import { getDisplayName as i } from "../../../helpers/getDisplayName.mjs";
|
|
4
|
+
import { safeImageUrl as c } from "../../../helpers/safeImageUrl.mjs";
|
|
5
5
|
import "@solana/web3.js";
|
|
6
6
|
import "bitcoinjs-lib";
|
|
7
7
|
import "viem";
|
|
8
|
-
import {
|
|
9
|
-
|
|
8
|
+
import { ChainType as t } from "../../../types/chainType.mjs";
|
|
9
|
+
import { useAccount as p } from "../../hooks/useAccount.mjs";
|
|
10
|
+
const u = (e) => {
|
|
11
|
+
if (e === t.evm)
|
|
12
|
+
return "eip155";
|
|
13
|
+
if (e === t.sui)
|
|
14
|
+
return "sui";
|
|
15
|
+
}, w = ({
|
|
10
16
|
activeChain: e,
|
|
11
|
-
disabled:
|
|
12
|
-
className:
|
|
17
|
+
disabled: l,
|
|
18
|
+
className: o
|
|
13
19
|
}) => {
|
|
14
|
-
const
|
|
15
|
-
return /* @__PURE__ */
|
|
16
|
-
|
|
20
|
+
const n = p();
|
|
21
|
+
return /* @__PURE__ */ r(
|
|
22
|
+
s,
|
|
17
23
|
{
|
|
18
|
-
className:
|
|
19
|
-
disabled:
|
|
24
|
+
className: o,
|
|
25
|
+
disabled: l,
|
|
26
|
+
namespace: u(e == null ? void 0 : e.chainType),
|
|
20
27
|
"data-testid": "evm-network-connect-button",
|
|
21
|
-
children:
|
|
22
|
-
!
|
|
23
|
-
e && /* @__PURE__ */
|
|
28
|
+
children: n.isConnected ? null : /* @__PURE__ */ m("div", { className: "liq-flex liq-items-center liq-justify-center liq-gap-1", children: [
|
|
29
|
+
!n.isConnected && /* @__PURE__ */ r("div", { className: "liq-ml-2 liq-flex liq-items-center liq-gap-1", children: /* @__PURE__ */ r("span", { className: "liq-text-primary-200", children: n.isConnecting ? "Connecting..." : "Connect" }) }),
|
|
30
|
+
e && /* @__PURE__ */ r(
|
|
24
31
|
"img",
|
|
25
32
|
{
|
|
26
|
-
src:
|
|
33
|
+
src: c(e.pngUrl),
|
|
27
34
|
alt: "",
|
|
28
35
|
className: "liq-z-10 liq-flex liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg"
|
|
29
36
|
}
|
|
30
37
|
),
|
|
31
|
-
(e == null ? void 0 : e.networkName) && /* @__PURE__ */
|
|
38
|
+
(e == null ? void 0 : e.networkName) && /* @__PURE__ */ r("span", { className: "liq-inline liq-truncate", children: i(e) })
|
|
32
39
|
] })
|
|
33
40
|
}
|
|
34
41
|
);
|
|
35
42
|
};
|
|
36
43
|
export {
|
|
37
|
-
|
|
44
|
+
w as BridgeConnectButton
|
|
38
45
|
};
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { ChainNamespace } from '@reown/appkit-common';
|
|
2
3
|
|
|
3
|
-
export declare const CustomConnectButton: ({ disabled, className, children, "data-testid": dataTestId }: {
|
|
4
|
+
export declare const CustomConnectButton: ({ disabled, className, children, namespace, "data-testid": dataTestId }: {
|
|
4
5
|
disabled?: boolean;
|
|
5
6
|
className?: string;
|
|
6
7
|
children?: ReactNode;
|
|
8
|
+
/** AppKit namespace to restrict the WC session proposal (e.g. 'eip155'). */
|
|
9
|
+
namespace?: ChainNamespace;
|
|
7
10
|
"data-testid"?: string;
|
|
8
11
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),a=require("@reown/appkit/react"),s=require("wagmi"),b=({disabled:t,className:n,children:e,namespace:o,"data-testid":u})=>{const{open:r}=a.useAppKit(),{isConnected:l,isConnecting:d}=s.useAccount(),{disconnect:C}=s.useDisconnect(),c="liq-font-bold liq-text-inherit liq-rounded-lg";return l?i.jsx("button",{onClick:()=>C(),className:`${c} ${n}`,disabled:t,children:e||"Disconnect"}):i.jsx("button",{"data-testid":u,onClick:()=>r({view:"Connect",...o?{namespace:o}:{}}),className:`${c} ${n}`,disabled:t,children:e||(d?"Trying to connect...":"Connect")})};exports.CustomConnectButton=b;
|
|
@@ -1,34 +1,36 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useAppKit as
|
|
3
|
-
import { useAccount as m, useDisconnect as
|
|
4
|
-
const
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useAppKit as C } from "@reown/appkit/react";
|
|
3
|
+
import { useAccount as m, useDisconnect as p } from "wagmi";
|
|
4
|
+
const b = ({
|
|
5
5
|
disabled: t,
|
|
6
6
|
className: n,
|
|
7
7
|
children: o,
|
|
8
|
-
|
|
8
|
+
namespace: e,
|
|
9
|
+
"data-testid": s
|
|
9
10
|
}) => {
|
|
10
|
-
const { open:
|
|
11
|
-
return
|
|
11
|
+
const { open: r } = C(), { isConnected: u, isConnecting: l } = m(), { disconnect: d } = p(), c = "liq-font-bold liq-text-inherit liq-rounded-lg";
|
|
12
|
+
return u ? /* @__PURE__ */ i(
|
|
12
13
|
"button",
|
|
13
14
|
{
|
|
14
|
-
onClick: () =>
|
|
15
|
-
className: `${
|
|
15
|
+
onClick: () => d(),
|
|
16
|
+
className: `${c} ${n}`,
|
|
16
17
|
disabled: t,
|
|
17
18
|
children: o || "Disconnect"
|
|
18
19
|
}
|
|
19
|
-
) : /* @__PURE__ */
|
|
20
|
+
) : /* @__PURE__ */ i(
|
|
20
21
|
"button",
|
|
21
22
|
{
|
|
22
|
-
"data-testid":
|
|
23
|
-
onClick: () =>
|
|
24
|
-
view: "Connect"
|
|
23
|
+
"data-testid": s,
|
|
24
|
+
onClick: () => r({
|
|
25
|
+
view: "Connect",
|
|
26
|
+
...e ? { namespace: e } : {}
|
|
25
27
|
}),
|
|
26
|
-
className: `${
|
|
28
|
+
className: `${c} ${n}`,
|
|
27
29
|
disabled: t,
|
|
28
|
-
children: o || (
|
|
30
|
+
children: o || (l ? "Trying to connect..." : "Connect")
|
|
29
31
|
}
|
|
30
32
|
);
|
|
31
33
|
};
|
|
32
34
|
export {
|
|
33
|
-
|
|
35
|
+
b as CustomConnectButton
|
|
34
36
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { ChainType } from '../../../types/chainType';
|
|
1
2
|
import { ReactNode } from 'react';
|
|
2
3
|
|
|
3
|
-
export declare const SwitchChainButton: ({ children, className, disabled }: {
|
|
4
|
+
export declare const SwitchChainButton: ({ children, className, disabled, chainType }: {
|
|
4
5
|
children: ReactNode;
|
|
5
6
|
className?: string;
|
|
6
7
|
disabled?: boolean;
|
|
8
|
+
chainType?: ChainType;
|
|
7
9
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime"),n=require("@reown/appkit/react"),t=require("../../../types/chainType.js"),C=({children:c,className:u,disabled:o,chainType:e})=>{const{open:a}=n.useAppKit(),s=n.useAppKitAccount({namespace:"eip155"}),r=n.useAppKitAccount({namespace:"sui"}),i=e===t.ChainType.evm?"eip155":e===t.ChainType.sui?"sui":void 0,p=e===t.ChainType.evm?!!s.address:e===t.ChainType.sui?!!r.address:s.isConnected,l=`liq-font-bold liq-text-white liq-rounded-lg ${o?"liq-cursor-not-allowed":"liq-cursor-pointer"}`;return m.jsx("button",{onClick:d=>{d.preventDefault(),a({view:p?"Networks":"Connect",...i?{namespace:i}:{}})},className:`${l} ${u}`,disabled:o,"data-tesid":"evm-connect-button",children:c})};exports.SwitchChainButton=C;
|
|
@@ -1,26 +1,31 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useAppKit as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { useAppKit as d, useAppKitAccount as c } from "@reown/appkit/react";
|
|
3
|
+
import { ChainType as o } from "../../../types/chainType.mjs";
|
|
4
|
+
const w = ({
|
|
5
|
+
children: i,
|
|
6
|
+
className: r,
|
|
7
|
+
disabled: t,
|
|
8
|
+
chainType: e
|
|
7
9
|
}) => {
|
|
8
|
-
const { open:
|
|
9
|
-
|
|
10
|
+
const { open: a } = d(), n = c({
|
|
11
|
+
namespace: "eip155"
|
|
12
|
+
}), u = c({ namespace: "sui" }), s = e === o.evm ? "eip155" : e === o.sui ? "sui" : void 0, l = e === o.evm ? !!n.address : e === o.sui ? !!u.address : n.isConnected;
|
|
13
|
+
return /* @__PURE__ */ p(
|
|
10
14
|
"button",
|
|
11
15
|
{
|
|
12
|
-
onClick: (
|
|
13
|
-
|
|
14
|
-
view:
|
|
16
|
+
onClick: (m) => {
|
|
17
|
+
m.preventDefault(), a({
|
|
18
|
+
view: l ? "Networks" : "Connect",
|
|
19
|
+
...s ? { namespace: s } : {}
|
|
15
20
|
});
|
|
16
21
|
},
|
|
17
|
-
className: `${`liq-font-bold liq-text-white liq-rounded-lg ${t ? "liq-cursor-not-allowed" : "liq-cursor-pointer"}`} ${
|
|
22
|
+
className: `${`liq-font-bold liq-text-white liq-rounded-lg ${t ? "liq-cursor-not-allowed" : "liq-cursor-pointer"}`} ${r}`,
|
|
18
23
|
disabled: t,
|
|
19
24
|
"data-tesid": "evm-connect-button",
|
|
20
|
-
children:
|
|
25
|
+
children: i
|
|
21
26
|
}
|
|
22
27
|
);
|
|
23
28
|
};
|
|
24
29
|
export {
|
|
25
|
-
|
|
30
|
+
w as SwitchChainButton
|
|
26
31
|
};
|