UNPKG

@reservoir0x/relay-kit-ui

Version:

Relay is the Fastest and Cheapest Way to Bridge and Transact Across Chains.

36 lines 2.12 kB
import { jsx as _jsx } from "react/jsx-runtime"; import {} from 'react'; import { Button } from '../primitives/index.js'; import { useMounted } from '../../hooks/index.js'; import { EventNames } from '../../constants/events.js'; const SwapButton = ({ transactionModalOpen, depositAddressModalOpen, isValidFromAddress, isValidToAddress, context, showHighPriceImpactWarning, onConnectWallet, quote, address, hasInsufficientBalance, isInsufficientLiquidityError, debouncedInputAmountValue, debouncedOutputAmountValue, isSameCurrencySameRecipientSwap, fromChainWalletVMSupported, recipientWalletSupportsChain, onClick, ctaCopy, onAnalyticEvent, isFetchingQuote }) => { const isMounted = useMounted(); if (isMounted && (address || !fromChainWalletVMSupported)) { const invalidAmount = !quote || Number(debouncedInputAmountValue) === 0 || Number(debouncedOutputAmountValue) === 0; return (_jsx(Button, { css: { justifyContent: 'center' }, color: showHighPriceImpactWarning ? 'error' : 'primary', "aria-label": context, disabled: isFetchingQuote || (isValidToAddress && (isValidFromAddress || !fromChainWalletVMSupported) && (invalidAmount || hasInsufficientBalance || isInsufficientLiquidityError || transactionModalOpen || depositAddressModalOpen || isSameCurrencySameRecipientSwap || !recipientWalletSupportsChain)), onClick: () => { onClick(); }, children: ctaCopy })); } return (_jsx(Button, { css: { justifyContent: 'center' }, "aria-label": "Connect wallet", onClick: () => { if (!onConnectWallet) { throw 'Missing onWalletConnect function'; } onConnectWallet(); onAnalyticEvent?.(EventNames.CONNECT_WALLET_CLICKED, { context }); }, children: "Connect Wallet" })); }; export default SwapButton; //# sourceMappingURL=SwapButton.js.map