@multiversx/sdk-dapp-liquidity 1.1.0-alpha.2 → 1.1.0-alpha.21
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/README.md +6 -1
- package/api/getTransactions.d.ts +8 -2
- package/api/getTransactions.js +23 -3
- package/api/getTransactions.mjs +23 -3
- package/api/tests/getChains.spec.js +2 -1
- package/api/tests/getChains.spec.mjs +2 -1
- package/api/tests/getTokens.spec.js +2 -2
- package/api/tests/getTokens.spec.mjs +2 -2
- package/api/tests/getTransactions.spec.js +79 -69
- package/api/tests/getTransactions.spec.mjs +79 -69
- package/constants/index.d.ts +1 -1
- package/constants/index.js +1 -1
- package/constants/index.mjs +1 -1
- package/dto/Chain.dto.d.ts +3 -1
- package/dto/ConfirmRate.dto.d.ts +1 -0
- package/dto/Token.dto.d.ts +7 -2
- package/index.js +44 -16
- package/index.mjs +14 -16
- package/package.json +10 -6
- package/reactjs/components/BridgeForm/BridgeForm.d.ts +3 -1
- package/reactjs/components/BridgeForm/BridgeForm.js +182 -87
- package/reactjs/components/BridgeForm/BridgeForm.mjs +153 -58
- package/reactjs/components/BridgeHistory/BridgeHistory.js +73 -26
- package/reactjs/components/BridgeHistory/BridgeHistory.mjs +68 -21
- package/reactjs/components/Connect/BridgeAccountDisplay.js +2 -5
- package/reactjs/components/Connect/BridgeAccountDisplay.mjs +2 -5
- package/reactjs/components/Connect/CustomConnectButton.js +2 -5
- package/reactjs/components/Connect/CustomConnectButton.mjs +1 -4
- package/reactjs/components/Connect/MvxConnectButton.d.ts +2 -4
- package/reactjs/components/Connect/MvxConnectButton.js +2 -2
- package/reactjs/components/Connect/MvxConnectButton.mjs +2 -2
- package/reactjs/components/Connect/SwitchChainButton.js +2 -6
- package/reactjs/components/Connect/SwitchChainButton.mjs +1 -5
- package/reactjs/components/CopyButton/CopyButton.js +2 -2
- package/reactjs/components/CopyButton/CopyButton.mjs +2 -2
- package/reactjs/components/DisplayAmount/components/AnimateNumber/AnimateNumber.js +5 -5
- package/reactjs/components/Error/Error.d.ts +6 -0
- package/reactjs/components/Error/Error.js +67 -0
- package/reactjs/components/Error/Error.mjs +66 -0
- package/reactjs/components/Error/index.d.ts +1 -0
- package/reactjs/components/Error/index.js +5 -0
- package/reactjs/components/Error/index.mjs +4 -0
- package/reactjs/components/TokenSelector/TokenSelector.d.ts +2 -1
- package/reactjs/components/TokenSelector/TokenSelector.js +17 -9
- package/reactjs/components/TokenSelector/TokenSelector.mjs +13 -5
- package/reactjs/components/TokenSelector/components/ChainSelect/ChainSelect.d.ts +2 -1
- package/reactjs/components/TokenSelector/components/ChainSelect/ChainSelect.js +7 -3
- package/reactjs/components/TokenSelector/components/ChainSelect/ChainSelect.mjs +4 -0
- package/reactjs/components/TokenSelector/components/SelectContent.d.ts +2 -1
- package/reactjs/components/TokenSelector/components/SelectContent.js +12 -9
- package/reactjs/components/TokenSelector/components/SelectContent.mjs +4 -1
- package/reactjs/components/TokenSelector/components/TokenIcon.js +3 -3
- package/reactjs/components/TokenSelector/components/TokenItem.js +9 -9
- package/reactjs/components/TokenSelector/components/TokenItem.mjs +6 -6
- package/reactjs/components/base/MxCard/MxCard.js +2 -2
- package/reactjs/components/base/MxCircleLoader/MxCircleLoader.d.ts +4 -0
- package/reactjs/components/base/MxCircleLoader/MxCircleLoader.js +29 -0
- package/reactjs/components/base/MxCircleLoader/MxCircleLoader.mjs +28 -0
- package/reactjs/components/base/MxCircleLoader/index.d.ts +1 -0
- package/reactjs/components/base/MxCircleLoader/index.js +5 -0
- package/reactjs/components/base/MxCircleLoader/index.mjs +4 -0
- package/reactjs/components/base/MxLink/MxLink.js +2 -2
- package/reactjs/components/base/MxSearch/MxSearch.js +4 -4
- package/reactjs/components/base/MxSlideover/MxSlideover.js +4 -4
- package/reactjs/components/base/MxTooltip/MxTooltip.js +9 -9
- package/reactjs/components/base/MxTooltip/components/TooltipContainer/TooltipContainer.js +2 -2
- package/reactjs/components/index.d.ts +1 -0
- package/reactjs/components/index.js +2 -0
- package/reactjs/components/index.mjs +2 -0
- package/reactjs/context/Web3AppProvider.d.ts +3 -1
- package/reactjs/context/Web3AppProvider.js +7 -5
- package/reactjs/context/Web3AppProvider.mjs +4 -2
- package/reactjs/context/useWeb3App.js +2 -2
- package/reactjs/hooks/index.js +1 -1
- package/reactjs/hooks/index.mjs +1 -1
- package/reactjs/hooks/useAccount.js +1 -5
- package/reactjs/hooks/useAccount.mjs +1 -5
- package/reactjs/hooks/useBalances.d.ts +4 -4
- package/reactjs/hooks/useBalances.js +16 -1
- package/reactjs/hooks/useBalances.mjs +16 -1
- package/reactjs/hooks/useBridgeFormik.js +9 -16
- package/reactjs/hooks/useBridgeFormik.mjs +0 -7
- package/reactjs/hooks/useDebounce.js +3 -3
- package/reactjs/hooks/useFetchBridgeData.d.ts +14 -4
- package/reactjs/hooks/useFetchTokens.d.ts +14 -4
- package/reactjs/hooks/useFetchTokens.js +9 -9
- package/reactjs/hooks/useFetchTokens.mjs +2 -2
- package/reactjs/hooks/useFiatData.d.ts +7 -2
- package/reactjs/hooks/useFiatData.js +6 -6
- package/reactjs/hooks/useFiatData.mjs +1 -1
- package/reactjs/hooks/useGetChainId.js +3 -3
- package/reactjs/hooks/useGetChainId.mjs +1 -1
- package/reactjs/hooks/useResolveTokenChain.js +2 -2
- package/reactjs/hooks/useSendTransactions.js +2 -2
- package/reactjs/hooks/useSignTransaction.d.ts +93 -67
- package/reactjs/hooks/useSignTransaction.js +53 -4
- package/reactjs/hooks/useSignTransaction.mjs +53 -4
- package/reactjs/hooks/validation/useTestHasEnoughFunds.js +3 -3
- package/reactjs/hooks/validation/useTestIsConnected.js +2 -2
- package/reactjs/index.js +44 -16
- package/reactjs/index.mjs +14 -16
- package/reactjs/init/init.d.ts +220 -1
- package/reactjs/init/init.js +34 -10
- package/reactjs/init/init.mjs +31 -7
- package/reactjs/init/tests/init.spec.js +5 -6
- package/reactjs/init/tests/init.spec.mjs +5 -6
- package/reactjs/queries/index.d.ts +0 -1
- package/reactjs/queries/index.js +0 -2
- package/reactjs/queries/index.mjs +1 -3
- package/reactjs/queries/useGetEvmTokensBalances.query.d.ts +8 -3
- package/reactjs/queries/useGetEvmTokensBalances.query.js +15 -18
- package/reactjs/queries/useGetEvmTokensBalances.query.mjs +15 -18
- package/reactjs/queries/useGetHistory.query.d.ts +9 -1
- package/reactjs/queries/useGetHistory.query.js +23 -5
- package/reactjs/queries/useGetHistory.query.mjs +23 -5
- package/reactjs/queries/useGetMvxTokensBalances.query.d.ts +7 -2
- package/reactjs/queries/useGetMvxTokensBalances.query.js +2 -2
- package/reactjs/reexports.d.ts +2 -1
- package/reactjs/reexports.js +41 -13
- package/reactjs/reexports.mjs +11 -13
- package/reactjs/utils/getInitialTokens.d.ts +4 -1
- package/reactjs/utils/getInitialTokens.js +3 -3
- package/reactjs/utils/getInitialTokens.mjs +3 -3
- package/style.css +33 -1730
- package/types/chainType.d.ts +6 -0
- package/types/chainType.js +11 -0
- package/types/chainType.mjs +10 -0
- package/types/transaction.d.ts +28 -0
- package/types/utxo.d.ts +11 -0
- package/types/utxo.js +2 -0
- package/types/utxo.mjs +1 -0
- package/{useBalances-C_69CFoa.mjs → useBalances-Bom1mw1J.mjs} +101 -23
- package/{useBalances-C4YhEYxy.js → useBalances-gZTsFZHe.js} +102 -24
- package/index-BIVnypNe.mjs +0 -108
- package/index-Ben8n3bd.js +0 -58656
- package/index-CnKr4rL1.mjs +0 -91
- package/index-CnuruJNu.js +0 -329
- package/index-DsBh-EBw.js +0 -108
- package/index-iN9APQ6x.mjs +0 -58735
- package/modules/fiat/components/FiatForm/FiatForm.d.ts +0 -9
- package/modules/fiat/components/FiatForm/FiatForm.js +0 -314
- package/modules/fiat/components/FiatForm/FiatForm.mjs +0 -313
- package/modules/fiat/components/FiatForm/components/AmountInput/AmountInput.d.ts +0 -13
- package/modules/fiat/components/FiatForm/components/AmountInput/AmountInput.js +0 -117
- package/modules/fiat/components/FiatForm/components/AmountInput/AmountInput.mjs +0 -116
- package/modules/fiat/components/FiatForm/components/AmountInput/index.d.ts +0 -1
- package/modules/fiat/components/FiatForm/components/AmountInput/index.js +0 -5
- package/modules/fiat/components/FiatForm/components/AmountInput/index.mjs +0 -4
- package/modules/fiat/components/FiatForm/components/RateReloading/RateReloading.d.ts +0 -7
- package/modules/fiat/components/FiatForm/components/RateReloading/RateReloading.js +0 -74
- package/modules/fiat/components/FiatForm/components/RateReloading/RateReloading.mjs +0 -73
- package/modules/fiat/components/FiatForm/components/TokenSelector/TokenSelector.d.ts +0 -14
- package/modules/fiat/components/FiatForm/components/TokenSelector/TokenSelector.js +0 -94
- package/modules/fiat/components/FiatForm/components/TokenSelector/TokenSelector.mjs +0 -93
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/SelectContainer.d.ts +0 -7
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/SelectContainer.js +0 -82
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/SelectContainer.mjs +0 -81
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/SelectContent.d.ts +0 -7
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/SelectContent.js +0 -91
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/SelectContent.mjs +0 -90
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/SelectedOption.d.ts +0 -5
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/SelectedOption.js +0 -30
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/SelectedOption.mjs +0 -29
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenIcon.d.ts +0 -8
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenIcon.js +0 -103
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenIcon.mjs +0 -102
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenItem.d.ts +0 -7
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenItem.js +0 -33
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenItem.mjs +0 -32
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenList.d.ts +0 -7
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenList.js +0 -21
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenList.mjs +0 -20
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenSymbol.d.ts +0 -9
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenSymbol.js +0 -26
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenSymbol.mjs +0 -25
- package/modules/fiat/components/FiatForm/components/TokenSelector/index.d.ts +0 -1
- package/modules/fiat/components/FiatForm/components/TokenSelector/index.js +0 -5
- package/modules/fiat/components/FiatForm/components/TokenSelector/index.mjs +0 -4
- package/modules/fiat/components/FiatForm/index.d.ts +0 -1
- package/modules/fiat/components/FiatForm/index.js +0 -5
- package/modules/fiat/components/FiatForm/index.mjs +0 -4
- package/modules/fiat/components/index.d.ts +0 -1
- package/modules/fiat/components/index.js +0 -5
- package/modules/fiat/components/index.mjs +0 -4
- package/modules/fiat/context/FiatProvider.d.ts +0 -8
- package/modules/fiat/context/FiatProvider.js +0 -24
- package/modules/fiat/context/FiatProvider.mjs +0 -23
- package/modules/fiat/context/queryClient.d.ts +0 -3
- package/modules/fiat/context/queryClient.js +0 -12
- package/modules/fiat/context/queryClient.mjs +0 -11
- package/modules/fiat/context/useFiat.d.ts +0 -1
- package/modules/fiat/context/useFiat.js +0 -13
- package/modules/fiat/context/useFiat.mjs +0 -12
- package/modules/fiat/hooks/index.d.ts +0 -2
- package/modules/fiat/hooks/index.js +0 -7
- package/modules/fiat/hooks/index.mjs +0 -6
- package/modules/fiat/hooks/useFiatData.d.ts +0 -7
- package/modules/fiat/hooks/useFiatData.js +0 -75
- package/modules/fiat/hooks/useFiatData.mjs +0 -74
- package/modules/fiat/hooks/validation/index.d.ts +0 -1
- package/modules/fiat/hooks/validation/index.js +0 -5
- package/modules/fiat/hooks/validation/index.mjs +0 -4
- package/modules/fiat/hooks/validation/useAmountSchema.d.ts +0 -2
- package/modules/fiat/hooks/validation/useAmountSchema.js +0 -27
- package/modules/fiat/hooks/validation/useAmountSchema.mjs +0 -9
- package/modules/fiat/index.d.ts +0 -8
- package/modules/fiat/index.js +0 -22
- package/modules/fiat/index.mjs +0 -21
- package/modules/fiat/init/index.d.ts +0 -2
- package/modules/fiat/init/index.js +0 -5
- package/modules/fiat/init/index.mjs +0 -4
- package/modules/fiat/init/init.d.ts +0 -22
- package/modules/fiat/init/init.js +0 -15
- package/modules/fiat/init/init.mjs +0 -14
- package/modules/fiat/queries/index.d.ts +0 -2
- package/modules/fiat/queries/index.js +0 -7
- package/modules/fiat/queries/index.mjs +0 -6
- package/modules/fiat/queries/useGetRate.mutation.d.ts +0 -6
- package/modules/fiat/queries/useGetRate.mutation.js +0 -20
- package/modules/fiat/queries/useGetRate.mutation.mjs +0 -19
- package/modules/fiat/queries/useGetTokens.query.d.ts +0 -5
- package/modules/fiat/queries/useGetTokens.query.js +0 -33
- package/modules/fiat/queries/useGetTokens.query.mjs +0 -32
- package/react-47kZTyAT.mjs +0 -51
- package/react-B_iI3-1z.mjs +0 -3133
- package/react-BomcNL1v.js +0 -254
- package/react-CqKlu0W0.js +0 -51
- package/react-R_xxu7fN.js +0 -3133
- package/react-cXurUY4Z.mjs +0 -254
- package/reactjs/queries/useGetTokens.query.d.ts +0 -3
- package/reactjs/queries/useGetTokens.query.js +0 -34
- package/reactjs/queries/useGetTokens.query.mjs +0 -33
- package/w3m-modal-Bhg44d6I.js +0 -356
- package/w3m-modal-Br2Ec3MM.mjs +0 -356
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
interface FiatFormProps {
|
|
2
|
-
mvxChainId: string;
|
|
3
|
-
mvxAddress?: string;
|
|
4
|
-
nativeAuthToken?: string;
|
|
5
|
-
showHistory?: boolean;
|
|
6
|
-
onHistoryClose?: () => void;
|
|
7
|
-
}
|
|
8
|
-
export declare const FiatForm: ({ mvxChainId, mvxAddress, nativeAuthToken, showHistory, onHistoryClose }: FiatFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export {};
|
|
@@ -1,314 +0,0 @@
|
|
|
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 axios = require("axios");
|
|
6
|
-
const debounce = require("lodash/debounce");
|
|
7
|
-
const require$$0 = require("react");
|
|
8
|
-
;/* empty css */
|
|
9
|
-
const reactjs_utils_mxClsx = require("../../../../reactjs/utils/mxClsx.js");
|
|
10
|
-
const reactjs_components_base_MxButton_MxButton = require("../../../../reactjs/components/base/MxButton/MxButton.js");
|
|
11
|
-
const reactjs_components_base_MxCard_MxCard = require("../../../../reactjs/components/base/MxCard/MxCard.js");
|
|
12
|
-
require("../../../../reactjs/components/base/MxLink/MxLink.js");
|
|
13
|
-
require("../../../../reactjs/components/base/MxSearch/MxSearch.js");
|
|
14
|
-
require("@fortawesome/free-solid-svg-icons/faClose");
|
|
15
|
-
require("@fortawesome/react-fontawesome");
|
|
16
|
-
require("@headlessui/react");
|
|
17
|
-
require("react-dom");
|
|
18
|
-
require("react-popper");
|
|
19
|
-
require("../../../../reactjs/components/base/MxTooltip/components/TooltipContainer/TooltipContainer.js");
|
|
20
|
-
require("../../../../reactjs/constants/index.js");
|
|
21
|
-
require("react-number-format");
|
|
22
|
-
require("@fortawesome/free-solid-svg-icons/faSpinner");
|
|
23
|
-
require("@multiversx/sdk-dapp-utils/out/helpers/formatAmount");
|
|
24
|
-
require("react-toastify");
|
|
25
|
-
require("wagmi");
|
|
26
|
-
const helpers_getApiURL = require("../../../../helpers/getApiURL.js");
|
|
27
|
-
require("../../../../reactjs/context/Web3AppProvider.js");
|
|
28
|
-
require("../../../../index-Ben8n3bd.js");
|
|
29
|
-
require("viem");
|
|
30
|
-
require("viem/chains");
|
|
31
|
-
require("formik");
|
|
32
|
-
require("yup");
|
|
33
|
-
require("@multiversx/sdk-dapp-utils/out/helpers/parseAmount");
|
|
34
|
-
require("../../../../bignumber-B8vjg9qn.js");
|
|
35
|
-
const types_providerType = require("../../../../types/providerType.js");
|
|
36
|
-
require("@tanstack/react-query");
|
|
37
|
-
const reactjs_components_BridgeHistory_BridgeHistory = require("../../../../reactjs/components/BridgeHistory/BridgeHistory.js");
|
|
38
|
-
require("@fortawesome/free-solid-svg-icons/faPowerOff");
|
|
39
|
-
require("@fortawesome/free-solid-svg-icons/faCheck");
|
|
40
|
-
require("@fortawesome/free-solid-svg-icons/faCopy");
|
|
41
|
-
require("@fortawesome/free-solid-svg-icons/faChevronDown");
|
|
42
|
-
require("@fortawesome/free-solid-svg-icons/faWallet");
|
|
43
|
-
require("react-select");
|
|
44
|
-
require("@fortawesome/free-solid-svg-icons/faDiamond");
|
|
45
|
-
require("lodash/isString");
|
|
46
|
-
require("animated-number-react");
|
|
47
|
-
require("numeral");
|
|
48
|
-
require("@multiversx/sdk-dapp-utils/out/helpers/stringIsInteger");
|
|
49
|
-
require("@fortawesome/free-solid-svg-icons/faArrowUpRightFromSquare");
|
|
50
|
-
require("@reown/appkit-adapter-wagmi");
|
|
51
|
-
const modules_fiat_components_FiatForm_components_AmountInput_AmountInput = require("./components/AmountInput/AmountInput.js");
|
|
52
|
-
const modules_fiat_components_FiatForm_components_RateReloading_RateReloading = require("./components/RateReloading/RateReloading.js");
|
|
53
|
-
const modules_fiat_components_FiatForm_components_TokenSelector_TokenSelector = require("./components/TokenSelector/TokenSelector.js");
|
|
54
|
-
const api_confirmFiatRate = require("../../../../api/confirmFiatRate.js");
|
|
55
|
-
const modules_fiat_hooks_useFiatData = require("../../hooks/useFiatData.js");
|
|
56
|
-
const modules_fiat_queries_useGetRate_mutation = require("../../queries/useGetRate.mutation.js");
|
|
57
|
-
const ArrowUpRight = "data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M15%206V13C15%2013.5625%2014.5312%2014%2014%2014C13.4375%2014%2013%2013.5625%2013%2013V8.4375L6.6875%2014.7188C6.3125%2015.125%205.65625%2015.125%205.28125%2014.7188C4.875%2014.3438%204.875%2013.6875%205.28125%2013.3125L11.5625%207H7C6.4375%207%206%206.5625%206%206C6%205.46875%206.4375%205%207%205H14C14.5312%205%2015%205.46875%2015%206Z'%20fill='%23CDD0DB'/%3e%3c/svg%3e";
|
|
58
|
-
let fetchRateInterval;
|
|
59
|
-
const FiatForm = ({
|
|
60
|
-
mvxChainId,
|
|
61
|
-
mvxAddress,
|
|
62
|
-
nativeAuthToken,
|
|
63
|
-
showHistory,
|
|
64
|
-
onHistoryClose
|
|
65
|
-
}) => {
|
|
66
|
-
const ref = require$$0.useRef(null);
|
|
67
|
-
const [isTokenSelectorVisible, setIsTokenSelectorVisible] = require$$0.useState(false);
|
|
68
|
-
const [firstToken, setFirstToken] = require$$0.useState();
|
|
69
|
-
const [amount, setAmount] = require$$0.useState("");
|
|
70
|
-
const [conversionRate, setConversionRate] = require$$0.useState();
|
|
71
|
-
const {
|
|
72
|
-
currencies,
|
|
73
|
-
mvxTokens,
|
|
74
|
-
isTokensLoading: tokensLoading
|
|
75
|
-
} = modules_fiat_hooks_useFiatData.useFiatData();
|
|
76
|
-
const [selectedCurrency, setSelectedCurrency] = require$$0.useState();
|
|
77
|
-
const {
|
|
78
|
-
mutate: getRate,
|
|
79
|
-
data: rate,
|
|
80
|
-
isPending: isPendingRate,
|
|
81
|
-
error: rateError
|
|
82
|
-
} = modules_fiat_queries_useGetRate_mutation.useGetRateMutation();
|
|
83
|
-
const availableTokens = require$$0.useMemo(() => {
|
|
84
|
-
if (!(selectedCurrency == null ? void 0 : selectedCurrency.availableTokens)) {
|
|
85
|
-
return [];
|
|
86
|
-
}
|
|
87
|
-
const foundTokens = [];
|
|
88
|
-
for (const ticker of selectedCurrency.availableTokens) {
|
|
89
|
-
const foundToken = mvxTokens == null ? void 0 : mvxTokens.find(
|
|
90
|
-
(mvxToken) => mvxToken.address === ticker
|
|
91
|
-
);
|
|
92
|
-
if (foundToken) {
|
|
93
|
-
foundTokens.push(foundToken);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return foundTokens;
|
|
97
|
-
}, [mvxTokens, selectedCurrency]);
|
|
98
|
-
const fromOptions = require$$0.useMemo(
|
|
99
|
-
() => (availableTokens && availableTokens.map((token) => {
|
|
100
|
-
return {
|
|
101
|
-
...token,
|
|
102
|
-
identifier: token.address,
|
|
103
|
-
ticker: token.symbol
|
|
104
|
-
};
|
|
105
|
-
})) ?? [],
|
|
106
|
-
[availableTokens]
|
|
107
|
-
);
|
|
108
|
-
const fetchRateDebounced = require$$0.useCallback(
|
|
109
|
-
debounce(async (value) => {
|
|
110
|
-
if (!value || !(firstToken == null ? void 0 : firstToken.address) || !selectedCurrency) {
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
getRate({
|
|
114
|
-
nativeAuthToken: nativeAuthToken ?? "",
|
|
115
|
-
body: {
|
|
116
|
-
tokenIn: selectedCurrency.address,
|
|
117
|
-
amountIn: value,
|
|
118
|
-
fromChainId: mvxChainId.toString(),
|
|
119
|
-
tokenOut: firstToken.address,
|
|
120
|
-
toChainId: mvxChainId
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
}, 500),
|
|
124
|
-
[firstToken == null ? void 0 : firstToken.address, firstToken == null ? void 0 : firstToken.chainId, selectedCurrency]
|
|
125
|
-
);
|
|
126
|
-
const onChangeFirstSelect = require$$0.useCallback((option) => {
|
|
127
|
-
if (!option) {
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
setFirstToken(() => option);
|
|
131
|
-
}, []);
|
|
132
|
-
const handleAmountChange = (value) => {
|
|
133
|
-
setAmount(value);
|
|
134
|
-
};
|
|
135
|
-
const handleOnSubmit = async (e) => {
|
|
136
|
-
e.preventDefault();
|
|
137
|
-
const { data } = await api_confirmFiatRate.confirmFiatRate({
|
|
138
|
-
url: helpers_getApiURL.getApiURL(),
|
|
139
|
-
nativeAuthToken: nativeAuthToken ?? "",
|
|
140
|
-
body: {
|
|
141
|
-
tokenIn: (selectedCurrency == null ? void 0 : selectedCurrency.symbol) ?? "",
|
|
142
|
-
amountIn: (amount == null ? void 0 : amount.toString()) ?? "",
|
|
143
|
-
fromChainId: "",
|
|
144
|
-
tokenOut: (firstToken == null ? void 0 : firstToken.address) ?? "",
|
|
145
|
-
toChainId: mvxChainId.toString(),
|
|
146
|
-
amountOut: (rate == null ? void 0 : rate.amountOut) ?? "",
|
|
147
|
-
sender: mvxAddress ?? "",
|
|
148
|
-
receiver: mvxAddress ?? "",
|
|
149
|
-
fee: (rate == null ? void 0 : rate.fee) ?? "0",
|
|
150
|
-
provider: (rate == null ? void 0 : rate.provider) ?? types_providerType.ProviderType.None,
|
|
151
|
-
orderId: (rate == null ? void 0 : rate.orderId) ?? ""
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
const responseData = data == null ? void 0 : data[0];
|
|
155
|
-
if (!responseData) {
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
const paymentURL = responseData.additionalInfo.url;
|
|
159
|
-
if (!paymentURL) {
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
axios.post(paymentURL, {
|
|
163
|
-
checksum: responseData.additionalInfo.checksum,
|
|
164
|
-
jsonRequest: responseData.additionalInfo.jsonRequest
|
|
165
|
-
});
|
|
166
|
-
};
|
|
167
|
-
require$$0.useEffect(() => {
|
|
168
|
-
fetchRateDebounced(amount);
|
|
169
|
-
if (fetchRateInterval) {
|
|
170
|
-
clearInterval(fetchRateInterval);
|
|
171
|
-
}
|
|
172
|
-
fetchRateInterval = setInterval(() => {
|
|
173
|
-
fetchRateDebounced(amount);
|
|
174
|
-
}, 60 * 1e3);
|
|
175
|
-
return () => clearInterval(fetchRateInterval);
|
|
176
|
-
}, [amount, fetchRateDebounced]);
|
|
177
|
-
require$$0.useEffect(() => {
|
|
178
|
-
if (!(rate == null ? void 0 : rate.amountOut)) {
|
|
179
|
-
setConversionRate(void 0);
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
setConversionRate(Number(amount || "1") / Number(rate.amountOut || "1"));
|
|
183
|
-
}, [rate == null ? void 0 : rate.amountOut, amount]);
|
|
184
|
-
require$$0.useEffect(() => {
|
|
185
|
-
if (currencies == null ? void 0 : currencies.length) {
|
|
186
|
-
setSelectedCurrency(() => currencies == null ? void 0 : currencies[0]);
|
|
187
|
-
}
|
|
188
|
-
}, [currencies == null ? void 0 : currencies.length]);
|
|
189
|
-
require$$0.useEffect(() => {
|
|
190
|
-
setFirstToken(fromOptions == null ? void 0 : fromOptions[0]);
|
|
191
|
-
}, [fromOptions]);
|
|
192
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
193
|
-
"form",
|
|
194
|
-
{
|
|
195
|
-
ref,
|
|
196
|
-
noValidate: true,
|
|
197
|
-
className: "liq-flex liq-flex-col liq-gap-1 liq-relative",
|
|
198
|
-
autoComplete: "off",
|
|
199
|
-
onSubmit: handleOnSubmit,
|
|
200
|
-
children: [
|
|
201
|
-
showHistory && /* @__PURE__ */ jsxRuntime.jsx(
|
|
202
|
-
reactjs_components_BridgeHistory_BridgeHistory.BridgeHistory,
|
|
203
|
-
{
|
|
204
|
-
mvxAddress,
|
|
205
|
-
onClose: () => onHistoryClose == null ? void 0 : onHistoryClose()
|
|
206
|
-
}
|
|
207
|
-
),
|
|
208
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
209
|
-
reactjs_components_base_MxCard_MxCard.MxCard,
|
|
210
|
-
{
|
|
211
|
-
cardSize: "lg",
|
|
212
|
-
variant: "neutral-750",
|
|
213
|
-
className: reactjs_utils_mxClsx.mxClsx(
|
|
214
|
-
"liq-flex liq-flex-col liq-gap-4 liq-outline liq-outline-transparent",
|
|
215
|
-
"liq-py-12 sm:liq-py-6",
|
|
216
|
-
{
|
|
217
|
-
"liq-pointer-events-none": isTokenSelectorVisible
|
|
218
|
-
}
|
|
219
|
-
),
|
|
220
|
-
children: [
|
|
221
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-flex liq-items-center liq-justify-center liq-gap-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
222
|
-
modules_fiat_components_FiatForm_components_TokenSelector_TokenSelector.TokenSelector,
|
|
223
|
-
{
|
|
224
|
-
name: "firstToken",
|
|
225
|
-
disabled: isPendingRate,
|
|
226
|
-
options: fromOptions,
|
|
227
|
-
areOptionsLoading: tokensLoading,
|
|
228
|
-
color: "neutral-850",
|
|
229
|
-
onChange: onChangeFirstSelect,
|
|
230
|
-
selectedOption: firstToken,
|
|
231
|
-
onTokenSelectorDisplay: (visible) => setIsTokenSelectorVisible(visible)
|
|
232
|
-
}
|
|
233
|
-
) }),
|
|
234
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liq-flex liq-flex-col liq-justify-between liq-gap-1 liq-text-center", children: [
|
|
235
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
236
|
-
modules_fiat_components_FiatForm_components_AmountInput_AmountInput.AmountInput,
|
|
237
|
-
{
|
|
238
|
-
inputName: "amount",
|
|
239
|
-
inputValue: amount,
|
|
240
|
-
disabled: false,
|
|
241
|
-
onInputDebounceChange: handleAmountChange
|
|
242
|
-
}
|
|
243
|
-
),
|
|
244
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
245
|
-
"p",
|
|
246
|
-
{
|
|
247
|
-
className: `liq-text-sm mt-2 ${rateError ? "liq-text-danger" : "liq-text-gray-400"}`,
|
|
248
|
-
children: [
|
|
249
|
-
"⇅",
|
|
250
|
-
rateError ? "Error fetching rate" : `${(rate == null ? void 0 : rate.amountOut) ? Number(rate == null ? void 0 : rate.amountOut).toFixed(4) : 0} ${firstToken == null ? void 0 : firstToken.symbol}`
|
|
251
|
-
]
|
|
252
|
-
}
|
|
253
|
-
)
|
|
254
|
-
] }),
|
|
255
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-flex liq-justify-center liq-gap-3 liq-mt-6", children: ["50", "100", "500"].map((value) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
256
|
-
"button",
|
|
257
|
-
{
|
|
258
|
-
className: "liq-bg-neutral-750/50 hover:liq-bg-neutral-700/50 liq-px-4 liq-py-2 liq-rounded-lg liq-text-neutral-200 hover:liq-text-neutral-50",
|
|
259
|
-
onClick: (e) => {
|
|
260
|
-
e.preventDefault();
|
|
261
|
-
handleAmountChange(value);
|
|
262
|
-
},
|
|
263
|
-
children: [
|
|
264
|
-
"€",
|
|
265
|
-
value
|
|
266
|
-
]
|
|
267
|
-
},
|
|
268
|
-
value
|
|
269
|
-
)) })
|
|
270
|
-
]
|
|
271
|
-
}
|
|
272
|
-
),
|
|
273
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
274
|
-
reactjs_components_base_MxButton_MxButton.MxButton,
|
|
275
|
-
{
|
|
276
|
-
type: "submit",
|
|
277
|
-
variant: "neutral-850",
|
|
278
|
-
className: "liq-w-full disabled:liq-bg-neutral-850/50 liq-py-2 hover:enabled:liq-bg-primary !liq-text-primary-200",
|
|
279
|
-
disabled: isPendingRate || !mvxAddress || Boolean(rateError),
|
|
280
|
-
children: [
|
|
281
|
-
Boolean(amount) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liq-flex liq-justify-center liq-items-center liq-gap-2", children: [
|
|
282
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1", children: "Continue" }),
|
|
283
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
284
|
-
"img",
|
|
285
|
-
{
|
|
286
|
-
src: ArrowUpRight,
|
|
287
|
-
alt: "",
|
|
288
|
-
className: "liq-flex liq-items-center liq-justify-center liq-rounded-full liq-fill-primary-200"
|
|
289
|
-
}
|
|
290
|
-
)
|
|
291
|
-
] }),
|
|
292
|
-
!Boolean(amount) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "liq-text-neutral-100", children: "Enter amount" })
|
|
293
|
-
]
|
|
294
|
-
}
|
|
295
|
-
),
|
|
296
|
-
amount && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liq-transition-colors liq-duration-200 liq-bg-neutral-900/50 liq-flex liq-justify-between liq-items-center liq-border liq-border-neutral-750 liq-rounded-xl liq-p-2", children: [
|
|
297
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-flex liq-items-center", children: "Exchange Rate" }),
|
|
298
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liq-flex liq-items-center liq-ml-2", children: [
|
|
299
|
-
conversionRate && /* @__PURE__ */ jsxRuntime.jsx(modules_fiat_components_FiatForm_components_RateReloading_RateReloading.RateReloading, { progressWidth: 16 }),
|
|
300
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "liq-flex liq-items-center liq-ml-2", children: [
|
|
301
|
-
"1 ",
|
|
302
|
-
firstToken == null ? void 0 : firstToken.symbol,
|
|
303
|
-
" = ",
|
|
304
|
-
selectedCurrency == null ? void 0 : selectedCurrency.symbol,
|
|
305
|
-
" ",
|
|
306
|
-
conversionRate ? conversionRate.toFixed(4) : "..."
|
|
307
|
-
] })
|
|
308
|
-
] })
|
|
309
|
-
] })
|
|
310
|
-
]
|
|
311
|
-
}
|
|
312
|
-
);
|
|
313
|
-
};
|
|
314
|
-
exports.FiatForm = FiatForm;
|
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import axios from "axios";
|
|
3
|
-
import debounce from "lodash/debounce";
|
|
4
|
-
import { useRef, useState, useMemo, useCallback, useEffect } from "react";
|
|
5
|
-
/* empty css */
|
|
6
|
-
import { mxClsx } from "../../../../reactjs/utils/mxClsx.mjs";
|
|
7
|
-
import { MxButton } from "../../../../reactjs/components/base/MxButton/MxButton.mjs";
|
|
8
|
-
import { MxCard } from "../../../../reactjs/components/base/MxCard/MxCard.mjs";
|
|
9
|
-
import "../../../../reactjs/components/base/MxLink/MxLink.mjs";
|
|
10
|
-
import "../../../../reactjs/components/base/MxSearch/MxSearch.mjs";
|
|
11
|
-
import "@fortawesome/free-solid-svg-icons/faClose";
|
|
12
|
-
import "@fortawesome/react-fontawesome";
|
|
13
|
-
import "@headlessui/react";
|
|
14
|
-
import "react-dom";
|
|
15
|
-
import "react-popper";
|
|
16
|
-
import "../../../../reactjs/components/base/MxTooltip/components/TooltipContainer/TooltipContainer.mjs";
|
|
17
|
-
import "../../../../reactjs/constants/index.mjs";
|
|
18
|
-
import "react-number-format";
|
|
19
|
-
import "@fortawesome/free-solid-svg-icons/faSpinner";
|
|
20
|
-
import "@multiversx/sdk-dapp-utils/out/helpers/formatAmount";
|
|
21
|
-
import "react-toastify";
|
|
22
|
-
import "wagmi";
|
|
23
|
-
import { getApiURL } from "../../../../helpers/getApiURL.mjs";
|
|
24
|
-
import "../../../../reactjs/context/Web3AppProvider.mjs";
|
|
25
|
-
import "../../../../index-iN9APQ6x.mjs";
|
|
26
|
-
import "viem";
|
|
27
|
-
import "viem/chains";
|
|
28
|
-
import "formik";
|
|
29
|
-
import "yup";
|
|
30
|
-
import "@multiversx/sdk-dapp-utils/out/helpers/parseAmount";
|
|
31
|
-
import "../../../../bignumber-CKZkoo0g.mjs";
|
|
32
|
-
import { ProviderType } from "../../../../types/providerType.mjs";
|
|
33
|
-
import "@tanstack/react-query";
|
|
34
|
-
import { BridgeHistory } from "../../../../reactjs/components/BridgeHistory/BridgeHistory.mjs";
|
|
35
|
-
import "@fortawesome/free-solid-svg-icons/faPowerOff";
|
|
36
|
-
import "@fortawesome/free-solid-svg-icons/faCheck";
|
|
37
|
-
import "@fortawesome/free-solid-svg-icons/faCopy";
|
|
38
|
-
import "@fortawesome/free-solid-svg-icons/faChevronDown";
|
|
39
|
-
import "@fortawesome/free-solid-svg-icons/faWallet";
|
|
40
|
-
import "react-select";
|
|
41
|
-
import "@fortawesome/free-solid-svg-icons/faDiamond";
|
|
42
|
-
import "lodash/isString";
|
|
43
|
-
import "animated-number-react";
|
|
44
|
-
import "numeral";
|
|
45
|
-
import "@multiversx/sdk-dapp-utils/out/helpers/stringIsInteger";
|
|
46
|
-
import "@fortawesome/free-solid-svg-icons/faArrowUpRightFromSquare";
|
|
47
|
-
import "@reown/appkit-adapter-wagmi";
|
|
48
|
-
import { AmountInput } from "./components/AmountInput/AmountInput.mjs";
|
|
49
|
-
import { RateReloading } from "./components/RateReloading/RateReloading.mjs";
|
|
50
|
-
import { TokenSelector } from "./components/TokenSelector/TokenSelector.mjs";
|
|
51
|
-
import { confirmFiatRate } from "../../../../api/confirmFiatRate.mjs";
|
|
52
|
-
import { useFiatData } from "../../hooks/useFiatData.mjs";
|
|
53
|
-
import { useGetRateMutation } from "../../queries/useGetRate.mutation.mjs";
|
|
54
|
-
const ArrowUpRight = "data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M15%206V13C15%2013.5625%2014.5312%2014%2014%2014C13.4375%2014%2013%2013.5625%2013%2013V8.4375L6.6875%2014.7188C6.3125%2015.125%205.65625%2015.125%205.28125%2014.7188C4.875%2014.3438%204.875%2013.6875%205.28125%2013.3125L11.5625%207H7C6.4375%207%206%206.5625%206%206C6%205.46875%206.4375%205%207%205H14C14.5312%205%2015%205.46875%2015%206Z'%20fill='%23CDD0DB'/%3e%3c/svg%3e";
|
|
55
|
-
let fetchRateInterval;
|
|
56
|
-
const FiatForm = ({
|
|
57
|
-
mvxChainId,
|
|
58
|
-
mvxAddress,
|
|
59
|
-
nativeAuthToken,
|
|
60
|
-
showHistory,
|
|
61
|
-
onHistoryClose
|
|
62
|
-
}) => {
|
|
63
|
-
const ref = useRef(null);
|
|
64
|
-
const [isTokenSelectorVisible, setIsTokenSelectorVisible] = useState(false);
|
|
65
|
-
const [firstToken, setFirstToken] = useState();
|
|
66
|
-
const [amount, setAmount] = useState("");
|
|
67
|
-
const [conversionRate, setConversionRate] = useState();
|
|
68
|
-
const {
|
|
69
|
-
currencies,
|
|
70
|
-
mvxTokens,
|
|
71
|
-
isTokensLoading: tokensLoading
|
|
72
|
-
} = useFiatData();
|
|
73
|
-
const [selectedCurrency, setSelectedCurrency] = useState();
|
|
74
|
-
const {
|
|
75
|
-
mutate: getRate,
|
|
76
|
-
data: rate,
|
|
77
|
-
isPending: isPendingRate,
|
|
78
|
-
error: rateError
|
|
79
|
-
} = useGetRateMutation();
|
|
80
|
-
const availableTokens = useMemo(() => {
|
|
81
|
-
if (!(selectedCurrency == null ? void 0 : selectedCurrency.availableTokens)) {
|
|
82
|
-
return [];
|
|
83
|
-
}
|
|
84
|
-
const foundTokens = [];
|
|
85
|
-
for (const ticker of selectedCurrency.availableTokens) {
|
|
86
|
-
const foundToken = mvxTokens == null ? void 0 : mvxTokens.find(
|
|
87
|
-
(mvxToken) => mvxToken.address === ticker
|
|
88
|
-
);
|
|
89
|
-
if (foundToken) {
|
|
90
|
-
foundTokens.push(foundToken);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return foundTokens;
|
|
94
|
-
}, [mvxTokens, selectedCurrency]);
|
|
95
|
-
const fromOptions = useMemo(
|
|
96
|
-
() => (availableTokens && availableTokens.map((token) => {
|
|
97
|
-
return {
|
|
98
|
-
...token,
|
|
99
|
-
identifier: token.address,
|
|
100
|
-
ticker: token.symbol
|
|
101
|
-
};
|
|
102
|
-
})) ?? [],
|
|
103
|
-
[availableTokens]
|
|
104
|
-
);
|
|
105
|
-
const fetchRateDebounced = useCallback(
|
|
106
|
-
debounce(async (value) => {
|
|
107
|
-
if (!value || !(firstToken == null ? void 0 : firstToken.address) || !selectedCurrency) {
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
getRate({
|
|
111
|
-
nativeAuthToken: nativeAuthToken ?? "",
|
|
112
|
-
body: {
|
|
113
|
-
tokenIn: selectedCurrency.address,
|
|
114
|
-
amountIn: value,
|
|
115
|
-
fromChainId: mvxChainId.toString(),
|
|
116
|
-
tokenOut: firstToken.address,
|
|
117
|
-
toChainId: mvxChainId
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
}, 500),
|
|
121
|
-
[firstToken == null ? void 0 : firstToken.address, firstToken == null ? void 0 : firstToken.chainId, selectedCurrency]
|
|
122
|
-
);
|
|
123
|
-
const onChangeFirstSelect = useCallback((option) => {
|
|
124
|
-
if (!option) {
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
setFirstToken(() => option);
|
|
128
|
-
}, []);
|
|
129
|
-
const handleAmountChange = (value) => {
|
|
130
|
-
setAmount(value);
|
|
131
|
-
};
|
|
132
|
-
const handleOnSubmit = async (e) => {
|
|
133
|
-
e.preventDefault();
|
|
134
|
-
const { data } = await confirmFiatRate({
|
|
135
|
-
url: getApiURL(),
|
|
136
|
-
nativeAuthToken: nativeAuthToken ?? "",
|
|
137
|
-
body: {
|
|
138
|
-
tokenIn: (selectedCurrency == null ? void 0 : selectedCurrency.symbol) ?? "",
|
|
139
|
-
amountIn: (amount == null ? void 0 : amount.toString()) ?? "",
|
|
140
|
-
fromChainId: "",
|
|
141
|
-
tokenOut: (firstToken == null ? void 0 : firstToken.address) ?? "",
|
|
142
|
-
toChainId: mvxChainId.toString(),
|
|
143
|
-
amountOut: (rate == null ? void 0 : rate.amountOut) ?? "",
|
|
144
|
-
sender: mvxAddress ?? "",
|
|
145
|
-
receiver: mvxAddress ?? "",
|
|
146
|
-
fee: (rate == null ? void 0 : rate.fee) ?? "0",
|
|
147
|
-
provider: (rate == null ? void 0 : rate.provider) ?? ProviderType.None,
|
|
148
|
-
orderId: (rate == null ? void 0 : rate.orderId) ?? ""
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
const responseData = data == null ? void 0 : data[0];
|
|
152
|
-
if (!responseData) {
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
const paymentURL = responseData.additionalInfo.url;
|
|
156
|
-
if (!paymentURL) {
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
axios.post(paymentURL, {
|
|
160
|
-
checksum: responseData.additionalInfo.checksum,
|
|
161
|
-
jsonRequest: responseData.additionalInfo.jsonRequest
|
|
162
|
-
});
|
|
163
|
-
};
|
|
164
|
-
useEffect(() => {
|
|
165
|
-
fetchRateDebounced(amount);
|
|
166
|
-
if (fetchRateInterval) {
|
|
167
|
-
clearInterval(fetchRateInterval);
|
|
168
|
-
}
|
|
169
|
-
fetchRateInterval = setInterval(() => {
|
|
170
|
-
fetchRateDebounced(amount);
|
|
171
|
-
}, 60 * 1e3);
|
|
172
|
-
return () => clearInterval(fetchRateInterval);
|
|
173
|
-
}, [amount, fetchRateDebounced]);
|
|
174
|
-
useEffect(() => {
|
|
175
|
-
if (!(rate == null ? void 0 : rate.amountOut)) {
|
|
176
|
-
setConversionRate(void 0);
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
setConversionRate(Number(amount || "1") / Number(rate.amountOut || "1"));
|
|
180
|
-
}, [rate == null ? void 0 : rate.amountOut, amount]);
|
|
181
|
-
useEffect(() => {
|
|
182
|
-
if (currencies == null ? void 0 : currencies.length) {
|
|
183
|
-
setSelectedCurrency(() => currencies == null ? void 0 : currencies[0]);
|
|
184
|
-
}
|
|
185
|
-
}, [currencies == null ? void 0 : currencies.length]);
|
|
186
|
-
useEffect(() => {
|
|
187
|
-
setFirstToken(fromOptions == null ? void 0 : fromOptions[0]);
|
|
188
|
-
}, [fromOptions]);
|
|
189
|
-
return /* @__PURE__ */ jsxs(
|
|
190
|
-
"form",
|
|
191
|
-
{
|
|
192
|
-
ref,
|
|
193
|
-
noValidate: true,
|
|
194
|
-
className: "liq-flex liq-flex-col liq-gap-1 liq-relative",
|
|
195
|
-
autoComplete: "off",
|
|
196
|
-
onSubmit: handleOnSubmit,
|
|
197
|
-
children: [
|
|
198
|
-
showHistory && /* @__PURE__ */ jsx(
|
|
199
|
-
BridgeHistory,
|
|
200
|
-
{
|
|
201
|
-
mvxAddress,
|
|
202
|
-
onClose: () => onHistoryClose == null ? void 0 : onHistoryClose()
|
|
203
|
-
}
|
|
204
|
-
),
|
|
205
|
-
/* @__PURE__ */ jsxs(
|
|
206
|
-
MxCard,
|
|
207
|
-
{
|
|
208
|
-
cardSize: "lg",
|
|
209
|
-
variant: "neutral-750",
|
|
210
|
-
className: mxClsx(
|
|
211
|
-
"liq-flex liq-flex-col liq-gap-4 liq-outline liq-outline-transparent",
|
|
212
|
-
"liq-py-12 sm:liq-py-6",
|
|
213
|
-
{
|
|
214
|
-
"liq-pointer-events-none": isTokenSelectorVisible
|
|
215
|
-
}
|
|
216
|
-
),
|
|
217
|
-
children: [
|
|
218
|
-
/* @__PURE__ */ jsx("div", { className: "liq-flex liq-items-center liq-justify-center liq-gap-1", children: /* @__PURE__ */ jsx(
|
|
219
|
-
TokenSelector,
|
|
220
|
-
{
|
|
221
|
-
name: "firstToken",
|
|
222
|
-
disabled: isPendingRate,
|
|
223
|
-
options: fromOptions,
|
|
224
|
-
areOptionsLoading: tokensLoading,
|
|
225
|
-
color: "neutral-850",
|
|
226
|
-
onChange: onChangeFirstSelect,
|
|
227
|
-
selectedOption: firstToken,
|
|
228
|
-
onTokenSelectorDisplay: (visible) => setIsTokenSelectorVisible(visible)
|
|
229
|
-
}
|
|
230
|
-
) }),
|
|
231
|
-
/* @__PURE__ */ jsxs("div", { className: "liq-flex liq-flex-col liq-justify-between liq-gap-1 liq-text-center", children: [
|
|
232
|
-
/* @__PURE__ */ jsx(
|
|
233
|
-
AmountInput,
|
|
234
|
-
{
|
|
235
|
-
inputName: "amount",
|
|
236
|
-
inputValue: amount,
|
|
237
|
-
disabled: false,
|
|
238
|
-
onInputDebounceChange: handleAmountChange
|
|
239
|
-
}
|
|
240
|
-
),
|
|
241
|
-
/* @__PURE__ */ jsxs(
|
|
242
|
-
"p",
|
|
243
|
-
{
|
|
244
|
-
className: `liq-text-sm mt-2 ${rateError ? "liq-text-danger" : "liq-text-gray-400"}`,
|
|
245
|
-
children: [
|
|
246
|
-
"⇅",
|
|
247
|
-
rateError ? "Error fetching rate" : `${(rate == null ? void 0 : rate.amountOut) ? Number(rate == null ? void 0 : rate.amountOut).toFixed(4) : 0} ${firstToken == null ? void 0 : firstToken.symbol}`
|
|
248
|
-
]
|
|
249
|
-
}
|
|
250
|
-
)
|
|
251
|
-
] }),
|
|
252
|
-
/* @__PURE__ */ jsx("div", { className: "liq-flex liq-justify-center liq-gap-3 liq-mt-6", children: ["50", "100", "500"].map((value) => /* @__PURE__ */ jsxs(
|
|
253
|
-
"button",
|
|
254
|
-
{
|
|
255
|
-
className: "liq-bg-neutral-750/50 hover:liq-bg-neutral-700/50 liq-px-4 liq-py-2 liq-rounded-lg liq-text-neutral-200 hover:liq-text-neutral-50",
|
|
256
|
-
onClick: (e) => {
|
|
257
|
-
e.preventDefault();
|
|
258
|
-
handleAmountChange(value);
|
|
259
|
-
},
|
|
260
|
-
children: [
|
|
261
|
-
"€",
|
|
262
|
-
value
|
|
263
|
-
]
|
|
264
|
-
},
|
|
265
|
-
value
|
|
266
|
-
)) })
|
|
267
|
-
]
|
|
268
|
-
}
|
|
269
|
-
),
|
|
270
|
-
/* @__PURE__ */ jsxs(
|
|
271
|
-
MxButton,
|
|
272
|
-
{
|
|
273
|
-
type: "submit",
|
|
274
|
-
variant: "neutral-850",
|
|
275
|
-
className: "liq-w-full disabled:liq-bg-neutral-850/50 liq-py-2 hover:enabled:liq-bg-primary !liq-text-primary-200",
|
|
276
|
-
disabled: isPendingRate || !mvxAddress || Boolean(rateError),
|
|
277
|
-
children: [
|
|
278
|
-
Boolean(amount) && /* @__PURE__ */ jsxs("div", { className: "liq-flex liq-justify-center liq-items-center liq-gap-2", children: [
|
|
279
|
-
/* @__PURE__ */ jsx("div", { className: "flex-1", children: "Continue" }),
|
|
280
|
-
/* @__PURE__ */ jsx(
|
|
281
|
-
"img",
|
|
282
|
-
{
|
|
283
|
-
src: ArrowUpRight,
|
|
284
|
-
alt: "",
|
|
285
|
-
className: "liq-flex liq-items-center liq-justify-center liq-rounded-full liq-fill-primary-200"
|
|
286
|
-
}
|
|
287
|
-
)
|
|
288
|
-
] }),
|
|
289
|
-
!Boolean(amount) && /* @__PURE__ */ jsx("span", { className: "liq-text-neutral-100", children: "Enter amount" })
|
|
290
|
-
]
|
|
291
|
-
}
|
|
292
|
-
),
|
|
293
|
-
amount && /* @__PURE__ */ jsxs("div", { className: "liq-transition-colors liq-duration-200 liq-bg-neutral-900/50 liq-flex liq-justify-between liq-items-center liq-border liq-border-neutral-750 liq-rounded-xl liq-p-2", children: [
|
|
294
|
-
/* @__PURE__ */ jsx("div", { className: "liq-flex liq-items-center", children: "Exchange Rate" }),
|
|
295
|
-
/* @__PURE__ */ jsxs("div", { className: "liq-flex liq-items-center liq-ml-2", children: [
|
|
296
|
-
conversionRate && /* @__PURE__ */ jsx(RateReloading, { progressWidth: 16 }),
|
|
297
|
-
/* @__PURE__ */ jsxs("span", { className: "liq-flex liq-items-center liq-ml-2", children: [
|
|
298
|
-
"1 ",
|
|
299
|
-
firstToken == null ? void 0 : firstToken.symbol,
|
|
300
|
-
" = ",
|
|
301
|
-
selectedCurrency == null ? void 0 : selectedCurrency.symbol,
|
|
302
|
-
" ",
|
|
303
|
-
conversionRate ? conversionRate.toFixed(4) : "..."
|
|
304
|
-
] })
|
|
305
|
-
] })
|
|
306
|
-
] })
|
|
307
|
-
]
|
|
308
|
-
}
|
|
309
|
-
);
|
|
310
|
-
};
|
|
311
|
-
export {
|
|
312
|
-
FiatForm
|
|
313
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ChangeEvent, FocusEvent } from 'react';
|
|
2
|
-
|
|
3
|
-
export declare const AmountInput: ({ inputName, inputValue, disabled, amountError, omitDisableClass, className, onBlur, onInputDebounceChange, onInputChange }: {
|
|
4
|
-
inputName: string;
|
|
5
|
-
inputValue: string;
|
|
6
|
-
disabled?: boolean;
|
|
7
|
-
amountError?: string;
|
|
8
|
-
omitDisableClass?: boolean;
|
|
9
|
-
className?: string;
|
|
10
|
-
onBlur?: (e: FocusEvent<HTMLElement>) => void;
|
|
11
|
-
onInputDebounceChange?: (amount: string) => void;
|
|
12
|
-
onInputChange?: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
13
|
-
}) => import("react/jsx-runtime").JSX.Element;
|