@multiversx/sdk-dapp-liquidity 1.1.4 → 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/api/getChains.js +1 -1
- package/api/getChains.mjs +1 -1
- package/package.json +1 -1
- package/reactjs/components/BridgeForm/Deposit.js +11 -21
- package/reactjs/components/BridgeForm/Deposit.mjs +12 -22
- package/reactjs/components/BridgeForm/Transfer.js +11 -23
- package/reactjs/components/BridgeForm/Transfer.mjs +11 -23
- 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/style.css +0 -6
package/api/getChains.js
CHANGED
package/api/getChains.mjs
CHANGED
package/package.json
CHANGED
|
@@ -65,7 +65,7 @@ const Deposit = ({
|
|
|
65
65
|
onNavigate,
|
|
66
66
|
onChangeDirection
|
|
67
67
|
}) => {
|
|
68
|
-
var _a, _b
|
|
68
|
+
var _a, _b;
|
|
69
69
|
const ref = React.useRef(null);
|
|
70
70
|
const [isTokenSelectorVisible, setIsTokenSelectorVisible] = React.useState(false);
|
|
71
71
|
const [pendingSigning, setPendingSigning] = React.useState(false);
|
|
@@ -349,6 +349,7 @@ const Deposit = ({
|
|
|
349
349
|
}
|
|
350
350
|
},
|
|
351
351
|
[
|
|
352
|
+
selectedChainOption,
|
|
352
353
|
bridgeAddress,
|
|
353
354
|
handleOnChangeFirstAmount,
|
|
354
355
|
handleOnChangeSecondAmount,
|
|
@@ -368,6 +369,7 @@ const Deposit = ({
|
|
|
368
369
|
handleSubmit,
|
|
369
370
|
resetSwapForm
|
|
370
371
|
} = reactjs_hooks_useBridgeFormik.useBridgeFormik({
|
|
372
|
+
isMvxConnected: Boolean(mvxAddress),
|
|
371
373
|
rate,
|
|
372
374
|
sender: account.address ?? "",
|
|
373
375
|
receiver: mvxAddress ?? "",
|
|
@@ -618,26 +620,14 @@ const Deposit = ({
|
|
|
618
620
|
}
|
|
619
621
|
)
|
|
620
622
|
] }),
|
|
621
|
-
account.address && siginingTransactionsCount > 0 && /* @__PURE__ */ jsxRuntime.
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
" "
|
|
630
|
-
] }),
|
|
631
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
632
|
-
"img",
|
|
633
|
-
{
|
|
634
|
-
src: (_d = (_c = core.getConnections(config)[0]) == null ? void 0 : _c.connector) == null ? void 0 : _d.icon,
|
|
635
|
-
alt: "",
|
|
636
|
-
className: "liq-mx-1 liq-h-[1rem] liq-w-[1rem]"
|
|
637
|
-
}
|
|
638
|
-
),
|
|
639
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { children: (_f = (_e = core.getConnections(config)[0]) == null ? void 0 : _e.connector) == null ? void 0 : _f.name })
|
|
640
|
-
] })
|
|
623
|
+
account.address && siginingTransactionsCount > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-flex liq-items-center liq-justify-center liq-text-neutral-300 liq-text-sm", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
624
|
+
"You will be asked to sign ",
|
|
625
|
+
siginingTransactionsCount,
|
|
626
|
+
" ",
|
|
627
|
+
siginingTransactionsCount > 1 ? "transactions" : "transaction",
|
|
628
|
+
" ",
|
|
629
|
+
"on your wallet"
|
|
630
|
+
] }) })
|
|
641
631
|
]
|
|
642
632
|
}
|
|
643
633
|
) });
|
|
@@ -3,7 +3,7 @@ import { faSpinner } from "@fortawesome/free-solid-svg-icons/faSpinner";
|
|
|
3
3
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
4
4
|
import { formatAmount } from "@multiversx/sdk-dapp-utils/out/helpers/formatAmount";
|
|
5
5
|
import { useAppKitNetwork } from "@reown/appkit/react";
|
|
6
|
-
import { waitForTransactionReceipt
|
|
6
|
+
import { waitForTransactionReceipt } from "@wagmi/core";
|
|
7
7
|
import debounce from "lodash/debounce";
|
|
8
8
|
import { useRef, useState, useMemo, useCallback, useEffect } from "react";
|
|
9
9
|
import { toast } from "react-toastify";
|
|
@@ -62,7 +62,7 @@ const Deposit = ({
|
|
|
62
62
|
onNavigate,
|
|
63
63
|
onChangeDirection
|
|
64
64
|
}) => {
|
|
65
|
-
var _a, _b
|
|
65
|
+
var _a, _b;
|
|
66
66
|
const ref = useRef(null);
|
|
67
67
|
const [isTokenSelectorVisible, setIsTokenSelectorVisible] = useState(false);
|
|
68
68
|
const [pendingSigning, setPendingSigning] = useState(false);
|
|
@@ -346,6 +346,7 @@ const Deposit = ({
|
|
|
346
346
|
}
|
|
347
347
|
},
|
|
348
348
|
[
|
|
349
|
+
selectedChainOption,
|
|
349
350
|
bridgeAddress,
|
|
350
351
|
handleOnChangeFirstAmount,
|
|
351
352
|
handleOnChangeSecondAmount,
|
|
@@ -365,6 +366,7 @@ const Deposit = ({
|
|
|
365
366
|
handleSubmit,
|
|
366
367
|
resetSwapForm
|
|
367
368
|
} = useBridgeFormik({
|
|
369
|
+
isMvxConnected: Boolean(mvxAddress),
|
|
368
370
|
rate,
|
|
369
371
|
sender: account.address ?? "",
|
|
370
372
|
receiver: mvxAddress ?? "",
|
|
@@ -615,26 +617,14 @@ const Deposit = ({
|
|
|
615
617
|
}
|
|
616
618
|
)
|
|
617
619
|
] }),
|
|
618
|
-
account.address && siginingTransactionsCount > 0 && /* @__PURE__ */
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
" "
|
|
627
|
-
] }),
|
|
628
|
-
/* @__PURE__ */ jsx(
|
|
629
|
-
"img",
|
|
630
|
-
{
|
|
631
|
-
src: (_d = (_c = getConnections(config)[0]) == null ? void 0 : _c.connector) == null ? void 0 : _d.icon,
|
|
632
|
-
alt: "",
|
|
633
|
-
className: "liq-mx-1 liq-h-[1rem] liq-w-[1rem]"
|
|
634
|
-
}
|
|
635
|
-
),
|
|
636
|
-
/* @__PURE__ */ jsx("div", { children: (_f = (_e = getConnections(config)[0]) == null ? void 0 : _e.connector) == null ? void 0 : _f.name })
|
|
637
|
-
] })
|
|
620
|
+
account.address && siginingTransactionsCount > 0 && /* @__PURE__ */ jsx("div", { className: "liq-flex liq-items-center liq-justify-center liq-text-neutral-300 liq-text-sm", children: /* @__PURE__ */ jsxs("div", { children: [
|
|
621
|
+
"You will be asked to sign ",
|
|
622
|
+
siginingTransactionsCount,
|
|
623
|
+
" ",
|
|
624
|
+
siginingTransactionsCount > 1 ? "transactions" : "transaction",
|
|
625
|
+
" ",
|
|
626
|
+
"on your wallet"
|
|
627
|
+
] }) })
|
|
638
628
|
]
|
|
639
629
|
}
|
|
640
630
|
) });
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
4
4
|
const jsxRuntime = require("react/jsx-runtime");
|
|
5
5
|
const formatAmount = require("@multiversx/sdk-dapp-utils/out/helpers/formatAmount");
|
|
6
6
|
const react = require("@reown/appkit/react");
|
|
7
|
-
const core = require("@wagmi/core");
|
|
8
7
|
const debounce = require("lodash/debounce");
|
|
9
8
|
const React = require("react");
|
|
10
9
|
const reactToastify = require("react-toastify");
|
|
@@ -70,7 +69,7 @@ const Transfer = ({
|
|
|
70
69
|
onNavigate,
|
|
71
70
|
onChangeDirection
|
|
72
71
|
}) => {
|
|
73
|
-
var _a, _b
|
|
72
|
+
var _a, _b;
|
|
74
73
|
const ref = React.useRef(null);
|
|
75
74
|
const [isTokenSelectorVisible, setIsTokenSelectorVisible] = React.useState(false);
|
|
76
75
|
const [forceRefetchRate, setForceRefetchRate] = React.useState(1);
|
|
@@ -79,7 +78,6 @@ const Transfer = ({
|
|
|
79
78
|
const account = reactjs_hooks_useAccount.useAccount();
|
|
80
79
|
const { switchNetwork } = react.useAppKitNetwork();
|
|
81
80
|
const {
|
|
82
|
-
config,
|
|
83
81
|
options,
|
|
84
82
|
supportedChains: sdkChains,
|
|
85
83
|
nativeAuthToken,
|
|
@@ -276,6 +274,7 @@ const Transfer = ({
|
|
|
276
274
|
handleSubmit,
|
|
277
275
|
resetSwapForm
|
|
278
276
|
} = reactjs_hooks_useBridgeFormik.useBridgeFormik({
|
|
277
|
+
isMvxConnected: Boolean(mvxAddress),
|
|
279
278
|
rate,
|
|
280
279
|
sender: mvxAddress ?? "",
|
|
281
280
|
receiver: account.address ?? "",
|
|
@@ -516,6 +515,7 @@ const Transfer = ({
|
|
|
516
515
|
mvxAddress && isAuthenticated && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
517
516
|
reactjs_components_base_MxButton_MxButton.MxButton,
|
|
518
517
|
{
|
|
518
|
+
"data-testid": "submit-button",
|
|
519
519
|
type: "submit",
|
|
520
520
|
variant: "neutral-850",
|
|
521
521
|
className: "liq-w-full disabled:liq-bg-neutral-850/50 liq-py-3 hover:enabled:liq-bg-primary !liq-text-primary-200",
|
|
@@ -538,26 +538,14 @@ const Transfer = ({
|
|
|
538
538
|
}
|
|
539
539
|
)
|
|
540
540
|
] }),
|
|
541
|
-
account.address && siginingTransactionsCount > 0 && /* @__PURE__ */ jsxRuntime.
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
" "
|
|
550
|
-
] }),
|
|
551
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
552
|
-
"img",
|
|
553
|
-
{
|
|
554
|
-
src: (_d = (_c = core.getConnections(config)[0]) == null ? void 0 : _c.connector) == null ? void 0 : _d.icon,
|
|
555
|
-
alt: "",
|
|
556
|
-
className: "liq-mx-1 liq-h-[1rem] liq-w-[1rem]"
|
|
557
|
-
}
|
|
558
|
-
),
|
|
559
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { children: (_f = (_e = core.getConnections(config)[0]) == null ? void 0 : _e.connector) == null ? void 0 : _f.name })
|
|
560
|
-
] })
|
|
541
|
+
account.address && siginingTransactionsCount > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-flex liq-items-center liq-justify-center liq-text-neutral-300 liq-text-sm", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
542
|
+
"You will be asked to sign ",
|
|
543
|
+
siginingTransactionsCount,
|
|
544
|
+
" ",
|
|
545
|
+
siginingTransactionsCount > 1 ? "transactions" : "transaction",
|
|
546
|
+
" ",
|
|
547
|
+
"on your wallet"
|
|
548
|
+
] }) })
|
|
561
549
|
]
|
|
562
550
|
}
|
|
563
551
|
) });
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { formatAmount } from "@multiversx/sdk-dapp-utils/out/helpers/formatAmount";
|
|
3
3
|
import { useAppKitNetwork } from "@reown/appkit/react";
|
|
4
|
-
import { getConnections } from "@wagmi/core";
|
|
5
4
|
import debounce from "lodash/debounce";
|
|
6
5
|
import { useRef, useState, useMemo, useCallback, useEffect } from "react";
|
|
7
6
|
import { toast } from "react-toastify";
|
|
@@ -67,7 +66,7 @@ const Transfer = ({
|
|
|
67
66
|
onNavigate,
|
|
68
67
|
onChangeDirection
|
|
69
68
|
}) => {
|
|
70
|
-
var _a, _b
|
|
69
|
+
var _a, _b;
|
|
71
70
|
const ref = useRef(null);
|
|
72
71
|
const [isTokenSelectorVisible, setIsTokenSelectorVisible] = useState(false);
|
|
73
72
|
const [forceRefetchRate, setForceRefetchRate] = useState(1);
|
|
@@ -76,7 +75,6 @@ const Transfer = ({
|
|
|
76
75
|
const account = useAccount();
|
|
77
76
|
const { switchNetwork } = useAppKitNetwork();
|
|
78
77
|
const {
|
|
79
|
-
config,
|
|
80
78
|
options,
|
|
81
79
|
supportedChains: sdkChains,
|
|
82
80
|
nativeAuthToken,
|
|
@@ -273,6 +271,7 @@ const Transfer = ({
|
|
|
273
271
|
handleSubmit,
|
|
274
272
|
resetSwapForm
|
|
275
273
|
} = useBridgeFormik({
|
|
274
|
+
isMvxConnected: Boolean(mvxAddress),
|
|
276
275
|
rate,
|
|
277
276
|
sender: mvxAddress ?? "",
|
|
278
277
|
receiver: account.address ?? "",
|
|
@@ -513,6 +512,7 @@ const Transfer = ({
|
|
|
513
512
|
mvxAddress && isAuthenticated && /* @__PURE__ */ jsxs(
|
|
514
513
|
MxButton,
|
|
515
514
|
{
|
|
515
|
+
"data-testid": "submit-button",
|
|
516
516
|
type: "submit",
|
|
517
517
|
variant: "neutral-850",
|
|
518
518
|
className: "liq-w-full disabled:liq-bg-neutral-850/50 liq-py-3 hover:enabled:liq-bg-primary !liq-text-primary-200",
|
|
@@ -535,26 +535,14 @@ const Transfer = ({
|
|
|
535
535
|
}
|
|
536
536
|
)
|
|
537
537
|
] }),
|
|
538
|
-
account.address && siginingTransactionsCount > 0 && /* @__PURE__ */
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
" "
|
|
547
|
-
] }),
|
|
548
|
-
/* @__PURE__ */ jsx(
|
|
549
|
-
"img",
|
|
550
|
-
{
|
|
551
|
-
src: (_d = (_c = getConnections(config)[0]) == null ? void 0 : _c.connector) == null ? void 0 : _d.icon,
|
|
552
|
-
alt: "",
|
|
553
|
-
className: "liq-mx-1 liq-h-[1rem] liq-w-[1rem]"
|
|
554
|
-
}
|
|
555
|
-
),
|
|
556
|
-
/* @__PURE__ */ jsx("div", { children: (_f = (_e = getConnections(config)[0]) == null ? void 0 : _e.connector) == null ? void 0 : _f.name })
|
|
557
|
-
] })
|
|
538
|
+
account.address && siginingTransactionsCount > 0 && /* @__PURE__ */ jsx("div", { className: "liq-flex liq-items-center liq-justify-center liq-text-neutral-300 liq-text-sm", children: /* @__PURE__ */ jsxs("div", { children: [
|
|
539
|
+
"You will be asked to sign ",
|
|
540
|
+
siginingTransactionsCount,
|
|
541
|
+
" ",
|
|
542
|
+
siginingTransactionsCount > 1 ? "transactions" : "transaction",
|
|
543
|
+
" ",
|
|
544
|
+
"on your wallet"
|
|
545
|
+
] }) })
|
|
558
546
|
]
|
|
559
547
|
}
|
|
560
548
|
) });
|
|
@@ -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 {
|
package/style.css
CHANGED
|
@@ -692,9 +692,6 @@ video {
|
|
|
692
692
|
.liq-h-\[1\.5rem\]{
|
|
693
693
|
height: 1.5rem;
|
|
694
694
|
}
|
|
695
|
-
.liq-h-\[1rem\]{
|
|
696
|
-
height: 1rem;
|
|
697
|
-
}
|
|
698
695
|
.liq-h-full{
|
|
699
696
|
height: 100%;
|
|
700
697
|
}
|
|
@@ -743,9 +740,6 @@ video {
|
|
|
743
740
|
.liq-w-\[1\.5rem\]{
|
|
744
741
|
width: 1.5rem;
|
|
745
742
|
}
|
|
746
|
-
.liq-w-\[1rem\]{
|
|
747
|
-
width: 1rem;
|
|
748
|
-
}
|
|
749
743
|
.liq-w-full{
|
|
750
744
|
width: 100%;
|
|
751
745
|
}
|