@multiversx/sdk-dapp-liquidity 1.1.1-alpha.0 → 1.1.1-alpha.1
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/BridgeForm.d.ts +3 -1
- package/reactjs/components/BridgeForm/BridgeForm.js +4 -3
- package/reactjs/components/BridgeForm/BridgeForm.mjs +4 -3
- package/reactjs/components/BridgeForm/Deposit.js +3 -12
- package/reactjs/components/BridgeForm/Deposit.mjs +3 -12
- package/reactjs/components/BridgeForm/Transfer.js +43 -28
- package/reactjs/components/BridgeForm/Transfer.mjs +43 -28
- package/reactjs/components/ToggleDirection/ToggleDirection.d.ts +3 -0
- package/reactjs/components/ToggleDirection/ToggleDirection.js +23 -0
- package/reactjs/components/ToggleDirection/ToggleDirection.mjs +22 -0
- package/reactjs/context/Web3AppProvider.d.ts +7 -3
- package/reactjs/context/Web3AppProvider.js +6 -2
- package/reactjs/context/Web3AppProvider.mjs +6 -2
- package/reactjs/hooks/useFetchTokens.d.ts +1 -1
- package/reactjs/hooks/useFetchTokens.js +6 -1
- package/reactjs/hooks/useFetchTokens.mjs +6 -1
- package/reactjs/queries/useGetAllTokens.query.d.ts +4 -1
- package/reactjs/queries/useGetAllTokens.query.js +5 -4
- package/reactjs/queries/useGetAllTokens.query.mjs +5 -4
- package/style.css +9 -0
- package/reactjs/hooks/useFiatData.d.ts +0 -33
- package/reactjs/hooks/useFiatData.js +0 -68
- package/reactjs/hooks/useFiatData.mjs +0 -67
package/package.json
CHANGED
|
@@ -12,10 +12,12 @@ interface BridgeFormProps {
|
|
|
12
12
|
forcedDestinationTokenSymbol?: string;
|
|
13
13
|
onSuccessfullySentTransaction?: (txHashes?: string[]) => void;
|
|
14
14
|
onFailedSentTransaction?: (message?: string) => void;
|
|
15
|
+
onSuccessfullySentMvxTransaction?: (txHashes?: string[]) => void;
|
|
16
|
+
onFailedSentMvxTransaction?: (message?: string) => void;
|
|
15
17
|
onHistoryClose?: () => void;
|
|
16
18
|
onMvxConnect: () => void;
|
|
17
19
|
onMvxDisconnect?: () => void;
|
|
18
20
|
onNavigate?: (url: string, options?: object) => void;
|
|
19
21
|
}
|
|
20
|
-
export declare const BridgeForm: ({ mvxChainId, mvxAddress, username, callbackRoute, firstTokenIdentifier, secondTokenIdentifier, firstTokenAmount, secondTokenAmount, refetchTrigger, showHistory, forcedDestinationTokenSymbol, onSuccessfullySentTransaction, onFailedSentTransaction, onMvxConnect, onMvxDisconnect, onHistoryClose, onNavigate }: BridgeFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare const BridgeForm: ({ mvxChainId, mvxAddress, username, callbackRoute, firstTokenIdentifier, secondTokenIdentifier, firstTokenAmount, secondTokenAmount, refetchTrigger, showHistory, forcedDestinationTokenSymbol, onSuccessfullySentTransaction, onSuccessfullySentMvxTransaction, onFailedSentMvxTransaction, onFailedSentTransaction, onMvxConnect, onMvxDisconnect, onHistoryClose, onNavigate }: BridgeFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
23
|
export {};
|
|
@@ -18,6 +18,8 @@ const BridgeForm = ({
|
|
|
18
18
|
showHistory,
|
|
19
19
|
forcedDestinationTokenSymbol,
|
|
20
20
|
onSuccessfullySentTransaction,
|
|
21
|
+
onSuccessfullySentMvxTransaction,
|
|
22
|
+
onFailedSentMvxTransaction,
|
|
21
23
|
onFailedSentTransaction,
|
|
22
24
|
onMvxConnect,
|
|
23
25
|
onMvxDisconnect,
|
|
@@ -26,7 +28,6 @@ const BridgeForm = ({
|
|
|
26
28
|
}) => {
|
|
27
29
|
const [direction, setDirection] = React.useState("deposit");
|
|
28
30
|
const handleChangeDirection = () => {
|
|
29
|
-
console.log("handleChangeDirection", direction);
|
|
30
31
|
setDirection(
|
|
31
32
|
(prevState) => prevState === "deposit" ? "withdraw" : "deposit"
|
|
32
33
|
);
|
|
@@ -70,8 +71,8 @@ const BridgeForm = ({
|
|
|
70
71
|
forcedDestinationTokenSymbol,
|
|
71
72
|
direction,
|
|
72
73
|
onChangeDirection: handleChangeDirection,
|
|
73
|
-
onSuccessfullySentTransaction,
|
|
74
|
-
onFailedSentTransaction,
|
|
74
|
+
onSuccessfullySentTransaction: onSuccessfullySentMvxTransaction,
|
|
75
|
+
onFailedSentTransaction: onFailedSentMvxTransaction,
|
|
75
76
|
onHistoryClose,
|
|
76
77
|
onMvxConnect,
|
|
77
78
|
onMvxDisconnect,
|
|
@@ -15,6 +15,8 @@ const BridgeForm = ({
|
|
|
15
15
|
showHistory,
|
|
16
16
|
forcedDestinationTokenSymbol,
|
|
17
17
|
onSuccessfullySentTransaction,
|
|
18
|
+
onSuccessfullySentMvxTransaction,
|
|
19
|
+
onFailedSentMvxTransaction,
|
|
18
20
|
onFailedSentTransaction,
|
|
19
21
|
onMvxConnect,
|
|
20
22
|
onMvxDisconnect,
|
|
@@ -23,7 +25,6 @@ const BridgeForm = ({
|
|
|
23
25
|
}) => {
|
|
24
26
|
const [direction, setDirection] = useState("deposit");
|
|
25
27
|
const handleChangeDirection = () => {
|
|
26
|
-
console.log("handleChangeDirection", direction);
|
|
27
28
|
setDirection(
|
|
28
29
|
(prevState) => prevState === "deposit" ? "withdraw" : "deposit"
|
|
29
30
|
);
|
|
@@ -67,8 +68,8 @@ const BridgeForm = ({
|
|
|
67
68
|
forcedDestinationTokenSymbol,
|
|
68
69
|
direction,
|
|
69
70
|
onChangeDirection: handleChangeDirection,
|
|
70
|
-
onSuccessfullySentTransaction,
|
|
71
|
-
onFailedSentTransaction,
|
|
71
|
+
onSuccessfullySentTransaction: onSuccessfullySentMvxTransaction,
|
|
72
|
+
onFailedSentTransaction: onFailedSentMvxTransaction,
|
|
72
73
|
onHistoryClose,
|
|
73
74
|
onMvxConnect,
|
|
74
75
|
onMvxDisconnect,
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
const jsxRuntime = require("react/jsx-runtime");
|
|
5
|
-
const freeSolidSvgIcons = require("@fortawesome/free-solid-svg-icons");
|
|
6
5
|
const faSpinner = require("@fortawesome/free-solid-svg-icons/faSpinner");
|
|
7
6
|
const reactFontawesome = require("@fortawesome/react-fontawesome");
|
|
8
7
|
const formatAmount = require("@multiversx/sdk-dapp-utils/out/helpers/formatAmount");
|
|
@@ -42,6 +41,7 @@ require("wagmi");
|
|
|
42
41
|
const reactjs_components_Connect_MvxConnectButton = require("../Connect/MvxConnectButton.js");
|
|
43
42
|
const reactjs_components_Connect_BridgeAccountDisplay = require("../Connect/BridgeAccountDisplay.js");
|
|
44
43
|
const reactjs_components_Connect_MvxAccountDisplay = require("../Connect/MvxAccountDisplay.js");
|
|
44
|
+
const reactjs_components_ToggleDirection_ToggleDirection = require("../ToggleDirection/ToggleDirection.js");
|
|
45
45
|
const reactjs_components_TokenSelector_TokenSelector = require("../TokenSelector/TokenSelector.js");
|
|
46
46
|
const viem = require("viem");
|
|
47
47
|
const actions = require("viem/actions");
|
|
@@ -332,9 +332,7 @@ const Deposit = ({
|
|
|
332
332
|
},
|
|
333
333
|
[fromOptions, updateUrlParams]
|
|
334
334
|
);
|
|
335
|
-
const handleChangeDirection = (
|
|
336
|
-
e.preventDefault();
|
|
337
|
-
e.stopPropagation();
|
|
335
|
+
const handleChangeDirection = () => {
|
|
338
336
|
if (!firstToken || !secondToken) {
|
|
339
337
|
return;
|
|
340
338
|
}
|
|
@@ -622,7 +620,6 @@ const Deposit = ({
|
|
|
622
620
|
});
|
|
623
621
|
}, [mvxTokensWithBalances, secondToken == null ? void 0 : secondToken.address]);
|
|
624
622
|
React.useEffect(() => {
|
|
625
|
-
console.log("Deposit");
|
|
626
623
|
if (firstTokenAmount) {
|
|
627
624
|
formik.setFieldValue(
|
|
628
625
|
reactjs_hooks_useBridgeFormik.BridgeFormikValuesEnum.firstAmount,
|
|
@@ -704,13 +701,7 @@ const Deposit = ({
|
|
|
704
701
|
]
|
|
705
702
|
}
|
|
706
703
|
),
|
|
707
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
708
|
-
reactFontawesome.FontAwesomeIcon,
|
|
709
|
-
{
|
|
710
|
-
icon: freeSolidSvgIcons.faExchangeAlt,
|
|
711
|
-
className: "liq-h-6 liq-w-6 liq-text-neutral-100 liq-mx-auto liq-my-2"
|
|
712
|
-
}
|
|
713
|
-
) }),
|
|
704
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-absolute liq-left-[6%] liq-top-[40%] -liq-mt-1 liq-z-10", children: /* @__PURE__ */ jsxRuntime.jsx(reactjs_components_ToggleDirection_ToggleDirection.ToggleDirection, { onChangeDirection: handleChangeDirection }) }),
|
|
714
705
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
715
706
|
reactjs_components_AmountCard_AmountCard.AmountCard,
|
|
716
707
|
{
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { faExchangeAlt } from "@fortawesome/free-solid-svg-icons";
|
|
3
2
|
import { faSpinner } from "@fortawesome/free-solid-svg-icons/faSpinner";
|
|
4
3
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
5
4
|
import { formatAmount } from "@multiversx/sdk-dapp-utils/out/helpers/formatAmount";
|
|
@@ -39,6 +38,7 @@ import "wagmi";
|
|
|
39
38
|
import { MvxConnectButton } from "../Connect/MvxConnectButton.mjs";
|
|
40
39
|
import { BridgeAccountDisplay } from "../Connect/BridgeAccountDisplay.mjs";
|
|
41
40
|
import { MvxAccountDisplay } from "../Connect/MvxAccountDisplay.mjs";
|
|
41
|
+
import { ToggleDirection } from "../ToggleDirection/ToggleDirection.mjs";
|
|
42
42
|
import { TokenSelector } from "../TokenSelector/TokenSelector.mjs";
|
|
43
43
|
import { hexToString } from "viem";
|
|
44
44
|
import { waitForTransactionReceipt as waitForTransactionReceipt$1, getTransaction, call } from "viem/actions";
|
|
@@ -329,9 +329,7 @@ const Deposit = ({
|
|
|
329
329
|
},
|
|
330
330
|
[fromOptions, updateUrlParams]
|
|
331
331
|
);
|
|
332
|
-
const handleChangeDirection = (
|
|
333
|
-
e.preventDefault();
|
|
334
|
-
e.stopPropagation();
|
|
332
|
+
const handleChangeDirection = () => {
|
|
335
333
|
if (!firstToken || !secondToken) {
|
|
336
334
|
return;
|
|
337
335
|
}
|
|
@@ -619,7 +617,6 @@ const Deposit = ({
|
|
|
619
617
|
});
|
|
620
618
|
}, [mvxTokensWithBalances, secondToken == null ? void 0 : secondToken.address]);
|
|
621
619
|
useEffect(() => {
|
|
622
|
-
console.log("Deposit");
|
|
623
620
|
if (firstTokenAmount) {
|
|
624
621
|
formik.setFieldValue(
|
|
625
622
|
BridgeFormikValuesEnum.firstAmount,
|
|
@@ -701,13 +698,7 @@ const Deposit = ({
|
|
|
701
698
|
]
|
|
702
699
|
}
|
|
703
700
|
),
|
|
704
|
-
/* @__PURE__ */ jsx("
|
|
705
|
-
FontAwesomeIcon,
|
|
706
|
-
{
|
|
707
|
-
icon: faExchangeAlt,
|
|
708
|
-
className: "liq-h-6 liq-w-6 liq-text-neutral-100 liq-mx-auto liq-my-2"
|
|
709
|
-
}
|
|
710
|
-
) }),
|
|
701
|
+
/* @__PURE__ */ jsx("div", { className: "liq-absolute liq-left-[6%] liq-top-[40%] -liq-mt-1 liq-z-10", children: /* @__PURE__ */ jsx(ToggleDirection, { onChangeDirection: handleChangeDirection }) }),
|
|
711
702
|
/* @__PURE__ */ jsxs(
|
|
712
703
|
AmountCard,
|
|
713
704
|
{
|
|
@@ -2,19 +2,28 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
const jsxRuntime = require("react/jsx-runtime");
|
|
5
|
-
const freeSolidSvgIcons = require("@fortawesome/free-solid-svg-icons");
|
|
6
|
-
const reactFontawesome = require("@fortawesome/react-fontawesome");
|
|
7
5
|
const formatAmount = require("@multiversx/sdk-dapp-utils/out/helpers/formatAmount");
|
|
8
6
|
const react = require("@reown/appkit/react");
|
|
9
7
|
const debounce = require("lodash/debounce");
|
|
10
8
|
const React = require("react");
|
|
11
9
|
const reactToastify = require("react-toastify");
|
|
10
|
+
const helpers_getApiURL = require("../../../helpers/getApiURL.js");
|
|
11
|
+
const types_providerType = require("../../../types/providerType.js");
|
|
12
12
|
const reactjs_constants_index = require("../../constants/index.js");
|
|
13
13
|
const reactjs_context_useWeb3App = require("../../context/useWeb3App.js");
|
|
14
|
+
require("yup");
|
|
15
|
+
require("@multiversx/sdk-dapp-utils/out/helpers/parseAmount");
|
|
16
|
+
require("../../../bignumber-B8vjg9qn.js");
|
|
14
17
|
const reactjs_hooks_useAccount = require("../../hooks/useAccount.js");
|
|
18
|
+
require("axios");
|
|
15
19
|
const reactjs_hooks_useBridgeFormik = require("../../hooks/useBridgeFormik.js");
|
|
16
20
|
const reactjs_hooks_useFetchBridgeData = require("../../hooks/useFetchBridgeData.js");
|
|
21
|
+
require("@tanstack/react-query");
|
|
17
22
|
const reactjs_hooks_useGetChainId = require("../../hooks/useGetChainId.js");
|
|
23
|
+
const reactjs_hooks_useSendTransactions = require("../../hooks/useSendTransactions.js");
|
|
24
|
+
require("@reown/appkit-adapter-solana/react");
|
|
25
|
+
require("@solana/web3.js");
|
|
26
|
+
require("wagmi");
|
|
18
27
|
const reactjs_queries_useGetHistory_query = require("../../queries/useGetHistory.query.js");
|
|
19
28
|
const reactjs_queries_useGetRate_mutation = require("../../queries/useGetRate.mutation.js");
|
|
20
29
|
const reactjs_utils_getCompletePathname = require("../../utils/getCompletePathname.js");
|
|
@@ -27,16 +36,17 @@ require("../base/MxCard/MxCard.js");
|
|
|
27
36
|
require("../base/MxLink/MxLink.js");
|
|
28
37
|
require("../base/MxSearch/MxSearch.js");
|
|
29
38
|
require("@fortawesome/free-solid-svg-icons/faClose");
|
|
39
|
+
require("@fortawesome/react-fontawesome");
|
|
30
40
|
require("@headlessui/react");
|
|
31
41
|
require("react-dom");
|
|
32
42
|
require("react-popper");
|
|
33
43
|
require("../base/MxTooltip/components/TooltipContainer/TooltipContainer.js");
|
|
34
44
|
const reactjs_components_BridgeHistory_BridgeHistory = require("../BridgeHistory/BridgeHistory.js");
|
|
35
45
|
const reactjs_components_Connect_BridgeConnectButton = require("../Connect/BridgeConnectButton.js");
|
|
36
|
-
require("wagmi");
|
|
37
46
|
const reactjs_components_Connect_MvxConnectButton = require("../Connect/MvxConnectButton.js");
|
|
38
47
|
const reactjs_components_Connect_BridgeAccountDisplay = require("../Connect/BridgeAccountDisplay.js");
|
|
39
48
|
const reactjs_components_Connect_MvxAccountDisplay = require("../Connect/MvxAccountDisplay.js");
|
|
49
|
+
const reactjs_components_ToggleDirection_ToggleDirection = require("../ToggleDirection/ToggleDirection.js");
|
|
40
50
|
const reactjs_components_TokenSelector_TokenSelector = require("../TokenSelector/TokenSelector.js");
|
|
41
51
|
const getConnections = require("../../../getConnections-DufiP2Qa.js");
|
|
42
52
|
let fetchRateInterval;
|
|
@@ -66,6 +76,7 @@ const Transfer = ({
|
|
|
66
76
|
const [isTokenSelectorVisible, setIsTokenSelectorVisible] = React.useState(false);
|
|
67
77
|
const [forceRefetchRate, setForceRefetchRate] = React.useState(1);
|
|
68
78
|
const [siginingTransactionsCount, setSigningTransactionsCount] = React.useState(0);
|
|
79
|
+
const [latestTransactions, setLatestTransactions] = React.useState([]);
|
|
69
80
|
const account = reactjs_hooks_useAccount.useAccount();
|
|
70
81
|
const { switchNetwork } = react.useAppKitNetwork();
|
|
71
82
|
const {
|
|
@@ -75,7 +86,12 @@ const Transfer = ({
|
|
|
75
86
|
nativeAuthToken
|
|
76
87
|
} = reactjs_context_useWeb3App.useWeb3App();
|
|
77
88
|
const chainId = reactjs_hooks_useGetChainId.useGetChainId();
|
|
78
|
-
const
|
|
89
|
+
const sendTransactions = reactjs_hooks_useSendTransactions.useSendTransactions();
|
|
90
|
+
const {
|
|
91
|
+
signMvxTransactions,
|
|
92
|
+
resetMvxTransactionHash,
|
|
93
|
+
latestMvxTransactionHash
|
|
94
|
+
} = reactjs_context_useWeb3App.useWeb3App();
|
|
79
95
|
const {
|
|
80
96
|
evmTokensWithBalances,
|
|
81
97
|
mvxTokensWithBalances,
|
|
@@ -290,9 +306,7 @@ const Transfer = ({
|
|
|
290
306
|
},
|
|
291
307
|
[fromOptions, updateUrlParams]
|
|
292
308
|
);
|
|
293
|
-
const handleChangeDirection = (
|
|
294
|
-
e.preventDefault();
|
|
295
|
-
e.stopPropagation();
|
|
309
|
+
const handleChangeDirection = () => {
|
|
296
310
|
if (!firstToken || !secondToken) {
|
|
297
311
|
return;
|
|
298
312
|
}
|
|
@@ -371,10 +385,8 @@ const Transfer = ({
|
|
|
371
385
|
async ({ transactions }) => {
|
|
372
386
|
setSigningTransactionsCount(() => transactions.length);
|
|
373
387
|
try {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
);
|
|
377
|
-
console.log("Signed transactions:", signedTransactions);
|
|
388
|
+
await signMvxTransactions(transactions);
|
|
389
|
+
setLatestTransactions(transactions);
|
|
378
390
|
} catch (e) {
|
|
379
391
|
console.error(e);
|
|
380
392
|
reactToastify.toast.dismiss();
|
|
@@ -426,16 +438,7 @@ const Transfer = ({
|
|
|
426
438
|
const amountErrorSecondInput = React.useMemo(() => {
|
|
427
439
|
return secondAmount !== "" ? fromChainError ?? secondAmountError : void 0;
|
|
428
440
|
}, [fromChainError, secondAmountError, secondAmount]);
|
|
429
|
-
console.log("Transfer", {
|
|
430
|
-
firstTokenIdentifier,
|
|
431
|
-
secondTokenIdentifier,
|
|
432
|
-
firstTokenAmount,
|
|
433
|
-
secondTokenAmount
|
|
434
|
-
});
|
|
435
441
|
React.useEffect(() => {
|
|
436
|
-
console.log({
|
|
437
|
-
firstAmount
|
|
438
|
-
});
|
|
439
442
|
if (!firstAmount) {
|
|
440
443
|
setSecondAmount("");
|
|
441
444
|
}
|
|
@@ -497,7 +500,6 @@ const Transfer = ({
|
|
|
497
500
|
});
|
|
498
501
|
}, [mvxTokensWithBalances, secondToken == null ? void 0 : secondToken.address]);
|
|
499
502
|
React.useEffect(() => {
|
|
500
|
-
console.log("Transfer");
|
|
501
503
|
if (firstTokenAmount) {
|
|
502
504
|
formik.setFieldValue(
|
|
503
505
|
reactjs_hooks_useBridgeFormik.BridgeFormikValuesEnum.firstAmount,
|
|
@@ -515,6 +517,25 @@ const Transfer = ({
|
|
|
515
517
|
handleOnChangeSecondAmount(secondTokenAmount);
|
|
516
518
|
}
|
|
517
519
|
}, [secondTokenAmount]);
|
|
520
|
+
React.useEffect(() => {
|
|
521
|
+
if (latestMvxTransactionHash) {
|
|
522
|
+
const txHash = latestMvxTransactionHash;
|
|
523
|
+
resetMvxTransactionHash == null ? void 0 : resetMvxTransactionHash();
|
|
524
|
+
onSuccessfullySentTransaction == null ? void 0 : onSuccessfullySentTransaction([txHash]);
|
|
525
|
+
sendTransactions({
|
|
526
|
+
transactions: latestTransactions,
|
|
527
|
+
provider: (rate == null ? void 0 : rate.provider) ?? types_providerType.ProviderType.None,
|
|
528
|
+
url: helpers_getApiURL.getApiURL() ?? "",
|
|
529
|
+
token: nativeAuthToken ?? ""
|
|
530
|
+
});
|
|
531
|
+
setLatestTransactions([]);
|
|
532
|
+
}
|
|
533
|
+
}, [
|
|
534
|
+
latestMvxTransactionHash,
|
|
535
|
+
latestTransactions,
|
|
536
|
+
rate == null ? void 0 : rate.provider,
|
|
537
|
+
sendTransactions
|
|
538
|
+
]);
|
|
518
539
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
519
540
|
"form",
|
|
520
541
|
{
|
|
@@ -584,13 +605,7 @@ const Transfer = ({
|
|
|
584
605
|
]
|
|
585
606
|
}
|
|
586
607
|
),
|
|
587
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
588
|
-
reactFontawesome.FontAwesomeIcon,
|
|
589
|
-
{
|
|
590
|
-
icon: freeSolidSvgIcons.faExchangeAlt,
|
|
591
|
-
className: "liq-h-6 liq-w-6 liq-text-neutral-100 liq-mx-auto liq-my-2"
|
|
592
|
-
}
|
|
593
|
-
) }),
|
|
608
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-absolute liq-left-[6%] liq-top-[40%] -liq-mt-1 liq-z-10", children: /* @__PURE__ */ jsxRuntime.jsx(reactjs_components_ToggleDirection_ToggleDirection.ToggleDirection, { onChangeDirection: handleChangeDirection }) }),
|
|
594
609
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
595
610
|
reactjs_components_AmountCard_AmountCard.AmountCard,
|
|
596
611
|
{
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { faExchangeAlt } from "@fortawesome/free-solid-svg-icons";
|
|
3
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
4
2
|
import { formatAmount } from "@multiversx/sdk-dapp-utils/out/helpers/formatAmount";
|
|
5
3
|
import { useAppKitNetwork } from "@reown/appkit/react";
|
|
6
4
|
import debounce from "lodash/debounce";
|
|
7
5
|
import { useRef, useState, useMemo, useCallback, useEffect } from "react";
|
|
8
6
|
import { toast } from "react-toastify";
|
|
7
|
+
import { getApiURL } from "../../../helpers/getApiURL.mjs";
|
|
8
|
+
import { ProviderType } from "../../../types/providerType.mjs";
|
|
9
9
|
import { safeWindow } from "../../constants/index.mjs";
|
|
10
10
|
import { useWeb3App } from "../../context/useWeb3App.mjs";
|
|
11
|
+
import "yup";
|
|
12
|
+
import "@multiversx/sdk-dapp-utils/out/helpers/parseAmount";
|
|
13
|
+
import "../../../bignumber-CKZkoo0g.mjs";
|
|
11
14
|
import { useAccount } from "../../hooks/useAccount.mjs";
|
|
15
|
+
import "axios";
|
|
12
16
|
import { useBridgeFormik, BridgeFormikValuesEnum } from "../../hooks/useBridgeFormik.mjs";
|
|
13
17
|
import { useFetchBridgeData } from "../../hooks/useFetchBridgeData.mjs";
|
|
18
|
+
import "@tanstack/react-query";
|
|
14
19
|
import { useGetChainId } from "../../hooks/useGetChainId.mjs";
|
|
20
|
+
import { useSendTransactions } from "../../hooks/useSendTransactions.mjs";
|
|
21
|
+
import "@reown/appkit-adapter-solana/react";
|
|
22
|
+
import "@solana/web3.js";
|
|
23
|
+
import "wagmi";
|
|
15
24
|
import { invalidateHistoryQuery } from "../../queries/useGetHistory.query.mjs";
|
|
16
25
|
import { useGetRateMutation } from "../../queries/useGetRate.mutation.mjs";
|
|
17
26
|
import { getCompletePathname } from "../../utils/getCompletePathname.mjs";
|
|
@@ -24,16 +33,17 @@ import "../base/MxCard/MxCard.mjs";
|
|
|
24
33
|
import "../base/MxLink/MxLink.mjs";
|
|
25
34
|
import "../base/MxSearch/MxSearch.mjs";
|
|
26
35
|
import "@fortawesome/free-solid-svg-icons/faClose";
|
|
36
|
+
import "@fortawesome/react-fontawesome";
|
|
27
37
|
import "@headlessui/react";
|
|
28
38
|
import "react-dom";
|
|
29
39
|
import "react-popper";
|
|
30
40
|
import "../base/MxTooltip/components/TooltipContainer/TooltipContainer.mjs";
|
|
31
41
|
import { BridgeHistory } from "../BridgeHistory/BridgeHistory.mjs";
|
|
32
42
|
import { BridgeConnectButton } from "../Connect/BridgeConnectButton.mjs";
|
|
33
|
-
import "wagmi";
|
|
34
43
|
import { MvxConnectButton } from "../Connect/MvxConnectButton.mjs";
|
|
35
44
|
import { BridgeAccountDisplay } from "../Connect/BridgeAccountDisplay.mjs";
|
|
36
45
|
import { MvxAccountDisplay } from "../Connect/MvxAccountDisplay.mjs";
|
|
46
|
+
import { ToggleDirection } from "../ToggleDirection/ToggleDirection.mjs";
|
|
37
47
|
import { TokenSelector } from "../TokenSelector/TokenSelector.mjs";
|
|
38
48
|
import { g as getConnections } from "../../../getConnections-BBxOUh4c.mjs";
|
|
39
49
|
let fetchRateInterval;
|
|
@@ -63,6 +73,7 @@ const Transfer = ({
|
|
|
63
73
|
const [isTokenSelectorVisible, setIsTokenSelectorVisible] = useState(false);
|
|
64
74
|
const [forceRefetchRate, setForceRefetchRate] = useState(1);
|
|
65
75
|
const [siginingTransactionsCount, setSigningTransactionsCount] = useState(0);
|
|
76
|
+
const [latestTransactions, setLatestTransactions] = useState([]);
|
|
66
77
|
const account = useAccount();
|
|
67
78
|
const { switchNetwork } = useAppKitNetwork();
|
|
68
79
|
const {
|
|
@@ -72,7 +83,12 @@ const Transfer = ({
|
|
|
72
83
|
nativeAuthToken
|
|
73
84
|
} = useWeb3App();
|
|
74
85
|
const chainId = useGetChainId();
|
|
75
|
-
const
|
|
86
|
+
const sendTransactions = useSendTransactions();
|
|
87
|
+
const {
|
|
88
|
+
signMvxTransactions,
|
|
89
|
+
resetMvxTransactionHash,
|
|
90
|
+
latestMvxTransactionHash
|
|
91
|
+
} = useWeb3App();
|
|
76
92
|
const {
|
|
77
93
|
evmTokensWithBalances,
|
|
78
94
|
mvxTokensWithBalances,
|
|
@@ -287,9 +303,7 @@ const Transfer = ({
|
|
|
287
303
|
},
|
|
288
304
|
[fromOptions, updateUrlParams]
|
|
289
305
|
);
|
|
290
|
-
const handleChangeDirection = (
|
|
291
|
-
e.preventDefault();
|
|
292
|
-
e.stopPropagation();
|
|
306
|
+
const handleChangeDirection = () => {
|
|
293
307
|
if (!firstToken || !secondToken) {
|
|
294
308
|
return;
|
|
295
309
|
}
|
|
@@ -368,10 +382,8 @@ const Transfer = ({
|
|
|
368
382
|
async ({ transactions }) => {
|
|
369
383
|
setSigningTransactionsCount(() => transactions.length);
|
|
370
384
|
try {
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
);
|
|
374
|
-
console.log("Signed transactions:", signedTransactions);
|
|
385
|
+
await signMvxTransactions(transactions);
|
|
386
|
+
setLatestTransactions(transactions);
|
|
375
387
|
} catch (e) {
|
|
376
388
|
console.error(e);
|
|
377
389
|
toast.dismiss();
|
|
@@ -423,16 +435,7 @@ const Transfer = ({
|
|
|
423
435
|
const amountErrorSecondInput = useMemo(() => {
|
|
424
436
|
return secondAmount !== "" ? fromChainError ?? secondAmountError : void 0;
|
|
425
437
|
}, [fromChainError, secondAmountError, secondAmount]);
|
|
426
|
-
console.log("Transfer", {
|
|
427
|
-
firstTokenIdentifier,
|
|
428
|
-
secondTokenIdentifier,
|
|
429
|
-
firstTokenAmount,
|
|
430
|
-
secondTokenAmount
|
|
431
|
-
});
|
|
432
438
|
useEffect(() => {
|
|
433
|
-
console.log({
|
|
434
|
-
firstAmount
|
|
435
|
-
});
|
|
436
439
|
if (!firstAmount) {
|
|
437
440
|
setSecondAmount("");
|
|
438
441
|
}
|
|
@@ -494,7 +497,6 @@ const Transfer = ({
|
|
|
494
497
|
});
|
|
495
498
|
}, [mvxTokensWithBalances, secondToken == null ? void 0 : secondToken.address]);
|
|
496
499
|
useEffect(() => {
|
|
497
|
-
console.log("Transfer");
|
|
498
500
|
if (firstTokenAmount) {
|
|
499
501
|
formik.setFieldValue(
|
|
500
502
|
BridgeFormikValuesEnum.firstAmount,
|
|
@@ -512,6 +514,25 @@ const Transfer = ({
|
|
|
512
514
|
handleOnChangeSecondAmount(secondTokenAmount);
|
|
513
515
|
}
|
|
514
516
|
}, [secondTokenAmount]);
|
|
517
|
+
useEffect(() => {
|
|
518
|
+
if (latestMvxTransactionHash) {
|
|
519
|
+
const txHash = latestMvxTransactionHash;
|
|
520
|
+
resetMvxTransactionHash == null ? void 0 : resetMvxTransactionHash();
|
|
521
|
+
onSuccessfullySentTransaction == null ? void 0 : onSuccessfullySentTransaction([txHash]);
|
|
522
|
+
sendTransactions({
|
|
523
|
+
transactions: latestTransactions,
|
|
524
|
+
provider: (rate == null ? void 0 : rate.provider) ?? ProviderType.None,
|
|
525
|
+
url: getApiURL() ?? "",
|
|
526
|
+
token: nativeAuthToken ?? ""
|
|
527
|
+
});
|
|
528
|
+
setLatestTransactions([]);
|
|
529
|
+
}
|
|
530
|
+
}, [
|
|
531
|
+
latestMvxTransactionHash,
|
|
532
|
+
latestTransactions,
|
|
533
|
+
rate == null ? void 0 : rate.provider,
|
|
534
|
+
sendTransactions
|
|
535
|
+
]);
|
|
515
536
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
|
|
516
537
|
"form",
|
|
517
538
|
{
|
|
@@ -581,13 +602,7 @@ const Transfer = ({
|
|
|
581
602
|
]
|
|
582
603
|
}
|
|
583
604
|
),
|
|
584
|
-
/* @__PURE__ */ jsx("
|
|
585
|
-
FontAwesomeIcon,
|
|
586
|
-
{
|
|
587
|
-
icon: faExchangeAlt,
|
|
588
|
-
className: "liq-h-6 liq-w-6 liq-text-neutral-100 liq-mx-auto liq-my-2"
|
|
589
|
-
}
|
|
590
|
-
) }),
|
|
605
|
+
/* @__PURE__ */ jsx("div", { className: "liq-absolute liq-left-[6%] liq-top-[40%] -liq-mt-1 liq-z-10", children: /* @__PURE__ */ jsx(ToggleDirection, { onChangeDirection: handleChangeDirection }) }),
|
|
591
606
|
/* @__PURE__ */ jsxs(
|
|
592
607
|
AmountCard,
|
|
593
608
|
{
|
|
@@ -0,0 +1,23 @@
|
|
|
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 HugImage = "data:image/svg+xml,%3csvg%20width='23'%20height='23'%20viewBox='0%200%2023%2023'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='23'%20height='23'%20rx='11.5'%20fill='%2314151A'/%3e%3ccircle%20cx='11.5'%20cy='7'%20r='1'%20fill='%23737373'/%3e%3ccircle%20cx='11.5'%20cy='10'%20r='1'%20fill='%23737373'/%3e%3cpath%20d='M11.4297%2016.1641L8.89844%2013.6328C8.86328%2013.5977%208.86328%2013.5391%208.89844%2013.5039C8.93359%2013.4688%208.99219%2013.4688%209.02734%2013.5039L11.5%2015.9648L13.9609%2013.5039C13.9961%2013.4688%2014.0547%2013.4688%2014.0898%2013.5039C14.125%2013.5391%2014.125%2013.5977%2014.0898%2013.6328L11.5586%2016.1641C11.5234%2016.1992%2011.4648%2016.1992%2011.4297%2016.1641Z'%20fill='%23737373'/%3e%3cpath%20d='M9.02734%2013.5039L8.67379%2013.8575L8.67463%2013.8583L9.02734%2013.5039ZM11.5%2015.9648L11.1473%2016.3192L11.5008%2016.6711L11.8536%2016.3184L11.5%2015.9648ZM11.7832%2015.8105L9.25199%2013.2793L8.54488%2013.9864L11.0761%2016.5176L11.7832%2015.8105ZM9.25199%2013.2793C9.4121%2013.4394%209.4121%2013.6974%209.25199%2013.8575L8.54488%2013.1504C8.31447%2013.3808%208.31447%2013.7559%208.54488%2013.9864L9.25199%2013.2793ZM9.25199%2013.8575C9.09189%2014.0176%208.8339%2014.0176%208.67379%2013.8575L9.3809%2013.1504C9.15048%2012.9199%208.7753%2012.9199%208.54488%2013.1504L9.25199%2013.8575ZM8.67463%2013.8583L11.1473%2016.3192L11.8527%2015.6105L9.38006%2013.1495L8.67463%2013.8583ZM11.8536%2016.3184L14.3145%2013.8575L13.6074%2013.1504L11.1464%2015.6113L11.8536%2016.3184ZM14.3145%2013.8575C14.1544%2014.0176%2013.8964%2014.0176%2013.7363%2013.8575L14.4434%2013.1504C14.213%2012.9199%2013.8378%2012.9199%2013.6074%2013.1504L14.3145%2013.8575ZM13.7363%2013.8575C13.5762%2013.6974%2013.5762%2013.4394%2013.7363%2013.2793L14.4434%2013.9864C14.6738%2013.7559%2014.6738%2013.3808%2014.4434%2013.1504L13.7363%2013.8575ZM13.7363%2013.2793L11.205%2015.8105L11.9121%2016.5176L14.4434%2013.9864L13.7363%2013.2793ZM11.205%2015.8105C11.3651%2015.6504%2011.6231%2015.6504%2011.7832%2015.8105L11.0761%2016.5176C11.3066%2016.748%2011.6817%2016.748%2011.9121%2016.5176L11.205%2015.8105Z'%20fill='%23737373'/%3e%3c/svg%3e";
|
|
6
|
+
const ToggleDirection = ({
|
|
7
|
+
onChangeDirection
|
|
8
|
+
}) => {
|
|
9
|
+
const handleChangeDirection = (e) => {
|
|
10
|
+
e.preventDefault();
|
|
11
|
+
e.stopPropagation();
|
|
12
|
+
onChangeDirection();
|
|
13
|
+
};
|
|
14
|
+
return /* @__PURE__ */ jsxRuntime.jsx("button", { className: "liq-inline-block", onClick: handleChangeDirection, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
15
|
+
"img",
|
|
16
|
+
{
|
|
17
|
+
src: HugImage,
|
|
18
|
+
alt: "",
|
|
19
|
+
className: "liq-h-6 liq-w-6 liq-text-neutral-100 liq-mx-auto liq-my-2"
|
|
20
|
+
}
|
|
21
|
+
) });
|
|
22
|
+
};
|
|
23
|
+
exports.ToggleDirection = ToggleDirection;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
const HugImage = "data:image/svg+xml,%3csvg%20width='23'%20height='23'%20viewBox='0%200%2023%2023'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='23'%20height='23'%20rx='11.5'%20fill='%2314151A'/%3e%3ccircle%20cx='11.5'%20cy='7'%20r='1'%20fill='%23737373'/%3e%3ccircle%20cx='11.5'%20cy='10'%20r='1'%20fill='%23737373'/%3e%3cpath%20d='M11.4297%2016.1641L8.89844%2013.6328C8.86328%2013.5977%208.86328%2013.5391%208.89844%2013.5039C8.93359%2013.4688%208.99219%2013.4688%209.02734%2013.5039L11.5%2015.9648L13.9609%2013.5039C13.9961%2013.4688%2014.0547%2013.4688%2014.0898%2013.5039C14.125%2013.5391%2014.125%2013.5977%2014.0898%2013.6328L11.5586%2016.1641C11.5234%2016.1992%2011.4648%2016.1992%2011.4297%2016.1641Z'%20fill='%23737373'/%3e%3cpath%20d='M9.02734%2013.5039L8.67379%2013.8575L8.67463%2013.8583L9.02734%2013.5039ZM11.5%2015.9648L11.1473%2016.3192L11.5008%2016.6711L11.8536%2016.3184L11.5%2015.9648ZM11.7832%2015.8105L9.25199%2013.2793L8.54488%2013.9864L11.0761%2016.5176L11.7832%2015.8105ZM9.25199%2013.2793C9.4121%2013.4394%209.4121%2013.6974%209.25199%2013.8575L8.54488%2013.1504C8.31447%2013.3808%208.31447%2013.7559%208.54488%2013.9864L9.25199%2013.2793ZM9.25199%2013.8575C9.09189%2014.0176%208.8339%2014.0176%208.67379%2013.8575L9.3809%2013.1504C9.15048%2012.9199%208.7753%2012.9199%208.54488%2013.1504L9.25199%2013.8575ZM8.67463%2013.8583L11.1473%2016.3192L11.8527%2015.6105L9.38006%2013.1495L8.67463%2013.8583ZM11.8536%2016.3184L14.3145%2013.8575L13.6074%2013.1504L11.1464%2015.6113L11.8536%2016.3184ZM14.3145%2013.8575C14.1544%2014.0176%2013.8964%2014.0176%2013.7363%2013.8575L14.4434%2013.1504C14.213%2012.9199%2013.8378%2012.9199%2013.6074%2013.1504L14.3145%2013.8575ZM13.7363%2013.8575C13.5762%2013.6974%2013.5762%2013.4394%2013.7363%2013.2793L14.4434%2013.9864C14.6738%2013.7559%2014.6738%2013.3808%2014.4434%2013.1504L13.7363%2013.8575ZM13.7363%2013.2793L11.205%2015.8105L11.9121%2016.5176L14.4434%2013.9864L13.7363%2013.2793ZM11.205%2015.8105C11.3651%2015.6504%2011.6231%2015.6504%2011.7832%2015.8105L11.0761%2016.5176C11.3066%2016.748%2011.6817%2016.748%2011.9121%2016.5176L11.205%2015.8105Z'%20fill='%23737373'/%3e%3c/svg%3e";
|
|
3
|
+
const ToggleDirection = ({
|
|
4
|
+
onChangeDirection
|
|
5
|
+
}) => {
|
|
6
|
+
const handleChangeDirection = (e) => {
|
|
7
|
+
e.preventDefault();
|
|
8
|
+
e.stopPropagation();
|
|
9
|
+
onChangeDirection();
|
|
10
|
+
};
|
|
11
|
+
return /* @__PURE__ */ jsx("button", { className: "liq-inline-block", onClick: handleChangeDirection, children: /* @__PURE__ */ jsx(
|
|
12
|
+
"img",
|
|
13
|
+
{
|
|
14
|
+
src: HugImage,
|
|
15
|
+
alt: "",
|
|
16
|
+
className: "liq-h-6 liq-w-6 liq-text-neutral-100 liq-mx-auto liq-my-2"
|
|
17
|
+
}
|
|
18
|
+
) });
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
ToggleDirection
|
|
22
|
+
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { InitOptions } from '../init/init';
|
|
2
|
-
import { ServerTransaction } from '../../types';
|
|
3
2
|
import { PropsWithChildren } from 'react';
|
|
4
3
|
import { ResolvedRegister } from '@wagmi/core';
|
|
5
4
|
import { AppKitNetwork } from '@reown/appkit-common';
|
|
@@ -13,7 +12,12 @@ export type Web3AppContextProps = {
|
|
|
13
12
|
supportedChains: AppKitNetwork[];
|
|
14
13
|
nativeAuthToken: string;
|
|
15
14
|
bridgeOnly?: boolean;
|
|
16
|
-
signMvxTransactions: (transactions: ITransaction[]) => Promise<
|
|
15
|
+
signMvxTransactions: (transactions: ITransaction[]) => Promise<{
|
|
16
|
+
error?: string;
|
|
17
|
+
batchId?: string;
|
|
18
|
+
}>;
|
|
19
|
+
latestMvxTransactionHash?: string;
|
|
20
|
+
resetMvxTransactionHash?: () => void;
|
|
17
21
|
};
|
|
18
22
|
export declare const Web3AppContext: import('react').Context<Web3AppContextProps | undefined>;
|
|
19
|
-
export declare function Web3AppProvider({ children, config, appKit, options, supportedChains, nativeAuthToken, bridgeOnly, signMvxTransactions }: PropsWithChildren<Web3AppContextProps>): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export declare function Web3AppProvider({ children, config, appKit, options, supportedChains, nativeAuthToken, bridgeOnly, signMvxTransactions, latestMvxTransactionHash, resetMvxTransactionHash }: PropsWithChildren<Web3AppContextProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -18,7 +18,9 @@ function Web3AppProvider({
|
|
|
18
18
|
supportedChains,
|
|
19
19
|
nativeAuthToken,
|
|
20
20
|
bridgeOnly = true,
|
|
21
|
-
signMvxTransactions
|
|
21
|
+
signMvxTransactions,
|
|
22
|
+
latestMvxTransactionHash,
|
|
23
|
+
resetMvxTransactionHash
|
|
22
24
|
}) {
|
|
23
25
|
const value = React.useMemo(() => {
|
|
24
26
|
return {
|
|
@@ -28,7 +30,9 @@ function Web3AppProvider({
|
|
|
28
30
|
supportedChains,
|
|
29
31
|
nativeAuthToken,
|
|
30
32
|
bridgeOnly,
|
|
31
|
-
signMvxTransactions
|
|
33
|
+
signMvxTransactions,
|
|
34
|
+
latestMvxTransactionHash,
|
|
35
|
+
resetMvxTransactionHash
|
|
32
36
|
};
|
|
33
37
|
}, [config, appKit, options, nativeAuthToken, signMvxTransactions]);
|
|
34
38
|
return /* @__PURE__ */ jsxRuntime.jsx(Web3AppContext.Provider, { value, children: /* @__PURE__ */ jsxRuntime.jsx(wagmi.WagmiProvider, { config, children: /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: queryClient, children }) }) });
|
|
@@ -15,7 +15,9 @@ function Web3AppProvider({
|
|
|
15
15
|
supportedChains,
|
|
16
16
|
nativeAuthToken,
|
|
17
17
|
bridgeOnly = true,
|
|
18
|
-
signMvxTransactions
|
|
18
|
+
signMvxTransactions,
|
|
19
|
+
latestMvxTransactionHash,
|
|
20
|
+
resetMvxTransactionHash
|
|
19
21
|
}) {
|
|
20
22
|
const value = useMemo(() => {
|
|
21
23
|
return {
|
|
@@ -25,7 +27,9 @@ function Web3AppProvider({
|
|
|
25
27
|
supportedChains,
|
|
26
28
|
nativeAuthToken,
|
|
27
29
|
bridgeOnly,
|
|
28
|
-
signMvxTransactions
|
|
30
|
+
signMvxTransactions,
|
|
31
|
+
latestMvxTransactionHash,
|
|
32
|
+
resetMvxTransactionHash
|
|
29
33
|
};
|
|
30
34
|
}, [config, appKit, options, nativeAuthToken, signMvxTransactions]);
|
|
31
35
|
return /* @__PURE__ */ jsx(Web3AppContext.Provider, { value, children: /* @__PURE__ */ jsx(WagmiProvider, { config, children: /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children }) }) });
|
|
@@ -5,6 +5,7 @@ const react = require("@reown/appkit/react");
|
|
|
5
5
|
const React = require("react");
|
|
6
6
|
const reactjs_hooks_useAccount = require("./useAccount.js");
|
|
7
7
|
const constants_index = require("../../constants/index.js");
|
|
8
|
+
const reactjs_context_useWeb3App = require("../context/useWeb3App.js");
|
|
8
9
|
const reactjs_queries_useGetAllTokens_query = require("../queries/useGetAllTokens.query.js");
|
|
9
10
|
const reactjs_queries_useGetMvxTokensBalances_query = require("../queries/useGetMvxTokensBalances.query.js");
|
|
10
11
|
const reactjs_queries_useGetNonMvxTokensBalances_query = require("../queries/useGetNonMvxTokensBalances.query.js");
|
|
@@ -15,11 +16,15 @@ const useFetchTokens = ({
|
|
|
15
16
|
}) => {
|
|
16
17
|
const { chainId } = react.useAppKitNetwork();
|
|
17
18
|
const account = reactjs_hooks_useAccount.useAccount();
|
|
19
|
+
const { nativeAuthToken, bridgeOnly } = reactjs_context_useWeb3App.useWeb3App();
|
|
18
20
|
const {
|
|
19
21
|
data: tokens,
|
|
20
22
|
isLoading: isTokensLoading,
|
|
21
23
|
isError: isTokensError
|
|
22
|
-
} = reactjs_queries_useGetAllTokens_query.useGetAllTokensQuery(
|
|
24
|
+
} = reactjs_queries_useGetAllTokens_query.useGetAllTokensQuery({
|
|
25
|
+
nativeAuthToken,
|
|
26
|
+
bridgeOnly
|
|
27
|
+
});
|
|
23
28
|
const evmTokens = React.useMemo(
|
|
24
29
|
() => tokens == null ? void 0 : tokens.filter(
|
|
25
30
|
(token) => !constants_index.MVX_CHAIN_IDS.includes(token.chainId.toString()) && token.chainId.toLowerCase() !== "fiat"
|
|
@@ -2,6 +2,7 @@ import { useAppKitNetwork } from "@reown/appkit/react";
|
|
|
2
2
|
import { useMemo, useEffect } from "react";
|
|
3
3
|
import { useAccount } from "./useAccount.mjs";
|
|
4
4
|
import { MVX_CHAIN_IDS } from "../../constants/index.mjs";
|
|
5
|
+
import { useWeb3App } from "../context/useWeb3App.mjs";
|
|
5
6
|
import { useGetAllTokensQuery } from "../queries/useGetAllTokens.query.mjs";
|
|
6
7
|
import { useGetMvxTokensBalancesQuery, invalidateMvxTokensBalancesQuery } from "../queries/useGetMvxTokensBalances.query.mjs";
|
|
7
8
|
import { useGetNonMvxTokensBalancesQuery, invalidateEvmTokensBalances } from "../queries/useGetNonMvxTokensBalances.query.mjs";
|
|
@@ -12,11 +13,15 @@ const useFetchTokens = ({
|
|
|
12
13
|
}) => {
|
|
13
14
|
const { chainId } = useAppKitNetwork();
|
|
14
15
|
const account = useAccount();
|
|
16
|
+
const { nativeAuthToken, bridgeOnly } = useWeb3App();
|
|
15
17
|
const {
|
|
16
18
|
data: tokens,
|
|
17
19
|
isLoading: isTokensLoading,
|
|
18
20
|
isError: isTokensError
|
|
19
|
-
} = useGetAllTokensQuery(
|
|
21
|
+
} = useGetAllTokensQuery({
|
|
22
|
+
nativeAuthToken,
|
|
23
|
+
bridgeOnly
|
|
24
|
+
});
|
|
20
25
|
const evmTokens = useMemo(
|
|
21
26
|
() => tokens == null ? void 0 : tokens.filter(
|
|
22
27
|
(token) => !MVX_CHAIN_IDS.includes(token.chainId.toString()) && token.chainId.toLowerCase() !== "fiat"
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { AxiosError } from 'axios';
|
|
2
2
|
|
|
3
|
-
export declare const useGetAllTokensQuery: (
|
|
3
|
+
export declare const useGetAllTokensQuery: ({ nativeAuthToken, bridgeOnly }: {
|
|
4
|
+
nativeAuthToken?: string;
|
|
5
|
+
bridgeOnly?: boolean;
|
|
6
|
+
}) => import('@tanstack/react-query').UseQueryResult<import('../..').TokenType[], AxiosError<unknown, any>>;
|
|
@@ -4,14 +4,15 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
4
4
|
const reactQuery = require("@tanstack/react-query");
|
|
5
5
|
const api_getTokens = require("../../api/getTokens.js");
|
|
6
6
|
const helpers_getApiURL = require("../../helpers/getApiURL.js");
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const useGetAllTokensQuery = ({
|
|
8
|
+
nativeAuthToken,
|
|
9
|
+
bridgeOnly = true
|
|
10
|
+
}) => {
|
|
10
11
|
const queryFn = async () => {
|
|
11
12
|
try {
|
|
12
13
|
const { data } = await api_getTokens.getTokens({
|
|
13
14
|
url: helpers_getApiURL.getApiURL(),
|
|
14
|
-
nativeAuthToken,
|
|
15
|
+
nativeAuthToken: nativeAuthToken ?? "",
|
|
15
16
|
bridgeOnly: Boolean(bridgeOnly)
|
|
16
17
|
});
|
|
17
18
|
return data;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { useQuery } from "@tanstack/react-query";
|
|
2
2
|
import { getTokens } from "../../api/getTokens.mjs";
|
|
3
3
|
import { getApiURL } from "../../helpers/getApiURL.mjs";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const useGetAllTokensQuery = ({
|
|
5
|
+
nativeAuthToken,
|
|
6
|
+
bridgeOnly = true
|
|
7
|
+
}) => {
|
|
7
8
|
const queryFn = async () => {
|
|
8
9
|
try {
|
|
9
10
|
const { data } = await getTokens({
|
|
10
11
|
url: getApiURL(),
|
|
11
|
-
nativeAuthToken,
|
|
12
|
+
nativeAuthToken: nativeAuthToken ?? "",
|
|
12
13
|
bridgeOnly: Boolean(bridgeOnly)
|
|
13
14
|
});
|
|
14
15
|
return data;
|
package/style.css
CHANGED
|
@@ -548,6 +548,9 @@ video {
|
|
|
548
548
|
.liq-left-6{
|
|
549
549
|
left: 1.5rem;
|
|
550
550
|
}
|
|
551
|
+
.liq-left-\[6\%\]{
|
|
552
|
+
left: 6%;
|
|
553
|
+
}
|
|
551
554
|
.liq-left-auto{
|
|
552
555
|
left: auto;
|
|
553
556
|
}
|
|
@@ -566,6 +569,9 @@ video {
|
|
|
566
569
|
.liq-top-12{
|
|
567
570
|
top: 3rem;
|
|
568
571
|
}
|
|
572
|
+
.liq-top-\[40\%\]{
|
|
573
|
+
top: 40%;
|
|
574
|
+
}
|
|
569
575
|
.\!liq-z-\[15\]{
|
|
570
576
|
z-index: 15 !important;
|
|
571
577
|
}
|
|
@@ -599,6 +605,9 @@ video {
|
|
|
599
605
|
.\!liq-mr-2{
|
|
600
606
|
margin-right: 0.5rem !important;
|
|
601
607
|
}
|
|
608
|
+
.-liq-mt-1{
|
|
609
|
+
margin-top: -0.25rem;
|
|
610
|
+
}
|
|
602
611
|
.liq-mb-1{
|
|
603
612
|
margin-bottom: 0.25rem;
|
|
604
613
|
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export declare const useFiatData: ({ mvxAddress, mvxApiURL, refetchTrigger }: {
|
|
2
|
-
mvxAddress?: string;
|
|
3
|
-
mvxApiURL: string;
|
|
4
|
-
refetchTrigger?: number;
|
|
5
|
-
}) => {
|
|
6
|
-
isTokensLoading: boolean;
|
|
7
|
-
isTokensError: boolean;
|
|
8
|
-
isLoadingMvxTokensBalances: boolean;
|
|
9
|
-
isErrorMvxTokensBalances: boolean;
|
|
10
|
-
mvxTokensWithBalances: {
|
|
11
|
-
balance: string;
|
|
12
|
-
chainId: string;
|
|
13
|
-
address: string;
|
|
14
|
-
name: string;
|
|
15
|
-
symbol: string;
|
|
16
|
-
decimals: number;
|
|
17
|
-
crosschain: boolean;
|
|
18
|
-
pngUrl: string;
|
|
19
|
-
svgUrl: string;
|
|
20
|
-
metadata: {
|
|
21
|
-
minBridgeAmount: string;
|
|
22
|
-
maxBridgeAmount: string;
|
|
23
|
-
};
|
|
24
|
-
availableTokens?: {
|
|
25
|
-
address: string;
|
|
26
|
-
chainId: string;
|
|
27
|
-
symbol: string;
|
|
28
|
-
}[];
|
|
29
|
-
isNative?: boolean;
|
|
30
|
-
}[] | undefined;
|
|
31
|
-
currencies: import('../..').TokenType[] | undefined;
|
|
32
|
-
tokens: import('../..').TokenType[] | undefined;
|
|
33
|
-
};
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const React = require("react");
|
|
5
|
-
const constants_index = require("../../constants/index.js");
|
|
6
|
-
const reactjs_queries_useGetAllTokens_query = require("../queries/useGetAllTokens.query.js");
|
|
7
|
-
const reactjs_queries_useGetMvxTokensBalances_query = require("../queries/useGetMvxTokensBalances.query.js");
|
|
8
|
-
const useFiatData = ({
|
|
9
|
-
mvxAddress,
|
|
10
|
-
mvxApiURL,
|
|
11
|
-
refetchTrigger
|
|
12
|
-
}) => {
|
|
13
|
-
const {
|
|
14
|
-
data: tokens,
|
|
15
|
-
isLoading: isTokensLoading,
|
|
16
|
-
isError: isTokensError
|
|
17
|
-
} = reactjs_queries_useGetAllTokens_query.useGetAllTokensQuery();
|
|
18
|
-
const mvxTokens = React.useMemo(
|
|
19
|
-
() => tokens == null ? void 0 : tokens.filter(
|
|
20
|
-
(token) => constants_index.MVX_CHAIN_IDS.includes(token.chainId.toString())
|
|
21
|
-
),
|
|
22
|
-
[tokens]
|
|
23
|
-
);
|
|
24
|
-
const currencies = React.useMemo(() => {
|
|
25
|
-
return tokens == null ? void 0 : tokens.filter((token) => !token.chainId);
|
|
26
|
-
}, [tokens]);
|
|
27
|
-
const {
|
|
28
|
-
data: mvxTokensBalances,
|
|
29
|
-
isLoading: isLoadingMvxTokensBalances,
|
|
30
|
-
isError: isErrorMvxTokensBalances
|
|
31
|
-
} = reactjs_queries_useGetMvxTokensBalances_query.useGetMvxTokensBalancesQuery({
|
|
32
|
-
tokens: mvxTokens ?? [],
|
|
33
|
-
mvxAddress,
|
|
34
|
-
apiURL: mvxApiURL
|
|
35
|
-
});
|
|
36
|
-
const mvxTokensWithBalances = React.useMemo(() => {
|
|
37
|
-
return mvxTokens == null ? void 0 : mvxTokens.map((token) => {
|
|
38
|
-
const foundToken = mvxTokensBalances == null ? void 0 : mvxTokensBalances.find(
|
|
39
|
-
(mvxToken) => mvxToken.address === token.address
|
|
40
|
-
);
|
|
41
|
-
if (!foundToken) {
|
|
42
|
-
return {
|
|
43
|
-
...token,
|
|
44
|
-
balance: "0"
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
return {
|
|
48
|
-
...foundToken,
|
|
49
|
-
balance: foundToken.balance.toString()
|
|
50
|
-
};
|
|
51
|
-
});
|
|
52
|
-
}, [mvxTokens, mvxTokensBalances]);
|
|
53
|
-
React.useEffect(() => {
|
|
54
|
-
if (mvxAddress) {
|
|
55
|
-
reactjs_queries_useGetMvxTokensBalances_query.invalidateMvxTokensBalancesQuery();
|
|
56
|
-
}
|
|
57
|
-
}, [refetchTrigger, mvxAddress]);
|
|
58
|
-
return {
|
|
59
|
-
isTokensLoading,
|
|
60
|
-
isTokensError,
|
|
61
|
-
isLoadingMvxTokensBalances,
|
|
62
|
-
isErrorMvxTokensBalances,
|
|
63
|
-
mvxTokensWithBalances,
|
|
64
|
-
currencies,
|
|
65
|
-
tokens
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
exports.useFiatData = useFiatData;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { useMemo, useEffect } from "react";
|
|
2
|
-
import { MVX_CHAIN_IDS } from "../../constants/index.mjs";
|
|
3
|
-
import { useGetAllTokensQuery } from "../queries/useGetAllTokens.query.mjs";
|
|
4
|
-
import { useGetMvxTokensBalancesQuery, invalidateMvxTokensBalancesQuery } from "../queries/useGetMvxTokensBalances.query.mjs";
|
|
5
|
-
const useFiatData = ({
|
|
6
|
-
mvxAddress,
|
|
7
|
-
mvxApiURL,
|
|
8
|
-
refetchTrigger
|
|
9
|
-
}) => {
|
|
10
|
-
const {
|
|
11
|
-
data: tokens,
|
|
12
|
-
isLoading: isTokensLoading,
|
|
13
|
-
isError: isTokensError
|
|
14
|
-
} = useGetAllTokensQuery();
|
|
15
|
-
const mvxTokens = useMemo(
|
|
16
|
-
() => tokens == null ? void 0 : tokens.filter(
|
|
17
|
-
(token) => MVX_CHAIN_IDS.includes(token.chainId.toString())
|
|
18
|
-
),
|
|
19
|
-
[tokens]
|
|
20
|
-
);
|
|
21
|
-
const currencies = useMemo(() => {
|
|
22
|
-
return tokens == null ? void 0 : tokens.filter((token) => !token.chainId);
|
|
23
|
-
}, [tokens]);
|
|
24
|
-
const {
|
|
25
|
-
data: mvxTokensBalances,
|
|
26
|
-
isLoading: isLoadingMvxTokensBalances,
|
|
27
|
-
isError: isErrorMvxTokensBalances
|
|
28
|
-
} = useGetMvxTokensBalancesQuery({
|
|
29
|
-
tokens: mvxTokens ?? [],
|
|
30
|
-
mvxAddress,
|
|
31
|
-
apiURL: mvxApiURL
|
|
32
|
-
});
|
|
33
|
-
const mvxTokensWithBalances = useMemo(() => {
|
|
34
|
-
return mvxTokens == null ? void 0 : mvxTokens.map((token) => {
|
|
35
|
-
const foundToken = mvxTokensBalances == null ? void 0 : mvxTokensBalances.find(
|
|
36
|
-
(mvxToken) => mvxToken.address === token.address
|
|
37
|
-
);
|
|
38
|
-
if (!foundToken) {
|
|
39
|
-
return {
|
|
40
|
-
...token,
|
|
41
|
-
balance: "0"
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
return {
|
|
45
|
-
...foundToken,
|
|
46
|
-
balance: foundToken.balance.toString()
|
|
47
|
-
};
|
|
48
|
-
});
|
|
49
|
-
}, [mvxTokens, mvxTokensBalances]);
|
|
50
|
-
useEffect(() => {
|
|
51
|
-
if (mvxAddress) {
|
|
52
|
-
invalidateMvxTokensBalancesQuery();
|
|
53
|
-
}
|
|
54
|
-
}, [refetchTrigger, mvxAddress]);
|
|
55
|
-
return {
|
|
56
|
-
isTokensLoading,
|
|
57
|
-
isTokensError,
|
|
58
|
-
isLoadingMvxTokensBalances,
|
|
59
|
-
isErrorMvxTokensBalances,
|
|
60
|
-
mvxTokensWithBalances,
|
|
61
|
-
currencies,
|
|
62
|
-
tokens
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
export {
|
|
66
|
-
useFiatData
|
|
67
|
-
};
|