@multiversx/sdk-dapp-liquidity 1.1.2-alpha.5 → 1.1.2-alpha.7
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/helpers/getDisplayName.d.ts +3 -0
- package/helpers/getDisplayName.js +12 -0
- package/helpers/getDisplayName.mjs +11 -0
- package/package.json +1 -1
- package/reactjs/components/BridgeForm/Deposit.js +2 -0
- package/reactjs/components/BridgeForm/Deposit.mjs +2 -0
- package/reactjs/components/BridgeForm/Transfer.js +2 -0
- package/reactjs/components/BridgeForm/Transfer.mjs +2 -0
- package/reactjs/components/Connect/BridgeAccountDisplay.js +2 -1
- package/reactjs/components/Connect/BridgeAccountDisplay.mjs +2 -1
- package/reactjs/components/Connect/BridgeConnectButton.js +2 -8
- package/reactjs/components/Connect/BridgeConnectButton.mjs +2 -8
- package/reactjs/components/TokenSelector/TokenSelector.d.ts +2 -1
- package/reactjs/components/TokenSelector/TokenSelector.js +22 -1
- package/reactjs/components/TokenSelector/TokenSelector.mjs +22 -1
- package/style.css +0 -4
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
+
require("../reactjs/constants/index.js");
|
|
5
|
+
const reactjs_constants_chains = require("../reactjs/constants/chains.js");
|
|
6
|
+
const getDisplayName = (chain) => {
|
|
7
|
+
if (!(chain == null ? void 0 : chain.chainName)) {
|
|
8
|
+
return (chain == null ? void 0 : chain.networkName) || "";
|
|
9
|
+
}
|
|
10
|
+
return reactjs_constants_chains.ChainName[chain.chainName] || chain.networkName;
|
|
11
|
+
};
|
|
12
|
+
exports.getDisplayName = getDisplayName;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import "../reactjs/constants/index.mjs";
|
|
2
|
+
import { ChainName } from "../reactjs/constants/chains.mjs";
|
|
3
|
+
const getDisplayName = (chain) => {
|
|
4
|
+
if (!(chain == null ? void 0 : chain.chainName)) {
|
|
5
|
+
return (chain == null ? void 0 : chain.networkName) || "";
|
|
6
|
+
}
|
|
7
|
+
return ChainName[chain.chainName] || chain.networkName;
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
getDisplayName
|
|
11
|
+
};
|
package/package.json
CHANGED
|
@@ -485,6 +485,7 @@ const Deposit = ({
|
|
|
485
485
|
options: fromOptions,
|
|
486
486
|
areOptionsLoading: isTokensLoading,
|
|
487
487
|
isMvxSelector: isFirstTokenMvx,
|
|
488
|
+
isDestination: false,
|
|
488
489
|
color: "neutral-850",
|
|
489
490
|
onChange: onChangeFirstSelect,
|
|
490
491
|
onBlur: handleBlur,
|
|
@@ -545,6 +546,7 @@ const Deposit = ({
|
|
|
545
546
|
options: toOptions,
|
|
546
547
|
areOptionsLoading: isTokensLoading,
|
|
547
548
|
isMvxSelector: isSecondTokenMvx,
|
|
549
|
+
isDestination: true,
|
|
548
550
|
color: "neutral-850",
|
|
549
551
|
onChange: onChangeSecondSelect,
|
|
550
552
|
onBlur: handleBlur,
|
|
@@ -482,6 +482,7 @@ const Deposit = ({
|
|
|
482
482
|
options: fromOptions,
|
|
483
483
|
areOptionsLoading: isTokensLoading,
|
|
484
484
|
isMvxSelector: isFirstTokenMvx,
|
|
485
|
+
isDestination: false,
|
|
485
486
|
color: "neutral-850",
|
|
486
487
|
onChange: onChangeFirstSelect,
|
|
487
488
|
onBlur: handleBlur,
|
|
@@ -542,6 +543,7 @@ const Deposit = ({
|
|
|
542
543
|
options: toOptions,
|
|
543
544
|
areOptionsLoading: isTokensLoading,
|
|
544
545
|
isMvxSelector: isSecondTokenMvx,
|
|
546
|
+
isDestination: true,
|
|
545
547
|
color: "neutral-850",
|
|
546
548
|
onChange: onChangeSecondSelect,
|
|
547
549
|
onBlur: handleBlur,
|
|
@@ -430,6 +430,7 @@ const Transfer = ({
|
|
|
430
430
|
options: fromOptions,
|
|
431
431
|
areOptionsLoading: isTokensLoading,
|
|
432
432
|
isMvxSelector: isFirstTokenMvx,
|
|
433
|
+
isDestination: false,
|
|
433
434
|
color: "neutral-850",
|
|
434
435
|
onChange: onChangeFirstSelect,
|
|
435
436
|
onBlur: handleBlur,
|
|
@@ -485,6 +486,7 @@ const Transfer = ({
|
|
|
485
486
|
options: toOptions,
|
|
486
487
|
areOptionsLoading: isTokensLoading,
|
|
487
488
|
isMvxSelector: isSecondTokenMvx,
|
|
489
|
+
isDestination: true,
|
|
488
490
|
color: "neutral-850",
|
|
489
491
|
onChange: onChangeSecondSelect,
|
|
490
492
|
onBlur: handleBlur,
|
|
@@ -427,6 +427,7 @@ const Transfer = ({
|
|
|
427
427
|
options: fromOptions,
|
|
428
428
|
areOptionsLoading: isTokensLoading,
|
|
429
429
|
isMvxSelector: isFirstTokenMvx,
|
|
430
|
+
isDestination: false,
|
|
430
431
|
color: "neutral-850",
|
|
431
432
|
onChange: onChangeFirstSelect,
|
|
432
433
|
onBlur: handleBlur,
|
|
@@ -482,6 +483,7 @@ const Transfer = ({
|
|
|
482
483
|
options: toOptions,
|
|
483
484
|
areOptionsLoading: isTokensLoading,
|
|
484
485
|
isMvxSelector: isSecondTokenMvx,
|
|
486
|
+
isDestination: true,
|
|
485
487
|
color: "neutral-850",
|
|
486
488
|
onChange: onChangeSecondSelect,
|
|
487
489
|
onBlur: handleBlur,
|
|
@@ -7,6 +7,7 @@ const reactFontawesome = require("@fortawesome/react-fontawesome");
|
|
|
7
7
|
const react = require("@reown/appkit/react");
|
|
8
8
|
const React = require("react");
|
|
9
9
|
const api_checkAccount = require("../../../api/checkAccount.js");
|
|
10
|
+
const helpers_getDisplayName = require("../../../helpers/getDisplayName.js");
|
|
10
11
|
const reactjs_components_Connect_SwitchChainButton = require("./SwitchChainButton.js");
|
|
11
12
|
const helpers_getApiURL = require("../../../helpers/getApiURL.js");
|
|
12
13
|
const reactjs_context_useWeb3App = require("../../context/useWeb3App.js");
|
|
@@ -130,7 +131,7 @@ const BridgeAccountDisplay = ({
|
|
|
130
131
|
" "
|
|
131
132
|
] }),
|
|
132
133
|
/* @__PURE__ */ jsxRuntime.jsx("img", { src: activeChain == null ? void 0 : activeChain.pngUrl, alt: "", className: "liq-w-4" }),
|
|
133
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-truncate md:liq-text-clip", children: activeChain
|
|
134
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-truncate md:liq-text-clip", children: helpers_getDisplayName.getDisplayName(activeChain) })
|
|
134
135
|
] }) })
|
|
135
136
|
}
|
|
136
137
|
)
|
|
@@ -4,6 +4,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
|
4
4
|
import { useDisconnect } from "@reown/appkit/react";
|
|
5
5
|
import { useCallback, useEffect } from "react";
|
|
6
6
|
import { checkAccount } from "../../../api/checkAccount.mjs";
|
|
7
|
+
import { getDisplayName } from "../../../helpers/getDisplayName.mjs";
|
|
7
8
|
import { SwitchChainButton } from "./SwitchChainButton.mjs";
|
|
8
9
|
import { getApiURL } from "../../../helpers/getApiURL.mjs";
|
|
9
10
|
import { useWeb3App } from "../../context/useWeb3App.mjs";
|
|
@@ -127,7 +128,7 @@ const BridgeAccountDisplay = ({
|
|
|
127
128
|
" "
|
|
128
129
|
] }),
|
|
129
130
|
/* @__PURE__ */ jsx("img", { src: activeChain == null ? void 0 : activeChain.pngUrl, alt: "", className: "liq-w-4" }),
|
|
130
|
-
/* @__PURE__ */ jsx("div", { className: "liq-truncate md:liq-text-clip", children: activeChain
|
|
131
|
+
/* @__PURE__ */ jsx("div", { className: "liq-truncate md:liq-text-clip", children: getDisplayName(activeChain) })
|
|
131
132
|
] }) })
|
|
132
133
|
}
|
|
133
134
|
)
|
|
@@ -3,14 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
const jsxRuntime = require("react/jsx-runtime");
|
|
5
5
|
const reactjs_components_Connect_CustomConnectButton = require("./CustomConnectButton.js");
|
|
6
|
-
const
|
|
6
|
+
const helpers_getDisplayName = require("../../../helpers/getDisplayName.js");
|
|
7
7
|
const reactjs_hooks_useAccount = require("../../hooks/useAccount.js");
|
|
8
|
-
const getDisplayName = (chain) => {
|
|
9
|
-
if (!(chain == null ? void 0 : chain.chainName)) {
|
|
10
|
-
return (chain == null ? void 0 : chain.networkName) || "";
|
|
11
|
-
}
|
|
12
|
-
return reactjs_constants_chains.ChainName[chain.chainName] || chain.networkName;
|
|
13
|
-
};
|
|
14
8
|
const BridgeConnectButton = ({
|
|
15
9
|
activeChain,
|
|
16
10
|
disabled,
|
|
@@ -27,7 +21,7 @@ const BridgeConnectButton = ({
|
|
|
27
21
|
className: "liq-z-10 liq-flex liq-h-[1.5rem] liq-w-[1.5rem] liq-p-1"
|
|
28
22
|
}
|
|
29
23
|
),
|
|
30
|
-
(activeChain == null ? void 0 : activeChain.networkName) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "liq-inline
|
|
24
|
+
(activeChain == null ? void 0 : activeChain.networkName) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "liq-inline liq-truncate", children: helpers_getDisplayName.getDisplayName(activeChain) })
|
|
31
25
|
] }) });
|
|
32
26
|
};
|
|
33
27
|
exports.BridgeConnectButton = BridgeConnectButton;
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { CustomConnectButton } from "./CustomConnectButton.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { getDisplayName } from "../../../helpers/getDisplayName.mjs";
|
|
4
4
|
import { useAccount } from "../../hooks/useAccount.mjs";
|
|
5
|
-
const getDisplayName = (chain) => {
|
|
6
|
-
if (!(chain == null ? void 0 : chain.chainName)) {
|
|
7
|
-
return (chain == null ? void 0 : chain.networkName) || "";
|
|
8
|
-
}
|
|
9
|
-
return ChainName[chain.chainName] || chain.networkName;
|
|
10
|
-
};
|
|
11
5
|
const BridgeConnectButton = ({
|
|
12
6
|
activeChain,
|
|
13
7
|
disabled,
|
|
@@ -24,7 +18,7 @@ const BridgeConnectButton = ({
|
|
|
24
18
|
className: "liq-z-10 liq-flex liq-h-[1.5rem] liq-w-[1.5rem] liq-p-1"
|
|
25
19
|
}
|
|
26
20
|
),
|
|
27
|
-
(activeChain == null ? void 0 : activeChain.networkName) && /* @__PURE__ */ jsx("span", { className: "liq-inline
|
|
21
|
+
(activeChain == null ? void 0 : activeChain.networkName) && /* @__PURE__ */ jsx("span", { className: "liq-inline liq-truncate", children: getDisplayName(activeChain) })
|
|
28
22
|
] }) });
|
|
29
23
|
};
|
|
30
24
|
export {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TokenType } from '../../../types/token';
|
|
2
2
|
|
|
3
|
-
export declare const TokenSelector: ({ name, options, selectedOption, areOptionsLoading, className, disabled, isMvxSelector, omitDisableClass, color, onBlur, onChange, onMaxBtnClick, onTokenSelectorDisplay }: {
|
|
3
|
+
export declare const TokenSelector: ({ name, options, selectedOption, areOptionsLoading, className, disabled, isMvxSelector, omitDisableClass, isDestination, color, onBlur, onChange, onMaxBtnClick, onTokenSelectorDisplay }: {
|
|
4
4
|
name: string;
|
|
5
5
|
options: TokenType[];
|
|
6
6
|
selectedOption?: TokenType;
|
|
@@ -8,6 +8,7 @@ export declare const TokenSelector: ({ name, options, selectedOption, areOptions
|
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
isMvxSelector?: boolean;
|
|
10
10
|
omitDisableClass?: boolean;
|
|
11
|
+
isDestination?: boolean;
|
|
11
12
|
className?: string;
|
|
12
13
|
color?: "neutral-750" | "neutral-850";
|
|
13
14
|
onChange: (option?: TokenType) => void;
|
|
@@ -24,6 +24,7 @@ const TokenSelector = ({
|
|
|
24
24
|
disabled = false,
|
|
25
25
|
isMvxSelector = false,
|
|
26
26
|
omitDisableClass = false,
|
|
27
|
+
isDestination = false,
|
|
27
28
|
color = "neutral-750",
|
|
28
29
|
onBlur,
|
|
29
30
|
onChange,
|
|
@@ -45,8 +46,28 @@ const TokenSelector = ({
|
|
|
45
46
|
(chain) => !constants_index.MVX_CHAIN_IDS.includes(chain.chainId.toString())
|
|
46
47
|
)) ?? [];
|
|
47
48
|
}, [data, isMvxSelector]);
|
|
48
|
-
const isDestinationMvx =
|
|
49
|
+
const isDestinationMvx = React.useMemo(() => {
|
|
50
|
+
const shouldDisable = isMvxSelector && isDestination;
|
|
51
|
+
if (isMvxSelector) {
|
|
52
|
+
console.log(`🔍 TokenSelector [${name}]:`, {
|
|
53
|
+
isMvxSelector,
|
|
54
|
+
isDestination,
|
|
55
|
+
shouldDisable,
|
|
56
|
+
disabled,
|
|
57
|
+
chainsLength: chains.length
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return shouldDisable;
|
|
61
|
+
}, [isMvxSelector, isDestination, name, disabled, chains.length]);
|
|
49
62
|
const isVisuallyDisabled = disabled || chains.length < 2 || isDestinationMvx;
|
|
63
|
+
if (isMvxSelector) {
|
|
64
|
+
console.log(`🎛️ Final disable state [${name}]:`, {
|
|
65
|
+
disabled,
|
|
66
|
+
"chains.length < 2": chains.length < 2,
|
|
67
|
+
isDestinationMvx,
|
|
68
|
+
isVisuallyDisabled
|
|
69
|
+
});
|
|
70
|
+
}
|
|
50
71
|
const handleOnClick = () => setShow(true);
|
|
51
72
|
const showLoadingSkeleton = (areOptionsLoading || areChainsLoading) && !selectedOption;
|
|
52
73
|
React.useEffect(() => {
|
|
@@ -21,6 +21,7 @@ const TokenSelector = ({
|
|
|
21
21
|
disabled = false,
|
|
22
22
|
isMvxSelector = false,
|
|
23
23
|
omitDisableClass = false,
|
|
24
|
+
isDestination = false,
|
|
24
25
|
color = "neutral-750",
|
|
25
26
|
onBlur,
|
|
26
27
|
onChange,
|
|
@@ -42,8 +43,28 @@ const TokenSelector = ({
|
|
|
42
43
|
(chain) => !MVX_CHAIN_IDS.includes(chain.chainId.toString())
|
|
43
44
|
)) ?? [];
|
|
44
45
|
}, [data, isMvxSelector]);
|
|
45
|
-
const isDestinationMvx =
|
|
46
|
+
const isDestinationMvx = useMemo(() => {
|
|
47
|
+
const shouldDisable = isMvxSelector && isDestination;
|
|
48
|
+
if (isMvxSelector) {
|
|
49
|
+
console.log(`🔍 TokenSelector [${name}]:`, {
|
|
50
|
+
isMvxSelector,
|
|
51
|
+
isDestination,
|
|
52
|
+
shouldDisable,
|
|
53
|
+
disabled,
|
|
54
|
+
chainsLength: chains.length
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return shouldDisable;
|
|
58
|
+
}, [isMvxSelector, isDestination, name, disabled, chains.length]);
|
|
46
59
|
const isVisuallyDisabled = disabled || chains.length < 2 || isDestinationMvx;
|
|
60
|
+
if (isMvxSelector) {
|
|
61
|
+
console.log(`🎛️ Final disable state [${name}]:`, {
|
|
62
|
+
disabled,
|
|
63
|
+
"chains.length < 2": chains.length < 2,
|
|
64
|
+
isDestinationMvx,
|
|
65
|
+
isVisuallyDisabled
|
|
66
|
+
});
|
|
67
|
+
}
|
|
47
68
|
const handleOnClick = () => setShow(true);
|
|
48
69
|
const showLoadingSkeleton = (areOptionsLoading || areChainsLoading) && !selectedOption;
|
|
49
70
|
useEffect(() => {
|