@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,132 +1,112 @@
|
|
|
1
|
-
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { faChevronDown } from "@fortawesome/free-solid-svg-icons/faChevronDown";
|
|
3
|
-
import { faWallet } from "@fortawesome/free-solid-svg-icons/faWallet";
|
|
4
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
5
|
-
import { useState, useMemo, useEffect } from "react";
|
|
6
|
-
import { SelectContainer } from "./components/SelectContainer.mjs";
|
|
7
|
-
import { SelectContent } from "./components/SelectContent.mjs";
|
|
8
|
-
import { SelectedOption } from "./components/SelectedOption.mjs";
|
|
9
|
-
import { MVX_CHAIN_IDS } from "../../../constants/index.mjs";
|
|
10
|
-
import { useResolveTokenChain } from "../../hooks/useResolveTokenChain.mjs";
|
|
11
|
-
import { useGetChainsQuery } from "../../queries/useGetChains.query.mjs";
|
|
12
|
-
import { mxClsx } from "../../utils/mxClsx.mjs";
|
|
13
|
-
import { MxButton } from "../base/MxButton/MxButton.mjs";
|
|
14
|
-
import { DisplayAmount } from "../DisplayAmount/DisplayAmount.mjs";
|
|
15
|
-
const
|
|
16
|
-
name,
|
|
17
|
-
options = [],
|
|
18
|
-
selectedOption,
|
|
19
|
-
areOptionsLoading =
|
|
20
|
-
className = "",
|
|
21
|
-
disabled =
|
|
22
|
-
isMvxSelector =
|
|
23
|
-
omitDisableClass =
|
|
24
|
-
isDestination =
|
|
25
|
-
color = "neutral-750",
|
|
26
|
-
onBlur,
|
|
27
|
-
onChange,
|
|
28
|
-
onMaxBtnClick,
|
|
29
|
-
onTokenSelectorDisplay
|
|
1
|
+
import { jsx as l, jsxs as n, Fragment as D } from "react/jsx-runtime";
|
|
2
|
+
import { faChevronDown as F } from "@fortawesome/free-solid-svg-icons/faChevronDown";
|
|
3
|
+
import { faWallet as V } from "@fortawesome/free-solid-svg-icons/faWallet";
|
|
4
|
+
import { FontAwesomeIcon as p } from "@fortawesome/react-fontawesome";
|
|
5
|
+
import { useState as X, useMemo as x, useEffect as _ } from "react";
|
|
6
|
+
import { SelectContainer as z } from "./components/SelectContainer.mjs";
|
|
7
|
+
import { SelectContent as E } from "./components/SelectContent.mjs";
|
|
8
|
+
import { SelectedOption as G } from "./components/SelectedOption.mjs";
|
|
9
|
+
import { MVX_CHAIN_IDS as v } from "../../../constants/index.mjs";
|
|
10
|
+
import { useResolveTokenChain as H } from "../../hooks/useResolveTokenChain.mjs";
|
|
11
|
+
import { useGetChainsQuery as Q } from "../../queries/useGetChains.query.mjs";
|
|
12
|
+
import { mxClsx as C } from "../../utils/mxClsx.mjs";
|
|
13
|
+
import { MxButton as R } from "../base/MxButton/MxButton.mjs";
|
|
14
|
+
import { DisplayAmount as W } from "../DisplayAmount/DisplayAmount.mjs";
|
|
15
|
+
const rl = ({
|
|
16
|
+
name: m,
|
|
17
|
+
options: N = [],
|
|
18
|
+
selectedOption: i,
|
|
19
|
+
areOptionsLoading: w = !1,
|
|
20
|
+
className: c = "",
|
|
21
|
+
disabled: f = !1,
|
|
22
|
+
isMvxSelector: t = !1,
|
|
23
|
+
omitDisableClass: y = !1,
|
|
24
|
+
isDestination: d = !1,
|
|
25
|
+
color: a = "neutral-750",
|
|
26
|
+
onBlur: I,
|
|
27
|
+
onChange: k,
|
|
28
|
+
onMaxBtnClick: h,
|
|
29
|
+
onTokenSelectorDisplay: q
|
|
30
30
|
}) => {
|
|
31
|
-
const [
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
31
|
+
const [o, u] = X(!1), { data: e, isLoading: b } = Q(), { chainIcon: g } = H({
|
|
32
|
+
token: i
|
|
33
|
+
}), A = x(() => t ? (e == null ? void 0 : e.filter(
|
|
34
|
+
(r) => v.includes(r.chainId.toString())
|
|
35
|
+
)) ?? [] : (e == null ? void 0 : e.filter(
|
|
36
|
+
(r) => !v.includes(r.chainId.toString())
|
|
37
|
+
)) ?? [], [e, t]), S = x(() => t && d, [t, d]), s = f || S, j = () => u(!0), L = (w || b) && !i;
|
|
38
|
+
return _(() => {
|
|
39
|
+
q == null || q(o);
|
|
40
|
+
}, [o]), L ? /* @__PURE__ */ l(
|
|
41
|
+
"div",
|
|
42
|
+
{
|
|
43
|
+
className: C(
|
|
44
|
+
"liq-h-12 liq-w-40 liq-animate-pulse",
|
|
45
|
+
{
|
|
46
|
+
"liq-rounded-xl": !0,
|
|
47
|
+
"liq-rounded-e-lg liq-rounded-s-3xl": !0
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"liq-bg-neutral-100 liq-bg-opacity-[0.1] hover:liq-bg-opacity-[0.25]": a === "neutral-750",
|
|
51
|
+
"liq-bg-neutral-100 liq-bg-opacity-[0.05] hover:liq-bg-opacity-[0.15]": a === "neutral-850"
|
|
52
|
+
},
|
|
53
|
+
c
|
|
54
|
+
)
|
|
41
55
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}, [data, isMvxSelector]);
|
|
46
|
-
const isDestinationMvx = useMemo(() => {
|
|
47
|
-
const shouldDisable = isMvxSelector && isDestination;
|
|
48
|
-
return shouldDisable;
|
|
49
|
-
}, [isMvxSelector, isDestination]);
|
|
50
|
-
const isVisuallyDisabled = disabled || isDestinationMvx;
|
|
51
|
-
const handleOnClick = () => setShow(true);
|
|
52
|
-
const showLoadingSkeleton = (areOptionsLoading || areChainsLoading) && !selectedOption;
|
|
53
|
-
useEffect(() => {
|
|
54
|
-
onTokenSelectorDisplay == null ? void 0 : onTokenSelectorDisplay(show);
|
|
55
|
-
}, [show]);
|
|
56
|
-
if (showLoadingSkeleton) {
|
|
57
|
-
return /* @__PURE__ */ jsx(
|
|
58
|
-
"div",
|
|
59
|
-
{
|
|
60
|
-
className: mxClsx(
|
|
61
|
-
"liq-h-12 liq-w-40 liq-animate-pulse",
|
|
62
|
-
{
|
|
63
|
-
"liq-rounded-xl": true,
|
|
64
|
-
"liq-rounded-e-lg liq-rounded-s-3xl": true
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
"liq-bg-neutral-100 liq-bg-opacity-[0.1] hover:liq-bg-opacity-[0.25]": color === "neutral-750",
|
|
68
|
-
"liq-bg-neutral-100 liq-bg-opacity-[0.05] hover:liq-bg-opacity-[0.15]": color === "neutral-850"
|
|
69
|
-
},
|
|
70
|
-
className
|
|
71
|
-
)
|
|
72
|
-
}
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
76
|
-
show && /* @__PURE__ */ jsx(SelectContainer, { onClose: () => setShow(false), children: /* @__PURE__ */ jsx(
|
|
77
|
-
SelectContent,
|
|
56
|
+
) : /* @__PURE__ */ n(D, { children: [
|
|
57
|
+
o && /* @__PURE__ */ l(z, { onClose: () => u(!1), children: /* @__PURE__ */ l(
|
|
58
|
+
E,
|
|
78
59
|
{
|
|
79
|
-
onSelect: (
|
|
80
|
-
|
|
81
|
-
setShow(false);
|
|
60
|
+
onSelect: (r) => {
|
|
61
|
+
k(r), u(!1);
|
|
82
62
|
},
|
|
83
|
-
tokens:
|
|
84
|
-
chains,
|
|
85
|
-
isMvxSelector,
|
|
86
|
-
areChainsLoading,
|
|
87
|
-
selectedToken:
|
|
63
|
+
tokens: N,
|
|
64
|
+
chains: A,
|
|
65
|
+
isMvxSelector: t,
|
|
66
|
+
areChainsLoading: b,
|
|
67
|
+
selectedToken: i
|
|
88
68
|
}
|
|
89
69
|
) }),
|
|
90
|
-
!
|
|
91
|
-
/* @__PURE__ */
|
|
70
|
+
!o && /* @__PURE__ */ n("div", { className: "liq-flex liq-flex-col liq-items-end liq-justify-between liq-gap-4", children: [
|
|
71
|
+
/* @__PURE__ */ n(
|
|
92
72
|
"button",
|
|
93
73
|
{
|
|
94
|
-
name,
|
|
74
|
+
name: m,
|
|
95
75
|
type: "button",
|
|
96
76
|
role: "combobox",
|
|
97
|
-
className:
|
|
77
|
+
className: C(
|
|
98
78
|
"focus-primary liq-group liq-flex liq-cursor-pointer liq-items-center liq-gap-2 liq-transition-colors liq-duration-200 liq-relative",
|
|
99
79
|
{
|
|
100
|
-
"liq-rounded-e-lg liq-rounded-s-3xl liq-px-1 liq-py-1 liq-pr-3":
|
|
80
|
+
"liq-rounded-e-lg liq-rounded-s-3xl liq-px-1 liq-py-1 liq-pr-3": !0
|
|
101
81
|
},
|
|
102
82
|
{
|
|
103
|
-
"liq-bg-neutral-750/50 hover:enabled:liq-bg-neutral-750":
|
|
104
|
-
"liq-bg-neutral-900/50 liq-outline liq-outline-1 liq-outline-neutral-700/20 hover:enabled:liq-bg-neutral-600/50 hover:enabled:liq-outline-neutral-600":
|
|
83
|
+
"liq-bg-neutral-750/50 hover:enabled:liq-bg-neutral-750": a === "neutral-750",
|
|
84
|
+
"liq-bg-neutral-900/50 liq-outline liq-outline-1 liq-outline-neutral-700/20 hover:enabled:liq-bg-neutral-600/50 hover:enabled:liq-outline-neutral-600": a === "neutral-850"
|
|
105
85
|
},
|
|
106
86
|
{
|
|
107
|
-
"disabled:!liq-opacity-70":
|
|
87
|
+
"disabled:!liq-opacity-70": s && !y
|
|
108
88
|
},
|
|
109
89
|
{
|
|
110
|
-
"!liq-cursor-not-allowed !liq-bg-transparent !liq-outline-transparent":
|
|
90
|
+
"!liq-cursor-not-allowed !liq-bg-transparent !liq-outline-transparent": s
|
|
111
91
|
},
|
|
112
|
-
|
|
92
|
+
c
|
|
113
93
|
),
|
|
114
|
-
onBlur,
|
|
115
|
-
onClick:
|
|
116
|
-
disabled:
|
|
94
|
+
onBlur: I,
|
|
95
|
+
onClick: j,
|
|
96
|
+
disabled: s,
|
|
117
97
|
children: [
|
|
118
|
-
/* @__PURE__ */
|
|
119
|
-
!
|
|
120
|
-
|
|
98
|
+
/* @__PURE__ */ l(G, { value: i }),
|
|
99
|
+
!s && /* @__PURE__ */ l(
|
|
100
|
+
p,
|
|
121
101
|
{
|
|
122
|
-
icon:
|
|
102
|
+
icon: F,
|
|
123
103
|
className: "liq-text-neutral-200 group-hover:liq-text-neutral-50"
|
|
124
104
|
}
|
|
125
105
|
),
|
|
126
|
-
|
|
106
|
+
g && /* @__PURE__ */ l(
|
|
127
107
|
"img",
|
|
128
108
|
{
|
|
129
|
-
src:
|
|
109
|
+
src: g,
|
|
130
110
|
alt: "",
|
|
131
111
|
className: "liq-absolute liq-left-6 liq-bottom-[2px] liq-chain-icon liq-sm liq-w-6 liq-h-6 liq-border-[3px] liq-border-neutral-850 liq-rounded-lg"
|
|
132
112
|
}
|
|
@@ -134,33 +114,33 @@ const TokenSelector = ({
|
|
|
134
114
|
]
|
|
135
115
|
}
|
|
136
116
|
),
|
|
137
|
-
/* @__PURE__ */
|
|
138
|
-
/* @__PURE__ */
|
|
139
|
-
/* @__PURE__ */
|
|
140
|
-
|
|
117
|
+
/* @__PURE__ */ l("div", { className: "liq-flex liq-items-center liq-gap-3", children: /* @__PURE__ */ n("div", { className: "liq-flex liq-items-center liq-gap-3", children: [
|
|
118
|
+
/* @__PURE__ */ n("div", { className: "liq-flex liq-items-center liq-gap-1", children: [
|
|
119
|
+
/* @__PURE__ */ l(
|
|
120
|
+
p,
|
|
141
121
|
{
|
|
142
|
-
icon:
|
|
122
|
+
icon: V,
|
|
143
123
|
className: "liq-text-neutral-300"
|
|
144
124
|
}
|
|
145
125
|
),
|
|
146
|
-
/* @__PURE__ */
|
|
147
|
-
|
|
126
|
+
/* @__PURE__ */ l(
|
|
127
|
+
W,
|
|
148
128
|
{
|
|
149
|
-
"data-testid": `${
|
|
150
|
-
decimals:
|
|
151
|
-
amount: (
|
|
129
|
+
"data-testid": `${m}-balance`,
|
|
130
|
+
decimals: i == null ? void 0 : i.decimals,
|
|
131
|
+
amount: (i == null ? void 0 : i.balance) ?? "0",
|
|
152
132
|
className: "liq-font-medium liq-text-neutral-100"
|
|
153
133
|
}
|
|
154
134
|
)
|
|
155
135
|
] }),
|
|
156
|
-
|
|
157
|
-
|
|
136
|
+
h && /* @__PURE__ */ l(
|
|
137
|
+
R,
|
|
158
138
|
{
|
|
159
139
|
btnSize: "xs",
|
|
160
140
|
variant: "neutral-800",
|
|
161
|
-
disabled,
|
|
162
|
-
onClick:
|
|
163
|
-
children: /* @__PURE__ */
|
|
141
|
+
disabled: f,
|
|
142
|
+
onClick: h,
|
|
143
|
+
children: /* @__PURE__ */ l("span", { className: "liq-text-neutral-300", children: "MAX" })
|
|
164
144
|
}
|
|
165
145
|
)
|
|
166
146
|
] }) })
|
|
@@ -168,5 +148,5 @@ const TokenSelector = ({
|
|
|
168
148
|
] });
|
|
169
149
|
};
|
|
170
150
|
export {
|
|
171
|
-
TokenSelector
|
|
151
|
+
rl as TokenSelector
|
|
172
152
|
};
|
|
@@ -1,95 +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 Select = require("react-select");
|
|
7
|
-
const helpers_getDisplayName = require("../../../../../helpers/getDisplayName.js");
|
|
8
|
-
const reactjs_components_TokenSelector_components_ChainSelect_components_FormatChainOptionLabel = require("./components/FormatChainOptionLabel.js");
|
|
9
|
-
const reactjs_components_TokenSelector_components_ChainSelect_components_IndicatorSeparator = require("./components/IndicatorSeparator.js");
|
|
10
|
-
const reactjs_components_TokenSelector_components_ChainSelect_components_SelectedChainOption = require("./components/SelectedChainOption.js");
|
|
11
|
-
require("../../../../constants/index.js");
|
|
12
|
-
const reactjs_constants_chains = require("../../../../constants/chains.js");
|
|
13
|
-
const ChainSelect = ({
|
|
14
|
-
isLoading,
|
|
15
|
-
selectedChainId,
|
|
16
|
-
ignoreAllChains = false,
|
|
17
|
-
onChange,
|
|
18
|
-
chains
|
|
19
|
-
}) => {
|
|
20
|
-
const chainOptions = React.useMemo(() => {
|
|
21
|
-
const options = chains.map((chain) => ({
|
|
22
|
-
label: chain.networkName,
|
|
23
|
-
value: chain.chainId.toString(),
|
|
24
|
-
chain: {
|
|
25
|
-
id: chain.chainId.toString(),
|
|
26
|
-
name: helpers_getDisplayName.getDisplayName(chain),
|
|
27
|
-
networkName: chain.networkName,
|
|
28
|
-
svgUrl: chain.svgUrl,
|
|
29
|
-
pngUrl: chain.pngUrl
|
|
30
|
-
}
|
|
31
|
-
}));
|
|
32
|
-
if (ignoreAllChains) {
|
|
33
|
-
return options;
|
|
34
|
-
}
|
|
35
|
-
options.unshift({
|
|
36
|
-
label: "All",
|
|
37
|
-
value: reactjs_constants_chains.ALL_NETWORK_ID,
|
|
38
|
-
chain: {
|
|
39
|
-
id: reactjs_constants_chains.ALL_NETWORK_ID,
|
|
40
|
-
name: "all",
|
|
41
|
-
networkName: "All",
|
|
42
|
-
svgUrl: "https://cdn.multiversx.com/liquidity-sdk/all-networks.svg",
|
|
43
|
-
pngUrl: "https://cdn.multiversx.com/liquidity-sdk/all-networks.svg"
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
return options;
|
|
47
|
-
}, [chains]);
|
|
48
|
-
const selectedChain = React.useMemo(() => {
|
|
49
|
-
return chainOptions.find(
|
|
50
|
-
(chainOption) => chainOption.value.toString() === (selectedChainId == null ? void 0 : selectedChainId.toString())
|
|
51
|
-
) ?? (chainOptions == null ? void 0 : chainOptions[0]);
|
|
52
|
-
}, [chainOptions, selectedChainId]);
|
|
53
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "styled-chain-select", "data-testid": "chainDropdown", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
54
|
-
Select,
|
|
55
|
-
{
|
|
56
|
-
className: "basic-single",
|
|
57
|
-
classNamePrefix: "styled-chain-select",
|
|
58
|
-
maxMenuHeight: 260,
|
|
59
|
-
value: selectedChain,
|
|
60
|
-
isLoading,
|
|
61
|
-
styles: {
|
|
62
|
-
indicatorSeparator: reactjs_components_TokenSelector_components_ChainSelect_components_IndicatorSeparator.IndicatorSeparator,
|
|
63
|
-
control: (css) => ({
|
|
64
|
-
...css,
|
|
65
|
-
width: "max-content",
|
|
66
|
-
minWidth: "100%",
|
|
67
|
-
maxWidth: "10rem"
|
|
68
|
-
}),
|
|
69
|
-
menu: (css) => ({
|
|
70
|
-
...css,
|
|
71
|
-
zIndex: 9999,
|
|
72
|
-
width: "max-content",
|
|
73
|
-
minWidth: "100%",
|
|
74
|
-
right: 0
|
|
75
|
-
})
|
|
76
|
-
},
|
|
77
|
-
isSearchable: true,
|
|
78
|
-
name: "chain",
|
|
79
|
-
options: chainOptions,
|
|
80
|
-
onChange: (selectedOption) => {
|
|
81
|
-
var _a, _b;
|
|
82
|
-
if ((_a = selectedOption == null ? void 0 : selectedOption.chain) == null ? void 0 : _a.id) {
|
|
83
|
-
onChange == null ? void 0 : onChange((_b = selectedOption.chain) == null ? void 0 : _b.id.toString());
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
isMulti: false,
|
|
87
|
-
formatOptionLabel: reactjs_components_TokenSelector_components_ChainSelect_components_FormatChainOptionLabel.FormatChainOptionLabel,
|
|
88
|
-
components: {
|
|
89
|
-
Input: () => null,
|
|
90
|
-
SingleValue: reactjs_components_TokenSelector_components_ChainSelect_components_SelectedChainOption.SelectedChainOption
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
) });
|
|
94
|
-
};
|
|
95
|
-
exports.ChainSelect = ChainSelect;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),l=require("react"),_=require("react-select"),S=require("../../../../../helpers/getDisplayName.js"),d=require("./components/FormatChainOptionLabel.js"),g=require("./components/IndicatorSeparator.js"),h=require("./components/SelectedChainOption.js");require("../../../../constants/index.js");const c=require("../../../../constants/chains.js"),v=({isLoading:m,selectedChainId:r,ignoreAllChains:u=!1,onChange:o,chains:i})=>{const n=l.useMemo(()=>{const e=i.map(t=>({label:t.networkName,value:t.chainId.toString(),chain:{id:t.chainId.toString(),name:S.getDisplayName(t),networkName:t.networkName,svgUrl:t.svgUrl,pngUrl:t.pngUrl}}));return u||e.unshift({label:"All",value:c.ALL_NETWORK_ID,chain:{id:c.ALL_NETWORK_ID,name:"all",networkName:"All",svgUrl:"https://cdn.multiversx.com/liquidity-sdk/all-networks.svg",pngUrl:"https://cdn.multiversx.com/liquidity-sdk/all-networks.svg"}}),e},[i]),p=l.useMemo(()=>n.find(e=>e.value.toString()===(r==null?void 0:r.toString()))??(n==null?void 0:n[0]),[n,r]);return s.jsx("div",{className:"styled-chain-select","data-testid":"chainDropdown",children:s.jsx(_,{className:"basic-single",classNamePrefix:"styled-chain-select",maxMenuHeight:260,value:p,isLoading:m,styles:{indicatorSeparator:g.IndicatorSeparator,control:e=>({...e,width:"max-content",minWidth:"100%",maxWidth:"10rem"}),menu:e=>({...e,zIndex:9999,width:"max-content",minWidth:"100%",right:0})},isSearchable:!0,name:"chain",options:n,onChange:e=>{var t,a;(t=e==null?void 0:e.chain)!=null&&t.id&&(o==null||o((a=e.chain)==null?void 0:a.id.toString()))},isMulti:!1,formatOptionLabel:d.FormatChainOptionLabel,components:{Input:()=>null,SingleValue:h.SelectedChainOption}})})};exports.ChainSelect=v;
|
|
@@ -1,94 +1,85 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo } from "react";
|
|
3
|
-
import
|
|
4
|
-
import { getDisplayName } from "../../../../../helpers/getDisplayName.mjs";
|
|
5
|
-
import { FormatChainOptionLabel } from "./components/FormatChainOptionLabel.mjs";
|
|
6
|
-
import { IndicatorSeparator } from "./components/IndicatorSeparator.mjs";
|
|
7
|
-
import { SelectedChainOption } from "./components/SelectedChainOption.mjs";
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as e } from "react";
|
|
3
|
+
import f from "react-select";
|
|
4
|
+
import { getDisplayName as d } from "../../../../../helpers/getDisplayName.mjs";
|
|
5
|
+
import { FormatChainOptionLabel as g } from "./components/FormatChainOptionLabel.mjs";
|
|
6
|
+
import { IndicatorSeparator as v } from "./components/IndicatorSeparator.mjs";
|
|
7
|
+
import { SelectedChainOption as S } from "./components/SelectedChainOption.mjs";
|
|
8
8
|
import "../../../../constants/index.mjs";
|
|
9
|
-
import { ALL_NETWORK_ID } from "../../../../constants/chains.mjs";
|
|
10
|
-
const
|
|
11
|
-
isLoading,
|
|
12
|
-
selectedChainId,
|
|
13
|
-
ignoreAllChains =
|
|
14
|
-
onChange,
|
|
15
|
-
chains
|
|
9
|
+
import { ALL_NETWORK_ID as s } from "../../../../constants/chains.mjs";
|
|
10
|
+
const W = ({
|
|
11
|
+
isLoading: p,
|
|
12
|
+
selectedChainId: o,
|
|
13
|
+
ignoreAllChains: u = !1,
|
|
14
|
+
onChange: a,
|
|
15
|
+
chains: m
|
|
16
16
|
}) => {
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
label:
|
|
20
|
-
value:
|
|
17
|
+
const i = e(() => {
|
|
18
|
+
const t = m.map((r) => ({
|
|
19
|
+
label: r.networkName,
|
|
20
|
+
value: r.chainId.toString(),
|
|
21
21
|
chain: {
|
|
22
|
-
id:
|
|
23
|
-
name:
|
|
24
|
-
networkName:
|
|
25
|
-
svgUrl:
|
|
26
|
-
pngUrl:
|
|
22
|
+
id: r.chainId.toString(),
|
|
23
|
+
name: d(r),
|
|
24
|
+
networkName: r.networkName,
|
|
25
|
+
svgUrl: r.svgUrl,
|
|
26
|
+
pngUrl: r.pngUrl
|
|
27
27
|
}
|
|
28
28
|
}));
|
|
29
|
-
|
|
30
|
-
return options;
|
|
31
|
-
}
|
|
32
|
-
options.unshift({
|
|
29
|
+
return u || t.unshift({
|
|
33
30
|
label: "All",
|
|
34
|
-
value:
|
|
31
|
+
value: s,
|
|
35
32
|
chain: {
|
|
36
|
-
id:
|
|
33
|
+
id: s,
|
|
37
34
|
name: "all",
|
|
38
35
|
networkName: "All",
|
|
39
36
|
svgUrl: "https://cdn.multiversx.com/liquidity-sdk/all-networks.svg",
|
|
40
37
|
pngUrl: "https://cdn.multiversx.com/liquidity-sdk/all-networks.svg"
|
|
41
38
|
}
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
) ?? (chainOptions == null ? void 0 : chainOptions[0]);
|
|
49
|
-
}, [chainOptions, selectedChainId]);
|
|
50
|
-
return /* @__PURE__ */ jsx("div", { className: "styled-chain-select", "data-testid": "chainDropdown", children: /* @__PURE__ */ jsx(
|
|
51
|
-
Select,
|
|
39
|
+
}), t;
|
|
40
|
+
}, [m]), c = e(() => i.find(
|
|
41
|
+
(t) => t.value.toString() === (o == null ? void 0 : o.toString())
|
|
42
|
+
) ?? (i == null ? void 0 : i[0]), [i, o]);
|
|
43
|
+
return /* @__PURE__ */ n("div", { className: "styled-chain-select", "data-testid": "chainDropdown", children: /* @__PURE__ */ n(
|
|
44
|
+
f,
|
|
52
45
|
{
|
|
53
46
|
className: "basic-single",
|
|
54
47
|
classNamePrefix: "styled-chain-select",
|
|
55
48
|
maxMenuHeight: 260,
|
|
56
|
-
value:
|
|
57
|
-
isLoading,
|
|
49
|
+
value: c,
|
|
50
|
+
isLoading: p,
|
|
58
51
|
styles: {
|
|
59
|
-
indicatorSeparator:
|
|
60
|
-
control: (
|
|
61
|
-
...
|
|
52
|
+
indicatorSeparator: v,
|
|
53
|
+
control: (t) => ({
|
|
54
|
+
...t,
|
|
62
55
|
width: "max-content",
|
|
63
56
|
minWidth: "100%",
|
|
64
57
|
maxWidth: "10rem"
|
|
65
58
|
}),
|
|
66
|
-
menu: (
|
|
67
|
-
...
|
|
59
|
+
menu: (t) => ({
|
|
60
|
+
...t,
|
|
68
61
|
zIndex: 9999,
|
|
69
62
|
width: "max-content",
|
|
70
63
|
minWidth: "100%",
|
|
71
64
|
right: 0
|
|
72
65
|
})
|
|
73
66
|
},
|
|
74
|
-
isSearchable:
|
|
67
|
+
isSearchable: !0,
|
|
75
68
|
name: "chain",
|
|
76
|
-
options:
|
|
77
|
-
onChange: (
|
|
78
|
-
var
|
|
79
|
-
|
|
80
|
-
onChange == null ? void 0 : onChange((_b = selectedOption.chain) == null ? void 0 : _b.id.toString());
|
|
81
|
-
}
|
|
69
|
+
options: i,
|
|
70
|
+
onChange: (t) => {
|
|
71
|
+
var r, l;
|
|
72
|
+
(r = t == null ? void 0 : t.chain) != null && r.id && (a == null || a((l = t.chain) == null ? void 0 : l.id.toString()));
|
|
82
73
|
},
|
|
83
|
-
isMulti:
|
|
84
|
-
formatOptionLabel:
|
|
74
|
+
isMulti: !1,
|
|
75
|
+
formatOptionLabel: g,
|
|
85
76
|
components: {
|
|
86
77
|
Input: () => null,
|
|
87
|
-
SingleValue:
|
|
78
|
+
SingleValue: S
|
|
88
79
|
}
|
|
89
80
|
}
|
|
90
81
|
) });
|
|
91
82
|
};
|
|
92
83
|
export {
|
|
93
|
-
ChainSelect
|
|
84
|
+
W as ChainSelect
|
|
94
85
|
};
|
package/reactjs/components/TokenSelector/components/ChainSelect/components/ChainOptionLabel.js
CHANGED
|
@@ -1,52 +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
|
-
require("@multiversx/sdk-dapp-utils/out/helpers/formatAmount");
|
|
6
|
-
require("@multiversx/sdk-dapp-utils/out/helpers/stringIsInteger");
|
|
7
|
-
require("bignumber.js");
|
|
8
|
-
require("../../../../../constants/index.js");
|
|
9
|
-
require("@multiversx/sdk-dapp-utils/out/helpers/parseAmount");
|
|
10
|
-
const reactjs_utils_mxClsx = require("../../../../../utils/mxClsx.js");
|
|
11
|
-
const allNetworks = require("../../../../../../all-networks-NYACMyeN.js");
|
|
12
|
-
const reactjs_constants_chains = require("../../../../../constants/chains.js");
|
|
13
|
-
const ChainOptionLabel = ({
|
|
14
|
-
chain,
|
|
15
|
-
inDropdown = false
|
|
16
|
-
}) => {
|
|
17
|
-
const inDropdownClass = inDropdown ? "in-dropdown" : "hidden md:flex";
|
|
18
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
19
|
-
"div",
|
|
20
|
-
{
|
|
21
|
-
className: `chain-element liq-flex liq-items-center liq-justify-between`,
|
|
22
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liq-flex liq-flex-row liq-items-center", children: [
|
|
23
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `chain-image liq-mr-2 ${inDropdownClass}`, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-h-6 liq-w-6 liq-flex-shrink-0 liq-overflow-hidden", children: chain.pngUrl ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
24
|
-
"img",
|
|
25
|
-
{
|
|
26
|
-
src: chain.pngUrl ?? reactjs_constants_chains.chainIdentifier[chain.name],
|
|
27
|
-
alt: "",
|
|
28
|
-
loading: "lazy",
|
|
29
|
-
className: reactjs_utils_mxClsx.mxClsx("liq-h-full liq-w-full", {
|
|
30
|
-
"liq-rounded-lg": chain.id !== reactjs_constants_chains.ALL_NETWORK_ID
|
|
31
|
-
})
|
|
32
|
-
}
|
|
33
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
34
|
-
"img",
|
|
35
|
-
{
|
|
36
|
-
src: allNetworks.AllNetworks,
|
|
37
|
-
alt: "",
|
|
38
|
-
className: "liq-h-full liq-w-full"
|
|
39
|
-
}
|
|
40
|
-
) }) }),
|
|
41
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-flex liq-flex-col", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-flex liq-items-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
42
|
-
"div",
|
|
43
|
-
{
|
|
44
|
-
className: "chain-name liq-flex liq-items-center liq-gap-2 liq-whitespace-nowrap",
|
|
45
|
-
children: chain.networkName
|
|
46
|
-
}
|
|
47
|
-
) }) })
|
|
48
|
-
] })
|
|
49
|
-
}
|
|
50
|
-
);
|
|
51
|
-
};
|
|
52
|
-
exports.ChainOptionLabel = ChainOptionLabel;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime");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"),a=require("../../../../../../helpers/safeImageUrl.js"),t=require("../../../../../../all-networks--dfVLHLJ.js"),i=require("../../../../../constants/chains.js"),c=({chain:l,inDropdown:s=!1})=>{const r=s?"in-dropdown":"hidden md:flex";return e.jsx("div",{className:"chain-element liq-flex liq-items-center liq-justify-between",children:e.jsxs("div",{className:"liq-flex liq-flex-row liq-items-center",children:[e.jsx("div",{className:`chain-image liq-mr-2 ${r}`,children:e.jsx("div",{className:"liq-h-6 liq-w-6 liq-flex-shrink-0 liq-overflow-hidden",children:l.pngUrl?e.jsx("img",{src:a.safeImageUrl(l.pngUrl,i.chainIdentifier[l.name]),alt:"",loading:"lazy",className:n.mxClsx("liq-h-full liq-w-full",{"liq-rounded-lg":l.id!==i.ALL_NETWORK_ID})}):e.jsx("img",{src:t.AllNetworks,alt:"",className:"liq-h-full liq-w-full"})})}),e.jsx("div",{className:"liq-flex liq-flex-col",children:e.jsx("div",{className:"liq-flex liq-items-center",children:e.jsx("div",{className:"chain-name liq-flex liq-items-center liq-gap-2 liq-whitespace-nowrap",children:l.networkName})})})]})})};exports.ChainOptionLabel=c;
|