@multiversx/sdk-dapp-liquidity 2.0.0 → 2.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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.d.ts +8 -0
- package/helpers/assertRateConfirmationMatchesIntent.js +2 -0
- package/helpers/assertRateConfirmationMatchesIntent.mjs +20 -0
- 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.d.ts +2 -0
- package/helpers/index.js +1 -22
- package/helpers/index.mjs +24 -20
- package/helpers/safeImageUrl.d.ts +1 -0
- package/helpers/safeImageUrl.js +2 -0
- package/helpers/safeImageUrl.mjs +13 -0
- package/helpers/serializeTransaction.js +1 -8
- package/helpers/serializeTransaction.mjs +3 -5
- package/helpers/tests/assertRateConfirmationMatchesIntent.spec.d.ts +1 -0
- package/helpers/tests/assertRateConfirmationMatchesIntent.spec.js +2 -0
- package/helpers/tests/assertRateConfirmationMatchesIntent.spec.mjs +52 -0
- 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.d.ts +1 -0
- package/helpers/tests/safeImageUrl.spec.js +2 -0
- package/helpers/tests/safeImageUrl.spec.mjs +32 -0
- package/helpers/tests/serializeTransaction.spec.d.ts +1 -0
- package/helpers/tests/serializeTransaction.spec.js +2 -0
- package/helpers/tests/serializeTransaction.spec.mjs +24 -0
- package/index.js +1 -228
- package/index.mjs +196 -192
- package/package.json +14 -9
- package/react.esm-B0AMOHxa.js +73 -0
- package/react.esm-BxvJJ86Q.mjs +9949 -0
- package/reactjs/adapters/SuiAdapter.d.ts +14 -0
- package/reactjs/adapters/SuiAdapter.js +1 -349
- package/reactjs/adapters/SuiAdapter.mjs +171 -199
- 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 -673
- package/reactjs/components/BridgeForm/Deposit.mjs +381 -503
- package/reactjs/components/BridgeForm/Transfer.js +1 -559
- package/reactjs/components/BridgeForm/Transfer.mjs +316 -427
- 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 +35 -65
- package/reactjs/components/BridgeHistory/BridgeHistory.js +1 -367
- package/reactjs/components/BridgeHistory/BridgeHistory.mjs +177 -193
- 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 -34
- package/reactjs/components/Connect/BridgeConnectButton.mjs +20 -19
- 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 -51
- package/reactjs/components/TokenSelector/components/ChainSelect/components/ChainOptionLabel.mjs +45 -44
- 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 -39
- package/reactjs/components/TokenSelector/components/ChainSelect/components/SelectedChainOption.mjs +22 -18
- 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 -81
- package/reactjs/components/TokenSelector/components/TokenIcon.mjs +52 -57
- 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 -40
- package/reactjs/context/Web3AppProvider.mjs +34 -34
- 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.d.ts +1 -0
- package/reactjs/hooks/tests/useGenericSignMessage.spec.js +2 -0
- package/reactjs/hooks/tests/useGenericSignMessage.spec.mjs +52 -0
- package/reactjs/hooks/tests/useSignTransaction.spec.d.ts +1 -0
- package/reactjs/hooks/tests/useSignTransaction.spec.js +2 -0
- package/reactjs/hooks/tests/useSignTransaction.spec.mjs +156 -0
- 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 -162
- package/reactjs/hooks/useBridgeFormik.mjs +110 -150
- 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 -113
- package/reactjs/hooks/useFetchTokens.mjs +80 -106
- package/reactjs/hooks/useGenericSignMessage.js +1 -55
- package/reactjs/hooks/useGenericSignMessage.mjs +47 -47
- 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 -86
- package/reactjs/hooks/useSignTransaction.mjs +59 -59
- 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.d.ts +1 -0
- package/reactjs/init/init.js +1 -139
- package/reactjs/init/init.mjs +59 -72
- 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.d.ts +1 -1
- package/reactjs/queries/useGetHistory.query.js +1 -68
- package/reactjs/queries/useGetHistory.query.mjs +55 -58
- package/reactjs/queries/useGetMvxTokensBalances.query.d.ts +1 -1
- package/reactjs/queries/useGetMvxTokensBalances.query.js +1 -71
- package/reactjs/queries/useGetMvxTokensBalances.query.mjs +40 -53
- package/reactjs/queries/useGetNonMvxTokensBalances.query.d.ts +1 -1
- package/reactjs/queries/useGetNonMvxTokensBalances.query.js +1 -81
- package/reactjs/queries/useGetNonMvxTokensBalances.query.mjs +51 -59
- 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.d.ts +3 -0
- package/types/errors.js +2 -0
- package/types/errors.mjs +8 -0
- 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/reactjs/hooks/useSignTransaction.d.ts +0 -511
|
@@ -1,266 +1,198 @@
|
|
|
1
|
-
import { useRef, useState, useMemo, useCallback, useEffect } from "react";
|
|
2
|
-
import { sameBridgeApiChainId } from "../../../helpers/resolveBridgeApiChainId.mjs";
|
|
3
|
-
import { getInitialTokens } from "../../../utils/getInitialTokens.mjs";
|
|
4
|
-
import { getAvailableTokens, getDefaultReceivingToken, updateUrlParams } from "../utils/bridgeFormHelpers.mjs";
|
|
5
|
-
const
|
|
6
|
-
chains,
|
|
7
|
-
firstTokenIdentifier,
|
|
8
|
-
secondTokenIdentifier,
|
|
9
|
-
fromTokens,
|
|
10
|
-
toTokens,
|
|
11
|
-
isTokensLoading,
|
|
12
|
-
activeChainId,
|
|
13
|
-
mvxChainId,
|
|
14
|
-
callbackRoute,
|
|
15
|
-
forcedDestinationTokenSymbol,
|
|
16
|
-
onNavigate,
|
|
17
|
-
switchNetwork,
|
|
18
|
-
sdkChains,
|
|
19
|
-
activeChain
|
|
1
|
+
import { useRef as _, useState as Q, useMemo as p, useCallback as O, useEffect as z } from "react";
|
|
2
|
+
import { sameBridgeApiChainId as m } from "../../../helpers/resolveBridgeApiChainId.mjs";
|
|
3
|
+
import { getInitialTokens as n } from "../../../utils/getInitialTokens.mjs";
|
|
4
|
+
import { getAvailableTokens as x, getDefaultReceivingToken as i, updateUrlParams as N } from "../utils/bridgeFormHelpers.mjs";
|
|
5
|
+
const ee = ({
|
|
6
|
+
chains: f,
|
|
7
|
+
firstTokenIdentifier: D,
|
|
8
|
+
secondTokenIdentifier: F,
|
|
9
|
+
fromTokens: s,
|
|
10
|
+
toTokens: t,
|
|
11
|
+
isTokensLoading: o,
|
|
12
|
+
activeChainId: C,
|
|
13
|
+
mvxChainId: g,
|
|
14
|
+
callbackRoute: E,
|
|
15
|
+
forcedDestinationTokenSymbol: M,
|
|
16
|
+
onNavigate: j,
|
|
17
|
+
switchNetwork: w,
|
|
18
|
+
sdkChains: I,
|
|
19
|
+
activeChain: y
|
|
20
20
|
}) => {
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (mvxChainId) {
|
|
27
|
-
return token.chainId.toString().toLowerCase() === mvxChainId.toString().toLowerCase();
|
|
28
|
-
}
|
|
29
|
-
return true;
|
|
30
|
-
}).map((token) => ({
|
|
31
|
-
...token,
|
|
32
|
-
identifier: token.address,
|
|
33
|
-
ticker: token.symbol
|
|
21
|
+
const U = _(!1), [d, S] = Q(), [l, A] = Q(), L = p(
|
|
22
|
+
() => (s == null ? void 0 : s.filter((e) => g ? e.chainId.toString().toLowerCase() === g.toString().toLowerCase() : !0).map((e) => ({
|
|
23
|
+
...e,
|
|
24
|
+
identifier: e.address,
|
|
25
|
+
ticker: e.symbol
|
|
34
26
|
}))) ?? [],
|
|
35
|
-
[
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
forcedDestinationTokenSymbol
|
|
27
|
+
[s, g]
|
|
28
|
+
), P = O(
|
|
29
|
+
(e) => x(
|
|
30
|
+
e,
|
|
31
|
+
t,
|
|
32
|
+
M
|
|
42
33
|
),
|
|
43
|
-
[
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
identifier: token.address,
|
|
54
|
-
ticker: token.symbol
|
|
55
|
-
}))) ?? [];
|
|
56
|
-
}, [firstToken == null ? void 0 : firstToken.symbol, toTokens]);
|
|
57
|
-
const selectedChainOption = useMemo(() => {
|
|
58
|
-
const anchorToken = mvxChainId ? secondToken : firstToken;
|
|
59
|
-
const byAnchorToken = anchorToken && (chains == null ? void 0 : chains.find(
|
|
60
|
-
(option) => sameBridgeApiChainId(option.chainId, anchorToken.chainId)
|
|
34
|
+
[t, M]
|
|
35
|
+
), V = p(() => d ? (t == null ? void 0 : t.filter(
|
|
36
|
+
(e) => e.symbol.toLowerCase() === d.symbol.toLowerCase()
|
|
37
|
+
).map((e) => ({
|
|
38
|
+
...e,
|
|
39
|
+
identifier: e.address,
|
|
40
|
+
ticker: e.symbol
|
|
41
|
+
}))) ?? [] : [], [d == null ? void 0 : d.symbol, t]), W = p(() => {
|
|
42
|
+
const e = g ? l : d, r = e && (f == null ? void 0 : f.find(
|
|
43
|
+
(c) => m(c.chainId, e.chainId)
|
|
61
44
|
));
|
|
62
|
-
if (
|
|
63
|
-
return
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
(option) => sameBridgeApiChainId(option.chainId, activeChain == null ? void 0 : activeChain.id)
|
|
45
|
+
if (r)
|
|
46
|
+
return r;
|
|
47
|
+
const u = f == null ? void 0 : f.find(
|
|
48
|
+
(c) => m(c.chainId, y == null ? void 0 : y.id)
|
|
67
49
|
);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
)) : secondToken && (chains == null ? void 0 : chains.find(
|
|
74
|
-
(option) => sameBridgeApiChainId(option.chainId, secondToken.chainId)
|
|
75
|
-
));
|
|
76
|
-
return byOtherToken ?? (chains == null ? void 0 : chains[0]);
|
|
50
|
+
return u || ((g ? d && (f == null ? void 0 : f.find(
|
|
51
|
+
(c) => m(c.chainId, d.chainId)
|
|
52
|
+
)) : l && (f == null ? void 0 : f.find(
|
|
53
|
+
(c) => m(c.chainId, l.chainId)
|
|
54
|
+
))) ?? (f == null ? void 0 : f[0]));
|
|
77
55
|
}, [
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
])
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
);
|
|
88
|
-
const updateUrlParams$1 = useCallback(
|
|
56
|
+
y == null ? void 0 : y.id,
|
|
57
|
+
f,
|
|
58
|
+
d == null ? void 0 : d.chainId,
|
|
59
|
+
g,
|
|
60
|
+
l == null ? void 0 : l.chainId
|
|
61
|
+
]), R = O(
|
|
62
|
+
(e) => i(e, t),
|
|
63
|
+
[t]
|
|
64
|
+
), b = O(
|
|
89
65
|
({
|
|
90
|
-
firstTokenId,
|
|
91
|
-
secondTokenId
|
|
66
|
+
firstTokenId: e,
|
|
67
|
+
secondTokenId: r
|
|
92
68
|
}) => {
|
|
93
|
-
|
|
94
|
-
firstTokenId,
|
|
95
|
-
secondTokenId,
|
|
96
|
-
callbackRoute,
|
|
97
|
-
isTokensLoading,
|
|
98
|
-
onNavigate
|
|
69
|
+
N({
|
|
70
|
+
firstTokenId: e,
|
|
71
|
+
secondTokenId: r,
|
|
72
|
+
callbackRoute: E,
|
|
73
|
+
isTokensLoading: o,
|
|
74
|
+
onNavigate: j
|
|
99
75
|
});
|
|
100
76
|
},
|
|
101
|
-
[
|
|
102
|
-
)
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if (!option) {
|
|
77
|
+
[E, o, j]
|
|
78
|
+
), X = O(
|
|
79
|
+
(e) => {
|
|
80
|
+
if (!e)
|
|
106
81
|
return;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
let secondOption = toTokens == null ? void 0 : toTokens.find(
|
|
111
|
-
(x) => x.symbol.toLowerCase() === option.symbol.toLowerCase()
|
|
82
|
+
S(e), b({ firstTokenId: e.address });
|
|
83
|
+
let r = t == null ? void 0 : t.find(
|
|
84
|
+
(u) => u.symbol.toLowerCase() === e.symbol.toLowerCase()
|
|
112
85
|
);
|
|
113
|
-
if (!
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
(
|
|
117
|
-
) ??
|
|
118
|
-
}
|
|
119
|
-
if (secondOption) {
|
|
120
|
-
setSecondToken(secondOption);
|
|
121
|
-
updateUrlParams$1({ secondTokenId: secondOption.address });
|
|
86
|
+
if (!r) {
|
|
87
|
+
const u = P(e);
|
|
88
|
+
r = u.find(
|
|
89
|
+
($) => $.symbol.toLowerCase() === e.symbol.toLowerCase()
|
|
90
|
+
) ?? R(u);
|
|
122
91
|
}
|
|
92
|
+
r && (A(r), b({ secondTokenId: r.address }));
|
|
123
93
|
},
|
|
124
|
-
[
|
|
125
|
-
)
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
if (!option) {
|
|
94
|
+
[P, R, b, t]
|
|
95
|
+
), Y = O(
|
|
96
|
+
(e) => {
|
|
97
|
+
if (!e)
|
|
129
98
|
return;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
const firstOption = fromOptions.find(
|
|
134
|
-
(x) => x.symbol.toLowerCase() === option.symbol.toLowerCase()
|
|
99
|
+
A(e), b({ secondTokenId: e.address });
|
|
100
|
+
const r = L.find(
|
|
101
|
+
(u) => u.symbol.toLowerCase() === e.symbol.toLowerCase()
|
|
135
102
|
);
|
|
136
|
-
|
|
137
|
-
setFirstToken(firstOption);
|
|
138
|
-
updateUrlParams$1({ firstTokenId: firstOption.address });
|
|
139
|
-
}
|
|
103
|
+
r && (S(r), b({ firstTokenId: r.address }));
|
|
140
104
|
},
|
|
141
|
-
[
|
|
142
|
-
)
|
|
143
|
-
|
|
144
|
-
if (!firstToken || !secondToken) {
|
|
105
|
+
[L, b]
|
|
106
|
+
), Z = O(() => {
|
|
107
|
+
if (!d || !l)
|
|
145
108
|
return;
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
updateUrlParams$1({
|
|
150
|
-
firstTokenId: secondToken.address,
|
|
151
|
-
secondTokenId: firstToken.address
|
|
109
|
+
S(l), A(d), b({
|
|
110
|
+
firstTokenId: l.address,
|
|
111
|
+
secondTokenId: d.address
|
|
152
112
|
});
|
|
153
|
-
const
|
|
154
|
-
(
|
|
113
|
+
const e = I == null ? void 0 : I.find(
|
|
114
|
+
(r) => m(r.id, l.chainId)
|
|
155
115
|
);
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
var _a, _b, _c, _d;
|
|
162
|
-
if (isTokensLoading || initializedInitialTokensRef.current || !fromOptions.length) {
|
|
116
|
+
e && w && w(e);
|
|
117
|
+
}, [d, l, b, I, w]);
|
|
118
|
+
return z(() => {
|
|
119
|
+
var q, G, H, J;
|
|
120
|
+
if (o || U.current || !L.length)
|
|
163
121
|
return;
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
initializedInitialTokensRef.current = true;
|
|
122
|
+
if (d && l) {
|
|
123
|
+
U.current = !0;
|
|
167
124
|
return;
|
|
168
125
|
}
|
|
169
|
-
const
|
|
170
|
-
firstTokenId:
|
|
171
|
-
secondTokenId:
|
|
172
|
-
})
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
(x) => x.symbol.toLowerCase() === (firstOption == null ? void 0 : firstOption.symbol.toLowerCase())
|
|
126
|
+
const e = n({
|
|
127
|
+
firstTokenId: D,
|
|
128
|
+
secondTokenId: F
|
|
129
|
+
}), r = L.find(
|
|
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())
|
|
180
136
|
);
|
|
181
|
-
if (!
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
({ address }) => {
|
|
185
|
-
var
|
|
186
|
-
return
|
|
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());
|
|
187
143
|
}
|
|
188
|
-
)) ??
|
|
189
|
-
(
|
|
190
|
-
) ??
|
|
144
|
+
)) ?? a.find(
|
|
145
|
+
(B) => B.symbol.toLowerCase() === (r == null ? void 0 : r.symbol.toLowerCase())
|
|
146
|
+
) ?? R(a);
|
|
191
147
|
}
|
|
192
|
-
|
|
193
|
-
if (hasOptionsSelected) {
|
|
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()))
|
|
194
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;
|
|
195
157
|
}
|
|
196
|
-
|
|
197
|
-
if (firstOption) {
|
|
198
|
-
setFirstToken(firstOption);
|
|
199
|
-
updateUrlParams$1({ firstTokenId: firstOption.address });
|
|
200
|
-
const selectedOptionChain = (sdkChains == null ? void 0 : sdkChains.find(
|
|
201
|
-
(chain) => sameBridgeApiChainId(chain.id, firstOption.chainId)
|
|
202
|
-
)) ?? activeChain;
|
|
203
|
-
if (selectedOptionChain && switchNetwork) {
|
|
204
|
-
switchNetwork(selectedOptionChain);
|
|
205
|
-
}
|
|
206
|
-
initialized = true;
|
|
207
|
-
}
|
|
208
|
-
if (secondOption) {
|
|
209
|
-
setSecondToken(secondOption);
|
|
210
|
-
updateUrlParams$1({ secondTokenId: secondOption.address });
|
|
211
|
-
initialized = initialized && true;
|
|
212
|
-
}
|
|
213
|
-
initializedInitialTokensRef.current = initialized;
|
|
158
|
+
u && (A(u), b({ secondTokenId: u.address }), c = c && !0), U.current = c;
|
|
214
159
|
}, [
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
useEffect(() => {
|
|
231
|
-
const selectedTokenOption = fromTokens == null ? void 0 : fromTokens.find(
|
|
232
|
-
(x) => x.address === (firstToken == null ? void 0 : firstToken.address)
|
|
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)
|
|
233
175
|
);
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}
|
|
239
|
-
}, [fromTokens, firstToken == null ? void 0 : firstToken.address]);
|
|
240
|
-
useEffect(() => {
|
|
241
|
-
const selectedTokenOption = toTokens == null ? void 0 : toTokens.find(
|
|
242
|
-
(x) => x.address === (secondToken == null ? void 0 : secondToken.address)
|
|
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)
|
|
243
180
|
);
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
setSecondToken,
|
|
258
|
-
onChangeFirstSelect,
|
|
259
|
-
onChangeSecondSelect,
|
|
260
|
-
handleChangeDirection,
|
|
261
|
-
updateUrlParams: updateUrlParams$1
|
|
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
|
|
262
194
|
};
|
|
263
195
|
};
|
|
264
196
|
export {
|
|
265
|
-
useBridgeTokenSelection
|
|
197
|
+
ee as useBridgeTokenSelection
|
|
266
198
|
};
|
|
@@ -1,5 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const reactjs_components_BridgeForm_BridgeForm = require("./BridgeForm.js");
|
|
5
|
-
exports.BridgeForm = reactjs_components_BridgeForm_BridgeForm.BridgeForm;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./BridgeForm.js");exports.BridgeForm=e.BridgeForm;
|
|
@@ -1,77 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const types_chainType = require("../../../../types/chainType.js");
|
|
5
|
-
const reactjs_constants_index = require("../../../constants/index.js");
|
|
6
|
-
const reactjs_utils_getCompletePathname = require("../../../utils/getCompletePathname.js");
|
|
7
|
-
const updateUrlParams = ({
|
|
8
|
-
firstTokenId,
|
|
9
|
-
secondTokenId,
|
|
10
|
-
callbackRoute,
|
|
11
|
-
isTokensLoading,
|
|
12
|
-
onNavigate
|
|
13
|
-
}) => {
|
|
14
|
-
if (isTokensLoading) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
const currentUrl = reactjs_utils_getCompletePathname.getCompletePathname();
|
|
18
|
-
const searchParams = new URLSearchParams(reactjs_constants_index.safeWindow.location.search);
|
|
19
|
-
if (firstTokenId) {
|
|
20
|
-
searchParams.set("firstToken", firstTokenId);
|
|
21
|
-
}
|
|
22
|
-
if (secondTokenId) {
|
|
23
|
-
searchParams.set("secondToken", secondTokenId);
|
|
24
|
-
}
|
|
25
|
-
const newUrl = `${callbackRoute}?${searchParams.toString()}`;
|
|
26
|
-
if (currentUrl === newUrl) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
onNavigate == null ? void 0 : onNavigate(newUrl, { replace: true });
|
|
30
|
-
};
|
|
31
|
-
function resolveSigningChainType(transaction, fallbackChain) {
|
|
32
|
-
var _a, _b;
|
|
33
|
-
if (((_a = transaction.suiParams) == null ? void 0 : _a.transactionBytes) && ((_b = transaction.suiParams) == null ? void 0 : _b.sender)) {
|
|
34
|
-
return types_chainType.ChainType.sui;
|
|
35
|
-
}
|
|
36
|
-
if (transaction.instructions && transaction.feePayer) {
|
|
37
|
-
return types_chainType.ChainType.sol;
|
|
38
|
-
}
|
|
39
|
-
if (transaction.bitcoinParams) {
|
|
40
|
-
return types_chainType.ChainType.btc;
|
|
41
|
-
}
|
|
42
|
-
if (transaction.to && transaction.data !== void 0) {
|
|
43
|
-
return types_chainType.ChainType.evm;
|
|
44
|
-
}
|
|
45
|
-
return fallbackChain == null ? void 0 : fallbackChain.chainType;
|
|
46
|
-
}
|
|
47
|
-
const getAvailableTokens = (option, targetTokens, forcedDestinationTokenSymbol) => {
|
|
48
|
-
if (forcedDestinationTokenSymbol) {
|
|
49
|
-
const forcedToken = targetTokens == null ? void 0 : targetTokens.find(
|
|
50
|
-
(token) => token.symbol.toLowerCase() === forcedDestinationTokenSymbol.toLowerCase()
|
|
51
|
-
);
|
|
52
|
-
if (forcedToken) {
|
|
53
|
-
return [forcedToken];
|
|
54
|
-
}
|
|
55
|
-
return [];
|
|
56
|
-
}
|
|
57
|
-
if (!(option == null ? void 0 : option.availableTokens)) {
|
|
58
|
-
return [];
|
|
59
|
-
}
|
|
60
|
-
const foundTokens = [];
|
|
61
|
-
for (const availableToken of option.availableTokens) {
|
|
62
|
-
const foundToken = targetTokens == null ? void 0 : targetTokens.find(
|
|
63
|
-
(token) => token.address.toLowerCase() === availableToken.address.toLowerCase()
|
|
64
|
-
);
|
|
65
|
-
if (foundToken) {
|
|
66
|
-
foundTokens.push(foundToken);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return foundTokens;
|
|
70
|
-
};
|
|
71
|
-
const getDefaultReceivingToken = (values, fallbackTokens) => {
|
|
72
|
-
return values.find((x) => x.symbol.toLowerCase().includes("usdc")) ?? (fallbackTokens == null ? void 0 : fallbackTokens.find((x) => x.symbol.toLowerCase().includes("usdc")));
|
|
73
|
-
};
|
|
74
|
-
exports.getAvailableTokens = getAvailableTokens;
|
|
75
|
-
exports.getDefaultReceivingToken = getDefaultReceivingToken;
|
|
76
|
-
exports.resolveSigningChainType = resolveSigningChainType;
|
|
77
|
-
exports.updateUrlParams = updateUrlParams;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../../../types/chainType.js"),f=require("../../../constants/index.js"),l=require("../../../utils/getCompletePathname.js"),y=({firstTokenId:e,secondTokenId:r,callbackRoute:s,isTokensLoading:n,onNavigate:i})=>{var o,a;if(n)return;const u=l.getCompletePathname(),t=new URLSearchParams(f.safeWindow.location.search);e&&t.set("firstToken",e),r&&t.set("secondToken",r);const d=`${s}?${t.toString()}`;u!==d&&((a=(o=f.safeWindow.history)==null?void 0:o.replaceState)==null||a.call(o,null,"",d),i==null||i(d,{replace:!0}))};function m(e,r){var s,n;return(s=e.suiParams)!=null&&s.transactionBytes&&((n=e.suiParams)!=null&&n.sender)?c.ChainType.sui:e.instructions&&e.feePayer?c.ChainType.sol:e.bitcoinParams?c.ChainType.btc:e.to&&e.data!==void 0?c.ChainType.evm:r==null?void 0:r.chainType}const p=(e,r,s)=>{if(s){const i=r==null?void 0:r.find(u=>u.symbol.toLowerCase()===s.toLowerCase());return i?[i]:[]}if(!(e!=null&&e.availableTokens))return[];const n=[];for(const i of e.availableTokens){const u=r==null?void 0:r.find(t=>t.address.toLowerCase()===i.address.toLowerCase());u&&n.push(u)}return n},h=(e,r)=>e.find(s=>s.symbol.toLowerCase().includes("usdc"))??(r==null?void 0:r.find(s=>s.symbol.toLowerCase().includes("usdc")));exports.getAvailableTokens=p;exports.getDefaultReceivingToken=h;exports.resolveSigningChainType=m;exports.updateUrlParams=y;
|
|
@@ -1,76 +1,46 @@
|
|
|
1
|
-
import { ChainType } from "../../../../types/chainType.mjs";
|
|
2
|
-
import { safeWindow } from "../../../constants/index.mjs";
|
|
3
|
-
import { getCompletePathname } from "../../../utils/getCompletePathname.mjs";
|
|
4
|
-
const
|
|
5
|
-
firstTokenId,
|
|
6
|
-
secondTokenId,
|
|
7
|
-
callbackRoute,
|
|
8
|
-
isTokensLoading,
|
|
9
|
-
onNavigate
|
|
1
|
+
import { ChainType as t } from "../../../../types/chainType.mjs";
|
|
2
|
+
import { safeWindow as c } from "../../../constants/index.mjs";
|
|
3
|
+
import { getCompletePathname as w } from "../../../utils/getCompletePathname.mjs";
|
|
4
|
+
const p = ({
|
|
5
|
+
firstTokenId: e,
|
|
6
|
+
secondTokenId: r,
|
|
7
|
+
callbackRoute: s,
|
|
8
|
+
isTokensLoading: i,
|
|
9
|
+
onNavigate: u
|
|
10
10
|
}) => {
|
|
11
|
-
|
|
11
|
+
var n, m;
|
|
12
|
+
if (i)
|
|
12
13
|
return;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
searchParams.set("firstToken", firstTokenId);
|
|
18
|
-
}
|
|
19
|
-
if (secondTokenId) {
|
|
20
|
-
searchParams.set("secondToken", secondTokenId);
|
|
21
|
-
}
|
|
22
|
-
const newUrl = `${callbackRoute}?${searchParams.toString()}`;
|
|
23
|
-
if (currentUrl === newUrl) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
onNavigate == null ? void 0 : onNavigate(newUrl, { replace: true });
|
|
14
|
+
const o = w(), f = new URLSearchParams(c.location.search);
|
|
15
|
+
e && f.set("firstToken", e), r && f.set("secondToken", r);
|
|
16
|
+
const d = `${s}?${f.toString()}`;
|
|
17
|
+
o !== d && ((m = (n = c.history) == null ? void 0 : n.replaceState) == null || m.call(n, null, "", d), u == null || u(d, { replace: !0 }));
|
|
27
18
|
};
|
|
28
|
-
function
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
return ChainType.sui;
|
|
32
|
-
}
|
|
33
|
-
if (transaction.instructions && transaction.feePayer) {
|
|
34
|
-
return ChainType.sol;
|
|
35
|
-
}
|
|
36
|
-
if (transaction.bitcoinParams) {
|
|
37
|
-
return ChainType.btc;
|
|
38
|
-
}
|
|
39
|
-
if (transaction.to && transaction.data !== void 0) {
|
|
40
|
-
return ChainType.evm;
|
|
41
|
-
}
|
|
42
|
-
return fallbackChain == null ? void 0 : fallbackChain.chainType;
|
|
19
|
+
function L(e, r) {
|
|
20
|
+
var s, i;
|
|
21
|
+
return (s = e.suiParams) != null && s.transactionBytes && ((i = e.suiParams) != null && i.sender) ? t.sui : e.instructions && e.feePayer ? t.sol : e.bitcoinParams ? t.btc : e.to && e.data !== void 0 ? t.evm : r == null ? void 0 : r.chainType;
|
|
43
22
|
}
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
46
|
-
const
|
|
47
|
-
(
|
|
23
|
+
const h = (e, r, s) => {
|
|
24
|
+
if (s) {
|
|
25
|
+
const u = r == null ? void 0 : r.find(
|
|
26
|
+
(o) => o.symbol.toLowerCase() === s.toLowerCase()
|
|
48
27
|
);
|
|
49
|
-
|
|
50
|
-
return [forcedToken];
|
|
51
|
-
}
|
|
52
|
-
return [];
|
|
28
|
+
return u ? [u] : [];
|
|
53
29
|
}
|
|
54
|
-
if (!(
|
|
30
|
+
if (!(e != null && e.availableTokens))
|
|
55
31
|
return [];
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
(token) => token.address.toLowerCase() === availableToken.address.toLowerCase()
|
|
32
|
+
const i = [];
|
|
33
|
+
for (const u of e.availableTokens) {
|
|
34
|
+
const o = r == null ? void 0 : r.find(
|
|
35
|
+
(f) => f.address.toLowerCase() === u.address.toLowerCase()
|
|
61
36
|
);
|
|
62
|
-
|
|
63
|
-
foundTokens.push(foundToken);
|
|
64
|
-
}
|
|
37
|
+
o && i.push(o);
|
|
65
38
|
}
|
|
66
|
-
return
|
|
67
|
-
};
|
|
68
|
-
const getDefaultReceivingToken = (values, fallbackTokens) => {
|
|
69
|
-
return values.find((x) => x.symbol.toLowerCase().includes("usdc")) ?? (fallbackTokens == null ? void 0 : fallbackTokens.find((x) => x.symbol.toLowerCase().includes("usdc")));
|
|
70
|
-
};
|
|
39
|
+
return i;
|
|
40
|
+
}, C = (e, r) => e.find((s) => s.symbol.toLowerCase().includes("usdc")) ?? (r == null ? void 0 : r.find((s) => s.symbol.toLowerCase().includes("usdc")));
|
|
71
41
|
export {
|
|
72
|
-
getAvailableTokens,
|
|
73
|
-
getDefaultReceivingToken,
|
|
74
|
-
resolveSigningChainType,
|
|
75
|
-
updateUrlParams
|
|
42
|
+
h as getAvailableTokens,
|
|
43
|
+
C as getDefaultReceivingToken,
|
|
44
|
+
L as resolveSigningChainType,
|
|
45
|
+
p as updateUrlParams
|
|
76
46
|
};
|