@multiversx/sdk-dapp-liquidity 2.3.0-alpha.1 → 2.3.0-alpha.3
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/BridgeForm/Deposit.js +1 -1
- package/reactjs/components/BridgeForm/Deposit.mjs +155 -147
- package/reactjs/components/BridgeForm/Transfer.js +1 -1
- package/reactjs/components/BridgeForm/Transfer.mjs +99 -94
- package/reactjs/components/Connect/BridgeAccountDisplay.js +1 -1
- package/reactjs/components/Connect/BridgeAccountDisplay.mjs +59 -58
- package/reactjs/hooks/useDisconnectOnChainTypeChange.d.ts +12 -0
- package/reactjs/hooks/useDisconnectOnChainTypeChange.js +2 -0
- package/reactjs/hooks/useDisconnectOnChainTypeChange.mjs +13 -0
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { faPowerOff as
|
|
3
|
-
import { FontAwesomeIcon as
|
|
4
|
-
import { useDisconnect as
|
|
5
|
-
import { getDisplayName as
|
|
6
|
-
import { SwitchChainButton as
|
|
7
|
-
import { ChainType as
|
|
8
|
-
import { useAccount as
|
|
9
|
-
import {
|
|
1
|
+
import { jsxs as r, Fragment as x, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { faPowerOff as g } from "@fortawesome/free-solid-svg-icons/faPowerOff";
|
|
3
|
+
import { FontAwesomeIcon as y } from "@fortawesome/react-fontawesome";
|
|
4
|
+
import { useDisconnect as N } from "@reown/appkit/react";
|
|
5
|
+
import { getDisplayName as t } from "../../../helpers/getDisplayName.mjs";
|
|
6
|
+
import { SwitchChainButton as b } from "./SwitchChainButton.mjs";
|
|
7
|
+
import { ChainType as o } from "../../../types/chainType.mjs";
|
|
8
|
+
import { useAccount as w } from "../../hooks/useAccount.mjs";
|
|
9
|
+
import { useNamespaceAddress as k } from "../../hooks/useNamespaceAddress.mjs";
|
|
10
|
+
import { useSuiConnect as A } from "../../hooks/useSuiConnect.mjs";
|
|
10
11
|
import "clsx";
|
|
11
12
|
import "tailwind-merge";
|
|
12
13
|
import "../base/MxCard/MxCard.mjs";
|
|
13
|
-
import { MxLink as
|
|
14
|
+
import { MxLink as T } from "../base/MxLink/MxLink.mjs";
|
|
14
15
|
import "../base/MxSearch/MxSearch.mjs";
|
|
15
16
|
import "@fortawesome/free-solid-svg-icons/faClose";
|
|
16
17
|
import "@headlessui/react";
|
|
@@ -19,116 +20,116 @@ import "react-dom";
|
|
|
19
20
|
import "react-popper";
|
|
20
21
|
import "../base/MxTooltip/components/TooltipContainer/TooltipContainer.mjs";
|
|
21
22
|
import "../../constants/index.mjs";
|
|
22
|
-
import { CopyButton as
|
|
23
|
-
import { TrimAddress as
|
|
24
|
-
const
|
|
25
|
-
activeChain:
|
|
26
|
-
disabled:
|
|
23
|
+
import { CopyButton as j } from "../CopyButton/CopyButton.mjs";
|
|
24
|
+
import { TrimAddress as D } from "../TrimAddress/TrimAddress.mjs";
|
|
25
|
+
const v = ({
|
|
26
|
+
activeChain: l,
|
|
27
|
+
disabled: n
|
|
27
28
|
}) => {
|
|
28
|
-
var
|
|
29
|
-
const m =
|
|
29
|
+
var q;
|
|
30
|
+
const m = w(), { disconnect: p } = N(), i = A(), d = k(l == null ? void 0 : l.chainType), c = (l == null ? void 0 : l.chainType) === o.sui, s = (l == null ? void 0 : l.chainType) === o.evm || (l == null ? void 0 : l.chainType) === o.sui ? d : d ?? m.address, a = async (u) => {
|
|
30
31
|
try {
|
|
31
|
-
|
|
32
|
-
} catch (
|
|
33
|
-
console.error("Failed to disconnect:",
|
|
32
|
+
u.preventDefault(), c ? await i.disconnect() : await p();
|
|
33
|
+
} catch (f) {
|
|
34
|
+
console.error("Failed to disconnect:", f);
|
|
34
35
|
}
|
|
35
36
|
};
|
|
36
|
-
return
|
|
37
|
-
/* @__PURE__ */
|
|
37
|
+
return s ? /* @__PURE__ */ r(x, { children: [
|
|
38
|
+
/* @__PURE__ */ e(
|
|
38
39
|
"img",
|
|
39
40
|
{
|
|
40
|
-
src:
|
|
41
|
+
src: l == null ? void 0 : l.pngUrl,
|
|
41
42
|
alt: "",
|
|
42
43
|
className: "liq-w-6 liq-h-6 liq-rounded-lg"
|
|
43
44
|
}
|
|
44
45
|
),
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
/* @__PURE__ */
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
|
|
46
|
+
/* @__PURE__ */ e("span", { className: "liq-truncate liq-text-gray-400", children: t(l) }),
|
|
47
|
+
/* @__PURE__ */ e("span", { className: "liq-ml-[-5px]", children: ":" }),
|
|
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
|
+
/* @__PURE__ */ e(
|
|
50
|
+
T,
|
|
50
51
|
{
|
|
51
|
-
to: `${(
|
|
52
|
+
to: `${(q = l == null ? void 0 : l.blockExplorerUrls) == null ? void 0 : q[0]}/address/${s}`,
|
|
52
53
|
target: "_blank",
|
|
53
54
|
showExternalIcon: !1,
|
|
54
55
|
className: "!liq-relative",
|
|
55
|
-
children: /* @__PURE__ */
|
|
56
|
-
|
|
56
|
+
children: /* @__PURE__ */ e("div", { className: "liq-flex liq-min-w-0 liq-flex-grow liq-overflow-hidden liq-leading-none liq-max-w-[10rem]", children: /* @__PURE__ */ e(
|
|
57
|
+
D,
|
|
57
58
|
{
|
|
58
|
-
address:
|
|
59
|
+
address: s,
|
|
59
60
|
"data-testid": "evm-address"
|
|
60
61
|
}
|
|
61
62
|
) })
|
|
62
63
|
}
|
|
63
64
|
),
|
|
64
|
-
/* @__PURE__ */
|
|
65
|
-
|
|
65
|
+
/* @__PURE__ */ e(
|
|
66
|
+
j,
|
|
66
67
|
{
|
|
67
|
-
text:
|
|
68
|
+
text: s,
|
|
68
69
|
className: "liq-text-sm",
|
|
69
70
|
"data-testid": "evm-copy-button"
|
|
70
71
|
}
|
|
71
72
|
)
|
|
72
73
|
] }) }),
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
+
/* @__PURE__ */ e("div", { className: "liq-ml-auto liq-mr-0 liq-flex liq-items-center liq-gap-1", children: /* @__PURE__ */ e(
|
|
74
75
|
"button",
|
|
75
76
|
{
|
|
76
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",
|
|
77
|
-
onClick:
|
|
78
|
+
onClick: a,
|
|
78
79
|
"data-testid": "evm-disconnect-button",
|
|
79
|
-
children: /* @__PURE__ */
|
|
80
|
+
children: /* @__PURE__ */ e(y, { icon: g })
|
|
80
81
|
}
|
|
81
82
|
) })
|
|
82
|
-
] }) :
|
|
83
|
-
/* @__PURE__ */
|
|
83
|
+
] }) : c ? /* @__PURE__ */ r("div", { className: "liq-flex liq-max-w-full liq-items-center liq-gap-2", children: [
|
|
84
|
+
/* @__PURE__ */ e(
|
|
84
85
|
"button",
|
|
85
86
|
{
|
|
86
|
-
disabled:
|
|
87
|
-
onClick: () =>
|
|
87
|
+
disabled: n || i.isConnecting,
|
|
88
|
+
onClick: () => i.connect(),
|
|
88
89
|
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",
|
|
89
|
-
children: /* @__PURE__ */
|
|
90
|
-
/* @__PURE__ */
|
|
91
|
-
/* @__PURE__ */
|
|
90
|
+
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: [
|
|
91
|
+
/* @__PURE__ */ e("div", { children: i.isConnecting ? "Connecting..." : "Connect" }),
|
|
92
|
+
/* @__PURE__ */ e(
|
|
92
93
|
"img",
|
|
93
94
|
{
|
|
94
|
-
src:
|
|
95
|
+
src: l == null ? void 0 : l.pngUrl,
|
|
95
96
|
alt: "",
|
|
96
97
|
className: "liq-w-4 liq-h-4 liq-rounded-sm"
|
|
97
98
|
}
|
|
98
99
|
),
|
|
99
|
-
/* @__PURE__ */
|
|
100
|
+
/* @__PURE__ */ e("div", { className: "liq-truncate md:liq-text-clip", children: t(l) })
|
|
100
101
|
] }) })
|
|
101
102
|
}
|
|
102
103
|
),
|
|
103
|
-
|
|
104
|
+
i.isConnecting && /* @__PURE__ */ e(
|
|
104
105
|
"button",
|
|
105
106
|
{
|
|
106
107
|
type: "button",
|
|
107
|
-
onClick: () => void
|
|
108
|
+
onClick: () => void i.cancelPendingConnection(),
|
|
108
109
|
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",
|
|
109
110
|
children: "Cancel"
|
|
110
111
|
}
|
|
111
112
|
)
|
|
112
|
-
] }) : /* @__PURE__ */
|
|
113
|
-
|
|
113
|
+
] }) : /* @__PURE__ */ e(
|
|
114
|
+
b,
|
|
114
115
|
{
|
|
115
|
-
disabled:
|
|
116
|
+
disabled: n,
|
|
116
117
|
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",
|
|
117
|
-
children: /* @__PURE__ */
|
|
118
|
-
/* @__PURE__ */
|
|
119
|
-
/* @__PURE__ */
|
|
118
|
+
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
|
+
/* @__PURE__ */ e("div", { children: m.isConnecting ? "Connecting..." : "Connect" }),
|
|
120
|
+
/* @__PURE__ */ e(
|
|
120
121
|
"img",
|
|
121
122
|
{
|
|
122
|
-
src:
|
|
123
|
+
src: l == null ? void 0 : l.pngUrl,
|
|
123
124
|
alt: "",
|
|
124
125
|
className: "liq-w-4 liq-h-4 liq-rounded-sm"
|
|
125
126
|
}
|
|
126
127
|
),
|
|
127
|
-
/* @__PURE__ */
|
|
128
|
+
/* @__PURE__ */ e("div", { className: "liq-truncate md:liq-text-clip", children: t(l) })
|
|
128
129
|
] }) })
|
|
129
130
|
}
|
|
130
131
|
);
|
|
131
132
|
};
|
|
132
133
|
export {
|
|
133
|
-
|
|
134
|
+
v as BridgeAccountDisplay
|
|
134
135
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ChainType } from '../../types/chainType';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Disconnects the previous chain namespace when the active chain type changes.
|
|
5
|
+
*
|
|
6
|
+
* This covers all paths that can change the chain type (token selection, direction
|
|
7
|
+
* toggle, etc.) and prevents stale SUI sessions from lingering after switching to
|
|
8
|
+
* EVM (and vice-versa) in mobile dapp browsers.
|
|
9
|
+
*
|
|
10
|
+
* Only reacts to genuine transitions — skips the initial undefined→value mount.
|
|
11
|
+
*/
|
|
12
|
+
export declare function useDisconnectOnChainTypeChange(chainType: ChainType | undefined): void;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@reown/appkit/react"),s=require("react"),c=require("../../types/chainType.js");function r(n){const{disconnect:i}=o.useDisconnect(),t=s.useRef(void 0);s.useEffect(()=>{const e=t.current;t.current=n,!(e===void 0||e===n)&&(e===c.ChainType.sui?i({namespace:"sui"}):e===c.ChainType.evm&&i())},[n])}exports.useDisconnectOnChainTypeChange=r;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useDisconnect as t } from "@reown/appkit/react";
|
|
2
|
+
import { useRef as s, useEffect as c } from "react";
|
|
3
|
+
import { ChainType as r } from "../../types/chainType.mjs";
|
|
4
|
+
function p(n) {
|
|
5
|
+
const { disconnect: o } = t(), i = s(void 0);
|
|
6
|
+
c(() => {
|
|
7
|
+
const e = i.current;
|
|
8
|
+
i.current = n, !(e === void 0 || e === n) && (e === r.sui ? o({ namespace: "sui" }) : e === r.evm && o());
|
|
9
|
+
}, [n]);
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
p as useDisconnectOnChainTypeChange
|
|
13
|
+
};
|