@multiversx/sdk-dapp-liquidity 1.1.5 → 1.1.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/BridgeForm/Deposit.js +1 -0
- package/reactjs/components/BridgeForm/Deposit.mjs +1 -0
- package/reactjs/components/BridgeForm/Transfer.js +2 -0
- package/reactjs/components/BridgeForm/Transfer.mjs +2 -0
- package/reactjs/components/Connect/BridgeAccountDisplay.js +9 -1
- package/reactjs/components/Connect/BridgeAccountDisplay.mjs +9 -1
- package/reactjs/components/Connect/BridgeConnectButton.js +20 -12
- package/reactjs/components/Connect/BridgeConnectButton.mjs +20 -12
- package/reactjs/components/Connect/CustomConnectButton.d.ts +2 -1
- package/reactjs/components/Connect/CustomConnectButton.js +3 -1
- package/reactjs/components/Connect/CustomConnectButton.mjs +3 -1
- package/reactjs/components/Connect/MvxAccountDisplay.js +10 -1
- package/reactjs/components/Connect/MvxAccountDisplay.mjs +10 -1
- package/reactjs/components/Connect/MvxConnectButton.js +1 -0
- package/reactjs/components/Connect/MvxConnectButton.mjs +1 -0
- package/reactjs/components/Connect/SwitchChainButton.js +1 -0
- package/reactjs/components/Connect/SwitchChainButton.mjs +1 -0
- package/reactjs/components/CopyButton/CopyButton.d.ts +2 -1
- package/reactjs/components/CopyButton/CopyButton.js +6 -1
- package/reactjs/components/CopyButton/CopyButton.mjs +6 -1
- package/reactjs/components/ToggleDirection/ToggleDirection.js +14 -6
- package/reactjs/components/ToggleDirection/ToggleDirection.mjs +14 -6
- package/reactjs/components/TokenSelector/TokenSelector.js +1 -0
- package/reactjs/components/TokenSelector/TokenSelector.mjs +1 -0
- package/reactjs/components/TokenSelector/components/TokenItem.js +2 -0
- package/reactjs/components/TokenSelector/components/TokenItem.mjs +2 -0
- package/reactjs/hooks/useBridgeFormik.d.ts +2 -1
- package/reactjs/hooks/useBridgeFormik.js +3 -2
- package/reactjs/hooks/useBridgeFormik.mjs +3 -2
- package/reactjs/hooks/validation/useAmountSchema.d.ts +3 -1
- package/reactjs/hooks/validation/useAmountSchema.js +4 -2
- package/reactjs/hooks/validation/useAmountSchema.mjs +4 -2
- package/reactjs/hooks/validation/useTestIsConnected.d.ts +3 -1
- package/reactjs/hooks/validation/useTestIsConnected.js +10 -3
- package/reactjs/hooks/validation/useTestIsConnected.mjs +10 -3
package/package.json
CHANGED
|
@@ -274,6 +274,7 @@ const Transfer = ({
|
|
|
274
274
|
handleSubmit,
|
|
275
275
|
resetSwapForm
|
|
276
276
|
} = reactjs_hooks_useBridgeFormik.useBridgeFormik({
|
|
277
|
+
isMvxConnected: Boolean(mvxAddress),
|
|
277
278
|
rate,
|
|
278
279
|
sender: mvxAddress ?? "",
|
|
279
280
|
receiver: account.address ?? "",
|
|
@@ -514,6 +515,7 @@ const Transfer = ({
|
|
|
514
515
|
mvxAddress && isAuthenticated && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
515
516
|
reactjs_components_base_MxButton_MxButton.MxButton,
|
|
516
517
|
{
|
|
518
|
+
"data-testid": "submit-button",
|
|
517
519
|
type: "submit",
|
|
518
520
|
variant: "neutral-850",
|
|
519
521
|
className: "liq-w-full disabled:liq-bg-neutral-850/50 liq-py-3 hover:enabled:liq-bg-primary !liq-text-primary-200",
|
|
@@ -271,6 +271,7 @@ const Transfer = ({
|
|
|
271
271
|
handleSubmit,
|
|
272
272
|
resetSwapForm
|
|
273
273
|
} = useBridgeFormik({
|
|
274
|
+
isMvxConnected: Boolean(mvxAddress),
|
|
274
275
|
rate,
|
|
275
276
|
sender: mvxAddress ?? "",
|
|
276
277
|
receiver: account.address ?? "",
|
|
@@ -511,6 +512,7 @@ const Transfer = ({
|
|
|
511
512
|
mvxAddress && isAuthenticated && /* @__PURE__ */ jsxs(
|
|
512
513
|
MxButton,
|
|
513
514
|
{
|
|
515
|
+
"data-testid": "submit-button",
|
|
514
516
|
type: "submit",
|
|
515
517
|
variant: "neutral-850",
|
|
516
518
|
className: "liq-w-full disabled:liq-bg-neutral-850/50 liq-py-3 hover:enabled:liq-bg-primary !liq-text-primary-200",
|
|
@@ -53,13 +53,21 @@ const BridgeAccountDisplay = ({
|
|
|
53
53
|
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(reactjs_components_TrimAddress_TrimAddress.TrimAddress, { address: account.address }) })
|
|
54
54
|
}
|
|
55
55
|
),
|
|
56
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
56
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
57
|
+
reactjs_components_CopyButton_CopyButton.CopyButton,
|
|
58
|
+
{
|
|
59
|
+
text: account.address,
|
|
60
|
+
className: "liq-text-sm",
|
|
61
|
+
"data-testid": "evm-copy-button"
|
|
62
|
+
}
|
|
63
|
+
)
|
|
57
64
|
] }) }),
|
|
58
65
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-ml-auto liq-mr-0 liq-flex liq-items-center liq-gap-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
59
66
|
"button",
|
|
60
67
|
{
|
|
61
68
|
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",
|
|
62
69
|
onClick: handleDisconnect,
|
|
70
|
+
"data-testid": "evm-disconnect-button",
|
|
63
71
|
children: /* @__PURE__ */ jsxRuntime.jsx(reactFontawesome.FontAwesomeIcon, { icon: faPowerOff.faPowerOff })
|
|
64
72
|
}
|
|
65
73
|
) })
|
|
@@ -50,13 +50,21 @@ const BridgeAccountDisplay = ({
|
|
|
50
50
|
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(TrimAddress, { address: account.address }) })
|
|
51
51
|
}
|
|
52
52
|
),
|
|
53
|
-
/* @__PURE__ */ jsx(
|
|
53
|
+
/* @__PURE__ */ jsx(
|
|
54
|
+
CopyButton,
|
|
55
|
+
{
|
|
56
|
+
text: account.address,
|
|
57
|
+
className: "liq-text-sm",
|
|
58
|
+
"data-testid": "evm-copy-button"
|
|
59
|
+
}
|
|
60
|
+
)
|
|
54
61
|
] }) }),
|
|
55
62
|
/* @__PURE__ */ jsx("div", { className: "liq-ml-auto liq-mr-0 liq-flex liq-items-center liq-gap-1", children: /* @__PURE__ */ jsx(
|
|
56
63
|
"button",
|
|
57
64
|
{
|
|
58
65
|
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",
|
|
59
66
|
onClick: handleDisconnect,
|
|
67
|
+
"data-testid": "evm-disconnect-button",
|
|
60
68
|
children: /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: faPowerOff })
|
|
61
69
|
}
|
|
62
70
|
) })
|
|
@@ -11,17 +11,25 @@ const BridgeConnectButton = ({
|
|
|
11
11
|
className
|
|
12
12
|
}) => {
|
|
13
13
|
const account = reactjs_hooks_useAccount.useAccount();
|
|
14
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
className: "liq-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
15
|
+
reactjs_components_Connect_CustomConnectButton.CustomConnectButton,
|
|
16
|
+
{
|
|
17
|
+
className,
|
|
18
|
+
disabled,
|
|
19
|
+
"data-testid": "evm-network-connect-button",
|
|
20
|
+
children: account.isConnected ? null : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liq-flex liq-items-center liq-justify-center liq-gap-1", children: [
|
|
21
|
+
!account.isConnected && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-ml-2 liq-flex liq-items-center liq-gap-1", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "liq-text-primary-200", children: account.isConnecting ? "Connecting..." : "Connect" }) }),
|
|
22
|
+
activeChain && /* @__PURE__ */ jsxRuntime.jsx(
|
|
23
|
+
"img",
|
|
24
|
+
{
|
|
25
|
+
src: activeChain.pngUrl,
|
|
26
|
+
alt: "",
|
|
27
|
+
className: "liq-z-10 liq-flex liq-h-[1.5rem] liq-w-[1.5rem] liq-p-1"
|
|
28
|
+
}
|
|
29
|
+
),
|
|
30
|
+
(activeChain == null ? void 0 : activeChain.networkName) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "liq-inline liq-truncate", children: helpers_getDisplayName.getDisplayName(activeChain) })
|
|
31
|
+
] })
|
|
32
|
+
}
|
|
33
|
+
);
|
|
26
34
|
};
|
|
27
35
|
exports.BridgeConnectButton = BridgeConnectButton;
|
|
@@ -8,18 +8,26 @@ const BridgeConnectButton = ({
|
|
|
8
8
|
className
|
|
9
9
|
}) => {
|
|
10
10
|
const account = useAccount();
|
|
11
|
-
return /* @__PURE__ */ jsx(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
className: "liq-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
11
|
+
return /* @__PURE__ */ jsx(
|
|
12
|
+
CustomConnectButton,
|
|
13
|
+
{
|
|
14
|
+
className,
|
|
15
|
+
disabled,
|
|
16
|
+
"data-testid": "evm-network-connect-button",
|
|
17
|
+
children: account.isConnected ? null : /* @__PURE__ */ jsxs("div", { className: "liq-flex liq-items-center liq-justify-center liq-gap-1", children: [
|
|
18
|
+
!account.isConnected && /* @__PURE__ */ jsx("div", { className: "liq-ml-2 liq-flex liq-items-center liq-gap-1", children: /* @__PURE__ */ jsx("span", { className: "liq-text-primary-200", children: account.isConnecting ? "Connecting..." : "Connect" }) }),
|
|
19
|
+
activeChain && /* @__PURE__ */ jsx(
|
|
20
|
+
"img",
|
|
21
|
+
{
|
|
22
|
+
src: activeChain.pngUrl,
|
|
23
|
+
alt: "",
|
|
24
|
+
className: "liq-z-10 liq-flex liq-h-[1.5rem] liq-w-[1.5rem] liq-p-1"
|
|
25
|
+
}
|
|
26
|
+
),
|
|
27
|
+
(activeChain == null ? void 0 : activeChain.networkName) && /* @__PURE__ */ jsx("span", { className: "liq-inline liq-truncate", children: getDisplayName(activeChain) })
|
|
28
|
+
] })
|
|
29
|
+
}
|
|
30
|
+
);
|
|
23
31
|
};
|
|
24
32
|
export {
|
|
25
33
|
BridgeConnectButton
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
|
|
3
|
-
export declare const CustomConnectButton: ({ disabled, className, children }: {
|
|
3
|
+
export declare const CustomConnectButton: ({ disabled, className, children, "data-testid": dataTestId }: {
|
|
4
4
|
disabled?: boolean;
|
|
5
5
|
className?: string;
|
|
6
6
|
children?: ReactNode;
|
|
7
|
+
"data-testid"?: string;
|
|
7
8
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,7 +7,8 @@ const wagmi = require("wagmi");
|
|
|
7
7
|
const CustomConnectButton = ({
|
|
8
8
|
disabled,
|
|
9
9
|
className,
|
|
10
|
-
children
|
|
10
|
+
children,
|
|
11
|
+
"data-testid": dataTestId
|
|
11
12
|
}) => {
|
|
12
13
|
const { open } = react.useAppKit();
|
|
13
14
|
const { isConnected, isConnecting } = wagmi.useAccount();
|
|
@@ -27,6 +28,7 @@ const CustomConnectButton = ({
|
|
|
27
28
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
28
29
|
"button",
|
|
29
30
|
{
|
|
31
|
+
"data-testid": dataTestId,
|
|
30
32
|
onClick: () => open({
|
|
31
33
|
view: "Connect"
|
|
32
34
|
}),
|
|
@@ -4,7 +4,8 @@ import { useAccount, useDisconnect } from "wagmi";
|
|
|
4
4
|
const CustomConnectButton = ({
|
|
5
5
|
disabled,
|
|
6
6
|
className,
|
|
7
|
-
children
|
|
7
|
+
children,
|
|
8
|
+
"data-testid": dataTestId
|
|
8
9
|
}) => {
|
|
9
10
|
const { open } = useAppKit();
|
|
10
11
|
const { isConnected, isConnecting } = useAccount();
|
|
@@ -24,6 +25,7 @@ const CustomConnectButton = ({
|
|
|
24
25
|
return /* @__PURE__ */ jsx(
|
|
25
26
|
"button",
|
|
26
27
|
{
|
|
28
|
+
"data-testid": dataTestId,
|
|
27
29
|
onClick: () => open({
|
|
28
30
|
view: "Connect"
|
|
29
31
|
}),
|
|
@@ -46,13 +46,21 @@ const MvxAccountDisplay = ({
|
|
|
46
46
|
)
|
|
47
47
|
}
|
|
48
48
|
),
|
|
49
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
49
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
50
|
+
reactjs_components_CopyButton_CopyButton.CopyButton,
|
|
51
|
+
{
|
|
52
|
+
text: accountAddress,
|
|
53
|
+
className: "liq-text-sm",
|
|
54
|
+
"data-testid": "mx-copy-button"
|
|
55
|
+
}
|
|
56
|
+
)
|
|
50
57
|
] }) }),
|
|
51
58
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-ml-auto liq-mr-0 liq-flex liq-items-center liq-gap-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
52
59
|
"button",
|
|
53
60
|
{
|
|
54
61
|
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",
|
|
55
62
|
onClick: handleDisconnect,
|
|
63
|
+
"data-testid": "mx-disconnect-button",
|
|
56
64
|
children: /* @__PURE__ */ jsxRuntime.jsx(reactFontawesome.FontAwesomeIcon, { icon: faPowerOff.faPowerOff })
|
|
57
65
|
}
|
|
58
66
|
) })
|
|
@@ -63,6 +71,7 @@ const MvxAccountDisplay = ({
|
|
|
63
71
|
type: "button",
|
|
64
72
|
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",
|
|
65
73
|
onClick: handleConnect,
|
|
74
|
+
"data-testid": "mx-connect-button",
|
|
66
75
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liq-flex liq-justify-center liq-gap-2", children: [
|
|
67
76
|
/* @__PURE__ */ jsxRuntime.jsx("div", { children: "Connect " }),
|
|
68
77
|
/* @__PURE__ */ jsxRuntime.jsx("img", { src: chainIcon, alt: "", className: "liq-w-4" }),
|
|
@@ -43,13 +43,21 @@ const MvxAccountDisplay = ({
|
|
|
43
43
|
)
|
|
44
44
|
}
|
|
45
45
|
),
|
|
46
|
-
/* @__PURE__ */ jsx(
|
|
46
|
+
/* @__PURE__ */ jsx(
|
|
47
|
+
CopyButton,
|
|
48
|
+
{
|
|
49
|
+
text: accountAddress,
|
|
50
|
+
className: "liq-text-sm",
|
|
51
|
+
"data-testid": "mx-copy-button"
|
|
52
|
+
}
|
|
53
|
+
)
|
|
47
54
|
] }) }),
|
|
48
55
|
/* @__PURE__ */ jsx("div", { className: "liq-ml-auto liq-mr-0 liq-flex liq-items-center liq-gap-1", children: /* @__PURE__ */ jsx(
|
|
49
56
|
"button",
|
|
50
57
|
{
|
|
51
58
|
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",
|
|
52
59
|
onClick: handleDisconnect,
|
|
60
|
+
"data-testid": "mx-disconnect-button",
|
|
53
61
|
children: /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: faPowerOff })
|
|
54
62
|
}
|
|
55
63
|
) })
|
|
@@ -60,6 +68,7 @@ const MvxAccountDisplay = ({
|
|
|
60
68
|
type: "button",
|
|
61
69
|
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",
|
|
62
70
|
onClick: handleConnect,
|
|
71
|
+
"data-testid": "mx-connect-button",
|
|
63
72
|
children: /* @__PURE__ */ jsxs("div", { className: "liq-flex liq-justify-center liq-gap-2", children: [
|
|
64
73
|
/* @__PURE__ */ jsx("div", { children: "Connect " }),
|
|
65
74
|
/* @__PURE__ */ jsx("img", { src: chainIcon, alt: "", className: "liq-w-4" }),
|
|
@@ -17,6 +17,7 @@ const MvxConnectButton = ({
|
|
|
17
17
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
18
18
|
reactjs_components_base_MxButton_MxButton.MxButton,
|
|
19
19
|
{
|
|
20
|
+
"data-testid": "mx-network-connect-button",
|
|
20
21
|
type: "button",
|
|
21
22
|
variant: "neutral-850",
|
|
22
23
|
className: reactjs_utils_mxClsx.mxClsx(
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
interface CopyButtonType {
|
|
2
2
|
text: string;
|
|
3
3
|
className?: string;
|
|
4
|
+
'data-testid'?: string;
|
|
4
5
|
}
|
|
5
|
-
export declare const CopyButton: ({ text, className }: CopyButtonType) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const CopyButton: ({ text, className, "data-testid": dataTestId }: CopyButtonType) => import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
export {};
|
|
@@ -8,7 +8,11 @@ const reactFontawesome = require("@fortawesome/react-fontawesome");
|
|
|
8
8
|
const React = require("react");
|
|
9
9
|
const reactjs_components_CopyButton_utils_copyToClipboard = require("./utils/copyToClipboard.js");
|
|
10
10
|
const reactjs_components_base_MxButton_MxButton = require("../base/MxButton/MxButton.js");
|
|
11
|
-
const CopyButton = ({
|
|
11
|
+
const CopyButton = ({
|
|
12
|
+
text,
|
|
13
|
+
className = "",
|
|
14
|
+
"data-testid": dataTestId
|
|
15
|
+
}) => {
|
|
12
16
|
const [copyResult, setCopyResut] = React.useState({
|
|
13
17
|
default: true,
|
|
14
18
|
success: false
|
|
@@ -35,6 +39,7 @@ const CopyButton = ({ text, className = "" }) => {
|
|
|
35
39
|
className,
|
|
36
40
|
variant: "link-neutral-500",
|
|
37
41
|
onClick: handleOnClick,
|
|
42
|
+
"data-testid": dataTestId,
|
|
38
43
|
children: copyResult.default || !copyResult.success ? /* @__PURE__ */ jsxRuntime.jsx(reactFontawesome.FontAwesomeIcon, { icon: faCopy.faCopy }) : /* @__PURE__ */ jsxRuntime.jsx(reactFontawesome.FontAwesomeIcon, { icon: faCheck.faCheck })
|
|
39
44
|
}
|
|
40
45
|
);
|
|
@@ -5,7 +5,11 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
|
5
5
|
import React from "react";
|
|
6
6
|
import { copyTextToClipboard } from "./utils/copyToClipboard.mjs";
|
|
7
7
|
import { MxButton } from "../base/MxButton/MxButton.mjs";
|
|
8
|
-
const CopyButton = ({
|
|
8
|
+
const CopyButton = ({
|
|
9
|
+
text,
|
|
10
|
+
className = "",
|
|
11
|
+
"data-testid": dataTestId
|
|
12
|
+
}) => {
|
|
9
13
|
const [copyResult, setCopyResut] = React.useState({
|
|
10
14
|
default: true,
|
|
11
15
|
success: false
|
|
@@ -32,6 +36,7 @@ const CopyButton = ({ text, className = "" }) => {
|
|
|
32
36
|
className,
|
|
33
37
|
variant: "link-neutral-500",
|
|
34
38
|
onClick: handleOnClick,
|
|
39
|
+
"data-testid": dataTestId,
|
|
35
40
|
children: copyResult.default || !copyResult.success ? /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: faCopy }) : /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: faCheck })
|
|
36
41
|
}
|
|
37
42
|
);
|
|
@@ -11,13 +11,21 @@ const ToggleDirection = ({
|
|
|
11
11
|
e.stopPropagation();
|
|
12
12
|
onChangeDirection();
|
|
13
13
|
};
|
|
14
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
15
|
-
"
|
|
14
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
15
|
+
"button",
|
|
16
16
|
{
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
className: "liq-inline-block",
|
|
18
|
+
onClick: handleChangeDirection,
|
|
19
|
+
"data-testid": "toggle-button",
|
|
20
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
21
|
+
"img",
|
|
22
|
+
{
|
|
23
|
+
src: HugImage,
|
|
24
|
+
alt: "",
|
|
25
|
+
className: "liq-h-6 liq-w-6 liq-text-neutral-100 liq-mx-auto liq-my-2"
|
|
26
|
+
}
|
|
27
|
+
)
|
|
20
28
|
}
|
|
21
|
-
)
|
|
29
|
+
);
|
|
22
30
|
};
|
|
23
31
|
exports.ToggleDirection = ToggleDirection;
|
|
@@ -8,14 +8,22 @@ const ToggleDirection = ({
|
|
|
8
8
|
e.stopPropagation();
|
|
9
9
|
onChangeDirection();
|
|
10
10
|
};
|
|
11
|
-
return /* @__PURE__ */ jsx(
|
|
12
|
-
"
|
|
11
|
+
return /* @__PURE__ */ jsx(
|
|
12
|
+
"button",
|
|
13
13
|
{
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
className: "liq-inline-block",
|
|
15
|
+
onClick: handleChangeDirection,
|
|
16
|
+
"data-testid": "toggle-button",
|
|
17
|
+
children: /* @__PURE__ */ jsx(
|
|
18
|
+
"img",
|
|
19
|
+
{
|
|
20
|
+
src: HugImage,
|
|
21
|
+
alt: "",
|
|
22
|
+
className: "liq-h-6 liq-w-6 liq-text-neutral-100 liq-mx-auto liq-my-2"
|
|
23
|
+
}
|
|
24
|
+
)
|
|
17
25
|
}
|
|
18
|
-
)
|
|
26
|
+
);
|
|
19
27
|
};
|
|
20
28
|
export {
|
|
21
29
|
ToggleDirection
|
|
@@ -149,6 +149,7 @@ const TokenSelector = ({
|
|
|
149
149
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
150
150
|
reactjs_components_DisplayAmount_DisplayAmount.DisplayAmount,
|
|
151
151
|
{
|
|
152
|
+
"data-testid": `${name}-balance`,
|
|
152
153
|
decimals: selectedOption == null ? void 0 : selectedOption.decimals,
|
|
153
154
|
amount: (selectedOption == null ? void 0 : selectedOption.balance) ?? "0",
|
|
154
155
|
className: "liq-font-medium liq-text-neutral-100"
|
|
@@ -146,6 +146,7 @@ const TokenSelector = ({
|
|
|
146
146
|
/* @__PURE__ */ jsx(
|
|
147
147
|
DisplayAmount,
|
|
148
148
|
{
|
|
149
|
+
"data-testid": `${name}-balance`,
|
|
149
150
|
decimals: selectedOption == null ? void 0 : selectedOption.decimals,
|
|
150
151
|
amount: (selectedOption == null ? void 0 : selectedOption.balance) ?? "0",
|
|
151
152
|
className: "liq-font-medium liq-text-neutral-100"
|
|
@@ -13,6 +13,7 @@ const TokenItem = ({
|
|
|
13
13
|
onClick,
|
|
14
14
|
selected
|
|
15
15
|
}) => {
|
|
16
|
+
var _a, _b;
|
|
16
17
|
const { tokenChain, chainIcon } = reactjs_hooks_useResolveTokenChain.useResolveTokenChain({
|
|
17
18
|
token
|
|
18
19
|
});
|
|
@@ -36,6 +37,7 @@ const TokenItem = ({
|
|
|
36
37
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
37
38
|
"div",
|
|
38
39
|
{
|
|
40
|
+
"data-testid": `token-item-${(_b = (_a = token.symbol) == null ? void 0 : _a.toLowerCase) == null ? void 0 : _b.call(_a)}`,
|
|
39
41
|
className: `token-item ${selected ? "liq-selected" : ""} liq-flex liq-cursor-pointer liq-items-center liq-justify-between liq-rounded-lg liq-p-2 hover:liq-bg-neutral-700 liq-bg-neutral-850`,
|
|
40
42
|
onClick: () => {
|
|
41
43
|
handleSwitchChain();
|
|
@@ -10,6 +10,7 @@ const TokenItem = ({
|
|
|
10
10
|
onClick,
|
|
11
11
|
selected
|
|
12
12
|
}) => {
|
|
13
|
+
var _a, _b;
|
|
13
14
|
const { tokenChain, chainIcon } = useResolveTokenChain({
|
|
14
15
|
token
|
|
15
16
|
});
|
|
@@ -33,6 +34,7 @@ const TokenItem = ({
|
|
|
33
34
|
return /* @__PURE__ */ jsx(
|
|
34
35
|
"div",
|
|
35
36
|
{
|
|
37
|
+
"data-testid": `token-item-${(_b = (_a = token.symbol) == null ? void 0 : _a.toLowerCase) == null ? void 0 : _b.call(_a)}`,
|
|
36
38
|
className: `token-item ${selected ? "liq-selected" : ""} liq-flex liq-cursor-pointer liq-items-center liq-justify-between liq-rounded-lg liq-p-2 hover:liq-bg-neutral-700 liq-bg-neutral-850`,
|
|
37
39
|
onClick: () => {
|
|
38
40
|
handleSwitchChain();
|
|
@@ -19,7 +19,7 @@ export interface TradeFormikValuesType {
|
|
|
19
19
|
fromChainId?: string;
|
|
20
20
|
toChainId?: string;
|
|
21
21
|
}
|
|
22
|
-
export declare const useBridgeFormik: ({ sender, receiver, firstToken, firstAmount, secondToken, secondAmount, fromChainId, toChainId, setForceRefetchRate, rate, onSubmit }: {
|
|
22
|
+
export declare const useBridgeFormik: ({ sender, receiver, firstToken, firstAmount, secondToken, secondAmount, fromChainId, toChainId, setForceRefetchRate, rate, onSubmit, isMvxConnected }: {
|
|
23
23
|
sender: string;
|
|
24
24
|
receiver: string;
|
|
25
25
|
firstAmount?: string;
|
|
@@ -28,6 +28,7 @@ export declare const useBridgeFormik: ({ sender, receiver, firstToken, firstAmou
|
|
|
28
28
|
toChainId?: string;
|
|
29
29
|
firstToken?: TokenType;
|
|
30
30
|
secondToken?: TokenType;
|
|
31
|
+
isMvxConnected: boolean;
|
|
31
32
|
setForceRefetchRate?: (value: (previous: number) => number) => void;
|
|
32
33
|
rate?: RateRequestResponse;
|
|
33
34
|
onSubmit: ({ transactions, provider }: {
|
|
@@ -30,7 +30,8 @@ const useBridgeFormik = ({
|
|
|
30
30
|
toChainId,
|
|
31
31
|
setForceRefetchRate,
|
|
32
32
|
rate,
|
|
33
|
-
onSubmit
|
|
33
|
+
onSubmit,
|
|
34
|
+
isMvxConnected
|
|
34
35
|
}) => {
|
|
35
36
|
const pendingSigningRef = React.useRef();
|
|
36
37
|
const { nativeAuthToken } = reactjs_context_useWeb3App.useWeb3App();
|
|
@@ -93,7 +94,7 @@ const useBridgeFormik = ({
|
|
|
93
94
|
[
|
|
94
95
|
"firstAmount"
|
|
95
96
|
/* firstAmount */
|
|
96
|
-
]: reactjs_hooks_validation_useAmountSchema.useAmountSchema(),
|
|
97
|
+
]: reactjs_hooks_validation_useAmountSchema.useAmountSchema({ isMvxConnected }),
|
|
97
98
|
[
|
|
98
99
|
"firstToken"
|
|
99
100
|
/* firstToken */
|
|
@@ -27,7 +27,8 @@ const useBridgeFormik = ({
|
|
|
27
27
|
toChainId,
|
|
28
28
|
setForceRefetchRate,
|
|
29
29
|
rate,
|
|
30
|
-
onSubmit
|
|
30
|
+
onSubmit,
|
|
31
|
+
isMvxConnected
|
|
31
32
|
}) => {
|
|
32
33
|
const pendingSigningRef = useRef();
|
|
33
34
|
const { nativeAuthToken } = useWeb3App();
|
|
@@ -90,7 +91,7 @@ const useBridgeFormik = ({
|
|
|
90
91
|
[
|
|
91
92
|
"firstAmount"
|
|
92
93
|
/* firstAmount */
|
|
93
|
-
]: useAmountSchema(),
|
|
94
|
+
]: useAmountSchema({ isMvxConnected }),
|
|
94
95
|
[
|
|
95
96
|
"firstToken"
|
|
96
97
|
/* firstToken */
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
|
-
export declare const useAmountSchema: (
|
|
2
|
+
export declare const useAmountSchema: ({ isMvxConnected }: {
|
|
3
|
+
isMvxConnected: boolean;
|
|
4
|
+
}) => yup.StringSchema<string, yup.AnyObject, undefined, "">;
|
|
@@ -21,9 +21,11 @@ function _interopNamespaceDefault(e) {
|
|
|
21
21
|
return Object.freeze(n);
|
|
22
22
|
}
|
|
23
23
|
const yup__namespace = /* @__PURE__ */ _interopNamespaceDefault(yup);
|
|
24
|
-
const useAmountSchema = (
|
|
24
|
+
const useAmountSchema = ({
|
|
25
|
+
isMvxConnected
|
|
26
|
+
}) => {
|
|
25
27
|
const testHasEnoughFunds = reactjs_hooks_validation_useTestHasEnoughFunds.useTestHasEnoughFunds();
|
|
26
|
-
const testIsConnected = reactjs_hooks_validation_useTestIsConnected.useTestIsConnected();
|
|
28
|
+
const testIsConnected = reactjs_hooks_validation_useTestIsConnected.useTestIsConnected({ isMvxConnected });
|
|
27
29
|
const testStartDot = (value) => !(value == null ? void 0 : value.startsWith("."));
|
|
28
30
|
const testEndDot = (value) => !(value == null ? void 0 : value.endsWith("."));
|
|
29
31
|
return yup__namespace.string().required("Amount is a required field").test("account", testIsConnected).test("startDot", "Amount must not start with dot", testStartDot).test("endDot", "Amount must not end with dot", testEndDot).test("funds", testHasEnoughFunds);
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as yup from "yup";
|
|
2
2
|
import { useTestHasEnoughFunds } from "./useTestHasEnoughFunds.mjs";
|
|
3
3
|
import { useTestIsConnected } from "./useTestIsConnected.mjs";
|
|
4
|
-
const useAmountSchema = (
|
|
4
|
+
const useAmountSchema = ({
|
|
5
|
+
isMvxConnected
|
|
6
|
+
}) => {
|
|
5
7
|
const testHasEnoughFunds = useTestHasEnoughFunds();
|
|
6
|
-
const testIsConnected = useTestIsConnected();
|
|
8
|
+
const testIsConnected = useTestIsConnected({ isMvxConnected });
|
|
7
9
|
const testStartDot = (value) => !(value == null ? void 0 : value.startsWith("."));
|
|
8
10
|
const testEndDot = (value) => !(value == null ? void 0 : value.endsWith("."));
|
|
9
11
|
return yup.string().required("Amount is a required field").test("account", testIsConnected).test("startDot", "Amount must not start with dot", testStartDot).test("endDot", "Amount must not end with dot", testEndDot).test("funds", testHasEnoughFunds);
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { TestContext } from 'yup';
|
|
2
2
|
|
|
3
|
-
export declare const useTestIsConnected: (
|
|
3
|
+
export declare const useTestIsConnected: ({ isMvxConnected }: {
|
|
4
|
+
isMvxConnected: boolean;
|
|
5
|
+
}) => <T extends string | undefined>(_value: T, context: TestContext) => true | import('yup').ValidationError;
|
|
@@ -2,12 +2,19 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
const React = require("react");
|
|
5
|
+
const helpers_getMvxChainId = require("../../../helpers/getMvxChainId.js");
|
|
5
6
|
const reactjs_hooks_useAccount = require("../useAccount.js");
|
|
6
|
-
const useTestIsConnected = (
|
|
7
|
+
const useTestIsConnected = ({
|
|
8
|
+
isMvxConnected
|
|
9
|
+
}) => {
|
|
7
10
|
const { address } = reactjs_hooks_useAccount.useAccount();
|
|
8
11
|
return React.useCallback(
|
|
9
12
|
(_value, context) => {
|
|
10
|
-
|
|
13
|
+
const firstToken = context.parent.firstToken;
|
|
14
|
+
const mvxChainId = helpers_getMvxChainId.getMvxChainId();
|
|
15
|
+
const isFromMvxChain = (firstToken == null ? void 0 : firstToken.chainId) === mvxChainId;
|
|
16
|
+
const isConnected = isFromMvxChain ? isMvxConnected : Boolean(address);
|
|
17
|
+
if (isConnected) {
|
|
11
18
|
return true;
|
|
12
19
|
}
|
|
13
20
|
return context.createError({
|
|
@@ -15,7 +22,7 @@ const useTestIsConnected = () => {
|
|
|
15
22
|
path: context.path
|
|
16
23
|
});
|
|
17
24
|
},
|
|
18
|
-
[address]
|
|
25
|
+
[address, isMvxConnected]
|
|
19
26
|
);
|
|
20
27
|
};
|
|
21
28
|
exports.useTestIsConnected = useTestIsConnected;
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { useCallback } from "react";
|
|
2
|
+
import { getMvxChainId } from "../../../helpers/getMvxChainId.mjs";
|
|
2
3
|
import { useAccount } from "../useAccount.mjs";
|
|
3
|
-
const useTestIsConnected = (
|
|
4
|
+
const useTestIsConnected = ({
|
|
5
|
+
isMvxConnected
|
|
6
|
+
}) => {
|
|
4
7
|
const { address } = useAccount();
|
|
5
8
|
return useCallback(
|
|
6
9
|
(_value, context) => {
|
|
7
|
-
|
|
10
|
+
const firstToken = context.parent.firstToken;
|
|
11
|
+
const mvxChainId = getMvxChainId();
|
|
12
|
+
const isFromMvxChain = (firstToken == null ? void 0 : firstToken.chainId) === mvxChainId;
|
|
13
|
+
const isConnected = isFromMvxChain ? isMvxConnected : Boolean(address);
|
|
14
|
+
if (isConnected) {
|
|
8
15
|
return true;
|
|
9
16
|
}
|
|
10
17
|
return context.createError({
|
|
@@ -12,7 +19,7 @@ const useTestIsConnected = () => {
|
|
|
12
19
|
path: context.path
|
|
13
20
|
});
|
|
14
21
|
},
|
|
15
|
-
[address]
|
|
22
|
+
[address, isMvxConnected]
|
|
16
23
|
);
|
|
17
24
|
};
|
|
18
25
|
export {
|