@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
package/reactjs/components/TokenSelector/components/ChainSelect/components/ChainOptionLabel.mjs
CHANGED
|
@@ -1,51 +1,52 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as l, jsxs as r } from "react/jsx-runtime";
|
|
2
2
|
import "@multiversx/sdk-dapp-utils/out/helpers/formatAmount";
|
|
3
3
|
import "@multiversx/sdk-dapp-utils/out/helpers/stringIsInteger";
|
|
4
4
|
import "bignumber.js";
|
|
5
5
|
import "../../../../../constants/index.mjs";
|
|
6
6
|
import "@multiversx/sdk-dapp-utils/out/helpers/parseAmount";
|
|
7
|
-
import { mxClsx } from "../../../../../utils/mxClsx.mjs";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
children: /* @__PURE__ */
|
|
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
|
-
}
|
|
7
|
+
import { mxClsx as s } from "../../../../../utils/mxClsx.mjs";
|
|
8
|
+
import { safeImageUrl as m } from "../../../../../../helpers/safeImageUrl.mjs";
|
|
9
|
+
import { A as a } from "../../../../../../all-networks-Czd8zS1n.mjs";
|
|
10
|
+
import { ALL_NETWORK_ID as n, chainIdentifier as o } from "../../../../../constants/chains.mjs";
|
|
11
|
+
const v = ({
|
|
12
|
+
chain: i,
|
|
13
|
+
inDropdown: e = !1
|
|
14
|
+
}) => /* @__PURE__ */ l(
|
|
15
|
+
"div",
|
|
16
|
+
{
|
|
17
|
+
className: "chain-element liq-flex liq-items-center liq-justify-between",
|
|
18
|
+
children: /* @__PURE__ */ r("div", { className: "liq-flex liq-flex-row liq-items-center", children: [
|
|
19
|
+
/* @__PURE__ */ l("div", { className: `chain-image liq-mr-2 ${e ? "in-dropdown" : "hidden md:flex"}`, children: /* @__PURE__ */ l("div", { className: "liq-h-6 liq-w-6 liq-flex-shrink-0 liq-overflow-hidden", children: i.pngUrl ? /* @__PURE__ */ l(
|
|
20
|
+
"img",
|
|
21
|
+
{
|
|
22
|
+
src: m(
|
|
23
|
+
i.pngUrl,
|
|
24
|
+
o[i.name]
|
|
25
|
+
),
|
|
26
|
+
alt: "",
|
|
27
|
+
loading: "lazy",
|
|
28
|
+
className: s("liq-h-full liq-w-full", {
|
|
29
|
+
"liq-rounded-lg": i.id !== n
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
) : /* @__PURE__ */ l(
|
|
33
|
+
"img",
|
|
34
|
+
{
|
|
35
|
+
src: a,
|
|
36
|
+
alt: "",
|
|
37
|
+
className: "liq-h-full liq-w-full"
|
|
38
|
+
}
|
|
39
|
+
) }) }),
|
|
40
|
+
/* @__PURE__ */ l("div", { className: "liq-flex liq-flex-col", children: /* @__PURE__ */ l("div", { className: "liq-flex liq-items-center", children: /* @__PURE__ */ l(
|
|
41
|
+
"div",
|
|
42
|
+
{
|
|
43
|
+
className: "chain-name liq-flex liq-items-center liq-gap-2 liq-whitespace-nowrap",
|
|
44
|
+
children: i.networkName
|
|
45
|
+
}
|
|
46
|
+
) }) })
|
|
47
|
+
] })
|
|
48
|
+
}
|
|
49
|
+
);
|
|
49
50
|
export {
|
|
50
|
-
ChainOptionLabel
|
|
51
|
+
v as ChainOptionLabel
|
|
51
52
|
};
|
package/reactjs/components/TokenSelector/components/ChainSelect/components/FormatChainOptionLabel.js
CHANGED
|
@@ -1,19 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
5
|
-
const reactjs_components_TokenSelector_components_ChainSelect_components_ChainOptionLabel = require("./ChainOptionLabel.js");
|
|
6
|
-
const reactjs_components_SmallLoader_SmallLoader = require("../../../../SmallLoader/SmallLoader.js");
|
|
7
|
-
const FormatChainOptionLabel = (option, { context }) => {
|
|
8
|
-
const { chain } = option;
|
|
9
|
-
const inDropdown = context === "menu";
|
|
10
|
-
const args = {
|
|
11
|
-
chain,
|
|
12
|
-
inDropdown
|
|
13
|
-
};
|
|
14
|
-
if (option.value === "loader") {
|
|
15
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-flex liq-justify-center liq-py-5", children: /* @__PURE__ */ jsxRuntime.jsx(reactjs_components_SmallLoader_SmallLoader.SmallLoader, { show: true }) });
|
|
16
|
-
}
|
|
17
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactjs_components_TokenSelector_components_ChainSelect_components_ChainOptionLabel.ChainOptionLabel, { ...args });
|
|
18
|
-
};
|
|
19
|
-
exports.FormatChainOptionLabel = FormatChainOptionLabel;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("./ChainOptionLabel.js"),i=require("../../../../SmallLoader/SmallLoader.js"),s=(n,{context:o})=>{const{chain:t}=n,r={chain:t,inDropdown:o==="menu"};return n.value==="loader"?e.jsx("div",{className:"liq-flex liq-justify-center liq-py-5",children:e.jsx(i.SmallLoader,{show:!0})}):e.jsx(a.ChainOptionLabel,{...r})};exports.FormatChainOptionLabel=s;
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { ChainOptionLabel } from "./ChainOptionLabel.mjs";
|
|
3
|
-
import { SmallLoader } from "../../../../SmallLoader/SmallLoader.mjs";
|
|
4
|
-
const
|
|
5
|
-
const { chain } =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
chain,
|
|
9
|
-
inDropdown
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { ChainOptionLabel as t } from "./ChainOptionLabel.mjs";
|
|
3
|
+
import { SmallLoader as a } from "../../../../SmallLoader/SmallLoader.mjs";
|
|
4
|
+
const p = (o, { context: n }) => {
|
|
5
|
+
const { chain: i } = o, e = {
|
|
6
|
+
chain: i,
|
|
7
|
+
inDropdown: n === "menu"
|
|
10
8
|
};
|
|
11
|
-
|
|
12
|
-
return /* @__PURE__ */ jsx("div", { className: "liq-flex liq-justify-center liq-py-5", children: /* @__PURE__ */ jsx(SmallLoader, { show: true }) });
|
|
13
|
-
}
|
|
14
|
-
return /* @__PURE__ */ jsx(ChainOptionLabel, { ...args });
|
|
9
|
+
return o.value === "loader" ? /* @__PURE__ */ r("div", { className: "liq-flex liq-justify-center liq-py-5", children: /* @__PURE__ */ r(a, { show: !0 }) }) : /* @__PURE__ */ r(t, { ...e });
|
|
15
10
|
};
|
|
16
11
|
export {
|
|
17
|
-
FormatChainOptionLabel
|
|
12
|
+
p as FormatChainOptionLabel
|
|
18
13
|
};
|
package/reactjs/components/TokenSelector/components/ChainSelect/components/IndicatorSeparator.js
CHANGED
|
@@ -1,7 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const IndicatorSeparator = () => {
|
|
5
|
-
return { display: "none" };
|
|
6
|
-
};
|
|
7
|
-
exports.IndicatorSeparator = IndicatorSeparator;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=()=>({display:"none"});exports.IndicatorSeparator=e;
|
package/reactjs/components/TokenSelector/components/ChainSelect/components/SelectedChainOption.js
CHANGED
|
@@ -1,40 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
5
|
-
const Select = require("react-select");
|
|
6
|
-
require("@multiversx/sdk-dapp-utils/out/helpers/formatAmount");
|
|
7
|
-
require("@multiversx/sdk-dapp-utils/out/helpers/stringIsInteger");
|
|
8
|
-
require("bignumber.js");
|
|
9
|
-
require("../../../../../constants/index.js");
|
|
10
|
-
require("@multiversx/sdk-dapp-utils/out/helpers/parseAmount");
|
|
11
|
-
const reactjs_utils_mxClsx = require("../../../../../utils/mxClsx.js");
|
|
12
|
-
const allNetworks = require("../../../../../../all-networks-NYACMyeN.js");
|
|
13
|
-
const reactjs_constants_chains = require("../../../../../constants/chains.js");
|
|
14
|
-
const SelectedChainOption = ({
|
|
15
|
-
...props
|
|
16
|
-
}) => {
|
|
17
|
-
const {
|
|
18
|
-
selectProps: { onMenuOpen },
|
|
19
|
-
data: { chain }
|
|
20
|
-
} = props;
|
|
21
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Select.components.SingleValue, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
22
|
-
"div",
|
|
23
|
-
{
|
|
24
|
-
className: "liq-h-6 liq-w-6 liq-flex liq-justify-between liq-items-center liq-cursor-pointer",
|
|
25
|
-
onClick: onMenuOpen,
|
|
26
|
-
children: (chain == null ? void 0 : chain.pngUrl) ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
27
|
-
"img",
|
|
28
|
-
{
|
|
29
|
-
src: chain.pngUrl ?? reactjs_constants_chains.chainIdentifier[chain.name],
|
|
30
|
-
alt: "",
|
|
31
|
-
loading: "lazy",
|
|
32
|
-
className: reactjs_utils_mxClsx.mxClsx("liq-h-full liq-w-full", {
|
|
33
|
-
"liq-rounded-lg": (chain == null ? void 0 : chain.id) !== reactjs_constants_chains.ALL_NETWORK_ID
|
|
34
|
-
})
|
|
35
|
-
}
|
|
36
|
-
) : /* @__PURE__ */ jsxRuntime.jsx("img", { src: allNetworks.AllNetworks, alt: "", className: "liq-h-full liq-w-full" })
|
|
37
|
-
}
|
|
38
|
-
) });
|
|
39
|
-
};
|
|
40
|
-
exports.SelectedChainOption = SelectedChainOption;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),t=require("react-select");require("@multiversx/sdk-dapp-utils/out/helpers/formatAmount");require("@multiversx/sdk-dapp-utils/out/helpers/stringIsInteger");require("bignumber.js");require("../../../../../constants/index.js");require("@multiversx/sdk-dapp-utils/out/helpers/parseAmount");const n=require("../../../../../utils/mxClsx.js"),c=require("../../../../../../helpers/safeImageUrl.js"),u=require("../../../../../../all-networks--dfVLHLJ.js"),i=require("../../../../../constants/chains.js"),o=({...r})=>{const{selectProps:{onMenuOpen:s},data:{chain:e}}=r;return l.jsx(t.components.SingleValue,{...r,children:l.jsx("div",{className:"liq-h-6 liq-w-6 liq-flex liq-justify-between liq-items-center liq-cursor-pointer",onClick:s,children:e!=null&&e.pngUrl?l.jsx("img",{src:c.safeImageUrl(e.pngUrl,i.chainIdentifier[e.name]),alt:"",loading:"lazy",className:n.mxClsx("liq-h-full liq-w-full",{"liq-rounded-lg":(e==null?void 0:e.id)!==i.ALL_NETWORK_ID})}):l.jsx("img",{src:u.AllNetworks,alt:"",className:"liq-h-full liq-w-full"})})})};exports.SelectedChainOption=o;
|
package/reactjs/components/TokenSelector/components/ChainSelect/components/SelectedChainOption.mjs
CHANGED
|
@@ -1,39 +1,43 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { components } from "react-select";
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { components as o } from "react-select";
|
|
3
3
|
import "@multiversx/sdk-dapp-utils/out/helpers/formatAmount";
|
|
4
4
|
import "@multiversx/sdk-dapp-utils/out/helpers/stringIsInteger";
|
|
5
5
|
import "bignumber.js";
|
|
6
6
|
import "../../../../../constants/index.mjs";
|
|
7
7
|
import "@multiversx/sdk-dapp-utils/out/helpers/parseAmount";
|
|
8
|
-
import { mxClsx } from "../../../../../utils/mxClsx.mjs";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
import { mxClsx as t } from "../../../../../utils/mxClsx.mjs";
|
|
9
|
+
import { safeImageUrl as m } from "../../../../../../helpers/safeImageUrl.mjs";
|
|
10
|
+
import { A as n } from "../../../../../../all-networks-Czd8zS1n.mjs";
|
|
11
|
+
import { ALL_NETWORK_ID as s, chainIdentifier as p } from "../../../../../constants/chains.mjs";
|
|
12
|
+
const A = ({
|
|
13
|
+
...r
|
|
13
14
|
}) => {
|
|
14
15
|
const {
|
|
15
|
-
selectProps: { onMenuOpen },
|
|
16
|
-
data: { chain }
|
|
17
|
-
} =
|
|
18
|
-
return /* @__PURE__ */
|
|
16
|
+
selectProps: { onMenuOpen: e },
|
|
17
|
+
data: { chain: l }
|
|
18
|
+
} = r;
|
|
19
|
+
return /* @__PURE__ */ i(o.SingleValue, { ...r, children: /* @__PURE__ */ i(
|
|
19
20
|
"div",
|
|
20
21
|
{
|
|
21
22
|
className: "liq-h-6 liq-w-6 liq-flex liq-justify-between liq-items-center liq-cursor-pointer",
|
|
22
|
-
onClick:
|
|
23
|
-
children:
|
|
23
|
+
onClick: e,
|
|
24
|
+
children: l != null && l.pngUrl ? /* @__PURE__ */ i(
|
|
24
25
|
"img",
|
|
25
26
|
{
|
|
26
|
-
src:
|
|
27
|
+
src: m(
|
|
28
|
+
l.pngUrl,
|
|
29
|
+
p[l.name]
|
|
30
|
+
),
|
|
27
31
|
alt: "",
|
|
28
32
|
loading: "lazy",
|
|
29
|
-
className:
|
|
30
|
-
"liq-rounded-lg": (
|
|
33
|
+
className: t("liq-h-full liq-w-full", {
|
|
34
|
+
"liq-rounded-lg": (l == null ? void 0 : l.id) !== s
|
|
31
35
|
})
|
|
32
36
|
}
|
|
33
|
-
) : /* @__PURE__ */
|
|
37
|
+
) : /* @__PURE__ */ i("img", { src: n, alt: "", className: "liq-h-full liq-w-full" })
|
|
34
38
|
}
|
|
35
39
|
) });
|
|
36
40
|
};
|
|
37
41
|
export {
|
|
38
|
-
SelectedChainOption
|
|
42
|
+
A as SelectedChainOption
|
|
39
43
|
};
|
|
@@ -1,41 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
5
|
-
const faClose = require("@fortawesome/free-solid-svg-icons/faClose");
|
|
6
|
-
const reactFontawesome = require("@fortawesome/react-fontawesome");
|
|
7
|
-
const reactjs_utils_mxClsx = require("../../../utils/mxClsx.js");
|
|
8
|
-
const reactjs_components_base_MxButton_MxButton = require("../../base/MxButton/MxButton.js");
|
|
9
|
-
const reactjs_components_base_MxCard_MxCard = require("../../base/MxCard/MxCard.js");
|
|
10
|
-
const SelectContainer = ({
|
|
11
|
-
children,
|
|
12
|
-
className,
|
|
13
|
-
onClose
|
|
14
|
-
}) => {
|
|
15
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
16
|
-
reactjs_components_base_MxCard_MxCard.MxCard,
|
|
17
|
-
{
|
|
18
|
-
className: reactjs_utils_mxClsx.mxClsx(
|
|
19
|
-
"liq-flex liq-flex-col liq-absolute liq-left-0 liq-top-0 liq-order-1 liq-mx-auto liq-w-full liq-gap-1 liq-pt-12 lg:liq-order-2 lg:liq-max-w-[27.5rem] !liq-min-h-[26rem] !lg:liq-pt-0 !liq-bg-neutral-850 !liq-z-[15] !liq-p-2 !liq-pointer-events-auto",
|
|
20
|
-
className
|
|
21
|
-
),
|
|
22
|
-
children: [
|
|
23
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liq-flex liq-items-center liq-justify-between", children: [
|
|
24
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-flex liq-flex-1 liq-items-center liq-justify-center liq-text-center liq-text-lg", children: "Select a token" }),
|
|
25
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
26
|
-
reactjs_components_base_MxButton_MxButton.MxButton,
|
|
27
|
-
{
|
|
28
|
-
btnSize: "md",
|
|
29
|
-
className: "liq-border-none !liq-px-2",
|
|
30
|
-
variant: "link-neutral-500",
|
|
31
|
-
onClick: onClose,
|
|
32
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactFontawesome.FontAwesomeIcon, { icon: faClose.faClose, size: "xl" })
|
|
33
|
-
}
|
|
34
|
-
)
|
|
35
|
-
] }),
|
|
36
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "!liq-flex !liq-flex-1 !liq-flex-col !liq-gap-1", children })
|
|
37
|
-
]
|
|
38
|
-
}
|
|
39
|
-
);
|
|
40
|
-
};
|
|
41
|
-
exports.SelectContainer = SelectContainer;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("@fortawesome/free-solid-svg-icons/faClose"),s=require("@fortawesome/react-fontawesome"),r=require("../../../utils/mxClsx.js"),o=require("../../base/MxButton/MxButton.js"),q=require("../../base/MxCard/MxCard.js"),a=({children:l,className:i,onClose:t})=>e.jsxs(q.MxCard,{className:r.mxClsx("liq-flex liq-flex-col liq-absolute liq-left-0 liq-top-0 liq-order-1 liq-mx-auto liq-w-full liq-gap-1 liq-pt-12 lg:liq-order-2 lg:liq-max-w-[27.5rem] !liq-min-h-[26rem] !lg:liq-pt-0 !liq-bg-neutral-850 !liq-z-[15] !liq-p-2 !liq-pointer-events-auto",i),children:[e.jsxs("div",{className:"liq-flex liq-items-center liq-justify-between",children:[e.jsx("div",{className:"liq-flex liq-flex-1 liq-items-center liq-justify-center liq-text-center liq-text-lg",children:"Select a token"}),e.jsx(o.MxButton,{btnSize:"md",className:"liq-border-none !liq-px-2",variant:"link-neutral-500",onClick:t,children:e.jsx(s.FontAwesomeIcon,{icon:n.faClose,size:"xl"})})]}),e.jsx("div",{className:"!liq-flex !liq-flex-1 !liq-flex-col !liq-gap-1",children:l})]});exports.SelectContainer=a;
|
|
@@ -1,40 +1,38 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { faClose } from "@fortawesome/free-solid-svg-icons/faClose";
|
|
3
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
4
|
-
import { mxClsx } from "../../../utils/mxClsx.mjs";
|
|
5
|
-
import { MxButton } from "../../base/MxButton/MxButton.mjs";
|
|
6
|
-
import { MxCard } from "../../base/MxCard/MxCard.mjs";
|
|
7
|
-
const
|
|
8
|
-
children,
|
|
9
|
-
className,
|
|
10
|
-
onClose
|
|
11
|
-
}) =>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
children: [
|
|
20
|
-
/* @__PURE__ */
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
);
|
|
37
|
-
};
|
|
1
|
+
import { jsxs as i, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { faClose as o } from "@fortawesome/free-solid-svg-icons/faClose";
|
|
3
|
+
import { FontAwesomeIcon as q } from "@fortawesome/react-fontawesome";
|
|
4
|
+
import { mxClsx as n } from "../../../utils/mxClsx.mjs";
|
|
5
|
+
import { MxButton as m } from "../../base/MxButton/MxButton.mjs";
|
|
6
|
+
import { MxCard as a } from "../../base/MxCard/MxCard.mjs";
|
|
7
|
+
const u = ({
|
|
8
|
+
children: e,
|
|
9
|
+
className: t,
|
|
10
|
+
onClose: r
|
|
11
|
+
}) => /* @__PURE__ */ i(
|
|
12
|
+
a,
|
|
13
|
+
{
|
|
14
|
+
className: n(
|
|
15
|
+
"liq-flex liq-flex-col liq-absolute liq-left-0 liq-top-0 liq-order-1 liq-mx-auto liq-w-full liq-gap-1 liq-pt-12 lg:liq-order-2 lg:liq-max-w-[27.5rem] !liq-min-h-[26rem] !lg:liq-pt-0 !liq-bg-neutral-850 !liq-z-[15] !liq-p-2 !liq-pointer-events-auto",
|
|
16
|
+
t
|
|
17
|
+
),
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ i("div", { className: "liq-flex liq-items-center liq-justify-between", children: [
|
|
20
|
+
/* @__PURE__ */ l("div", { className: "liq-flex liq-flex-1 liq-items-center liq-justify-center liq-text-center liq-text-lg", children: "Select a token" }),
|
|
21
|
+
/* @__PURE__ */ l(
|
|
22
|
+
m,
|
|
23
|
+
{
|
|
24
|
+
btnSize: "md",
|
|
25
|
+
className: "liq-border-none !liq-px-2",
|
|
26
|
+
variant: "link-neutral-500",
|
|
27
|
+
onClick: r,
|
|
28
|
+
children: /* @__PURE__ */ l(q, { icon: o, size: "xl" })
|
|
29
|
+
}
|
|
30
|
+
)
|
|
31
|
+
] }),
|
|
32
|
+
/* @__PURE__ */ l("div", { className: "!liq-flex !liq-flex-1 !liq-flex-col !liq-gap-1", children: e })
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
);
|
|
38
36
|
export {
|
|
39
|
-
SelectContainer
|
|
37
|
+
u as SelectContainer
|
|
40
38
|
};
|
|
@@ -1,137 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
5
|
-
const React = require("react");
|
|
6
|
-
const reactjs_components_TokenSelector_components_ChainSelect_ChainSelect = require("./ChainSelect/ChainSelect.js");
|
|
7
|
-
const reactjs_components_TokenSelector_components_TokenList = require("./TokenList.js");
|
|
8
|
-
const constants_index = require("../../../../constants/index.js");
|
|
9
|
-
const helpers_getDisplayName = require("../../../../helpers/getDisplayName.js");
|
|
10
|
-
require("../../../constants/index.js");
|
|
11
|
-
const reactjs_components_base_MxSearch_MxSearch = require("../../base/MxSearch/MxSearch.js");
|
|
12
|
-
const reactjs_constants_chains = require("../../../constants/chains.js");
|
|
13
|
-
const SelectContent = ({
|
|
14
|
-
onSelect,
|
|
15
|
-
tokens = [],
|
|
16
|
-
chains = [],
|
|
17
|
-
isMvxSelector = false,
|
|
18
|
-
areChainsLoading,
|
|
19
|
-
selectedToken
|
|
20
|
-
}) => {
|
|
21
|
-
const [filteredTokens, setFilteredTokens] = React.useState(tokens);
|
|
22
|
-
const [selected, setSelected] = React.useState(selectedToken);
|
|
23
|
-
const searchPatternRef = React.useRef("");
|
|
24
|
-
const availableChains = React.useMemo(() => {
|
|
25
|
-
if (isMvxSelector) {
|
|
26
|
-
return chains.filter(
|
|
27
|
-
(chain) => constants_index.MVX_CHAIN_IDS.includes(chain.chainId.toString())
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
return chains.filter(
|
|
31
|
-
(chain) => !constants_index.MVX_CHAIN_IDS.includes(chain.chainId.toString())
|
|
32
|
-
);
|
|
33
|
-
}, [chains, isMvxSelector]);
|
|
34
|
-
const defaultChainId = React.useMemo(() => {
|
|
35
|
-
var _a;
|
|
36
|
-
if (isMvxSelector) {
|
|
37
|
-
const mvxChainWithTokens = availableChains.find(
|
|
38
|
-
(chain) => tokens.some(
|
|
39
|
-
(token) => token.chainId.toString() === chain.chainId.toString()
|
|
40
|
-
)
|
|
41
|
-
);
|
|
42
|
-
return (mvxChainWithTokens == null ? void 0 : mvxChainWithTokens.chainId.toString()) ?? ((_a = availableChains[0]) == null ? void 0 : _a.chainId.toString()) ?? reactjs_constants_chains.ALL_NETWORK_ID;
|
|
43
|
-
}
|
|
44
|
-
return reactjs_constants_chains.ALL_NETWORK_ID;
|
|
45
|
-
}, [availableChains, tokens, isMvxSelector]);
|
|
46
|
-
const [selectedChainId, setSelectedChainId] = React.useState(defaultChainId);
|
|
47
|
-
React.useEffect(() => {
|
|
48
|
-
const isCurrentSelectionValid = availableChains.some(
|
|
49
|
-
(chain) => chain.chainId.toString() === selectedChainId
|
|
50
|
-
);
|
|
51
|
-
if (!isCurrentSelectionValid) {
|
|
52
|
-
setSelectedChainId(defaultChainId);
|
|
53
|
-
}
|
|
54
|
-
}, [defaultChainId, availableChains, selectedChainId]);
|
|
55
|
-
const filteredTokensText = React.useMemo(() => {
|
|
56
|
-
const selectedChain = availableChains.find(
|
|
57
|
-
(chain) => chain.chainId.toString() === selectedChainId
|
|
58
|
-
);
|
|
59
|
-
if (!selectedChain) {
|
|
60
|
-
return `Tokens on all networks (${tokens.length})`;
|
|
61
|
-
}
|
|
62
|
-
return `Tokens on ${helpers_getDisplayName.getDisplayName(selectedChain)} (${filteredTokens.length})`;
|
|
63
|
-
}, [availableChains, filteredTokens.length, selectedChainId, tokens.length]);
|
|
64
|
-
const handleSelect = (token) => {
|
|
65
|
-
setSelected(token);
|
|
66
|
-
onSelect(token);
|
|
67
|
-
};
|
|
68
|
-
const handleSearch = (pattern) => {
|
|
69
|
-
searchPatternRef.current = pattern;
|
|
70
|
-
if (selectedChainId === reactjs_constants_chains.ALL_NETWORK_ID) {
|
|
71
|
-
if (pattern.trim() === "") {
|
|
72
|
-
setFilteredTokens(tokens);
|
|
73
|
-
} else {
|
|
74
|
-
const filtered = tokens.filter(
|
|
75
|
-
(token) => token.symbol.toLowerCase().includes(pattern.toLowerCase())
|
|
76
|
-
);
|
|
77
|
-
setFilteredTokens(filtered);
|
|
78
|
-
}
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
if (pattern.trim() === "") {
|
|
82
|
-
const filtered = tokens.filter(
|
|
83
|
-
(token) => token.chainId.toString() === selectedChainId.toString()
|
|
84
|
-
);
|
|
85
|
-
setFilteredTokens(filtered);
|
|
86
|
-
} else {
|
|
87
|
-
const filtered = tokens.filter(
|
|
88
|
-
(token) => token.symbol.toLowerCase().includes(pattern.toLowerCase()) && token.chainId.toString() === selectedChainId.toString()
|
|
89
|
-
);
|
|
90
|
-
setFilteredTokens(filtered);
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
React.useEffect(() => {
|
|
94
|
-
setFilteredTokens(tokens);
|
|
95
|
-
setSelected(selectedToken);
|
|
96
|
-
searchPatternRef.current = "";
|
|
97
|
-
}, [selectedToken, tokens]);
|
|
98
|
-
React.useEffect(() => {
|
|
99
|
-
handleSearch(searchPatternRef.current);
|
|
100
|
-
}, [selectedChainId, tokens]);
|
|
101
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liq-relative liq-flex liq-max-w-full liq-flex-col liq-rounded-none liq-p-0 !liq-max-h-[22rem]", children: [
|
|
102
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-flex liq-flex-col liq-gap-3 liq-rounded-t-2xl liq-p-2", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liq-flex liq-gap-2", children: [
|
|
103
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
104
|
-
reactjs_components_base_MxSearch_MxSearch.MxSearch,
|
|
105
|
-
{
|
|
106
|
-
inputClassName: "!liq-bg-neutral-750 liq-border liq-border-neutral-750",
|
|
107
|
-
placeholder: "Search token",
|
|
108
|
-
onChange: handleSearch
|
|
109
|
-
}
|
|
110
|
-
),
|
|
111
|
-
!isMvxSelector && /* @__PURE__ */ jsxRuntime.jsx(
|
|
112
|
-
reactjs_components_TokenSelector_components_ChainSelect_ChainSelect.ChainSelect,
|
|
113
|
-
{
|
|
114
|
-
chains: availableChains,
|
|
115
|
-
ignoreAllChains: isMvxSelector,
|
|
116
|
-
selectedChainId,
|
|
117
|
-
onChange: (chainId) => {
|
|
118
|
-
setSelectedChainId(chainId);
|
|
119
|
-
},
|
|
120
|
-
isLoading: areChainsLoading
|
|
121
|
-
}
|
|
122
|
-
)
|
|
123
|
-
] }) }),
|
|
124
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "scrollbar-thin liq-flex liq-flex-col liq-gap-2 liq-overflow-y-scroll liq-border-t liq-border-neutral-750 liq-pb-3", children: [
|
|
125
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-flex liq-text-left liq-text-neutral-300 liq-mt-4 liq-ml-2", children: filteredTokensText }),
|
|
126
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
127
|
-
reactjs_components_TokenSelector_components_TokenList.TokenList,
|
|
128
|
-
{
|
|
129
|
-
tokens: filteredTokens,
|
|
130
|
-
onSelect: handleSelect,
|
|
131
|
-
selectedToken: selected
|
|
132
|
-
}
|
|
133
|
-
)
|
|
134
|
-
] })
|
|
135
|
-
] });
|
|
136
|
-
};
|
|
137
|
-
exports.SelectContent = SelectContent;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),i=require("react"),N=require("./ChainSelect/ChainSelect.js"),T=require("./TokenList.js"),x=require("../../../../constants/index.js"),w=require("../../../../helpers/getDisplayName.js");require("../../../constants/index.js");const y=require("../../base/MxSearch/MxSearch.js"),S=require("../../../constants/chains.js"),D=({onSelect:C,tokens:n=[],chains:d=[],isMvxSelector:o=!1,areChainsLoading:I,selectedToken:u})=>{const[f,a]=i.useState(n),[b,g]=i.useState(u),h=i.useRef(""),r=i.useMemo(()=>o?d.filter(e=>x.MVX_CHAIN_IDS.includes(e.chainId.toString())):d.filter(e=>!x.MVX_CHAIN_IDS.includes(e.chainId.toString())),[d,o]),q=i.useMemo(()=>{var e;if(o){const t=r.find(s=>n.some(L=>L.chainId.toString()===s.chainId.toString()));return(t==null?void 0:t.chainId.toString())??((e=r[0])==null?void 0:e.chainId.toString())??S.ALL_NETWORK_ID}return S.ALL_NETWORK_ID},[r,n,o]),[l,m]=i.useState(q);i.useEffect(()=>{r.some(t=>t.chainId.toString()===l)||m(q)},[q,r,l]);const j=i.useMemo(()=>{const e=r.find(t=>t.chainId.toString()===l);return e?`Tokens on ${w.getDisplayName(e)} (${f.length})`:`Tokens on all networks (${n.length})`},[r,f.length,l,n.length]),p=e=>{g(e),C(e)},_=e=>{if(h.current=e,l===S.ALL_NETWORK_ID){if(e.trim()==="")a(n);else{const t=n.filter(s=>s.symbol.toLowerCase().includes(e.toLowerCase()));a(t)}return}if(e.trim()===""){const t=n.filter(s=>s.chainId.toString()===l.toString());a(t)}else{const t=n.filter(s=>s.symbol.toLowerCase().includes(e.toLowerCase())&&s.chainId.toString()===l.toString());a(t)}};return i.useEffect(()=>{a(n),g(u),h.current=""},[u,n]),i.useEffect(()=>{_(h.current)},[l,n]),c.jsxs("div",{className:"liq-relative liq-flex liq-max-w-full liq-flex-col liq-rounded-none liq-p-0 !liq-max-h-[22rem]",children:[c.jsx("div",{className:"liq-flex liq-flex-col liq-gap-3 liq-rounded-t-2xl liq-p-2",children:c.jsxs("div",{className:"liq-flex liq-gap-2",children:[c.jsx(y.MxSearch,{inputClassName:"!liq-bg-neutral-750 liq-border liq-border-neutral-750",placeholder:"Search token",onChange:_}),!o&&c.jsx(N.ChainSelect,{chains:r,ignoreAllChains:o,selectedChainId:l,onChange:e=>{m(e)},isLoading:I})]})}),c.jsxs("div",{className:"scrollbar-thin liq-flex liq-flex-col liq-gap-2 liq-overflow-y-scroll liq-border-t liq-border-neutral-750 liq-pb-3",children:[c.jsx("div",{className:"liq-flex liq-text-left liq-text-neutral-300 liq-mt-4 liq-ml-2",children:j}),c.jsx(T.TokenList,{tokens:f,onSelect:p,selectedToken:b})]})]})};exports.SelectContent=D;
|