0xtrails 0.6.6 → 0.7.0
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/dist/aave.d.ts +10 -2
- package/dist/aave.d.ts.map +1 -1
- package/dist/analytics.d.ts +26 -0
- package/dist/analytics.d.ts.map +1 -1
- package/dist/{ccip-CbJrlK-L.js → ccip-fConRNoG.js} +21 -21
- package/dist/chains.d.ts +23 -8
- package/dist/chains.d.ts.map +1 -1
- package/dist/constants.d.ts +5 -5
- package/dist/constants.d.ts.map +1 -1
- package/dist/customTokens.d.ts +12 -0
- package/dist/customTokens.d.ts.map +1 -0
- package/dist/decoders.d.ts +2 -2
- package/dist/decoders.d.ts.map +1 -1
- package/dist/error.d.ts.map +1 -1
- package/dist/fees.d.ts +37 -2
- package/dist/fees.d.ts.map +1 -1
- package/dist/gasless.d.ts +15 -36
- package/dist/gasless.d.ts.map +1 -1
- package/dist/{index-w7_dK4c5.js → index-BbajxCG_.js} +59269 -77146
- package/dist/index.d.ts +8 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +828 -359
- package/dist/indexerClient.d.ts.map +1 -1
- package/dist/intentReceiptMonitor.d.ts +1 -1
- package/dist/intentReceiptMonitor.d.ts.map +1 -1
- package/dist/intentReceiptPoller.d.ts +1 -1
- package/dist/intentReceiptPoller.d.ts.map +1 -1
- package/dist/intents.d.ts +3 -2
- package/dist/intents.d.ts.map +1 -1
- package/dist/mode.d.ts +1 -1
- package/dist/mode.d.ts.map +1 -1
- package/dist/mutations.d.ts +2 -2
- package/dist/mutations.d.ts.map +1 -1
- package/dist/prepareSend.d.ts +2 -2
- package/dist/prepareSend.d.ts.map +1 -1
- package/dist/prices.d.ts +1 -1
- package/dist/prices.d.ts.map +1 -1
- package/dist/sequenceWallet.d.ts +2 -2
- package/dist/sequenceWallet.d.ts.map +1 -1
- package/dist/time.d.ts +6 -0
- package/dist/time.d.ts.map +1 -1
- package/dist/tokenBalances.d.ts +40 -25
- package/dist/tokenBalances.d.ts.map +1 -1
- package/dist/tokens.d.ts +54 -14
- package/dist/tokens.d.ts.map +1 -1
- package/dist/trailsClient.d.ts +1 -1
- package/dist/trailsClient.d.ts.map +1 -1
- package/dist/trailsRouter.d.ts +2 -1
- package/dist/trailsRouter.d.ts.map +1 -1
- package/dist/transactionIntent/deposits/depositOrchestrator.d.ts +3 -2
- package/dist/transactionIntent/deposits/depositOrchestrator.d.ts.map +1 -1
- package/dist/transactionIntent/deposits/gaslessDeposit.d.ts +2 -1
- package/dist/transactionIntent/deposits/gaslessDeposit.d.ts.map +1 -1
- package/dist/transactionIntent/execution/transactionState.d.ts +1 -1
- package/dist/transactionIntent/execution/transactionState.d.ts.map +1 -1
- package/dist/transactionIntent/handlers/crossChain.d.ts +5 -3
- package/dist/transactionIntent/handlers/crossChain.d.ts.map +1 -1
- package/dist/transactionIntent/handlers/sameChainSameToken.d.ts +5 -3
- package/dist/transactionIntent/handlers/sameChainSameToken.d.ts.map +1 -1
- package/dist/transactionIntent/quote/feeExtractors.d.ts +1 -6
- package/dist/transactionIntent/quote/feeExtractors.d.ts.map +1 -1
- package/dist/transactionIntent/quote/normalizeQuote.d.ts +4 -2
- package/dist/transactionIntent/quote/normalizeQuote.d.ts.map +1 -1
- package/dist/transactionIntent/quote/quoteHelpers.d.ts +1 -1
- package/dist/transactionIntent/quote/quoteHelpers.d.ts.map +1 -1
- package/dist/transactionIntent/types.d.ts +28 -5
- package/dist/transactionIntent/types.d.ts.map +1 -1
- package/dist/transactionIntent/utils/testnetHelpers.d.ts +0 -1
- package/dist/transactionIntent/utils/testnetHelpers.d.ts.map +1 -1
- package/dist/transactionIntent/validators.d.ts +0 -2
- package/dist/transactionIntent/validators.d.ts.map +1 -1
- package/dist/transactions.d.ts +2 -2
- package/dist/transactions.d.ts.map +1 -1
- package/dist/utils.d.ts +7 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/wallets.d.ts +1 -0
- package/dist/wallets.d.ts.map +1 -1
- package/dist/widget/components/AccountIntentTransactionHistory.d.ts.map +1 -1
- package/dist/widget/components/AddressWalletIcon.d.ts +6 -0
- package/dist/widget/components/AddressWalletIcon.d.ts.map +1 -0
- package/dist/widget/components/ChainFilterDropdown.d.ts +2 -6
- package/dist/widget/components/ChainFilterDropdown.d.ts.map +1 -1
- package/dist/widget/components/ChainImage.d.ts.map +1 -1
- package/dist/widget/components/ChainList.d.ts +0 -5
- package/dist/widget/components/ChainList.d.ts.map +1 -1
- package/dist/widget/components/ClassicSwap.d.ts +6 -6
- package/dist/widget/components/ClassicSwap.d.ts.map +1 -1
- package/dist/widget/components/ConnectWallet.d.ts.map +1 -1
- package/dist/widget/components/ConnectedWallets.d.ts.map +1 -1
- package/dist/widget/components/DebugMenu.d.ts +1 -1
- package/dist/widget/components/DebugMenu.d.ts.map +1 -1
- package/dist/widget/components/DebugScreensList.d.ts.map +1 -1
- package/dist/widget/components/DepositTracker.d.ts.map +1 -1
- package/dist/widget/components/Earn.d.ts +5 -5
- package/dist/widget/components/Earn.d.ts.map +1 -1
- package/dist/widget/components/FeeOption.d.ts +1 -1
- package/dist/widget/components/FeeOption.d.ts.map +1 -1
- package/dist/widget/components/FeeOptions.d.ts +2 -2
- package/dist/widget/components/FeeOptions.d.ts.map +1 -1
- package/dist/widget/components/Footer.d.ts +1 -1
- package/dist/widget/components/Footer.d.ts.map +1 -1
- package/dist/widget/components/Fund.d.ts +5 -5
- package/dist/widget/components/Fund.d.ts.map +1 -1
- package/dist/widget/components/FundMethods.d.ts +0 -1
- package/dist/widget/components/FundMethods.d.ts.map +1 -1
- package/dist/widget/components/FundSwap.d.ts +6 -6
- package/dist/widget/components/FundSwap.d.ts.map +1 -1
- package/dist/widget/components/HookModalContent.d.ts +8 -0
- package/dist/widget/components/HookModalContent.d.ts.map +1 -0
- package/dist/widget/components/OriginSelectionAmount.d.ts +11 -0
- package/dist/widget/components/OriginSelectionAmount.d.ts.map +1 -0
- package/dist/widget/components/Pay.d.ts +5 -5
- package/dist/widget/components/Pay.d.ts.map +1 -1
- package/dist/widget/components/PoolDeposit.d.ts +5 -5
- package/dist/widget/components/PoolDeposit.d.ts.map +1 -1
- package/dist/widget/components/PoolWithdraw.d.ts +3 -3
- package/dist/widget/components/PoolWithdraw.d.ts.map +1 -1
- package/dist/widget/components/QuoteDetails.d.ts.map +1 -1
- package/dist/widget/components/Receipt.d.ts +2 -1
- package/dist/widget/components/Receipt.d.ts.map +1 -1
- package/dist/widget/components/RecentTokens.d.ts +4 -4
- package/dist/widget/components/RecentTokens.d.ts.map +1 -1
- package/dist/widget/components/RecipientSelectorButton.d.ts.map +1 -1
- package/dist/widget/components/ShadowPortal.d.ts +6 -0
- package/dist/widget/components/ShadowPortal.d.ts.map +1 -0
- package/dist/widget/components/Swap.d.ts +6 -6
- package/dist/widget/components/Swap.d.ts.map +1 -1
- package/dist/widget/components/ThemeProvider.d.ts +1 -1
- package/dist/widget/components/ThemeProvider.d.ts.map +1 -1
- package/dist/widget/components/TokenList.d.ts +3 -4
- package/dist/widget/components/TokenList.d.ts.map +1 -1
- package/dist/widget/components/TokenSelector.d.ts +3 -4
- package/dist/widget/components/TokenSelector.d.ts.map +1 -1
- package/dist/widget/components/Tooltip.d.ts +6 -1
- package/dist/widget/components/Tooltip.d.ts.map +1 -1
- package/dist/widget/components/TrailsHookModal.d.ts +10 -0
- package/dist/widget/components/TrailsHookModal.d.ts.map +1 -0
- package/dist/widget/components/WaasFeeOptions.d.ts +3 -0
- package/dist/widget/components/WaasFeeOptions.d.ts.map +1 -1
- package/dist/widget/components/WalletConfirmation.d.ts.map +1 -1
- package/dist/widget/components/WalletConnect.d.ts.map +1 -1
- package/dist/widget/components/WidgetProviders.d.ts +14 -0
- package/dist/widget/components/WidgetProviders.d.ts.map +1 -0
- package/dist/widget/css/compiled.css +1 -1
- package/dist/widget/hooks/useAddressWalletIcon.d.ts +10 -0
- package/dist/widget/hooks/useAddressWalletIcon.d.ts.map +1 -0
- package/dist/widget/hooks/useBalanceVisible.d.ts +1 -1
- package/dist/widget/hooks/useBalanceVisible.d.ts.map +1 -1
- package/dist/widget/hooks/useChainFilter.d.ts +1 -1
- package/dist/widget/hooks/useChainFilter.d.ts.map +1 -1
- package/dist/widget/hooks/useCheckout.d.ts +13 -1
- package/dist/widget/hooks/useCheckout.d.ts.map +1 -1
- package/dist/widget/hooks/useConnector.d.ts +4 -0
- package/dist/widget/hooks/useConnector.d.ts.map +1 -0
- package/dist/widget/hooks/useCurrentScreen.d.ts +1 -1
- package/dist/widget/hooks/useCurrentScreen.d.ts.map +1 -1
- package/dist/widget/hooks/useCustomTokenFetch.d.ts +19 -0
- package/dist/widget/hooks/useCustomTokenFetch.d.ts.map +1 -0
- package/dist/widget/hooks/useCustomTokenSearch.d.ts +20 -0
- package/dist/widget/hooks/useCustomTokenSearch.d.ts.map +1 -0
- package/dist/widget/hooks/useDebounce.d.ts +10 -0
- package/dist/widget/hooks/useDebounce.d.ts.map +1 -0
- package/dist/widget/hooks/useDebugScreens.d.ts +7 -2
- package/dist/widget/hooks/useDebugScreens.d.ts.map +1 -1
- package/dist/widget/hooks/useDefaultTokenSelection.d.ts +3 -19
- package/dist/widget/hooks/useDefaultTokenSelection.d.ts.map +1 -1
- package/dist/widget/hooks/useDestinationSelectedToken.d.ts +1 -14
- package/dist/widget/hooks/useDestinationSelectedToken.d.ts.map +1 -1
- package/dist/widget/hooks/useEarnPool.d.ts +1 -1
- package/dist/widget/hooks/useEarnPool.d.ts.map +1 -1
- package/dist/widget/hooks/useIntentTransactionHistory.d.ts.map +1 -1
- package/dist/widget/hooks/useIsMobile.d.ts +5 -0
- package/dist/widget/hooks/useIsMobile.d.ts.map +1 -0
- package/dist/widget/hooks/useMode.d.ts +2 -2
- package/dist/widget/hooks/useMode.d.ts.map +1 -1
- package/dist/widget/hooks/useOriginSelectedToken.d.ts +2 -15
- package/dist/widget/hooks/useOriginSelectedToken.d.ts.map +1 -1
- package/dist/widget/hooks/usePayMessage.d.ts.map +1 -1
- package/dist/widget/hooks/usePriceImpactWarning.d.ts +1 -1
- package/dist/widget/hooks/usePriceImpactWarning.d.ts.map +1 -1
- package/dist/widget/hooks/useQuote.d.ts +173 -4
- package/dist/widget/hooks/useQuote.d.ts.map +1 -1
- package/dist/widget/hooks/useRecentTokens.d.ts +3 -3
- package/dist/widget/hooks/useRecentTokens.d.ts.map +1 -1
- package/dist/widget/hooks/useRecipients.d.ts +1 -1
- package/dist/widget/hooks/useRecipients.d.ts.map +1 -1
- package/dist/widget/hooks/useSelectedFeeOption.d.ts +2 -2
- package/dist/widget/hooks/useSelectedFeeOption.d.ts.map +1 -1
- package/dist/widget/hooks/useSelectedFundMethod.d.ts +1 -1
- package/dist/widget/hooks/useSelectedFundMethod.d.ts.map +1 -1
- package/dist/widget/hooks/useSelectedRecipient.d.ts +1 -1
- package/dist/widget/hooks/useSelectedRecipient.d.ts.map +1 -1
- package/dist/widget/hooks/useSendForm.d.ts +9 -31
- package/dist/widget/hooks/useSendForm.d.ts.map +1 -1
- package/dist/widget/hooks/useSwapAmount.d.ts +1 -1
- package/dist/widget/hooks/useSwapAmount.d.ts.map +1 -1
- package/dist/widget/hooks/useTheme.d.ts +1 -1
- package/dist/widget/hooks/useTheme.d.ts.map +1 -1
- package/dist/widget/hooks/useTokenList.d.ts +7 -31
- package/dist/widget/hooks/useTokenList.d.ts.map +1 -1
- package/dist/widget/hooks/useTrailsSendTransaction.d.ts +83 -0
- package/dist/widget/hooks/useTrailsSendTransaction.d.ts.map +1 -0
- package/dist/widget/hooks/useWalletConnectUri.d.ts +11 -0
- package/dist/widget/hooks/useWalletConnectUri.d.ts.map +1 -0
- package/dist/widget/hooks/useWidgetProps.d.ts +5 -0
- package/dist/widget/hooks/useWidgetProps.d.ts.map +1 -1
- package/dist/widget/index.d.ts +2 -0
- package/dist/widget/index.d.ts.map +1 -1
- package/dist/widget/index.js +8 -5
- package/dist/widget/providers/TrailsModalProvider.d.ts +65 -0
- package/dist/widget/providers/TrailsModalProvider.d.ts.map +1 -0
- package/dist/widget/providers/TrailsProvider.d.ts +1 -1
- package/dist/widget/providers/TrailsProvider.d.ts.map +1 -1
- package/dist/widget/types.d.ts +11 -18
- package/dist/widget/types.d.ts.map +1 -1
- package/dist/widget/widget.d.ts +20 -11
- package/dist/widget/widget.d.ts.map +1 -1
- package/package.json +45 -49
- package/src/aave.ts +387 -138
- package/src/analytics.ts +208 -2
- package/src/chains.ts +65 -64
- package/src/constants.ts +18 -14
- package/src/customTokens.ts +151 -0
- package/src/decoders.ts +4 -7
- package/src/error.ts +7 -3
- package/src/fees.ts +239 -125
- package/src/gasless.ts +54 -108
- package/src/index.ts +29 -9
- package/src/indexerClient.ts +2 -0
- package/src/intentReceiptMonitor.ts +1 -4
- package/src/intentReceiptPoller.ts +2 -2
- package/src/intents.ts +16 -5
- package/src/mode.ts +1 -1
- package/src/mutations.ts +7 -3
- package/src/prepareSend.ts +19 -14
- package/src/prices.ts +1 -1
- package/src/sequenceWallet.ts +2 -2
- package/src/time.ts +28 -0
- package/src/tokenBalances.ts +348 -153
- package/src/tokens.ts +393 -142
- package/src/trailsClient.ts +1 -1
- package/src/trailsRouter.ts +4 -5
- package/src/transactionIntent/deposits/depositOrchestrator.ts +6 -2
- package/src/transactionIntent/deposits/gaslessDeposit.ts +13 -7
- package/src/transactionIntent/deposits/standardDeposit.ts +1 -1
- package/src/transactionIntent/execution/transactionState.ts +1 -1
- package/src/transactionIntent/handlers/crossChain.ts +75 -37
- package/src/transactionIntent/handlers/sameChainSameToken.ts +66 -20
- package/src/transactionIntent/quote/feeExtractors.ts +1 -29
- package/src/transactionIntent/quote/normalizeQuote.ts +99 -7
- package/src/transactionIntent/quote/quoteHelpers.ts +1 -1
- package/src/transactionIntent/types.ts +31 -6
- package/src/transactionIntent/utils/testnetHelpers.ts +0 -5
- package/src/transactionIntent/validators.ts +0 -30
- package/src/transactions.ts +3 -3
- package/src/utils.ts +18 -0
- package/src/wallets.ts +32 -10
- package/src/widget/compiled.css +1 -1
- package/src/widget/components/AccountIntentTransactionHistory.tsx +2 -1
- package/src/widget/components/AccountIntentTransactionHistoryButton.tsx +2 -2
- package/src/widget/components/AddressWalletIcon.tsx +29 -0
- package/src/widget/components/ChainFilterDropdown.tsx +2 -8
- package/src/widget/components/ChainImage.tsx +8 -5
- package/src/widget/components/ChainList.tsx +6 -8
- package/src/widget/components/ClassicSwap.tsx +93 -85
- package/src/widget/components/ConnectWallet.tsx +1 -2
- package/src/widget/components/ConnectedWallets.tsx +17 -4
- package/src/widget/components/DebugMenu.tsx +2 -2
- package/src/widget/components/DebugScreensList.tsx +0 -1
- package/src/widget/components/DepositTracker.tsx +20 -34
- package/src/widget/components/Earn.tsx +7 -6
- package/src/widget/components/FeeOption.tsx +4 -4
- package/src/widget/components/FeeOptions.tsx +19 -39
- package/src/widget/components/Footer.tsx +1 -1
- package/src/widget/components/Fund.tsx +23 -119
- package/src/widget/components/FundMethods.tsx +9 -6
- package/src/widget/components/FundSwap.tsx +6 -5
- package/src/widget/components/FundingMethodSelectorButton.tsx +2 -2
- package/src/widget/components/HookModalContent.tsx +306 -0
- package/src/widget/components/Modal.tsx +1 -1
- package/src/widget/components/OriginSelectionAmount.tsx +135 -0
- package/src/widget/components/Pay.tsx +66 -124
- package/src/widget/components/PoolDeposit.tsx +11 -55
- package/src/widget/components/PoolWithdraw.tsx +3 -3
- package/src/widget/components/QuoteDetails.tsx +473 -728
- package/src/widget/components/Receipt.tsx +74 -7
- package/src/widget/components/RecentTokens.tsx +8 -8
- package/src/widget/components/RecipientSelectorButton.tsx +4 -2
- package/src/widget/components/ScreenHeader.tsx +2 -2
- package/src/widget/components/SearchInputField.tsx +1 -1
- package/src/widget/components/ShadowPortal.tsx +58 -0
- package/src/widget/components/Swap.tsx +6 -5
- package/src/widget/components/ThemeProvider.tsx +1 -1
- package/src/widget/components/TokenList.tsx +3 -4
- package/src/widget/components/TokenSelector.tsx +211 -80
- package/src/widget/components/Tooltip.tsx +18 -7
- package/src/widget/components/TrailsHookModal.tsx +118 -0
- package/src/widget/components/WaasFeeOptions.tsx +333 -138
- package/src/widget/components/WalletConfirmation.tsx +7 -2
- package/src/widget/components/WalletConnect.tsx +197 -235
- package/src/widget/components/WidgetProviders.tsx +75 -0
- package/src/widget/hooks/useAddressWalletIcon.ts +53 -0
- package/src/widget/hooks/useBalanceVisible.tsx +1 -1
- package/src/widget/hooks/useChainFilter.tsx +1 -1
- package/src/widget/hooks/useCheckout.ts +13 -1
- package/src/widget/hooks/useConnector.tsx +18 -0
- package/src/widget/hooks/useCurrentScreen.tsx +3 -3
- package/src/widget/hooks/useCustomTokenFetch.tsx +72 -0
- package/src/widget/hooks/useCustomTokenSearch.tsx +402 -0
- package/src/widget/hooks/useDebounce.ts +25 -0
- package/src/widget/hooks/useDebugScreens.ts +26 -10
- package/src/widget/hooks/useDefaultTokenSelection.tsx +99 -143
- package/src/widget/hooks/useDestinationSelectedToken.tsx +1 -14
- package/src/widget/hooks/useEarnPool.tsx +1 -1
- package/src/widget/hooks/useIntentTransactionHistory.ts +20 -11
- package/src/widget/hooks/useIsMobile.tsx +50 -0
- package/src/widget/hooks/useMode.ts +2 -3
- package/src/widget/hooks/useOriginSelectedToken.tsx +2 -15
- package/src/widget/hooks/usePayMessage.tsx +31 -11
- package/src/widget/hooks/usePriceImpactWarning.ts +1 -1
- package/src/widget/hooks/useQuote.ts +189 -6
- package/src/widget/hooks/useRecentTokens.ts +6 -6
- package/src/widget/hooks/useRecipients.ts +1 -1
- package/src/widget/hooks/useSelectedFeeOption.tsx +2 -2
- package/src/widget/hooks/useSelectedFundMethod.tsx +1 -1
- package/src/widget/hooks/useSelectedRecipient.tsx +1 -1
- package/src/widget/hooks/useSendForm.ts +328 -152
- package/src/widget/hooks/useSwapAmount.tsx +1 -1
- package/src/widget/hooks/useTheme.tsx +1 -1
- package/src/widget/hooks/useTokenList.ts +672 -400
- package/src/widget/hooks/useTrailsSendTransaction.ts +949 -0
- package/src/widget/hooks/useWalletConnectUri.tsx +228 -0
- package/src/widget/hooks/useWidgetProps.tsx +3 -1
- package/src/widget/index.tsx +12 -0
- package/src/widget/providers/TrailsModalProvider.tsx +195 -0
- package/src/widget/providers/TrailsProvider.tsx +9 -3
- package/src/widget/types.ts +12 -20
- package/src/widget/widget.tsx +598 -385
- package/dist/cctp.d.ts +0 -3
- package/dist/cctp.d.ts.map +0 -1
- package/dist/lifi.d.ts +0 -4
- package/dist/lifi.d.ts.map +0 -1
- package/dist/meshconnect.d.ts +0 -171
- package/dist/meshconnect.d.ts.map +0 -1
- package/dist/relaySdk.d.ts +0 -87
- package/dist/relaySdk.d.ts.map +0 -1
- package/dist/widget/components/MeshConnectExchanges.d.ts +0 -7
- package/dist/widget/components/MeshConnectExchanges.d.ts.map +0 -1
- package/dist/widget/components/MeshConnectFlow.d.ts +0 -13
- package/dist/widget/components/MeshConnectFlow.d.ts.map +0 -1
- package/dist/widget/components/MeshConnectIframe.d.ts +0 -15
- package/dist/widget/components/MeshConnectIframe.d.ts.map +0 -1
- package/dist/widget/components/Receive.d.ts +0 -12
- package/dist/widget/components/Receive.d.ts.map +0 -1
- package/dist/widget/hooks/useSelectedMeshExchange.d.ts +0 -14
- package/dist/widget/hooks/useSelectedMeshExchange.d.ts.map +0 -1
- package/src/cctp.ts +0 -54
- package/src/lifi.ts +0 -108
- package/src/meshconnect.ts +0 -531
- package/src/relaySdk.ts +0 -703
- package/src/widget/components/MeshConnectExchanges.tsx +0 -290
- package/src/widget/components/MeshConnectFlow.tsx +0 -90
- package/src/widget/components/MeshConnectIframe.tsx +0 -500
- package/src/widget/components/Receive.tsx +0 -175
- package/src/widget/hooks/useSelectedMeshExchange.tsx +0 -46
|
@@ -8,8 +8,15 @@ import { useState, useEffect, useRef, useCallback } from "react"
|
|
|
8
8
|
import { truncateAddress } from "../../utils.js"
|
|
9
9
|
import { PriceImpactWarning } from "./PriceImpactWarning.js"
|
|
10
10
|
import { usePriceImpactWarning } from "../hooks/usePriceImpactWarning.js"
|
|
11
|
-
import {
|
|
12
|
-
|
|
11
|
+
import {
|
|
12
|
+
Copy,
|
|
13
|
+
Check,
|
|
14
|
+
Info,
|
|
15
|
+
ExternalLink,
|
|
16
|
+
Clock,
|
|
17
|
+
ChevronDown,
|
|
18
|
+
TriangleAlert,
|
|
19
|
+
} from "lucide-react"
|
|
13
20
|
|
|
14
21
|
interface QuoteDetailsProps {
|
|
15
22
|
quote?: PrepareSendQuote | null
|
|
@@ -21,30 +28,6 @@ interface QuoteDetailsProps {
|
|
|
21
28
|
isRefetching?: boolean
|
|
22
29
|
}
|
|
23
30
|
|
|
24
|
-
// Helper function to format completion time
|
|
25
|
-
const formatCompletionTime = (seconds: number): string => {
|
|
26
|
-
if (seconds < 60) {
|
|
27
|
-
return `${seconds}s`
|
|
28
|
-
} else if (seconds < 3600) {
|
|
29
|
-
const minutes = Math.floor(seconds / 60)
|
|
30
|
-
const remainingSeconds = seconds % 60
|
|
31
|
-
return remainingSeconds > 0
|
|
32
|
-
? `${minutes}m${remainingSeconds}s`
|
|
33
|
-
: `${minutes}m`
|
|
34
|
-
} else {
|
|
35
|
-
const hours = Math.floor(seconds / 3600)
|
|
36
|
-
const remainingMinutes = Math.floor((seconds % 3600) / 60)
|
|
37
|
-
const remainingSeconds = seconds % 60
|
|
38
|
-
if (remainingMinutes > 0 || remainingSeconds > 0) {
|
|
39
|
-
return `${hours}h${remainingMinutes}m${
|
|
40
|
-
remainingSeconds > 0 ? `${remainingSeconds}s` : ""
|
|
41
|
-
}`
|
|
42
|
-
} else {
|
|
43
|
-
return `${hours}h`
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
31
|
export const QuoteDetails: React.FC<QuoteDetailsProps> = ({
|
|
49
32
|
quote,
|
|
50
33
|
showContent = true,
|
|
@@ -97,6 +80,10 @@ export const QuoteDetails: React.FC<QuoteDetailsProps> = ({
|
|
|
97
80
|
|
|
98
81
|
if (!showContent) return null
|
|
99
82
|
|
|
83
|
+
// Use grandTotalUsd from normalized quote object
|
|
84
|
+
const grandTotalUsd = quote?.grandTotalUsd ?? 0
|
|
85
|
+
const grandTotalUsdDisplay = quote?.grandTotalUsdDisplay ?? "$0.00"
|
|
86
|
+
|
|
100
87
|
return (
|
|
101
88
|
<div
|
|
102
89
|
className={`relative transition-opacity duration-300 ${
|
|
@@ -117,24 +104,11 @@ export const QuoteDetails: React.FC<QuoteDetailsProps> = ({
|
|
|
117
104
|
<span className="text-xs text-amber-600 dark:text-amber-400 flex items-center gap-1">
|
|
118
105
|
Balance Status:
|
|
119
106
|
<Tooltip message="Your wallet does not have sufficient balance to complete this transaction">
|
|
120
|
-
<Info className="
|
|
107
|
+
<Info className="size-3 text-amber-500 dark:text-amber-400 cursor-pointer" />
|
|
121
108
|
</Tooltip>
|
|
122
109
|
</span>
|
|
123
110
|
<span className="font-medium text-xs text-amber-600 dark:text-amber-400 flex items-center gap-1">
|
|
124
|
-
<
|
|
125
|
-
className="w-3 h-3"
|
|
126
|
-
fill="none"
|
|
127
|
-
stroke="currentColor"
|
|
128
|
-
viewBox="0 0 24 24"
|
|
129
|
-
aria-hidden="true"
|
|
130
|
-
>
|
|
131
|
-
<path
|
|
132
|
-
strokeLinecap="round"
|
|
133
|
-
strokeLinejoin="round"
|
|
134
|
-
strokeWidth={2}
|
|
135
|
-
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"
|
|
136
|
-
/>
|
|
137
|
-
</svg>
|
|
111
|
+
<TriangleAlert className="size-3" />
|
|
138
112
|
Insufficient Balance
|
|
139
113
|
</span>
|
|
140
114
|
</div>
|
|
@@ -145,38 +119,25 @@ export const QuoteDetails: React.FC<QuoteDetailsProps> = ({
|
|
|
145
119
|
<button
|
|
146
120
|
type="button"
|
|
147
121
|
onClick={() => setIsExpanded(!isExpanded)}
|
|
148
|
-
className="w-full flex items-center justify-between px-2 py-2 trails-border-radius-button transition-colors cursor-pointer text-
|
|
122
|
+
className="w-full flex items-center justify-between px-2 py-2 trails-border-radius-button transition-colors cursor-pointer text-sm"
|
|
149
123
|
aria-label="Show more details"
|
|
150
124
|
>
|
|
151
|
-
<div className="
|
|
152
|
-
{quote?.originTokenRate && (
|
|
153
|
-
<span
|
|
154
|
-
)}
|
|
125
|
+
<div className="font-semibold text-gray-900 dark:text-white flex items-center gap-2 whitespace-nowrap max-w-48 truncate">
|
|
126
|
+
{quote?.originTokenRate && quote.originTokenRate !== "0" ? (
|
|
127
|
+
<span>{quote.originTokenRate}</span>
|
|
128
|
+
) : null}
|
|
155
129
|
</div>
|
|
156
130
|
<div className="flex items-center gap-2 text-gray-600 dark:text-gray-400">
|
|
157
|
-
{quote?.
|
|
158
|
-
|
|
159
|
-
<
|
|
160
|
-
className="w-3 h-3"
|
|
161
|
-
fill="none"
|
|
162
|
-
stroke="currentColor"
|
|
163
|
-
viewBox="0 0 24 24"
|
|
164
|
-
aria-hidden="true"
|
|
165
|
-
>
|
|
166
|
-
<path
|
|
167
|
-
strokeLinecap="round"
|
|
168
|
-
strokeLinejoin="round"
|
|
169
|
-
strokeWidth={2}
|
|
170
|
-
d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
171
|
-
/>
|
|
172
|
-
</svg>
|
|
131
|
+
{quote?.completionEstimateDisplay && (
|
|
132
|
+
<div className="flex items-center gap-1">
|
|
133
|
+
<Clock className="size-3" />
|
|
173
134
|
<span className="font-medium">
|
|
174
|
-
~{
|
|
135
|
+
~{quote.completionEstimateDisplay}
|
|
175
136
|
</span>
|
|
176
|
-
|
|
137
|
+
</div>
|
|
177
138
|
)}
|
|
178
|
-
{
|
|
179
|
-
|
|
139
|
+
{grandTotalUsd > 0 && (
|
|
140
|
+
<div className="flex items-center gap-1">
|
|
180
141
|
<svg
|
|
181
142
|
aria-hidden="true"
|
|
182
143
|
focusable="false"
|
|
@@ -193,25 +154,14 @@ export const QuoteDetails: React.FC<QuoteDetailsProps> = ({
|
|
|
193
154
|
d="M32 64C32 28.7 60.7 0 96 0H256c35.3 0 64 28.7 64 64V256h8c48.6 0 88 39.4 88 88v32c0 13.3 10.7 24 24 24s24-10.7 24-24V222c-27.6-7.1-48-32.2-48-62V96L384 64c-8.8-8.8-8.8-23.2 0-32s23.2-8.8 32 0l77.3 77.3c12 12 18.7 28.3 18.7 45.3V168v24 32V376c0 39.8-32.2 72-72 72s-72-32.2-72-72V344c0-22.1-17.9-40-40-40h-8V448c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32V64zM96 80v96c0 8.8 7.2 16 16 16H240c8.8 0 16-7.2 16-16V80c0-8.8-7.2-16-16-16H112c-8.8 0-16 7.2-16 16z"
|
|
194
155
|
/>
|
|
195
156
|
</svg>
|
|
196
|
-
<span className="font-medium">{
|
|
197
|
-
|
|
157
|
+
<span className="font-medium">{grandTotalUsdDisplay}</span>
|
|
158
|
+
</div>
|
|
198
159
|
)}
|
|
199
|
-
<
|
|
200
|
-
className={`
|
|
160
|
+
<ChevronDown
|
|
161
|
+
className={`size-3 transition-transform duration-300 ease-out text-gray-600 dark:text-gray-400 ${
|
|
201
162
|
isExpanded ? "rotate-180" : ""
|
|
202
163
|
}`}
|
|
203
|
-
|
|
204
|
-
stroke="currentColor"
|
|
205
|
-
viewBox="0 0 24 24"
|
|
206
|
-
aria-hidden="true"
|
|
207
|
-
>
|
|
208
|
-
<path
|
|
209
|
-
strokeLinecap="round"
|
|
210
|
-
strokeLinejoin="round"
|
|
211
|
-
strokeWidth={2}
|
|
212
|
-
d="M19 9l-7 7-7-7"
|
|
213
|
-
/>
|
|
214
|
-
</svg>
|
|
164
|
+
/>
|
|
215
165
|
</div>
|
|
216
166
|
</button>
|
|
217
167
|
) : (
|
|
@@ -224,22 +174,11 @@ export const QuoteDetails: React.FC<QuoteDetailsProps> = ({
|
|
|
224
174
|
aria-label="Show transaction details"
|
|
225
175
|
>
|
|
226
176
|
<span>Transaction details</span>
|
|
227
|
-
<
|
|
228
|
-
className={`
|
|
177
|
+
<ChevronDown
|
|
178
|
+
className={`size-3 transition-transform duration-300 ease-out ${
|
|
229
179
|
isExpanded ? "rotate-180" : ""
|
|
230
180
|
}`}
|
|
231
|
-
|
|
232
|
-
stroke="currentColor"
|
|
233
|
-
viewBox="0 0 24 24"
|
|
234
|
-
aria-hidden="true"
|
|
235
|
-
>
|
|
236
|
-
<path
|
|
237
|
-
strokeLinecap="round"
|
|
238
|
-
strokeLinejoin="round"
|
|
239
|
-
strokeWidth={2}
|
|
240
|
-
d="M19 9l-7 7-7-7"
|
|
241
|
-
/>
|
|
242
|
-
</svg>
|
|
181
|
+
/>
|
|
243
182
|
</button>
|
|
244
183
|
)}
|
|
245
184
|
</div>
|
|
@@ -259,25 +198,11 @@ export const QuoteDetails: React.FC<QuoteDetailsProps> = ({
|
|
|
259
198
|
<span className="text-xs text-gray-600 dark:text-gray-400 flex items-center gap-1">
|
|
260
199
|
Estimated Time:
|
|
261
200
|
<Tooltip message="Estimated time for the transaction to complete across all chains">
|
|
262
|
-
<Info className="
|
|
201
|
+
<Info className="size-3 text-gray-500 dark:text-gray-400 cursor-pointer" />
|
|
263
202
|
</Tooltip>
|
|
264
203
|
</span>
|
|
265
204
|
<span className="font-medium text-xs text-gray-900 dark:text-white flex items-center gap-1">
|
|
266
|
-
|
|
267
|
-
className="w-3 h-3"
|
|
268
|
-
fill="none"
|
|
269
|
-
stroke="currentColor"
|
|
270
|
-
viewBox="0 0 24 24"
|
|
271
|
-
aria-hidden="true"
|
|
272
|
-
>
|
|
273
|
-
<path
|
|
274
|
-
strokeLinecap="round"
|
|
275
|
-
strokeLinejoin="round"
|
|
276
|
-
strokeWidth={2}
|
|
277
|
-
d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
278
|
-
/>
|
|
279
|
-
</svg>
|
|
280
|
-
~{formatCompletionTime(quote.completionEstimateSeconds)}
|
|
205
|
+
~{quote.completionEstimateDisplay}
|
|
281
206
|
</span>
|
|
282
207
|
</div>
|
|
283
208
|
)} */}
|
|
@@ -288,149 +213,73 @@ export const QuoteDetails: React.FC<QuoteDetailsProps> = ({
|
|
|
288
213
|
{/* Gas Costs Section */}
|
|
289
214
|
{quote?.trailsFeeBreakdown &&
|
|
290
215
|
(quote?.trailsFeeBreakdown.originRelayFee ||
|
|
291
|
-
quote?.trailsFeeBreakdown.destinationRelayFee) &&
|
|
216
|
+
quote?.trailsFeeBreakdown.destinationRelayFee) &&
|
|
217
|
+
grandTotalUsd > 0 && (
|
|
292
218
|
<>
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
quote.trailsFeeBreakdown?.destinationRelayFee?.usdValue?.replace(
|
|
304
|
-
/[^0-9.-]/g,
|
|
305
|
-
"",
|
|
306
|
-
) || "0",
|
|
307
|
-
)
|
|
308
|
-
const totalGasUsd = originGasUsd + destGasUsd
|
|
309
|
-
|
|
310
|
-
// Calculate total provider costs (including swap fees)
|
|
311
|
-
const providerUsd = parseFloat(
|
|
312
|
-
quote.trailsFeeBreakdown?.providerFee?.usdValue?.replace(
|
|
313
|
-
/[^0-9.-]/g,
|
|
314
|
-
"",
|
|
315
|
-
) || "0",
|
|
316
|
-
)
|
|
317
|
-
const trailsUsd = parseFloat(
|
|
318
|
-
quote.trailsFeeBreakdown?.trailsFee?.usdValue?.replace(
|
|
319
|
-
/[^0-9.-]/g,
|
|
320
|
-
"",
|
|
321
|
-
) || "0",
|
|
322
|
-
)
|
|
323
|
-
const originUsd = parseFloat(
|
|
324
|
-
quote.originAmountUsdDisplay?.replace(/[^0-9.-]/g, "") ||
|
|
325
|
-
"0",
|
|
326
|
-
)
|
|
327
|
-
const destUsd = parseFloat(
|
|
328
|
-
quote.destinationAmountUsdDisplay?.replace(
|
|
329
|
-
/[^0-9.-]/g,
|
|
330
|
-
"",
|
|
331
|
-
) || "0",
|
|
332
|
-
)
|
|
333
|
-
const totalFeesUsd = parseFloat(
|
|
334
|
-
quote.fees?.totalFeeAmountUsdDisplay?.replace(
|
|
335
|
-
/[^0-9.-]/g,
|
|
336
|
-
"",
|
|
337
|
-
) || "0",
|
|
338
|
-
)
|
|
339
|
-
const swapFeesUsd = Math.max(
|
|
340
|
-
0,
|
|
341
|
-
originUsd - destUsd - totalFeesUsd,
|
|
342
|
-
)
|
|
343
|
-
const totalProviderUsd =
|
|
344
|
-
providerUsd + trailsUsd + swapFeesUsd
|
|
345
|
-
|
|
346
|
-
// Sum of all gas costs and all provider costs
|
|
347
|
-
const grandTotalUsd = totalGasUsd + totalProviderUsd
|
|
348
|
-
|
|
349
|
-
if (grandTotalUsd <= 0) return null
|
|
350
|
-
|
|
351
|
-
return (
|
|
352
|
-
<div className="flex justify-between items-center">
|
|
353
|
-
<span className="text-sm font-semibold text-gray-900 dark:text-white flex items-center gap-1">
|
|
354
|
-
Fees total
|
|
355
|
-
<Tooltip message="The total fees for this transaction, including gas costs and all provider fees">
|
|
356
|
-
<Info className="w-3 h-3 text-gray-500 dark:text-gray-400 cursor-pointer" />
|
|
357
|
-
</Tooltip>
|
|
358
|
-
</span>
|
|
359
|
-
<span className="font-semibold text-sm text-gray-900 dark:text-white">
|
|
360
|
-
≈ {formatUsdAmountDisplay(grandTotalUsd)}
|
|
361
|
-
</span>
|
|
362
|
-
</div>
|
|
363
|
-
)
|
|
364
|
-
})()}
|
|
365
|
-
|
|
219
|
+
<Row variant="bold">
|
|
220
|
+
<RowLabel tooltip="The total fees for this transaction, including gas costs and all provider fees">
|
|
221
|
+
Fees total
|
|
222
|
+
</RowLabel>
|
|
223
|
+
<RowValue>
|
|
224
|
+
<span title={`$${grandTotalUsd}`}>
|
|
225
|
+
≈ {grandTotalUsdDisplay}
|
|
226
|
+
</span>
|
|
227
|
+
</RowValue>
|
|
228
|
+
</Row>
|
|
366
229
|
<div className="h-0" />
|
|
367
|
-
|
|
368
|
-
{/* All Gas Costs */}
|
|
230
|
+
{/* Gas Costs Group */}
|
|
369
231
|
{(quote.trailsFeeBreakdown.originRelayFee ||
|
|
370
232
|
quote.trailsFeeBreakdown.destinationRelayFee) && (
|
|
371
|
-
<
|
|
372
|
-
<
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
{/* Origin Gas */}
|
|
400
|
-
{quote.trailsFeeBreakdown.originRelayFee && (
|
|
401
|
-
<div className="flex justify-between items-center">
|
|
402
|
-
<span className="text-xs text-gray-400 dark:text-gray-600 flex items-center gap-1">
|
|
403
|
-
Origin Gas
|
|
404
|
-
<ChainImage chainId={quote.originChain.id} size={16} />
|
|
405
|
-
<Tooltip message="Gas fee for executing the transaction on the origin chain">
|
|
406
|
-
<Info className="w-3 h-3 text-gray-500 dark:text-gray-400 cursor-pointer" />
|
|
407
|
-
</Tooltip>
|
|
408
|
-
</span>
|
|
409
|
-
<span className="font-medium text-xs text-gray-400 dark:text-gray-600">
|
|
410
|
-
{quote.trailsFeeBreakdown.originRelayFee.usdValue}
|
|
411
|
-
</span>
|
|
412
|
-
</div>
|
|
413
|
-
)}
|
|
233
|
+
<RowGroup>
|
|
234
|
+
<Row>
|
|
235
|
+
<RowLabel tooltip="Total gas costs for executing transactions on both origin and destination chains">
|
|
236
|
+
All gas costs
|
|
237
|
+
</RowLabel>
|
|
238
|
+
<RowValue>
|
|
239
|
+
<span title={`$${quote.totalGasUsd ?? 0}`}>
|
|
240
|
+
{quote.totalGasUsdDisplay ?? "$0.00"}
|
|
241
|
+
</span>
|
|
242
|
+
</RowValue>
|
|
243
|
+
</Row>
|
|
244
|
+
|
|
245
|
+
{quote.trailsFeeBreakdown.originRelayFee && (
|
|
246
|
+
<Row variant="light">
|
|
247
|
+
<RowLabel tooltip="Gas fee for executing the transaction on the origin chain">
|
|
248
|
+
Origin Gas
|
|
249
|
+
<ChainImage
|
|
250
|
+
chainId={quote.originChain.id}
|
|
251
|
+
size={16}
|
|
252
|
+
/>
|
|
253
|
+
</RowLabel>
|
|
254
|
+
<RowValue>
|
|
255
|
+
<span title={`$${quote.originGasUsd ?? 0}`}>
|
|
256
|
+
{quote.trailsFeeBreakdown.originRelayFee.usdValue}
|
|
257
|
+
</span>
|
|
258
|
+
</RowValue>
|
|
259
|
+
</Row>
|
|
260
|
+
)}
|
|
414
261
|
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
262
|
+
{quote.trailsFeeBreakdown.destinationRelayFee && (
|
|
263
|
+
<Row variant="light">
|
|
264
|
+
<RowLabel tooltip="Gas fee for executing the transaction on the destination chain">
|
|
265
|
+
Destination Gas
|
|
266
|
+
<ChainImage
|
|
267
|
+
chainId={quote.destinationChain.id}
|
|
268
|
+
size={16}
|
|
269
|
+
/>
|
|
270
|
+
</RowLabel>
|
|
271
|
+
<RowValue>
|
|
272
|
+
<span title={`$${quote.destGasUsd ?? 0}`}>
|
|
273
|
+
{
|
|
274
|
+
quote.trailsFeeBreakdown.destinationRelayFee
|
|
275
|
+
.usdValue
|
|
276
|
+
}
|
|
277
|
+
</span>
|
|
278
|
+
</RowValue>
|
|
279
|
+
</Row>
|
|
280
|
+
)}
|
|
281
|
+
</RowGroup>
|
|
432
282
|
)}
|
|
433
|
-
|
|
434
283
|
{/* Spacer */}
|
|
435
284
|
<div className="h-1" />
|
|
436
285
|
</>
|
|
@@ -441,86 +290,35 @@ export const QuoteDetails: React.FC<QuoteDetailsProps> = ({
|
|
|
441
290
|
if (!quote?.trailsFeeBreakdown) return null
|
|
442
291
|
|
|
443
292
|
// Check if provider fee is non-zero
|
|
444
|
-
const hasProviderFee =
|
|
445
|
-
quote.trailsFeeBreakdown.providerFee &&
|
|
446
|
-
parseFloat(
|
|
447
|
-
quote.trailsFeeBreakdown.providerFee.usdValue?.replace(
|
|
448
|
-
/[^0-9.-]/g,
|
|
449
|
-
"",
|
|
450
|
-
) || "0",
|
|
451
|
-
) !== 0
|
|
293
|
+
const hasProviderFee = (quote.providerUsd ?? 0) > 0
|
|
452
294
|
|
|
453
295
|
// Check if trails fee is non-zero
|
|
454
|
-
const hasTrailsFee =
|
|
455
|
-
quote.trailsFeeBreakdown.trailsFee &&
|
|
456
|
-
parseFloat(
|
|
457
|
-
quote.trailsFeeBreakdown.trailsFee.usdValue?.replace(
|
|
458
|
-
/[^0-9.-]/g,
|
|
459
|
-
"",
|
|
460
|
-
) || "0",
|
|
461
|
-
) !== 0
|
|
296
|
+
const hasTrailsFee = (quote.trailsUsd ?? 0) > 0
|
|
462
297
|
|
|
463
298
|
if (!hasProviderFee && !hasTrailsFee) return null
|
|
464
299
|
|
|
465
300
|
return (
|
|
466
|
-
|
|
467
|
-
{/*
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
301
|
+
<RowGroup>
|
|
302
|
+
{/* All Provider Fees = provider fee + swap fee */}
|
|
303
|
+
{((quote.providerUsd ?? 0) > 0 ||
|
|
304
|
+
(quote.swapFeesUsd ?? 0) > 0) &&
|
|
305
|
+
quote.allProviderFeesUsdDisplay &&
|
|
471
306
|
(() => {
|
|
472
|
-
const
|
|
473
|
-
quote.
|
|
474
|
-
|
|
475
|
-
"",
|
|
476
|
-
) || "0",
|
|
477
|
-
)
|
|
478
|
-
const trailsUsd = parseFloat(
|
|
479
|
-
quote.trailsFeeBreakdown.trailsFee?.usdValue?.replace(
|
|
480
|
-
/[^0-9.-]/g,
|
|
481
|
-
"",
|
|
482
|
-
) || "0",
|
|
483
|
-
)
|
|
484
|
-
|
|
485
|
-
// Calculate swap fees
|
|
486
|
-
const originUsd = parseFloat(
|
|
487
|
-
quote.originAmountUsdDisplay?.replace(
|
|
488
|
-
/[^0-9.-]/g,
|
|
489
|
-
"",
|
|
490
|
-
) || "0",
|
|
491
|
-
)
|
|
492
|
-
const destUsd = parseFloat(
|
|
493
|
-
quote.destinationAmountUsdDisplay?.replace(
|
|
494
|
-
/[^0-9.-]/g,
|
|
495
|
-
"",
|
|
496
|
-
) || "0",
|
|
497
|
-
)
|
|
498
|
-
const totalFeesUsd = parseFloat(
|
|
499
|
-
quote.fees?.totalFeeAmountUsdDisplay?.replace(
|
|
500
|
-
/[^0-9.-]/g,
|
|
501
|
-
"",
|
|
502
|
-
) || "0",
|
|
503
|
-
)
|
|
504
|
-
const swapFeesUsd = Math.max(
|
|
505
|
-
0,
|
|
506
|
-
originUsd - destUsd - totalFeesUsd,
|
|
507
|
-
)
|
|
508
|
-
|
|
509
|
-
const totalProviderUsd =
|
|
510
|
-
providerUsd + trailsUsd + swapFeesUsd
|
|
307
|
+
const allProviderFees =
|
|
308
|
+
(quote.providerUsd ?? 0) + (quote.swapFeesUsd ?? 0)
|
|
309
|
+
if (allProviderFees <= 0) return null
|
|
511
310
|
|
|
512
311
|
return (
|
|
513
|
-
<
|
|
514
|
-
<
|
|
515
|
-
All provider
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
</div>
|
|
312
|
+
<Row>
|
|
313
|
+
<RowLabel tooltip="Total provider fees including bridge fees and swap fees">
|
|
314
|
+
All provider fees
|
|
315
|
+
</RowLabel>
|
|
316
|
+
<RowValue>
|
|
317
|
+
<span title={`$${quote.allProviderFeesUsd ?? 0}`}>
|
|
318
|
+
{quote.allProviderFeesUsdDisplay}
|
|
319
|
+
</span>
|
|
320
|
+
</RowValue>
|
|
321
|
+
</Row>
|
|
524
322
|
)
|
|
525
323
|
})()}
|
|
526
324
|
|
|
@@ -533,8 +331,8 @@ export const QuoteDetails: React.FC<QuoteDetailsProps> = ({
|
|
|
533
331
|
const providerName = quote.quoteProvider?.name || ""
|
|
534
332
|
|
|
535
333
|
return (
|
|
536
|
-
<
|
|
537
|
-
<
|
|
334
|
+
<Row variant="light">
|
|
335
|
+
<RowLabel tooltip="Fee charged by the bridge/swap provider for executing the transaction">
|
|
538
336
|
{isCrossChain ? (
|
|
539
337
|
providerName ? (
|
|
540
338
|
<>
|
|
@@ -548,20 +346,7 @@ export const QuoteDetails: React.FC<QuoteDetailsProps> = ({
|
|
|
548
346
|
className="hover:underline inline-flex items-center gap-0.5 text-blue-500"
|
|
549
347
|
>
|
|
550
348
|
{providerName}
|
|
551
|
-
<
|
|
552
|
-
className="w-3 h-3"
|
|
553
|
-
fill="none"
|
|
554
|
-
stroke="currentColor"
|
|
555
|
-
viewBox="0 0 24 24"
|
|
556
|
-
aria-hidden="true"
|
|
557
|
-
>
|
|
558
|
-
<path
|
|
559
|
-
strokeLinecap="round"
|
|
560
|
-
strokeLinejoin="round"
|
|
561
|
-
strokeWidth={2}
|
|
562
|
-
d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
|
|
563
|
-
/>
|
|
564
|
-
</svg>
|
|
349
|
+
<ExternalLink className="size-3" />
|
|
565
350
|
</a>
|
|
566
351
|
)
|
|
567
352
|
</span>
|
|
@@ -581,20 +366,7 @@ export const QuoteDetails: React.FC<QuoteDetailsProps> = ({
|
|
|
581
366
|
className="hover:underline inline-flex items-center gap-0.5 text-blue-500"
|
|
582
367
|
>
|
|
583
368
|
{providerName}
|
|
584
|
-
<
|
|
585
|
-
className="w-3 h-3"
|
|
586
|
-
fill="none"
|
|
587
|
-
stroke="currentColor"
|
|
588
|
-
viewBox="0 0 24 24"
|
|
589
|
-
aria-hidden="true"
|
|
590
|
-
>
|
|
591
|
-
<path
|
|
592
|
-
strokeLinecap="round"
|
|
593
|
-
strokeLinejoin="round"
|
|
594
|
-
strokeWidth={2}
|
|
595
|
-
d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
|
|
596
|
-
/>
|
|
597
|
-
</svg>
|
|
369
|
+
<ExternalLink className="size-3" />
|
|
598
370
|
</a>
|
|
599
371
|
)
|
|
600
372
|
</span>
|
|
@@ -602,56 +374,37 @@ export const QuoteDetails: React.FC<QuoteDetailsProps> = ({
|
|
|
602
374
|
) : (
|
|
603
375
|
<>Liquidity Provider</>
|
|
604
376
|
)}
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
</div>
|
|
377
|
+
</RowLabel>
|
|
378
|
+
<RowValue>
|
|
379
|
+
<span title={`$${quote.providerUsd ?? 0}`}>
|
|
380
|
+
{providerFee.usdValue}
|
|
381
|
+
</span>
|
|
382
|
+
</RowValue>
|
|
383
|
+
</Row>
|
|
613
384
|
)
|
|
614
385
|
})()}
|
|
615
386
|
|
|
616
387
|
{/* Swap Fees (implicit costs) */}
|
|
617
|
-
{
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
quote.originAmountUsdDisplay?.replace(/[^0-9.-]/g, "") ||
|
|
621
|
-
"0",
|
|
622
|
-
)
|
|
623
|
-
const destUsd = parseFloat(
|
|
624
|
-
quote.destinationAmountUsdDisplay?.replace(
|
|
625
|
-
/[^0-9.-]/g,
|
|
626
|
-
"",
|
|
627
|
-
) || "0",
|
|
628
|
-
)
|
|
629
|
-
const totalFeesUsd = parseFloat(
|
|
630
|
-
quote.fees?.totalFeeAmountUsdDisplay?.replace(
|
|
631
|
-
/[^0-9.-]/g,
|
|
632
|
-
"",
|
|
633
|
-
) || "0",
|
|
634
|
-
)
|
|
635
|
-
|
|
636
|
-
const swapFeesUsd = originUsd - destUsd - totalFeesUsd
|
|
388
|
+
{quote.swapFeesUsdDisplay &&
|
|
389
|
+
(() => {
|
|
390
|
+
const swapFeesUsd = quote.swapFeesUsd ?? 0
|
|
637
391
|
|
|
638
|
-
|
|
639
|
-
|
|
392
|
+
// Only show if swap fees > 0
|
|
393
|
+
if (swapFeesUsd <= 0) return null
|
|
640
394
|
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
</
|
|
652
|
-
|
|
653
|
-
)
|
|
654
|
-
})()}
|
|
395
|
+
return (
|
|
396
|
+
<Row variant="light">
|
|
397
|
+
<RowLabel tooltip="Implicit costs including DEX fees, liquidity provider fees, and routing costs">
|
|
398
|
+
Swap
|
|
399
|
+
</RowLabel>
|
|
400
|
+
<RowValue>
|
|
401
|
+
<span title={`$${swapFeesUsd}`}>
|
|
402
|
+
{quote.swapFeesUsdDisplay}
|
|
403
|
+
</span>
|
|
404
|
+
</RowValue>
|
|
405
|
+
</Row>
|
|
406
|
+
)
|
|
407
|
+
})()}
|
|
655
408
|
|
|
656
409
|
{/* Trails Platform Fee */}
|
|
657
410
|
{hasTrailsFee &&
|
|
@@ -660,20 +413,15 @@ export const QuoteDetails: React.FC<QuoteDetailsProps> = ({
|
|
|
660
413
|
const trailsFee = quote.trailsFeeBreakdown.trailsFee
|
|
661
414
|
|
|
662
415
|
return (
|
|
663
|
-
<
|
|
664
|
-
<
|
|
416
|
+
<Row variant="light">
|
|
417
|
+
<RowLabel tooltip="Platform fee for using the Trails service">
|
|
665
418
|
Trails
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
</span>
|
|
670
|
-
<span className="font-medium text-xs text-gray-400 dark:text-gray-600">
|
|
671
|
-
{trailsFee.usdValue}
|
|
672
|
-
</span>
|
|
673
|
-
</div>
|
|
419
|
+
</RowLabel>
|
|
420
|
+
<RowValue>{trailsFee.usdValue}</RowValue>
|
|
421
|
+
</Row>
|
|
674
422
|
)
|
|
675
423
|
})()}
|
|
676
|
-
|
|
424
|
+
</RowGroup>
|
|
677
425
|
)
|
|
678
426
|
})()}
|
|
679
427
|
|
|
@@ -693,20 +441,16 @@ export const QuoteDetails: React.FC<QuoteDetailsProps> = ({
|
|
|
693
441
|
if (!showSection) return null
|
|
694
442
|
|
|
695
443
|
return (
|
|
696
|
-
|
|
697
|
-
<
|
|
698
|
-
<
|
|
699
|
-
|
|
700
|
-
</span>
|
|
701
|
-
</div>
|
|
444
|
+
<RowGroup>
|
|
445
|
+
<Row variant="bold">
|
|
446
|
+
<RowLabel>Transaction details</RowLabel>
|
|
447
|
+
</Row>
|
|
702
448
|
|
|
703
449
|
{/* Intent ID */}
|
|
704
450
|
{hasIntentId && (
|
|
705
|
-
<
|
|
706
|
-
<
|
|
707
|
-
|
|
708
|
-
</span>
|
|
709
|
-
<div className="flex items-center gap-1 text-xs font-medium text-gray-600 dark:text-gray-400">
|
|
451
|
+
<Row className="gap-2">
|
|
452
|
+
<RowLabel>Intent ID</RowLabel>
|
|
453
|
+
<RowValue className="flex items-center gap-1">
|
|
710
454
|
<span title={quote.intentId ?? undefined}>
|
|
711
455
|
{truncateAddress(quote?.intentId ?? "", 9, 3)}
|
|
712
456
|
</span>
|
|
@@ -717,42 +461,34 @@ export const QuoteDetails: React.FC<QuoteDetailsProps> = ({
|
|
|
717
461
|
aria-label="Copy intent ID"
|
|
718
462
|
>
|
|
719
463
|
{intentIdCopied ? (
|
|
720
|
-
<Check className="
|
|
464
|
+
<Check className="size-3 text-emerald-500" />
|
|
721
465
|
) : (
|
|
722
|
-
<Copy className="
|
|
466
|
+
<Copy className="size-3 text-gray-500 dark:text-gray-400" />
|
|
723
467
|
)}
|
|
724
468
|
</button>
|
|
725
|
-
</
|
|
726
|
-
</
|
|
469
|
+
</RowValue>
|
|
470
|
+
</Row>
|
|
727
471
|
)}
|
|
728
472
|
|
|
729
473
|
{/* Max Slippage */}
|
|
730
474
|
{hasSlippage && (
|
|
731
|
-
<
|
|
732
|
-
<
|
|
475
|
+
<Row>
|
|
476
|
+
<RowLabel tooltip="The maximum percentage by which the exchange rate can change before the transaction fails. Higher slippage means more tolerance for price changes but potentially worse rates.">
|
|
733
477
|
Max slippage
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
</span>
|
|
738
|
-
<span className="font-medium text-xs text-gray-600 dark:text-gray-400">
|
|
739
|
-
{quote.slippageTolerance}%
|
|
740
|
-
</span>
|
|
741
|
-
</div>
|
|
478
|
+
</RowLabel>
|
|
479
|
+
<RowValue>{quote.slippageTolerance}%</RowValue>
|
|
480
|
+
</Row>
|
|
742
481
|
)}
|
|
743
482
|
|
|
744
483
|
{/* Price Impact */}
|
|
745
484
|
{hasPriceImpact && (
|
|
746
485
|
<div className="space-y-1">
|
|
747
|
-
<
|
|
748
|
-
<
|
|
486
|
+
<Row>
|
|
487
|
+
<RowLabel tooltip="The percentage change in the token price caused by your trade. Higher impact means your trade affects the market price more, potentially resulting in worse rates.">
|
|
749
488
|
Price impact
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
</span>
|
|
754
|
-
<span
|
|
755
|
-
className={`font-medium text-xs flex items-center gap-1 ${
|
|
489
|
+
</RowLabel>
|
|
490
|
+
<RowValue
|
|
491
|
+
className={`flex items-center gap-1 ${
|
|
756
492
|
Math.abs(Number(quote.priceImpact)) > 5
|
|
757
493
|
? "text-red-600 dark:text-red-400"
|
|
758
494
|
: Math.abs(Number(quote.priceImpact)) > 0.5
|
|
@@ -762,25 +498,12 @@ export const QuoteDetails: React.FC<QuoteDetailsProps> = ({
|
|
|
762
498
|
>
|
|
763
499
|
{Math.abs(Number(quote.priceImpact)) > 0.5 && (
|
|
764
500
|
<span title="High price impact">
|
|
765
|
-
<
|
|
766
|
-
className="w-3 h-3"
|
|
767
|
-
fill="none"
|
|
768
|
-
stroke="currentColor"
|
|
769
|
-
viewBox="0 0 24 24"
|
|
770
|
-
aria-hidden="true"
|
|
771
|
-
>
|
|
772
|
-
<path
|
|
773
|
-
strokeLinecap="round"
|
|
774
|
-
strokeLinejoin="round"
|
|
775
|
-
strokeWidth={2}
|
|
776
|
-
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"
|
|
777
|
-
/>
|
|
778
|
-
</svg>
|
|
501
|
+
<TriangleAlert className="size-3" />
|
|
779
502
|
</span>
|
|
780
503
|
)}
|
|
781
504
|
{quote.priceImpact}%
|
|
782
|
-
</
|
|
783
|
-
</
|
|
505
|
+
</RowValue>
|
|
506
|
+
</Row>
|
|
784
507
|
{quote.priceImpactUsdDisplay && (
|
|
785
508
|
<div className="text-right">
|
|
786
509
|
<span className="text-xs text-gray-500 dark:text-gray-400">
|
|
@@ -790,284 +513,252 @@ export const QuoteDetails: React.FC<QuoteDetailsProps> = ({
|
|
|
790
513
|
)}
|
|
791
514
|
</div>
|
|
792
515
|
)}
|
|
793
|
-
|
|
516
|
+
</RowGroup>
|
|
794
517
|
)
|
|
795
518
|
})()}
|
|
796
519
|
|
|
797
520
|
<div className="space-y-3 pt-2">
|
|
798
521
|
{/* Exchange Rate */}
|
|
799
|
-
{quote?.originTokenRate &&
|
|
800
|
-
|
|
801
|
-
|
|
522
|
+
{quote?.originTokenRate &&
|
|
523
|
+
quote?.destinationTokenRate &&
|
|
524
|
+
quote.originTokenRate !== "0" &&
|
|
525
|
+
quote.destinationTokenRate !== "0" ? (
|
|
526
|
+
<Row>
|
|
527
|
+
<RowLabel tooltip="The current exchange rate between the origin and destination tokens">
|
|
802
528
|
Exchange Rate
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
{
|
|
820
|
-
{quote?.originAmount &&
|
|
529
|
+
</RowLabel>
|
|
530
|
+
<RowValue>
|
|
531
|
+
<button
|
|
532
|
+
type="button"
|
|
533
|
+
onClick={() => setShowOriginRate(!showOriginRate)}
|
|
534
|
+
className="hover:underline cursor-pointer"
|
|
535
|
+
>
|
|
536
|
+
{showOriginRate
|
|
537
|
+
? quote.originTokenRate
|
|
538
|
+
: quote.destinationTokenRate}
|
|
539
|
+
</button>
|
|
540
|
+
</RowValue>
|
|
541
|
+
</Row>
|
|
542
|
+
) : null}
|
|
543
|
+
|
|
544
|
+
{/* Transfer Amounts Group */}
|
|
545
|
+
{((quote?.originAmount &&
|
|
821
546
|
quote?.originToken.symbol &&
|
|
822
|
-
quote?.originChain.id
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
547
|
+
quote?.originChain.id) ||
|
|
548
|
+
(quote?.destinationToken.symbol &&
|
|
549
|
+
quote?.destinationAmount &&
|
|
550
|
+
quote?.destinationAmountUsdDisplay &&
|
|
551
|
+
quote?.destinationChain.id)) && (
|
|
552
|
+
<RowGroup>
|
|
553
|
+
{quote?.originAmount &&
|
|
554
|
+
quote?.originToken.symbol &&
|
|
555
|
+
quote?.originChain.id && (
|
|
556
|
+
<Row className="items-start">
|
|
557
|
+
<RowLabel tooltip="The amount of tokens you will send from the origin chain">
|
|
558
|
+
Origin Transfer Amount
|
|
559
|
+
</RowLabel>
|
|
560
|
+
<div className="text-right">
|
|
561
|
+
{quote.originToken.contractAddress ===
|
|
562
|
+
"0x0000000000000000000000000000000000000000" ? (
|
|
563
|
+
<>
|
|
564
|
+
<div className="font-medium text-xs text-gray-600 dark:text-gray-400 flex items-center gap-1 justify-end">
|
|
565
|
+
<TokenImage
|
|
566
|
+
imageUrl={quote.originToken.imageUrl}
|
|
567
|
+
symbol={quote.originToken.symbol}
|
|
568
|
+
chainId={quote.originChain.id}
|
|
569
|
+
contractAddress={
|
|
570
|
+
quote.originToken.contractAddress
|
|
571
|
+
}
|
|
572
|
+
size={16}
|
|
573
|
+
/>
|
|
574
|
+
{quote.originAmountDisplay}{" "}
|
|
575
|
+
{quote.originToken.symbol}
|
|
576
|
+
</div>
|
|
577
|
+
{quote.originAmountUsdDisplay && (
|
|
578
|
+
<div className="text-xs text-gray-500 dark:text-gray-400 mt-0.5">
|
|
579
|
+
≈ {quote.originAmountUsdDisplay}
|
|
580
|
+
</div>
|
|
581
|
+
)}
|
|
582
|
+
</>
|
|
583
|
+
) : (
|
|
584
|
+
<>
|
|
585
|
+
<a
|
|
586
|
+
href={getExplorerUrlForAddress({
|
|
587
|
+
address: quote.originToken.contractAddress,
|
|
588
|
+
chainId: quote.originChain.id,
|
|
589
|
+
})}
|
|
590
|
+
target="_blank"
|
|
591
|
+
rel="noopener noreferrer"
|
|
592
|
+
className="hover:underline cursor-pointer"
|
|
593
|
+
>
|
|
594
|
+
<div className="font-medium text-xs text-gray-600 dark:text-gray-400 flex items-center gap-1 justify-end">
|
|
595
|
+
<TokenImage
|
|
596
|
+
imageUrl={quote.originToken.imageUrl}
|
|
597
|
+
symbol={quote.originToken.symbol}
|
|
598
|
+
chainId={quote.originChain.id}
|
|
599
|
+
contractAddress={
|
|
600
|
+
quote.originToken.contractAddress
|
|
601
|
+
}
|
|
602
|
+
size={16}
|
|
603
|
+
/>
|
|
604
|
+
{quote.originAmountDisplay}{" "}
|
|
605
|
+
{quote.originToken.symbol}
|
|
606
|
+
</div>
|
|
607
|
+
</a>
|
|
608
|
+
{quote.originAmountUsdDisplay && (
|
|
609
|
+
<div className="text-xs text-gray-500 dark:text-gray-400 mt-0.5">
|
|
610
|
+
≈ {quote.originAmountUsdDisplay}
|
|
611
|
+
</div>
|
|
612
|
+
)}
|
|
613
|
+
</>
|
|
851
614
|
)}
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
quote.
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
615
|
+
</div>
|
|
616
|
+
</Row>
|
|
617
|
+
)}
|
|
618
|
+
|
|
619
|
+
{quote?.destinationToken.symbol &&
|
|
620
|
+
quote?.destinationAmount &&
|
|
621
|
+
quote?.destinationAmountUsdDisplay &&
|
|
622
|
+
quote?.destinationChain.id && (
|
|
623
|
+
<Row className="items-start">
|
|
624
|
+
<RowLabel tooltip="The amount of tokens you will receive on the destination chain after the swap and/or bridge">
|
|
625
|
+
Destination Target Amount
|
|
626
|
+
</RowLabel>
|
|
627
|
+
<div className="text-right">
|
|
628
|
+
{quote.destinationToken.contractAddress ===
|
|
629
|
+
"0x0000000000000000000000000000000000000000" ? (
|
|
630
|
+
<>
|
|
631
|
+
<div className="font-medium text-xs text-gray-600 dark:text-gray-400 flex items-center gap-1 justify-end">
|
|
632
|
+
<TokenImage
|
|
633
|
+
imageUrl={quote.destinationToken.imageUrl}
|
|
634
|
+
symbol={quote.destinationToken.symbol}
|
|
635
|
+
chainId={quote.destinationChain.id}
|
|
636
|
+
contractAddress={
|
|
637
|
+
quote.destinationToken.contractAddress
|
|
638
|
+
}
|
|
639
|
+
size={16}
|
|
640
|
+
/>
|
|
641
|
+
{quote.destinationAmountDisplay}{" "}
|
|
642
|
+
{quote.destinationToken.symbol}
|
|
643
|
+
</div>
|
|
644
|
+
{quote.destinationAmountUsdDisplay && (
|
|
645
|
+
<div className="text-xs text-gray-500 dark:text-gray-400 mt-0.5">
|
|
646
|
+
≈ {quote.destinationAmountUsdDisplay}
|
|
647
|
+
</div>
|
|
648
|
+
)}
|
|
649
|
+
</>
|
|
650
|
+
) : (
|
|
651
|
+
<>
|
|
652
|
+
<a
|
|
653
|
+
href={getExplorerUrlForAddress({
|
|
654
|
+
address:
|
|
655
|
+
quote.destinationToken.contractAddress,
|
|
656
|
+
chainId: quote.destinationChain.id,
|
|
657
|
+
})}
|
|
658
|
+
target="_blank"
|
|
659
|
+
rel="noopener noreferrer"
|
|
660
|
+
className="hover:underline cursor-pointer"
|
|
661
|
+
>
|
|
662
|
+
<div className="font-medium text-xs text-gray-600 dark:text-gray-400 flex items-center gap-1 justify-end">
|
|
663
|
+
<TokenImage
|
|
664
|
+
imageUrl={quote.destinationToken.imageUrl}
|
|
665
|
+
symbol={quote.destinationToken.symbol}
|
|
666
|
+
chainId={quote.destinationChain.id}
|
|
667
|
+
contractAddress={
|
|
668
|
+
quote.destinationToken.contractAddress
|
|
669
|
+
}
|
|
670
|
+
size={16}
|
|
671
|
+
/>
|
|
672
|
+
{quote.destinationAmountDisplay}{" "}
|
|
673
|
+
{quote.destinationToken.symbol}
|
|
674
|
+
</div>
|
|
675
|
+
</a>
|
|
676
|
+
{quote.destinationAmountUsdDisplay && (
|
|
677
|
+
<div className="text-xs text-gray-500 dark:text-gray-400 mt-0.5">
|
|
678
|
+
≈ {quote.destinationAmountUsdDisplay}
|
|
679
|
+
</div>
|
|
680
|
+
)}
|
|
681
|
+
</>
|
|
882
682
|
)}
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
683
|
+
</div>
|
|
684
|
+
</Row>
|
|
685
|
+
)}
|
|
686
|
+
</RowGroup>
|
|
687
|
+
)}
|
|
888
688
|
|
|
889
|
-
{/*
|
|
890
|
-
{quote?.
|
|
891
|
-
quote?.
|
|
892
|
-
quote?.
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
<
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
) : (
|
|
925
|
-
<>
|
|
689
|
+
{/* Address Group */}
|
|
690
|
+
{(quote?.originDepositAddress ||
|
|
691
|
+
quote?.destinationDepositAddress ||
|
|
692
|
+
quote?.destinationAddress) && (
|
|
693
|
+
<RowGroup>
|
|
694
|
+
{quote?.originDepositAddress && (
|
|
695
|
+
<Row>
|
|
696
|
+
<RowLabel tooltip="This is the intent address to deposit to that will then execute the swap and/or bridge">
|
|
697
|
+
Origin Deposit Address
|
|
698
|
+
</RowLabel>
|
|
699
|
+
<RowValue>
|
|
700
|
+
<a
|
|
701
|
+
href={getExplorerUrlForAddress({
|
|
702
|
+
address: quote.originDepositAddress,
|
|
703
|
+
chainId: quote.originChain.id,
|
|
704
|
+
})}
|
|
705
|
+
target="_blank"
|
|
706
|
+
rel="noopener noreferrer"
|
|
707
|
+
className="font-mono text-xs hover:underline flex items-center gap-1 text-blue-500"
|
|
708
|
+
>
|
|
709
|
+
{truncateAddress(quote.originDepositAddress)}
|
|
710
|
+
<ExternalLink className="size-3" />
|
|
711
|
+
</a>
|
|
712
|
+
</RowValue>
|
|
713
|
+
</Row>
|
|
714
|
+
)}
|
|
715
|
+
|
|
716
|
+
{quote?.destinationDepositAddress &&
|
|
717
|
+
quote?.destinationDepositAddress !==
|
|
718
|
+
quote?.originDepositAddress && (
|
|
719
|
+
<Row>
|
|
720
|
+
<RowLabel tooltip="This is the address that will receive the tokens after any swap and/or bridge from the origin chain">
|
|
721
|
+
Destination Deposit Address
|
|
722
|
+
</RowLabel>
|
|
723
|
+
<RowValue>
|
|
926
724
|
<a
|
|
927
725
|
href={getExplorerUrlForAddress({
|
|
928
|
-
address: quote.
|
|
726
|
+
address: quote.destinationDepositAddress,
|
|
929
727
|
chainId: quote.destinationChain.id,
|
|
930
728
|
})}
|
|
931
729
|
target="_blank"
|
|
932
730
|
rel="noopener noreferrer"
|
|
933
|
-
className="hover:underline
|
|
731
|
+
className="font-mono text-xs hover:underline flex items-center gap-1 text-blue-500"
|
|
934
732
|
>
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
imageUrl={quote.destinationToken.imageUrl}
|
|
938
|
-
symbol={quote.destinationToken.symbol}
|
|
939
|
-
chainId={quote.destinationChain.id}
|
|
940
|
-
contractAddress={
|
|
941
|
-
quote.destinationToken.contractAddress
|
|
942
|
-
}
|
|
943
|
-
size={16}
|
|
944
|
-
/>
|
|
945
|
-
{quote.destinationAmountDisplay}{" "}
|
|
946
|
-
{quote.destinationToken.symbol}
|
|
947
|
-
</div>
|
|
733
|
+
{truncateAddress(quote.destinationDepositAddress)}
|
|
734
|
+
<ExternalLink className="size-3" />
|
|
948
735
|
</a>
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
rel="noopener noreferrer"
|
|
976
|
-
className="font-mono text-xs hover:underline flex items-center gap-1 text-blue-500"
|
|
977
|
-
>
|
|
978
|
-
{truncateAddress(quote.originDepositAddress)}
|
|
979
|
-
<svg
|
|
980
|
-
className="w-3 h-3"
|
|
981
|
-
fill="none"
|
|
982
|
-
stroke="currentColor"
|
|
983
|
-
viewBox="0 0 24 24"
|
|
984
|
-
aria-hidden="true"
|
|
985
|
-
>
|
|
986
|
-
<path
|
|
987
|
-
strokeLinecap="round"
|
|
988
|
-
strokeLinejoin="round"
|
|
989
|
-
strokeWidth={2}
|
|
990
|
-
d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
|
|
991
|
-
/>
|
|
992
|
-
</svg>
|
|
993
|
-
</a>
|
|
994
|
-
</div>
|
|
995
|
-
)}
|
|
996
|
-
|
|
997
|
-
{/* Destination Deposit Address */}
|
|
998
|
-
{quote?.destinationDepositAddress &&
|
|
999
|
-
quote?.destinationDepositAddress !==
|
|
1000
|
-
quote?.originDepositAddress && (
|
|
1001
|
-
<div className="flex justify-between items-center">
|
|
1002
|
-
<span className="text-xs text-gray-600 dark:text-gray-400 flex items-center gap-1">
|
|
1003
|
-
Destination Deposit Address
|
|
1004
|
-
<Tooltip message="This is the address that will receive the tokens after any swap and/or bridge from the origin chain">
|
|
1005
|
-
<Info className="w-3 h-3 text-gray-500 dark:text-gray-400 cursor-pointer" />
|
|
1006
|
-
</Tooltip>
|
|
1007
|
-
</span>
|
|
1008
|
-
<a
|
|
1009
|
-
href={getExplorerUrlForAddress({
|
|
1010
|
-
address: quote.destinationDepositAddress,
|
|
1011
|
-
chainId: quote.destinationChain.id,
|
|
1012
|
-
})}
|
|
1013
|
-
target="_blank"
|
|
1014
|
-
rel="noopener noreferrer"
|
|
1015
|
-
className="font-mono text-xs hover:underline flex items-center gap-1 text-blue-500"
|
|
1016
|
-
>
|
|
1017
|
-
{truncateAddress(quote.destinationDepositAddress)}
|
|
1018
|
-
<svg
|
|
1019
|
-
className="w-3 h-3"
|
|
1020
|
-
fill="none"
|
|
1021
|
-
stroke="currentColor"
|
|
1022
|
-
viewBox="0 0 24 24"
|
|
1023
|
-
aria-hidden="true"
|
|
1024
|
-
>
|
|
1025
|
-
<path
|
|
1026
|
-
strokeLinecap="round"
|
|
1027
|
-
strokeLinejoin="round"
|
|
1028
|
-
strokeWidth={2}
|
|
1029
|
-
d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
|
|
1030
|
-
/>
|
|
1031
|
-
</svg>
|
|
1032
|
-
</a>
|
|
1033
|
-
</div>
|
|
1034
|
-
)}
|
|
1035
|
-
|
|
1036
|
-
{/* Destination Target Address */}
|
|
1037
|
-
{quote?.destinationAddress && (
|
|
1038
|
-
<div className="flex justify-between items-center">
|
|
1039
|
-
<span className="text-xs text-gray-600 dark:text-gray-400 flex items-center gap-1">
|
|
1040
|
-
Destination Target Address
|
|
1041
|
-
<Tooltip message="This is the final execution address or recipient address">
|
|
1042
|
-
<Info className="w-3 h-3 text-gray-500 dark:text-gray-400 cursor-pointer" />
|
|
1043
|
-
</Tooltip>
|
|
1044
|
-
</span>
|
|
1045
|
-
<a
|
|
1046
|
-
href={getExplorerUrlForAddress({
|
|
1047
|
-
address: quote.destinationAddress,
|
|
1048
|
-
chainId: quote.destinationChain.id,
|
|
1049
|
-
})}
|
|
1050
|
-
target="_blank"
|
|
1051
|
-
rel="noopener noreferrer"
|
|
1052
|
-
className="font-mono text-xs hover:underline flex items-center gap-1 text-blue-500"
|
|
1053
|
-
>
|
|
1054
|
-
{truncateAddress(quote.destinationAddress)}
|
|
1055
|
-
<svg
|
|
1056
|
-
className="w-3 h-3"
|
|
1057
|
-
fill="none"
|
|
1058
|
-
stroke="currentColor"
|
|
1059
|
-
viewBox="0 0 24 24"
|
|
1060
|
-
aria-hidden="true"
|
|
1061
|
-
>
|
|
1062
|
-
<path
|
|
1063
|
-
strokeLinecap="round"
|
|
1064
|
-
strokeLinejoin="round"
|
|
1065
|
-
strokeWidth={2}
|
|
1066
|
-
d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
|
|
1067
|
-
/>
|
|
1068
|
-
</svg>
|
|
1069
|
-
</a>
|
|
1070
|
-
</div>
|
|
736
|
+
</RowValue>
|
|
737
|
+
</Row>
|
|
738
|
+
)}
|
|
739
|
+
|
|
740
|
+
{quote?.destinationAddress && (
|
|
741
|
+
<Row>
|
|
742
|
+
<RowLabel tooltip="This is the final execution address or recipient address">
|
|
743
|
+
Destination Target Address
|
|
744
|
+
</RowLabel>
|
|
745
|
+
<RowValue>
|
|
746
|
+
<a
|
|
747
|
+
href={getExplorerUrlForAddress({
|
|
748
|
+
address: quote.destinationAddress,
|
|
749
|
+
chainId: quote.destinationChain.id,
|
|
750
|
+
})}
|
|
751
|
+
target="_blank"
|
|
752
|
+
rel="noopener noreferrer"
|
|
753
|
+
className="font-mono text-xs hover:underline flex items-center gap-1 text-blue-500"
|
|
754
|
+
>
|
|
755
|
+
{truncateAddress(quote.destinationAddress)}
|
|
756
|
+
<ExternalLink className="size-3" />
|
|
757
|
+
</a>
|
|
758
|
+
</RowValue>
|
|
759
|
+
</Row>
|
|
760
|
+
)}
|
|
761
|
+
</RowGroup>
|
|
1071
762
|
)}
|
|
1072
763
|
|
|
1073
764
|
{/* Custom Calldata */}
|
|
@@ -1099,22 +790,11 @@ export const QuoteDetails: React.FC<QuoteDetailsProps> = ({
|
|
|
1099
790
|
<span className="text-[10px]">
|
|
1100
791
|
Includes custom destination calldata
|
|
1101
792
|
</span>
|
|
1102
|
-
<
|
|
1103
|
-
className={`
|
|
793
|
+
<ChevronDown
|
|
794
|
+
className={`size-3 transition-transform duration-300 ease-out ${
|
|
1104
795
|
showCalldata ? "rotate-180" : ""
|
|
1105
796
|
}`}
|
|
1106
|
-
|
|
1107
|
-
stroke="currentColor"
|
|
1108
|
-
viewBox="0 0 24 24"
|
|
1109
|
-
aria-hidden="true"
|
|
1110
|
-
>
|
|
1111
|
-
<path
|
|
1112
|
-
strokeLinecap="round"
|
|
1113
|
-
strokeLinejoin="round"
|
|
1114
|
-
strokeWidth={2}
|
|
1115
|
-
d="M19 9l-7 7-7-7"
|
|
1116
|
-
/>
|
|
1117
|
-
</svg>
|
|
797
|
+
/>
|
|
1118
798
|
</button>
|
|
1119
799
|
<div
|
|
1120
800
|
ref={calldataRef}
|
|
@@ -1148,3 +828,68 @@ export const QuoteDetails: React.FC<QuoteDetailsProps> = ({
|
|
|
1148
828
|
}
|
|
1149
829
|
|
|
1150
830
|
export default QuoteDetails
|
|
831
|
+
|
|
832
|
+
interface RowGroupProps {
|
|
833
|
+
children: React.ReactNode
|
|
834
|
+
className?: string
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
const RowGroup: React.FC<RowGroupProps> = ({ children, className = "" }) => (
|
|
838
|
+
<div className={`space-y-2 ${className}`}>{children}</div>
|
|
839
|
+
)
|
|
840
|
+
|
|
841
|
+
const rowVariants = {
|
|
842
|
+
default: "text-xs text-gray-600 dark:text-gray-400",
|
|
843
|
+
light: "text-xs text-gray-400 dark:text-gray-600",
|
|
844
|
+
bold: "text-sm font-semibold text-gray-900 dark:text-white",
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
interface RowProps {
|
|
848
|
+
children: React.ReactNode
|
|
849
|
+
className?: string
|
|
850
|
+
variant?: keyof typeof rowVariants
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
const Row: React.FC<RowProps> = ({
|
|
854
|
+
children,
|
|
855
|
+
className = "",
|
|
856
|
+
variant = "default",
|
|
857
|
+
}) => (
|
|
858
|
+
<div
|
|
859
|
+
className={`flex justify-between items-center ${rowVariants[variant]} ${className}`}
|
|
860
|
+
>
|
|
861
|
+
{children}
|
|
862
|
+
</div>
|
|
863
|
+
)
|
|
864
|
+
|
|
865
|
+
interface RowLabelProps {
|
|
866
|
+
children: React.ReactNode
|
|
867
|
+
tooltip?: string
|
|
868
|
+
className?: string
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
const RowLabel: React.FC<RowLabelProps> = ({
|
|
872
|
+
children,
|
|
873
|
+
tooltip,
|
|
874
|
+
className = "",
|
|
875
|
+
}) => {
|
|
876
|
+
return (
|
|
877
|
+
<div className={`flex items-center gap-1 ${className}`}>
|
|
878
|
+
{children}
|
|
879
|
+
{tooltip && (
|
|
880
|
+
<Tooltip message={tooltip}>
|
|
881
|
+
<Info className="size-3 text-gray-500 dark:text-gray-400 cursor-pointer" />
|
|
882
|
+
</Tooltip>
|
|
883
|
+
)}
|
|
884
|
+
</div>
|
|
885
|
+
)
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
interface RowValueProps {
|
|
889
|
+
children: React.ReactNode
|
|
890
|
+
className?: string
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
const RowValue: React.FC<RowValueProps> = ({ children, className }) => {
|
|
894
|
+
return <div className={className}>{children}</div>
|
|
895
|
+
}
|