@multiversx/sdk-dapp-liquidity 2.3.0 → 2.4.0-alpha.0
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/BridgeHistory-BU-L_w0l.js +2 -0
- package/BridgeHistory-CInRkJ6T.mjs +275 -0
- package/ToggleDirection-BLDXxUlN.mjs +16 -0
- package/ToggleDirection-CZ9-ZD7Y.js +2 -0
- package/all-networks-De_MBUh1.js +2 -0
- package/all-networks-hdZt5Hcc.mjs +4 -0
- package/api/checkAccount.d.ts +1 -2
- package/api/checkAccount.js +1 -1
- package/api/checkAccount.mjs +10 -20
- package/api/confirmRate.d.ts +2 -3
- package/api/confirmRate.js +1 -1
- package/api/confirmRate.mjs +16 -23
- package/api/getChains.d.ts +1 -2
- package/api/getChains.js +1 -1
- package/api/getChains.mjs +10 -16
- package/api/getRate.d.ts +1 -2
- package/api/getRate.js +1 -1
- package/api/getRate.mjs +16 -23
- package/api/getTokens.d.ts +1 -2
- package/api/getTokens.js +1 -1
- package/api/getTokens.mjs +10 -20
- package/api/getTokensBalances.d.ts +1 -2
- package/api/getTokensBalances.js +1 -1
- package/api/getTokensBalances.mjs +10 -20
- package/api/getTransactions.d.ts +2 -3
- package/api/getTransactions.js +1 -1
- package/api/getTransactions.mjs +19 -31
- package/api/index.js +1 -1
- package/api/index.mjs +9 -18
- package/api/sendTransactions.d.ts +3 -4
- package/api/sendTransactions.js +1 -1
- package/api/sendTransactions.mjs +19 -31
- package/api/tests/confirmRate.spec.js +1 -1
- package/api/tests/confirmRate.spec.mjs +98 -112
- package/api/tests/getChains.spec.js +1 -1
- package/api/tests/getChains.spec.mjs +38 -36
- package/api/tests/getRate.spec.js +1 -1
- package/api/tests/getRate.spec.mjs +73 -69
- package/api/tests/getTokens.spec.js +1 -1
- package/api/tests/getTokens.spec.mjs +58 -58
- package/api/tests/getTransactions.spec.js +1 -1
- package/api/tests/getTransactions.spec.mjs +84 -74
- package/api/tests/sendTransactions.spec.js +1 -1
- package/api/tests/sendTransactions.spec.mjs +74 -84
- package/chains-Bmeag21l.js +2 -0
- package/chains-DQACurVn.mjs +33 -0
- package/chunk-oiTVcehM.js +2 -0
- package/constants/index.js +1 -1
- package/constants/index.mjs +8 -4
- package/default-CqGeN438.js +2 -0
- package/default-DuNFRYAj.mjs +4 -0
- package/dto/Chain.dto.d.ts +0 -1
- package/dto/Chain.dto.js +0 -1
- package/dto/Chain.dto.mjs +0 -1
- package/dto/CheckAccount.dto.js +0 -1
- package/dto/CheckAccount.dto.mjs +0 -1
- package/dto/ConfirmRate.dto.d.ts +0 -1
- package/dto/ConfirmRate.dto.js +0 -1
- package/dto/ConfirmRate.dto.mjs +0 -1
- package/dto/Token.dto.js +0 -1
- package/dto/Token.dto.mjs +0 -1
- package/dto/TokenBalance.dto.js +0 -1
- package/dto/TokenBalance.dto.mjs +0 -1
- package/dto/Transaction.dto.d.ts +0 -1
- package/dto/Transaction.dto.js +0 -1
- package/dto/Transaction.dto.mjs +0 -1
- package/dto/index.js +0 -1
- package/dto/index.mjs +0 -1
- package/helpers/assertConfirmRateData.js +1 -1
- package/helpers/assertConfirmRateData.mjs +11 -28
- package/helpers/assertRateConfirmationMatchesIntent.d.ts +0 -1
- package/helpers/assertRateConfirmationMatchesIntent.js +1 -1
- package/helpers/assertRateConfirmationMatchesIntent.mjs +9 -18
- package/helpers/base64Utils.js +1 -1
- package/helpers/base64Utils.mjs +15 -18
- package/helpers/decodeLoginToken.js +1 -1
- package/helpers/decodeLoginToken.mjs +19 -21
- package/helpers/decodeToken.js +1 -1
- package/helpers/decodeToken.mjs +22 -27
- package/helpers/getApiURL.js +1 -1
- package/helpers/getApiURL.mjs +5 -5
- package/helpers/getBridgeURL.js +1 -1
- package/helpers/getBridgeURL.mjs +4 -4
- package/helpers/getDisplayName.d.ts +0 -1
- package/helpers/getDisplayName.js +1 -1
- package/helpers/getDisplayName.mjs +5 -5
- package/helpers/getMvxApiURL.js +1 -1
- package/helpers/getMvxApiURL.mjs +5 -5
- package/helpers/getMvxChainId.js +1 -1
- package/helpers/getMvxChainId.mjs +5 -5
- package/helpers/getMvxExplorerAddress.js +1 -1
- package/helpers/getMvxExplorerAddress.mjs +4 -4
- package/helpers/index.js +1 -1
- package/helpers/index.mjs +12 -27
- package/helpers/isValidAddressForChainType.d.ts +0 -1
- package/helpers/isValidAddressForChainType.js +1 -1
- package/helpers/isValidAddressForChainType.mjs +37 -48
- package/helpers/safeImageUrl.js +1 -1
- package/helpers/safeImageUrl.mjs +14 -12
- package/helpers/serializeTransaction.d.ts +0 -1
- package/helpers/serializeTransaction.js +1 -1
- package/helpers/serializeTransaction.mjs +5 -5
- package/helpers/tests/assertConfirmRateData.spec.js +1 -1
- package/helpers/tests/assertConfirmRateData.spec.mjs +86 -74
- package/helpers/tests/assertRateConfirmationMatchesIntent.spec.js +1 -1
- package/helpers/tests/assertRateConfirmationMatchesIntent.spec.mjs +61 -49
- package/helpers/tests/base64Utils.spec.js +1 -1
- package/helpers/tests/base64Utils.spec.mjs +15 -13
- package/helpers/tests/decodeLoginToken.spec.js +1 -1
- package/helpers/tests/decodeLoginToken.spec.mjs +20 -19
- package/helpers/tests/decodeToken.spec.js +1 -1
- package/helpers/tests/decodeToken.spec.mjs +18 -19
- package/helpers/tests/isValidAddressForChainType.spec.js +1 -1
- package/helpers/tests/isValidAddressForChainType.spec.mjs +59 -134
- package/helpers/tests/safeImageUrl.spec.js +1 -1
- package/helpers/tests/safeImageUrl.spec.mjs +30 -30
- package/helpers/tests/serializeTransaction.spec.js +1 -1
- package/helpers/tests/serializeTransaction.spec.mjs +35 -21
- package/index.js +1 -1
- package/index.mjs +91 -200
- package/package.json +23 -32
- package/react.esm-JNqTldrP.mjs +8927 -0
- package/react.esm-kvI07ZPd.js +59 -0
- package/reactjs/adapters/SuiAdapter.d.ts +2 -2
- package/reactjs/adapters/SuiAdapter.js +1 -1
- package/reactjs/adapters/SuiAdapter.mjs +254 -323
- package/reactjs/components/AccountAddress/AccountAddress.d.ts +1 -1
- package/reactjs/components/AccountAddress/AccountAddress.js +1 -1
- package/reactjs/components/AccountAddress/AccountAddress.mjs +20 -30
- package/reactjs/components/AccountAddress/index.js +1 -1
- package/reactjs/components/AccountAddress/index.mjs +2 -4
- package/reactjs/components/AmountCard/AmountCard.d.ts +1 -2
- package/reactjs/components/AmountCard/AmountCard.js +1 -1
- package/reactjs/components/AmountCard/AmountCard.mjs +13 -31
- package/reactjs/components/AmountCard/index.js +1 -1
- package/reactjs/components/AmountCard/index.mjs +2 -4
- package/reactjs/components/AmountInput/AmountInput.d.ts +1 -2
- package/reactjs/components/AmountInput/AmountInput.js +1 -1
- package/reactjs/components/AmountInput/AmountInput.mjs +48 -66
- package/reactjs/components/AmountInput/index.js +1 -1
- package/reactjs/components/AmountInput/index.mjs +2 -4
- package/reactjs/components/BridgeForm/BridgeForm.d.ts +1 -1
- package/reactjs/components/BridgeForm/BridgeForm.js +1 -1
- package/reactjs/components/BridgeForm/BridgeForm.mjs +53 -81
- package/reactjs/components/BridgeForm/Deposit.d.ts +1 -1
- package/reactjs/components/BridgeForm/Deposit.js +1 -1
- package/reactjs/components/BridgeForm/Deposit.mjs +457 -573
- package/reactjs/components/BridgeForm/Transfer.d.ts +1 -1
- package/reactjs/components/BridgeForm/Transfer.js +1 -1
- package/reactjs/components/BridgeForm/Transfer.mjs +358 -470
- package/reactjs/components/BridgeForm/hooks/useBridgeAmounts.d.ts +0 -1
- package/reactjs/components/BridgeForm/hooks/useBridgeAmounts.js +1 -1
- package/reactjs/components/BridgeForm/hooks/useBridgeAmounts.mjs +52 -54
- package/reactjs/components/BridgeForm/hooks/useBridgeRateFetching.d.ts +0 -1
- package/reactjs/components/BridgeForm/hooks/useBridgeRateFetching.js +1 -1
- package/reactjs/components/BridgeForm/hooks/useBridgeRateFetching.mjs +35 -46
- package/reactjs/components/BridgeForm/hooks/useBridgeTokenSelection.d.ts +1 -2
- package/reactjs/components/BridgeForm/hooks/useBridgeTokenSelection.js +1 -1
- package/reactjs/components/BridgeForm/hooks/useBridgeTokenSelection.mjs +131 -197
- package/reactjs/components/BridgeForm/index.js +1 -1
- package/reactjs/components/BridgeForm/index.mjs +1 -3
- package/reactjs/components/BridgeForm/utils/bridgeFormHelpers.d.ts +3 -4
- package/reactjs/components/BridgeForm/utils/bridgeFormHelpers.js +1 -1
- package/reactjs/components/BridgeForm/utils/bridgeFormHelpers.mjs +26 -43
- package/reactjs/components/BridgeHistory/BridgeHistory.d.ts +1 -1
- package/reactjs/components/BridgeHistory/BridgeHistory.js +1 -1
- package/reactjs/components/BridgeHistory/BridgeHistory.mjs +2 -353
- package/reactjs/components/BridgeHistory/index.js +1 -1
- package/reactjs/components/BridgeHistory/index.mjs +2 -4
- package/reactjs/components/Connect/BridgeAccountDisplay.d.ts +1 -2
- package/reactjs/components/Connect/BridgeAccountDisplay.js +1 -1
- package/reactjs/components/Connect/BridgeAccountDisplay.mjs +125 -134
- package/reactjs/components/Connect/BridgeConnectButton.d.ts +1 -2
- package/reactjs/components/Connect/BridgeConnectButton.js +1 -1
- package/reactjs/components/Connect/BridgeConnectButton.mjs +42 -44
- package/reactjs/components/Connect/ChainSelectConnect.d.ts +1 -2
- package/reactjs/components/Connect/ChainSelectConnect.js +1 -1
- package/reactjs/components/Connect/ChainSelectConnect.mjs +100 -129
- package/reactjs/components/Connect/CustomConnectButton.d.ts +2 -3
- package/reactjs/components/Connect/CustomConnectButton.js +1 -1
- package/reactjs/components/Connect/CustomConnectButton.mjs +23 -35
- package/reactjs/components/Connect/MvxAccountDisplay.d.ts +1 -1
- package/reactjs/components/Connect/MvxAccountDisplay.js +1 -1
- package/reactjs/components/Connect/MvxAccountDisplay.mjs +74 -94
- package/reactjs/components/Connect/MvxConnectButton.d.ts +1 -1
- package/reactjs/components/Connect/MvxConnectButton.js +1 -1
- package/reactjs/components/Connect/MvxConnectButton.mjs +27 -38
- package/reactjs/components/Connect/SwitchChainButton.d.ts +2 -3
- package/reactjs/components/Connect/SwitchChainButton.js +1 -1
- package/reactjs/components/Connect/SwitchChainButton.mjs +20 -30
- package/reactjs/components/Connect/index.js +1 -1
- package/reactjs/components/Connect/index.mjs +6 -14
- package/reactjs/components/CopyButton/CopyButton.d.ts +2 -1
- package/reactjs/components/CopyButton/CopyButton.js +1 -1
- package/reactjs/components/CopyButton/CopyButton.mjs +35 -42
- package/reactjs/components/CopyButton/index.js +1 -1
- package/reactjs/components/CopyButton/index.mjs +2 -4
- package/reactjs/components/CopyButton/utils/copyToClipboard.js +1 -1
- package/reactjs/components/CopyButton/utils/copyToClipboard.mjs +20 -24
- package/reactjs/components/CopyButton/utils/index.js +1 -1
- package/reactjs/components/CopyButton/utils/index.mjs +2 -4
- package/reactjs/components/DisplayAmount/DisplayAmount.d.ts +2 -3
- package/reactjs/components/DisplayAmount/DisplayAmount.js +1 -1
- package/reactjs/components/DisplayAmount/DisplayAmount.mjs +74 -82
- package/reactjs/components/DisplayAmount/components/AnimateNumber/AnimateNumber.d.ts +1 -1
- package/reactjs/components/DisplayAmount/components/AnimateNumber/AnimateNumber.js +1 -1
- package/reactjs/components/DisplayAmount/components/AnimateNumber/AnimateNumber.mjs +22 -31
- package/reactjs/components/DisplayAmount/components/AnimateNumber/index.js +0 -1
- package/reactjs/components/DisplayAmount/components/AnimateNumber/index.mjs +0 -1
- package/reactjs/components/DisplayAmount/components/PrecisedAmount/PrecisedAmount.d.ts +1 -2
- package/reactjs/components/DisplayAmount/components/PrecisedAmount/PrecisedAmount.js +1 -1
- package/reactjs/components/DisplayAmount/components/PrecisedAmount/PrecisedAmount.mjs +46 -52
- package/reactjs/components/DisplayAmount/components/index.js +0 -1
- package/reactjs/components/DisplayAmount/components/index.mjs +0 -1
- package/reactjs/components/DisplayAmount/index.js +1 -1
- package/reactjs/components/DisplayAmount/index.mjs +2 -4
- package/reactjs/components/DisplayAmount/utils/index.js +1 -1
- package/reactjs/components/DisplayAmount/utils/index.mjs +2 -4
- package/reactjs/components/DisplayAmount/utils/truncateAmount.js +1 -1
- package/reactjs/components/DisplayAmount/utils/truncateAmount.mjs +14 -16
- package/reactjs/components/Error/Error.d.ts +1 -2
- package/reactjs/components/Error/Error.js +1 -1
- package/reactjs/components/Error/Error.mjs +44 -66
- package/reactjs/components/Error/index.js +1 -1
- package/reactjs/components/Error/index.mjs +1 -3
- package/reactjs/components/SmallLoader/SmallLoader.d.ts +1 -1
- package/reactjs/components/SmallLoader/SmallLoader.js +1 -1
- package/reactjs/components/SmallLoader/SmallLoader.mjs +12 -15
- package/reactjs/components/SmallLoader/index.js +1 -1
- package/reactjs/components/SmallLoader/index.mjs +2 -4
- package/reactjs/components/ToggleDirection/ToggleDirection.d.ts +1 -1
- package/reactjs/components/ToggleDirection/ToggleDirection.js +1 -1
- package/reactjs/components/ToggleDirection/ToggleDirection.mjs +2 -24
- package/reactjs/components/TokenSelector/TokenSelector.d.ts +1 -2
- package/reactjs/components/TokenSelector/TokenSelector.js +1 -1
- package/reactjs/components/TokenSelector/TokenSelector.mjs +94 -151
- package/reactjs/components/TokenSelector/components/ChainSelect/ChainSelect.d.ts +1 -2
- package/reactjs/components/TokenSelector/components/ChainSelect/ChainSelect.js +1 -1
- package/reactjs/components/TokenSelector/components/ChainSelect/ChainSelect.mjs +75 -83
- package/reactjs/components/TokenSelector/components/ChainSelect/components/ChainOptionLabel.d.ts +1 -1
- package/reactjs/components/TokenSelector/components/ChainSelect/components/ChainOptionLabel.js +1 -1
- package/reactjs/components/TokenSelector/components/ChainSelect/components/ChainOptionLabel.mjs +40 -51
- package/reactjs/components/TokenSelector/components/ChainSelect/components/FormatChainOptionLabel.d.ts +2 -3
- package/reactjs/components/TokenSelector/components/ChainSelect/components/FormatChainOptionLabel.js +1 -1
- package/reactjs/components/TokenSelector/components/ChainSelect/components/FormatChainOptionLabel.mjs +16 -12
- package/reactjs/components/TokenSelector/components/ChainSelect/components/IndicatorSeparator.js +1 -1
- package/reactjs/components/TokenSelector/components/ChainSelect/components/IndicatorSeparator.mjs +4 -4
- package/reactjs/components/TokenSelector/components/ChainSelect/components/SelectedChainOption.d.ts +2 -3
- package/reactjs/components/TokenSelector/components/ChainSelect/components/SelectedChainOption.js +1 -1
- package/reactjs/components/TokenSelector/components/ChainSelect/components/SelectedChainOption.mjs +29 -41
- package/reactjs/components/TokenSelector/components/ChainSelect/types/chainSelectOption.js +0 -1
- package/reactjs/components/TokenSelector/components/ChainSelect/types/chainSelectOption.mjs +0 -1
- package/reactjs/components/TokenSelector/components/ChainSelect/types/partialChainOption.js +0 -1
- package/reactjs/components/TokenSelector/components/ChainSelect/types/partialChainOption.mjs +0 -1
- package/reactjs/components/TokenSelector/components/SelectContainer.d.ts +1 -2
- package/reactjs/components/TokenSelector/components/SelectContainer.js +1 -1
- package/reactjs/components/TokenSelector/components/SelectContainer.mjs +32 -37
- package/reactjs/components/TokenSelector/components/SelectContent.d.ts +2 -3
- package/reactjs/components/TokenSelector/components/SelectContent.js +1 -1
- package/reactjs/components/TokenSelector/components/SelectContent.mjs +78 -110
- package/reactjs/components/TokenSelector/components/SelectedOption.d.ts +1 -2
- package/reactjs/components/TokenSelector/components/SelectedOption.js +1 -1
- package/reactjs/components/TokenSelector/components/SelectedOption.mjs +26 -26
- package/reactjs/components/TokenSelector/components/TokenIcon.d.ts +1 -2
- package/reactjs/components/TokenSelector/components/TokenIcon.js +1 -1
- package/reactjs/components/TokenSelector/components/TokenIcon.mjs +54 -74
- package/reactjs/components/TokenSelector/components/TokenItem.d.ts +1 -2
- package/reactjs/components/TokenSelector/components/TokenItem.js +1 -1
- package/reactjs/components/TokenSelector/components/TokenItem.mjs +53 -66
- package/reactjs/components/TokenSelector/components/TokenList.d.ts +1 -2
- package/reactjs/components/TokenSelector/components/TokenList.js +1 -1
- package/reactjs/components/TokenSelector/components/TokenList.mjs +13 -21
- package/reactjs/components/TokenSelector/components/TokenSymbol.d.ts +1 -2
- package/reactjs/components/TokenSelector/components/TokenSymbol.js +1 -1
- package/reactjs/components/TokenSelector/components/TokenSymbol.mjs +15 -23
- package/reactjs/components/TokenSelector/index.js +1 -1
- package/reactjs/components/TokenSelector/index.mjs +2 -4
- package/reactjs/components/TransactionToast/TransactionToast.d.ts +1 -2
- package/reactjs/components/TransactionToast/TransactionToast.js +1 -1
- package/reactjs/components/TransactionToast/TransactionToast.mjs +43 -51
- package/reactjs/components/TransactionToast/TransactionToastContainer.d.ts +1 -2
- package/reactjs/components/TransactionToast/TransactionToastContainer.js +1 -1
- package/reactjs/components/TransactionToast/TransactionToastContainer.mjs +15 -18
- package/reactjs/components/TransactionToast/index.js +1 -1
- package/reactjs/components/TransactionToast/index.mjs +3 -6
- package/reactjs/components/TrimAddress/TrimAddress.d.ts +1 -1
- package/reactjs/components/TrimAddress/TrimAddress.js +1 -1
- package/reactjs/components/TrimAddress/TrimAddress.mjs +13 -22
- package/reactjs/components/TrimAddress/index.js +1 -1
- package/reactjs/components/TrimAddress/index.mjs +1 -3
- package/reactjs/components/base/MxButton/MxButton.d.ts +1 -2
- package/reactjs/components/base/MxButton/MxButton.js +1 -1
- package/reactjs/components/base/MxButton/MxButton.mjs +43 -70
- package/reactjs/components/base/MxButton/index.js +1 -1
- package/reactjs/components/base/MxButton/index.mjs +2 -4
- package/reactjs/components/base/MxCard/MxCard.d.ts +0 -1
- package/reactjs/components/base/MxCard/MxCard.js +1 -1
- package/reactjs/components/base/MxCard/MxCard.mjs +33 -54
- package/reactjs/components/base/MxCard/index.js +1 -1
- package/reactjs/components/base/MxCard/index.mjs +2 -4
- package/reactjs/components/base/MxCircleLoader/MxCircleLoader.d.ts +1 -1
- package/reactjs/components/base/MxCircleLoader/MxCircleLoader.js +1 -1
- package/reactjs/components/base/MxCircleLoader/MxCircleLoader.mjs +9 -26
- package/reactjs/components/base/MxCircleLoader/index.js +1 -1
- package/reactjs/components/base/MxCircleLoader/index.mjs +2 -4
- package/reactjs/components/base/MxLink/MxLink.d.ts +0 -1
- package/reactjs/components/base/MxLink/MxLink.js +1 -1
- package/reactjs/components/base/MxLink/MxLink.mjs +42 -68
- package/reactjs/components/base/MxLink/index.js +1 -1
- package/reactjs/components/base/MxLink/index.mjs +2 -4
- package/reactjs/components/base/MxSearch/MxSearch.js +1 -1
- package/reactjs/components/base/MxSearch/MxSearch.mjs +35 -65
- package/reactjs/components/base/MxSearch/index.js +1 -1
- package/reactjs/components/base/MxSearch/index.mjs +2 -4
- package/reactjs/components/base/MxSlideover/MxSlideover.d.ts +1 -2
- package/reactjs/components/base/MxSlideover/MxSlideover.js +1 -1
- package/reactjs/components/base/MxSlideover/MxSlideover.mjs +70 -76
- package/reactjs/components/base/MxSlideover/index.js +1 -1
- package/reactjs/components/base/MxSlideover/index.mjs +2 -4
- package/reactjs/components/base/MxTooltip/MxTooltip.d.ts +2 -3
- package/reactjs/components/base/MxTooltip/MxTooltip.js +1 -1
- package/reactjs/components/base/MxTooltip/MxTooltip.mjs +79 -119
- package/reactjs/components/base/MxTooltip/components/TooltipContainer/TooltipContainer.d.ts +0 -1
- package/reactjs/components/base/MxTooltip/components/TooltipContainer/TooltipContainer.js +1 -1
- package/reactjs/components/base/MxTooltip/components/TooltipContainer/TooltipContainer.mjs +23 -31
- package/reactjs/components/base/MxTooltip/components/TooltipContainer/index.js +1 -1
- package/reactjs/components/base/MxTooltip/components/TooltipContainer/index.mjs +2 -4
- package/reactjs/components/base/MxTooltip/components/TooltipContent/TooltipContent.d.ts +1 -2
- package/reactjs/components/base/MxTooltip/components/TooltipContent/TooltipContent.js +1 -1
- package/reactjs/components/base/MxTooltip/components/TooltipContent/TooltipContent.mjs +13 -25
- package/reactjs/components/base/MxTooltip/components/TooltipContent/index.js +1 -1
- package/reactjs/components/base/MxTooltip/components/TooltipContent/index.mjs +1 -3
- package/reactjs/components/base/MxTooltip/components/index.js +1 -1
- package/reactjs/components/base/MxTooltip/components/index.mjs +5 -6
- package/reactjs/components/base/MxTooltip/index.js +1 -1
- package/reactjs/components/base/MxTooltip/index.mjs +2 -4
- package/reactjs/components/base/index.js +1 -1
- package/reactjs/components/base/index.mjs +12 -13
- package/reactjs/components/index.js +1 -1
- package/reactjs/components/index.mjs +40 -53
- package/reactjs/constants/chains.js +1 -1
- package/reactjs/constants/chains.mjs +2 -35
- package/reactjs/constants/index.js +1 -1
- package/reactjs/constants/index.mjs +5 -12
- package/reactjs/context/Web3AppProvider.d.ts +6 -7
- package/reactjs/context/Web3AppProvider.js +1 -1
- package/reactjs/context/Web3AppProvider.mjs +41 -40
- package/reactjs/context/queryClient.d.ts +0 -1
- package/reactjs/context/queryClient.js +1 -1
- package/reactjs/context/queryClient.mjs +6 -6
- package/reactjs/context/useWeb3App.js +1 -1
- package/reactjs/context/useWeb3App.mjs +9 -10
- package/reactjs/helpers/index.js +1 -1
- package/reactjs/helpers/index.mjs +2 -6
- package/reactjs/helpers/resolveBridgeApiChainId.js +1 -1
- package/reactjs/helpers/resolveBridgeApiChainId.mjs +22 -23
- package/reactjs/hooks/index.js +1 -1
- package/reactjs/hooks/index.mjs +16 -35
- package/reactjs/hooks/tests/useGenericSignMessage.spec.js +1 -1
- package/reactjs/hooks/tests/useGenericSignMessage.spec.mjs +43 -50
- package/reactjs/hooks/tests/useSignTransaction.spec.js +1 -1
- package/reactjs/hooks/tests/useSignTransaction.spec.mjs +123 -150
- package/reactjs/hooks/useAccount.js +1 -1
- package/reactjs/hooks/useAccount.mjs +11 -11
- package/reactjs/hooks/useBalances.d.ts +0 -1
- package/reactjs/hooks/useBalances.js +1 -1
- package/reactjs/hooks/useBalances.mjs +31 -39
- package/reactjs/hooks/useBridgeApiChainId.js +1 -1
- package/reactjs/hooks/useBridgeApiChainId.mjs +8 -11
- package/reactjs/hooks/useBridgeFormik.d.ts +4 -5
- package/reactjs/hooks/useBridgeFormik.js +1 -1
- package/reactjs/hooks/useBridgeFormik.mjs +117 -143
- package/reactjs/hooks/useDebounce.js +1 -1
- package/reactjs/hooks/useDebounce.mjs +10 -10
- package/reactjs/hooks/useDisconnectOnChainTypeChange.d.ts +0 -1
- package/reactjs/hooks/useDisconnectOnChainTypeChange.js +1 -1
- package/reactjs/hooks/useDisconnectOnChainTypeChange.mjs +12 -12
- package/reactjs/hooks/useFetchBridgeData.d.ts +2 -2
- package/reactjs/hooks/useFetchBridgeData.js +1 -1
- package/reactjs/hooks/useFetchBridgeData.mjs +2 -44
- package/reactjs/hooks/useFetchTokens.d.ts +1 -1
- package/reactjs/hooks/useFetchTokens.js +1 -1
- package/reactjs/hooks/useFetchTokens.mjs +2 -92
- package/reactjs/hooks/useGenericSignMessage.js +1 -1
- package/reactjs/hooks/useGenericSignMessage.mjs +37 -54
- package/reactjs/hooks/useGetChainId.js +1 -1
- package/reactjs/hooks/useGetChainId.mjs +9 -9
- package/reactjs/hooks/useNamespaceAddress.d.ts +0 -1
- package/reactjs/hooks/useNamespaceAddress.js +1 -1
- package/reactjs/hooks/useNamespaceAddress.mjs +12 -15
- package/reactjs/hooks/useResolveTokenChain.d.ts +0 -1
- package/reactjs/hooks/useResolveTokenChain.js +1 -1
- package/reactjs/hooks/useResolveTokenChain.mjs +13 -15
- package/reactjs/hooks/useSendTransactions.d.ts +0 -1
- package/reactjs/hooks/useSendTransactions.js +1 -1
- package/reactjs/hooks/useSendTransactions.mjs +11 -20
- package/reactjs/hooks/useSignTransaction.d.ts +509 -0
- package/reactjs/hooks/useSignTransaction.js +1 -1
- package/reactjs/hooks/useSignTransaction.mjs +59 -85
- package/reactjs/hooks/useSuiConnect.js +1 -1
- package/reactjs/hooks/useSuiConnect.mjs +68 -67
- package/reactjs/hooks/validation/index.js +1 -1
- package/reactjs/hooks/validation/index.mjs +5 -10
- package/reactjs/hooks/validation/useAmountSchema.js +1 -1
- package/reactjs/hooks/validation/useAmountSchema.mjs +9 -11
- package/reactjs/hooks/validation/useSecondAmountSchema.js +1 -1
- package/reactjs/hooks/validation/useSecondAmountSchema.mjs +5 -8
- package/reactjs/hooks/validation/useTestHasEnoughFunds.d.ts +0 -1
- package/reactjs/hooks/validation/useTestHasEnoughFunds.js +1 -1
- package/reactjs/hooks/validation/useTestHasEnoughFunds.mjs +20 -27
- package/reactjs/hooks/validation/useTestIsConnected.d.ts +0 -1
- package/reactjs/hooks/validation/useTestIsConnected.js +1 -1
- package/reactjs/hooks/validation/useTestIsConnected.mjs +15 -20
- package/reactjs/index.d.ts +0 -1
- package/reactjs/index.js +1 -1
- package/reactjs/index.mjs +70 -157
- package/reactjs/init/index.js +1 -1
- package/reactjs/init/index.mjs +2 -5
- package/reactjs/init/init.d.ts +2 -3
- package/reactjs/init/init.js +1 -1
- package/reactjs/init/init.mjs +113 -112
- package/reactjs/init/isMobileInjectedDappBrowser.js +1 -1
- package/reactjs/init/isMobileInjectedDappBrowser.mjs +6 -7
- package/reactjs/queries/index.js +1 -1
- package/reactjs/queries/index.mjs +7 -17
- package/reactjs/queries/useCheckAccount.query.d.ts +1 -2
- package/reactjs/queries/useCheckAccount.query.js +1 -1
- package/reactjs/queries/useCheckAccount.query.mjs +35 -34
- package/reactjs/queries/useGetAllTokens.query.d.ts +1 -2
- package/reactjs/queries/useGetAllTokens.query.js +1 -1
- package/reactjs/queries/useGetAllTokens.query.mjs +24 -30
- package/reactjs/queries/useGetChains.query.d.ts +1 -2
- package/reactjs/queries/useGetChains.query.js +1 -1
- package/reactjs/queries/useGetChains.query.mjs +28 -31
- package/reactjs/queries/useGetHistory.query.d.ts +2 -3
- package/reactjs/queries/useGetHistory.query.js +1 -1
- package/reactjs/queries/useGetHistory.query.mjs +50 -64
- package/reactjs/queries/useGetMvxTokensBalances.query.d.ts +3 -4
- package/reactjs/queries/useGetMvxTokensBalances.query.js +1 -1
- package/reactjs/queries/useGetMvxTokensBalances.query.mjs +44 -56
- package/reactjs/queries/useGetNonMvxTokensBalances.query.d.ts +3 -4
- package/reactjs/queries/useGetNonMvxTokensBalances.query.js +1 -1
- package/reactjs/queries/useGetNonMvxTokensBalances.query.mjs +2 -75
- package/reactjs/queries/useGetRate.mutation.d.ts +0 -1
- package/reactjs/queries/useGetRate.mutation.js +1 -1
- package/reactjs/queries/useGetRate.mutation.mjs +12 -14
- package/reactjs/reexports.d.ts +2 -3
- package/reactjs/reexports.js +1 -1
- package/reactjs/reexports.mjs +3 -15
- package/reactjs/utils/delay.js +1 -1
- package/reactjs/utils/delay.mjs +5 -5
- package/reactjs/utils/formatAmount.js +1 -1
- package/reactjs/utils/formatAmount.mjs +11 -22
- package/reactjs/utils/getCleanStringAmount.js +1 -1
- package/reactjs/utils/getCleanStringAmount.mjs +11 -8
- package/reactjs/utils/getCompletePathname.js +1 -1
- package/reactjs/utils/getCompletePathname.mjs +5 -5
- package/reactjs/utils/getInitialTokens.js +1 -1
- package/reactjs/utils/getInitialTokens.mjs +10 -10
- package/reactjs/utils/hasEnoughFunds.js +1 -1
- package/reactjs/utils/hasEnoughFunds.mjs +9 -15
- package/reactjs/utils/index.js +1 -1
- package/reactjs/utils/index.mjs +12 -25
- package/reactjs/utils/isStringFloat.js +1 -1
- package/reactjs/utils/isStringFloat.mjs +10 -13
- package/reactjs/utils/mxClsx.d.ts +0 -1
- package/reactjs/utils/mxClsx.js +1 -1
- package/reactjs/utils/mxClsx.mjs +5 -5
- package/reactjs/utils/pipe.js +1 -1
- package/reactjs/utils/pipe.mjs +13 -20
- package/reactjs/utils/removeCommas.js +1 -1
- package/reactjs/utils/removeCommas.mjs +4 -4
- package/reactjs/utils/roundAmount.js +1 -1
- package/reactjs/utils/roundAmount.mjs +15 -19
- package/reactjs/utils/testNumber.js +1 -1
- package/reactjs/utils/testNumber.mjs +4 -4
- package/store/inMemoryStore.js +1 -1
- package/store/inMemoryStore.mjs +30 -34
- package/style.css +2 -1
- package/types/batchTransactions.d.ts +0 -1
- package/types/batchTransactions.js +0 -1
- package/types/batchTransactions.mjs +0 -1
- package/types/chainType.js +1 -1
- package/types/chainType.mjs +6 -4
- package/types/errors.js +1 -1
- package/types/errors.mjs +15 -19
- package/types/index.js +0 -1
- package/types/index.mjs +0 -1
- package/types/providerType.js +1 -1
- package/types/providerType.mjs +6 -4
- package/types/rate.d.ts +0 -1
- package/types/rate.js +0 -1
- package/types/rate.mjs +0 -1
- package/types/token.d.ts +0 -1
- package/types/token.js +0 -1
- package/types/token.mjs +0 -1
- package/types/transaction.d.ts +3 -4
- package/types/transaction.js +0 -1
- package/types/transaction.mjs +0 -1
- package/types/utxo.js +0 -1
- package/types/utxo.mjs +0 -1
- package/useFetchBridgeData-B5xt9GbW.js +2 -0
- package/useFetchBridgeData-C_hZjzd_.mjs +142 -0
- package/all-networks--dfVLHLJ.js +0 -2
- package/all-networks-Czd8zS1n.mjs +0 -4
- package/default-D0Jk5ROI.mjs +0 -4
- package/default-DbU6vPaB.js +0 -2
- package/react.esm-B0AMOHxa.js +0 -73
- package/react.esm-BxvJJ86Q.mjs +0 -9949
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../hooks/useBridgeFormik.js");let t=require("react"),n=require("@multiversx/sdk-dapp-utils/out/helpers/formatAmount");var r=({firstToken:r,firstTokenAmount:i,secondTokenAmount:a,rate:o,rateValidationError:s,formikSetFieldValue:c})=>{let[l,u]=(0,t.useState)(i??``),[d,f]=(0,t.useState)(a??``),p=(0,t.useCallback)(e=>{u(e)},[]),m=(0,t.useCallback)(e=>{f(e)},[]),h=(0,t.useCallback)(()=>{let e=(0,n.formatAmount)({decimals:r?.decimals,input:r?.balance??`0`,addCommas:!1,digits:4});c(`firstAmount`,e),p(e)},[r?.balance,r?.decimals,c,p]),g=(0,t.useCallback)(()=>{p(``),m(``)},[p,m]);return(0,t.useEffect)(()=>{o?.amountOut&&(c(e.BridgeFormikValuesEnum.secondAmount,o.amountOut),f(o.amountOut))},[o?.amountOut,c]),(0,t.useEffect)(()=>{s&&(c(e.BridgeFormikValuesEnum.secondAmount,`0`),f(`0`))},[s,c]),(0,t.useEffect)(()=>{i&&(c(e.BridgeFormikValuesEnum.firstAmount,i),p(i))},[i,c,p]),(0,t.useEffect)(()=>{a&&(c(e.BridgeFormikValuesEnum.secondAmount,a),m(a))},[a,c,m]),{firstAmount:l,secondAmount:d,handleOnChangeFirstAmount:p,handleOnChangeSecondAmount:m,handleOnFirstMaxBtnChange:h,clearAmounts:g,hasAmounts:l!==``&&d!==``}};exports.useBridgeAmounts=r;
|
|
@@ -1,55 +1,53 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
export {
|
|
54
|
-
y as useBridgeAmounts
|
|
1
|
+
import { BridgeFormikValuesEnum as e } from "../../../hooks/useBridgeFormik.mjs";
|
|
2
|
+
import { useCallback as t, useEffect as n, useState as r } from "react";
|
|
3
|
+
import { formatAmount as i } from "@multiversx/sdk-dapp-utils/out/helpers/formatAmount";
|
|
4
|
+
//#region src/reactjs/components/BridgeForm/hooks/useBridgeAmounts.ts
|
|
5
|
+
var a = ({ firstToken: a, firstTokenAmount: o, secondTokenAmount: s, rate: c, rateValidationError: l, formikSetFieldValue: u }) => {
|
|
6
|
+
let [d, f] = r(o ?? ""), [p, m] = r(s ?? ""), h = t((e) => {
|
|
7
|
+
f(e);
|
|
8
|
+
}, []), g = t((e) => {
|
|
9
|
+
m(e);
|
|
10
|
+
}, []), _ = t(() => {
|
|
11
|
+
let e = i({
|
|
12
|
+
decimals: a?.decimals,
|
|
13
|
+
input: a?.balance ?? "0",
|
|
14
|
+
addCommas: !1,
|
|
15
|
+
digits: 4
|
|
16
|
+
});
|
|
17
|
+
u("firstAmount", e), h(e);
|
|
18
|
+
}, [
|
|
19
|
+
a?.balance,
|
|
20
|
+
a?.decimals,
|
|
21
|
+
u,
|
|
22
|
+
h
|
|
23
|
+
]), v = t(() => {
|
|
24
|
+
h(""), g("");
|
|
25
|
+
}, [h, g]);
|
|
26
|
+
return n(() => {
|
|
27
|
+
c?.amountOut && (u(e.secondAmount, c.amountOut), m(c.amountOut));
|
|
28
|
+
}, [c?.amountOut, u]), n(() => {
|
|
29
|
+
l && (u(e.secondAmount, "0"), m("0"));
|
|
30
|
+
}, [l, u]), n(() => {
|
|
31
|
+
o && (u(e.firstAmount, o), h(o));
|
|
32
|
+
}, [
|
|
33
|
+
o,
|
|
34
|
+
u,
|
|
35
|
+
h
|
|
36
|
+
]), n(() => {
|
|
37
|
+
s && (u(e.secondAmount, s), g(s));
|
|
38
|
+
}, [
|
|
39
|
+
s,
|
|
40
|
+
u,
|
|
41
|
+
g
|
|
42
|
+
]), {
|
|
43
|
+
firstAmount: d,
|
|
44
|
+
secondAmount: p,
|
|
45
|
+
handleOnChangeFirstAmount: h,
|
|
46
|
+
handleOnChangeSecondAmount: g,
|
|
47
|
+
handleOnFirstMaxBtnChange: _,
|
|
48
|
+
clearAmounts: v,
|
|
49
|
+
hasAmounts: d !== "" && p !== ""
|
|
50
|
+
};
|
|
55
51
|
};
|
|
52
|
+
//#endregion
|
|
53
|
+
export { a as useBridgeAmounts };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../../chunk-oiTVcehM.js");let t=require("react"),n=require("lodash/debounce");n=e.n(n);var r,i=({firstAmount:e,firstToken:i,secondToken:a,accountAddress:o,fromChainId:s,toChainId:c,nativeAuthToken:l,forceRefetchRate:u,getRate:d})=>{let f=(0,t.useCallback)((0,n.default)(async e=>{!e||!Number(e)||!o||!i?.address||!a?.address||!s||d({nativeAuthToken:l??``,body:{tokenIn:i.address,amountIn:e,fromChainId:s,tokenOut:a.address,toChainId:c}})},500),[o,i?.address,a?.address,s,c,l,d]);return(0,t.useEffect)(()=>{if(e)return f(e),r&&clearInterval(r),r=setInterval(()=>{f(e)},50*1e3),()=>clearInterval(r)},[e,u,f]),{fetchRateDebounced:f}};exports.useBridgeRateFetching=i;
|
|
@@ -1,47 +1,36 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
I,
|
|
35
|
-
y
|
|
36
|
-
]
|
|
37
|
-
);
|
|
38
|
-
return x(() => {
|
|
39
|
-
if (l)
|
|
40
|
-
return u(l), b && clearInterval(b), b = setInterval(() => {
|
|
41
|
-
u(l);
|
|
42
|
-
}, 50 * 1e3), () => clearInterval(b);
|
|
43
|
-
}, [l, R, u]), { fetchRateDebounced: u };
|
|
44
|
-
};
|
|
45
|
-
export {
|
|
46
|
-
E as useBridgeRateFetching
|
|
1
|
+
import { useCallback as e, useEffect as t } from "react";
|
|
2
|
+
import n from "lodash/debounce";
|
|
3
|
+
//#region src/reactjs/components/BridgeForm/hooks/useBridgeRateFetching.ts
|
|
4
|
+
var r, i = ({ firstAmount: i, firstToken: a, secondToken: o, accountAddress: s, fromChainId: c, toChainId: l, nativeAuthToken: u, forceRefetchRate: d, getRate: f }) => {
|
|
5
|
+
let p = e(n(async (e) => {
|
|
6
|
+
!e || !Number(e) || !s || !a?.address || !o?.address || !c || f({
|
|
7
|
+
nativeAuthToken: u ?? "",
|
|
8
|
+
body: {
|
|
9
|
+
tokenIn: a.address,
|
|
10
|
+
amountIn: e,
|
|
11
|
+
fromChainId: c,
|
|
12
|
+
tokenOut: o.address,
|
|
13
|
+
toChainId: l
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}, 500), [
|
|
17
|
+
s,
|
|
18
|
+
a?.address,
|
|
19
|
+
o?.address,
|
|
20
|
+
c,
|
|
21
|
+
l,
|
|
22
|
+
u,
|
|
23
|
+
f
|
|
24
|
+
]);
|
|
25
|
+
return t(() => {
|
|
26
|
+
if (i) return p(i), r && clearInterval(r), r = setInterval(() => {
|
|
27
|
+
p(i);
|
|
28
|
+
}, 50 * 1e3), () => clearInterval(r);
|
|
29
|
+
}, [
|
|
30
|
+
i,
|
|
31
|
+
d,
|
|
32
|
+
p
|
|
33
|
+
]), { fetchRateDebounced: p };
|
|
47
34
|
};
|
|
35
|
+
//#endregion
|
|
36
|
+
export { i as useBridgeRateFetching };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../helpers/resolveBridgeApiChainId.js"),t=require("../../../utils/getInitialTokens.js"),n=require("../utils/bridgeFormHelpers.js");let r=require("react");var i=({chains:i,firstTokenIdentifier:a,secondTokenIdentifier:o,fromTokens:s,toTokens:c,isTokensLoading:l,activeChainId:u,mvxChainId:d,callbackRoute:f,forcedDestinationTokenSymbol:p,onNavigate:m,switchNetwork:h,sdkChains:g,activeChain:_})=>{let v=(0,r.useRef)(!1),[y,b]=(0,r.useState)(),[x,S]=(0,r.useState)(),C=(0,r.useMemo)(()=>s?.filter(e=>d?e.chainId.toString().toLowerCase()===d.toString().toLowerCase():!0).map(e=>({...e,identifier:e.address,ticker:e.symbol}))??[],[s,d]),w=(0,r.useCallback)(e=>n.getAvailableTokens(e,c,p),[c,p]),T=(0,r.useMemo)(()=>y?c?.filter(e=>e.symbol.toLowerCase()===y.symbol.toLowerCase()).map(e=>({...e,identifier:e.address,ticker:e.symbol}))??[]:[],[y?.symbol,c]),E=(0,r.useMemo)(()=>{let t=d?x:y;return t&&i?.find(n=>e.sameBridgeApiChainId(n.chainId,t.chainId))||i?.find(t=>e.sameBridgeApiChainId(t.chainId,_?.id))||((d?y&&i?.find(t=>e.sameBridgeApiChainId(t.chainId,y.chainId)):x&&i?.find(t=>e.sameBridgeApiChainId(t.chainId,x.chainId)))??i?.[0])},[_?.id,i,y?.chainId,d,x?.chainId]),D=(0,r.useCallback)(e=>n.getDefaultReceivingToken(e,c),[c]),O=(0,r.useCallback)(({firstTokenId:e,secondTokenId:t})=>{n.updateUrlParams({firstTokenId:e,secondTokenId:t,callbackRoute:f,isTokensLoading:l,onNavigate:m})},[f,l,m]),k=(0,r.useCallback)(e=>{if(!e)return;b(e),O({firstTokenId:e.address});let t=c?.find(t=>t.symbol.toLowerCase()===e.symbol.toLowerCase());if(!t){let n=w(e);t=n.find(t=>t.symbol.toLowerCase()===e.symbol.toLowerCase())??D(n)}t&&(S(t),O({secondTokenId:t.address}))},[w,D,O,c]),A=(0,r.useCallback)(e=>{if(!e)return;S(e),O({secondTokenId:e.address});let t=C.find(t=>t.symbol.toLowerCase()===e.symbol.toLowerCase());t&&(b(t),O({firstTokenId:t.address}))},[C,O]),j=(0,r.useCallback)(()=>{if(!y||!x)return;b(x),S(y),O({firstTokenId:x.address,secondTokenId:y.address});let t=g?.find(t=>e.sameBridgeApiChainId(t.id,x.chainId));t&&h&&h(t)},[y,x,O,g,h]);return(0,r.useEffect)(()=>{if(l||v.current||!C.length)return;if(y&&x){v.current=!0;return}let n=t.getInitialTokens({firstTokenId:a,secondTokenId:o}),r=C.find(({identifier:e})=>n?.firstTokenId===e)??C.find(t=>e.sameBridgeApiChainId(t.chainId,u))??C[0],i=c?.find(e=>e.symbol.toLowerCase()===r?.symbol.toLowerCase());if(!i){let e=w(r);i=e?.find(({address:e})=>e.toLowerCase()===(r?.symbol??n?.secondTokenId)?.toLowerCase())??e.find(e=>e.symbol.toLowerCase()===r?.symbol.toLowerCase())??D(e)}if(y&&x&&y?.address?.toLowerCase()===r?.address?.toLowerCase()&&x?.address?.toLowerCase()===i?.address?.toLowerCase())return;let s=!1;if(r){b(r),O({firstTokenId:r.address});let t=g?.find(t=>e.sameBridgeApiChainId(t.id,r.chainId))??_;t&&h&&h(t),s=!0}i&&(S(i),O({secondTokenId:i.address}),s&&=!0),v.current=s},[l,C,c,a,o,u,w,D,O,g,_,h]),(0,r.useEffect)(()=>{let e=s?.find(e=>e.address===y?.address);e&&b(t=>t&&{...t,balance:e.balance})},[s,y?.address]),(0,r.useEffect)(()=>{let e=c?.find(e=>e.address===x?.address);e&&S(t=>t&&{...t,balance:e.balance})},[c,x?.address]),{firstToken:y,secondToken:x,fromOptions:C,toOptions:T,selectedChainOption:E,setFirstToken:b,setSecondToken:S,onChangeFirstSelect:k,onChangeSecondSelect:A,handleChangeDirection:j,updateUrlParams:O}};exports.useBridgeTokenSelection=i;
|
|
@@ -1,198 +1,132 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
({ identifier: a }) => (e == null ? void 0 : e.firstTokenId) === a
|
|
131
|
-
) ?? L.find(
|
|
132
|
-
(a) => m(a.chainId, C)
|
|
133
|
-
) ?? L[0];
|
|
134
|
-
let u = t == null ? void 0 : t.find(
|
|
135
|
-
(a) => a.symbol.toLowerCase() === (r == null ? void 0 : r.symbol.toLowerCase())
|
|
136
|
-
);
|
|
137
|
-
if (!u) {
|
|
138
|
-
const a = P(r);
|
|
139
|
-
u = (a == null ? void 0 : a.find(
|
|
140
|
-
({ address: B }) => {
|
|
141
|
-
var K;
|
|
142
|
-
return B.toLowerCase() === ((K = (r == null ? void 0 : r.symbol) ?? (e == null ? void 0 : e.secondTokenId)) == null ? void 0 : K.toLowerCase());
|
|
143
|
-
}
|
|
144
|
-
)) ?? a.find(
|
|
145
|
-
(B) => B.symbol.toLowerCase() === (r == null ? void 0 : r.symbol.toLowerCase())
|
|
146
|
-
) ?? R(a);
|
|
147
|
-
}
|
|
148
|
-
if (!!d && !!l && ((q = d == null ? void 0 : d.address) == null ? void 0 : q.toLowerCase()) === ((G = r == null ? void 0 : r.address) == null ? void 0 : G.toLowerCase()) && ((H = l == null ? void 0 : l.address) == null ? void 0 : H.toLowerCase()) === ((J = u == null ? void 0 : u.address) == null ? void 0 : J.toLowerCase()))
|
|
149
|
-
return;
|
|
150
|
-
let c = !1;
|
|
151
|
-
if (r) {
|
|
152
|
-
S(r), b({ firstTokenId: r.address });
|
|
153
|
-
const a = (I == null ? void 0 : I.find(
|
|
154
|
-
(B) => m(B.id, r.chainId)
|
|
155
|
-
)) ?? y;
|
|
156
|
-
a && w && w(a), c = !0;
|
|
157
|
-
}
|
|
158
|
-
u && (A(u), b({ secondTokenId: u.address }), c = c && !0), U.current = c;
|
|
159
|
-
}, [
|
|
160
|
-
o,
|
|
161
|
-
L,
|
|
162
|
-
t,
|
|
163
|
-
D,
|
|
164
|
-
F,
|
|
165
|
-
C,
|
|
166
|
-
P,
|
|
167
|
-
R,
|
|
168
|
-
b,
|
|
169
|
-
I,
|
|
170
|
-
y,
|
|
171
|
-
w
|
|
172
|
-
]), z(() => {
|
|
173
|
-
const e = s == null ? void 0 : s.find(
|
|
174
|
-
(r) => r.address === (d == null ? void 0 : d.address)
|
|
175
|
-
);
|
|
176
|
-
e && S((r) => r && { ...r, balance: e.balance });
|
|
177
|
-
}, [s, d == null ? void 0 : d.address]), z(() => {
|
|
178
|
-
const e = t == null ? void 0 : t.find(
|
|
179
|
-
(r) => r.address === (l == null ? void 0 : l.address)
|
|
180
|
-
);
|
|
181
|
-
e && A((r) => r && { ...r, balance: e.balance });
|
|
182
|
-
}, [t, l == null ? void 0 : l.address]), {
|
|
183
|
-
firstToken: d,
|
|
184
|
-
secondToken: l,
|
|
185
|
-
fromOptions: L,
|
|
186
|
-
toOptions: V,
|
|
187
|
-
selectedChainOption: W,
|
|
188
|
-
setFirstToken: S,
|
|
189
|
-
setSecondToken: A,
|
|
190
|
-
onChangeFirstSelect: X,
|
|
191
|
-
onChangeSecondSelect: Y,
|
|
192
|
-
handleChangeDirection: Z,
|
|
193
|
-
updateUrlParams: b
|
|
194
|
-
};
|
|
195
|
-
};
|
|
196
|
-
export {
|
|
197
|
-
ee as useBridgeTokenSelection
|
|
1
|
+
import { sameBridgeApiChainId as e } from "../../../helpers/resolveBridgeApiChainId.mjs";
|
|
2
|
+
import { getInitialTokens as t } from "../../../utils/getInitialTokens.mjs";
|
|
3
|
+
import { getAvailableTokens as n, getDefaultReceivingToken as r, updateUrlParams as i } from "../utils/bridgeFormHelpers.mjs";
|
|
4
|
+
import { useCallback as a, useEffect as o, useMemo as s, useRef as c, useState as l } from "react";
|
|
5
|
+
//#region src/reactjs/components/BridgeForm/hooks/useBridgeTokenSelection.ts
|
|
6
|
+
var u = ({ chains: u, firstTokenIdentifier: d, secondTokenIdentifier: f, fromTokens: p, toTokens: m, isTokensLoading: h, activeChainId: g, mvxChainId: _, callbackRoute: v, forcedDestinationTokenSymbol: y, onNavigate: b, switchNetwork: x, sdkChains: S, activeChain: C }) => {
|
|
7
|
+
let w = c(!1), [T, E] = l(), [D, O] = l(), k = s(() => p?.filter((e) => _ ? e.chainId.toString().toLowerCase() === _.toString().toLowerCase() : !0).map((e) => ({
|
|
8
|
+
...e,
|
|
9
|
+
identifier: e.address,
|
|
10
|
+
ticker: e.symbol
|
|
11
|
+
})) ?? [], [p, _]), A = a((e) => n(e, m, y), [m, y]), j = s(() => T ? m?.filter((e) => e.symbol.toLowerCase() === T.symbol.toLowerCase()).map((e) => ({
|
|
12
|
+
...e,
|
|
13
|
+
identifier: e.address,
|
|
14
|
+
ticker: e.symbol
|
|
15
|
+
})) ?? [] : [], [T?.symbol, m]), M = s(() => {
|
|
16
|
+
let t = _ ? D : T;
|
|
17
|
+
return t && u?.find((n) => e(n.chainId, t.chainId)) || u?.find((t) => e(t.chainId, C?.id)) || ((_ ? T && u?.find((t) => e(t.chainId, T.chainId)) : D && u?.find((t) => e(t.chainId, D.chainId))) ?? u?.[0]);
|
|
18
|
+
}, [
|
|
19
|
+
C?.id,
|
|
20
|
+
u,
|
|
21
|
+
T?.chainId,
|
|
22
|
+
_,
|
|
23
|
+
D?.chainId
|
|
24
|
+
]), N = a((e) => r(e, m), [m]), P = a(({ firstTokenId: e, secondTokenId: t }) => {
|
|
25
|
+
i({
|
|
26
|
+
firstTokenId: e,
|
|
27
|
+
secondTokenId: t,
|
|
28
|
+
callbackRoute: v,
|
|
29
|
+
isTokensLoading: h,
|
|
30
|
+
onNavigate: b
|
|
31
|
+
});
|
|
32
|
+
}, [
|
|
33
|
+
v,
|
|
34
|
+
h,
|
|
35
|
+
b
|
|
36
|
+
]), F = a((e) => {
|
|
37
|
+
if (!e) return;
|
|
38
|
+
E(e), P({ firstTokenId: e.address });
|
|
39
|
+
let t = m?.find((t) => t.symbol.toLowerCase() === e.symbol.toLowerCase());
|
|
40
|
+
if (!t) {
|
|
41
|
+
let n = A(e);
|
|
42
|
+
t = n.find((t) => t.symbol.toLowerCase() === e.symbol.toLowerCase()) ?? N(n);
|
|
43
|
+
}
|
|
44
|
+
t && (O(t), P({ secondTokenId: t.address }));
|
|
45
|
+
}, [
|
|
46
|
+
A,
|
|
47
|
+
N,
|
|
48
|
+
P,
|
|
49
|
+
m
|
|
50
|
+
]), I = a((e) => {
|
|
51
|
+
if (!e) return;
|
|
52
|
+
O(e), P({ secondTokenId: e.address });
|
|
53
|
+
let t = k.find((t) => t.symbol.toLowerCase() === e.symbol.toLowerCase());
|
|
54
|
+
t && (E(t), P({ firstTokenId: t.address }));
|
|
55
|
+
}, [k, P]), L = a(() => {
|
|
56
|
+
if (!T || !D) return;
|
|
57
|
+
E(D), O(T), P({
|
|
58
|
+
firstTokenId: D.address,
|
|
59
|
+
secondTokenId: T.address
|
|
60
|
+
});
|
|
61
|
+
let t = S?.find((t) => e(t.id, D.chainId));
|
|
62
|
+
t && x && x(t);
|
|
63
|
+
}, [
|
|
64
|
+
T,
|
|
65
|
+
D,
|
|
66
|
+
P,
|
|
67
|
+
S,
|
|
68
|
+
x
|
|
69
|
+
]);
|
|
70
|
+
return o(() => {
|
|
71
|
+
if (h || w.current || !k.length) return;
|
|
72
|
+
if (T && D) {
|
|
73
|
+
w.current = !0;
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
let n = t({
|
|
77
|
+
firstTokenId: d,
|
|
78
|
+
secondTokenId: f
|
|
79
|
+
}), r = k.find(({ identifier: e }) => n?.firstTokenId === e) ?? k.find((t) => e(t.chainId, g)) ?? k[0], i = m?.find((e) => e.symbol.toLowerCase() === r?.symbol.toLowerCase());
|
|
80
|
+
if (!i) {
|
|
81
|
+
let e = A(r);
|
|
82
|
+
i = e?.find(({ address: e }) => e.toLowerCase() === (r?.symbol ?? n?.secondTokenId)?.toLowerCase()) ?? e.find((e) => e.symbol.toLowerCase() === r?.symbol.toLowerCase()) ?? N(e);
|
|
83
|
+
}
|
|
84
|
+
if (T && D && T?.address?.toLowerCase() === r?.address?.toLowerCase() && D?.address?.toLowerCase() === i?.address?.toLowerCase()) return;
|
|
85
|
+
let a = !1;
|
|
86
|
+
if (r) {
|
|
87
|
+
E(r), P({ firstTokenId: r.address });
|
|
88
|
+
let t = S?.find((t) => e(t.id, r.chainId)) ?? C;
|
|
89
|
+
t && x && x(t), a = !0;
|
|
90
|
+
}
|
|
91
|
+
i && (O(i), P({ secondTokenId: i.address }), a &&= !0), w.current = a;
|
|
92
|
+
}, [
|
|
93
|
+
h,
|
|
94
|
+
k,
|
|
95
|
+
m,
|
|
96
|
+
d,
|
|
97
|
+
f,
|
|
98
|
+
g,
|
|
99
|
+
A,
|
|
100
|
+
N,
|
|
101
|
+
P,
|
|
102
|
+
S,
|
|
103
|
+
C,
|
|
104
|
+
x
|
|
105
|
+
]), o(() => {
|
|
106
|
+
let e = p?.find((e) => e.address === T?.address);
|
|
107
|
+
e && E((t) => t && {
|
|
108
|
+
...t,
|
|
109
|
+
balance: e.balance
|
|
110
|
+
});
|
|
111
|
+
}, [p, T?.address]), o(() => {
|
|
112
|
+
let e = m?.find((e) => e.address === D?.address);
|
|
113
|
+
e && O((t) => t && {
|
|
114
|
+
...t,
|
|
115
|
+
balance: e.balance
|
|
116
|
+
});
|
|
117
|
+
}, [m, D?.address]), {
|
|
118
|
+
firstToken: T,
|
|
119
|
+
secondToken: D,
|
|
120
|
+
fromOptions: k,
|
|
121
|
+
toOptions: j,
|
|
122
|
+
selectedChainOption: M,
|
|
123
|
+
setFirstToken: E,
|
|
124
|
+
setSecondToken: O,
|
|
125
|
+
onChangeFirstSelect: F,
|
|
126
|
+
onChangeSecondSelect: I,
|
|
127
|
+
handleChangeDirection: L,
|
|
128
|
+
updateUrlParams: P
|
|
129
|
+
};
|
|
198
130
|
};
|
|
131
|
+
//#endregion
|
|
132
|
+
export { u as useBridgeTokenSelection };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./BridgeForm.js");exports.BridgeForm=e.BridgeForm;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { InitialTokensType } from '../../../utils/getInitialTokens';
|
|
2
|
-
import { ServerTransaction } from '../../../../types/transaction';
|
|
3
|
-
import { TokenType } from '../../../../types/token';
|
|
4
1
|
import { ChainType } from '../../../../types/chainType';
|
|
5
|
-
|
|
2
|
+
import { TokenType } from '../../../../types/token';
|
|
3
|
+
import { ServerTransaction } from '../../../../types/transaction';
|
|
4
|
+
import { InitialTokensType } from '../../../utils/getInitialTokens';
|
|
6
5
|
export declare const updateUrlParams: ({ firstTokenId, secondTokenId, callbackRoute, isTokensLoading, onNavigate }: InitialTokensType & {
|
|
7
6
|
callbackRoute: string;
|
|
8
7
|
isTokensLoading: boolean;
|