@multiversx/sdk-dapp-liquidity 1.1.7 → 2.0.0-alpha.0
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/index.js +7 -0
- package/index.mjs +8 -1
- package/package.json +19 -16
- package/reactjs/adapters/SuiAdapter.d.ts +60 -0
- package/reactjs/adapters/SuiAdapter.js +350 -0
- package/reactjs/adapters/SuiAdapter.mjs +349 -0
- package/reactjs/components/AmountInput/AmountInput.js +1 -1
- package/reactjs/components/AmountInput/AmountInput.mjs +1 -1
- package/reactjs/components/BridgeForm/Deposit.js +57 -18
- package/reactjs/components/BridgeForm/Deposit.mjs +57 -18
- package/reactjs/components/BridgeForm/Transfer.js +17 -10
- package/reactjs/components/BridgeForm/Transfer.mjs +17 -10
- package/reactjs/components/BridgeForm/hooks/useBridgeTokenSelection.js +31 -9
- package/reactjs/components/BridgeForm/hooks/useBridgeTokenSelection.mjs +31 -9
- package/reactjs/components/BridgeForm/utils/bridgeFormHelpers.d.ts +6 -0
- package/reactjs/components/BridgeForm/utils/bridgeFormHelpers.js +18 -0
- package/reactjs/components/BridgeForm/utils/bridgeFormHelpers.mjs +18 -0
- package/reactjs/components/BridgeHistory/BridgeHistory.js +2 -2
- package/reactjs/components/BridgeHistory/BridgeHistory.mjs +2 -2
- package/reactjs/components/Connect/BridgeAccountDisplay.js +77 -25
- package/reactjs/components/Connect/BridgeAccountDisplay.mjs +77 -25
- package/reactjs/components/Connect/BridgeConnectButton.js +1 -1
- package/reactjs/components/Connect/BridgeConnectButton.mjs +1 -1
- package/reactjs/components/Connect/ChainSelectConnect.d.ts +7 -0
- package/reactjs/components/Connect/ChainSelectConnect.js +144 -0
- package/reactjs/components/Connect/ChainSelectConnect.mjs +143 -0
- package/reactjs/components/Connect/MvxAccountDisplay.js +17 -3
- package/reactjs/components/Connect/MvxAccountDisplay.mjs +17 -3
- package/reactjs/components/Connect/MvxConnectButton.js +2 -2
- package/reactjs/components/Connect/MvxConnectButton.mjs +2 -2
- package/reactjs/components/Connect/index.d.ts +1 -0
- package/reactjs/components/Connect/index.js +2 -0
- package/reactjs/components/Connect/index.mjs +2 -0
- package/reactjs/components/TokenSelector/components/TokenItem.js +11 -1
- package/reactjs/components/TokenSelector/components/TokenItem.mjs +11 -1
- package/reactjs/components/TrimAddress/TrimAddress.js +1 -1
- package/reactjs/components/TrimAddress/TrimAddress.mjs +1 -1
- package/reactjs/components/index.js +2 -0
- package/reactjs/components/index.mjs +2 -0
- package/reactjs/constants/chains.d.ts +7 -1
- package/reactjs/constants/chains.js +6 -0
- package/reactjs/constants/chains.mjs +6 -0
- package/reactjs/helpers/index.d.ts +1 -0
- package/reactjs/helpers/index.js +7 -0
- package/reactjs/helpers/index.mjs +6 -0
- package/reactjs/helpers/resolveBridgeApiChainId.d.ts +18 -0
- package/reactjs/helpers/resolveBridgeApiChainId.js +41 -0
- package/reactjs/helpers/resolveBridgeApiChainId.mjs +40 -0
- package/reactjs/hooks/index.d.ts +2 -0
- package/reactjs/hooks/index.js +4 -0
- package/reactjs/hooks/index.mjs +4 -0
- package/reactjs/hooks/useBridgeApiChainId.d.ts +2 -0
- package/reactjs/hooks/useBridgeApiChainId.js +14 -0
- package/reactjs/hooks/useBridgeApiChainId.mjs +13 -0
- package/reactjs/hooks/useFetchTokens.js +17 -17
- package/reactjs/hooks/useFetchTokens.mjs +17 -17
- package/reactjs/hooks/useGenericSignMessage.d.ts +1 -1
- package/reactjs/hooks/useGenericSignMessage.js +14 -0
- package/reactjs/hooks/useGenericSignMessage.mjs +14 -0
- package/reactjs/hooks/useSignTransaction.d.ts +418 -3
- package/reactjs/hooks/useSignTransaction.js +28 -0
- package/reactjs/hooks/useSignTransaction.mjs +28 -0
- package/reactjs/hooks/useSuiConnect.d.ts +8 -0
- package/reactjs/hooks/useSuiConnect.js +87 -0
- package/reactjs/hooks/useSuiConnect.mjs +86 -0
- package/reactjs/index.js +7 -0
- package/reactjs/index.mjs +8 -1
- package/reactjs/init/index.js +1 -0
- package/reactjs/init/index.mjs +2 -1
- package/reactjs/init/init.d.ts +9 -30
- package/reactjs/init/init.js +90 -9
- package/reactjs/init/init.mjs +91 -10
- package/reactjs/queries/useCheckAccount.query.js +4 -14
- package/reactjs/queries/useCheckAccount.query.mjs +4 -14
- package/reactjs/queries/useGetNonMvxTokensBalances.query.js +1 -0
- package/reactjs/queries/useGetNonMvxTokensBalances.query.mjs +1 -0
- package/style.css +51 -0
- package/types/chainType.d.ts +2 -1
- package/types/chainType.js +1 -0
- package/types/chainType.mjs +1 -0
- package/types/transaction.d.ts +5 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ChainType } from "../../../../types/chainType.mjs";
|
|
1
2
|
import { safeWindow } from "../../../constants/index.mjs";
|
|
2
3
|
import { getCompletePathname } from "../../../utils/getCompletePathname.mjs";
|
|
3
4
|
const updateUrlParams = ({
|
|
@@ -24,6 +25,22 @@ const updateUrlParams = ({
|
|
|
24
25
|
}
|
|
25
26
|
onNavigate == null ? void 0 : onNavigate(newUrl, { replace: true });
|
|
26
27
|
};
|
|
28
|
+
function resolveSigningChainType(transaction, fallbackChain) {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
if (((_a = transaction.suiParams) == null ? void 0 : _a.transactionBytes) && ((_b = transaction.suiParams) == null ? void 0 : _b.sender)) {
|
|
31
|
+
return ChainType.sui;
|
|
32
|
+
}
|
|
33
|
+
if (transaction.instructions && transaction.feePayer) {
|
|
34
|
+
return ChainType.sol;
|
|
35
|
+
}
|
|
36
|
+
if (transaction.bitcoinParams) {
|
|
37
|
+
return ChainType.btc;
|
|
38
|
+
}
|
|
39
|
+
if (transaction.to && transaction.data !== void 0) {
|
|
40
|
+
return ChainType.evm;
|
|
41
|
+
}
|
|
42
|
+
return fallbackChain == null ? void 0 : fallbackChain.chainType;
|
|
43
|
+
}
|
|
27
44
|
const getAvailableTokens = (option, targetTokens, forcedDestinationTokenSymbol) => {
|
|
28
45
|
if (forcedDestinationTokenSymbol) {
|
|
29
46
|
const forcedToken = targetTokens == null ? void 0 : targetTokens.find(
|
|
@@ -54,5 +71,6 @@ const getDefaultReceivingToken = (values, fallbackTokens) => {
|
|
|
54
71
|
export {
|
|
55
72
|
getAvailableTokens,
|
|
56
73
|
getDefaultReceivingToken,
|
|
74
|
+
resolveSigningChainType,
|
|
57
75
|
updateUrlParams
|
|
58
76
|
};
|
|
@@ -216,7 +216,7 @@ const BridgeHistory = ({
|
|
|
216
216
|
{
|
|
217
217
|
src: (_c = tokensMap[transaction.tokenDestination]) == null ? void 0 : _c.pngUrl,
|
|
218
218
|
alt: "",
|
|
219
|
-
className: "liq-h-[1.5rem] liq-w-[1.5rem]"
|
|
219
|
+
className: "liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg"
|
|
220
220
|
}
|
|
221
221
|
),
|
|
222
222
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "liq-whitespace-nowrap", children: "from" }),
|
|
@@ -272,7 +272,7 @@ const BridgeHistory = ({
|
|
|
272
272
|
{
|
|
273
273
|
src: (_j = tokensMap[transaction.tokenSource]) == null ? void 0 : _j.pngUrl,
|
|
274
274
|
alt: "",
|
|
275
|
-
className: "liq-h-[1.5rem] liq-w-[1.5rem]"
|
|
275
|
+
className: "liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg"
|
|
276
276
|
}
|
|
277
277
|
),
|
|
278
278
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "liq-whitespace-nowrap", children: "to" }),
|
|
@@ -213,7 +213,7 @@ const BridgeHistory = ({
|
|
|
213
213
|
{
|
|
214
214
|
src: (_c = tokensMap[transaction.tokenDestination]) == null ? void 0 : _c.pngUrl,
|
|
215
215
|
alt: "",
|
|
216
|
-
className: "liq-h-[1.5rem] liq-w-[1.5rem]"
|
|
216
|
+
className: "liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg"
|
|
217
217
|
}
|
|
218
218
|
),
|
|
219
219
|
/* @__PURE__ */ jsx("span", { className: "liq-whitespace-nowrap", children: "from" }),
|
|
@@ -269,7 +269,7 @@ const BridgeHistory = ({
|
|
|
269
269
|
{
|
|
270
270
|
src: (_j = tokensMap[transaction.tokenSource]) == null ? void 0 : _j.pngUrl,
|
|
271
271
|
alt: "",
|
|
272
|
-
className: "liq-h-[1.5rem] liq-w-[1.5rem]"
|
|
272
|
+
className: "liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg"
|
|
273
273
|
}
|
|
274
274
|
),
|
|
275
275
|
/* @__PURE__ */ jsx("span", { className: "liq-whitespace-nowrap", children: "to" }),
|
|
@@ -7,7 +7,9 @@ const reactFontawesome = require("@fortawesome/react-fontawesome");
|
|
|
7
7
|
const react = require("@reown/appkit/react");
|
|
8
8
|
const helpers_getDisplayName = require("../../../helpers/getDisplayName.js");
|
|
9
9
|
const reactjs_components_Connect_SwitchChainButton = require("./SwitchChainButton.js");
|
|
10
|
+
const types_chainType = require("../../../types/chainType.js");
|
|
10
11
|
const reactjs_hooks_useAccount = require("../../hooks/useAccount.js");
|
|
12
|
+
const reactjs_hooks_useSuiConnect = require("../../hooks/useSuiConnect.js");
|
|
11
13
|
require("clsx");
|
|
12
14
|
require("tailwind-merge");
|
|
13
15
|
require("../base/MxCard/MxCard.js");
|
|
@@ -29,31 +31,45 @@ const BridgeAccountDisplay = ({
|
|
|
29
31
|
var _a;
|
|
30
32
|
const account = reactjs_hooks_useAccount.useAccount();
|
|
31
33
|
const { disconnect } = react.useDisconnect();
|
|
34
|
+
const suiConnect = reactjs_hooks_useSuiConnect.useSuiConnect();
|
|
35
|
+
const isSuiChain = (activeChain == null ? void 0 : activeChain.chainType) === types_chainType.ChainType.sui;
|
|
36
|
+
const displayAddress = isSuiChain ? suiConnect.suiAddress : account.address;
|
|
32
37
|
const handleDisconnect = async (e) => {
|
|
33
38
|
try {
|
|
34
39
|
e.preventDefault();
|
|
35
|
-
|
|
40
|
+
if (isSuiChain) {
|
|
41
|
+
await suiConnect.disconnect();
|
|
42
|
+
} else {
|
|
43
|
+
await disconnect();
|
|
44
|
+
}
|
|
36
45
|
} catch (error) {
|
|
37
46
|
console.error("Failed to disconnect:", error);
|
|
38
47
|
}
|
|
39
48
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
49
|
+
if (displayAddress) {
|
|
50
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
51
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
52
|
+
"img",
|
|
53
|
+
{
|
|
54
|
+
src: activeChain == null ? void 0 : activeChain.pngUrl,
|
|
55
|
+
alt: "",
|
|
56
|
+
className: "liq-w-6 liq-h-6 liq-rounded-lg"
|
|
57
|
+
}
|
|
58
|
+
),
|
|
43
59
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "liq-truncate liq-text-gray-400", children: helpers_getDisplayName.getDisplayName(activeChain) }),
|
|
44
60
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "liq-ml-[-5px]", children: ":" }),
|
|
45
61
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-flex liq-items-center liq-justify-between", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liq-flex liq-max-w-[10rem] liq-items-center liq-gap-1", children: [
|
|
46
62
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
47
63
|
reactjs_components_base_MxLink_MxLink.MxLink,
|
|
48
64
|
{
|
|
49
|
-
to: `${(_a = activeChain == null ? void 0 : activeChain.blockExplorerUrls) == null ? void 0 : _a[0]}/address/${
|
|
65
|
+
to: `${(_a = activeChain == null ? void 0 : activeChain.blockExplorerUrls) == null ? void 0 : _a[0]}/address/${displayAddress}`,
|
|
50
66
|
target: "_blank",
|
|
51
67
|
showExternalIcon: false,
|
|
52
68
|
className: "!liq-relative",
|
|
53
69
|
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-flex liq-min-w-0 liq-flex-grow liq-overflow-hidden liq-leading-none liq-max-w-[10rem]", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
54
70
|
reactjs_components_TrimAddress_TrimAddress.TrimAddress,
|
|
55
71
|
{
|
|
56
|
-
address:
|
|
72
|
+
address: displayAddress,
|
|
57
73
|
"data-testid": "evm-address"
|
|
58
74
|
}
|
|
59
75
|
) })
|
|
@@ -62,7 +78,7 @@ const BridgeAccountDisplay = ({
|
|
|
62
78
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
63
79
|
reactjs_components_CopyButton_CopyButton.CopyButton,
|
|
64
80
|
{
|
|
65
|
-
text:
|
|
81
|
+
text: displayAddress,
|
|
66
82
|
className: "liq-text-sm",
|
|
67
83
|
"data-testid": "evm-copy-button"
|
|
68
84
|
}
|
|
@@ -77,23 +93,59 @@ const BridgeAccountDisplay = ({
|
|
|
77
93
|
children: /* @__PURE__ */ jsxRuntime.jsx(reactFontawesome.FontAwesomeIcon, { icon: faPowerOff.faPowerOff })
|
|
78
94
|
}
|
|
79
95
|
) })
|
|
80
|
-
] })
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
] });
|
|
97
|
+
}
|
|
98
|
+
if (isSuiChain) {
|
|
99
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liq-flex liq-max-w-full liq-items-center liq-gap-2", children: [
|
|
100
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
101
|
+
"button",
|
|
102
|
+
{
|
|
103
|
+
disabled: disabled || suiConnect.isConnecting,
|
|
104
|
+
onClick: () => suiConnect.connect(),
|
|
105
|
+
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",
|
|
106
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-flex liq-items-center", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liq-flex liq-justify-center liq-items-center liq-gap-2", children: [
|
|
107
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children: suiConnect.isConnecting ? "Connecting..." : "Connect" }),
|
|
108
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
109
|
+
"img",
|
|
110
|
+
{
|
|
111
|
+
src: activeChain == null ? void 0 : activeChain.pngUrl,
|
|
112
|
+
alt: "",
|
|
113
|
+
className: "liq-w-4 liq-h-4 liq-rounded-sm"
|
|
114
|
+
}
|
|
115
|
+
),
|
|
116
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-truncate md:liq-text-clip", children: helpers_getDisplayName.getDisplayName(activeChain) })
|
|
117
|
+
] }) })
|
|
118
|
+
}
|
|
119
|
+
),
|
|
120
|
+
suiConnect.isConnecting && /* @__PURE__ */ jsxRuntime.jsx(
|
|
121
|
+
"button",
|
|
122
|
+
{
|
|
123
|
+
type: "button",
|
|
124
|
+
onClick: () => void suiConnect.cancelPendingConnection(),
|
|
125
|
+
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",
|
|
126
|
+
children: "Cancel"
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
] });
|
|
130
|
+
}
|
|
131
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
132
|
+
reactjs_components_Connect_SwitchChainButton.SwitchChainButton,
|
|
133
|
+
{
|
|
134
|
+
disabled,
|
|
135
|
+
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",
|
|
136
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-flex liq-items-center", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liq-flex liq-justify-center liq-items-center liq-gap-2", children: [
|
|
137
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children: account.isConnecting ? "Connecting..." : "Connect" }),
|
|
138
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
139
|
+
"img",
|
|
140
|
+
{
|
|
141
|
+
src: activeChain == null ? void 0 : activeChain.pngUrl,
|
|
142
|
+
alt: "",
|
|
143
|
+
className: "liq-w-4 liq-h-4 liq-rounded-sm"
|
|
144
|
+
}
|
|
145
|
+
),
|
|
146
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-truncate md:liq-text-clip", children: helpers_getDisplayName.getDisplayName(activeChain) })
|
|
147
|
+
] }) })
|
|
148
|
+
}
|
|
149
|
+
);
|
|
98
150
|
};
|
|
99
151
|
exports.BridgeAccountDisplay = BridgeAccountDisplay;
|
|
@@ -4,7 +4,9 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
|
4
4
|
import { useDisconnect } from "@reown/appkit/react";
|
|
5
5
|
import { getDisplayName } from "../../../helpers/getDisplayName.mjs";
|
|
6
6
|
import { SwitchChainButton } from "./SwitchChainButton.mjs";
|
|
7
|
+
import { ChainType } from "../../../types/chainType.mjs";
|
|
7
8
|
import { useAccount } from "../../hooks/useAccount.mjs";
|
|
9
|
+
import { useSuiConnect } from "../../hooks/useSuiConnect.mjs";
|
|
8
10
|
import "clsx";
|
|
9
11
|
import "tailwind-merge";
|
|
10
12
|
import "../base/MxCard/MxCard.mjs";
|
|
@@ -26,31 +28,45 @@ const BridgeAccountDisplay = ({
|
|
|
26
28
|
var _a;
|
|
27
29
|
const account = useAccount();
|
|
28
30
|
const { disconnect } = useDisconnect();
|
|
31
|
+
const suiConnect = useSuiConnect();
|
|
32
|
+
const isSuiChain = (activeChain == null ? void 0 : activeChain.chainType) === ChainType.sui;
|
|
33
|
+
const displayAddress = isSuiChain ? suiConnect.suiAddress : account.address;
|
|
29
34
|
const handleDisconnect = async (e) => {
|
|
30
35
|
try {
|
|
31
36
|
e.preventDefault();
|
|
32
|
-
|
|
37
|
+
if (isSuiChain) {
|
|
38
|
+
await suiConnect.disconnect();
|
|
39
|
+
} else {
|
|
40
|
+
await disconnect();
|
|
41
|
+
}
|
|
33
42
|
} catch (error) {
|
|
34
43
|
console.error("Failed to disconnect:", error);
|
|
35
44
|
}
|
|
36
45
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
/* @__PURE__ */ jsx(
|
|
46
|
+
if (displayAddress) {
|
|
47
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
48
|
+
/* @__PURE__ */ jsx(
|
|
49
|
+
"img",
|
|
50
|
+
{
|
|
51
|
+
src: activeChain == null ? void 0 : activeChain.pngUrl,
|
|
52
|
+
alt: "",
|
|
53
|
+
className: "liq-w-6 liq-h-6 liq-rounded-lg"
|
|
54
|
+
}
|
|
55
|
+
),
|
|
40
56
|
/* @__PURE__ */ jsx("span", { className: "liq-truncate liq-text-gray-400", children: getDisplayName(activeChain) }),
|
|
41
57
|
/* @__PURE__ */ jsx("span", { className: "liq-ml-[-5px]", children: ":" }),
|
|
42
58
|
/* @__PURE__ */ jsx("div", { className: "liq-flex liq-items-center liq-justify-between", children: /* @__PURE__ */ jsxs("div", { className: "liq-flex liq-max-w-[10rem] liq-items-center liq-gap-1", children: [
|
|
43
59
|
/* @__PURE__ */ jsx(
|
|
44
60
|
MxLink,
|
|
45
61
|
{
|
|
46
|
-
to: `${(_a = activeChain == null ? void 0 : activeChain.blockExplorerUrls) == null ? void 0 : _a[0]}/address/${
|
|
62
|
+
to: `${(_a = activeChain == null ? void 0 : activeChain.blockExplorerUrls) == null ? void 0 : _a[0]}/address/${displayAddress}`,
|
|
47
63
|
target: "_blank",
|
|
48
64
|
showExternalIcon: false,
|
|
49
65
|
className: "!liq-relative",
|
|
50
66
|
children: /* @__PURE__ */ jsx("div", { className: "liq-flex liq-min-w-0 liq-flex-grow liq-overflow-hidden liq-leading-none liq-max-w-[10rem]", children: /* @__PURE__ */ jsx(
|
|
51
67
|
TrimAddress,
|
|
52
68
|
{
|
|
53
|
-
address:
|
|
69
|
+
address: displayAddress,
|
|
54
70
|
"data-testid": "evm-address"
|
|
55
71
|
}
|
|
56
72
|
) })
|
|
@@ -59,7 +75,7 @@ const BridgeAccountDisplay = ({
|
|
|
59
75
|
/* @__PURE__ */ jsx(
|
|
60
76
|
CopyButton,
|
|
61
77
|
{
|
|
62
|
-
text:
|
|
78
|
+
text: displayAddress,
|
|
63
79
|
className: "liq-text-sm",
|
|
64
80
|
"data-testid": "evm-copy-button"
|
|
65
81
|
}
|
|
@@ -74,24 +90,60 @@ const BridgeAccountDisplay = ({
|
|
|
74
90
|
children: /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: faPowerOff })
|
|
75
91
|
}
|
|
76
92
|
) })
|
|
77
|
-
] })
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
] });
|
|
94
|
+
}
|
|
95
|
+
if (isSuiChain) {
|
|
96
|
+
return /* @__PURE__ */ jsxs("div", { className: "liq-flex liq-max-w-full liq-items-center liq-gap-2", children: [
|
|
97
|
+
/* @__PURE__ */ jsx(
|
|
98
|
+
"button",
|
|
99
|
+
{
|
|
100
|
+
disabled: disabled || suiConnect.isConnecting,
|
|
101
|
+
onClick: () => suiConnect.connect(),
|
|
102
|
+
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",
|
|
103
|
+
children: /* @__PURE__ */ jsx("div", { className: "liq-flex liq-items-center", children: /* @__PURE__ */ jsxs("div", { className: "liq-flex liq-justify-center liq-items-center liq-gap-2", children: [
|
|
104
|
+
/* @__PURE__ */ jsx("div", { children: suiConnect.isConnecting ? "Connecting..." : "Connect" }),
|
|
105
|
+
/* @__PURE__ */ jsx(
|
|
106
|
+
"img",
|
|
107
|
+
{
|
|
108
|
+
src: activeChain == null ? void 0 : activeChain.pngUrl,
|
|
109
|
+
alt: "",
|
|
110
|
+
className: "liq-w-4 liq-h-4 liq-rounded-sm"
|
|
111
|
+
}
|
|
112
|
+
),
|
|
113
|
+
/* @__PURE__ */ jsx("div", { className: "liq-truncate md:liq-text-clip", children: getDisplayName(activeChain) })
|
|
114
|
+
] }) })
|
|
115
|
+
}
|
|
116
|
+
),
|
|
117
|
+
suiConnect.isConnecting && /* @__PURE__ */ jsx(
|
|
118
|
+
"button",
|
|
119
|
+
{
|
|
120
|
+
type: "button",
|
|
121
|
+
onClick: () => void suiConnect.cancelPendingConnection(),
|
|
122
|
+
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",
|
|
123
|
+
children: "Cancel"
|
|
124
|
+
}
|
|
125
|
+
)
|
|
126
|
+
] });
|
|
127
|
+
}
|
|
128
|
+
return /* @__PURE__ */ jsx(
|
|
129
|
+
SwitchChainButton,
|
|
130
|
+
{
|
|
131
|
+
disabled,
|
|
132
|
+
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",
|
|
133
|
+
children: /* @__PURE__ */ jsx("div", { className: "liq-flex liq-items-center", children: /* @__PURE__ */ jsxs("div", { className: "liq-flex liq-justify-center liq-items-center liq-gap-2", children: [
|
|
134
|
+
/* @__PURE__ */ jsx("div", { children: account.isConnecting ? "Connecting..." : "Connect" }),
|
|
135
|
+
/* @__PURE__ */ jsx(
|
|
136
|
+
"img",
|
|
137
|
+
{
|
|
138
|
+
src: activeChain == null ? void 0 : activeChain.pngUrl,
|
|
139
|
+
alt: "",
|
|
140
|
+
className: "liq-w-4 liq-h-4 liq-rounded-sm"
|
|
141
|
+
}
|
|
142
|
+
),
|
|
143
|
+
/* @__PURE__ */ jsx("div", { className: "liq-truncate md:liq-text-clip", children: getDisplayName(activeChain) })
|
|
144
|
+
] }) })
|
|
145
|
+
}
|
|
146
|
+
);
|
|
95
147
|
};
|
|
96
148
|
export {
|
|
97
149
|
BridgeAccountDisplay
|
|
@@ -24,7 +24,7 @@ const BridgeConnectButton = ({
|
|
|
24
24
|
{
|
|
25
25
|
src: activeChain.pngUrl,
|
|
26
26
|
alt: "",
|
|
27
|
-
className: "liq-z-10 liq-flex liq-h-[1.5rem] liq-w-[1.5rem] liq-
|
|
27
|
+
className: "liq-z-10 liq-flex liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg"
|
|
28
28
|
}
|
|
29
29
|
),
|
|
30
30
|
(activeChain == null ? void 0 : activeChain.networkName) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "liq-inline liq-truncate", children: helpers_getDisplayName.getDisplayName(activeChain) })
|
|
@@ -21,7 +21,7 @@ const BridgeConnectButton = ({
|
|
|
21
21
|
{
|
|
22
22
|
src: activeChain.pngUrl,
|
|
23
23
|
alt: "",
|
|
24
|
-
className: "liq-z-10 liq-flex liq-h-[1.5rem] liq-w-[1.5rem] liq-
|
|
24
|
+
className: "liq-z-10 liq-flex liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg"
|
|
25
25
|
}
|
|
26
26
|
),
|
|
27
27
|
(activeChain == null ? void 0 : activeChain.networkName) && /* @__PURE__ */ jsx("span", { className: "liq-inline liq-truncate", children: getDisplayName(activeChain) })
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
5
|
+
const react = require("@reown/appkit/react");
|
|
6
|
+
const React = require("react");
|
|
7
|
+
const helpers_getDisplayName = require("../../../helpers/getDisplayName.js");
|
|
8
|
+
const reactjs_context_useWeb3App = require("../../context/useWeb3App.js");
|
|
9
|
+
const reactjs_hooks_useAccount = require("../../hooks/useAccount.js");
|
|
10
|
+
const reactjs_hooks_useSuiConnect = require("../../hooks/useSuiConnect.js");
|
|
11
|
+
const SUI_ICON = "https://raw.githubusercontent.com/MystenLabs/sui/main/docs/site/static/img/logo.svg";
|
|
12
|
+
const ChainSelectModal = ({
|
|
13
|
+
activeChain,
|
|
14
|
+
hasSui,
|
|
15
|
+
onEvmSelect,
|
|
16
|
+
onSuiSelect,
|
|
17
|
+
onClose
|
|
18
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
19
|
+
"div",
|
|
20
|
+
{
|
|
21
|
+
className: "liq-fixed liq-inset-0 liq-z-[9999] liq-flex liq-items-center liq-justify-center liq-bg-black/60",
|
|
22
|
+
onClick: onClose,
|
|
23
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
24
|
+
"div",
|
|
25
|
+
{
|
|
26
|
+
className: "liq-w-[340px] liq-rounded-2xl liq-bg-neutral-900 liq-border liq-border-neutral-700/40 liq-shadow-2xl",
|
|
27
|
+
onClick: (e) => e.stopPropagation(),
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liq-flex liq-items-center liq-justify-between liq-px-5 liq-py-4 liq-border-b liq-border-neutral-700/30", children: [
|
|
30
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "liq-text-white liq-text-base liq-font-semibold liq-m-0", children: "Select Chain" }),
|
|
31
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
32
|
+
"button",
|
|
33
|
+
{
|
|
34
|
+
onClick: onClose,
|
|
35
|
+
className: "liq-text-neutral-400 hover:liq-text-white liq-text-lg liq-bg-transparent liq-border-none liq-cursor-pointer liq-p-1",
|
|
36
|
+
children: "×"
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
] }),
|
|
40
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liq-flex liq-flex-col liq-gap-2 liq-p-4", children: [
|
|
41
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
42
|
+
"button",
|
|
43
|
+
{
|
|
44
|
+
onClick: onEvmSelect,
|
|
45
|
+
className: "liq-flex liq-items-center liq-gap-3 liq-w-full liq-rounded-xl liq-bg-neutral-800/60 liq-px-4 liq-py-3 liq-text-left liq-text-white liq-font-medium liq-border liq-border-transparent liq-transition-all liq-duration-200 hover:liq-bg-neutral-750 hover:liq-border-neutral-600/50 liq-cursor-pointer",
|
|
46
|
+
children: [
|
|
47
|
+
(activeChain == null ? void 0 : activeChain.pngUrl) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
48
|
+
"img",
|
|
49
|
+
{
|
|
50
|
+
src: activeChain.pngUrl,
|
|
51
|
+
alt: "",
|
|
52
|
+
className: "liq-w-8 liq-h-8 liq-rounded-full"
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
56
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-text-sm liq-font-semibold", children: activeChain ? helpers_getDisplayName.getDisplayName(activeChain) : "Ethereum" }),
|
|
57
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-text-xs liq-text-neutral-400", children: "EVM Chains" })
|
|
58
|
+
] })
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
hasSui && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
63
|
+
"button",
|
|
64
|
+
{
|
|
65
|
+
onClick: onSuiSelect,
|
|
66
|
+
className: "liq-flex liq-items-center liq-gap-3 liq-w-full liq-rounded-xl liq-bg-neutral-800/60 liq-px-4 liq-py-3 liq-text-left liq-text-white liq-font-medium liq-border liq-border-transparent liq-transition-all liq-duration-200 hover:liq-bg-neutral-750 hover:liq-border-neutral-600/50 liq-cursor-pointer",
|
|
67
|
+
children: [
|
|
68
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
69
|
+
"img",
|
|
70
|
+
{
|
|
71
|
+
src: SUI_ICON,
|
|
72
|
+
alt: "",
|
|
73
|
+
className: "liq-w-8 liq-h-8 liq-rounded-full"
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
77
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-text-sm liq-font-semibold", children: "Sui" }),
|
|
78
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-text-xs liq-text-neutral-400", children: "Sui Network" })
|
|
79
|
+
] })
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
] })
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
const ChainSelectConnect = ({
|
|
90
|
+
activeChain,
|
|
91
|
+
disabled,
|
|
92
|
+
className
|
|
93
|
+
}) => {
|
|
94
|
+
const [showModal, setShowModal] = React.useState(false);
|
|
95
|
+
const { open } = react.useAppKit();
|
|
96
|
+
const account = reactjs_hooks_useAccount.useAccount();
|
|
97
|
+
const { options } = reactjs_context_useWeb3App.useWeb3App();
|
|
98
|
+
const suiConnect = reactjs_hooks_useSuiConnect.useSuiConnect();
|
|
99
|
+
const hasSui = Boolean(options.suiEnvironment);
|
|
100
|
+
if (account.isConnected || suiConnect.isConnected) {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
const handleEvmConnect = () => {
|
|
104
|
+
setShowModal(false);
|
|
105
|
+
open({ view: "Connect", namespace: "eip155" });
|
|
106
|
+
};
|
|
107
|
+
const handleSuiConnect = () => {
|
|
108
|
+
setShowModal(false);
|
|
109
|
+
suiConnect.connect();
|
|
110
|
+
};
|
|
111
|
+
if (!hasSui) {
|
|
112
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
113
|
+
"button",
|
|
114
|
+
{
|
|
115
|
+
onClick: handleEvmConnect,
|
|
116
|
+
disabled,
|
|
117
|
+
className: `liq-font-bold liq-text-inherit liq-rounded-lg ${className ?? ""}`,
|
|
118
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-flex liq-items-center liq-justify-center liq-gap-1", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "liq-text-primary-200", children: account.isConnecting ? "Connecting..." : "Connect" }) })
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
123
|
+
showModal && /* @__PURE__ */ jsxRuntime.jsx(
|
|
124
|
+
ChainSelectModal,
|
|
125
|
+
{
|
|
126
|
+
activeChain,
|
|
127
|
+
hasSui,
|
|
128
|
+
onEvmSelect: handleEvmConnect,
|
|
129
|
+
onSuiSelect: handleSuiConnect,
|
|
130
|
+
onClose: () => setShowModal(false)
|
|
131
|
+
}
|
|
132
|
+
),
|
|
133
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
134
|
+
"button",
|
|
135
|
+
{
|
|
136
|
+
onClick: () => setShowModal(true),
|
|
137
|
+
disabled,
|
|
138
|
+
className: `liq-font-bold liq-text-inherit liq-rounded-lg ${className ?? ""}`,
|
|
139
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-flex liq-items-center liq-justify-center liq-gap-1", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "liq-text-primary-200", children: account.isConnecting ? "Connecting..." : "Connect" }) })
|
|
140
|
+
}
|
|
141
|
+
)
|
|
142
|
+
] });
|
|
143
|
+
};
|
|
144
|
+
exports.ChainSelectConnect = ChainSelectConnect;
|