@relayprotocol/relay-kit-ui 2.17.2
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/LICENSE +21 -0
- package/_cjs/package.json +1 -0
- package/_cjs/src/components/common/AmountInput.js +42 -0
- package/_cjs/src/components/common/AmountInput.js.map +1 -0
- package/_cjs/src/components/common/BalanceDisplay.js +18 -0
- package/_cjs/src/components/common/BalanceDisplay.js.map +1 -0
- package/_cjs/src/components/common/CopyToClipBoard.js +36 -0
- package/_cjs/src/components/common/CopyToClipBoard.js.map +1 -0
- package/_cjs/src/components/common/CustomAddressModal.js +105 -0
- package/_cjs/src/components/common/CustomAddressModal.js.map +1 -0
- package/_cjs/src/components/common/ErrorWell.js +41 -0
- package/_cjs/src/components/common/ErrorWell.js.map +1 -0
- package/_cjs/src/components/common/LoadingSpinner.js +19 -0
- package/_cjs/src/components/common/LoadingSpinner.js.map +1 -0
- package/_cjs/src/components/common/Modal.js +34 -0
- package/_cjs/src/components/common/Modal.js.map +1 -0
- package/_cjs/src/components/common/MultiWalletDropdown.js +148 -0
- package/_cjs/src/components/common/MultiWalletDropdown.js.map +1 -0
- package/_cjs/src/components/common/RefundReason.js +52 -0
- package/_cjs/src/components/common/RefundReason.js.map +1 -0
- package/_cjs/src/components/common/SlippageToleranceConfig.js +143 -0
- package/_cjs/src/components/common/SlippageToleranceConfig.js.map +1 -0
- package/_cjs/src/components/common/TokenSelector/ChainFilter.js +119 -0
- package/_cjs/src/components/common/TokenSelector/ChainFilter.js.map +1 -0
- package/_cjs/src/components/common/TokenSelector/ChainFilterSidebar.js +150 -0
- package/_cjs/src/components/common/TokenSelector/ChainFilterSidebar.js.map +1 -0
- package/_cjs/src/components/common/TokenSelector/SuggestedTokens.js +67 -0
- package/_cjs/src/components/common/TokenSelector/SuggestedTokens.js.map +1 -0
- package/_cjs/src/components/common/TokenSelector/TagPill.js +18 -0
- package/_cjs/src/components/common/TokenSelector/TagPill.js.map +1 -0
- package/_cjs/src/components/common/TokenSelector/TokenList.js +83 -0
- package/_cjs/src/components/common/TokenSelector/TokenList.js.map +1 -0
- package/_cjs/src/components/common/TokenSelector/TokenSelector.js +402 -0
- package/_cjs/src/components/common/TokenSelector/TokenSelector.js.map +1 -0
- package/_cjs/src/components/common/TokenSelector/triggers/TokenTrigger.js +42 -0
- package/_cjs/src/components/common/TokenSelector/triggers/TokenTrigger.js.map +1 -0
- package/_cjs/src/components/common/TransactionModal/DepositAddressModal.js +85 -0
- package/_cjs/src/components/common/TransactionModal/DepositAddressModal.js.map +1 -0
- package/_cjs/src/components/common/TransactionModal/DepositAddressModalRenderer.js +247 -0
- package/_cjs/src/components/common/TransactionModal/DepositAddressModalRenderer.js.map +1 -0
- package/_cjs/src/components/common/TransactionModal/TransactionModal.js +121 -0
- package/_cjs/src/components/common/TransactionModal/TransactionModal.js.map +1 -0
- package/_cjs/src/components/common/TransactionModal/TransactionModalRenderer.js +136 -0
- package/_cjs/src/components/common/TransactionModal/TransactionModalRenderer.js.map +1 -0
- package/_cjs/src/components/common/TransactionModal/steps/ApprovalPlusSwapStep.js +80 -0
- package/_cjs/src/components/common/TransactionModal/steps/ApprovalPlusSwapStep.js.map +1 -0
- package/_cjs/src/components/common/TransactionModal/steps/DepositAddressValidatingStep.js +21 -0
- package/_cjs/src/components/common/TransactionModal/steps/DepositAddressValidatingStep.js.map +1 -0
- package/_cjs/src/components/common/TransactionModal/steps/ErrorStep.js +82 -0
- package/_cjs/src/components/common/TransactionModal/steps/ErrorStep.js.map +1 -0
- package/_cjs/src/components/common/TransactionModal/steps/SwapConfirmationStep.js +117 -0
- package/_cjs/src/components/common/TransactionModal/steps/SwapConfirmationStep.js.map +1 -0
- package/_cjs/src/components/common/TransactionModal/steps/SwapSuccessStep.js +131 -0
- package/_cjs/src/components/common/TransactionModal/steps/SwapSuccessStep.js.map +1 -0
- package/_cjs/src/components/common/TransactionModal/steps/TransactionsByChain.js +67 -0
- package/_cjs/src/components/common/TransactionModal/steps/TransactionsByChain.js.map +1 -0
- package/_cjs/src/components/common/TransactionModal/steps/WaitingForDepositStep.js +86 -0
- package/_cjs/src/components/common/TransactionModal/steps/WaitingForDepositStep.js.map +1 -0
- package/_cjs/src/components/common/UnverifiedTokenModal.js +75 -0
- package/_cjs/src/components/common/UnverifiedTokenModal.js.map +1 -0
- package/_cjs/src/components/primitives/AccessibleList.js +33 -0
- package/_cjs/src/components/primitives/AccessibleList.js.map +1 -0
- package/_cjs/src/components/primitives/Anchor.js +57 -0
- package/_cjs/src/components/primitives/Anchor.js.map +1 -0
- package/_cjs/src/components/primitives/Box.js +10 -0
- package/_cjs/src/components/primitives/Box.js.map +1 -0
- package/_cjs/src/components/primitives/Button.js +155 -0
- package/_cjs/src/components/primitives/Button.js.map +1 -0
- package/_cjs/src/components/primitives/ChainIcon.js +35 -0
- package/_cjs/src/components/primitives/ChainIcon.js.map +1 -0
- package/_cjs/src/components/primitives/ChainTokenIcon.js +54 -0
- package/_cjs/src/components/primitives/ChainTokenIcon.js.map +1 -0
- package/_cjs/src/components/primitives/Collapsible.js +46 -0
- package/_cjs/src/components/primitives/Collapsible.js.map +1 -0
- package/_cjs/src/components/primitives/Dialog.js +104 -0
- package/_cjs/src/components/primitives/Dialog.js.map +1 -0
- package/_cjs/src/components/primitives/Dropdown.js +55 -0
- package/_cjs/src/components/primitives/Dropdown.js.map +1 -0
- package/_cjs/src/components/primitives/Flex.js +76 -0
- package/_cjs/src/components/primitives/Flex.js.map +1 -0
- package/_cjs/src/components/primitives/Input.js +69 -0
- package/_cjs/src/components/primitives/Input.js.map +1 -0
- package/_cjs/src/components/primitives/Pill.js +64 -0
- package/_cjs/src/components/primitives/Pill.js.map +1 -0
- package/_cjs/src/components/primitives/Skeleton.js +18 -0
- package/_cjs/src/components/primitives/Skeleton.js.map +1 -0
- package/_cjs/src/components/primitives/Switch.js +53 -0
- package/_cjs/src/components/primitives/Switch.js.map +1 -0
- package/_cjs/src/components/primitives/Tabs.js +53 -0
- package/_cjs/src/components/primitives/Tabs.js.map +1 -0
- package/_cjs/src/components/primitives/Text.js +106 -0
- package/_cjs/src/components/primitives/Text.js.map +1 -0
- package/_cjs/src/components/primitives/Tooltip.js +44 -0
- package/_cjs/src/components/primitives/Tooltip.js.map +1 -0
- package/_cjs/src/components/primitives/index.js +31 -0
- package/_cjs/src/components/primitives/index.js.map +1 -0
- package/_cjs/src/components/widgets/FeeBreakdown.js +165 -0
- package/_cjs/src/components/widgets/FeeBreakdown.js.map +1 -0
- package/_cjs/src/components/widgets/FetchingQuoteLoader.js +20 -0
- package/_cjs/src/components/widgets/FetchingQuoteLoader.js.map +1 -0
- package/_cjs/src/components/widgets/OnrampWidget/index.js +9 -0
- package/_cjs/src/components/widgets/OnrampWidget/index.js.map +1 -0
- package/_cjs/src/components/widgets/OnrampWidget/modals/OnrampModal.js +286 -0
- package/_cjs/src/components/widgets/OnrampWidget/modals/OnrampModal.js.map +1 -0
- package/_cjs/src/components/widgets/OnrampWidget/modals/steps/OnrampConfirmingStep.js +42 -0
- package/_cjs/src/components/widgets/OnrampWidget/modals/steps/OnrampConfirmingStep.js.map +1 -0
- package/_cjs/src/components/widgets/OnrampWidget/modals/steps/OnrampMoonPayStep.js +203 -0
- package/_cjs/src/components/widgets/OnrampWidget/modals/steps/OnrampMoonPayStep.js.map +1 -0
- package/_cjs/src/components/widgets/OnrampWidget/modals/steps/OnrampProcessingPassthroughStep.js +45 -0
- package/_cjs/src/components/widgets/OnrampWidget/modals/steps/OnrampProcessingPassthroughStep.js.map +1 -0
- package/_cjs/src/components/widgets/OnrampWidget/modals/steps/OnrampProcessingStepUI.js +87 -0
- package/_cjs/src/components/widgets/OnrampWidget/modals/steps/OnrampProcessingStepUI.js.map +1 -0
- package/_cjs/src/components/widgets/OnrampWidget/modals/steps/OnrampSuccessStep.js +39 -0
- package/_cjs/src/components/widgets/OnrampWidget/modals/steps/OnrampSuccessStep.js.map +1 -0
- package/_cjs/src/components/widgets/OnrampWidget/widget/FiatCurrencyModal.js +171 -0
- package/_cjs/src/components/widgets/OnrampWidget/widget/FiatCurrencyModal.js.map +1 -0
- package/_cjs/src/components/widgets/OnrampWidget/widget/OnrampWidgetRenderer.js +197 -0
- package/_cjs/src/components/widgets/OnrampWidget/widget/OnrampWidgetRenderer.js.map +1 -0
- package/_cjs/src/components/widgets/OnrampWidget/widget/index.js +332 -0
- package/_cjs/src/components/widgets/OnrampWidget/widget/index.js.map +1 -0
- package/_cjs/src/components/widgets/PriceImpactTooltip.js +28 -0
- package/_cjs/src/components/widgets/PriceImpactTooltip.js.map +1 -0
- package/_cjs/src/components/widgets/SwapButton.js +37 -0
- package/_cjs/src/components/widgets/SwapButton.js.map +1 -0
- package/_cjs/src/components/widgets/SwapRouteSelector.js +86 -0
- package/_cjs/src/components/widgets/SwapRouteSelector.js.map +1 -0
- package/_cjs/src/components/widgets/SwapWidget/GasTopUpSection.js +24 -0
- package/_cjs/src/components/widgets/SwapWidget/GasTopUpSection.js.map +1 -0
- package/_cjs/src/components/widgets/SwapWidget/index.js +912 -0
- package/_cjs/src/components/widgets/SwapWidget/index.js.map +1 -0
- package/_cjs/src/components/widgets/SwapWidgetRenderer.js +735 -0
- package/_cjs/src/components/widgets/SwapWidgetRenderer.js.map +1 -0
- package/_cjs/src/components/widgets/TokenSelectorContainer.js +20 -0
- package/_cjs/src/components/widgets/TokenSelectorContainer.js.map +1 -0
- package/_cjs/src/components/widgets/WidgetContainer.js +27 -0
- package/_cjs/src/components/widgets/WidgetContainer.js.map +1 -0
- package/_cjs/src/components/widgets/WidgetErrorWell.js +148 -0
- package/_cjs/src/components/widgets/WidgetErrorWell.js.map +1 -0
- package/_cjs/src/components/widgets/WidgetFooter.js +34 -0
- package/_cjs/src/components/widgets/WidgetFooter.js.map +1 -0
- package/_cjs/src/constants/address.js +15 -0
- package/_cjs/src/constants/address.js.map +1 -0
- package/_cjs/src/constants/agwRegistryAbi.js +20 -0
- package/_cjs/src/constants/agwRegistryAbi.js.map +1 -0
- package/_cjs/src/constants/cache.js +6 -0
- package/_cjs/src/constants/cache.js.map +1 -0
- package/_cjs/src/constants/chainIdToAlchemyNetworkMap.js +13 -0
- package/_cjs/src/constants/chainIdToAlchemyNetworkMap.js.map +1 -0
- package/_cjs/src/constants/currencies.js +3 -0
- package/_cjs/src/constants/currencies.js.map +1 -0
- package/_cjs/src/constants/depositAddresses.js +14 -0
- package/_cjs/src/constants/depositAddresses.js.map +1 -0
- package/_cjs/src/constants/events.js +62 -0
- package/_cjs/src/constants/events.js.map +1 -0
- package/_cjs/src/constants/maxGasBuffer.js +12 -0
- package/_cjs/src/constants/maxGasBuffer.js.map +1 -0
- package/_cjs/src/constants/moonPayCurrencies.js +295 -0
- package/_cjs/src/constants/moonPayCurrencies.js.map +1 -0
- package/_cjs/src/constants/moonPayFiatCurrencies.js +209 -0
- package/_cjs/src/constants/moonPayFiatCurrencies.js.map +1 -0
- package/_cjs/src/constants/walletCompatibility.js +23 -0
- package/_cjs/src/constants/walletCompatibility.js.map +1 -0
- package/_cjs/src/hooks/index.js +51 -0
- package/_cjs/src/hooks/index.js.map +1 -0
- package/_cjs/src/hooks/useAdaptedWalletBalance.js +28 -0
- package/_cjs/src/hooks/useAdaptedWalletBalance.js.map +1 -0
- package/_cjs/src/hooks/useAtomicBatchSupport.js +34 -0
- package/_cjs/src/hooks/useAtomicBatchSupport.js.map +1 -0
- package/_cjs/src/hooks/useBitcoinBalance.js +40 -0
- package/_cjs/src/hooks/useBitcoinBalance.js.map +1 -0
- package/_cjs/src/hooks/useCexAddresses.js +21 -0
- package/_cjs/src/hooks/useCexAddresses.js.map +1 -0
- package/_cjs/src/hooks/useCurrencyBalance.js +234 -0
- package/_cjs/src/hooks/useCurrencyBalance.js.map +1 -0
- package/_cjs/src/hooks/useDebounceState.js +35 -0
- package/_cjs/src/hooks/useDebounceState.js.map +1 -0
- package/_cjs/src/hooks/useDisconnected.js +14 -0
- package/_cjs/src/hooks/useDisconnected.js.map +1 -0
- package/_cjs/src/hooks/useDuneBalances.js +99 -0
- package/_cjs/src/hooks/useDuneBalances.js.map +1 -0
- package/_cjs/src/hooks/useENSResolver.js +37 -0
- package/_cjs/src/hooks/useENSResolver.js.map +1 -0
- package/_cjs/src/hooks/useEclipseBalance.js +47 -0
- package/_cjs/src/hooks/useEclipseBalance.js.map +1 -0
- package/_cjs/src/hooks/useEnhancedTokensList.js +80 -0
- package/_cjs/src/hooks/useEnhancedTokensList.js.map +1 -0
- package/_cjs/src/hooks/useFallbackState.js +12 -0
- package/_cjs/src/hooks/useFallbackState.js.map +1 -0
- package/_cjs/src/hooks/useGasTopUpRequired.js +59 -0
- package/_cjs/src/hooks/useGasTopUpRequired.js.map +1 -0
- package/_cjs/src/hooks/useHyperliquidUsdcBalance.js +37 -0
- package/_cjs/src/hooks/useHyperliquidUsdcBalance.js.map +1 -0
- package/_cjs/src/hooks/useInternalRelayChains.js +23 -0
- package/_cjs/src/hooks/useInternalRelayChains.js.map +1 -0
- package/_cjs/src/hooks/useIpAddress.js +12 -0
- package/_cjs/src/hooks/useIpAddress.js.map +1 -0
- package/_cjs/src/hooks/useIsAGW.js +34 -0
- package/_cjs/src/hooks/useIsAGW.js.map +1 -0
- package/_cjs/src/hooks/useIsPassthrough.js +56 -0
- package/_cjs/src/hooks/useIsPassthrough.js.map +1 -0
- package/_cjs/src/hooks/useIsWalletCompatible.js +42 -0
- package/_cjs/src/hooks/useIsWalletCompatible.js.map +1 -0
- package/_cjs/src/hooks/useMoonPayCurrencies.js +23 -0
- package/_cjs/src/hooks/useMoonPayCurrencies.js.map +1 -0
- package/_cjs/src/hooks/useMoonPayGeolocation.js +25 -0
- package/_cjs/src/hooks/useMoonPayGeolocation.js.map +1 -0
- package/_cjs/src/hooks/useMoonPayTransaction.js +25 -0
- package/_cjs/src/hooks/useMoonPayTransaction.js.map +1 -0
- package/_cjs/src/hooks/useMounted.js +11 -0
- package/_cjs/src/hooks/useMounted.js.map +1 -0
- package/_cjs/src/hooks/usePreviousValueChange.js +14 -0
- package/_cjs/src/hooks/usePreviousValueChange.js.map +1 -0
- package/_cjs/src/hooks/useRelayClient.js +9 -0
- package/_cjs/src/hooks/useRelayClient.js.map +1 -0
- package/_cjs/src/hooks/useSuiBalance.js +48 -0
- package/_cjs/src/hooks/useSuiBalance.js.map +1 -0
- package/_cjs/src/hooks/useSupportedMoonPayCurrencyCode.js +65 -0
- package/_cjs/src/hooks/useSupportedMoonPayCurrencyCode.js.map +1 -0
- package/_cjs/src/hooks/useWalletAddress.js +23 -0
- package/_cjs/src/hooks/useWalletAddress.js.map +1 -0
- package/_cjs/src/hooks/widget/useSwapButtonCta.js +76 -0
- package/_cjs/src/hooks/widget/useSwapButtonCta.js.map +1 -0
- package/_cjs/src/icons/SwitchIcon.js +9 -0
- package/_cjs/src/icons/SwitchIcon.js.map +1 -0
- package/_cjs/src/icons/index.js +6 -0
- package/_cjs/src/icons/index.js.map +1 -0
- package/_cjs/src/img/AllChainsLogo.js +10 -0
- package/_cjs/src/img/AllChainsLogo.js.map +1 -0
- package/_cjs/src/img/MoonPayLogo.js +10 -0
- package/_cjs/src/img/MoonPayLogo.js.map +1 -0
- package/_cjs/src/img/ReservoirText.js +10 -0
- package/_cjs/src/img/ReservoirText.js.map +1 -0
- package/_cjs/src/index.js +23 -0
- package/_cjs/src/index.js.map +1 -0
- package/_cjs/src/providers/RelayClientProvider.js +14 -0
- package/_cjs/src/providers/RelayClientProvider.js.map +1 -0
- package/_cjs/src/providers/RelayKitProvider.js +123 -0
- package/_cjs/src/providers/RelayKitProvider.js.map +1 -0
- package/_cjs/src/styles.css +3408 -0
- package/_cjs/src/themes/RelayKitTheme.js +89 -0
- package/_cjs/src/themes/RelayKitTheme.js.map +1 -0
- package/_cjs/src/themes/index.js +6 -0
- package/_cjs/src/themes/index.js.map +1 -0
- package/_cjs/src/types/BridgeFee.js +3 -0
- package/_cjs/src/types/BridgeFee.js.map +1 -0
- package/_cjs/src/types/Fiat.js +3 -0
- package/_cjs/src/types/Fiat.js.map +1 -0
- package/_cjs/src/types/RelayTransaction.js +3 -0
- package/_cjs/src/types/RelayTransaction.js.map +1 -0
- package/_cjs/src/types/index.js +3 -0
- package/_cjs/src/types/index.js.map +1 -0
- package/_cjs/src/utils/address.js +75 -0
- package/_cjs/src/utils/address.js.map +1 -0
- package/_cjs/src/utils/bitcoin.js +12 -0
- package/_cjs/src/utils/bitcoin.js.map +1 -0
- package/_cjs/src/utils/browser.js +8 -0
- package/_cjs/src/utils/browser.js.map +1 -0
- package/_cjs/src/utils/ens.js +9 -0
- package/_cjs/src/utils/ens.js.map +1 -0
- package/_cjs/src/utils/errors.js +38 -0
- package/_cjs/src/utils/errors.js.map +1 -0
- package/_cjs/src/utils/fetcher.js +20 -0
- package/_cjs/src/utils/fetcher.js.map +1 -0
- package/_cjs/src/utils/getChainBlockExplorerUrl.js +12 -0
- package/_cjs/src/utils/getChainBlockExplorerUrl.js.map +1 -0
- package/_cjs/src/utils/getTxBlockExplorerUrl.js +28 -0
- package/_cjs/src/utils/getTxBlockExplorerUrl.js.map +1 -0
- package/_cjs/src/utils/hashing.js +41 -0
- package/_cjs/src/utils/hashing.js.map +1 -0
- package/_cjs/src/utils/localStorage.js +84 -0
- package/_cjs/src/utils/localStorage.js.map +1 -0
- package/_cjs/src/utils/moonPay.js +49 -0
- package/_cjs/src/utils/moonPay.js.map +1 -0
- package/_cjs/src/utils/nativeMaxAmount.js +137 -0
- package/_cjs/src/utils/nativeMaxAmount.js.map +1 -0
- package/_cjs/src/utils/numbers.js +171 -0
- package/_cjs/src/utils/numbers.js.map +1 -0
- package/_cjs/src/utils/qrcode.js +23 -0
- package/_cjs/src/utils/qrcode.js.map +1 -0
- package/_cjs/src/utils/quote.js +262 -0
- package/_cjs/src/utils/quote.js.map +1 -0
- package/_cjs/src/utils/relayTransaction.js +85 -0
- package/_cjs/src/utils/relayTransaction.js.map +1 -0
- package/_cjs/src/utils/slippage.js +18 -0
- package/_cjs/src/utils/slippage.js.map +1 -0
- package/_cjs/src/utils/solana.js +16 -0
- package/_cjs/src/utils/solana.js.map +1 -0
- package/_cjs/src/utils/steps.js +87 -0
- package/_cjs/src/utils/steps.js.map +1 -0
- package/_cjs/src/utils/sui.js +15 -0
- package/_cjs/src/utils/sui.js.map +1 -0
- package/_cjs/src/utils/theme.js +40 -0
- package/_cjs/src/utils/theme.js.map +1 -0
- package/_cjs/src/utils/time.js +36 -0
- package/_cjs/src/utils/time.js.map +1 -0
- package/_cjs/src/utils/titleCase.js +9 -0
- package/_cjs/src/utils/titleCase.js.map +1 -0
- package/_cjs/src/utils/tokenSelector.js +81 -0
- package/_cjs/src/utils/tokenSelector.js.map +1 -0
- package/_cjs/src/utils/tokens.js +56 -0
- package/_cjs/src/utils/tokens.js.map +1 -0
- package/_cjs/src/utils/tron.js +12 -0
- package/_cjs/src/utils/tron.js.map +1 -0
- package/_cjs/src/utils/truncate.js +18 -0
- package/_cjs/src/utils/truncate.js.map +1 -0
- package/_cjs/src/version.js +5 -0
- package/_cjs/src/version.js.map +1 -0
- package/_cjs/tsconfig.build.tsbuildinfo +1 -0
- package/_esm/package.json +1 -0
- package/_esm/src/components/common/AmountInput.js +43 -0
- package/_esm/src/components/common/AmountInput.js.map +1 -0
- package/_esm/src/components/common/BalanceDisplay.js +15 -0
- package/_esm/src/components/common/BalanceDisplay.js.map +1 -0
- package/_esm/src/components/common/CopyToClipBoard.js +31 -0
- package/_esm/src/components/common/CopyToClipBoard.js.map +1 -0
- package/_esm/src/components/common/CustomAddressModal.js +102 -0
- package/_esm/src/components/common/CustomAddressModal.js.map +1 -0
- package/_esm/src/components/common/ErrorWell.js +38 -0
- package/_esm/src/components/common/ErrorWell.js.map +1 -0
- package/_esm/src/components/common/LoadingSpinner.js +15 -0
- package/_esm/src/components/common/LoadingSpinner.js.map +1 -0
- package/_esm/src/components/common/Modal.js +30 -0
- package/_esm/src/components/common/Modal.js.map +1 -0
- package/_esm/src/components/common/MultiWalletDropdown.js +144 -0
- package/_esm/src/components/common/MultiWalletDropdown.js.map +1 -0
- package/_esm/src/components/common/RefundReason.js +49 -0
- package/_esm/src/components/common/RefundReason.js.map +1 -0
- package/_esm/src/components/common/SlippageToleranceConfig.js +143 -0
- package/_esm/src/components/common/SlippageToleranceConfig.js.map +1 -0
- package/_esm/src/components/common/TokenSelector/ChainFilter.js +116 -0
- package/_esm/src/components/common/TokenSelector/ChainFilter.js.map +1 -0
- package/_esm/src/components/common/TokenSelector/ChainFilterSidebar.js +150 -0
- package/_esm/src/components/common/TokenSelector/ChainFilterSidebar.js.map +1 -0
- package/_esm/src/components/common/TokenSelector/SuggestedTokens.js +63 -0
- package/_esm/src/components/common/TokenSelector/SuggestedTokens.js.map +1 -0
- package/_esm/src/components/common/TokenSelector/TagPill.js +15 -0
- package/_esm/src/components/common/TokenSelector/TagPill.js.map +1 -0
- package/_esm/src/components/common/TokenSelector/TokenList.js +79 -0
- package/_esm/src/components/common/TokenSelector/TokenList.js.map +1 -0
- package/_esm/src/components/common/TokenSelector/TokenSelector.js +411 -0
- package/_esm/src/components/common/TokenSelector/TokenSelector.js.map +1 -0
- package/_esm/src/components/common/TokenSelector/triggers/TokenTrigger.js +37 -0
- package/_esm/src/components/common/TokenSelector/triggers/TokenTrigger.js.map +1 -0
- package/_esm/src/components/common/TransactionModal/DepositAddressModal.js +83 -0
- package/_esm/src/components/common/TransactionModal/DepositAddressModal.js.map +1 -0
- package/_esm/src/components/common/TransactionModal/DepositAddressModalRenderer.js +245 -0
- package/_esm/src/components/common/TransactionModal/DepositAddressModalRenderer.js.map +1 -0
- package/_esm/src/components/common/TransactionModal/TransactionModal.js +120 -0
- package/_esm/src/components/common/TransactionModal/TransactionModal.js.map +1 -0
- package/_esm/src/components/common/TransactionModal/TransactionModalRenderer.js +135 -0
- package/_esm/src/components/common/TransactionModal/TransactionModalRenderer.js.map +1 -0
- package/_esm/src/components/common/TransactionModal/steps/ApprovalPlusSwapStep.js +77 -0
- package/_esm/src/components/common/TransactionModal/steps/ApprovalPlusSwapStep.js.map +1 -0
- package/_esm/src/components/common/TransactionModal/steps/DepositAddressValidatingStep.js +20 -0
- package/_esm/src/components/common/TransactionModal/steps/DepositAddressValidatingStep.js.map +1 -0
- package/_esm/src/components/common/TransactionModal/steps/ErrorStep.js +80 -0
- package/_esm/src/components/common/TransactionModal/steps/ErrorStep.js.map +1 -0
- package/_esm/src/components/common/TransactionModal/steps/SwapConfirmationStep.js +112 -0
- package/_esm/src/components/common/TransactionModal/steps/SwapConfirmationStep.js.map +1 -0
- package/_esm/src/components/common/TransactionModal/steps/SwapSuccessStep.js +130 -0
- package/_esm/src/components/common/TransactionModal/steps/SwapSuccessStep.js.map +1 -0
- package/_esm/src/components/common/TransactionModal/steps/TransactionsByChain.js +64 -0
- package/_esm/src/components/common/TransactionModal/steps/TransactionsByChain.js.map +1 -0
- package/_esm/src/components/common/TransactionModal/steps/WaitingForDepositStep.js +84 -0
- package/_esm/src/components/common/TransactionModal/steps/WaitingForDepositStep.js.map +1 -0
- package/_esm/src/components/common/UnverifiedTokenModal.js +70 -0
- package/_esm/src/components/common/UnverifiedTokenModal.js.map +1 -0
- package/_esm/src/components/primitives/AccessibleList.js +28 -0
- package/_esm/src/components/primitives/AccessibleList.js.map +1 -0
- package/_esm/src/components/primitives/Anchor.js +53 -0
- package/_esm/src/components/primitives/Anchor.js.map +1 -0
- package/_esm/src/components/primitives/Box.js +8 -0
- package/_esm/src/components/primitives/Box.js.map +1 -0
- package/_esm/src/components/primitives/Button.js +153 -0
- package/_esm/src/components/primitives/Button.js.map +1 -0
- package/_esm/src/components/primitives/ChainIcon.js +32 -0
- package/_esm/src/components/primitives/ChainIcon.js.map +1 -0
- package/_esm/src/components/primitives/ChainTokenIcon.js +50 -0
- package/_esm/src/components/primitives/ChainTokenIcon.js.map +1 -0
- package/_esm/src/components/primitives/Collapsible.js +40 -0
- package/_esm/src/components/primitives/Collapsible.js.map +1 -0
- package/_esm/src/components/primitives/Dialog.js +97 -0
- package/_esm/src/components/primitives/Dialog.js.map +1 -0
- package/_esm/src/components/primitives/Dropdown.js +49 -0
- package/_esm/src/components/primitives/Dropdown.js.map +1 -0
- package/_esm/src/components/primitives/Flex.js +73 -0
- package/_esm/src/components/primitives/Flex.js.map +1 -0
- package/_esm/src/components/primitives/Input.js +66 -0
- package/_esm/src/components/primitives/Input.js.map +1 -0
- package/_esm/src/components/primitives/Pill.js +60 -0
- package/_esm/src/components/primitives/Pill.js.map +1 -0
- package/_esm/src/components/primitives/Skeleton.js +16 -0
- package/_esm/src/components/primitives/Skeleton.js.map +1 -0
- package/_esm/src/components/primitives/Switch.js +49 -0
- package/_esm/src/components/primitives/Switch.js.map +1 -0
- package/_esm/src/components/primitives/Tabs.js +46 -0
- package/_esm/src/components/primitives/Tabs.js.map +1 -0
- package/_esm/src/components/primitives/Text.js +104 -0
- package/_esm/src/components/primitives/Text.js.map +1 -0
- package/_esm/src/components/primitives/Tooltip.js +41 -0
- package/_esm/src/components/primitives/Tooltip.js.map +1 -0
- package/_esm/src/components/primitives/index.js +14 -0
- package/_esm/src/components/primitives/index.js.map +1 -0
- package/_esm/src/components/widgets/FeeBreakdown.js +162 -0
- package/_esm/src/components/widgets/FeeBreakdown.js.map +1 -0
- package/_esm/src/components/widgets/FetchingQuoteLoader.js +19 -0
- package/_esm/src/components/widgets/FetchingQuoteLoader.js.map +1 -0
- package/_esm/src/components/widgets/OnrampWidget/index.js +2 -0
- package/_esm/src/components/widgets/OnrampWidget/index.js.map +1 -0
- package/_esm/src/components/widgets/OnrampWidget/modals/OnrampModal.js +281 -0
- package/_esm/src/components/widgets/OnrampWidget/modals/OnrampModal.js.map +1 -0
- package/_esm/src/components/widgets/OnrampWidget/modals/steps/OnrampConfirmingStep.js +38 -0
- package/_esm/src/components/widgets/OnrampWidget/modals/steps/OnrampConfirmingStep.js.map +1 -0
- package/_esm/src/components/widgets/OnrampWidget/modals/steps/OnrampMoonPayStep.js +176 -0
- package/_esm/src/components/widgets/OnrampWidget/modals/steps/OnrampMoonPayStep.js.map +1 -0
- package/_esm/src/components/widgets/OnrampWidget/modals/steps/OnrampProcessingPassthroughStep.js +40 -0
- package/_esm/src/components/widgets/OnrampWidget/modals/steps/OnrampProcessingPassthroughStep.js.map +1 -0
- package/_esm/src/components/widgets/OnrampWidget/modals/steps/OnrampProcessingStepUI.js +83 -0
- package/_esm/src/components/widgets/OnrampWidget/modals/steps/OnrampProcessingStepUI.js.map +1 -0
- package/_esm/src/components/widgets/OnrampWidget/modals/steps/OnrampSuccessStep.js +35 -0
- package/_esm/src/components/widgets/OnrampWidget/modals/steps/OnrampSuccessStep.js.map +1 -0
- package/_esm/src/components/widgets/OnrampWidget/widget/FiatCurrencyModal.js +170 -0
- package/_esm/src/components/widgets/OnrampWidget/widget/FiatCurrencyModal.js.map +1 -0
- package/_esm/src/components/widgets/OnrampWidget/widget/OnrampWidgetRenderer.js +195 -0
- package/_esm/src/components/widgets/OnrampWidget/widget/OnrampWidgetRenderer.js.map +1 -0
- package/_esm/src/components/widgets/OnrampWidget/widget/index.js +332 -0
- package/_esm/src/components/widgets/OnrampWidget/widget/index.js.map +1 -0
- package/_esm/src/components/widgets/PriceImpactTooltip.js +23 -0
- package/_esm/src/components/widgets/PriceImpactTooltip.js.map +1 -0
- package/_esm/src/components/widgets/SwapButton.js +36 -0
- package/_esm/src/components/widgets/SwapButton.js.map +1 -0
- package/_esm/src/components/widgets/SwapRouteSelector.js +84 -0
- package/_esm/src/components/widgets/SwapRouteSelector.js.map +1 -0
- package/_esm/src/components/widgets/SwapWidget/GasTopUpSection.js +23 -0
- package/_esm/src/components/widgets/SwapWidget/GasTopUpSection.js.map +1 -0
- package/_esm/src/components/widgets/SwapWidget/index.js +955 -0
- package/_esm/src/components/widgets/SwapWidget/index.js.map +1 -0
- package/_esm/src/components/widgets/SwapWidgetRenderer.js +754 -0
- package/_esm/src/components/widgets/SwapWidgetRenderer.js.map +1 -0
- package/_esm/src/components/widgets/TokenSelectorContainer.js +20 -0
- package/_esm/src/components/widgets/TokenSelectorContainer.js.map +1 -0
- package/_esm/src/components/widgets/WidgetContainer.js +26 -0
- package/_esm/src/components/widgets/WidgetContainer.js.map +1 -0
- package/_esm/src/components/widgets/WidgetErrorWell.js +153 -0
- package/_esm/src/components/widgets/WidgetErrorWell.js.map +1 -0
- package/_esm/src/components/widgets/WidgetFooter.js +31 -0
- package/_esm/src/components/widgets/WidgetFooter.js.map +1 -0
- package/_esm/src/constants/address.js +11 -0
- package/_esm/src/constants/address.js.map +1 -0
- package/_esm/src/constants/agwRegistryAbi.js +17 -0
- package/_esm/src/constants/agwRegistryAbi.js.map +1 -0
- package/_esm/src/constants/cache.js +3 -0
- package/_esm/src/constants/cache.js.map +1 -0
- package/_esm/src/constants/chainIdToAlchemyNetworkMap.js +11 -0
- package/_esm/src/constants/chainIdToAlchemyNetworkMap.js.map +1 -0
- package/_esm/src/constants/currencies.js +2 -0
- package/_esm/src/constants/currencies.js.map +1 -0
- package/_esm/src/constants/depositAddresses.js +11 -0
- package/_esm/src/constants/depositAddresses.js.map +1 -0
- package/_esm/src/constants/events.js +60 -0
- package/_esm/src/constants/events.js.map +1 -0
- package/_esm/src/constants/maxGasBuffer.js +9 -0
- package/_esm/src/constants/maxGasBuffer.js.map +1 -0
- package/_esm/src/constants/moonPayCurrencies.js +293 -0
- package/_esm/src/constants/moonPayCurrencies.js.map +1 -0
- package/_esm/src/constants/moonPayFiatCurrencies.js +207 -0
- package/_esm/src/constants/moonPayFiatCurrencies.js.map +1 -0
- package/_esm/src/constants/walletCompatibility.js +20 -0
- package/_esm/src/constants/walletCompatibility.js.map +1 -0
- package/_esm/src/hooks/index.js +25 -0
- package/_esm/src/hooks/index.js.map +1 -0
- package/_esm/src/hooks/useAdaptedWalletBalance.js +26 -0
- package/_esm/src/hooks/useAdaptedWalletBalance.js.map +1 -0
- package/_esm/src/hooks/useAtomicBatchSupport.js +33 -0
- package/_esm/src/hooks/useAtomicBatchSupport.js.map +1 -0
- package/_esm/src/hooks/useBitcoinBalance.js +38 -0
- package/_esm/src/hooks/useBitcoinBalance.js.map +1 -0
- package/_esm/src/hooks/useCexAddresses.js +19 -0
- package/_esm/src/hooks/useCexAddresses.js.map +1 -0
- package/_esm/src/hooks/useCurrencyBalance.js +232 -0
- package/_esm/src/hooks/useCurrencyBalance.js.map +1 -0
- package/_esm/src/hooks/useDebounceState.js +33 -0
- package/_esm/src/hooks/useDebounceState.js.map +1 -0
- package/_esm/src/hooks/useDisconnected.js +12 -0
- package/_esm/src/hooks/useDisconnected.js.map +1 -0
- package/_esm/src/hooks/useDuneBalances.js +98 -0
- package/_esm/src/hooks/useDuneBalances.js.map +1 -0
- package/_esm/src/hooks/useENSResolver.js +35 -0
- package/_esm/src/hooks/useENSResolver.js.map +1 -0
- package/_esm/src/hooks/useEclipseBalance.js +44 -0
- package/_esm/src/hooks/useEclipseBalance.js.map +1 -0
- package/_esm/src/hooks/useEnhancedTokensList.js +85 -0
- package/_esm/src/hooks/useEnhancedTokensList.js.map +1 -0
- package/_esm/src/hooks/useFallbackState.js +10 -0
- package/_esm/src/hooks/useFallbackState.js.map +1 -0
- package/_esm/src/hooks/useGasTopUpRequired.js +57 -0
- package/_esm/src/hooks/useGasTopUpRequired.js.map +1 -0
- package/_esm/src/hooks/useHyperliquidUsdcBalance.js +35 -0
- package/_esm/src/hooks/useHyperliquidUsdcBalance.js.map +1 -0
- package/_esm/src/hooks/useInternalRelayChains.js +19 -0
- package/_esm/src/hooks/useInternalRelayChains.js.map +1 -0
- package/_esm/src/hooks/useIpAddress.js +10 -0
- package/_esm/src/hooks/useIpAddress.js.map +1 -0
- package/_esm/src/hooks/useIsAGW.js +31 -0
- package/_esm/src/hooks/useIsAGW.js.map +1 -0
- package/_esm/src/hooks/useIsPassthrough.js +53 -0
- package/_esm/src/hooks/useIsPassthrough.js.map +1 -0
- package/_esm/src/hooks/useIsWalletCompatible.js +40 -0
- package/_esm/src/hooks/useIsWalletCompatible.js.map +1 -0
- package/_esm/src/hooks/useMoonPayCurrencies.js +21 -0
- package/_esm/src/hooks/useMoonPayCurrencies.js.map +1 -0
- package/_esm/src/hooks/useMoonPayGeolocation.js +23 -0
- package/_esm/src/hooks/useMoonPayGeolocation.js.map +1 -0
- package/_esm/src/hooks/useMoonPayTransaction.js +23 -0
- package/_esm/src/hooks/useMoonPayTransaction.js.map +1 -0
- package/_esm/src/hooks/useMounted.js +9 -0
- package/_esm/src/hooks/useMounted.js.map +1 -0
- package/_esm/src/hooks/usePreviousValueChange.js +12 -0
- package/_esm/src/hooks/usePreviousValueChange.js.map +1 -0
- package/_esm/src/hooks/useRelayClient.js +6 -0
- package/_esm/src/hooks/useRelayClient.js.map +1 -0
- package/_esm/src/hooks/useSuiBalance.js +45 -0
- package/_esm/src/hooks/useSuiBalance.js.map +1 -0
- package/_esm/src/hooks/useSupportedMoonPayCurrencyCode.js +61 -0
- package/_esm/src/hooks/useSupportedMoonPayCurrencyCode.js.map +1 -0
- package/_esm/src/hooks/useWalletAddress.js +20 -0
- package/_esm/src/hooks/useWalletAddress.js.map +1 -0
- package/_esm/src/hooks/widget/useSwapButtonCta.js +77 -0
- package/_esm/src/hooks/widget/useSwapButtonCta.js.map +1 -0
- package/_esm/src/icons/SwitchIcon.js +6 -0
- package/_esm/src/icons/SwitchIcon.js.map +1 -0
- package/_esm/src/icons/index.js +2 -0
- package/_esm/src/icons/index.js.map +1 -0
- package/_esm/src/img/AllChainsLogo.js +7 -0
- package/_esm/src/img/AllChainsLogo.js.map +1 -0
- package/_esm/src/img/MoonPayLogo.js +7 -0
- package/_esm/src/img/MoonPayLogo.js.map +1 -0
- package/_esm/src/img/ReservoirText.js +7 -0
- package/_esm/src/img/ReservoirText.js.map +1 -0
- package/_esm/src/index.js +13 -0
- package/_esm/src/index.js.map +1 -0
- package/_esm/src/providers/RelayClientProvider.js +10 -0
- package/_esm/src/providers/RelayClientProvider.js.map +1 -0
- package/_esm/src/providers/RelayKitProvider.js +120 -0
- package/_esm/src/providers/RelayKitProvider.js.map +1 -0
- package/_esm/src/styles.css +3408 -0
- package/_esm/src/themes/RelayKitTheme.js +86 -0
- package/_esm/src/themes/RelayKitTheme.js.map +1 -0
- package/_esm/src/themes/index.js +2 -0
- package/_esm/src/themes/index.js.map +1 -0
- package/_esm/src/types/BridgeFee.js +2 -0
- package/_esm/src/types/BridgeFee.js.map +1 -0
- package/_esm/src/types/Fiat.js +2 -0
- package/_esm/src/types/Fiat.js.map +1 -0
- package/_esm/src/types/RelayTransaction.js +2 -0
- package/_esm/src/types/RelayTransaction.js.map +1 -0
- package/_esm/src/types/index.js +2 -0
- package/_esm/src/types/index.js.map +1 -0
- package/_esm/src/utils/address.js +68 -0
- package/_esm/src/utils/address.js.map +1 -0
- package/_esm/src/utils/bitcoin.js +8 -0
- package/_esm/src/utils/bitcoin.js.map +1 -0
- package/_esm/src/utils/browser.js +4 -0
- package/_esm/src/utils/browser.js.map +1 -0
- package/_esm/src/utils/ens.js +5 -0
- package/_esm/src/utils/ens.js.map +1 -0
- package/_esm/src/utils/errors.js +36 -0
- package/_esm/src/utils/errors.js.map +1 -0
- package/_esm/src/utils/fetcher.js +15 -0
- package/_esm/src/utils/fetcher.js.map +1 -0
- package/_esm/src/utils/getChainBlockExplorerUrl.js +11 -0
- package/_esm/src/utils/getChainBlockExplorerUrl.js.map +1 -0
- package/_esm/src/utils/getTxBlockExplorerUrl.js +23 -0
- package/_esm/src/utils/getTxBlockExplorerUrl.js.map +1 -0
- package/_esm/src/utils/hashing.js +38 -0
- package/_esm/src/utils/hashing.js.map +1 -0
- package/_esm/src/utils/localStorage.js +93 -0
- package/_esm/src/utils/localStorage.js.map +1 -0
- package/_esm/src/utils/moonPay.js +44 -0
- package/_esm/src/utils/moonPay.js.map +1 -0
- package/_esm/src/utils/nativeMaxAmount.js +172 -0
- package/_esm/src/utils/nativeMaxAmount.js.map +1 -0
- package/_esm/src/utils/numbers.js +191 -0
- package/_esm/src/utils/numbers.js.map +1 -0
- package/_esm/src/utils/qrcode.js +19 -0
- package/_esm/src/utils/qrcode.js.map +1 -0
- package/_esm/src/utils/quote.js +248 -0
- package/_esm/src/utils/quote.js.map +1 -0
- package/_esm/src/utils/relayTransaction.js +80 -0
- package/_esm/src/utils/relayTransaction.js.map +1 -0
- package/_esm/src/utils/slippage.js +14 -0
- package/_esm/src/utils/slippage.js.map +1 -0
- package/_esm/src/utils/solana.js +12 -0
- package/_esm/src/utils/solana.js.map +1 -0
- package/_esm/src/utils/steps.js +102 -0
- package/_esm/src/utils/steps.js.map +1 -0
- package/_esm/src/utils/sui.js +11 -0
- package/_esm/src/utils/sui.js.map +1 -0
- package/_esm/src/utils/theme.js +37 -0
- package/_esm/src/utils/theme.js.map +1 -0
- package/_esm/src/utils/time.js +29 -0
- package/_esm/src/utils/time.js.map +1 -0
- package/_esm/src/utils/titleCase.js +12 -0
- package/_esm/src/utils/titleCase.js.map +1 -0
- package/_esm/src/utils/tokenSelector.js +79 -0
- package/_esm/src/utils/tokenSelector.js.map +1 -0
- package/_esm/src/utils/tokens.js +50 -0
- package/_esm/src/utils/tokens.js.map +1 -0
- package/_esm/src/utils/tron.js +8 -0
- package/_esm/src/utils/tron.js.map +1 -0
- package/_esm/src/utils/truncate.js +23 -0
- package/_esm/src/utils/truncate.js.map +1 -0
- package/_esm/src/version.js +2 -0
- package/_esm/src/version.js.map +1 -0
- package/_esm/tsconfig.build.tsbuildinfo +1 -0
- package/_types/src/components/common/AmountInput.d.ts +10 -0
- package/_types/src/components/common/AmountInput.d.ts.map +1 -0
- package/_types/src/components/common/BalanceDisplay.d.ts +14 -0
- package/_types/src/components/common/BalanceDisplay.d.ts.map +1 -0
- package/_types/src/components/common/CopyToClipBoard.d.ts +7 -0
- package/_types/src/components/common/CopyToClipBoard.d.ts.map +1 -0
- package/_types/src/components/common/CustomAddressModal.d.ts +22 -0
- package/_types/src/components/common/CustomAddressModal.d.ts.map +1 -0
- package/_types/src/components/common/ErrorWell.d.ts +11 -0
- package/_types/src/components/common/ErrorWell.d.ts.map +1 -0
- package/_types/src/components/common/LoadingSpinner.d.ts +6 -0
- package/_types/src/components/common/LoadingSpinner.d.ts.map +1 -0
- package/_types/src/components/common/Modal.d.ts +15 -0
- package/_types/src/components/common/Modal.d.ts.map +1 -0
- package/_types/src/components/common/MultiWalletDropdown.d.ts +17 -0
- package/_types/src/components/common/MultiWalletDropdown.d.ts.map +1 -0
- package/_types/src/components/common/RefundReason.d.ts +8 -0
- package/_types/src/components/common/RefundReason.d.ts.map +1 -0
- package/_types/src/components/common/SlippageToleranceConfig.d.ts +8 -0
- package/_types/src/components/common/SlippageToleranceConfig.d.ts.map +1 -0
- package/_types/src/components/common/TokenSelector/ChainFilter.d.ts +16 -0
- package/_types/src/components/common/TokenSelector/ChainFilter.d.ts.map +1 -0
- package/_types/src/components/common/TokenSelector/ChainFilterSidebar.d.ts +20 -0
- package/_types/src/components/common/TokenSelector/ChainFilterSidebar.d.ts.map +1 -0
- package/_types/src/components/common/TokenSelector/SuggestedTokens.d.ts +10 -0
- package/_types/src/components/common/TokenSelector/SuggestedTokens.d.ts.map +1 -0
- package/_types/src/components/common/TokenSelector/TagPill.d.ts +7 -0
- package/_types/src/components/common/TokenSelector/TagPill.d.ts.map +1 -0
- package/_types/src/components/common/TokenSelector/TokenList.d.ts +13 -0
- package/_types/src/components/common/TokenSelector/TokenList.d.ts.map +1 -0
- package/_types/src/components/common/TokenSelector/TokenSelector.d.ts +22 -0
- package/_types/src/components/common/TokenSelector/TokenSelector.d.ts.map +1 -0
- package/_types/src/components/common/TokenSelector/triggers/TokenTrigger.d.ts +11 -0
- package/_types/src/components/common/TokenSelector/triggers/TokenTrigger.d.ts.map +1 -0
- package/_types/src/components/common/TransactionModal/DepositAddressModal.d.ts +26 -0
- package/_types/src/components/common/TransactionModal/DepositAddressModal.d.ts.map +1 -0
- package/_types/src/components/common/TransactionModal/DepositAddressModalRenderer.d.ts +57 -0
- package/_types/src/components/common/TransactionModal/DepositAddressModalRenderer.d.ts.map +1 -0
- package/_types/src/components/common/TransactionModal/TransactionModal.d.ts +33 -0
- package/_types/src/components/common/TransactionModal/TransactionModal.d.ts.map +1 -0
- package/_types/src/components/common/TransactionModal/TransactionModalRenderer.d.ts +63 -0
- package/_types/src/components/common/TransactionModal/TransactionModalRenderer.d.ts.map +1 -0
- package/_types/src/components/common/TransactionModal/steps/ApprovalPlusSwapStep.d.ts +15 -0
- package/_types/src/components/common/TransactionModal/steps/ApprovalPlusSwapStep.d.ts.map +1 -0
- package/_types/src/components/common/TransactionModal/steps/DepositAddressValidatingStep.d.ts +9 -0
- package/_types/src/components/common/TransactionModal/steps/DepositAddressValidatingStep.d.ts.map +1 -0
- package/_types/src/components/common/TransactionModal/steps/ErrorStep.d.ts +17 -0
- package/_types/src/components/common/TransactionModal/steps/ErrorStep.d.ts.map +1 -0
- package/_types/src/components/common/TransactionModal/steps/SwapConfirmationStep.d.ts +30 -0
- package/_types/src/components/common/TransactionModal/steps/SwapConfirmationStep.d.ts.map +1 -0
- package/_types/src/components/common/TransactionModal/steps/SwapSuccessStep.d.ts +24 -0
- package/_types/src/components/common/TransactionModal/steps/SwapSuccessStep.d.ts.map +1 -0
- package/_types/src/components/common/TransactionModal/steps/TransactionsByChain.d.ts +14 -0
- package/_types/src/components/common/TransactionModal/steps/TransactionsByChain.d.ts.map +1 -0
- package/_types/src/components/common/TransactionModal/steps/WaitingForDepositStep.d.ts +13 -0
- package/_types/src/components/common/TransactionModal/steps/WaitingForDepositStep.d.ts.map +1 -0
- package/_types/src/components/common/UnverifiedTokenModal.d.ts +16 -0
- package/_types/src/components/common/UnverifiedTokenModal.d.ts.map +1 -0
- package/_types/src/components/primitives/AccessibleList.d.ts +17 -0
- package/_types/src/components/primitives/AccessibleList.d.ts.map +1 -0
- package/_types/src/components/primitives/Anchor.d.ts +44 -0
- package/_types/src/components/primitives/Anchor.d.ts.map +1 -0
- package/_types/src/components/primitives/Box.d.ts +10 -0
- package/_types/src/components/primitives/Box.d.ts.map +1 -0
- package/_types/src/components/primitives/Button.d.ts +11 -0
- package/_types/src/components/primitives/Button.d.ts.map +1 -0
- package/_types/src/components/primitives/ChainIcon.d.ts +12 -0
- package/_types/src/components/primitives/ChainIcon.d.ts.map +1 -0
- package/_types/src/components/primitives/ChainTokenIcon.d.ts +13 -0
- package/_types/src/components/primitives/ChainTokenIcon.d.ts.map +1 -0
- package/_types/src/components/primitives/Collapsible.d.ts +20 -0
- package/_types/src/components/primitives/Collapsible.d.ts.map +1 -0
- package/_types/src/components/primitives/Dialog.d.ts +23 -0
- package/_types/src/components/primitives/Dialog.d.ts.map +1 -0
- package/_types/src/components/primitives/Dropdown.d.ts +16 -0
- package/_types/src/components/primitives/Dropdown.d.ts.map +1 -0
- package/_types/src/components/primitives/Flex.d.ts +71 -0
- package/_types/src/components/primitives/Flex.d.ts.map +1 -0
- package/_types/src/components/primitives/Input.d.ts +18 -0
- package/_types/src/components/primitives/Input.d.ts.map +1 -0
- package/_types/src/components/primitives/Pill.d.ts +50 -0
- package/_types/src/components/primitives/Pill.d.ts.map +1 -0
- package/_types/src/components/primitives/Skeleton.d.ts +8 -0
- package/_types/src/components/primitives/Skeleton.d.ts.map +1 -0
- package/_types/src/components/primitives/Switch.d.ts +10 -0
- package/_types/src/components/primitives/Switch.d.ts.map +1 -0
- package/_types/src/components/primitives/Tabs.d.ts +17 -0
- package/_types/src/components/primitives/Tabs.d.ts.map +1 -0
- package/_types/src/components/primitives/Text.d.ts +99 -0
- package/_types/src/components/primitives/Text.d.ts.map +1 -0
- package/_types/src/components/primitives/Tooltip.d.ts +3 -0
- package/_types/src/components/primitives/Tooltip.d.ts.map +1 -0
- package/_types/src/components/primitives/index.d.ts +14 -0
- package/_types/src/components/primitives/index.d.ts.map +1 -0
- package/_types/src/components/widgets/FeeBreakdown.d.ts +14 -0
- package/_types/src/components/widgets/FeeBreakdown.d.ts.map +1 -0
- package/_types/src/components/widgets/FetchingQuoteLoader.d.ts +9 -0
- package/_types/src/components/widgets/FetchingQuoteLoader.d.ts.map +1 -0
- package/_types/src/components/widgets/OnrampWidget/index.d.ts +2 -0
- package/_types/src/components/widgets/OnrampWidget/index.d.ts.map +1 -0
- package/_types/src/components/widgets/OnrampWidget/modals/OnrampModal.d.ts +41 -0
- package/_types/src/components/widgets/OnrampWidget/modals/OnrampModal.d.ts.map +1 -0
- package/_types/src/components/widgets/OnrampWidget/modals/steps/OnrampConfirmingStep.d.ts +22 -0
- package/_types/src/components/widgets/OnrampWidget/modals/steps/OnrampConfirmingStep.d.ts.map +1 -0
- package/_types/src/components/widgets/OnrampWidget/modals/steps/OnrampMoonPayStep.d.ts +33 -0
- package/_types/src/components/widgets/OnrampWidget/modals/steps/OnrampMoonPayStep.d.ts.map +1 -0
- package/_types/src/components/widgets/OnrampWidget/modals/steps/OnrampProcessingPassthroughStep.d.ts +11 -0
- package/_types/src/components/widgets/OnrampWidget/modals/steps/OnrampProcessingPassthroughStep.d.ts.map +1 -0
- package/_types/src/components/widgets/OnrampWidget/modals/steps/OnrampProcessingStepUI.d.ts +19 -0
- package/_types/src/components/widgets/OnrampWidget/modals/steps/OnrampProcessingStepUI.d.ts.map +1 -0
- package/_types/src/components/widgets/OnrampWidget/modals/steps/OnrampSuccessStep.d.ts +15 -0
- package/_types/src/components/widgets/OnrampWidget/modals/steps/OnrampSuccessStep.d.ts.map +1 -0
- package/_types/src/components/widgets/OnrampWidget/widget/FiatCurrencyModal.d.ts +10 -0
- package/_types/src/components/widgets/OnrampWidget/widget/FiatCurrencyModal.d.ts.map +1 -0
- package/_types/src/components/widgets/OnrampWidget/widget/OnrampWidgetRenderer.d.ts +45 -0
- package/_types/src/components/widgets/OnrampWidget/widget/OnrampWidgetRenderer.d.ts.map +1 -0
- package/_types/src/components/widgets/OnrampWidget/widget/index.d.ts +38 -0
- package/_types/src/components/widgets/OnrampWidget/widget/index.d.ts.map +1 -0
- package/_types/src/components/widgets/PriceImpactTooltip.d.ts +10 -0
- package/_types/src/components/widgets/PriceImpactTooltip.d.ts.map +1 -0
- package/_types/src/components/widgets/SwapButton.d.ts +14 -0
- package/_types/src/components/widgets/SwapButton.d.ts.map +1 -0
- package/_types/src/components/widgets/SwapRouteSelector.d.ts +14 -0
- package/_types/src/components/widgets/SwapRouteSelector.d.ts.map +1 -0
- package/_types/src/components/widgets/SwapWidget/GasTopUpSection.d.ts +13 -0
- package/_types/src/components/widgets/SwapWidget/GasTopUpSection.d.ts.map +1 -0
- package/_types/src/components/widgets/SwapWidget/index.d.ts +50 -0
- package/_types/src/components/widgets/SwapWidget/index.d.ts.map +1 -0
- package/_types/src/components/widgets/SwapWidgetRenderer.d.ts +133 -0
- package/_types/src/components/widgets/SwapWidgetRenderer.d.ts.map +1 -0
- package/_types/src/components/widgets/TokenSelectorContainer.d.ts +8 -0
- package/_types/src/components/widgets/TokenSelectorContainer.d.ts.map +1 -0
- package/_types/src/components/widgets/WidgetContainer.d.ts +29 -0
- package/_types/src/components/widgets/WidgetContainer.d.ts.map +1 -0
- package/_types/src/components/widgets/WidgetErrorWell.d.ts +26 -0
- package/_types/src/components/widgets/WidgetErrorWell.d.ts.map +1 -0
- package/_types/src/components/widgets/WidgetFooter.d.ts +3 -0
- package/_types/src/components/widgets/WidgetFooter.d.ts.map +1 -0
- package/_types/src/constants/address.d.ts +5 -0
- package/_types/src/constants/address.d.ts.map +1 -0
- package/_types/src/constants/agwRegistryAbi.d.ts +16 -0
- package/_types/src/constants/agwRegistryAbi.d.ts.map +1 -0
- package/_types/src/constants/cache.d.ts +3 -0
- package/_types/src/constants/cache.d.ts.map +1 -0
- package/_types/src/constants/chainIdToAlchemyNetworkMap.d.ts +2 -0
- package/_types/src/constants/chainIdToAlchemyNetworkMap.d.ts.map +1 -0
- package/_types/src/constants/currencies.d.ts +8 -0
- package/_types/src/constants/currencies.d.ts.map +1 -0
- package/_types/src/constants/depositAddresses.d.ts +2 -0
- package/_types/src/constants/depositAddresses.d.ts.map +1 -0
- package/_types/src/constants/events.d.ts +59 -0
- package/_types/src/constants/events.d.ts.map +1 -0
- package/_types/src/constants/maxGasBuffer.d.ts +9 -0
- package/_types/src/constants/maxGasBuffer.d.ts.map +1 -0
- package/_types/src/constants/moonPayCurrencies.d.ts +11 -0
- package/_types/src/constants/moonPayCurrencies.d.ts.map +1 -0
- package/_types/src/constants/moonPayFiatCurrencies.d.ts +8 -0
- package/_types/src/constants/moonPayFiatCurrencies.d.ts.map +1 -0
- package/_types/src/constants/walletCompatibility.d.ts +4 -0
- package/_types/src/constants/walletCompatibility.d.ts.map +1 -0
- package/_types/src/hooks/index.d.ts +25 -0
- package/_types/src/hooks/index.d.ts.map +1 -0
- package/_types/src/hooks/useAdaptedWalletBalance.d.ts +175 -0
- package/_types/src/hooks/useAdaptedWalletBalance.d.ts.map +1 -0
- package/_types/src/hooks/useAtomicBatchSupport.d.ts +9 -0
- package/_types/src/hooks/useAtomicBatchSupport.d.ts.map +1 -0
- package/_types/src/hooks/useBitcoinBalance.d.ts +13 -0
- package/_types/src/hooks/useBitcoinBalance.d.ts.map +1 -0
- package/_types/src/hooks/useCexAddresses.d.ts +6 -0
- package/_types/src/hooks/useCexAddresses.d.ts.map +1 -0
- package/_types/src/hooks/useCurrencyBalance.d.ts +23 -0
- package/_types/src/hooks/useCurrencyBalance.d.ts.map +1 -0
- package/_types/src/hooks/useDebounceState.d.ts +11 -0
- package/_types/src/hooks/useDebounceState.d.ts.map +1 -0
- package/_types/src/hooks/useDisconnected.d.ts +4 -0
- package/_types/src/hooks/useDisconnected.d.ts.map +1 -0
- package/_types/src/hooks/useDuneBalances.d.ts +25 -0
- package/_types/src/hooks/useDuneBalances.d.ts.map +1 -0
- package/_types/src/hooks/useENSResolver.d.ts +14 -0
- package/_types/src/hooks/useENSResolver.d.ts.map +1 -0
- package/_types/src/hooks/useEclipseBalance.d.ts +12 -0
- package/_types/src/hooks/useEclipseBalance.d.ts.map +1 -0
- package/_types/src/hooks/useEnhancedTokensList.d.ts +23 -0
- package/_types/src/hooks/useEnhancedTokensList.d.ts.map +1 -0
- package/_types/src/hooks/useFallbackState.d.ts +5 -0
- package/_types/src/hooks/useFallbackState.d.ts.map +1 -0
- package/_types/src/hooks/useGasTopUpRequired.d.ts +9 -0
- package/_types/src/hooks/useGasTopUpRequired.d.ts.map +1 -0
- package/_types/src/hooks/useHyperliquidUsdcBalance.d.ts +23 -0
- package/_types/src/hooks/useHyperliquidUsdcBalance.d.ts.map +1 -0
- package/_types/src/hooks/useInternalRelayChains.d.ts +131 -0
- package/_types/src/hooks/useInternalRelayChains.d.ts.map +1 -0
- package/_types/src/hooks/useIpAddress.d.ts +9 -0
- package/_types/src/hooks/useIpAddress.d.ts.map +1 -0
- package/_types/src/hooks/useIsAGW.d.ts +2 -0
- package/_types/src/hooks/useIsAGW.d.ts.map +1 -0
- package/_types/src/hooks/useIsPassthrough.d.ts +17 -0
- package/_types/src/hooks/useIsPassthrough.d.ts.map +1 -0
- package/_types/src/hooks/useIsWalletCompatible.d.ts +4 -0
- package/_types/src/hooks/useIsWalletCompatible.d.ts.map +1 -0
- package/_types/src/hooks/useMoonPayCurrencies.d.ts +51 -0
- package/_types/src/hooks/useMoonPayCurrencies.d.ts.map +1 -0
- package/_types/src/hooks/useMoonPayGeolocation.d.ts +25 -0
- package/_types/src/hooks/useMoonPayGeolocation.d.ts.map +1 -0
- package/_types/src/hooks/useMoonPayTransaction.d.ts +22 -0
- package/_types/src/hooks/useMoonPayTransaction.d.ts.map +1 -0
- package/_types/src/hooks/useMounted.d.ts +3 -0
- package/_types/src/hooks/useMounted.d.ts.map +1 -0
- package/_types/src/hooks/usePreviousValueChange.d.ts +3 -0
- package/_types/src/hooks/usePreviousValueChange.d.ts.map +1 -0
- package/_types/src/hooks/useRelayClient.d.ts +2 -0
- package/_types/src/hooks/useRelayClient.d.ts.map +1 -0
- package/_types/src/hooks/useSuiBalance.d.ts +14 -0
- package/_types/src/hooks/useSuiBalance.d.ts.map +1 -0
- package/_types/src/hooks/useSupportedMoonPayCurrencyCode.d.ts +11 -0
- package/_types/src/hooks/useSupportedMoonPayCurrencyCode.d.ts.map +1 -0
- package/_types/src/hooks/useWalletAddress.d.ts +5 -0
- package/_types/src/hooks/useWalletAddress.d.ts.map +1 -0
- package/_types/src/hooks/widget/useSwapButtonCta.d.ts +28 -0
- package/_types/src/hooks/widget/useSwapButtonCta.d.ts.map +1 -0
- package/_types/src/icons/SwitchIcon.d.ts +9 -0
- package/_types/src/icons/SwitchIcon.d.ts.map +1 -0
- package/_types/src/icons/index.d.ts +2 -0
- package/_types/src/icons/index.d.ts.map +1 -0
- package/_types/src/img/AllChainsLogo.d.ts +4 -0
- package/_types/src/img/AllChainsLogo.d.ts.map +1 -0
- package/_types/src/img/MoonPayLogo.d.ts +4 -0
- package/_types/src/img/MoonPayLogo.d.ts.map +1 -0
- package/_types/src/img/ReservoirText.d.ts +4 -0
- package/_types/src/img/ReservoirText.d.ts.map +1 -0
- package/_types/src/index.d.ts +11 -0
- package/_types/src/index.d.ts.map +1 -0
- package/_types/src/providers/RelayClientProvider.d.ts +9 -0
- package/_types/src/providers/RelayClientProvider.d.ts.map +1 -0
- package/_types/src/providers/RelayKitProvider.d.ts +58 -0
- package/_types/src/providers/RelayKitProvider.d.ts.map +1 -0
- package/_types/src/themes/RelayKitTheme.d.ts +78 -0
- package/_types/src/themes/RelayKitTheme.d.ts.map +1 -0
- package/_types/src/themes/index.d.ts +3 -0
- package/_types/src/themes/index.d.ts.map +1 -0
- package/_types/src/types/BridgeFee.d.ts +15 -0
- package/_types/src/types/BridgeFee.d.ts.map +1 -0
- package/_types/src/types/Fiat.d.ts +7 -0
- package/_types/src/types/Fiat.d.ts.map +1 -0
- package/_types/src/types/RelayTransaction.d.ts +4 -0
- package/_types/src/types/RelayTransaction.d.ts.map +1 -0
- package/_types/src/types/index.d.ts +21 -0
- package/_types/src/types/index.d.ts.map +1 -0
- package/_types/src/utils/address.d.ts +8 -0
- package/_types/src/utils/address.d.ts.map +1 -0
- package/_types/src/utils/bitcoin.d.ts +5 -0
- package/_types/src/utils/bitcoin.d.ts.map +1 -0
- package/_types/src/utils/browser.d.ts +2 -0
- package/_types/src/utils/browser.d.ts.map +1 -0
- package/_types/src/utils/ens.d.ts +2 -0
- package/_types/src/utils/ens.d.ts.map +1 -0
- package/_types/src/utils/errors.d.ts +3 -0
- package/_types/src/utils/errors.d.ts.map +1 -0
- package/_types/src/utils/fetcher.d.ts +4 -0
- package/_types/src/utils/fetcher.d.ts.map +1 -0
- package/_types/src/utils/getChainBlockExplorerUrl.d.ts +4 -0
- package/_types/src/utils/getChainBlockExplorerUrl.d.ts.map +1 -0
- package/_types/src/utils/getTxBlockExplorerUrl.d.ts +3 -0
- package/_types/src/utils/getTxBlockExplorerUrl.d.ts.map +1 -0
- package/_types/src/utils/hashing.d.ts +2 -0
- package/_types/src/utils/hashing.d.ts.map +1 -0
- package/_types/src/utils/localStorage.d.ts +30 -0
- package/_types/src/utils/localStorage.d.ts.map +1 -0
- package/_types/src/utils/moonPay.d.ts +11 -0
- package/_types/src/utils/moonPay.d.ts.map +1 -0
- package/_types/src/utils/nativeMaxAmount.d.ts +34 -0
- package/_types/src/utils/nativeMaxAmount.d.ts.map +1 -0
- package/_types/src/utils/numbers.d.ts +21 -0
- package/_types/src/utils/numbers.d.ts.map +1 -0
- package/_types/src/utils/qrcode.d.ts +3 -0
- package/_types/src/utils/qrcode.d.ts.map +1 -0
- package/_types/src/utils/quote.d.ts +132 -0
- package/_types/src/utils/quote.d.ts.map +1 -0
- package/_types/src/utils/relayTransaction.d.ts +21 -0
- package/_types/src/utils/relayTransaction.d.ts.map +1 -0
- package/_types/src/utils/slippage.d.ts +9 -0
- package/_types/src/utils/slippage.d.ts.map +1 -0
- package/_types/src/utils/solana.d.ts +10 -0
- package/_types/src/utils/solana.d.ts.map +1 -0
- package/_types/src/utils/steps.d.ts +43 -0
- package/_types/src/utils/steps.d.ts.map +1 -0
- package/_types/src/utils/sui.d.ts +8 -0
- package/_types/src/utils/sui.d.ts.map +1 -0
- package/_types/src/utils/theme.d.ts +5 -0
- package/_types/src/utils/theme.d.ts.map +1 -0
- package/_types/src/utils/time.d.ts +4 -0
- package/_types/src/utils/time.d.ts.map +1 -0
- package/_types/src/utils/titleCase.d.ts +8 -0
- package/_types/src/utils/titleCase.d.ts.map +1 -0
- package/_types/src/utils/tokenSelector.d.ts +23 -0
- package/_types/src/utils/tokenSelector.d.ts.map +1 -0
- package/_types/src/utils/tokens.d.ts +21 -0
- package/_types/src/utils/tokens.d.ts.map +1 -0
- package/_types/src/utils/tron.d.ts +6 -0
- package/_types/src/utils/tron.d.ts.map +1 -0
- package/_types/src/utils/truncate.d.ts +13 -0
- package/_types/src/utils/truncate.d.ts.map +1 -0
- package/_types/src/version.d.ts +2 -0
- package/_types/src/version.d.ts.map +1 -0
- package/_types/tsconfig.build.tsbuildinfo +1 -0
- package/dist/panda.buildinfo.json +575 -0
- package/dist/styles.css +3408 -0
- package/package.json +109 -0
- package/readme.md +36 -0
|
@@ -0,0 +1,955 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Flex, Button, Text, Box } from '../../primitives/index.js';
|
|
3
|
+
import { useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
|
4
|
+
import { useRelayClient } from '../../../hooks/index.js';
|
|
5
|
+
import { formatUnits } from 'viem';
|
|
6
|
+
import { usePublicClient } from 'wagmi';
|
|
7
|
+
import { formatFixedLength, formatDollar, formatNumber } from '../../../utils/numbers.js';
|
|
8
|
+
import AmountInput from '../../common/AmountInput.js';
|
|
9
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
10
|
+
import { SwitchIcon } from '../../../icons/index.js';
|
|
11
|
+
import { getFeeBufferAmount } from '../../../utils/nativeMaxAmount.js';
|
|
12
|
+
import { WidgetErrorWell } from '../WidgetErrorWell.js';
|
|
13
|
+
import { BalanceDisplay } from '../../common/BalanceDisplay.js';
|
|
14
|
+
import { EventNames } from '../../../constants/events.js';
|
|
15
|
+
import SwapWidgetRenderer from '../SwapWidgetRenderer.js';
|
|
16
|
+
import WidgetContainer from '../WidgetContainer.js';
|
|
17
|
+
import SwapButton from '../SwapButton.js';
|
|
18
|
+
import TokenSelectorContainer from '../TokenSelectorContainer.js';
|
|
19
|
+
import FeeBreakdown from '../FeeBreakdown.js';
|
|
20
|
+
import { faArrowDown, faClipboard } from '@fortawesome/free-solid-svg-icons';
|
|
21
|
+
import { TokenTrigger } from '../../common/TokenSelector/triggers/TokenTrigger.js';
|
|
22
|
+
import { MultiWalletDropdown } from '../../common/MultiWalletDropdown.js';
|
|
23
|
+
import { findSupportedWallet } from '../../../utils/address.js';
|
|
24
|
+
import { isDeadAddress, tronDeadAddress } from '@relayprotocol/relay-sdk';
|
|
25
|
+
import SwapRouteSelector from '../SwapRouteSelector.js';
|
|
26
|
+
import { ProviderOptionsContext } from '../../../providers/RelayKitProvider.js';
|
|
27
|
+
import { findBridgableToken } from '../../../utils/tokens.js';
|
|
28
|
+
import { isChainLocked } from '../../../utils/tokenSelector.js';
|
|
29
|
+
import TokenSelector from '../../common/TokenSelector/TokenSelector.js';
|
|
30
|
+
import { UnverifiedTokenModal } from '../../common/UnverifiedTokenModal.js';
|
|
31
|
+
import { alreadyAcceptedToken } from '../../../utils/localStorage.js';
|
|
32
|
+
import GasTopUpSection from './GasTopUpSection.js';
|
|
33
|
+
import { calculateUsdValue, getSwapEventData } from '../../../utils/quote.js';
|
|
34
|
+
const SwapWidget = ({ fromToken, setFromToken, toToken, setToToken, defaultToAddress, defaultAmount, defaultTradeType, slippageTolerance, lockToToken = false, lockFromToken = false, lockChainId, singleChainMode = false, wallet, multiWalletSupportEnabled = false, linkedWallets, supportedWalletVMs, disableInputAutoFocus = false, popularChainIds, disablePasteWalletAddressOption, onSetPrimaryWallet, onLinkNewWallet, onFromTokenChange, onToTokenChange, onConnectWallet, onAnalyticEvent: _onAnalyticEvent, onSwapSuccess, onSwapValidating, onSwapError }) => {
|
|
35
|
+
const onAnalyticEvent = useCallback((eventName, data) => {
|
|
36
|
+
try {
|
|
37
|
+
_onAnalyticEvent?.(eventName, data);
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
console.error('Error in onAnalyticEvent', eventName, data, e);
|
|
41
|
+
}
|
|
42
|
+
}, [_onAnalyticEvent]);
|
|
43
|
+
const relayClient = useRelayClient();
|
|
44
|
+
const providerOptionsContext = useContext(ProviderOptionsContext);
|
|
45
|
+
const connectorKeyOverrides = providerOptionsContext.vmConnectorKeyOverrides;
|
|
46
|
+
const [transactionModalOpen, setTransactionModalOpen] = useState(false);
|
|
47
|
+
const [depositAddressModalOpen, setDepositAddressModalOpen] = useState(false);
|
|
48
|
+
const [addressModalOpen, setAddressModalOpen] = useState(false);
|
|
49
|
+
const [pendingSuccessFlush, setPendingSuccessFlush] = useState(false);
|
|
50
|
+
const [unverifiedTokens, setUnverifiedTokens] = useState([]);
|
|
51
|
+
const [isUsdInputMode, setIsUsdInputMode] = useState(false);
|
|
52
|
+
const [usdInputValue, setUsdInputValue] = useState('');
|
|
53
|
+
const [usdOutputValue, setUsdOutputValue] = useState('');
|
|
54
|
+
const [tokenInputCache, setTokenInputCache] = useState('');
|
|
55
|
+
const hasLockedToken = lockFromToken || lockToToken;
|
|
56
|
+
const isSingleChainLocked = singleChainMode && lockChainId !== undefined;
|
|
57
|
+
//Handle external unverified tokens
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
if (fromToken && 'verified' in fromToken && !fromToken.verified) {
|
|
60
|
+
const isAlreadyAccepted = alreadyAcceptedToken(fromToken);
|
|
61
|
+
if (!isAlreadyAccepted) {
|
|
62
|
+
unverifiedTokens.push({ token: fromToken, context: 'from' });
|
|
63
|
+
setFromToken?.(undefined);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (toToken && 'verified' in toToken && !toToken.verified) {
|
|
67
|
+
const isAlreadyAccepted = alreadyAcceptedToken(toToken);
|
|
68
|
+
if (!isAlreadyAccepted) {
|
|
69
|
+
unverifiedTokens.push({ token: toToken, context: 'to' });
|
|
70
|
+
setToToken?.(undefined);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}, [fromToken, toToken]);
|
|
74
|
+
return (_jsx(SwapWidgetRenderer, { context: "Swap", transactionModalOpen: transactionModalOpen, setTransactionModalOpen: setTransactionModalOpen, depositAddressModalOpen: depositAddressModalOpen, defaultAmount: defaultAmount, defaultToAddress: defaultToAddress, defaultTradeType: defaultTradeType, toToken: toToken, setToToken: setToToken, fromToken: fromToken, setFromToken: setFromToken, slippageTolerance: slippageTolerance, wallet: wallet, linkedWallets: linkedWallets, multiWalletSupportEnabled: multiWalletSupportEnabled, onSwapError: onSwapError, onAnalyticEvent: onAnalyticEvent, supportedWalletVMs: supportedWalletVMs, children: ({ quote, steps, swap, setSteps, feeBreakdown, fromToken, setFromToken, toToken, setToToken, error, toDisplayName, address, recipient, customToAddress, setCustomToAddress, tradeType, setTradeType, isSameCurrencySameRecipientSwap, debouncedInputAmountValue, debouncedAmountInputControls, setAmountInputValue, amountInputValue, amountOutputValue, debouncedOutputAmountValue, debouncedAmountOutputControls, setAmountOutputValue, toBalance, toBalancePending, isLoadingToBalance, isFetchingQuote, isLoadingFromBalance, fromBalance, fromBalancePending, highRelayerServiceFee, relayerFeeProportion, hasInsufficientBalance, isInsufficientLiquidityError, isCapacityExceededError, isCouldNotExecuteError, ctaCopy, isFromNative, timeEstimate, isSvmSwap, isBvmSwap, isValidFromAddress, isValidToAddress, supportsExternalLiquidity, useExternalLiquidity, slippageTolerance, canonicalTimeEstimate, fromChainWalletVMSupported, toChainWalletVMSupported, isRecipientLinked, swapError, recipientWalletSupportsChain, gasTopUpEnabled, setGasTopUpEnabled, gasTopUpRequired, gasTopUpAmount, gasTopUpAmountUsd, linkedWallet, quoteParameters, setSwapError, setUseExternalLiquidity, invalidateBalanceQueries, invalidateQuoteQuery, quoteInProgress, setQuoteInProgress, abortController, fromTokenPriceData, toTokenPriceData, isLoadingFromTokenPrice, isLoadingToTokenPrice }) => {
|
|
75
|
+
// Calculate the USD value of the input amount
|
|
76
|
+
const inputAmountUsd = useMemo(() => {
|
|
77
|
+
return calculateUsdValue(fromTokenPriceData?.price, amountInputValue);
|
|
78
|
+
}, [fromTokenPriceData, amountInputValue]);
|
|
79
|
+
// Calculate the USD value of the output amount
|
|
80
|
+
const outputAmountUsd = useMemo(() => {
|
|
81
|
+
return calculateUsdValue(toTokenPriceData?.price, amountOutputValue);
|
|
82
|
+
}, [toTokenPriceData, amountOutputValue]);
|
|
83
|
+
const handleMaxAmountClicked = async (amount, percent, bufferAmount) => {
|
|
84
|
+
if (fromToken) {
|
|
85
|
+
const formattedAmount = formatUnits(amount, fromToken?.decimals);
|
|
86
|
+
setAmountInputValue(formattedAmount);
|
|
87
|
+
setTradeType('EXACT_INPUT');
|
|
88
|
+
debouncedAmountOutputControls.cancel();
|
|
89
|
+
debouncedAmountInputControls.flush();
|
|
90
|
+
onAnalyticEvent?.(EventNames.MAX_AMOUNT_CLICKED, {
|
|
91
|
+
percent: percent,
|
|
92
|
+
bufferAmount: bufferAmount ? bufferAmount.toString() : '0',
|
|
93
|
+
chainType: fromChain?.vmType
|
|
94
|
+
});
|
|
95
|
+
if (isUsdInputMode && conversionRate) {
|
|
96
|
+
const numericTokenAmount = Number(formattedAmount);
|
|
97
|
+
if (!isNaN(numericTokenAmount)) {
|
|
98
|
+
const usdEquivalent = numericTokenAmount * conversionRate;
|
|
99
|
+
setUsdInputValue(usdEquivalent.toFixed(2));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
const handleSetFromToken = (token) => {
|
|
105
|
+
if (!token) {
|
|
106
|
+
setFromToken(undefined);
|
|
107
|
+
onFromTokenChange?.(undefined);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
let _token = token;
|
|
111
|
+
const newFromChain = relayClient?.chains.find((chain) => token?.chainId == chain.id);
|
|
112
|
+
if (newFromChain?.vmType &&
|
|
113
|
+
!supportedWalletVMs.includes(newFromChain?.vmType)) {
|
|
114
|
+
setTradeType('EXACT_INPUT');
|
|
115
|
+
const _toToken = findBridgableToken(toChain, toToken);
|
|
116
|
+
if (_toToken && _toToken?.address != toToken?.address) {
|
|
117
|
+
handleSetToToken(_toToken);
|
|
118
|
+
}
|
|
119
|
+
const _fromToken = findBridgableToken(newFromChain, _token);
|
|
120
|
+
if (_fromToken && _fromToken.address != _token?.address) {
|
|
121
|
+
_token = _fromToken;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
setFromToken(_token);
|
|
125
|
+
onFromTokenChange?.(_token);
|
|
126
|
+
};
|
|
127
|
+
const handleSetToToken = (token) => {
|
|
128
|
+
if (!token) {
|
|
129
|
+
setToToken(undefined);
|
|
130
|
+
onToTokenChange?.(undefined);
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
let _token = token;
|
|
134
|
+
if (!fromChainWalletVMSupported) {
|
|
135
|
+
const newToChain = relayClient?.chains.find((chain) => token?.chainId == chain.id);
|
|
136
|
+
if (newToChain) {
|
|
137
|
+
const _toToken = findBridgableToken(newToChain, _token);
|
|
138
|
+
if (_toToken && _toToken.address != _token?.address) {
|
|
139
|
+
_token = _toToken;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
setToToken(_token);
|
|
144
|
+
onToTokenChange?.(_token);
|
|
145
|
+
};
|
|
146
|
+
const fromChain = relayClient?.chains?.find((chain) => chain.id === fromToken?.chainId);
|
|
147
|
+
const toChain = relayClient?.chains?.find((chain) => chain.id === toToken?.chainId);
|
|
148
|
+
// Get public client for the fromChain to estimate gas
|
|
149
|
+
const publicClient = usePublicClient({ chainId: fromChain?.id });
|
|
150
|
+
useEffect(() => {
|
|
151
|
+
if (multiWalletSupportEnabled &&
|
|
152
|
+
fromChain &&
|
|
153
|
+
address &&
|
|
154
|
+
linkedWallets &&
|
|
155
|
+
!isValidFromAddress) {
|
|
156
|
+
const supportedAddress = findSupportedWallet(fromChain, address, linkedWallets, connectorKeyOverrides);
|
|
157
|
+
if (supportedAddress) {
|
|
158
|
+
onSetPrimaryWallet?.(supportedAddress);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
if (multiWalletSupportEnabled &&
|
|
162
|
+
toChain &&
|
|
163
|
+
recipient &&
|
|
164
|
+
linkedWallets &&
|
|
165
|
+
!isValidToAddress) {
|
|
166
|
+
const supportedAddress = findSupportedWallet(toChain, recipient, linkedWallets, connectorKeyOverrides);
|
|
167
|
+
if (supportedAddress) {
|
|
168
|
+
setCustomToAddress(supportedAddress);
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
setCustomToAddress(undefined);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}, [
|
|
175
|
+
multiWalletSupportEnabled,
|
|
176
|
+
fromChain?.id,
|
|
177
|
+
toChain?.id,
|
|
178
|
+
address,
|
|
179
|
+
linkedWallets,
|
|
180
|
+
onSetPrimaryWallet,
|
|
181
|
+
isValidFromAddress,
|
|
182
|
+
isValidToAddress,
|
|
183
|
+
connectorKeyOverrides
|
|
184
|
+
]);
|
|
185
|
+
//Handle if the paste wallet address option is disabled while there is a custom to address
|
|
186
|
+
useEffect(() => {
|
|
187
|
+
if (disablePasteWalletAddressOption && customToAddress) {
|
|
188
|
+
setCustomToAddress(undefined);
|
|
189
|
+
}
|
|
190
|
+
}, [disablePasteWalletAddressOption]);
|
|
191
|
+
const promptSwitchRoute = (isCapacityExceededError || isCouldNotExecuteError) &&
|
|
192
|
+
supportsExternalLiquidity &&
|
|
193
|
+
!isSingleChainLocked;
|
|
194
|
+
const isAutoSlippage = slippageTolerance === undefined;
|
|
195
|
+
const isHighPriceImpact = Number(quote?.details?.totalImpact?.percent) < -3.5;
|
|
196
|
+
const totalImpactUsd = quote?.details?.totalImpact?.usd;
|
|
197
|
+
const showHighPriceImpactWarning = Boolean(isHighPriceImpact && totalImpactUsd && Number(totalImpactUsd) <= -10);
|
|
198
|
+
// Calculate conversion rate
|
|
199
|
+
const conversionRate = useMemo(() => {
|
|
200
|
+
if (isUsdInputMode) {
|
|
201
|
+
// When in USD input mode, the conversion rate is the price of the fromToken.
|
|
202
|
+
if (fromTokenPriceData?.price && fromTokenPriceData.price > 0) {
|
|
203
|
+
return fromTokenPriceData.price;
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
// If no price data, or price is 0, return null to avoid stale calculations.
|
|
207
|
+
return null;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
// When in token input mode, calculate rate from quote if available.
|
|
212
|
+
if (amountInputValue &&
|
|
213
|
+
Number(amountInputValue) > 0 &&
|
|
214
|
+
quote?.details?.currencyIn?.amountUsd) {
|
|
215
|
+
const tokenVal = Number(amountInputValue);
|
|
216
|
+
const usdVal = Number(quote.details.currencyIn.amountUsd);
|
|
217
|
+
if (tokenVal > 0 && usdVal > 0) {
|
|
218
|
+
const rate = usdVal / tokenVal;
|
|
219
|
+
return rate;
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
// If in token mode and token input is cleared or zero, return null
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}, [
|
|
231
|
+
isUsdInputMode,
|
|
232
|
+
fromTokenPriceData?.price,
|
|
233
|
+
quote?.details?.currencyIn?.amountUsd,
|
|
234
|
+
amountInputValue
|
|
235
|
+
]);
|
|
236
|
+
// toggle between token and usd input mode
|
|
237
|
+
const toggleInputMode = () => {
|
|
238
|
+
if (!isUsdInputMode) {
|
|
239
|
+
// Switching TO USD mode
|
|
240
|
+
let newUsdInputValue = '';
|
|
241
|
+
let newUsdOutputValue = '';
|
|
242
|
+
// Calculate USD input value
|
|
243
|
+
if (quote?.details?.currencyIn?.amountUsd &&
|
|
244
|
+
Number(quote.details.currencyIn.amountUsd) > 0) {
|
|
245
|
+
newUsdInputValue = String(Number(quote.details.currencyIn.amountUsd));
|
|
246
|
+
}
|
|
247
|
+
else if (inputAmountUsd && inputAmountUsd > 0) {
|
|
248
|
+
newUsdInputValue = inputAmountUsd.toFixed(2);
|
|
249
|
+
}
|
|
250
|
+
else if (amountInputValue &&
|
|
251
|
+
Number(amountInputValue) > 0 &&
|
|
252
|
+
conversionRate &&
|
|
253
|
+
conversionRate > 0) {
|
|
254
|
+
newUsdInputValue = (Number(amountInputValue) * conversionRate).toFixed(2);
|
|
255
|
+
}
|
|
256
|
+
// Calculate USD output value
|
|
257
|
+
if (quote?.details?.currencyOut?.amountUsd &&
|
|
258
|
+
Number(quote.details.currencyOut.amountUsd) > 0) {
|
|
259
|
+
newUsdOutputValue = String(Number(quote.details.currencyOut.amountUsd));
|
|
260
|
+
}
|
|
261
|
+
else if (outputAmountUsd && outputAmountUsd > 0) {
|
|
262
|
+
newUsdOutputValue = outputAmountUsd.toFixed(2);
|
|
263
|
+
}
|
|
264
|
+
else if (amountOutputValue &&
|
|
265
|
+
Number(amountOutputValue) > 0 &&
|
|
266
|
+
toTokenPriceData?.price &&
|
|
267
|
+
toTokenPriceData.price > 0) {
|
|
268
|
+
newUsdOutputValue = (Number(amountOutputValue) * toTokenPriceData.price).toFixed(2);
|
|
269
|
+
}
|
|
270
|
+
setTokenInputCache(amountInputValue);
|
|
271
|
+
setUsdInputValue(newUsdInputValue);
|
|
272
|
+
setUsdOutputValue(newUsdOutputValue);
|
|
273
|
+
setIsUsdInputMode(true);
|
|
274
|
+
// Default to EXACT_INPUT unless we're currently in EXPECTED_OUTPUT mode with a valid USD output value
|
|
275
|
+
if (tradeType !== 'EXPECTED_OUTPUT' || !newUsdOutputValue) {
|
|
276
|
+
setTradeType('EXACT_INPUT');
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
// Switching FROM USD mode
|
|
281
|
+
if (!usdInputValue && tokenInputCache) {
|
|
282
|
+
setAmountInputValue(tokenInputCache);
|
|
283
|
+
}
|
|
284
|
+
setUsdInputValue('');
|
|
285
|
+
setUsdOutputValue('');
|
|
286
|
+
setIsUsdInputMode(false);
|
|
287
|
+
// Maintain current trade type when switching back to token mode
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
//Update token input value when USD input changes in USD mode
|
|
291
|
+
useEffect(() => {
|
|
292
|
+
if (isUsdInputMode) {
|
|
293
|
+
if (conversionRate && conversionRate > 0 && usdInputValue) {
|
|
294
|
+
const usdValue = Number(usdInputValue);
|
|
295
|
+
if (!isNaN(usdValue) && usdValue > 0) {
|
|
296
|
+
const tokenEquivalent = (usdValue / conversionRate).toFixed(fromToken?.decimals ?? 8);
|
|
297
|
+
setAmountInputValue(tokenEquivalent);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
else if (usdInputValue === '' || Number(usdInputValue) === 0) {
|
|
301
|
+
setAmountInputValue('');
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}, [
|
|
305
|
+
isUsdInputMode,
|
|
306
|
+
usdInputValue,
|
|
307
|
+
conversionRate,
|
|
308
|
+
setAmountInputValue,
|
|
309
|
+
fromToken?.decimals
|
|
310
|
+
]);
|
|
311
|
+
//Update token output value when USD output changes in USD mode
|
|
312
|
+
useEffect(() => {
|
|
313
|
+
if (isUsdInputMode && tradeType === 'EXPECTED_OUTPUT') {
|
|
314
|
+
if (toTokenPriceData?.price &&
|
|
315
|
+
toTokenPriceData.price > 0 &&
|
|
316
|
+
usdOutputValue) {
|
|
317
|
+
const usdValue = Number(usdOutputValue);
|
|
318
|
+
if (!isNaN(usdValue) && usdValue > 0) {
|
|
319
|
+
const tokenEquivalent = (usdValue / toTokenPriceData.price).toFixed(toToken?.decimals ?? 8);
|
|
320
|
+
setAmountOutputValue(tokenEquivalent);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
else if (usdOutputValue === '' || Number(usdOutputValue) === 0) {
|
|
324
|
+
setAmountOutputValue('');
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}, [
|
|
328
|
+
isUsdInputMode,
|
|
329
|
+
tradeType,
|
|
330
|
+
usdOutputValue,
|
|
331
|
+
toTokenPriceData?.price,
|
|
332
|
+
setAmountOutputValue,
|
|
333
|
+
toToken?.decimals
|
|
334
|
+
]);
|
|
335
|
+
//Update USD output value when in USD mode
|
|
336
|
+
useEffect(() => {
|
|
337
|
+
if (isUsdInputMode) {
|
|
338
|
+
// For EXPECTED_OUTPUT, don't override user's typed value
|
|
339
|
+
if (tradeType === 'EXPECTED_OUTPUT') {
|
|
340
|
+
// User is controlling the output value directly
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
// For EXACT_INPUT, update based on quote or calculations
|
|
344
|
+
if (quote?.details?.currencyOut?.amountUsd && !isFetchingQuote) {
|
|
345
|
+
// Use quote USD value when available
|
|
346
|
+
const quoteUsdValue = Number(quote.details.currencyOut.amountUsd);
|
|
347
|
+
if (!isNaN(quoteUsdValue) && quoteUsdValue >= 0) {
|
|
348
|
+
setUsdOutputValue(quoteUsdValue.toFixed(2));
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
else if (toTokenPriceData?.price &&
|
|
352
|
+
toTokenPriceData.price > 0 &&
|
|
353
|
+
amountOutputValue &&
|
|
354
|
+
Number(amountOutputValue) > 0) {
|
|
355
|
+
// Fallback to direct token price calculation
|
|
356
|
+
const tokenAmount = Number(amountOutputValue);
|
|
357
|
+
const usdEquivalent = tokenAmount * toTokenPriceData.price;
|
|
358
|
+
if (!isNaN(usdEquivalent) && usdEquivalent >= 0) {
|
|
359
|
+
setUsdOutputValue(usdEquivalent.toFixed(2));
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
else if (!amountOutputValue || Number(amountOutputValue) === 0) {
|
|
363
|
+
setUsdOutputValue('');
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}, [
|
|
367
|
+
isUsdInputMode,
|
|
368
|
+
tradeType,
|
|
369
|
+
quote?.details?.currencyOut?.amountUsd,
|
|
370
|
+
isFetchingQuote,
|
|
371
|
+
toTokenPriceData?.price,
|
|
372
|
+
amountOutputValue
|
|
373
|
+
]);
|
|
374
|
+
//Update USD input value when in EXPECTED_OUTPUT mode
|
|
375
|
+
useEffect(() => {
|
|
376
|
+
if (isUsdInputMode && tradeType === 'EXPECTED_OUTPUT') {
|
|
377
|
+
if (quote?.details?.currencyIn?.amountUsd && !isFetchingQuote) {
|
|
378
|
+
// Use quote USD value when available
|
|
379
|
+
const quoteUsdValue = Number(quote.details.currencyIn.amountUsd);
|
|
380
|
+
if (!isNaN(quoteUsdValue) && quoteUsdValue >= 0) {
|
|
381
|
+
setUsdInputValue(quoteUsdValue.toFixed(2));
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
else if (!amountInputValue || Number(amountInputValue) === 0) {
|
|
385
|
+
setUsdInputValue('');
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}, [
|
|
389
|
+
isUsdInputMode,
|
|
390
|
+
tradeType,
|
|
391
|
+
quote?.details?.currencyIn?.amountUsd,
|
|
392
|
+
isFetchingQuote,
|
|
393
|
+
amountInputValue
|
|
394
|
+
]);
|
|
395
|
+
const recipientLinkedWallet = linkedWallets?.find((wallet) => wallet.address === recipient);
|
|
396
|
+
return (_jsxs(_Fragment, { children: [_jsx(WidgetContainer, { steps: steps, setSteps: setSteps, quoteInProgress: quoteInProgress, setQuoteInProgress: setQuoteInProgress, transactionModalOpen: transactionModalOpen, setTransactionModalOpen: setTransactionModalOpen, depositAddressModalOpen: depositAddressModalOpen, setDepositAddressModalOpen: setDepositAddressModalOpen, addressModalOpen: addressModalOpen, setAddressModalOpen: setAddressModalOpen, fromToken: fromToken, fromChain: fromChain, toToken: toToken, toChain: toChain, address: address, recipient: recipient, amountInputValue: amountInputValue, amountOutputValue: amountOutputValue, debouncedInputAmountValue: debouncedInputAmountValue, debouncedOutputAmountValue: debouncedOutputAmountValue, tradeType: tradeType, onTransactionModalOpenChange: (open) => {
|
|
397
|
+
if (!open) {
|
|
398
|
+
if (pendingSuccessFlush) {
|
|
399
|
+
setPendingSuccessFlush(false);
|
|
400
|
+
}
|
|
401
|
+
else if (steps) {
|
|
402
|
+
invalidateQuoteQuery();
|
|
403
|
+
}
|
|
404
|
+
// Abort ongoing execution
|
|
405
|
+
if (abortController) {
|
|
406
|
+
abortController.abort();
|
|
407
|
+
}
|
|
408
|
+
setSwapError(null);
|
|
409
|
+
setSteps(null);
|
|
410
|
+
setQuoteInProgress(null);
|
|
411
|
+
}
|
|
412
|
+
else if (pendingSuccessFlush) {
|
|
413
|
+
setPendingSuccessFlush(false);
|
|
414
|
+
}
|
|
415
|
+
}, onDepositAddressModalOpenChange: (open) => {
|
|
416
|
+
if (!open) {
|
|
417
|
+
setSwapError(null);
|
|
418
|
+
if (pendingSuccessFlush) {
|
|
419
|
+
setPendingSuccessFlush(false);
|
|
420
|
+
}
|
|
421
|
+
else {
|
|
422
|
+
invalidateQuoteQuery();
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
else if (pendingSuccessFlush) {
|
|
426
|
+
setPendingSuccessFlush(false);
|
|
427
|
+
}
|
|
428
|
+
}, useExternalLiquidity: useExternalLiquidity, slippageTolerance: slippageTolerance, swapError: swapError, setSwapError: setSwapError, onSwapSuccess: (data) => {
|
|
429
|
+
setPendingSuccessFlush(true);
|
|
430
|
+
setGasTopUpEnabled(true);
|
|
431
|
+
setAmountInputValue('');
|
|
432
|
+
setAmountOutputValue('');
|
|
433
|
+
onSwapSuccess?.(data);
|
|
434
|
+
}, onSwapValidating: onSwapValidating, onAnalyticEvent: onAnalyticEvent, invalidateBalanceQueries: invalidateBalanceQueries, invalidateQuoteQuery: invalidateQuoteQuery, customToAddress: customToAddress, setCustomToAddress: setCustomToAddress, timeEstimate: timeEstimate, wallet: wallet, linkedWallets: linkedWallets, multiWalletSupportEnabled: multiWalletSupportEnabled, children: () => {
|
|
435
|
+
return (_jsxs(Flex, { direction: "column", css: {
|
|
436
|
+
width: '100%',
|
|
437
|
+
overflow: 'hidden',
|
|
438
|
+
border: 'widget-border',
|
|
439
|
+
minWidth: 300,
|
|
440
|
+
maxWidth: 408
|
|
441
|
+
}, children: [_jsxs(TokenSelectorContainer, { css: { backgroundColor: 'widget-background' }, id: 'from-token-section', children: [_jsxs(Flex, { align: "center", justify: "between", css: { gap: '2', width: '100%' }, children: [_jsx(Text, { style: "subtitle2", color: "subtle", children: "Sell" }), multiWalletSupportEnabled === true &&
|
|
442
|
+
fromChainWalletVMSupported ? (_jsx(MultiWalletDropdown, { context: "origin", selectedWalletAddress: address, disablePasteWalletAddressOption: disablePasteWalletAddressOption, onSelect: (wallet) => onSetPrimaryWallet?.(wallet.address), chain: fromChain, onLinkNewWallet: () => {
|
|
443
|
+
if (!address && fromChainWalletVMSupported) {
|
|
444
|
+
onConnectWallet?.();
|
|
445
|
+
}
|
|
446
|
+
else {
|
|
447
|
+
onLinkNewWallet?.({
|
|
448
|
+
chain: fromChain,
|
|
449
|
+
direction: 'from'
|
|
450
|
+
})?.then((wallet) => {
|
|
451
|
+
onSetPrimaryWallet?.(wallet.address);
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
}, setAddressModalOpen: setAddressModalOpen, wallets: linkedWallets, onAnalyticEvent: onAnalyticEvent })) : null] }), _jsxs(Flex, { align: "center", justify: "between", css: { gap: '4', width: '100%' }, children: [_jsx(AmountInput, { autoFocus: !disableInputAutoFocus, prefixSymbol: isUsdInputMode ? '$' : undefined, value: isUsdInputMode
|
|
455
|
+
? usdInputValue
|
|
456
|
+
: tradeType === 'EXACT_INPUT'
|
|
457
|
+
? amountInputValue
|
|
458
|
+
: amountInputValue
|
|
459
|
+
? formatFixedLength(amountInputValue, 8)
|
|
460
|
+
: amountInputValue, setValue: (e) => {
|
|
461
|
+
if (isUsdInputMode) {
|
|
462
|
+
setUsdInputValue(e);
|
|
463
|
+
setTradeType('EXACT_INPUT');
|
|
464
|
+
setTokenInputCache('');
|
|
465
|
+
if (Number(e) === 0) {
|
|
466
|
+
setAmountOutputValue('');
|
|
467
|
+
setUsdOutputValue('');
|
|
468
|
+
debouncedAmountInputControls.flush();
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
else {
|
|
472
|
+
setAmountInputValue(e);
|
|
473
|
+
setTradeType('EXACT_INPUT');
|
|
474
|
+
if (Number(e) === 0) {
|
|
475
|
+
setAmountOutputValue('');
|
|
476
|
+
debouncedAmountInputControls.flush();
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}, onFocus: () => {
|
|
480
|
+
onAnalyticEvent?.(EventNames.SWAP_INPUT_FOCUSED);
|
|
481
|
+
}, css: {
|
|
482
|
+
fontWeight: '700',
|
|
483
|
+
fontSize: 32,
|
|
484
|
+
lineHeight: '36px',
|
|
485
|
+
py: 0,
|
|
486
|
+
color: isFetchingQuote && tradeType === 'EXPECTED_OUTPUT'
|
|
487
|
+
? 'text-subtle'
|
|
488
|
+
: 'input-color',
|
|
489
|
+
_placeholder: {
|
|
490
|
+
color: isFetchingQuote &&
|
|
491
|
+
tradeType === 'EXPECTED_OUTPUT'
|
|
492
|
+
? 'text-subtle'
|
|
493
|
+
: 'input-color'
|
|
494
|
+
}
|
|
495
|
+
} }), _jsx(TokenSelector, { address: address, isValidAddress: isValidFromAddress, token: fromToken, onAnalyticEvent: onAnalyticEvent, fromChainWalletVMSupported: fromChainWalletVMSupported, supportedWalletVMs: supportedWalletVMs, setToken: (token) => {
|
|
496
|
+
if (token.address === toToken?.address &&
|
|
497
|
+
token.chainId === toToken?.chainId &&
|
|
498
|
+
address === recipient &&
|
|
499
|
+
(!lockToToken || !fromToken)) {
|
|
500
|
+
handleSetFromToken(toToken);
|
|
501
|
+
handleSetToToken(fromToken);
|
|
502
|
+
}
|
|
503
|
+
else {
|
|
504
|
+
handleSetFromToken(token);
|
|
505
|
+
}
|
|
506
|
+
}, context: "from", multiWalletSupportEnabled: multiWalletSupportEnabled, lockedChainIds: isSingleChainLocked
|
|
507
|
+
? [lockChainId]
|
|
508
|
+
: isChainLocked(fromToken?.chainId, lockChainId, toToken?.chainId, lockFromToken) && fromToken?.chainId
|
|
509
|
+
? [fromToken.chainId]
|
|
510
|
+
: undefined, chainIdsFilter: !fromChainWalletVMSupported && toToken
|
|
511
|
+
? [toToken.chainId]
|
|
512
|
+
: undefined, popularChainIds: popularChainIds, trigger: _jsx("div", { style: { width: 'max-content' }, children: _jsx(TokenTrigger, { token: fromToken, locked: lockFromToken, isSingleChainLocked: isSingleChainLocked, address: address }) }) })] }), _jsxs(Flex, { align: "center", justify: "between", css: { gap: '3', width: '100%' }, children: [_jsxs(Flex, { align: "center", css: { gap: '4px', _hover: { cursor: 'pointer' } }, onClick: () => {
|
|
513
|
+
toggleInputMode();
|
|
514
|
+
}, children: [_jsx(Text, { style: "subtitle3", color: "subtleSecondary", css: {
|
|
515
|
+
minHeight: 18,
|
|
516
|
+
display: 'flex',
|
|
517
|
+
alignItems: 'center'
|
|
518
|
+
}, children: isUsdInputMode ? (fromToken ? (
|
|
519
|
+
// In USD input mode, show token equivalent
|
|
520
|
+
usdInputValue && Number(usdInputValue) > 0 ? (
|
|
521
|
+
// USD input has a value
|
|
522
|
+
amountInputValue &&
|
|
523
|
+
conversionRate &&
|
|
524
|
+
!isLoadingFromTokenPrice ? (`${formatNumber(amountInputValue, 4, false)} ${fromToken.symbol}`) : (_jsx(Box, { css: {
|
|
525
|
+
width: 45,
|
|
526
|
+
height: 12,
|
|
527
|
+
backgroundColor: 'gray7',
|
|
528
|
+
borderRadius: 'widget-border-radius'
|
|
529
|
+
} }))) : (
|
|
530
|
+
// USD input is empty or zero, show "0 TOKEN_SYMBOL"
|
|
531
|
+
`0 ${fromToken.symbol}`)) : null) : quote?.details?.currencyIn?.amountUsd &&
|
|
532
|
+
!isFetchingQuote ? (
|
|
533
|
+
// In token input mode, show USD equivalent from quote
|
|
534
|
+
formatDollar(Number(quote.details.currencyIn.amountUsd))) : isLoadingFromTokenPrice && // This is for the direct fromToken price, used when quote isn't available yet
|
|
535
|
+
amountInputValue &&
|
|
536
|
+
Number(amountInputValue) > 0 ? (_jsx(Box, { css: {
|
|
537
|
+
width: 45,
|
|
538
|
+
height: 12,
|
|
539
|
+
backgroundColor: 'gray7',
|
|
540
|
+
borderRadius: 'widget-border-radius'
|
|
541
|
+
} })) : inputAmountUsd &&
|
|
542
|
+
inputAmountUsd > 0 &&
|
|
543
|
+
fromTokenPriceData?.price &&
|
|
544
|
+
fromTokenPriceData.price > 0 ? (formatDollar(inputAmountUsd)) : ('$0.00') }), _jsx(Button, { "aria-label": "Switch Input Mode", size: "none", color: "ghost", css: {
|
|
545
|
+
color: 'gray11',
|
|
546
|
+
alignSelf: 'center',
|
|
547
|
+
justifyContent: 'center',
|
|
548
|
+
width: '20px',
|
|
549
|
+
height: '20px',
|
|
550
|
+
borderRadius: '100px',
|
|
551
|
+
padding: '4px',
|
|
552
|
+
backgroundColor: 'gray3'
|
|
553
|
+
}, onClick: toggleInputMode, children: _jsx(SwitchIcon, { width: 16, height: 10 }) })] }), _jsxs(Flex, { align: "center", css: { gap: '3', marginLeft: 'auto', height: 23 }, children: [fromToken ? (_jsx(BalanceDisplay, { isLoading: isLoadingFromBalance, balance: fromBalance, decimals: fromToken?.decimals, symbol: fromToken?.symbol, hasInsufficientBalance: hasInsufficientBalance, displaySymbol: false, isConnected: !isDeadAddress(address) &&
|
|
554
|
+
address !== tronDeadAddress &&
|
|
555
|
+
address !== undefined, pending: fromBalancePending })) : (_jsx(Flex, { css: { height: 18 } })), fromBalance &&
|
|
556
|
+
(fromChain?.vmType === 'evm' || // EVM
|
|
557
|
+
fromChain?.vmType === 'svm') ? (_jsxs(Flex, { css: { gap: '1' }, children: [_jsx(Button, { "aria-label": "20%", css: {
|
|
558
|
+
fontSize: 12,
|
|
559
|
+
fontWeight: '500',
|
|
560
|
+
px: '1',
|
|
561
|
+
py: '1',
|
|
562
|
+
minHeight: '23px',
|
|
563
|
+
lineHeight: '100%',
|
|
564
|
+
backgroundColor: 'widget-selector-background',
|
|
565
|
+
border: 'none',
|
|
566
|
+
_hover: {
|
|
567
|
+
backgroundColor: 'widget-selector-hover-background'
|
|
568
|
+
}
|
|
569
|
+
}, color: "white", onClick: () => {
|
|
570
|
+
const percentageBuffer = (fromBalance * 20n) / 100n; // 20% of the balance
|
|
571
|
+
handleMaxAmountClicked(percentageBuffer, '20%');
|
|
572
|
+
}, children: "20%" }), _jsx(Button, { "aria-label": "50%", css: {
|
|
573
|
+
fontSize: 12,
|
|
574
|
+
fontWeight: '500',
|
|
575
|
+
px: '1',
|
|
576
|
+
py: '1',
|
|
577
|
+
minHeight: '23px',
|
|
578
|
+
lineHeight: '100%',
|
|
579
|
+
backgroundColor: 'widget-selector-background',
|
|
580
|
+
border: 'none',
|
|
581
|
+
_hover: {
|
|
582
|
+
backgroundColor: 'widget-selector-hover-background'
|
|
583
|
+
}
|
|
584
|
+
}, color: "white", onClick: () => {
|
|
585
|
+
const percentageBuffer = (fromBalance * 50n) / 100n; // 50% of the balance
|
|
586
|
+
handleMaxAmountClicked(percentageBuffer, '50%');
|
|
587
|
+
}, children: "50%" }), _jsx(Button, { "aria-label": "MAX", css: {
|
|
588
|
+
fontSize: 12,
|
|
589
|
+
fontWeight: '500',
|
|
590
|
+
px: '1',
|
|
591
|
+
py: '1',
|
|
592
|
+
minHeight: '23px',
|
|
593
|
+
lineHeight: '100%',
|
|
594
|
+
backgroundColor: 'widget-selector-background',
|
|
595
|
+
border: 'none',
|
|
596
|
+
_hover: {
|
|
597
|
+
backgroundColor: 'widget-selector-hover-background'
|
|
598
|
+
}
|
|
599
|
+
}, color: "white", onMouseEnter: () => {
|
|
600
|
+
if (fromChain?.vmType === 'evm' &&
|
|
601
|
+
publicClient &&
|
|
602
|
+
fromBalance) {
|
|
603
|
+
getFeeBufferAmount(fromChain.vmType, fromChain.id, fromBalance, publicClient);
|
|
604
|
+
}
|
|
605
|
+
else if (fromChain?.vmType === 'svm' &&
|
|
606
|
+
fromChain.id) {
|
|
607
|
+
getFeeBufferAmount(fromChain.vmType, fromChain.id, 0n, null);
|
|
608
|
+
}
|
|
609
|
+
}, onClick: async () => {
|
|
610
|
+
if (!fromBalance || !fromToken || !fromChain)
|
|
611
|
+
return;
|
|
612
|
+
let feeBufferAmount = 0n;
|
|
613
|
+
if (isFromNative) {
|
|
614
|
+
feeBufferAmount = await getFeeBufferAmount(fromChain.vmType, fromChain.id, fromBalance, publicClient ?? null);
|
|
615
|
+
}
|
|
616
|
+
const finalMaxAmount = isFromNative && feeBufferAmount > 0n
|
|
617
|
+
? fromBalance > feeBufferAmount
|
|
618
|
+
? fromBalance - feeBufferAmount
|
|
619
|
+
: 0n
|
|
620
|
+
: fromBalance;
|
|
621
|
+
handleMaxAmountClicked(finalMaxAmount, 'max', isFromNative ? feeBufferAmount : 0n);
|
|
622
|
+
}, children: "MAX" })] })) : null] })] })] }), _jsx(Box, { css: {
|
|
623
|
+
position: 'relative',
|
|
624
|
+
my: -13,
|
|
625
|
+
mx: 'auto',
|
|
626
|
+
height: 32,
|
|
627
|
+
width: 32
|
|
628
|
+
}, children: hasLockedToken ||
|
|
629
|
+
((isSvmSwap || isBvmSwap) &&
|
|
630
|
+
!multiWalletSupportEnabled) ? null : (_jsx(Button, { "aria-label": "Swap Tokens Direction", size: "none", color: "white", css: {
|
|
631
|
+
mt: '4px',
|
|
632
|
+
color: 'gray9',
|
|
633
|
+
alignSelf: 'center',
|
|
634
|
+
justifyContent: 'center',
|
|
635
|
+
width: '100%',
|
|
636
|
+
height: '100%',
|
|
637
|
+
'--borderWidth': 'borders.widget-swap-currency-button-border-width',
|
|
638
|
+
'--borderColor': 'colors.widget-swap-currency-button-border-color',
|
|
639
|
+
border: `var(--borderWidth) solid var(--borderColor)`,
|
|
640
|
+
zIndex: 10,
|
|
641
|
+
borderRadius: 'widget-swap-currency-button-border-radius'
|
|
642
|
+
}, onClick: () => {
|
|
643
|
+
if (fromToken || toToken) {
|
|
644
|
+
if (isUsdInputMode) {
|
|
645
|
+
// In USD mode, switch the tokens and values
|
|
646
|
+
handleSetFromToken(toToken);
|
|
647
|
+
handleSetToToken(fromToken);
|
|
648
|
+
// Switch USD values
|
|
649
|
+
const tempUsdInput = usdInputValue;
|
|
650
|
+
setUsdInputValue(usdOutputValue);
|
|
651
|
+
setUsdOutputValue(tempUsdInput);
|
|
652
|
+
// Always use EXACT_INPUT after switching
|
|
653
|
+
setTradeType('EXACT_INPUT');
|
|
654
|
+
debouncedAmountInputControls.flush();
|
|
655
|
+
debouncedAmountOutputControls.flush();
|
|
656
|
+
}
|
|
657
|
+
else {
|
|
658
|
+
// Token-denominated mode: maintain current behaviour when swapping token order
|
|
659
|
+
if (tradeType === 'EXACT_INPUT') {
|
|
660
|
+
setTradeType('EXPECTED_OUTPUT');
|
|
661
|
+
setAmountInputValue('');
|
|
662
|
+
setAmountOutputValue(amountInputValue);
|
|
663
|
+
}
|
|
664
|
+
else {
|
|
665
|
+
setTradeType('EXACT_INPUT');
|
|
666
|
+
setAmountOutputValue('');
|
|
667
|
+
setAmountInputValue(amountOutputValue);
|
|
668
|
+
}
|
|
669
|
+
handleSetFromToken(toToken);
|
|
670
|
+
handleSetToToken(fromToken);
|
|
671
|
+
debouncedAmountInputControls.flush();
|
|
672
|
+
debouncedAmountOutputControls.flush();
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
}, children: _jsx(FontAwesomeIcon, { icon: faArrowDown, width: 16, height: 16 }) })) }), _jsxs(TokenSelectorContainer, { css: {
|
|
676
|
+
backgroundColor: 'widget-background',
|
|
677
|
+
mb: 'widget-card-section-gutter'
|
|
678
|
+
}, id: 'to-token-section', children: [_jsxs(Flex, { css: { width: '100%' }, align: "center", justify: "between", children: [_jsx(Text, { style: "subtitle2", color: "subtle", children: "Buy" }), multiWalletSupportEnabled &&
|
|
679
|
+
toChainWalletVMSupported ? (_jsx(MultiWalletDropdown, { context: "destination", disablePasteWalletAddressOption: disablePasteWalletAddressOption, selectedWalletAddress: recipient, onSelect: (wallet) => {
|
|
680
|
+
setCustomToAddress(wallet.address);
|
|
681
|
+
}, chain: toChain, onLinkNewWallet: () => {
|
|
682
|
+
if (!address && toChainWalletVMSupported) {
|
|
683
|
+
onConnectWallet?.();
|
|
684
|
+
}
|
|
685
|
+
else {
|
|
686
|
+
onLinkNewWallet?.({
|
|
687
|
+
chain: toChain,
|
|
688
|
+
direction: 'to'
|
|
689
|
+
})?.then((wallet) => {
|
|
690
|
+
setCustomToAddress(wallet.address);
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
}, setAddressModalOpen: setAddressModalOpen, wallets: linkedWallets, onAnalyticEvent: onAnalyticEvent })) : null, !multiWalletSupportEnabled ||
|
|
694
|
+
!toChainWalletVMSupported ? (_jsxs(Button, { color: isValidToAddress &&
|
|
695
|
+
multiWalletSupportEnabled &&
|
|
696
|
+
!isRecipientLinked
|
|
697
|
+
? 'warning'
|
|
698
|
+
: 'secondary', corners: "pill", size: "none", css: {
|
|
699
|
+
display: 'flex',
|
|
700
|
+
alignItems: 'center',
|
|
701
|
+
px: '2',
|
|
702
|
+
py: '1'
|
|
703
|
+
}, onClick: () => {
|
|
704
|
+
setAddressModalOpen(true);
|
|
705
|
+
onAnalyticEvent?.(EventNames.SWAP_ADDRESS_MODAL_CLICKED);
|
|
706
|
+
}, children: [isValidToAddress &&
|
|
707
|
+
multiWalletSupportEnabled &&
|
|
708
|
+
!isRecipientLinked ? (_jsx(Box, { css: { color: 'amber11' }, children: _jsx(FontAwesomeIcon, { icon: faClipboard, width: 16, height: 16 }) })) : null, _jsx(Text, { style: "subtitle2", css: {
|
|
709
|
+
color: isValidToAddress &&
|
|
710
|
+
multiWalletSupportEnabled &&
|
|
711
|
+
!isRecipientLinked
|
|
712
|
+
? 'amber11'
|
|
713
|
+
: 'anchor-color'
|
|
714
|
+
}, children: !isValidToAddress
|
|
715
|
+
? `Enter Address`
|
|
716
|
+
: toDisplayName })] })) : null] }), _jsxs(Flex, { align: "center", justify: "between", css: { gap: '4', width: '100%' }, children: [_jsx(AmountInput, { prefixSymbol: isUsdInputMode ? '$' : undefined, value: isUsdInputMode
|
|
717
|
+
? usdOutputValue
|
|
718
|
+
: tradeType === 'EXPECTED_OUTPUT'
|
|
719
|
+
? amountOutputValue
|
|
720
|
+
: amountOutputValue
|
|
721
|
+
? formatFixedLength(amountOutputValue, 8)
|
|
722
|
+
: amountOutputValue, setValue: (e) => {
|
|
723
|
+
if (isUsdInputMode) {
|
|
724
|
+
setUsdOutputValue(e);
|
|
725
|
+
setTradeType('EXPECTED_OUTPUT');
|
|
726
|
+
if (Number(e) === 0) {
|
|
727
|
+
setAmountInputValue('');
|
|
728
|
+
setUsdInputValue('');
|
|
729
|
+
debouncedAmountOutputControls.flush();
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
else {
|
|
733
|
+
setAmountOutputValue(e);
|
|
734
|
+
setTradeType('EXPECTED_OUTPUT');
|
|
735
|
+
if (Number(e) === 0) {
|
|
736
|
+
setAmountInputValue('');
|
|
737
|
+
debouncedAmountOutputControls.flush();
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
}, disabled: !toToken || !fromChainWalletVMSupported, onFocus: () => {
|
|
741
|
+
onAnalyticEvent?.(EventNames.SWAP_OUTPUT_FOCUSED);
|
|
742
|
+
}, css: {
|
|
743
|
+
fontWeight: '700',
|
|
744
|
+
fontSize: 32,
|
|
745
|
+
color: isFetchingQuote && tradeType === 'EXACT_INPUT'
|
|
746
|
+
? 'text-subtle'
|
|
747
|
+
: 'input-color',
|
|
748
|
+
_placeholder: {
|
|
749
|
+
color: isFetchingQuote && tradeType === 'EXACT_INPUT'
|
|
750
|
+
? 'text-subtle'
|
|
751
|
+
: 'input-color'
|
|
752
|
+
},
|
|
753
|
+
_disabled: {
|
|
754
|
+
cursor: 'not-allowed',
|
|
755
|
+
_placeholder: {
|
|
756
|
+
color: 'gray10'
|
|
757
|
+
},
|
|
758
|
+
color: 'gray10'
|
|
759
|
+
}
|
|
760
|
+
} }), _jsx(TokenSelector, { address: recipient, isValidAddress: isValidToAddress, token: toToken, fromChainWalletVMSupported: fromChainWalletVMSupported, supportedWalletVMs: supportedWalletVMs, setToken: (token) => {
|
|
761
|
+
if (token.address === fromToken?.address &&
|
|
762
|
+
token.chainId === fromToken?.chainId &&
|
|
763
|
+
address === recipient &&
|
|
764
|
+
(!lockToToken || !fromToken)) {
|
|
765
|
+
handleSetToToken(fromToken);
|
|
766
|
+
handleSetFromToken(toToken);
|
|
767
|
+
}
|
|
768
|
+
else {
|
|
769
|
+
handleSetToToken(token);
|
|
770
|
+
}
|
|
771
|
+
}, context: "to", multiWalletSupportEnabled: multiWalletSupportEnabled, trigger: _jsx("div", { style: { width: 'max-content' }, children: _jsx(TokenTrigger, { token: toToken, locked: lockToToken, isSingleChainLocked: isSingleChainLocked, address: address }) }), onAnalyticEvent: onAnalyticEvent, lockedChainIds: isSingleChainLocked
|
|
772
|
+
? [lockChainId]
|
|
773
|
+
: isChainLocked(toToken?.chainId, lockChainId, fromToken?.chainId, lockToToken) && toToken?.chainId
|
|
774
|
+
? [toToken.chainId]
|
|
775
|
+
: undefined, chainIdsFilter: !fromChainWalletVMSupported && fromToken
|
|
776
|
+
? [fromToken.chainId]
|
|
777
|
+
: undefined, popularChainIds: popularChainIds })] }), _jsxs(Flex, { align: "center", justify: "between", css: { gap: '3', width: '100%' }, children: [_jsxs(Flex, { align: "center", css: {
|
|
778
|
+
gap: '1',
|
|
779
|
+
minHeight: 18
|
|
780
|
+
}, children: [_jsx(Text, { style: "subtitle3", color: "subtleSecondary", children: isUsdInputMode ? (toToken ? (
|
|
781
|
+
// In USD input mode, show token equivalent
|
|
782
|
+
usdOutputValue && Number(usdOutputValue) > 0 ? (
|
|
783
|
+
// USD output has a value
|
|
784
|
+
amountOutputValue &&
|
|
785
|
+
!isLoadingToTokenPrice ? (`${formatNumber(amountOutputValue, 4, false)} ${toToken.symbol}`) : (_jsx(Box, { css: {
|
|
786
|
+
width: 45,
|
|
787
|
+
height: 12,
|
|
788
|
+
backgroundColor: 'gray7',
|
|
789
|
+
borderRadius: 'widget-border-radius'
|
|
790
|
+
} }))) : (
|
|
791
|
+
// USD output is empty or zero, show "0 TOKEN_SYMBOL"
|
|
792
|
+
`0 ${toToken.symbol}`)) : null) : toToken &&
|
|
793
|
+
quote?.details?.currencyOut?.amountUsd &&
|
|
794
|
+
!isFetchingQuote ? (formatDollar(Number(quote.details.currencyOut.amountUsd))) : toToken &&
|
|
795
|
+
isLoadingToTokenPrice &&
|
|
796
|
+
amountOutputValue &&
|
|
797
|
+
Number(amountOutputValue) > 0 ? (_jsx(Box, { css: {
|
|
798
|
+
width: 45,
|
|
799
|
+
height: 12,
|
|
800
|
+
backgroundColor: 'gray7',
|
|
801
|
+
borderRadius: 'widget-border-radius'
|
|
802
|
+
} })) : toToken &&
|
|
803
|
+
outputAmountUsd &&
|
|
804
|
+
outputAmountUsd > 0 &&
|
|
805
|
+
toTokenPriceData?.price &&
|
|
806
|
+
toTokenPriceData.price > 0 ? (formatDollar(outputAmountUsd)) : ('$0.00') }), !isUsdInputMode &&
|
|
807
|
+
toToken &&
|
|
808
|
+
quote?.details?.currencyOut?.amountUsd &&
|
|
809
|
+
quote?.details?.currencyOut?.amountUsd !== '0' &&
|
|
810
|
+
!isFetchingQuote &&
|
|
811
|
+
quote?.details?.totalImpact?.percent ? (_jsxs(Text, { style: "subtitle3", color: feeBreakdown?.totalFees.priceImpactColor, children: ["(", feeBreakdown?.totalFees.priceImpactPercentage, ")"] })) : null] }), _jsx(Flex, { css: { marginLeft: 'auto' }, children: toToken ? (_jsx(BalanceDisplay, { isLoading: isLoadingToBalance, balance: toBalance, decimals: toToken?.decimals, symbol: toToken?.symbol, displaySymbol: false, isConnected: !isDeadAddress(address) &&
|
|
812
|
+
address !== tronDeadAddress &&
|
|
813
|
+
address !== undefined, pending: toBalancePending })) : (_jsx(Flex, { css: { height: 18 } })) })] })] }), error &&
|
|
814
|
+
!isFetchingQuote &&
|
|
815
|
+
!isSingleChainLocked &&
|
|
816
|
+
fromChainWalletVMSupported ? (_jsx(Box, { css: {
|
|
817
|
+
borderRadius: 'widget-card-border-radius',
|
|
818
|
+
backgroundColor: 'widget-background',
|
|
819
|
+
border: 'widget-card-border',
|
|
820
|
+
overflow: 'hidden',
|
|
821
|
+
mb: 'widget-card-section-gutter'
|
|
822
|
+
}, id: 'swap-route-selection-section', children: _jsx(SwapRouteSelector, { chain: toChain, supportsExternalLiquidity: supportsExternalLiquidity, externalLiquidtySelected: useExternalLiquidity, canonicalTimeEstimate: canonicalTimeEstimate?.formattedTime, onExternalLiquidityChange: (selected) => {
|
|
823
|
+
setUseExternalLiquidity(selected);
|
|
824
|
+
}, error: error }) })) : null, _jsx(GasTopUpSection, { toChain: toChain, gasTopUpEnabled: gasTopUpEnabled, onGasTopUpEnabled: (enabled) => {
|
|
825
|
+
setGasTopUpEnabled(enabled);
|
|
826
|
+
onAnalyticEvent?.(EventNames.GAS_TOP_UP_TOGGLE, {
|
|
827
|
+
enabled,
|
|
828
|
+
amount: gasTopUpAmount,
|
|
829
|
+
amount_usd: gasTopUpAmountUsd,
|
|
830
|
+
quote
|
|
831
|
+
});
|
|
832
|
+
}, gasTopUpRequired: gasTopUpRequired, gasTopUpAmount: gasTopUpAmount, gasTopUpAmountUsd: gasTopUpAmountUsd }), _jsx(FeeBreakdown, { feeBreakdown: feeBreakdown, isFetchingQuote: isFetchingQuote, toToken: toToken, fromToken: fromToken, quote: quote, timeEstimate: timeEstimate, supportsExternalLiquidity: supportsExternalLiquidity, useExternalLiquidity: useExternalLiquidity, isAutoSlippage: isAutoSlippage, slippageInputBps: slippageTolerance, toChain: toChain, setUseExternalLiquidity: (enabled) => {
|
|
833
|
+
setUseExternalLiquidity(enabled);
|
|
834
|
+
onAnalyticEvent?.(EventNames.SWAP_ROUTE_SELECTED, {
|
|
835
|
+
route: enabled ? 'canonical' : 'relay'
|
|
836
|
+
});
|
|
837
|
+
}, canonicalTimeEstimate: canonicalTimeEstimate, isSingleChainLocked: isSingleChainLocked, fromChainWalletVMSupported: fromChainWalletVMSupported, error: error }), _jsx(WidgetErrorWell, { hasInsufficientBalance: hasInsufficientBalance, error: error, quote: quote, currency: fromToken, isHighRelayerServiceFee: highRelayerServiceFee, isCapacityExceededError: isCapacityExceededError, isCouldNotExecuteError: isCouldNotExecuteError, relayerFeeProportion: relayerFeeProportion, supportsExternalLiquidity: supportsExternalLiquidity, containerCss: {
|
|
838
|
+
mb: 'widget-card-section-gutter'
|
|
839
|
+
}, recipientWalletSupportsChain: recipientWalletSupportsChain, recipient: recipient, toChainWalletVMSupported: toChainWalletVMSupported, recipientLinkedWallet: recipientLinkedWallet, toChainVmType: toChain?.vmType }), promptSwitchRoute ? (_jsx(Button, { color: "primary", css: { flexGrow: '1', justifyContent: 'center' }, onClick: () => {
|
|
840
|
+
setUseExternalLiquidity(true);
|
|
841
|
+
onAnalyticEvent?.(EventNames.CTA_SWITCH_ROUTE_CLICKED);
|
|
842
|
+
}, children: "Switch Route" })) : (_jsx(SwapButton, { isFetchingQuote: isFetchingQuote, transactionModalOpen: transactionModalOpen, depositAddressModalOpen: depositAddressModalOpen, isValidFromAddress: isValidFromAddress, isValidToAddress: isValidToAddress, fromChainWalletVMSupported: fromChainWalletVMSupported, context: 'Swap', showHighPriceImpactWarning: showHighPriceImpactWarning, onConnectWallet: onConnectWallet, onAnalyticEvent: onAnalyticEvent, quote: quote, address: address, hasInsufficientBalance: hasInsufficientBalance, isInsufficientLiquidityError: isInsufficientLiquidityError, recipientWalletSupportsChain: recipientWalletSupportsChain, debouncedInputAmountValue: debouncedInputAmountValue, debouncedOutputAmountValue: debouncedOutputAmountValue, isSameCurrencySameRecipientSwap: isSameCurrencySameRecipientSwap, onClick: () => {
|
|
843
|
+
if (fromChainWalletVMSupported) {
|
|
844
|
+
if (!isValidToAddress || !isValidFromAddress) {
|
|
845
|
+
if (multiWalletSupportEnabled &&
|
|
846
|
+
(isValidToAddress ||
|
|
847
|
+
(!isValidToAddress &&
|
|
848
|
+
toChainWalletVMSupported))) {
|
|
849
|
+
const chain = !isValidFromAddress
|
|
850
|
+
? fromChain
|
|
851
|
+
: toChain;
|
|
852
|
+
if (!address) {
|
|
853
|
+
onConnectWallet?.();
|
|
854
|
+
}
|
|
855
|
+
else {
|
|
856
|
+
onLinkNewWallet?.({
|
|
857
|
+
chain: chain,
|
|
858
|
+
direction: !isValidFromAddress
|
|
859
|
+
? 'from'
|
|
860
|
+
: 'to'
|
|
861
|
+
})?.then((wallet) => {
|
|
862
|
+
if (!isValidFromAddress) {
|
|
863
|
+
onSetPrimaryWallet?.(wallet.address);
|
|
864
|
+
}
|
|
865
|
+
else {
|
|
866
|
+
setCustomToAddress(wallet.address);
|
|
867
|
+
}
|
|
868
|
+
});
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
else {
|
|
872
|
+
setAddressModalOpen(true);
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
else {
|
|
876
|
+
swap();
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
else {
|
|
880
|
+
if (!isValidToAddress) {
|
|
881
|
+
if (multiWalletSupportEnabled &&
|
|
882
|
+
toChainWalletVMSupported) {
|
|
883
|
+
if (!address) {
|
|
884
|
+
onConnectWallet?.();
|
|
885
|
+
}
|
|
886
|
+
else {
|
|
887
|
+
onLinkNewWallet?.({
|
|
888
|
+
chain: toChain,
|
|
889
|
+
direction: 'to'
|
|
890
|
+
})?.then((wallet) => {
|
|
891
|
+
setCustomToAddress(wallet.address);
|
|
892
|
+
});
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
else {
|
|
896
|
+
setAddressModalOpen(true);
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
else {
|
|
900
|
+
const swapEventData = getSwapEventData(quote?.details, quote?.steps
|
|
901
|
+
? quote?.steps
|
|
902
|
+
: null, linkedWallet?.connector, quoteParameters);
|
|
903
|
+
onAnalyticEvent?.(EventNames.SWAP_CTA_CLICKED, swapEventData);
|
|
904
|
+
setDepositAddressModalOpen(true);
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
}, ctaCopy: ctaCopy }))] }));
|
|
908
|
+
} }), _jsx(UnverifiedTokenModal, { open: unverifiedTokens.length > 0, onOpenChange: () => { }, data: unverifiedTokens.length > 0 ? unverifiedTokens[0] : undefined, onDecline: (token, context) => {
|
|
909
|
+
const tokens = unverifiedTokens.filter((unverifiedToken) => !(unverifiedToken.context === context &&
|
|
910
|
+
unverifiedToken.token.address === token?.address &&
|
|
911
|
+
unverifiedToken.token.chainId === token?.chainId));
|
|
912
|
+
setUnverifiedTokens(tokens);
|
|
913
|
+
}, onAcceptToken: (token, context) => {
|
|
914
|
+
if (token) {
|
|
915
|
+
if (context === 'to') {
|
|
916
|
+
onAnalyticEvent?.(EventNames.SWAP_TOKEN_SELECT, {
|
|
917
|
+
direction: 'output',
|
|
918
|
+
token_symbol: token.symbol
|
|
919
|
+
});
|
|
920
|
+
if (token.address === fromToken?.address &&
|
|
921
|
+
token.chainId === fromToken?.chainId &&
|
|
922
|
+
address === recipient &&
|
|
923
|
+
(!lockToToken || !fromToken)) {
|
|
924
|
+
handleSetToToken(fromToken);
|
|
925
|
+
handleSetFromToken(toToken);
|
|
926
|
+
}
|
|
927
|
+
else {
|
|
928
|
+
handleSetToToken(token);
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
else if (context === 'from') {
|
|
932
|
+
onAnalyticEvent?.(EventNames.SWAP_TOKEN_SELECT, {
|
|
933
|
+
direction: 'input',
|
|
934
|
+
token_symbol: token.symbol
|
|
935
|
+
});
|
|
936
|
+
if (token.address === toToken?.address &&
|
|
937
|
+
token.chainId === toToken?.chainId &&
|
|
938
|
+
address === recipient &&
|
|
939
|
+
(!lockToToken || !fromToken)) {
|
|
940
|
+
handleSetFromToken(toToken);
|
|
941
|
+
handleSetToToken(fromToken);
|
|
942
|
+
}
|
|
943
|
+
else {
|
|
944
|
+
handleSetFromToken(token);
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
const tokens = unverifiedTokens.filter((unverifiedToken) => !(unverifiedToken.token.address === token?.address &&
|
|
949
|
+
unverifiedToken.token.chainId === token?.chainId));
|
|
950
|
+
setUnverifiedTokens(tokens);
|
|
951
|
+
} })] }));
|
|
952
|
+
} }));
|
|
953
|
+
};
|
|
954
|
+
export default SwapWidget;
|
|
955
|
+
//# sourceMappingURL=index.js.map
|