0xtrails 0.2.5 → 0.3.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 +2 -0
- package/dist/aave.d.ts.map +1 -1
- package/dist/abortController.d.ts +8 -0
- package/dist/abortController.d.ts.map +1 -0
- package/dist/{ccip-CXlshvBY.js → ccip-BMB3uDZt.js} +1 -1
- package/dist/config.d.ts +0 -5
- package/dist/config.d.ts.map +1 -1
- package/dist/constants.d.ts +4 -4
- package/dist/constants.d.ts.map +1 -1
- package/dist/error.d.ts +4 -1
- package/dist/error.d.ts.map +1 -1
- package/dist/fees.d.ts +19 -0
- package/dist/fees.d.ts.map +1 -0
- package/dist/{index-_QuyGrjU.js → index-QXPUrZVv.js} +48719 -50852
- package/dist/index.d.ts +9 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +811 -784
- package/dist/intentReceiptMonitor.d.ts +24 -0
- package/dist/intentReceiptMonitor.d.ts.map +1 -0
- package/dist/intentReceiptPoller.d.ts +69 -0
- package/dist/intentReceiptPoller.d.ts.map +1 -0
- package/dist/intents.d.ts +15 -11
- package/dist/intents.d.ts.map +1 -1
- package/dist/morpho.d.ts +6 -5
- package/dist/morpho.d.ts.map +1 -1
- package/dist/mutations.d.ts +16 -0
- package/dist/mutations.d.ts.map +1 -0
- package/dist/preconditions.d.ts +5 -4
- package/dist/preconditions.d.ts.map +1 -1
- package/dist/prepareSend.d.ts +7 -258
- package/dist/prepareSend.d.ts.map +1 -1
- package/dist/prices.d.ts +9 -6
- package/dist/prices.d.ts.map +1 -1
- package/dist/sequenceWallet.d.ts +3 -16
- package/dist/sequenceWallet.d.ts.map +1 -1
- package/dist/tokenBalances.d.ts +17 -13
- package/dist/tokenBalances.d.ts.map +1 -1
- package/dist/trails.d.ts +24 -40
- package/dist/trails.d.ts.map +1 -1
- package/dist/transactionIntent/constants.d.ts +7 -0
- package/dist/transactionIntent/constants.d.ts.map +1 -0
- package/dist/transactionIntent/deposits/depositOrchestrator.d.ts +44 -0
- package/dist/transactionIntent/deposits/depositOrchestrator.d.ts.map +1 -0
- package/dist/transactionIntent/deposits/gaslessDeposit.d.ts +30 -0
- package/dist/transactionIntent/deposits/gaslessDeposit.d.ts.map +1 -0
- package/dist/transactionIntent/deposits/index.d.ts +4 -0
- package/dist/transactionIntent/deposits/index.d.ts.map +1 -0
- package/dist/transactionIntent/deposits/standardDeposit.d.ts +30 -0
- package/dist/transactionIntent/deposits/standardDeposit.d.ts.map +1 -0
- package/dist/transactionIntent/execution/index.d.ts +2 -0
- package/dist/transactionIntent/execution/index.d.ts.map +1 -0
- package/dist/transactionIntent/execution/transactionState.d.ts +5 -0
- package/dist/transactionIntent/execution/transactionState.d.ts.map +1 -0
- package/dist/transactionIntent/handlers/crossChain.d.ts +82 -0
- package/dist/transactionIntent/handlers/crossChain.d.ts.map +1 -0
- package/dist/transactionIntent/handlers/index.d.ts +4 -0
- package/dist/transactionIntent/handlers/index.d.ts.map +1 -0
- package/dist/transactionIntent/handlers/sameChainDifferentToken.d.ts +62 -0
- package/dist/transactionIntent/handlers/sameChainDifferentToken.d.ts.map +1 -0
- package/dist/transactionIntent/handlers/sameChainSameToken.d.ts +72 -0
- package/dist/transactionIntent/handlers/sameChainSameToken.d.ts.map +1 -0
- package/dist/transactionIntent/index.d.ts +9 -0
- package/dist/transactionIntent/index.d.ts.map +1 -0
- package/dist/transactionIntent/quote/feeExtractors.d.ts +17 -0
- package/dist/transactionIntent/quote/feeExtractors.d.ts.map +1 -0
- package/dist/transactionIntent/quote/index.d.ts +4 -0
- package/dist/transactionIntent/quote/index.d.ts.map +1 -0
- package/dist/transactionIntent/quote/normalizeQuote.d.ts +34 -0
- package/dist/transactionIntent/quote/normalizeQuote.d.ts.map +1 -0
- package/dist/transactionIntent/quote/quoteHelpers.d.ts +5 -0
- package/dist/transactionIntent/quote/quoteHelpers.d.ts.map +1 -0
- package/dist/transactionIntent/types.d.ts +131 -0
- package/dist/transactionIntent/types.d.ts.map +1 -0
- package/dist/transactionIntent/utils/balanceChecker.d.ts +18 -0
- package/dist/transactionIntent/utils/balanceChecker.d.ts.map +1 -0
- package/dist/transactionIntent/utils/index.d.ts +4 -0
- package/dist/transactionIntent/utils/index.d.ts.map +1 -0
- package/dist/transactionIntent/utils/lifiHelpers.d.ts +10 -0
- package/dist/transactionIntent/utils/lifiHelpers.d.ts.map +1 -0
- package/dist/transactionIntent/utils/testnetHelpers.d.ts +3 -0
- package/dist/transactionIntent/utils/testnetHelpers.d.ts.map +1 -0
- package/dist/transactionIntent/validators.d.ts +6 -0
- package/dist/transactionIntent/validators.d.ts.map +1 -0
- package/dist/transactions.d.ts +6 -3
- package/dist/transactions.d.ts.map +1 -1
- package/dist/widget/components/AccountIntentTransactionHistoryButton.d.ts +4 -0
- package/dist/widget/components/AccountIntentTransactionHistoryButton.d.ts.map +1 -0
- package/dist/widget/components/AccountSettings.d.ts.map +1 -1
- package/dist/widget/components/ChainFilterDropdown.d.ts.map +1 -1
- package/dist/widget/components/ClassicSwap.d.ts +2 -3
- package/dist/widget/components/ClassicSwap.d.ts.map +1 -1
- package/dist/widget/components/ConfigDisplay.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/DynamicInputStyles.d.ts +18 -0
- package/dist/widget/components/DynamicInputStyles.d.ts.map +1 -0
- package/dist/widget/components/DynamicSizeInputField.d.ts +13 -0
- package/dist/widget/components/DynamicSizeInputField.d.ts.map +1 -0
- package/dist/widget/components/Earn.d.ts +2 -3
- package/dist/widget/components/Earn.d.ts.map +1 -1
- package/dist/widget/components/ErrorAnimationIcon.d.ts +2 -0
- package/dist/widget/components/ErrorAnimationIcon.d.ts.map +1 -0
- package/dist/widget/components/FeeBreakdown.d.ts +9 -0
- package/dist/widget/components/FeeBreakdown.d.ts.map +1 -0
- package/dist/widget/components/FeeOptions.d.ts +5 -13
- package/dist/widget/components/FeeOptions.d.ts.map +1 -1
- package/dist/widget/components/Fund.d.ts +2 -3
- package/dist/widget/components/Fund.d.ts.map +1 -1
- package/dist/widget/components/FundMethods.d.ts.map +1 -1
- package/dist/widget/components/FundSwap.d.ts +2 -3
- package/dist/widget/components/FundSwap.d.ts.map +1 -1
- package/dist/widget/components/FundingMethodSelectorButton.d.ts.map +1 -1
- package/dist/widget/components/Identicon.d.ts.map +1 -1
- package/dist/widget/components/MeshConnectExchanges.d.ts +0 -3
- package/dist/widget/components/MeshConnectExchanges.d.ts.map +1 -1
- package/dist/widget/components/Modal.d.ts.map +1 -1
- package/dist/widget/components/Pay.d.ts +2 -3
- package/dist/widget/components/Pay.d.ts.map +1 -1
- package/dist/widget/components/PoolDeposit.d.ts +3 -3
- package/dist/widget/components/PoolDeposit.d.ts.map +1 -1
- package/dist/widget/components/PoolWithdraw.d.ts +3 -20
- package/dist/widget/components/PoolWithdraw.d.ts.map +1 -1
- package/dist/widget/components/QuoteDetails.d.ts +2 -0
- package/dist/widget/components/QuoteDetails.d.ts.map +1 -1
- package/dist/widget/components/Receipt.d.ts.map +1 -1
- package/dist/widget/components/RecipientSelectorButton.d.ts.map +1 -1
- package/dist/widget/components/ScreenHeader.d.ts.map +1 -1
- package/dist/widget/components/Swap.d.ts +2 -3
- package/dist/widget/components/Swap.d.ts.map +1 -1
- package/dist/widget/components/ThemeProvider.d.ts.map +1 -1
- package/dist/widget/components/TokenDisplayNonSelectable.d.ts +11 -0
- package/dist/widget/components/TokenDisplayNonSelectable.d.ts.map +1 -0
- package/dist/widget/components/TokenSelector.d.ts.map +1 -1
- package/dist/widget/components/TokenSelectorButton.d.ts.map +1 -1
- package/dist/widget/components/Tooltip.d.ts +9 -0
- package/dist/widget/components/Tooltip.d.ts.map +1 -0
- package/dist/widget/components/TransferPendingVertical.d.ts.map +1 -1
- package/dist/widget/components/WaasFeeOptions.d.ts +1 -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/css/compiled.css +2 -2
- package/dist/widget/hooks/useCheckout.d.ts +17 -4
- package/dist/widget/hooks/useCheckout.d.ts.map +1 -1
- package/dist/widget/hooks/useDefaultTokenSelection.d.ts.map +1 -1
- package/dist/widget/hooks/useQuote.d.ts +82 -0
- package/dist/widget/hooks/useQuote.d.ts.map +1 -0
- package/dist/widget/hooks/useSelectedFeeToken.d.ts +1 -0
- package/dist/widget/hooks/useSelectedFeeToken.d.ts.map +1 -1
- package/dist/widget/hooks/useSendForm.d.ts +5 -6
- package/dist/widget/hooks/useSendForm.d.ts.map +1 -1
- package/dist/widget/hooks/useTokenList.d.ts.map +1 -1
- package/dist/widget/hooks/useWalletConnectionContext.d.ts +25 -0
- package/dist/widget/hooks/useWalletConnectionContext.d.ts.map +1 -0
- package/dist/widget/index.js +2 -2
- package/dist/widget/widget.d.ts +17 -7
- package/dist/widget/widget.d.ts.map +1 -1
- package/package.json +19 -21
- package/src/aave.ts +54 -1
- package/src/abortController.ts +35 -0
- package/src/config.ts +57 -58
- package/src/constants.ts +11 -9
- package/src/error.ts +21 -3
- package/src/fees.ts +210 -0
- package/src/index.ts +35 -13
- package/src/intentReceiptMonitor.ts +102 -0
- package/src/intentReceiptPoller.ts +299 -0
- package/src/intents.ts +205 -171
- package/src/morpho.ts +58 -9
- package/src/mutations.ts +129 -0
- package/src/preconditions.ts +16 -21
- package/src/prepareSend.ts +92 -4699
- package/src/prices.ts +26 -22
- package/src/relaySdk.ts +2 -2
- package/src/sequenceWallet.ts +6 -73
- package/src/tokenBalances.ts +175 -69
- package/src/trails.ts +230 -722
- package/src/transactionIntent/constants.ts +11 -0
- package/src/transactionIntent/deposits/depositOrchestrator.ts +210 -0
- package/src/transactionIntent/deposits/gaslessDeposit.ts +588 -0
- package/src/transactionIntent/deposits/index.ts +3 -0
- package/src/transactionIntent/deposits/standardDeposit.ts +379 -0
- package/src/transactionIntent/execution/index.ts +1 -0
- package/src/transactionIntent/execution/transactionState.ts +35 -0
- package/src/transactionIntent/handlers/crossChain.ts +1707 -0
- package/src/transactionIntent/handlers/index.ts +3 -0
- package/src/transactionIntent/handlers/sameChainDifferentToken.ts +323 -0
- package/src/transactionIntent/handlers/sameChainSameToken.ts +712 -0
- package/src/transactionIntent/index.ts +9 -0
- package/src/transactionIntent/quote/feeExtractors.ts +81 -0
- package/src/transactionIntent/quote/index.ts +3 -0
- package/src/transactionIntent/quote/normalizeQuote.ts +367 -0
- package/src/transactionIntent/quote/quoteHelpers.ts +53 -0
- package/src/transactionIntent/types.ts +157 -0
- package/src/transactionIntent/utils/balanceChecker.ts +96 -0
- package/src/transactionIntent/utils/index.ts +3 -0
- package/src/transactionIntent/utils/lifiHelpers.ts +68 -0
- package/src/transactionIntent/utils/testnetHelpers.ts +10 -0
- package/src/transactionIntent/validators.ts +57 -0
- package/src/transactions.ts +98 -71
- package/src/widget/compiled.css +2 -2
- package/src/widget/components/AccountIntentTransactionHistory.tsx +36 -36
- package/src/widget/components/AccountIntentTransactionHistoryButton.tsx +22 -0
- package/src/widget/components/AccountSettings.tsx +70 -41
- package/src/widget/components/ChainFilterDropdown.tsx +24 -3
- package/src/widget/components/ClassicSwap.tsx +44 -107
- package/src/widget/components/ConfigDisplay.tsx +0 -11
- package/src/widget/components/ConnectWallet.tsx +4 -1
- package/src/widget/components/ConnectedWallets.tsx +51 -25
- package/src/widget/components/DynamicInputStyles.tsx +76 -0
- package/src/widget/components/DynamicSizeInputField.tsx +109 -0
- package/src/widget/components/Earn.tsx +34 -45
- package/src/widget/components/ErrorAnimationIcon.tsx +130 -0
- package/src/widget/components/FeeBreakdown.tsx +155 -0
- package/src/widget/components/FeeOption.tsx +2 -2
- package/src/widget/components/FeeOptions.tsx +151 -112
- package/src/widget/components/Fund.tsx +10 -29
- package/src/widget/components/FundMethods.tsx +4 -3
- package/src/widget/components/FundSwap.tsx +2 -3
- package/src/widget/components/FundingMethodSelectorButton.tsx +24 -14
- package/src/widget/components/Identicon.tsx +164 -95
- package/src/widget/components/MeshConnectExchanges.tsx +2 -15
- package/src/widget/components/Modal.tsx +0 -12
- package/src/widget/components/Pay.tsx +72 -75
- package/src/widget/components/PoolDeposit.tsx +221 -242
- package/src/widget/components/PoolWithdraw.tsx +347 -469
- package/src/widget/components/PriceImpactWarning.tsx +1 -1
- package/src/widget/components/QuoteDetails.tsx +906 -484
- package/src/widget/components/Receipt.tsx +16 -2
- package/src/widget/components/RecipientSelectorButton.tsx +7 -5
- package/src/widget/components/Recipients.tsx +1 -1
- package/src/widget/components/ScreenHeader.tsx +60 -36
- package/src/widget/components/Swap.tsx +2 -3
- package/src/widget/components/ThemeProvider.tsx +2 -1
- package/src/widget/components/TokenDisplayNonSelectable.tsx +40 -0
- package/src/widget/components/TokenImage.tsx +1 -1
- package/src/widget/components/TokenSelector.tsx +62 -53
- package/src/widget/components/TokenSelectorButton.tsx +38 -15
- package/src/widget/components/Tooltip.tsx +51 -0
- package/src/widget/components/TransferPendingVertical.tsx +12 -8
- package/src/widget/components/WaasFeeOptions.tsx +139 -4
- package/src/widget/components/WalletConfirmation.tsx +23 -13
- package/src/widget/components/WalletConnect.tsx +93 -29
- package/src/widget/hooks/useAmountUsd.ts +9 -9
- package/src/widget/hooks/useCheckout.ts +97 -9
- package/src/widget/hooks/useDefaultTokenSelection.tsx +27 -21
- package/src/widget/hooks/useQuote.ts +466 -0
- package/src/widget/hooks/useSelectedFeeToken.tsx +32 -37
- package/src/widget/hooks/useSendForm.ts +45 -51
- package/src/widget/hooks/useTokenList.ts +34 -26
- package/src/widget/hooks/useWalletConnectionContext.tsx +128 -0
- package/src/widget/widget.tsx +365 -390
- package/dist/apiClient.d.ts +0 -9
- package/dist/apiClient.d.ts.map +0 -1
- package/dist/intentEntrypoint.d.ts +0 -114
- package/dist/intentEntrypoint.d.ts.map +0 -1
- package/dist/metaTxnMonitor.d.ts +0 -15
- package/dist/metaTxnMonitor.d.ts.map +0 -1
- package/dist/metaTxns.d.ts +0 -11
- package/dist/metaTxns.d.ts.map +0 -1
- package/dist/relayer.d.ts +0 -43
- package/dist/relayer.d.ts.map +0 -1
- package/src/apiClient.ts +0 -35
- package/src/intentEntrypoint.ts +0 -203
- package/src/metaTxnMonitor.ts +0 -171
- package/src/metaTxns.ts +0 -45
- package/src/relayer.ts +0 -289
|
@@ -13,7 +13,6 @@ import type { TransactionState } from "../../transactions.js"
|
|
|
13
13
|
import type { OnCompleteProps } from "../hooks/useSendForm.js"
|
|
14
14
|
import type { CheckoutOnHandlers } from "../hooks/useCheckout.js"
|
|
15
15
|
import { useSendForm } from "../hooks/useSendForm.js"
|
|
16
|
-
import { TradeType } from "../../prepareSend.js"
|
|
17
16
|
import { useOriginSelectedToken } from "../hooks/useOriginSelectedToken.js"
|
|
18
17
|
import { useEarnPool } from "../hooks/useEarnPool.js"
|
|
19
18
|
import { useTokenList } from "../hooks/useTokenList.js"
|
|
@@ -32,13 +31,15 @@ import { useAmountUsd } from "../hooks/useAmountUsd.js"
|
|
|
32
31
|
import { getExplorerUrlForAddress } from "../../explorer.js"
|
|
33
32
|
import aaveLogo from "../assets/aave.svg"
|
|
34
33
|
import morphoLogo from "../assets/morpho.svg"
|
|
35
|
-
import type
|
|
34
|
+
import { TradeType, type PrepareSendQuote } from "../../prepareSend.js"
|
|
36
35
|
import type { SupportedToken } from "../../tokens.js"
|
|
37
36
|
import { logger } from "../../logger.js"
|
|
37
|
+
import { DynamicSizeInputField } from "./DynamicSizeInputField.js"
|
|
38
|
+
import { FeeOptions } from "./FeeOptions.js"
|
|
38
39
|
|
|
39
40
|
interface PoolDepositProps {
|
|
40
|
-
account
|
|
41
|
-
walletClient
|
|
41
|
+
account?: Account
|
|
42
|
+
walletClient?: WalletClient
|
|
42
43
|
onTransactionStateChange: (transactionStates: TransactionState[]) => void
|
|
43
44
|
onError: (error: Error | string | null) => void
|
|
44
45
|
onWaitingForWalletConfirm: (props: PrepareSendQuote) => void
|
|
@@ -46,7 +47,6 @@ interface PoolDepositProps {
|
|
|
46
47
|
onComplete: (result: OnCompleteProps) => void
|
|
47
48
|
onSend: (amount: string, recipient: string) => void
|
|
48
49
|
paymasterUrls?: Array<{ chainId: number; url: string }>
|
|
49
|
-
gasless?: boolean
|
|
50
50
|
setWalletConfirmRetryHandler: (handler: () => Promise<void>) => void
|
|
51
51
|
quoteProvider?: string
|
|
52
52
|
fundMethod?: string
|
|
@@ -63,6 +63,7 @@ interface PoolDepositProps {
|
|
|
63
63
|
recentTokens?: SupportedToken[]
|
|
64
64
|
onRecentTokenSelect?: (token: SupportedToken) => void
|
|
65
65
|
onTrackToken?: (token: any) => void
|
|
66
|
+
onPoolSelectorStateChange?: (isShowing: boolean) => void
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
export const PoolDeposit: React.FC<PoolDepositProps> = ({
|
|
@@ -75,7 +76,6 @@ export const PoolDeposit: React.FC<PoolDepositProps> = ({
|
|
|
75
76
|
onComplete,
|
|
76
77
|
onSend,
|
|
77
78
|
paymasterUrls,
|
|
78
|
-
gasless,
|
|
79
79
|
setWalletConfirmRetryHandler,
|
|
80
80
|
quoteProvider,
|
|
81
81
|
fundMethod,
|
|
@@ -84,6 +84,7 @@ export const PoolDeposit: React.FC<PoolDepositProps> = ({
|
|
|
84
84
|
recentTokens,
|
|
85
85
|
onRecentTokenSelect,
|
|
86
86
|
onTrackToken,
|
|
87
|
+
onPoolSelectorStateChange,
|
|
87
88
|
}) => {
|
|
88
89
|
const { mode } = useMode()
|
|
89
90
|
const { isBalanceVisible } = useBalanceVisible()
|
|
@@ -115,6 +116,9 @@ export const PoolDeposit: React.FC<PoolDepositProps> = ({
|
|
|
115
116
|
isSubmitting,
|
|
116
117
|
buttonText,
|
|
117
118
|
isValidRecipient,
|
|
119
|
+
feeOptions,
|
|
120
|
+
selectedFeeToken,
|
|
121
|
+
setSelectedFeeToken,
|
|
118
122
|
} = useSendForm({
|
|
119
123
|
account,
|
|
120
124
|
toAmount: undefined,
|
|
@@ -127,10 +131,9 @@ export const PoolDeposit: React.FC<PoolDepositProps> = ({
|
|
|
127
131
|
onError,
|
|
128
132
|
onWaitingForWalletConfirm,
|
|
129
133
|
paymasterUrls,
|
|
130
|
-
|
|
134
|
+
onSend,
|
|
131
135
|
onConfirm,
|
|
132
136
|
onComplete,
|
|
133
|
-
onSend,
|
|
134
137
|
selectedToken: originToken as any,
|
|
135
138
|
setWalletConfirmRetryHandler,
|
|
136
139
|
tradeType: TradeType.EXACT_INPUT,
|
|
@@ -180,12 +183,22 @@ export const PoolDeposit: React.FC<PoolDepositProps> = ({
|
|
|
180
183
|
}
|
|
181
184
|
}, [])
|
|
182
185
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
186
|
+
// Notify parent component about pool selector and token selector visibility
|
|
187
|
+
useEffect(() => {
|
|
188
|
+
if (onPoolSelectorStateChange) {
|
|
189
|
+
// Hide tabs when showing EarnPools selector, token selector, or chain list
|
|
190
|
+
onPoolSelectorStateChange(
|
|
191
|
+
showEarnPools || showOriginTokenSelector || showOriginChainList,
|
|
192
|
+
)
|
|
188
193
|
}
|
|
194
|
+
}, [
|
|
195
|
+
showEarnPools,
|
|
196
|
+
showOriginTokenSelector,
|
|
197
|
+
showOriginChainList,
|
|
198
|
+
onPoolSelectorStateChange,
|
|
199
|
+
])
|
|
200
|
+
|
|
201
|
+
const handleAmountChange = (value: string) => {
|
|
189
202
|
setAmount(value)
|
|
190
203
|
setSendFormAmount(value) // Sync with useSendForm for quote functionality
|
|
191
204
|
}
|
|
@@ -264,268 +277,221 @@ export const PoolDeposit: React.FC<PoolDepositProps> = ({
|
|
|
264
277
|
|
|
265
278
|
return (
|
|
266
279
|
<div className="space-y-2">
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
<div className="
|
|
272
|
-
|
|
273
|
-
From
|
|
274
|
-
</div>
|
|
275
|
-
<FundingMethodSelectorButton />
|
|
280
|
+
{/* Input Section - Amount + Token Selection */}
|
|
281
|
+
<div className="pt-4 pb-4 trails-bg-secondary trails-bg-secondary-hover trails-border-radius-container p-3 group transition-all duration-200 border border-transparent focus-within:!bg-white dark:focus-within:!bg-gray-800 trails-focus-border-secondary min-h-[120px] flex flex-col">
|
|
282
|
+
{/* Deposit Label */}
|
|
283
|
+
<div className="mb-4 flex justify-between items-center">
|
|
284
|
+
<div className="text-sm font-medium trails-text-secondary text-left m-0">
|
|
285
|
+
{mode === "fund" ? "Payment method" : "From"}
|
|
276
286
|
</div>
|
|
287
|
+
<FundingMethodSelectorButton />
|
|
288
|
+
</div>
|
|
277
289
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
placeholder="0"
|
|
293
|
-
className={`bg-transparent border-none outline-none font-bold text-left trails-text-primary placeholder-trails-text-primary ${
|
|
294
|
-
isLoadingQuote ? "animate-pulse" : ""
|
|
295
|
-
}`}
|
|
296
|
-
style={{
|
|
297
|
-
fontSize:
|
|
298
|
-
amount.length > 12
|
|
299
|
-
? "0.875rem"
|
|
300
|
-
: amount.length > 9
|
|
301
|
-
? "1rem"
|
|
302
|
-
: amount.length > 6
|
|
303
|
-
? "1.125rem"
|
|
304
|
-
: amount.length > 3
|
|
305
|
-
? "1.25rem"
|
|
306
|
-
: "1.5rem",
|
|
307
|
-
width: `${Math.max((amount || "0").length, 1)}ch`,
|
|
308
|
-
minWidth: "1ch",
|
|
309
|
-
maxWidth: "270px",
|
|
310
|
-
padding: "0",
|
|
311
|
-
margin: "0",
|
|
312
|
-
transition: "all 0.1s ease-in-out",
|
|
313
|
-
}}
|
|
314
|
-
inputMode="decimal"
|
|
315
|
-
/>
|
|
316
|
-
<span
|
|
317
|
-
className="font-bold text-gray-400 dark:text-gray-500"
|
|
318
|
-
style={{
|
|
319
|
-
fontSize:
|
|
320
|
-
amount.length > 12
|
|
321
|
-
? "0.875rem"
|
|
322
|
-
: amount.length > 9
|
|
323
|
-
? "1rem"
|
|
324
|
-
: amount.length > 6
|
|
325
|
-
? "1.125rem"
|
|
326
|
-
: amount.length > 3
|
|
327
|
-
? "1.25rem"
|
|
328
|
-
: "1.5rem",
|
|
329
|
-
marginLeft: "0.1em",
|
|
330
|
-
padding: "0",
|
|
331
|
-
transition: "all 0.2s ease-in-out",
|
|
332
|
-
}}
|
|
333
|
-
>
|
|
334
|
-
{originToken?.symbol.slice(0, 4) || ""}
|
|
335
|
-
</span>
|
|
336
|
-
{isLoadingQuote && (
|
|
337
|
-
<div className="ml-2 animate-spin rounded-full h-4 w-4 border-solid border-b-2 trails-primary" />
|
|
338
|
-
)}
|
|
339
|
-
</div>
|
|
340
|
-
</button>
|
|
290
|
+
<div className="flex items-center space-x-2 flex-1">
|
|
291
|
+
{/* Amount Input */}
|
|
292
|
+
<div className="flex-1">
|
|
293
|
+
<div className="flex items-center space-x-2">
|
|
294
|
+
<DynamicSizeInputField
|
|
295
|
+
ref={inputRef}
|
|
296
|
+
value={amount}
|
|
297
|
+
onChange={(e) => handleAmountChange(e.target.value)}
|
|
298
|
+
isLoading={isLoadingQuote}
|
|
299
|
+
variant="default"
|
|
300
|
+
/>
|
|
301
|
+
{isLoadingQuote && (
|
|
302
|
+
<div className="animate-spin rounded-full h-4 w-4 border-solid border-b-2 trails-primary" />
|
|
303
|
+
)}
|
|
341
304
|
</div>
|
|
305
|
+
</div>
|
|
342
306
|
|
|
343
|
-
|
|
307
|
+
{/* Token Selection Button */}
|
|
308
|
+
<div className="relative">
|
|
344
309
|
<TokenSelectorButton
|
|
345
310
|
token={originToken}
|
|
346
311
|
chainId={originToken?.chainId}
|
|
347
312
|
onSelect={() => setShowOriginTokenSelector(true)}
|
|
348
313
|
/>
|
|
349
314
|
</div>
|
|
315
|
+
</div>
|
|
350
316
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
) : (
|
|
358
|
-
<span> </span>
|
|
359
|
-
)}
|
|
317
|
+
{/* Bottom Info Row */}
|
|
318
|
+
<div className="mt-4 flex justify-between items-center">
|
|
319
|
+
{/* USD Amount */}
|
|
320
|
+
{originToken?.symbol && (
|
|
321
|
+
<div className="text-xs text-gray-500 dark:text-gray-400">
|
|
322
|
+
≈ {underlyingTokenUsdDisplay || "$0.00"}
|
|
360
323
|
</div>
|
|
324
|
+
)}
|
|
361
325
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
326
|
+
{/* Origin Token Balance and Percentage Buttons */}
|
|
327
|
+
{originToken && balanceFormatted && (
|
|
328
|
+
<div className="flex items-center space-x-2">
|
|
329
|
+
<button
|
|
330
|
+
type="button"
|
|
331
|
+
className="text-xs text-gray-500 dark:text-gray-400 cursor-pointer hover:text-gray-700 dark:hover:text-gray-200 transition-colors bg-transparent border-none p-0"
|
|
332
|
+
onClick={() => handleAmountSelect(balanceFormatted || "0")}
|
|
333
|
+
onKeyDown={(e) => {
|
|
334
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
335
|
+
e.preventDefault()
|
|
336
|
+
handleAmountSelect(balanceFormatted || "0")
|
|
337
|
+
}
|
|
338
|
+
}}
|
|
339
|
+
title="Click to use full balance"
|
|
340
|
+
>
|
|
341
|
+
Balance:{" "}
|
|
342
|
+
{isBalanceVisible ? balanceFormatted || "0.00" : "••••••"}
|
|
343
|
+
</button>
|
|
380
344
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
</div>
|
|
345
|
+
{/* Percentage Buttons */}
|
|
346
|
+
<PercentageMaxButtons
|
|
347
|
+
userBalance={balanceFormatted}
|
|
348
|
+
isNativeToken={originToken.contractAddress === zeroAddress}
|
|
349
|
+
gasCostFormatted={prepareSendQuote?.gasCostFormatted}
|
|
350
|
+
chainId={originToken.chainId}
|
|
351
|
+
onAmountSelect={handleAmountSelect}
|
|
352
|
+
className="opacity-100"
|
|
353
|
+
/>
|
|
354
|
+
</div>
|
|
355
|
+
)}
|
|
393
356
|
</div>
|
|
357
|
+
</div>
|
|
394
358
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
359
|
+
{/* Flip Button - Absolutely Positioned */}
|
|
360
|
+
<div className="relative">
|
|
361
|
+
<button
|
|
362
|
+
type="button"
|
|
363
|
+
className="absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2 p-1.5 trails-border-radius-button trails-bg-tertiary hover:trails-hover-bg transition-colors cursor-pointer border-2 border-white dark:border-gray-800"
|
|
364
|
+
>
|
|
365
|
+
<ArrowDown
|
|
366
|
+
className="w-5 h-5 text-gray-900 dark:text-white"
|
|
367
|
+
strokeWidth={2.5}
|
|
368
|
+
/>
|
|
369
|
+
</button>
|
|
370
|
+
</div>
|
|
404
371
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
</div>
|
|
372
|
+
{/* Destination Vault Selection */}
|
|
373
|
+
<div className="mb-4 trails-bg-secondary trails-border-radius-container transition-all duration-200 border border-transparent hover:!bg-white dark:hover:!bg-white hover:border-gray-400 dark:hover:border-gray-500">
|
|
374
|
+
{selectedPool ? (
|
|
375
|
+
<div className="p-3 trails-border-radius-container trails-bg-secondary transition-all overflow-hidden">
|
|
376
|
+
{/* Vault Label */}
|
|
377
|
+
<div className="flex justify-between items-center mb-2">
|
|
378
|
+
<div className="text-sm font-semibold trails-text-secondary text-left">
|
|
379
|
+
Vault
|
|
414
380
|
</div>
|
|
381
|
+
</div>
|
|
415
382
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
383
|
+
<div className="px-1">
|
|
384
|
+
<div className="flex items-center justify-between">
|
|
385
|
+
<div className="flex items-center space-x-3">
|
|
386
|
+
<div style={{ width: "32px", height: "32px" }}>
|
|
387
|
+
<a
|
|
388
|
+
href={getExplorerUrlForAddress({
|
|
389
|
+
address: selectedPool.token.address,
|
|
390
|
+
chainId: selectedPool.chainId,
|
|
391
|
+
})}
|
|
392
|
+
target="_blank"
|
|
393
|
+
rel="noopener noreferrer"
|
|
394
|
+
className="cursor-pointer"
|
|
395
|
+
>
|
|
396
|
+
<TokenImage
|
|
397
|
+
symbol={selectedPool.token.symbol}
|
|
398
|
+
imageUrl={selectedPool.token.logoUrl}
|
|
399
|
+
chainId={selectedPool.chainId}
|
|
400
|
+
contractAddress={selectedPool.token.address}
|
|
401
|
+
size={32}
|
|
402
|
+
/>
|
|
403
|
+
</a>
|
|
404
|
+
</div>
|
|
405
|
+
<div>
|
|
406
|
+
<h3 className="font-medium text-gray-900 dark:text-white text-sm">
|
|
407
|
+
{selectedPool.poolUrl ? (
|
|
408
|
+
<a
|
|
409
|
+
href={selectedPool.poolUrl}
|
|
410
|
+
target="_blank"
|
|
411
|
+
rel="noopener noreferrer"
|
|
412
|
+
className="hover:underline cursor-pointer"
|
|
413
|
+
>
|
|
414
|
+
{selectedPool.name}
|
|
415
|
+
</a>
|
|
416
|
+
) : (
|
|
417
|
+
selectedPool.name
|
|
418
|
+
)}
|
|
419
|
+
</h3>
|
|
420
|
+
<div className="flex items-center space-x-2">
|
|
421
|
+
<span className="text-xs text-gray-500 dark:text-gray-400 flex items-center">
|
|
422
|
+
{selectedPool.protocol === "Aave" && (
|
|
423
|
+
<img
|
|
424
|
+
src={aaveLogo}
|
|
425
|
+
alt="Aave"
|
|
426
|
+
className="w-3 h-3 mr-1"
|
|
427
|
+
/>
|
|
428
|
+
)}
|
|
429
|
+
{selectedPool.protocol === "Morpho" && (
|
|
430
|
+
<img
|
|
431
|
+
src={morphoLogo}
|
|
432
|
+
alt="Morpho"
|
|
433
|
+
className="w-3 h-3 mr-1"
|
|
434
|
+
/>
|
|
435
|
+
)}
|
|
436
|
+
{selectedPool.protocolUrl ? (
|
|
441
437
|
<a
|
|
442
|
-
href={selectedPool.
|
|
438
|
+
href={selectedPool.protocolUrl}
|
|
443
439
|
target="_blank"
|
|
444
440
|
rel="noopener noreferrer"
|
|
445
441
|
className="hover:underline cursor-pointer"
|
|
446
442
|
>
|
|
447
|
-
{selectedPool.
|
|
443
|
+
{selectedPool.protocol}
|
|
448
444
|
</a>
|
|
449
445
|
) : (
|
|
450
|
-
selectedPool.
|
|
446
|
+
selectedPool.protocol
|
|
451
447
|
)}
|
|
452
|
-
</
|
|
453
|
-
<div className="flex items-center space-x-2">
|
|
454
|
-
<span className="text-xs text-gray-500 dark:text-gray-400 flex items-center">
|
|
455
|
-
{selectedPool.protocol === "Aave" && (
|
|
456
|
-
<img
|
|
457
|
-
src={aaveLogo}
|
|
458
|
-
alt="Aave"
|
|
459
|
-
className="w-3 h-3 mr-1"
|
|
460
|
-
/>
|
|
461
|
-
)}
|
|
462
|
-
{selectedPool.protocol === "Morpho" && (
|
|
463
|
-
<img
|
|
464
|
-
src={morphoLogo}
|
|
465
|
-
alt="Morpho"
|
|
466
|
-
className="w-3 h-3 mr-1"
|
|
467
|
-
/>
|
|
468
|
-
)}
|
|
469
|
-
{selectedPool.protocolUrl ? (
|
|
470
|
-
<a
|
|
471
|
-
href={selectedPool.protocolUrl}
|
|
472
|
-
target="_blank"
|
|
473
|
-
rel="noopener noreferrer"
|
|
474
|
-
className="hover:underline cursor-pointer"
|
|
475
|
-
>
|
|
476
|
-
{selectedPool.protocol}
|
|
477
|
-
</a>
|
|
478
|
-
) : (
|
|
479
|
-
selectedPool.protocol
|
|
480
|
-
)}
|
|
481
|
-
</span>
|
|
482
|
-
</div>
|
|
448
|
+
</span>
|
|
483
449
|
</div>
|
|
484
450
|
</div>
|
|
485
|
-
<button
|
|
486
|
-
type="button"
|
|
487
|
-
title="Select Vault"
|
|
488
|
-
onClick={() => setShowEarnPools(true)}
|
|
489
|
-
className="text-right flex items-center space-x-3 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700 rounded p-2 transition-colors"
|
|
490
|
-
>
|
|
491
|
-
<div>
|
|
492
|
-
<div className="flex items-center justify-end space-x-1 text-green-600 dark:text-green-400 mb-1 whitespace-nowrap">
|
|
493
|
-
<TrendingUp className="w-3 h-3" />
|
|
494
|
-
<span className="font-semibold text-sm">
|
|
495
|
-
{selectedPool.apy.toFixed(1)}% APY
|
|
496
|
-
</span>
|
|
497
|
-
</div>
|
|
498
|
-
<p className="text-xs text-gray-500 dark:text-gray-400 whitespace-nowrap">
|
|
499
|
-
TVL: {formatTvl(selectedPool.tvl)}
|
|
500
|
-
</p>
|
|
501
|
-
</div>
|
|
502
|
-
<ChevronRight className="w-4 h-4 text-gray-400" />
|
|
503
|
-
</button>
|
|
504
451
|
</div>
|
|
452
|
+
<button
|
|
453
|
+
type="button"
|
|
454
|
+
title="Select Vault"
|
|
455
|
+
onClick={() => setShowEarnPools(true)}
|
|
456
|
+
className="text-right flex items-center space-x-3 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700 rounded p-2 transition-colors"
|
|
457
|
+
>
|
|
458
|
+
<div>
|
|
459
|
+
<div className="flex items-center justify-end space-x-1 text-green-600 dark:text-green-400 mb-1 whitespace-nowrap">
|
|
460
|
+
<TrendingUp className="w-3 h-3" />
|
|
461
|
+
<span className="font-semibold text-sm">
|
|
462
|
+
{selectedPool.apy.toFixed(1)}% APY
|
|
463
|
+
</span>
|
|
464
|
+
</div>
|
|
465
|
+
<p className="text-xs text-gray-500 dark:text-gray-400 whitespace-nowrap">
|
|
466
|
+
TVL: {formatTvl(selectedPool.tvl)}
|
|
467
|
+
</p>
|
|
468
|
+
</div>
|
|
469
|
+
<ChevronRight className="w-4 h-4 text-gray-400" />
|
|
470
|
+
</button>
|
|
505
471
|
</div>
|
|
506
472
|
</div>
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
473
|
+
</div>
|
|
474
|
+
) : (
|
|
475
|
+
<button
|
|
476
|
+
type="button"
|
|
477
|
+
onClick={() => setShowEarnPools(true)}
|
|
478
|
+
className="w-full py-6 px-4 trails-list-item trails-border-radius-container transition-all duration-200 cursor-pointer"
|
|
479
|
+
>
|
|
480
|
+
<div className="flex items-center justify-between">
|
|
481
|
+
<div className="flex items-center space-x-3 flex-1">
|
|
482
|
+
<div className="w-8 h-8 rounded-full bg-gray-100 dark:bg-gray-700 flex items-center justify-center">
|
|
483
|
+
<Search className="w-4 h-4 text-gray-400" />
|
|
484
|
+
</div>
|
|
485
|
+
<div className="text-left flex-1">
|
|
486
|
+
<div className="font-semibold text-gray-900 dark:text-white text-sm">
|
|
487
|
+
Select vault to earn yield with
|
|
522
488
|
</div>
|
|
523
489
|
</div>
|
|
524
|
-
<ChevronRight className="w-4 h-4 trails-text-muted flex-shrink-0" />
|
|
525
490
|
</div>
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
491
|
+
<ChevronRight className="w-4 h-4 trails-text-muted flex-shrink-0" />
|
|
492
|
+
</div>
|
|
493
|
+
</button>
|
|
494
|
+
)}
|
|
529
495
|
</div>
|
|
530
496
|
|
|
531
497
|
{prepareSendQuote?.noSufficientBalance ? (
|
|
@@ -552,10 +518,23 @@ export const PoolDeposit: React.FC<PoolDepositProps> = ({
|
|
|
552
518
|
</div>
|
|
553
519
|
) : null}
|
|
554
520
|
|
|
521
|
+
{/* Fee Options */}
|
|
522
|
+
<FeeOptions
|
|
523
|
+
feeOptions={feeOptions || []}
|
|
524
|
+
selectedFeeToken={selectedFeeToken}
|
|
525
|
+
setSelectedFeeToken={(token) => setSelectedFeeToken(token as any)}
|
|
526
|
+
chainId={originToken?.chainId}
|
|
527
|
+
isRefetching={isLoadingQuote}
|
|
528
|
+
/>
|
|
529
|
+
|
|
555
530
|
{/* Quote Details */}
|
|
556
531
|
{prepareSendQuote && (
|
|
557
|
-
<div className="
|
|
558
|
-
<QuoteDetails
|
|
532
|
+
<div className="mb-4">
|
|
533
|
+
<QuoteDetails
|
|
534
|
+
quote={prepareSendQuote}
|
|
535
|
+
showContent={true}
|
|
536
|
+
isRefetching={isLoadingQuote}
|
|
537
|
+
/>
|
|
559
538
|
</div>
|
|
560
539
|
)}
|
|
561
540
|
|