@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,136 +1,112 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useRef, useMemo, useEffect } from "react";
|
|
3
|
-
import { ChainSelect } from "./ChainSelect/ChainSelect.mjs";
|
|
4
|
-
import { TokenList } from "./TokenList.mjs";
|
|
5
|
-
import { MVX_CHAIN_IDS } from "../../../../constants/index.mjs";
|
|
6
|
-
import { getDisplayName } from "../../../../helpers/getDisplayName.mjs";
|
|
1
|
+
import { jsxs as u, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { useState as q, useRef as A, useMemo as g, useEffect as S } from "react";
|
|
3
|
+
import { ChainSelect as D } from "./ChainSelect/ChainSelect.mjs";
|
|
4
|
+
import { TokenList as R } from "./TokenList.mjs";
|
|
5
|
+
import { MVX_CHAIN_IDS as b } from "../../../../constants/index.mjs";
|
|
6
|
+
import { getDisplayName as V } from "../../../../helpers/getDisplayName.mjs";
|
|
7
7
|
import "../../../constants/index.mjs";
|
|
8
|
-
import { MxSearch } from "../../base/MxSearch/MxSearch.mjs";
|
|
9
|
-
import { ALL_NETWORK_ID } from "../../../constants/chains.mjs";
|
|
10
|
-
const
|
|
11
|
-
onSelect,
|
|
12
|
-
tokens = [],
|
|
13
|
-
chains = [],
|
|
14
|
-
isMvxSelector =
|
|
15
|
-
areChainsLoading,
|
|
16
|
-
selectedToken
|
|
8
|
+
import { MxSearch as $ } from "../../base/MxSearch/MxSearch.mjs";
|
|
9
|
+
import { ALL_NETWORK_ID as C } from "../../../constants/chains.mjs";
|
|
10
|
+
const z = ({
|
|
11
|
+
onSelect: N,
|
|
12
|
+
tokens: l = [],
|
|
13
|
+
chains: d = [],
|
|
14
|
+
isMvxSelector: o = !1,
|
|
15
|
+
areChainsLoading: L,
|
|
16
|
+
selectedToken: s
|
|
17
17
|
}) => {
|
|
18
|
-
const [
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
(chain) => !MVX_CHAIN_IDS.includes(chain.chainId.toString())
|
|
29
|
-
);
|
|
30
|
-
}, [chains, isMvxSelector]);
|
|
31
|
-
const defaultChainId = useMemo(() => {
|
|
32
|
-
var _a;
|
|
33
|
-
if (isMvxSelector) {
|
|
34
|
-
const mvxChainWithTokens = availableChains.find(
|
|
35
|
-
(chain) => tokens.some(
|
|
36
|
-
(token) => token.chainId.toString() === chain.chainId.toString()
|
|
18
|
+
const [f, a] = q(l), [w, I] = q(s), m = A(""), r = g(() => o ? d.filter(
|
|
19
|
+
(e) => b.includes(e.chainId.toString())
|
|
20
|
+
) : d.filter(
|
|
21
|
+
(e) => !b.includes(e.chainId.toString())
|
|
22
|
+
), [d, o]), h = g(() => {
|
|
23
|
+
var e;
|
|
24
|
+
if (o) {
|
|
25
|
+
const i = r.find(
|
|
26
|
+
(n) => l.some(
|
|
27
|
+
(_) => _.chainId.toString() === n.chainId.toString()
|
|
37
28
|
)
|
|
38
29
|
);
|
|
39
|
-
return (
|
|
30
|
+
return (i == null ? void 0 : i.chainId.toString()) ?? ((e = r[0]) == null ? void 0 : e.chainId.toString()) ?? C;
|
|
40
31
|
}
|
|
41
|
-
return
|
|
42
|
-
}, [
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
32
|
+
return C;
|
|
33
|
+
}, [r, l, o]), [t, p] = q(h);
|
|
34
|
+
S(() => {
|
|
35
|
+
r.some(
|
|
36
|
+
(i) => i.chainId.toString() === t
|
|
37
|
+
) || p(h);
|
|
38
|
+
}, [h, r, t]);
|
|
39
|
+
const T = g(() => {
|
|
40
|
+
const e = r.find(
|
|
41
|
+
(i) => i.chainId.toString() === t
|
|
47
42
|
);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
return `Tokens on ${getDisplayName(selectedChain)} (${filteredTokens.length})`;
|
|
60
|
-
}, [availableChains, filteredTokens.length, selectedChainId, tokens.length]);
|
|
61
|
-
const handleSelect = (token) => {
|
|
62
|
-
setSelected(token);
|
|
63
|
-
onSelect(token);
|
|
64
|
-
};
|
|
65
|
-
const handleSearch = (pattern) => {
|
|
66
|
-
searchPatternRef.current = pattern;
|
|
67
|
-
if (selectedChainId === ALL_NETWORK_ID) {
|
|
68
|
-
if (pattern.trim() === "") {
|
|
69
|
-
setFilteredTokens(tokens);
|
|
70
|
-
} else {
|
|
71
|
-
const filtered = tokens.filter(
|
|
72
|
-
(token) => token.symbol.toLowerCase().includes(pattern.toLowerCase())
|
|
43
|
+
return e ? `Tokens on ${V(e)} (${f.length})` : `Tokens on all networks (${l.length})`;
|
|
44
|
+
}, [r, f.length, t, l.length]), y = (e) => {
|
|
45
|
+
I(e), N(e);
|
|
46
|
+
}, x = (e) => {
|
|
47
|
+
if (m.current = e, t === C) {
|
|
48
|
+
if (e.trim() === "")
|
|
49
|
+
a(l);
|
|
50
|
+
else {
|
|
51
|
+
const i = l.filter(
|
|
52
|
+
(n) => n.symbol.toLowerCase().includes(e.toLowerCase())
|
|
73
53
|
);
|
|
74
|
-
|
|
54
|
+
a(i);
|
|
75
55
|
}
|
|
76
56
|
return;
|
|
77
57
|
}
|
|
78
|
-
if (
|
|
79
|
-
const
|
|
80
|
-
(
|
|
58
|
+
if (e.trim() === "") {
|
|
59
|
+
const i = l.filter(
|
|
60
|
+
(n) => n.chainId.toString() === t.toString()
|
|
81
61
|
);
|
|
82
|
-
|
|
62
|
+
a(i);
|
|
83
63
|
} else {
|
|
84
|
-
const
|
|
85
|
-
(
|
|
64
|
+
const i = l.filter(
|
|
65
|
+
(n) => n.symbol.toLowerCase().includes(e.toLowerCase()) && n.chainId.toString() === t.toString()
|
|
86
66
|
);
|
|
87
|
-
|
|
67
|
+
a(i);
|
|
88
68
|
}
|
|
89
69
|
};
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}, [
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
return /* @__PURE__ */ 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: [
|
|
99
|
-
/* @__PURE__ */ jsx("div", { className: "liq-flex liq-flex-col liq-gap-3 liq-rounded-t-2xl liq-p-2", children: /* @__PURE__ */ jsxs("div", { className: "liq-flex liq-gap-2", children: [
|
|
100
|
-
/* @__PURE__ */ jsx(
|
|
101
|
-
MxSearch,
|
|
70
|
+
return S(() => {
|
|
71
|
+
a(l), I(s), m.current = "";
|
|
72
|
+
}, [s, l]), S(() => {
|
|
73
|
+
x(m.current);
|
|
74
|
+
}, [t, l]), /* @__PURE__ */ u("div", { className: "liq-relative liq-flex liq-max-w-full liq-flex-col liq-rounded-none liq-p-0 !liq-max-h-[22rem]", children: [
|
|
75
|
+
/* @__PURE__ */ c("div", { className: "liq-flex liq-flex-col liq-gap-3 liq-rounded-t-2xl liq-p-2", children: /* @__PURE__ */ u("div", { className: "liq-flex liq-gap-2", children: [
|
|
76
|
+
/* @__PURE__ */ c(
|
|
77
|
+
$,
|
|
102
78
|
{
|
|
103
79
|
inputClassName: "!liq-bg-neutral-750 liq-border liq-border-neutral-750",
|
|
104
80
|
placeholder: "Search token",
|
|
105
|
-
onChange:
|
|
81
|
+
onChange: x
|
|
106
82
|
}
|
|
107
83
|
),
|
|
108
|
-
!
|
|
109
|
-
|
|
84
|
+
!o && /* @__PURE__ */ c(
|
|
85
|
+
D,
|
|
110
86
|
{
|
|
111
|
-
chains:
|
|
112
|
-
ignoreAllChains:
|
|
113
|
-
selectedChainId,
|
|
114
|
-
onChange: (
|
|
115
|
-
|
|
87
|
+
chains: r,
|
|
88
|
+
ignoreAllChains: o,
|
|
89
|
+
selectedChainId: t,
|
|
90
|
+
onChange: (e) => {
|
|
91
|
+
p(e);
|
|
116
92
|
},
|
|
117
|
-
isLoading:
|
|
93
|
+
isLoading: L
|
|
118
94
|
}
|
|
119
95
|
)
|
|
120
96
|
] }) }),
|
|
121
|
-
/* @__PURE__ */
|
|
122
|
-
/* @__PURE__ */
|
|
123
|
-
/* @__PURE__ */
|
|
124
|
-
|
|
97
|
+
/* @__PURE__ */ u("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: [
|
|
98
|
+
/* @__PURE__ */ c("div", { className: "liq-flex liq-text-left liq-text-neutral-300 liq-mt-4 liq-ml-2", children: T }),
|
|
99
|
+
/* @__PURE__ */ c(
|
|
100
|
+
R,
|
|
125
101
|
{
|
|
126
|
-
tokens:
|
|
127
|
-
onSelect:
|
|
128
|
-
selectedToken:
|
|
102
|
+
tokens: f,
|
|
103
|
+
onSelect: y,
|
|
104
|
+
selectedToken: w
|
|
129
105
|
}
|
|
130
106
|
)
|
|
131
107
|
] })
|
|
132
108
|
] });
|
|
133
109
|
};
|
|
134
110
|
export {
|
|
135
|
-
SelectContent
|
|
111
|
+
z as SelectContent
|
|
136
112
|
};
|
|
@@ -1,29 +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_TokenIcon = require("./TokenIcon.js");
|
|
6
|
-
const reactjs_components_TokenSelector_components_TokenSymbol = require("./TokenSymbol.js");
|
|
7
|
-
const SelectedOption = ({ value }) => {
|
|
8
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
9
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10
|
-
reactjs_components_TokenSelector_components_TokenIcon.TokenIcon,
|
|
11
|
-
{
|
|
12
|
-
size: "lg",
|
|
13
|
-
token: value,
|
|
14
|
-
className: "liq-flex liq-items-center liq-justify-center liq-relative"
|
|
15
|
-
}
|
|
16
|
-
),
|
|
17
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liq-flex-1 liq-truncate liq-text-left", children: [
|
|
18
|
-
value && /* @__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(
|
|
19
|
-
reactjs_components_TokenSelector_components_TokenSymbol.TokenSymbol,
|
|
20
|
-
{
|
|
21
|
-
token: value,
|
|
22
|
-
className: "liq-font-semibold liq-leading-none"
|
|
23
|
-
}
|
|
24
|
-
) }) }),
|
|
25
|
-
!value && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-text-neutral-500", children: "Select token" })
|
|
26
|
-
] })
|
|
27
|
-
] });
|
|
28
|
-
};
|
|
29
|
-
exports.SelectedOption = SelectedOption;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./TokenIcon.js"),l=require("./TokenSymbol.js"),i=({value:n})=>e.jsxs(e.Fragment,{children:[e.jsx(t.TokenIcon,{size:"lg",token:n,className:"liq-flex liq-items-center liq-justify-center liq-relative"}),e.jsxs("div",{className:"liq-flex-1 liq-truncate liq-text-left",children:[n&&e.jsx("div",{className:"liq-flex liq-flex-col",children:e.jsx("div",{className:"liq-flex liq-items-center",children:e.jsx(l.TokenSymbol,{token:n,className:"liq-font-semibold liq-leading-none"})})}),!n&&e.jsx("div",{className:"liq-text-neutral-500",children:"Select token"})]})]});exports.SelectedOption=i;
|
|
@@ -1,28 +1,26 @@
|
|
|
1
|
-
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { TokenIcon } from "./TokenIcon.mjs";
|
|
3
|
-
import { TokenSymbol } from "./TokenSymbol.mjs";
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { jsxs as i, Fragment as t, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { TokenIcon as n } from "./TokenIcon.mjs";
|
|
3
|
+
import { TokenSymbol as r } from "./TokenSymbol.mjs";
|
|
4
|
+
const m = ({ value: l }) => /* @__PURE__ */ i(t, { children: [
|
|
5
|
+
/* @__PURE__ */ e(
|
|
6
|
+
n,
|
|
7
|
+
{
|
|
8
|
+
size: "lg",
|
|
9
|
+
token: l,
|
|
10
|
+
className: "liq-flex liq-items-center liq-justify-center liq-relative"
|
|
11
|
+
}
|
|
12
|
+
),
|
|
13
|
+
/* @__PURE__ */ i("div", { className: "liq-flex-1 liq-truncate liq-text-left", children: [
|
|
14
|
+
l && /* @__PURE__ */ e("div", { className: "liq-flex liq-flex-col", children: /* @__PURE__ */ e("div", { className: "liq-flex liq-items-center", children: /* @__PURE__ */ e(
|
|
15
|
+
r,
|
|
8
16
|
{
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
className: "liq-flex liq-items-center liq-justify-center liq-relative"
|
|
17
|
+
token: l,
|
|
18
|
+
className: "liq-font-semibold liq-leading-none"
|
|
12
19
|
}
|
|
13
|
-
),
|
|
14
|
-
/* @__PURE__ */
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
{
|
|
18
|
-
token: value,
|
|
19
|
-
className: "liq-font-semibold liq-leading-none"
|
|
20
|
-
}
|
|
21
|
-
) }) }),
|
|
22
|
-
!value && /* @__PURE__ */ jsx("div", { className: "liq-text-neutral-500", children: "Select token" })
|
|
23
|
-
] })
|
|
24
|
-
] });
|
|
25
|
-
};
|
|
20
|
+
) }) }),
|
|
21
|
+
!l && /* @__PURE__ */ e("div", { className: "liq-text-neutral-500", children: "Select token" })
|
|
22
|
+
] })
|
|
23
|
+
] });
|
|
26
24
|
export {
|
|
27
|
-
SelectedOption
|
|
25
|
+
m as SelectedOption
|
|
28
26
|
};
|
|
@@ -1,82 +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 faDiamond = require("@fortawesome/free-solid-svg-icons/faDiamond");
|
|
6
|
-
const reactFontawesome = require("@fortawesome/react-fontawesome");
|
|
7
|
-
const React = require("react");
|
|
8
|
-
const _default = require("../../../../default-H3AbmzFV.js");
|
|
9
|
-
const reactjs_utils_mxClsx = require("../../../utils/mxClsx.js");
|
|
10
|
-
const TokenIcon = ({
|
|
11
|
-
token,
|
|
12
|
-
size = "lg",
|
|
13
|
-
className = ""
|
|
14
|
-
}) => {
|
|
15
|
-
const getIconComponent = React.useCallback(
|
|
16
|
-
(assetTicker) => {
|
|
17
|
-
if (!assetTicker || !token) {
|
|
18
|
-
return /* @__PURE__ */ jsxRuntime.jsx("img", { src: _default.DefaultIcon, alt: "" });
|
|
19
|
-
}
|
|
20
|
-
return token.pngUrl && token.pngUrl !== "" ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
21
|
-
"img",
|
|
22
|
-
{
|
|
23
|
-
src: token.pngUrl,
|
|
24
|
-
alt: "",
|
|
25
|
-
className: "liq-asset-icon liq-sm liq-p-0"
|
|
26
|
-
}
|
|
27
|
-
) }) : /* @__PURE__ */ jsxRuntime.jsx("img", { src: _default.DefaultIcon, alt: "" });
|
|
28
|
-
},
|
|
29
|
-
[token]
|
|
30
|
-
);
|
|
31
|
-
const IconComponent = React.useMemo(
|
|
32
|
-
() => getIconComponent(token == null ? void 0 : token.symbol),
|
|
33
|
-
[getIconComponent, token == null ? void 0 : token.symbol]
|
|
34
|
-
);
|
|
35
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
36
|
-
"div",
|
|
37
|
-
{
|
|
38
|
-
className: reactjs_utils_mxClsx.mxClsx(
|
|
39
|
-
"liq-flex-shrink-0 liq-overflow-hidden liq-rounded-full",
|
|
40
|
-
{
|
|
41
|
-
"liq-h-4 liq-w-4": size === "xs",
|
|
42
|
-
"liq-h-5 liq-w-5": size === "2xs",
|
|
43
|
-
"liq-h-6 liq-w-6": size === "sm",
|
|
44
|
-
"liq-h-7 liq-w-7": size === "2sm",
|
|
45
|
-
"liq-h-8 liq-w-8": size === "md",
|
|
46
|
-
"liq-h-10 liq-w-10": size === "lg",
|
|
47
|
-
"liq-h-12 liq-w-12": size === "xl",
|
|
48
|
-
"liq-h-14 liq-w-14": size === "2xl",
|
|
49
|
-
"liq-h-16 liq-w-16": size === "3xl"
|
|
50
|
-
},
|
|
51
|
-
className
|
|
52
|
-
),
|
|
53
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: IconComponent ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
54
|
-
"div",
|
|
55
|
-
{
|
|
56
|
-
className: reactjs_utils_mxClsx.mxClsx(
|
|
57
|
-
{
|
|
58
|
-
"liq-h-4 liq-w-4": size === "xs",
|
|
59
|
-
"liq-h-5 liq-w-5": size === "2xs",
|
|
60
|
-
"liq-h-6 liq-w-6": size === "sm",
|
|
61
|
-
"liq-h-7 liq-w-7": size === "2sm",
|
|
62
|
-
"liq-h-8 liq-w-8": size === "md",
|
|
63
|
-
"liq-h-10 liq-w-10": size === "lg",
|
|
64
|
-
"liq-h-12 liq-w-12": size === "xl",
|
|
65
|
-
"liq-h-14 liq-w-14": size === "2xl",
|
|
66
|
-
"liq-h-16 liq-w-16": size === "3xl"
|
|
67
|
-
},
|
|
68
|
-
className
|
|
69
|
-
),
|
|
70
|
-
children: IconComponent
|
|
71
|
-
}
|
|
72
|
-
) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-flex liq-h-full liq-w-full liq-items-center liq-justify-center liq-rounded-full liq-bg-black liq-p-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
73
|
-
reactFontawesome.FontAwesomeIcon,
|
|
74
|
-
{
|
|
75
|
-
icon: faDiamond.faDiamond,
|
|
76
|
-
className: "liq-text-neutral-500"
|
|
77
|
-
}
|
|
78
|
-
) }) })
|
|
79
|
-
}
|
|
80
|
-
);
|
|
81
|
-
};
|
|
82
|
-
exports.TokenIcon = TokenIcon;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("react/jsx-runtime"),t=require("@fortawesome/free-solid-svg-icons/faDiamond"),o=require("@fortawesome/react-fontawesome"),c=require("react"),u=require("../../../../helpers/safeImageUrl.js"),r=require("../../../../default-DbU6vPaB.js"),a=require("../../../utils/mxClsx.js"),x=({token:i,size:l="lg",className:e=""})=>{const s=c.useCallback(m=>!m||!i?q.jsx("img",{src:r.DefaultIcon,alt:""}):i.pngUrl&&i.pngUrl!==""?q.jsx(q.Fragment,{children:q.jsx("img",{src:u.safeImageUrl(i.pngUrl,r.DefaultIcon),alt:"",className:"liq-asset-icon liq-sm liq-p-0"})}):q.jsx("img",{src:r.DefaultIcon,alt:""}),[i]),n=c.useMemo(()=>s(i==null?void 0:i.symbol),[s,i==null?void 0:i.symbol]);return q.jsx("div",{className:a.mxClsx("liq-flex-shrink-0 liq-overflow-hidden liq-rounded-full",{"liq-h-4 liq-w-4":l==="xs","liq-h-5 liq-w-5":l==="2xs","liq-h-6 liq-w-6":l==="sm","liq-h-7 liq-w-7":l==="2sm","liq-h-8 liq-w-8":l==="md","liq-h-10 liq-w-10":l==="lg","liq-h-12 liq-w-12":l==="xl","liq-h-14 liq-w-14":l==="2xl","liq-h-16 liq-w-16":l==="3xl"},e),children:q.jsx(q.Fragment,{children:n?q.jsx("div",{className:a.mxClsx({"liq-h-4 liq-w-4":l==="xs","liq-h-5 liq-w-5":l==="2xs","liq-h-6 liq-w-6":l==="sm","liq-h-7 liq-w-7":l==="2sm","liq-h-8 liq-w-8":l==="md","liq-h-10 liq-w-10":l==="lg","liq-h-12 liq-w-12":l==="xl","liq-h-14 liq-w-14":l==="2xl","liq-h-16 liq-w-16":l==="3xl"},e),children:n}):q.jsx("div",{className:"liq-flex liq-h-full liq-w-full liq-items-center liq-justify-center liq-rounded-full liq-bg-black liq-p-1",children:q.jsx(o.FontAwesomeIcon,{icon:t.faDiamond,className:"liq-text-neutral-500"})})})})};exports.TokenIcon=x;
|
|
@@ -1,75 +1,70 @@
|
|
|
1
|
-
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { faDiamond } from "@fortawesome/free-solid-svg-icons/faDiamond";
|
|
3
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
4
|
-
import { useCallback, useMemo } from "react";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { jsx as q, Fragment as o } from "react/jsx-runtime";
|
|
2
|
+
import { faDiamond as w } from "@fortawesome/free-solid-svg-icons/faDiamond";
|
|
3
|
+
import { FontAwesomeIcon as s } from "@fortawesome/react-fontawesome";
|
|
4
|
+
import { useCallback as f, useMemo as d } from "react";
|
|
5
|
+
import { safeImageUrl as t } from "../../../../helpers/safeImageUrl.mjs";
|
|
6
|
+
import { D as r } from "../../../../default-D0Jk5ROI.mjs";
|
|
7
|
+
import { mxClsx as a } from "../../../utils/mxClsx.mjs";
|
|
8
|
+
const v = ({
|
|
9
|
+
token: i,
|
|
10
|
+
size: l = "lg",
|
|
11
|
+
className: m = ""
|
|
11
12
|
}) => {
|
|
12
|
-
const
|
|
13
|
-
(
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
const c = f(
|
|
14
|
+
(n) => !n || !i ? /* @__PURE__ */ q("img", { src: r, alt: "" }) : i.pngUrl && i.pngUrl !== "" ? /* @__PURE__ */ q(o, { children: /* @__PURE__ */ q(
|
|
15
|
+
"img",
|
|
16
|
+
{
|
|
17
|
+
src: t(i.pngUrl, r),
|
|
18
|
+
alt: "",
|
|
19
|
+
className: "liq-asset-icon liq-sm liq-p-0"
|
|
16
20
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
className: "liq-asset-icon liq-sm liq-p-0"
|
|
23
|
-
}
|
|
24
|
-
) }) : /* @__PURE__ */ jsx("img", { src: DefaultIcon, alt: "" });
|
|
25
|
-
},
|
|
26
|
-
[token]
|
|
27
|
-
);
|
|
28
|
-
const IconComponent = useMemo(
|
|
29
|
-
() => getIconComponent(token == null ? void 0 : token.symbol),
|
|
30
|
-
[getIconComponent, token == null ? void 0 : token.symbol]
|
|
21
|
+
) }) : /* @__PURE__ */ q("img", { src: r, alt: "" }),
|
|
22
|
+
[i]
|
|
23
|
+
), h = d(
|
|
24
|
+
() => c(i == null ? void 0 : i.symbol),
|
|
25
|
+
[c, i == null ? void 0 : i.symbol]
|
|
31
26
|
);
|
|
32
|
-
return /* @__PURE__ */
|
|
27
|
+
return /* @__PURE__ */ q(
|
|
33
28
|
"div",
|
|
34
29
|
{
|
|
35
|
-
className:
|
|
30
|
+
className: a(
|
|
36
31
|
"liq-flex-shrink-0 liq-overflow-hidden liq-rounded-full",
|
|
37
32
|
{
|
|
38
|
-
"liq-h-4 liq-w-4":
|
|
39
|
-
"liq-h-5 liq-w-5":
|
|
40
|
-
"liq-h-6 liq-w-6":
|
|
41
|
-
"liq-h-7 liq-w-7":
|
|
42
|
-
"liq-h-8 liq-w-8":
|
|
43
|
-
"liq-h-10 liq-w-10":
|
|
44
|
-
"liq-h-12 liq-w-12":
|
|
45
|
-
"liq-h-14 liq-w-14":
|
|
46
|
-
"liq-h-16 liq-w-16":
|
|
33
|
+
"liq-h-4 liq-w-4": l === "xs",
|
|
34
|
+
"liq-h-5 liq-w-5": l === "2xs",
|
|
35
|
+
"liq-h-6 liq-w-6": l === "sm",
|
|
36
|
+
"liq-h-7 liq-w-7": l === "2sm",
|
|
37
|
+
"liq-h-8 liq-w-8": l === "md",
|
|
38
|
+
"liq-h-10 liq-w-10": l === "lg",
|
|
39
|
+
"liq-h-12 liq-w-12": l === "xl",
|
|
40
|
+
"liq-h-14 liq-w-14": l === "2xl",
|
|
41
|
+
"liq-h-16 liq-w-16": l === "3xl"
|
|
47
42
|
},
|
|
48
|
-
|
|
43
|
+
m
|
|
49
44
|
),
|
|
50
|
-
children: /* @__PURE__ */
|
|
45
|
+
children: /* @__PURE__ */ q(o, { children: h ? /* @__PURE__ */ q(
|
|
51
46
|
"div",
|
|
52
47
|
{
|
|
53
|
-
className:
|
|
48
|
+
className: a(
|
|
54
49
|
{
|
|
55
|
-
"liq-h-4 liq-w-4":
|
|
56
|
-
"liq-h-5 liq-w-5":
|
|
57
|
-
"liq-h-6 liq-w-6":
|
|
58
|
-
"liq-h-7 liq-w-7":
|
|
59
|
-
"liq-h-8 liq-w-8":
|
|
60
|
-
"liq-h-10 liq-w-10":
|
|
61
|
-
"liq-h-12 liq-w-12":
|
|
62
|
-
"liq-h-14 liq-w-14":
|
|
63
|
-
"liq-h-16 liq-w-16":
|
|
50
|
+
"liq-h-4 liq-w-4": l === "xs",
|
|
51
|
+
"liq-h-5 liq-w-5": l === "2xs",
|
|
52
|
+
"liq-h-6 liq-w-6": l === "sm",
|
|
53
|
+
"liq-h-7 liq-w-7": l === "2sm",
|
|
54
|
+
"liq-h-8 liq-w-8": l === "md",
|
|
55
|
+
"liq-h-10 liq-w-10": l === "lg",
|
|
56
|
+
"liq-h-12 liq-w-12": l === "xl",
|
|
57
|
+
"liq-h-14 liq-w-14": l === "2xl",
|
|
58
|
+
"liq-h-16 liq-w-16": l === "3xl"
|
|
64
59
|
},
|
|
65
|
-
|
|
60
|
+
m
|
|
66
61
|
),
|
|
67
|
-
children:
|
|
62
|
+
children: h
|
|
68
63
|
}
|
|
69
|
-
) : /* @__PURE__ */
|
|
70
|
-
|
|
64
|
+
) : /* @__PURE__ */ q("div", { className: "liq-flex liq-h-full liq-w-full liq-items-center liq-justify-center liq-rounded-full liq-bg-black liq-p-1", children: /* @__PURE__ */ q(
|
|
65
|
+
s,
|
|
71
66
|
{
|
|
72
|
-
icon:
|
|
67
|
+
icon: w,
|
|
73
68
|
className: "liq-text-neutral-500"
|
|
74
69
|
}
|
|
75
70
|
) }) })
|
|
@@ -77,5 +72,5 @@ const TokenIcon = ({
|
|
|
77
72
|
);
|
|
78
73
|
};
|
|
79
74
|
export {
|
|
80
|
-
TokenIcon
|
|
75
|
+
v as TokenIcon
|
|
81
76
|
};
|
|
@@ -1,81 +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("@reown/appkit/react");
|
|
6
|
-
const React = require("react");
|
|
7
|
-
const reactjs_components_TokenSelector_components_TokenIcon = require("./TokenIcon.js");
|
|
8
|
-
const types_chainType = require("../../../../types/chainType.js");
|
|
9
|
-
const reactjs_context_useWeb3App = require("../../../context/useWeb3App.js");
|
|
10
|
-
const reactjs_hooks_useGetChainId = require("../../../hooks/useGetChainId.js");
|
|
11
|
-
const reactjs_hooks_useResolveTokenChain = require("../../../hooks/useResolveTokenChain.js");
|
|
12
|
-
const TokenItem = ({
|
|
13
|
-
token,
|
|
14
|
-
onClick,
|
|
15
|
-
selected
|
|
16
|
-
}) => {
|
|
17
|
-
var _a, _b;
|
|
18
|
-
const { tokenChain, chainIcon } = reactjs_hooks_useResolveTokenChain.useResolveTokenChain({
|
|
19
|
-
token
|
|
20
|
-
});
|
|
21
|
-
const { supportedChains: sdkChains } = reactjs_context_useWeb3App.useWeb3App();
|
|
22
|
-
const { switchNetwork } = react.useAppKitNetwork();
|
|
23
|
-
const chainId = reactjs_hooks_useGetChainId.useGetChainId();
|
|
24
|
-
const activeChain = React.useMemo(() => {
|
|
25
|
-
return sdkChains == null ? void 0 : sdkChains.find(
|
|
26
|
-
(chain) => chain.id.toString() === (chainId == null ? void 0 : chainId.toString())
|
|
27
|
-
);
|
|
28
|
-
}, [chainId, sdkChains]);
|
|
29
|
-
const handleSwitchChain = React.useCallback(() => {
|
|
30
|
-
if ((tokenChain == null ? void 0 : tokenChain.chainType) !== types_chainType.ChainType.evm) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
if (activeChain && (tokenChain == null ? void 0 : tokenChain.chainId) && (activeChain == null ? void 0 : activeChain.id.toString()) !== (tokenChain == null ? void 0 : tokenChain.chainId.toString())) {
|
|
34
|
-
switchNetwork(
|
|
35
|
-
(sdkChains == null ? void 0 : sdkChains.find(
|
|
36
|
-
(chain) => chain.id.toString() === (tokenChain == null ? void 0 : tokenChain.chainId.toString())
|
|
37
|
-
)) ?? activeChain
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
}, [
|
|
41
|
-
activeChain,
|
|
42
|
-
sdkChains,
|
|
43
|
-
switchNetwork,
|
|
44
|
-
tokenChain == null ? void 0 : tokenChain.chainId,
|
|
45
|
-
tokenChain == null ? void 0 : tokenChain.chainType
|
|
46
|
-
]);
|
|
47
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
48
|
-
"div",
|
|
49
|
-
{
|
|
50
|
-
"data-testid": `token-item-${(_b = (_a = token.symbol) == null ? void 0 : _a.toLowerCase) == null ? void 0 : _b.call(_a)}`,
|
|
51
|
-
className: `token-item ${selected ? "liq-selected" : ""} liq-flex liq-cursor-pointer liq-items-center liq-justify-between liq-rounded-lg liq-p-2 hover:liq-bg-neutral-700 liq-bg-neutral-850`,
|
|
52
|
-
onClick: () => {
|
|
53
|
-
handleSwitchChain();
|
|
54
|
-
onClick(token);
|
|
55
|
-
},
|
|
56
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liq-flex liq-w-full liq-items-center liq-relative", children: [
|
|
57
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
58
|
-
reactjs_components_TokenSelector_components_TokenIcon.TokenIcon,
|
|
59
|
-
{
|
|
60
|
-
size: "lg",
|
|
61
|
-
token,
|
|
62
|
-
className: "liq-flex liq-items-center liq-justify-center"
|
|
63
|
-
}
|
|
64
|
-
),
|
|
65
|
-
chainIcon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
66
|
-
"img",
|
|
67
|
-
{
|
|
68
|
-
src: chainIcon,
|
|
69
|
-
alt: "",
|
|
70
|
-
className: "liq-absolute liq-left-4 liq-bottom-[-2px] liq-chain-icon liq-sm liq-w-6 liq-h-6 liq-border-[3px] liq-border-neutral-850 liq-rounded-lg"
|
|
71
|
-
}
|
|
72
|
-
),
|
|
73
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liq-ml-2", children: [
|
|
74
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-text-sm liq-font-bold", children: token.symbol }),
|
|
75
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-text-xs liq-text-gray-400", children: token.name })
|
|
76
|
-
] })
|
|
77
|
-
] })
|
|
78
|
-
}
|
|
79
|
-
);
|
|
80
|
-
};
|
|
81
|
-
exports.TokenItem = TokenItem;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),x=require("@reown/appkit/react"),a=require("react"),b=require("./TokenIcon.js"),g=require("../../../../types/chainType.js"),j=require("../../../context/useWeb3App.js"),f=require("../../../hooks/useGetChainId.js"),h=require("../../../hooks/useResolveTokenChain.js"),y=({token:s,onClick:d,selected:m})=>{var c,u;const{tokenChain:e,chainIcon:n}=h.useResolveTokenChain({token:s}),{supportedChains:i}=j.useWeb3App(),{switchNetwork:q}=x.useAppKitNetwork(),r=f.useGetChainId(),l=a.useMemo(()=>i==null?void 0:i.find(o=>o.id.toString()===(r==null?void 0:r.toString())),[r,i]),p=a.useCallback(()=>{(e==null?void 0:e.chainType)===g.ChainType.evm&&l&&e!=null&&e.chainId&&(l==null?void 0:l.id.toString())!==(e==null?void 0:e.chainId.toString())&&q((i==null?void 0:i.find(o=>o.id.toString()===(e==null?void 0:e.chainId.toString())))??l)},[l,i,q,e==null?void 0:e.chainId,e==null?void 0:e.chainType]);return t.jsx("div",{"data-testid":`token-item-${(u=(c=s.symbol)==null?void 0:c.toLowerCase)==null?void 0:u.call(c)}`,className:`token-item ${m?"liq-selected":""} liq-flex liq-cursor-pointer liq-items-center liq-justify-between liq-rounded-lg liq-p-2 hover:liq-bg-neutral-700 liq-bg-neutral-850`,onClick:()=>{p(),d(s)},children:t.jsxs("div",{className:"liq-flex liq-w-full liq-items-center liq-relative",children:[t.jsx(b.TokenIcon,{size:"lg",token:s,className:"liq-flex liq-items-center liq-justify-center"}),n&&t.jsx("img",{src:n,alt:"",className:"liq-absolute liq-left-4 liq-bottom-[-2px] liq-chain-icon liq-sm liq-w-6 liq-h-6 liq-border-[3px] liq-border-neutral-850 liq-rounded-lg"}),t.jsxs("div",{className:"liq-ml-2",children:[t.jsx("div",{className:"liq-text-sm liq-font-bold",children:s.symbol}),t.jsx("div",{className:"liq-text-xs liq-text-gray-400",children:s.name})]})]})})};exports.TokenItem=y;
|