@multiversx/sdk-dapp-liquidity 2.1.0-alpha.0 → 2.1.0-alpha.2
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/all-networks--dfVLHLJ.js +2 -0
- package/all-networks-Czd8zS1n.mjs +4 -0
- package/api/checkAccount.js +1 -21
- package/api/checkAccount.mjs +13 -13
- package/api/confirmRate.js +1 -29
- package/api/confirmRate.mjs +17 -22
- package/api/getChains.js +1 -17
- package/api/getChains.mjs +10 -10
- package/api/getRate.js +1 -27
- package/api/getRate.mjs +17 -20
- package/api/getTokens.js +1 -22
- package/api/getTokens.mjs +14 -15
- package/api/getTokensBalances.js +1 -21
- package/api/getTokensBalances.mjs +13 -13
- package/api/getTransactions.js +1 -38
- package/api/getTransactions.mjs +25 -31
- package/api/index.js +1 -18
- package/api/index.mjs +16 -16
- package/api/sendTransactions.js +1 -32
- package/api/sendTransactions.mjs +19 -19
- package/api/tests/confirmRate.spec.js +1 -130
- package/api/tests/confirmRate.spec.mjs +44 -58
- package/api/tests/getChains.spec.js +1 -43
- package/api/tests/getChains.spec.mjs +15 -18
- package/api/tests/getRate.spec.js +1 -87
- package/api/tests/getRate.spec.mjs +35 -49
- package/api/tests/getTokens.spec.js +1 -68
- package/api/tests/getTokens.spec.mjs +23 -29
- package/api/tests/getTransactions.spec.js +1 -94
- package/api/tests/getTransactions.spec.mjs +35 -51
- package/api/tests/sendTransactions.spec.js +1 -96
- package/api/tests/sendTransactions.spec.mjs +44 -52
- package/constants/index.js +1 -4
- package/constants/index.mjs +2 -2
- package/default-D0Jk5ROI.mjs +4 -0
- package/default-DbU6vPaB.js +2 -0
- package/helpers/assertRateConfirmationMatchesIntent.js +1 -23
- package/helpers/assertRateConfirmationMatchesIntent.mjs +13 -16
- package/helpers/base64Utils.js +1 -31
- package/helpers/base64Utils.mjs +14 -24
- package/helpers/decodeLoginToken.js +1 -27
- package/helpers/decodeLoginToken.mjs +13 -18
- package/helpers/decodeToken.js +1 -39
- package/helpers/decodeToken.mjs +20 -31
- package/helpers/getApiURL.js +1 -7
- package/helpers/getApiURL.mjs +3 -5
- package/helpers/getBridgeURL.js +1 -7
- package/helpers/getBridgeURL.mjs +3 -5
- package/helpers/getDisplayName.js +1 -11
- package/helpers/getDisplayName.mjs +3 -8
- package/helpers/getMvxApiURL.js +1 -7
- package/helpers/getMvxApiURL.mjs +3 -5
- package/helpers/getMvxChainId.js +1 -7
- package/helpers/getMvxChainId.mjs +3 -5
- package/helpers/getMvxExplorerAddress.js +1 -7
- package/helpers/getMvxExplorerAddress.mjs +3 -5
- package/helpers/index.js +1 -26
- package/helpers/index.mjs +24 -24
- package/helpers/safeImageUrl.js +1 -23
- package/helpers/safeImageUrl.mjs +10 -20
- package/helpers/serializeTransaction.js +1 -8
- package/helpers/serializeTransaction.mjs +3 -5
- package/helpers/tests/assertRateConfirmationMatchesIntent.spec.js +1 -63
- package/helpers/tests/assertRateConfirmationMatchesIntent.spec.mjs +31 -41
- package/helpers/tests/base64Utils.spec.js +1 -29
- package/helpers/tests/base64Utils.spec.mjs +11 -24
- package/helpers/tests/decodeLoginToken.spec.js +1 -34
- package/helpers/tests/decodeLoginToken.spec.mjs +13 -24
- package/helpers/tests/decodeToken.spec.js +1 -27
- package/helpers/tests/decodeToken.spec.mjs +7 -12
- package/helpers/tests/safeImageUrl.spec.js +1 -48
- package/helpers/tests/safeImageUrl.spec.mjs +28 -43
- package/helpers/tests/serializeTransaction.spec.js +1 -36
- package/helpers/tests/serializeTransaction.spec.mjs +13 -24
- package/index.js +1 -232
- package/index.mjs +196 -196
- package/package.json +5 -4
- package/react.esm-B0AMOHxa.js +73 -0
- package/react.esm-BxvJJ86Q.mjs +9949 -0
- package/reactjs/adapters/SuiAdapter.js +1 -378
- package/reactjs/adapters/SuiAdapter.mjs +160 -217
- package/reactjs/components/AccountAddress/AccountAddress.js +1 -31
- package/reactjs/components/AccountAddress/AccountAddress.mjs +16 -16
- package/reactjs/components/AccountAddress/index.js +1 -4
- package/reactjs/components/AccountAddress/index.mjs +2 -2
- package/reactjs/components/AmountCard/AmountCard.js +1 -33
- package/reactjs/components/AmountCard/AmountCard.mjs +19 -21
- package/reactjs/components/AmountCard/index.js +1 -4
- package/reactjs/components/AmountCard/index.mjs +2 -2
- package/reactjs/components/AmountInput/AmountInput.js +1 -71
- package/reactjs/components/AmountInput/AmountInput.mjs +42 -46
- package/reactjs/components/AmountInput/index.js +1 -4
- package/reactjs/components/AmountInput/index.mjs +2 -2
- package/reactjs/components/BridgeForm/BridgeForm.d.ts +9 -0
- package/reactjs/components/BridgeForm/BridgeForm.js +1 -89
- package/reactjs/components/BridgeForm/BridgeForm.mjs +72 -79
- package/reactjs/components/BridgeForm/Deposit.js +1 -675
- package/reactjs/components/BridgeForm/Deposit.mjs +380 -504
- package/reactjs/components/BridgeForm/Transfer.js +1 -561
- package/reactjs/components/BridgeForm/Transfer.mjs +315 -428
- package/reactjs/components/BridgeForm/hooks/useBridgeAmounts.js +1 -78
- package/reactjs/components/BridgeForm/hooks/useBridgeAmounts.mjs +47 -70
- package/reactjs/components/BridgeForm/hooks/useBridgeRateFetching.js +1 -58
- package/reactjs/components/BridgeForm/hooks/useBridgeRateFetching.mjs +36 -47
- package/reactjs/components/BridgeForm/hooks/useBridgeTokenSelection.js +1 -266
- package/reactjs/components/BridgeForm/hooks/useBridgeTokenSelection.mjs +163 -231
- package/reactjs/components/BridgeForm/index.js +1 -4
- package/reactjs/components/BridgeForm/index.mjs +2 -2
- package/reactjs/components/BridgeForm/utils/bridgeFormHelpers.js +1 -76
- package/reactjs/components/BridgeForm/utils/bridgeFormHelpers.mjs +33 -65
- package/reactjs/components/BridgeHistory/BridgeHistory.js +1 -381
- package/reactjs/components/BridgeHistory/BridgeHistory.mjs +170 -200
- package/reactjs/components/BridgeHistory/index.js +1 -4
- package/reactjs/components/BridgeHistory/index.mjs +2 -2
- package/reactjs/components/Connect/BridgeAccountDisplay.js +1 -150
- package/reactjs/components/Connect/BridgeAccountDisplay.mjs +99 -115
- package/reactjs/components/Connect/BridgeConnectButton.js +1 -35
- package/reactjs/components/Connect/BridgeConnectButton.mjs +20 -20
- package/reactjs/components/Connect/ChainSelectConnect.js +1 -144
- package/reactjs/components/Connect/ChainSelectConnect.mjs +70 -83
- package/reactjs/components/Connect/CustomConnectButton.js +1 -40
- package/reactjs/components/Connect/CustomConnectButton.mjs +24 -30
- package/reactjs/components/Connect/MvxAccountDisplay.js +1 -97
- package/reactjs/components/Connect/MvxAccountDisplay.mjs +47 -50
- package/reactjs/components/Connect/MvxConnectButton.js +1 -43
- package/reactjs/components/Connect/MvxConnectButton.mjs +35 -40
- package/reactjs/components/Connect/SwitchChainButton.js +1 -29
- package/reactjs/components/Connect/SwitchChainButton.mjs +15 -18
- package/reactjs/components/Connect/index.js +1 -16
- package/reactjs/components/Connect/index.mjs +14 -14
- package/reactjs/components/CopyButton/CopyButton.js +1 -46
- package/reactjs/components/CopyButton/CopyButton.mjs +33 -36
- package/reactjs/components/CopyButton/index.js +1 -4
- package/reactjs/components/CopyButton/index.mjs +2 -2
- package/reactjs/components/CopyButton/utils/copyToClipboard.js +1 -38
- package/reactjs/components/CopyButton/utils/copyToClipboard.mjs +20 -32
- package/reactjs/components/CopyButton/utils/index.js +1 -4
- package/reactjs/components/CopyButton/utils/index.mjs +2 -2
- package/reactjs/components/DisplayAmount/DisplayAmount.js +1 -90
- package/reactjs/components/DisplayAmount/DisplayAmount.mjs +68 -75
- package/reactjs/components/DisplayAmount/components/AnimateNumber/AnimateNumber.js +1 -39
- package/reactjs/components/DisplayAmount/components/AnimateNumber/AnimateNumber.mjs +26 -33
- package/reactjs/components/DisplayAmount/components/PrecisedAmount/PrecisedAmount.js +1 -61
- package/reactjs/components/DisplayAmount/components/PrecisedAmount/PrecisedAmount.mjs +38 -46
- package/reactjs/components/DisplayAmount/index.js +1 -4
- package/reactjs/components/DisplayAmount/index.mjs +2 -2
- package/reactjs/components/DisplayAmount/utils/index.js +1 -4
- package/reactjs/components/DisplayAmount/utils/index.mjs +2 -2
- package/reactjs/components/DisplayAmount/utils/truncateAmount.js +1 -21
- package/reactjs/components/DisplayAmount/utils/truncateAmount.mjs +9 -13
- package/reactjs/components/Error/Error.js +1 -66
- package/reactjs/components/Error/Error.mjs +29 -29
- package/reactjs/components/Error/index.js +1 -4
- package/reactjs/components/Error/index.mjs +2 -2
- package/reactjs/components/SmallLoader/SmallLoader.js +1 -21
- package/reactjs/components/SmallLoader/SmallLoader.mjs +13 -18
- package/reactjs/components/SmallLoader/index.js +1 -4
- package/reactjs/components/SmallLoader/index.mjs +2 -2
- package/reactjs/components/ToggleDirection/ToggleDirection.js +1 -30
- package/reactjs/components/ToggleDirection/ToggleDirection.mjs +22 -28
- package/reactjs/components/TokenSelector/TokenSelector.js +1 -172
- package/reactjs/components/TokenSelector/TokenSelector.mjs +98 -118
- package/reactjs/components/TokenSelector/components/ChainSelect/ChainSelect.js +1 -94
- package/reactjs/components/TokenSelector/components/ChainSelect/ChainSelect.mjs +48 -57
- package/reactjs/components/TokenSelector/components/ChainSelect/components/ChainOptionLabel.js +1 -55
- package/reactjs/components/TokenSelector/components/ChainSelect/components/ChainOptionLabel.mjs +45 -48
- package/reactjs/components/TokenSelector/components/ChainSelect/components/FormatChainOptionLabel.js +1 -18
- package/reactjs/components/TokenSelector/components/ChainSelect/components/FormatChainOptionLabel.mjs +9 -14
- package/reactjs/components/TokenSelector/components/ChainSelect/components/IndicatorSeparator.js +1 -6
- package/reactjs/components/TokenSelector/components/ChainSelect/components/IndicatorSeparator.mjs +2 -4
- package/reactjs/components/TokenSelector/components/ChainSelect/components/SelectedChainOption.js +1 -43
- package/reactjs/components/TokenSelector/components/ChainSelect/components/SelectedChainOption.mjs +21 -21
- package/reactjs/components/TokenSelector/components/SelectContainer.js +1 -40
- package/reactjs/components/TokenSelector/components/SelectContainer.mjs +36 -38
- package/reactjs/components/TokenSelector/components/SelectContent.js +1 -136
- package/reactjs/components/TokenSelector/components/SelectContent.mjs +79 -103
- package/reactjs/components/TokenSelector/components/SelectedOption.js +1 -28
- package/reactjs/components/TokenSelector/components/SelectedOption.mjs +22 -24
- package/reactjs/components/TokenSelector/components/TokenIcon.js +1 -82
- package/reactjs/components/TokenSelector/components/TokenIcon.mjs +52 -58
- package/reactjs/components/TokenSelector/components/TokenItem.js +1 -80
- package/reactjs/components/TokenSelector/components/TokenItem.mjs +41 -54
- package/reactjs/components/TokenSelector/components/TokenList.js +1 -23
- package/reactjs/components/TokenSelector/components/TokenList.mjs +19 -21
- package/reactjs/components/TokenSelector/components/TokenSymbol.js +1 -25
- package/reactjs/components/TokenSelector/components/TokenSymbol.mjs +14 -15
- package/reactjs/components/TokenSelector/index.js +1 -4
- package/reactjs/components/TokenSelector/index.mjs +2 -2
- package/reactjs/components/TransactionToast/TransactionToast.js +1 -53
- package/reactjs/components/TransactionToast/TransactionToast.mjs +27 -28
- package/reactjs/components/TransactionToast/TransactionToastContainer.js +1 -20
- package/reactjs/components/TransactionToast/TransactionToastContainer.mjs +16 -18
- package/reactjs/components/TransactionToast/index.js +1 -6
- package/reactjs/components/TransactionToast/index.mjs +4 -4
- package/reactjs/components/TrimAddress/TrimAddress.js +1 -27
- package/reactjs/components/TrimAddress/TrimAddress.mjs +19 -24
- package/reactjs/components/TrimAddress/index.js +1 -4
- package/reactjs/components/TrimAddress/index.mjs +2 -2
- package/reactjs/components/base/MxButton/MxButton.js +1 -71
- package/reactjs/components/base/MxButton/MxButton.mjs +46 -46
- package/reactjs/components/base/MxButton/index.js +1 -4
- package/reactjs/components/base/MxButton/index.mjs +2 -2
- package/reactjs/components/base/MxCard/MxCard.js +1 -54
- package/reactjs/components/base/MxCard/MxCard.mjs +34 -34
- package/reactjs/components/base/MxCard/index.js +1 -4
- package/reactjs/components/base/MxCard/index.mjs +2 -2
- package/reactjs/components/base/MxCircleLoader/MxCircleLoader.js +1 -28
- package/reactjs/components/base/MxCircleLoader/MxCircleLoader.mjs +24 -26
- package/reactjs/components/base/MxCircleLoader/index.js +1 -4
- package/reactjs/components/base/MxCircleLoader/index.mjs +2 -2
- package/reactjs/components/base/MxLink/MxLink.js +1 -70
- package/reactjs/components/base/MxLink/MxLink.mjs +44 -46
- package/reactjs/components/base/MxLink/index.js +1 -4
- package/reactjs/components/base/MxLink/index.mjs +2 -2
- package/reactjs/components/base/MxSearch/MxSearch.js +1 -69
- package/reactjs/components/base/MxSearch/MxSearch.mjs +37 -41
- package/reactjs/components/base/MxSearch/index.js +1 -4
- package/reactjs/components/base/MxSearch/index.mjs +2 -2
- package/reactjs/components/base/MxSlideover/MxSlideover.js +1 -78
- package/reactjs/components/base/MxSlideover/MxSlideover.mjs +72 -74
- package/reactjs/components/base/MxSlideover/index.js +1 -4
- package/reactjs/components/base/MxSlideover/index.mjs +2 -2
- package/reactjs/components/base/MxTooltip/MxTooltip.js +1 -163
- package/reactjs/components/base/MxTooltip/MxTooltip.mjs +92 -135
- package/reactjs/components/base/MxTooltip/components/TooltipContainer/TooltipContainer.js +1 -33
- package/reactjs/components/base/MxTooltip/components/TooltipContainer/TooltipContainer.mjs +29 -31
- package/reactjs/components/base/MxTooltip/components/TooltipContainer/index.js +1 -4
- package/reactjs/components/base/MxTooltip/components/TooltipContainer/index.mjs +2 -2
- package/reactjs/components/base/MxTooltip/components/TooltipContent/TooltipContent.js +1 -27
- package/reactjs/components/base/MxTooltip/components/TooltipContent/TooltipContent.mjs +23 -25
- package/reactjs/components/base/MxTooltip/components/TooltipContent/index.js +1 -4
- package/reactjs/components/base/MxTooltip/components/TooltipContent/index.mjs +2 -2
- package/reactjs/components/base/MxTooltip/components/index.js +1 -6
- package/reactjs/components/base/MxTooltip/components/index.mjs +4 -4
- package/reactjs/components/base/MxTooltip/index.js +1 -4
- package/reactjs/components/base/MxTooltip/index.mjs +2 -2
- package/reactjs/components/base/index.js +1 -14
- package/reactjs/components/base/index.mjs +12 -12
- package/reactjs/components/index.js +1 -54
- package/reactjs/components/index.mjs +52 -52
- package/reactjs/constants/chains.js +1 -54
- package/reactjs/constants/chains.mjs +33 -52
- package/reactjs/constants/index.js +1 -13
- package/reactjs/constants/index.mjs +9 -10
- package/reactjs/context/Web3AppProvider.js +1 -42
- package/reactjs/context/Web3AppProvider.mjs +34 -36
- package/reactjs/context/queryClient.js +1 -11
- package/reactjs/context/queryClient.mjs +5 -8
- package/reactjs/context/useWeb3App.js +1 -12
- package/reactjs/context/useWeb3App.mjs +7 -8
- package/reactjs/helpers/index.js +1 -6
- package/reactjs/helpers/index.mjs +4 -4
- package/reactjs/helpers/resolveBridgeApiChainId.js +1 -40
- package/reactjs/helpers/resolveBridgeApiChainId.mjs +21 -34
- package/reactjs/hooks/index.js +1 -35
- package/reactjs/hooks/index.mjs +33 -33
- package/reactjs/hooks/tests/useGenericSignMessage.spec.js +1 -68
- package/reactjs/hooks/tests/useGenericSignMessage.spec.mjs +23 -38
- package/reactjs/hooks/tests/useSignTransaction.spec.js +1 -195
- package/reactjs/hooks/tests/useSignTransaction.spec.mjs +72 -110
- package/reactjs/hooks/useAccount.js +1 -13
- package/reactjs/hooks/useAccount.mjs +7 -8
- package/reactjs/hooks/useBalances.js +1 -53
- package/reactjs/hooks/useBalances.mjs +28 -40
- package/reactjs/hooks/useBridgeApiChainId.js +1 -13
- package/reactjs/hooks/useBridgeApiChainId.mjs +9 -9
- package/reactjs/hooks/useBridgeFormik.js +1 -167
- package/reactjs/hooks/useBridgeFormik.mjs +110 -155
- package/reactjs/hooks/useDebounce.js +1 -13
- package/reactjs/hooks/useDebounce.mjs +8 -10
- package/reactjs/hooks/useFetchBridgeData.js +1 -45
- package/reactjs/hooks/useFetchBridgeData.mjs +37 -38
- package/reactjs/hooks/useFetchTokens.js +1 -115
- package/reactjs/hooks/useFetchTokens.mjs +80 -108
- package/reactjs/hooks/useGenericSignMessage.js +1 -75
- package/reactjs/hooks/useGenericSignMessage.mjs +44 -64
- package/reactjs/hooks/useGetChainId.js +1 -11
- package/reactjs/hooks/useGetChainId.mjs +7 -8
- package/reactjs/hooks/useResolveTokenChain.js +1 -20
- package/reactjs/hooks/useResolveTokenChain.mjs +11 -14
- package/reactjs/hooks/useSendTransactions.js +1 -25
- package/reactjs/hooks/useSendTransactions.mjs +19 -23
- package/reactjs/hooks/useSignTransaction.js +1 -112
- package/reactjs/hooks/useSignTransaction.mjs +50 -76
- package/reactjs/hooks/useSuiConnect.js +1 -86
- package/reactjs/hooks/useSuiConnect.mjs +52 -70
- package/reactjs/hooks/validation/index.js +1 -10
- package/reactjs/hooks/validation/index.mjs +8 -8
- package/reactjs/hooks/validation/useAmountSchema.js +1 -32
- package/reactjs/hooks/validation/useAmountSchema.mjs +8 -11
- package/reactjs/hooks/validation/useSecondAmountSchema.js +1 -26
- package/reactjs/hooks/validation/useSecondAmountSchema.mjs +5 -6
- package/reactjs/hooks/validation/useTestHasEnoughFunds.js +1 -37
- package/reactjs/hooks/validation/useTestHasEnoughFunds.mjs +20 -29
- package/reactjs/hooks/validation/useTestIsConnected.js +1 -27
- package/reactjs/hooks/validation/useTestIsConnected.mjs +13 -19
- package/reactjs/index.js +1 -190
- package/reactjs/index.mjs +154 -154
- package/reactjs/init/index.js +1 -5
- package/reactjs/init/index.mjs +3 -3
- package/reactjs/init/init.js +1 -147
- package/reactjs/init/init.mjs +57 -78
- package/reactjs/queries/index.js +1 -17
- package/reactjs/queries/index.mjs +15 -15
- package/reactjs/queries/useCheckAccount.query.js +1 -39
- package/reactjs/queries/useCheckAccount.query.mjs +29 -33
- package/reactjs/queries/useGetAllTokens.query.js +1 -35
- package/reactjs/queries/useGetAllTokens.query.mjs +26 -30
- package/reactjs/queries/useGetChains.query.js +1 -34
- package/reactjs/queries/useGetChains.query.mjs +26 -28
- package/reactjs/queries/useGetHistory.query.js +1 -69
- package/reactjs/queries/useGetHistory.query.mjs +53 -57
- package/reactjs/queries/useGetMvxTokensBalances.query.js +1 -66
- package/reactjs/queries/useGetMvxTokensBalances.query.mjs +38 -46
- package/reactjs/queries/useGetNonMvxTokensBalances.query.js +1 -81
- package/reactjs/queries/useGetNonMvxTokensBalances.query.mjs +49 -57
- package/reactjs/queries/useGetRate.mutation.js +1 -18
- package/reactjs/queries/useGetRate.mutation.mjs +12 -15
- package/reactjs/reexports.js +1 -48
- package/reactjs/reexports.mjs +13 -13
- package/reactjs/utils/delay.js +1 -6
- package/reactjs/utils/delay.mjs +3 -3
- package/reactjs/utils/formatAmount.js +1 -23
- package/reactjs/utils/formatAmount.mjs +16 -17
- package/reactjs/utils/getCleanStringAmount.js +1 -11
- package/reactjs/utils/getCleanStringAmount.mjs +6 -8
- package/reactjs/utils/getCompletePathname.js +1 -5
- package/reactjs/utils/getCompletePathname.mjs +3 -3
- package/reactjs/utils/getInitialTokens.js +1 -12
- package/reactjs/utils/getInitialTokens.mjs +6 -7
- package/reactjs/utils/hasEnoughFunds.js +1 -19
- package/reactjs/utils/hasEnoughFunds.mjs +11 -14
- package/reactjs/utils/index.js +1 -26
- package/reactjs/utils/index.mjs +24 -24
- package/reactjs/utils/isStringFloat.js +1 -21
- package/reactjs/utils/isStringFloat.mjs +11 -18
- package/reactjs/utils/mxClsx.js +1 -8
- package/reactjs/utils/mxClsx.mjs +4 -6
- package/reactjs/utils/pipe.js +1 -25
- package/reactjs/utils/pipe.mjs +13 -17
- package/reactjs/utils/removeCommas.js +1 -6
- package/reactjs/utils/removeCommas.mjs +2 -4
- package/reactjs/utils/roundAmount.js +1 -40
- package/reactjs/utils/roundAmount.mjs +16 -36
- package/reactjs/utils/testNumber.js +1 -4
- package/reactjs/utils/testNumber.mjs +2 -2
- package/store/inMemoryStore.js +1 -39
- package/store/inMemoryStore.mjs +17 -21
- package/style.css +1 -2274
- package/types/chainType.js +1 -11
- package/types/chainType.mjs +2 -9
- package/types/errors.js +1 -9
- package/types/errors.mjs +4 -5
- package/types/providerType.js +1 -9
- package/types/providerType.mjs +2 -7
- package/types/transaction.d.ts +2 -0
- package/all-networks-EJIVYZ_i.mjs +0 -4
- package/all-networks-NYACMyeN.js +0 -4
- package/default-BYtXv70Z.mjs +0 -4
- package/default-H3AbmzFV.js +0 -4
- package/react.esm-7GsOwMPq.js +0 -11815
- package/react.esm-CU-Iqz8D.mjs +0 -11796
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { formatAmount } from "@multiversx/sdk-dapp-utils/out/helpers/formatAmount";
|
|
3
|
-
import { useAppKitNetwork } from "@reown/appkit/react";
|
|
4
|
-
import
|
|
5
|
-
import { useRef, useState, useMemo, useCallback, useEffect } from "react";
|
|
6
|
-
import { toast } from "react-toastify";
|
|
7
|
-
import { useBridgeTokenSelection } from "./hooks/useBridgeTokenSelection.mjs";
|
|
8
|
-
import { MVX_CHAIN_IDS } from "../../../constants/index.mjs";
|
|
9
|
-
import { getApiURL } from "../../../helpers/getApiURL.mjs";
|
|
1
|
+
import { jsx as r, Fragment as li, jsxs as a } from "react/jsx-runtime";
|
|
2
|
+
import { formatAmount as ci } from "@multiversx/sdk-dapp-utils/out/helpers/formatAmount";
|
|
3
|
+
import { useAppKitNetwork as di } from "@reown/appkit/react";
|
|
4
|
+
import mi from "lodash/debounce";
|
|
5
|
+
import { useRef as ui, useState as C, useMemo as m, useCallback as u, useEffect as I } from "react";
|
|
6
|
+
import { toast as ue } from "react-toastify";
|
|
7
|
+
import { useBridgeTokenSelection as pi } from "./hooks/useBridgeTokenSelection.mjs";
|
|
8
|
+
import { MVX_CHAIN_IDS as pe } from "../../../constants/index.mjs";
|
|
9
|
+
import { getApiURL as hi } from "../../../helpers/getApiURL.mjs";
|
|
10
10
|
import "../../constants/index.mjs";
|
|
11
|
-
import { safeImageUrl } from "../../../helpers/safeImageUrl.mjs";
|
|
12
|
-
import { ProviderType } from "../../../types/providerType.mjs";
|
|
13
|
-
import { useWeb3App } from "../../context/useWeb3App.mjs";
|
|
14
|
-
import { sameBridgeApiChainId, toBridgeApiChainId } from "../../helpers/resolveBridgeApiChainId.mjs";
|
|
11
|
+
import { safeImageUrl as J } from "../../../helpers/safeImageUrl.mjs";
|
|
12
|
+
import { ProviderType as fi } from "../../../types/providerType.mjs";
|
|
13
|
+
import { useWeb3App as he } from "../../context/useWeb3App.mjs";
|
|
14
|
+
import { sameBridgeApiChainId as Z, toBridgeApiChainId as gi } from "../../helpers/resolveBridgeApiChainId.mjs";
|
|
15
15
|
import "yup";
|
|
16
16
|
import "@multiversx/sdk-dapp-utils/out/helpers/parseAmount";
|
|
17
17
|
import "bignumber.js";
|
|
18
|
-
import { useAccount } from "../../hooks/useAccount.mjs";
|
|
18
|
+
import { useAccount as qi } from "../../hooks/useAccount.mjs";
|
|
19
19
|
import "axios";
|
|
20
|
-
import { useBridgeFormik, BridgeFormikValuesEnum } from "../../hooks/useBridgeFormik.mjs";
|
|
21
|
-
import { useFetchBridgeData } from "../../hooks/useFetchBridgeData.mjs";
|
|
22
|
-
import { useBridgeApiChainId } from "../../hooks/useBridgeApiChainId.mjs";
|
|
20
|
+
import { useBridgeFormik as bi, BridgeFormikValuesEnum as F } from "../../hooks/useBridgeFormik.mjs";
|
|
21
|
+
import { useFetchBridgeData as vi } from "../../hooks/useFetchBridgeData.mjs";
|
|
22
|
+
import { useBridgeApiChainId as Ci } from "../../hooks/useBridgeApiChainId.mjs";
|
|
23
23
|
import "@tanstack/react-query";
|
|
24
|
-
import { useGetChainId } from "../../hooks/useGetChainId.mjs";
|
|
25
|
-
import { useSendTransactions } from "../../hooks/useSendTransactions.mjs";
|
|
24
|
+
import { useGetChainId as Ii } from "../../hooks/useGetChainId.mjs";
|
|
25
|
+
import { useSendTransactions as Bi } from "../../hooks/useSendTransactions.mjs";
|
|
26
26
|
import "@reown/appkit-adapter-solana/react";
|
|
27
27
|
import "@solana/web3.js";
|
|
28
28
|
import "wagmi";
|
|
29
29
|
import "@reown/appkit-controllers";
|
|
30
|
-
import { useInvalidateHistoryQuery } from "../../queries/useGetHistory.query.mjs";
|
|
31
|
-
import { useGetRateMutation } from "../../queries/useGetRate.mutation.mjs";
|
|
32
|
-
import { mxClsx } from "../../utils/mxClsx.mjs";
|
|
33
|
-
import { AmountCard } from "../AmountCard/AmountCard.mjs";
|
|
34
|
-
import { AmountInput } from "../AmountInput/AmountInput.mjs";
|
|
35
|
-
import { MxButton } from "../base/MxButton/MxButton.mjs";
|
|
30
|
+
import { useInvalidateHistoryQuery as Ai } from "../../queries/useGetHistory.query.mjs";
|
|
31
|
+
import { useGetRateMutation as xi } from "../../queries/useGetRate.mutation.mjs";
|
|
32
|
+
import { mxClsx as fe } from "../../utils/mxClsx.mjs";
|
|
33
|
+
import { AmountCard as ge } from "../AmountCard/AmountCard.mjs";
|
|
34
|
+
import { AmountInput as qe } from "../AmountInput/AmountInput.mjs";
|
|
35
|
+
import { MxButton as Ni } from "../base/MxButton/MxButton.mjs";
|
|
36
36
|
import "../base/MxCard/MxCard.mjs";
|
|
37
37
|
import "../base/MxLink/MxLink.mjs";
|
|
38
38
|
import "../base/MxSearch/MxSearch.mjs";
|
|
@@ -42,513 +42,400 @@ import "@headlessui/react";
|
|
|
42
42
|
import "react-dom";
|
|
43
43
|
import "react-popper";
|
|
44
44
|
import "../base/MxTooltip/components/TooltipContainer/TooltipContainer.mjs";
|
|
45
|
-
import { BridgeHistory } from "../BridgeHistory/BridgeHistory.mjs";
|
|
46
|
-
import { BridgeConnectButton } from "../Connect/BridgeConnectButton.mjs";
|
|
47
|
-
import { MvxConnectButton } from "../Connect/MvxConnectButton.mjs";
|
|
48
|
-
import { BridgeAccountDisplay } from "../Connect/BridgeAccountDisplay.mjs";
|
|
49
|
-
import { MvxAccountDisplay } from "../Connect/MvxAccountDisplay.mjs";
|
|
50
|
-
import { ToggleDirection } from "../ToggleDirection/ToggleDirection.mjs";
|
|
51
|
-
import { TokenSelector } from "../TokenSelector/TokenSelector.mjs";
|
|
52
|
-
let
|
|
53
|
-
const
|
|
54
|
-
mvxChainId,
|
|
55
|
-
mvxAddress,
|
|
56
|
-
username,
|
|
57
|
-
callbackRoute = "/",
|
|
58
|
-
firstTokenIdentifier,
|
|
59
|
-
secondTokenIdentifier,
|
|
60
|
-
firstTokenAmount,
|
|
61
|
-
secondTokenAmount,
|
|
62
|
-
refetchTrigger,
|
|
63
|
-
showHistory,
|
|
64
|
-
forcedDestinationTokenSymbol,
|
|
65
|
-
onSuccessfullySentTransaction,
|
|
66
|
-
onFailedSentTransaction,
|
|
67
|
-
onHistoryClose,
|
|
68
|
-
onMvxConnect,
|
|
69
|
-
onMvxDisconnect,
|
|
70
|
-
onNavigate,
|
|
71
|
-
onChangeDirection
|
|
45
|
+
import { BridgeHistory as wi } from "../BridgeHistory/BridgeHistory.mjs";
|
|
46
|
+
import { BridgeConnectButton as yi } from "../Connect/BridgeConnectButton.mjs";
|
|
47
|
+
import { MvxConnectButton as Di } from "../Connect/MvxConnectButton.mjs";
|
|
48
|
+
import { BridgeAccountDisplay as Oi } from "../Connect/BridgeAccountDisplay.mjs";
|
|
49
|
+
import { MvxAccountDisplay as Mi } from "../Connect/MvxAccountDisplay.mjs";
|
|
50
|
+
import { ToggleDirection as Ei } from "../ToggleDirection/ToggleDirection.mjs";
|
|
51
|
+
import { TokenSelector as be } from "../TokenSelector/TokenSelector.mjs";
|
|
52
|
+
let U;
|
|
53
|
+
const Ot = ({
|
|
54
|
+
mvxChainId: D,
|
|
55
|
+
mvxAddress: o,
|
|
56
|
+
username: ve,
|
|
57
|
+
callbackRoute: Ce = "/",
|
|
58
|
+
firstTokenIdentifier: Ie,
|
|
59
|
+
secondTokenIdentifier: Be,
|
|
60
|
+
firstTokenAmount: O,
|
|
61
|
+
secondTokenAmount: B,
|
|
62
|
+
refetchTrigger: Ae,
|
|
63
|
+
showHistory: xe,
|
|
64
|
+
forcedDestinationTokenSymbol: Ne,
|
|
65
|
+
onSuccessfullySentTransaction: p,
|
|
66
|
+
onFailedSentTransaction: f,
|
|
67
|
+
onHistoryClose: M,
|
|
68
|
+
onMvxConnect: S,
|
|
69
|
+
onMvxDisconnect: we,
|
|
70
|
+
onNavigate: ye,
|
|
71
|
+
onChangeDirection: De
|
|
72
72
|
}) => {
|
|
73
|
-
var
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
} =
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
mvxAddress,
|
|
107
|
-
mvxApiURL: options.mvxApiURL
|
|
108
|
-
});
|
|
109
|
-
const isTokensLoading = tokensLoading || isLoadingEvmTokensBalances || isLoadingMvxTokensBalances || isChainsLoading;
|
|
110
|
-
const activeChain = useMemo(() => {
|
|
111
|
-
return sdkChains.find((chain) => sameBridgeApiChainId(chain.id, chainId));
|
|
112
|
-
}, [chainId, sdkChains]);
|
|
113
|
-
const mvxChain = useMemo(() => {
|
|
114
|
-
return chains.find(
|
|
115
|
-
(chain) => chain.chainId.toString() === mvxChainId.toString()
|
|
116
|
-
);
|
|
117
|
-
}, [chainId, chains]);
|
|
118
|
-
const {
|
|
119
|
-
mutate: getRate,
|
|
120
|
-
data: rate,
|
|
121
|
-
isPending: isPendingRate,
|
|
122
|
-
error: rateError
|
|
123
|
-
} = useGetRateMutation();
|
|
124
|
-
const rateValidationError = ((_a = rateError == null ? void 0 : rateError.response) == null ? void 0 : _a.status) === 400 ? (_b = rateError == null ? void 0 : rateError.response) == null ? void 0 : _b.data.message : void 0;
|
|
125
|
-
const handleSwitchNetwork = useCallback(
|
|
126
|
-
(chain) => {
|
|
127
|
-
const sdkChain = sdkChains.find(
|
|
128
|
-
(c) => sameBridgeApiChainId(c.id, chain.id)
|
|
73
|
+
var de, me;
|
|
74
|
+
const Oe = ui(null), [j, Me] = C(!1), [Ee, Re] = C(1), [k, T] = C(0), [ee, ie] = C([]), s = qi(), { switchNetwork: te } = di(), re = Ai(), {
|
|
75
|
+
options: ne,
|
|
76
|
+
supportedChains: A,
|
|
77
|
+
nativeAuthToken: P,
|
|
78
|
+
bridgeOnly: Ve
|
|
79
|
+
} = he(), W = Ii(), oe = Ci(), ae = Bi(), {
|
|
80
|
+
signMvxTransactions: G,
|
|
81
|
+
resetMvxTransactionHash: Q,
|
|
82
|
+
latestMvxTransactionHash: _
|
|
83
|
+
} = he(), {
|
|
84
|
+
evmTokensWithBalances: Le,
|
|
85
|
+
mvxTokensWithBalances: Fe,
|
|
86
|
+
isTokensLoading: Ue,
|
|
87
|
+
isLoadingEvmTokensBalances: je,
|
|
88
|
+
isLoadingMvxTokensBalances: ke,
|
|
89
|
+
chains: x = [],
|
|
90
|
+
isChainsLoading: Pe
|
|
91
|
+
} = vi({
|
|
92
|
+
refetchTrigger: Ae,
|
|
93
|
+
mvxAddress: o,
|
|
94
|
+
mvxApiURL: ne.mvxApiURL
|
|
95
|
+
}), $ = Ue || je || ke || Pe, We = m(() => A.find((e) => Z(e.id, W)), [W, A]), g = m(() => x.find(
|
|
96
|
+
(e) => e.chainId.toString() === D.toString()
|
|
97
|
+
), [W, x]), {
|
|
98
|
+
mutate: Ge,
|
|
99
|
+
data: n,
|
|
100
|
+
isPending: N,
|
|
101
|
+
error: q
|
|
102
|
+
} = xi(), w = ((de = q == null ? void 0 : q.response) == null ? void 0 : de.status) === 400 ? (me = q == null ? void 0 : q.response) == null ? void 0 : me.data.message : void 0, Qe = u(
|
|
103
|
+
(e) => {
|
|
104
|
+
const v = A.find(
|
|
105
|
+
(si) => Z(si.id, e.id)
|
|
129
106
|
);
|
|
130
|
-
|
|
131
|
-
switchNetwork(sdkChain);
|
|
132
|
-
}
|
|
107
|
+
v && te(v);
|
|
133
108
|
},
|
|
134
|
-
[
|
|
135
|
-
)
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
const isSecondTokenMvx = useMemo(() => {
|
|
170
|
-
return secondToken ? MVX_CHAIN_IDS.includes(secondToken.chainId.toString()) : false;
|
|
171
|
-
}, [secondToken == null ? void 0 : secondToken.chainId]);
|
|
172
|
-
const secondTokenChain = useMemo(() => {
|
|
173
|
-
if (!secondToken) {
|
|
174
|
-
return selectedChainOption;
|
|
175
|
-
}
|
|
176
|
-
return chains.find(
|
|
177
|
-
(chain) => sameBridgeApiChainId(chain.chainId, secondToken.chainId)
|
|
178
|
-
) ?? selectedChainOption;
|
|
179
|
-
}, [secondToken == null ? void 0 : secondToken.chainId, chains, selectedChainOption]);
|
|
180
|
-
const bridgeToChainId = useMemo(
|
|
181
|
-
() => toBridgeApiChainId(secondToken == null ? void 0 : secondToken.chainId) ?? bridgeApiChainId,
|
|
182
|
-
[secondToken == null ? void 0 : secondToken.chainId, bridgeApiChainId]
|
|
183
|
-
);
|
|
184
|
-
const bridgeAddress = account.address;
|
|
185
|
-
const isAuthenticated = account.isConnected && Boolean(bridgeAddress);
|
|
186
|
-
const hasAmounts = firstAmount !== "" && secondAmount !== "";
|
|
187
|
-
const fetchRateDebounced = useCallback(
|
|
188
|
-
debounce(async (amount) => {
|
|
189
|
-
if (!amount || !Number(amount) || !account.address || !(firstToken == null ? void 0 : firstToken.address) || !(secondToken == null ? void 0 : secondToken.address) || !selectedChainOption || !bridgeToChainId) {
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
getRate({
|
|
193
|
-
nativeAuthToken: nativeAuthToken ?? "",
|
|
109
|
+
[A, te]
|
|
110
|
+
), {
|
|
111
|
+
firstToken: i,
|
|
112
|
+
secondToken: t,
|
|
113
|
+
fromOptions: _e,
|
|
114
|
+
toOptions: $e,
|
|
115
|
+
selectedChainOption: y,
|
|
116
|
+
onChangeFirstSelect: ze,
|
|
117
|
+
onChangeSecondSelect: He,
|
|
118
|
+
handleChangeDirection: Ke
|
|
119
|
+
} = pi({
|
|
120
|
+
chains: x,
|
|
121
|
+
activeChain: We,
|
|
122
|
+
sdkChains: A,
|
|
123
|
+
switchNetwork: Qe,
|
|
124
|
+
fromTokens: Fe,
|
|
125
|
+
toTokens: Le,
|
|
126
|
+
firstTokenIdentifier: Ie,
|
|
127
|
+
secondTokenIdentifier: Be,
|
|
128
|
+
forcedDestinationTokenSymbol: Ne,
|
|
129
|
+
isTokensLoading: $,
|
|
130
|
+
mvxChainId: D,
|
|
131
|
+
callbackRoute: Ce,
|
|
132
|
+
onNavigate: ye
|
|
133
|
+
}), Xe = () => {
|
|
134
|
+
Ke(), De();
|
|
135
|
+
}, [l, Ye] = C(O ?? ""), [E, R] = C(B ?? ""), Je = m(() => i ? pe.includes(i.chainId.toString()) : !1, [i == null ? void 0 : i.chainId]), Ze = m(() => t ? pe.includes(t.chainId.toString()) : !1, [t == null ? void 0 : t.chainId]), c = m(() => t ? x.find(
|
|
136
|
+
(e) => Z(e.chainId, t.chainId)
|
|
137
|
+
) ?? y : y, [t == null ? void 0 : t.chainId, x, y]), V = m(
|
|
138
|
+
() => gi(t == null ? void 0 : t.chainId) ?? oe,
|
|
139
|
+
[t == null ? void 0 : t.chainId, oe]
|
|
140
|
+
), se = s.address, le = s.isConnected && !!se, z = l !== "" && E !== "", H = u(
|
|
141
|
+
mi(async (e) => {
|
|
142
|
+
!e || !Number(e) || !s.address || !(i != null && i.address) || !(t != null && t.address) || !y || !V || Ge({
|
|
143
|
+
nativeAuthToken: P ?? "",
|
|
194
144
|
body: {
|
|
195
|
-
tokenIn:
|
|
196
|
-
amountIn:
|
|
197
|
-
fromChainId:
|
|
198
|
-
tokenOut:
|
|
199
|
-
toChainId:
|
|
145
|
+
tokenIn: i.address,
|
|
146
|
+
amountIn: e,
|
|
147
|
+
fromChainId: D,
|
|
148
|
+
tokenOut: t.address,
|
|
149
|
+
toChainId: V
|
|
200
150
|
}
|
|
201
151
|
});
|
|
202
152
|
}, 500),
|
|
203
153
|
[
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
154
|
+
s.address,
|
|
155
|
+
V,
|
|
156
|
+
i == null ? void 0 : i.address,
|
|
157
|
+
t == null ? void 0 : t.address,
|
|
158
|
+
y
|
|
209
159
|
]
|
|
210
|
-
)
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
}, [])
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
const formattedBalance = formatAmount({
|
|
222
|
-
decimals: firstToken == null ? void 0 : firstToken.decimals,
|
|
223
|
-
input: (firstToken == null ? void 0 : firstToken.balance) ?? "0",
|
|
224
|
-
addCommas: false,
|
|
160
|
+
), d = u((e) => {
|
|
161
|
+
Ye(() => e);
|
|
162
|
+
}, []), b = u((e) => {
|
|
163
|
+
R(() => e);
|
|
164
|
+
}, []), Se = u(() => {
|
|
165
|
+
M == null || M();
|
|
166
|
+
}, [M]), Te = u(() => {
|
|
167
|
+
const e = ci({
|
|
168
|
+
decimals: i == null ? void 0 : i.decimals,
|
|
169
|
+
input: (i == null ? void 0 : i.balance) ?? "0",
|
|
170
|
+
addCommas: !1,
|
|
225
171
|
digits: 4
|
|
226
172
|
});
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
async (txHashes) => {
|
|
232
|
-
handleOnChangeFirstAmount("");
|
|
233
|
-
handleOnChangeSecondAmount("");
|
|
234
|
-
invalidateHistoryQuery();
|
|
235
|
-
invalidateHistoryQuery();
|
|
236
|
-
onSuccessfullySentTransaction == null ? void 0 : onSuccessfullySentTransaction(txHashes);
|
|
173
|
+
h.setFieldValue("firstAmount", e), d(e);
|
|
174
|
+
}, [i == null ? void 0 : i.balance, i == null ? void 0 : i.decimals, d]), ei = u(
|
|
175
|
+
async (e) => {
|
|
176
|
+
d(""), b(""), re(), re(), p == null || p(e);
|
|
237
177
|
},
|
|
238
178
|
[
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
179
|
+
d,
|
|
180
|
+
b,
|
|
181
|
+
p
|
|
242
182
|
]
|
|
243
|
-
)
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
setSigningTransactionsCount(() => transactions.length);
|
|
183
|
+
), ii = u(
|
|
184
|
+
async ({ transactions: e }) => {
|
|
185
|
+
T(() => e.length);
|
|
247
186
|
try {
|
|
248
|
-
if (!
|
|
187
|
+
if (!G)
|
|
249
188
|
throw new Error("signMvxTransactions function is not provided");
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
} catch (e) {
|
|
254
|
-
console.error(e);
|
|
255
|
-
toast.dismiss();
|
|
256
|
-
toast.error("Transaction cancelled");
|
|
257
|
-
onFailedSentTransaction == null ? void 0 : onFailedSentTransaction("Transaction cancelled");
|
|
258
|
-
setSigningTransactionsCount(0);
|
|
259
|
-
resetSwapForm();
|
|
260
|
-
handleOnChangeFirstAmount("");
|
|
261
|
-
handleOnChangeSecondAmount("");
|
|
189
|
+
await G(e), ie(e);
|
|
190
|
+
} catch (v) {
|
|
191
|
+
console.error(v), ue.dismiss(), ue.error("Transaction cancelled"), f == null || f("Transaction cancelled"), T(0), ri(), d(""), b("");
|
|
262
192
|
}
|
|
263
193
|
},
|
|
264
194
|
[
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
195
|
+
se,
|
|
196
|
+
d,
|
|
197
|
+
b,
|
|
198
|
+
P,
|
|
199
|
+
ei,
|
|
200
|
+
G
|
|
271
201
|
]
|
|
272
|
-
)
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
}, [
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
fetchRateInterval = setInterval(() => {
|
|
314
|
-
fetchRateDebounced(firstAmount);
|
|
315
|
-
}, 50 * 1e3);
|
|
316
|
-
return () => clearInterval(fetchRateInterval);
|
|
317
|
-
}, [firstAmount, forceRefetchRate, fetchRateDebounced]);
|
|
318
|
-
useEffect(() => {
|
|
319
|
-
if (!(rate == null ? void 0 : rate.amountOut)) {
|
|
320
|
-
return;
|
|
321
|
-
}
|
|
322
|
-
formik.setFieldValue(BridgeFormikValuesEnum.secondAmount, rate.amountOut);
|
|
323
|
-
setSecondAmount(rate.amountOut);
|
|
324
|
-
}, [rate == null ? void 0 : rate.amountOut]);
|
|
325
|
-
useEffect(() => {
|
|
326
|
-
if (rateValidationError) {
|
|
327
|
-
formik.setFieldValue(BridgeFormikValuesEnum.secondAmount, "0");
|
|
328
|
-
setSecondAmount("0");
|
|
329
|
-
}
|
|
330
|
-
}, [rateValidationError]);
|
|
331
|
-
useEffect(() => {
|
|
332
|
-
if (firstTokenAmount) {
|
|
333
|
-
formik.setFieldValue(
|
|
334
|
-
BridgeFormikValuesEnum.firstAmount,
|
|
335
|
-
firstTokenAmount
|
|
336
|
-
);
|
|
337
|
-
handleOnChangeFirstAmount(firstTokenAmount);
|
|
338
|
-
}
|
|
339
|
-
}, []);
|
|
340
|
-
useEffect(() => {
|
|
341
|
-
if (secondTokenAmount) {
|
|
342
|
-
formik.setFieldValue(
|
|
343
|
-
BridgeFormikValuesEnum.secondAmount,
|
|
344
|
-
secondTokenAmount
|
|
345
|
-
);
|
|
346
|
-
handleOnChangeSecondAmount(secondTokenAmount);
|
|
347
|
-
}
|
|
348
|
-
}, [secondTokenAmount]);
|
|
349
|
-
useEffect(() => {
|
|
350
|
-
if (latestMvxTransactionHash) {
|
|
202
|
+
), {
|
|
203
|
+
formik: h,
|
|
204
|
+
firstAmountError: K,
|
|
205
|
+
secondAmountError: X,
|
|
206
|
+
fromChainError: Y,
|
|
207
|
+
handleBlur: L,
|
|
208
|
+
handleChange: ce,
|
|
209
|
+
handleSubmit: ti,
|
|
210
|
+
resetSwapForm: ri
|
|
211
|
+
} = bi({
|
|
212
|
+
isMvxConnected: !!o,
|
|
213
|
+
rate: n,
|
|
214
|
+
sender: o ?? "",
|
|
215
|
+
receiver: s.address ?? "",
|
|
216
|
+
firstToken: i,
|
|
217
|
+
firstAmount: l,
|
|
218
|
+
fromChainId: D,
|
|
219
|
+
toChainId: V,
|
|
220
|
+
secondToken: t,
|
|
221
|
+
secondAmount: E,
|
|
222
|
+
setForceRefetchRate: Re,
|
|
223
|
+
onSubmit: ii
|
|
224
|
+
}), ni = !!(K || X || Y || w), oi = m(() => l !== "" ? w ?? K : void 0, [K, l, w]), ai = m(() => E !== "" ? Y ?? X : void 0, [Y, X, E]);
|
|
225
|
+
return I(() => (l || R(""), H(l), U && clearInterval(U), U = setInterval(() => {
|
|
226
|
+
H(l);
|
|
227
|
+
}, 50 * 1e3), () => clearInterval(U)), [l, Ee, H]), I(() => {
|
|
228
|
+
n != null && n.amountOut && (h.setFieldValue(F.secondAmount, n.amountOut), R(n.amountOut));
|
|
229
|
+
}, [n == null ? void 0 : n.amountOut]), I(() => {
|
|
230
|
+
w && (h.setFieldValue(F.secondAmount, "0"), R("0"));
|
|
231
|
+
}, [w]), I(() => {
|
|
232
|
+
O && (h.setFieldValue(
|
|
233
|
+
F.firstAmount,
|
|
234
|
+
O
|
|
235
|
+
), d(O));
|
|
236
|
+
}, []), I(() => {
|
|
237
|
+
B && (h.setFieldValue(
|
|
238
|
+
F.secondAmount,
|
|
239
|
+
B
|
|
240
|
+
), b(B));
|
|
241
|
+
}, [B]), I(() => {
|
|
242
|
+
if (_)
|
|
351
243
|
try {
|
|
352
|
-
const
|
|
353
|
-
|
|
354
|
-
transactions:
|
|
355
|
-
...
|
|
356
|
-
txHash,
|
|
357
|
-
receiver:
|
|
244
|
+
const e = _;
|
|
245
|
+
ae({
|
|
246
|
+
transactions: ee.map((v) => ({
|
|
247
|
+
...v,
|
|
248
|
+
txHash: e,
|
|
249
|
+
receiver: s.address
|
|
358
250
|
})),
|
|
359
|
-
provider: (
|
|
360
|
-
url:
|
|
361
|
-
token:
|
|
362
|
-
});
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
console.error("Error while sending transactions:", err);
|
|
366
|
-
onFailedSentTransaction == null ? void 0 : onFailedSentTransaction(
|
|
251
|
+
provider: (n == null ? void 0 : n.provider) ?? fi.None,
|
|
252
|
+
url: hi() ?? "",
|
|
253
|
+
token: P ?? ""
|
|
254
|
+
}), p == null || p([e]);
|
|
255
|
+
} catch (e) {
|
|
256
|
+
console.error("Error while sending transactions:", e), f == null || f(
|
|
367
257
|
"An error occurred while sending the transaction"
|
|
368
258
|
);
|
|
369
259
|
return;
|
|
370
260
|
} finally {
|
|
371
|
-
|
|
372
|
-
setLatestTransactions([]);
|
|
261
|
+
Q == null || Q(), ie([]);
|
|
373
262
|
}
|
|
374
|
-
}
|
|
375
263
|
}, [
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
])
|
|
381
|
-
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
|
|
264
|
+
_,
|
|
265
|
+
ee,
|
|
266
|
+
n == null ? void 0 : n.provider,
|
|
267
|
+
ae
|
|
268
|
+
]), /* @__PURE__ */ r(li, { children: /* @__PURE__ */ a(
|
|
382
269
|
"form",
|
|
383
270
|
{
|
|
384
|
-
ref,
|
|
385
|
-
noValidate:
|
|
271
|
+
ref: Oe,
|
|
272
|
+
noValidate: !0,
|
|
386
273
|
className: "liq-flex liq-flex-col liq-gap-1 liq-relative",
|
|
387
274
|
autoComplete: "off",
|
|
388
|
-
onSubmit:
|
|
275
|
+
onSubmit: ti,
|
|
389
276
|
children: [
|
|
390
|
-
|
|
391
|
-
/* @__PURE__ */
|
|
392
|
-
|
|
277
|
+
xe && /* @__PURE__ */ r(wi, { mvxAddress: o, onClose: Se }),
|
|
278
|
+
/* @__PURE__ */ a(
|
|
279
|
+
ge,
|
|
393
280
|
{
|
|
394
|
-
className:
|
|
281
|
+
className: fe(
|
|
395
282
|
"liq-pb-8 liq-pt-6 hover:liq-bg-neutral-700/50 sm:liq-pb-6",
|
|
396
283
|
{
|
|
397
|
-
"liq-pointer-events-none":
|
|
398
|
-
"focus-within:liq-outline-neutral-700/75 hover:liq-outline-neutral-700/55 hover:focus-within:liq-outline-neutral-700/80": !
|
|
284
|
+
"liq-pointer-events-none": j,
|
|
285
|
+
"focus-within:liq-outline-neutral-700/75 hover:liq-outline-neutral-700/55 hover:focus-within:liq-outline-neutral-700/80": !j
|
|
399
286
|
}
|
|
400
287
|
),
|
|
401
288
|
children: [
|
|
402
|
-
/* @__PURE__ */
|
|
403
|
-
/* @__PURE__ */
|
|
404
|
-
/* @__PURE__ */
|
|
405
|
-
|
|
289
|
+
/* @__PURE__ */ a("div", { className: "liq-flex liq-items-center liq-gap-1", children: [
|
|
290
|
+
/* @__PURE__ */ r("span", { children: "From" }),
|
|
291
|
+
/* @__PURE__ */ r(
|
|
292
|
+
Mi,
|
|
406
293
|
{
|
|
407
|
-
accountAddress:
|
|
408
|
-
chainIcon:
|
|
409
|
-
username,
|
|
410
|
-
accountExplorerUrl: `${
|
|
411
|
-
showTag:
|
|
412
|
-
onDisconnect:
|
|
413
|
-
onConnect:
|
|
294
|
+
accountAddress: o,
|
|
295
|
+
chainIcon: J(g == null ? void 0 : g.pngUrl),
|
|
296
|
+
username: ve,
|
|
297
|
+
accountExplorerUrl: `${ne.mvxExplorerAddress}/accounts/${o}`,
|
|
298
|
+
showTag: !0,
|
|
299
|
+
onDisconnect: we,
|
|
300
|
+
onConnect: S
|
|
414
301
|
}
|
|
415
302
|
)
|
|
416
303
|
] }),
|
|
417
|
-
/* @__PURE__ */
|
|
418
|
-
/* @__PURE__ */
|
|
419
|
-
|
|
304
|
+
/* @__PURE__ */ a("div", { className: "liq-flex liq-justify-between liq-gap-1", children: [
|
|
305
|
+
/* @__PURE__ */ r(
|
|
306
|
+
qe,
|
|
420
307
|
{
|
|
421
308
|
inputName: "firstAmount",
|
|
422
|
-
inputValue:
|
|
423
|
-
amountError:
|
|
424
|
-
disabled:
|
|
425
|
-
onInputDebounceChange:
|
|
426
|
-
onInputChange:
|
|
427
|
-
onBlur:
|
|
309
|
+
inputValue: h.values.firstAmount,
|
|
310
|
+
amountError: oi,
|
|
311
|
+
disabled: !1,
|
|
312
|
+
onInputDebounceChange: d,
|
|
313
|
+
onInputChange: ce,
|
|
314
|
+
onBlur: L
|
|
428
315
|
}
|
|
429
316
|
),
|
|
430
|
-
/* @__PURE__ */
|
|
431
|
-
|
|
317
|
+
/* @__PURE__ */ r(
|
|
318
|
+
be,
|
|
432
319
|
{
|
|
433
320
|
name: "firstToken",
|
|
434
|
-
disabled:
|
|
435
|
-
options:
|
|
436
|
-
areOptionsLoading:
|
|
437
|
-
isMvxSelector:
|
|
438
|
-
isDestination:
|
|
321
|
+
disabled: N,
|
|
322
|
+
options: _e,
|
|
323
|
+
areOptionsLoading: $,
|
|
324
|
+
isMvxSelector: Je,
|
|
325
|
+
isDestination: !1,
|
|
439
326
|
color: "neutral-850",
|
|
440
|
-
onChange:
|
|
441
|
-
onBlur:
|
|
442
|
-
onMaxBtnClick:
|
|
443
|
-
selectedOption:
|
|
444
|
-
onTokenSelectorDisplay: (
|
|
327
|
+
onChange: ze,
|
|
328
|
+
onBlur: L,
|
|
329
|
+
onMaxBtnClick: Te,
|
|
330
|
+
selectedOption: i,
|
|
331
|
+
onTokenSelectorDisplay: (e) => Me(e)
|
|
445
332
|
}
|
|
446
333
|
)
|
|
447
334
|
] })
|
|
448
335
|
]
|
|
449
336
|
}
|
|
450
337
|
),
|
|
451
|
-
/* @__PURE__ */
|
|
452
|
-
/* @__PURE__ */
|
|
453
|
-
|
|
338
|
+
/* @__PURE__ */ r("div", { className: "liq-absolute liq-left-[6%] liq-top-[40%] -liq-mt-1 liq-z-10", children: Ve && /* @__PURE__ */ r(Ei, { onChangeDirection: Xe }) }),
|
|
339
|
+
/* @__PURE__ */ a(
|
|
340
|
+
ge,
|
|
454
341
|
{
|
|
455
|
-
className:
|
|
342
|
+
className: fe(
|
|
456
343
|
"liq-pb-8 liq-pt-6 hover:liq-bg-neutral-700/50 sm:liq-pb-6",
|
|
457
344
|
{
|
|
458
|
-
"liq-pointer-events-none":
|
|
345
|
+
"liq-pointer-events-none": j
|
|
459
346
|
}
|
|
460
347
|
),
|
|
461
348
|
children: [
|
|
462
|
-
/* @__PURE__ */
|
|
463
|
-
/* @__PURE__ */
|
|
464
|
-
/* @__PURE__ */
|
|
465
|
-
|
|
349
|
+
/* @__PURE__ */ a("div", { className: "liq-flex liq-items-center liq-gap-1", children: [
|
|
350
|
+
/* @__PURE__ */ r("span", { children: "To" }),
|
|
351
|
+
/* @__PURE__ */ r(
|
|
352
|
+
Oi,
|
|
466
353
|
{
|
|
467
|
-
disabled:
|
|
468
|
-
activeChain:
|
|
354
|
+
disabled: N,
|
|
355
|
+
activeChain: c
|
|
469
356
|
}
|
|
470
357
|
)
|
|
471
358
|
] }),
|
|
472
|
-
/* @__PURE__ */
|
|
473
|
-
/* @__PURE__ */
|
|
474
|
-
|
|
359
|
+
/* @__PURE__ */ a("div", { className: "liq-flex liq-justify-between liq-gap-1", children: [
|
|
360
|
+
/* @__PURE__ */ r(
|
|
361
|
+
qe,
|
|
475
362
|
{
|
|
476
363
|
inputName: "secondAmount",
|
|
477
|
-
inputValue:
|
|
478
|
-
amountError:
|
|
479
|
-
disabled:
|
|
480
|
-
onInputDebounceChange:
|
|
481
|
-
onInputChange:
|
|
482
|
-
onBlur:
|
|
364
|
+
inputValue: h.values.secondAmount,
|
|
365
|
+
amountError: ai,
|
|
366
|
+
disabled: !1,
|
|
367
|
+
onInputDebounceChange: b,
|
|
368
|
+
onInputChange: ce,
|
|
369
|
+
onBlur: L
|
|
483
370
|
}
|
|
484
371
|
),
|
|
485
|
-
/* @__PURE__ */
|
|
486
|
-
|
|
372
|
+
/* @__PURE__ */ r(
|
|
373
|
+
be,
|
|
487
374
|
{
|
|
488
375
|
name: "secondToken",
|
|
489
|
-
disabled:
|
|
490
|
-
omitDisableClass:
|
|
491
|
-
options:
|
|
492
|
-
areOptionsLoading:
|
|
493
|
-
isMvxSelector:
|
|
376
|
+
disabled: N,
|
|
377
|
+
omitDisableClass: !0,
|
|
378
|
+
options: $e,
|
|
379
|
+
areOptionsLoading: $,
|
|
380
|
+
isMvxSelector: Ze,
|
|
494
381
|
color: "neutral-850",
|
|
495
|
-
onChange:
|
|
496
|
-
onBlur:
|
|
497
|
-
selectedOption:
|
|
382
|
+
onChange: He,
|
|
383
|
+
onBlur: L,
|
|
384
|
+
selectedOption: t
|
|
498
385
|
}
|
|
499
386
|
)
|
|
500
387
|
] })
|
|
501
388
|
]
|
|
502
389
|
}
|
|
503
390
|
),
|
|
504
|
-
/* @__PURE__ */
|
|
505
|
-
!
|
|
506
|
-
|
|
391
|
+
/* @__PURE__ */ a("div", { className: "liq-flex liq-items-center liq-justify-center", children: [
|
|
392
|
+
!o && /* @__PURE__ */ r(
|
|
393
|
+
Di,
|
|
507
394
|
{
|
|
508
|
-
mvxAccountAddress:
|
|
509
|
-
icon:
|
|
510
|
-
onClick:
|
|
395
|
+
mvxAccountAddress: o,
|
|
396
|
+
icon: J(g == null ? void 0 : g.pngUrl),
|
|
397
|
+
onClick: S
|
|
511
398
|
}
|
|
512
399
|
),
|
|
513
|
-
|
|
514
|
-
|
|
400
|
+
o && !le && /* @__PURE__ */ r(
|
|
401
|
+
yi,
|
|
515
402
|
{
|
|
516
403
|
className: "liq-w-full liq-rounded-xl liq-bg-neutral-850/50 liq-px-8 liq-py-3 liq-font-semibold liq-text-primary-200 liq-transition-colors liq-duration-200 hover:enabled:liq-bg-primary-700/80 disabled:liq-opacity-50",
|
|
517
|
-
disabled:
|
|
518
|
-
activeChain:
|
|
404
|
+
disabled: N,
|
|
405
|
+
activeChain: c
|
|
519
406
|
}
|
|
520
407
|
),
|
|
521
|
-
|
|
522
|
-
|
|
408
|
+
o && le && /* @__PURE__ */ a(
|
|
409
|
+
Ni,
|
|
523
410
|
{
|
|
524
411
|
"data-testid": "submit-button",
|
|
525
412
|
type: "submit",
|
|
526
413
|
variant: "neutral-850",
|
|
527
414
|
className: "liq-w-full disabled:liq-bg-neutral-850/50 liq-py-3 hover:enabled:liq-bg-primary !liq-text-primary-200",
|
|
528
|
-
disabled: !
|
|
415
|
+
disabled: !z || N || !o || !s.address || ni,
|
|
529
416
|
children: [
|
|
530
|
-
|
|
531
|
-
/* @__PURE__ */
|
|
532
|
-
/* @__PURE__ */
|
|
417
|
+
z && /* @__PURE__ */ a("div", { className: "liq-flex liq-justify-center liq-items-center liq-gap-2", children: [
|
|
418
|
+
/* @__PURE__ */ r("div", { children: "Transfer to " }),
|
|
419
|
+
/* @__PURE__ */ r(
|
|
533
420
|
"img",
|
|
534
421
|
{
|
|
535
|
-
src:
|
|
422
|
+
src: J(c == null ? void 0 : c.pngUrl),
|
|
536
423
|
alt: "",
|
|
537
424
|
className: "liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg"
|
|
538
425
|
}
|
|
539
426
|
),
|
|
540
|
-
/* @__PURE__ */
|
|
427
|
+
/* @__PURE__ */ r("div", { children: c == null ? void 0 : c.networkName })
|
|
541
428
|
] }),
|
|
542
|
-
!
|
|
429
|
+
!z && /* @__PURE__ */ r("span", { className: "liq-text-neutral-100", children: "Enter amount" })
|
|
543
430
|
]
|
|
544
431
|
}
|
|
545
432
|
)
|
|
546
433
|
] }),
|
|
547
|
-
|
|
434
|
+
s.address && k > 0 && /* @__PURE__ */ r("div", { className: "liq-flex liq-items-center liq-justify-center liq-text-neutral-300 liq-text-sm", children: /* @__PURE__ */ a("div", { children: [
|
|
548
435
|
"You will be asked to sign ",
|
|
549
|
-
|
|
436
|
+
k,
|
|
550
437
|
" ",
|
|
551
|
-
|
|
438
|
+
k > 1 ? "transactions" : "transaction",
|
|
552
439
|
" ",
|
|
553
440
|
"on your wallet"
|
|
554
441
|
] }) })
|
|
@@ -557,5 +444,5 @@ const Transfer = ({
|
|
|
557
444
|
) });
|
|
558
445
|
};
|
|
559
446
|
export {
|
|
560
|
-
Transfer
|
|
447
|
+
Ot as Transfer
|
|
561
448
|
};
|