0xtrails 0.13.0 → 0.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ccip-Cg9-lJ6K.js → ccip-CT_An6eM.js} +39 -39
- package/dist/chains.d.ts +4 -3
- package/dist/chains.d.ts.map +1 -1
- package/dist/constants.d.ts +1 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/customTokens.d.ts.map +1 -1
- package/dist/error.d.ts +1 -0
- package/dist/error.d.ts.map +1 -1
- package/dist/gasless.d.ts +1 -2
- package/dist/gasless.d.ts.map +1 -1
- package/dist/{index-DEojZg7b.js → index-RfqL5Foz.js} +56672 -43550
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +385 -333
- package/dist/intents.d.ts +8 -2
- package/dist/intents.d.ts.map +1 -1
- package/dist/keyMachineClient.d.ts +9 -0
- package/dist/keyMachineClient.d.ts.map +1 -0
- package/dist/keymachine/index.d.ts +14 -0
- package/dist/keymachine/index.d.ts.map +1 -0
- package/dist/keymachine/key-machine.gen.d.ts +461 -0
- package/dist/keymachine/key-machine.gen.d.ts.map +1 -0
- package/dist/onramp/MeshConnectFlow.d.ts +18 -0
- package/dist/onramp/MeshConnectFlow.d.ts.map +1 -0
- package/dist/onramp/MeshConnectIframe.d.ts +13 -0
- package/dist/onramp/MeshConnectIframe.d.ts.map +1 -0
- package/dist/onramp/SendFromExchangeButton.d.ts +16 -0
- package/dist/onramp/SendFromExchangeButton.d.ts.map +1 -0
- package/dist/onramp/TrailsOnRampProvider.d.ts +31 -0
- package/dist/onramp/TrailsOnRampProvider.d.ts.map +1 -0
- package/dist/onramp/index.d.ts +13 -0
- package/dist/onramp/index.d.ts.map +1 -0
- package/dist/onramp/meshconnect.d.ts +30 -0
- package/dist/onramp/meshconnect.d.ts.map +1 -0
- package/dist/onramp/trailsOnramp.d.ts +24 -0
- package/dist/onramp/trailsOnramp.d.ts.map +1 -0
- package/dist/onramp-client/index.d.ts +3 -3
- package/dist/onramp-client/index.d.ts.map +1 -1
- package/dist/paymasterSend.d.ts.map +1 -1
- package/dist/prepareSend.d.ts.map +1 -1
- package/dist/query/balance.fetchers.d.ts +31 -2
- package/dist/query/balance.fetchers.d.ts.map +1 -1
- package/dist/query/balance.hooks.d.ts +21 -2
- package/dist/query/balance.hooks.d.ts.map +1 -1
- package/dist/query/balance.queries.d.ts +18 -1
- package/dist/query/balance.queries.d.ts.map +1 -1
- package/dist/query/chains.queries.d.ts.map +1 -1
- package/dist/query/meld.fetchers.d.ts +1 -1
- package/dist/query/meld.fetchers.d.ts.map +1 -1
- package/dist/query/meld.hooks.d.ts +3 -3
- package/dist/query/meld.hooks.d.ts.map +1 -1
- package/dist/query/meld.queries.d.ts +1 -1
- package/dist/query/meld.queries.d.ts.map +1 -1
- package/dist/query/price.fetchers.d.ts +15 -0
- package/dist/query/price.fetchers.d.ts.map +1 -0
- package/dist/query/price.hooks.d.ts +352 -0
- package/dist/query/price.hooks.d.ts.map +1 -0
- package/dist/query/price.queries.d.ts +34 -0
- package/dist/query/price.queries.d.ts.map +1 -0
- package/dist/query/tokenList.queries.d.ts +54 -0
- package/dist/query/tokenList.queries.d.ts.map +1 -0
- package/dist/recover.d.ts +6 -4
- package/dist/recover.d.ts.map +1 -1
- package/dist/tokens.d.ts +13 -0
- package/dist/tokens.d.ts.map +1 -1
- package/dist/transactionIntent/deposits/depositOrchestrator.d.ts +2 -2
- package/dist/transactionIntent/deposits/depositOrchestrator.d.ts.map +1 -1
- package/dist/transactionIntent/deposits/gaslessDeposit.d.ts +2 -2
- package/dist/transactionIntent/deposits/gaslessDeposit.d.ts.map +1 -1
- package/dist/transactionIntent/deposits/standardDeposit.d.ts +1 -1
- package/dist/transactionIntent/deposits/standardDeposit.d.ts.map +1 -1
- package/dist/transactionIntent/handlers/intentHandler.d.ts.map +1 -1
- package/dist/transactionIntent/helpers/transactionStateHelpers.d.ts.map +1 -1
- package/dist/transactionIntent/quote/normalizeQuote.d.ts.map +1 -1
- package/dist/transactionIntent/types.d.ts +1 -1
- package/dist/transactionIntent/types.d.ts.map +1 -1
- package/dist/transactions.d.ts +4 -0
- package/dist/transactions.d.ts.map +1 -1
- package/dist/umd/trails.min.js +291 -202
- package/dist/utils/format.d.ts +7 -0
- package/dist/utils/format.d.ts.map +1 -1
- package/dist/walletUtils.d.ts +2 -1
- package/dist/walletUtils.d.ts.map +1 -1
- package/dist/wallets.d.ts +13 -54
- package/dist/wallets.d.ts.map +1 -1
- package/dist/widget/components/AccountIntentTransactionHistory.d.ts.map +1 -1
- 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/DirectTransfer.d.ts +1 -1
- package/dist/widget/components/DirectTransfer.d.ts.map +1 -1
- package/dist/widget/components/EarnPools.d.ts.map +1 -1
- package/dist/widget/components/ExecutionStatusBadge.d.ts.map +1 -1
- package/dist/widget/components/Fund.d.ts.map +1 -1
- package/dist/widget/components/FundMethods.d.ts.map +1 -1
- package/dist/widget/components/HighPriceImpactBlock.d.ts +7 -0
- package/dist/widget/components/HighPriceImpactBlock.d.ts.map +1 -0
- package/dist/widget/components/MeldHistory.d.ts.map +1 -1
- package/dist/widget/components/MeshExchangeSelection.d.ts +11 -0
- package/dist/widget/components/MeshExchangeSelection.d.ts.map +1 -0
- package/dist/widget/components/OnrampHistoryRow.d.ts +1 -1
- package/dist/widget/components/OnrampHistoryRow.d.ts.map +1 -1
- package/dist/widget/components/OnrampProviderConfirmation.d.ts.map +1 -1
- package/dist/widget/components/Pay.d.ts.map +1 -1
- package/dist/widget/components/PoolDeposit.d.ts.map +1 -1
- package/dist/widget/components/PoolWithdraw.d.ts.map +1 -1
- package/dist/widget/components/QRCodeWalletSelect.d.ts +1 -1
- package/dist/widget/components/QRCodeWalletSelect.d.ts.map +1 -1
- package/dist/widget/components/QuoteDetails.d.ts.map +1 -1
- package/dist/widget/components/Receipt.d.ts.map +1 -1
- package/dist/widget/components/Recipients.d.ts.map +1 -1
- package/dist/widget/components/RefundWarning.d.ts.map +1 -1
- package/dist/widget/components/TokenSelector.d.ts.map +1 -1
- package/dist/widget/components/TransactionDetails.d.ts.map +1 -1
- package/dist/widget/components/TransactionHistoryItem.d.ts +2 -0
- package/dist/widget/components/TransactionHistoryItem.d.ts.map +1 -1
- package/dist/widget/components/TransferPendingVertical.d.ts +1 -0
- package/dist/widget/components/TransferPendingVertical.d.ts.map +1 -1
- package/dist/widget/components/WaasFeeOptions.d.ts.map +1 -1
- package/dist/widget/components/WalletConnect.d.ts.map +1 -1
- package/dist/widget/components/WalletImage.d.ts.map +1 -1
- package/dist/widget/components/WalletList.d.ts.map +1 -1
- package/dist/widget/components/Withdraw.d.ts.map +1 -1
- package/dist/widget/css/compiled.css +1 -1
- package/dist/widget/hooks/useAddressWalletIcon.d.ts.map +1 -1
- package/dist/widget/hooks/useCombinedHistory.d.ts +6 -5
- package/dist/widget/hooks/useCombinedHistory.d.ts.map +1 -1
- package/dist/widget/hooks/useCustomTokenSearch.d.ts +6 -1
- package/dist/widget/hooks/useCustomTokenSearch.d.ts.map +1 -1
- package/dist/widget/hooks/useDefaultDestinationToken.d.ts.map +1 -1
- package/dist/widget/hooks/useDefaultOriginToken.d.ts.map +1 -1
- package/dist/widget/hooks/useFiatOnRampCurrencies.d.ts +1 -1
- package/dist/widget/hooks/useFiatOnRampCurrencies.d.ts.map +1 -1
- package/dist/widget/hooks/useGetIntent.d.ts +3 -2
- package/dist/widget/hooks/useGetIntent.d.ts.map +1 -1
- package/dist/widget/hooks/useIntentReceiptBalances.d.ts +1 -1
- package/dist/widget/hooks/useIntentReceiptBalances.d.ts.map +1 -1
- package/dist/widget/hooks/useIntentTransactionHistory.d.ts +3 -2
- package/dist/widget/hooks/useIntentTransactionHistory.d.ts.map +1 -1
- package/dist/widget/hooks/useMeldTransactionHistory.d.ts +1 -1
- package/dist/widget/hooks/useMeldTransactionHistory.d.ts.map +1 -1
- package/dist/widget/hooks/useMeldTransactionStatus.d.ts +1 -1
- package/dist/widget/hooks/useMeldTransactionStatus.d.ts.map +1 -1
- package/dist/widget/hooks/useOnRampQuote.d.ts +1 -1
- package/dist/widget/hooks/useOnRampQuote.d.ts.map +1 -1
- package/dist/widget/hooks/useOnRampTransactionStatus.d.ts +1 -1
- package/dist/widget/hooks/useOnRampTransactionStatus.d.ts.map +1 -1
- package/dist/widget/hooks/useQuote.d.ts +2 -2
- package/dist/widget/hooks/useQuote.d.ts.map +1 -1
- package/dist/widget/hooks/useSelectedFundMethod.d.ts +7 -0
- package/dist/widget/hooks/useSelectedFundMethod.d.ts.map +1 -1
- package/dist/widget/hooks/useSendForm.d.ts +0 -1
- package/dist/widget/hooks/useSendForm.d.ts.map +1 -1
- package/dist/widget/hooks/useTokenList.d.ts +7 -1
- package/dist/widget/hooks/useTokenList.d.ts.map +1 -1
- package/dist/widget/hooks/useViewManager.d.ts +1 -1
- package/dist/widget/hooks/useViewManager.d.ts.map +1 -1
- package/dist/widget/index.js +1 -1
- package/dist/widget/providers/TrailsProvider.d.ts +2 -0
- package/dist/widget/providers/TrailsProvider.d.ts.map +1 -1
- package/dist/widget/utils/createWagmiConfig.d.ts +2 -2
- package/dist/widget/utils/createWagmiConfig.d.ts.map +1 -1
- package/dist/widget/utils/fundMethodSwitchState.d.ts +1 -0
- package/dist/widget/utils/fundMethodSwitchState.d.ts.map +1 -1
- package/dist/widget/utils/historyFilters.d.ts +13 -0
- package/dist/widget/utils/historyFilters.d.ts.map +1 -0
- package/dist/widget/utils/meldProviderUtils.d.ts +1 -1
- package/dist/widget/utils/meldProviderUtils.d.ts.map +1 -1
- package/dist/widget/utils/meshSupportedTokens.d.ts +4 -0
- package/dist/widget/utils/meshSupportedTokens.d.ts.map +1 -0
- package/dist/widget/utils/onrampConfig.d.ts +11 -0
- package/dist/widget/utils/onrampConfig.d.ts.map +1 -0
- package/dist/widget/utils/statusLabel.d.ts +2 -0
- package/dist/widget/utils/statusLabel.d.ts.map +1 -0
- package/dist/widget/utils/trailsOnrampConfig.d.ts +18 -0
- package/dist/widget/utils/trailsOnrampConfig.d.ts.map +1 -0
- package/dist/widget/widget.d.ts +24 -8
- package/dist/widget/widget.d.ts.map +1 -1
- package/package.json +9 -7
- package/src/chains.ts +26 -9
- package/src/constants.ts +2 -0
- package/src/customTokens.ts +22 -7
- package/src/error.ts +7 -0
- package/src/gasless.ts +5 -2
- package/src/index.ts +8 -5
- package/src/intents.ts +56 -60
- package/src/keyMachineClient.ts +29 -0
- package/src/keymachine/index.ts +175 -0
- package/src/keymachine/key-machine.gen.ts +993 -0
- package/src/onramp/MeshConnectFlow.tsx +86 -0
- package/src/onramp/MeshConnectIframe.tsx +661 -0
- package/src/onramp/SendFromExchangeButton.tsx +81 -0
- package/src/onramp/TrailsOnRampProvider.tsx +59 -0
- package/src/onramp/index.ts +31 -0
- package/src/onramp/meshconnect.ts +277 -0
- package/src/onramp/trailsOnramp.tsx +130 -0
- package/src/onramp-client/index.ts +4 -6
- package/src/paymasterSend.ts +0 -5
- package/src/prepareSend.ts +45 -44
- package/src/query/balance.fetchers.ts +172 -17
- package/src/query/balance.hooks.ts +69 -6
- package/src/query/balance.queries.ts +63 -0
- package/src/query/chains.queries.ts +1 -6
- package/src/query/meld.fetchers.ts +1 -1
- package/src/query/meld.hooks.ts +1 -1
- package/src/query/meld.queries.ts +1 -1
- package/src/query/price.fetchers.ts +53 -0
- package/src/query/price.hooks.ts +46 -0
- package/src/query/price.queries.ts +364 -0
- package/src/query/tokenList.queries.ts +118 -0
- package/src/recover.ts +89 -26
- package/src/tokens.ts +108 -26
- package/src/transactionIntent/deposits/depositOrchestrator.ts +11 -11
- package/src/transactionIntent/deposits/gaslessDeposit.ts +38 -39
- package/src/transactionIntent/deposits/standardDeposit.ts +5 -30
- package/src/transactionIntent/handlers/intentHandler.ts +29 -12
- package/src/transactionIntent/helpers/transactionStateHelpers.ts +5 -2
- package/src/transactionIntent/quote/normalizeQuote.ts +11 -5
- package/src/transactionIntent/types.ts +1 -1
- package/src/transactions.ts +5 -1
- package/src/utils/format.ts +85 -1
- package/src/walletUtils.ts +2 -1
- package/src/wallets.ts +184 -380
- package/src/widget/compiled.css +1 -1
- package/src/widget/components/AccountIntentTransactionHistory.tsx +134 -109
- package/src/widget/components/ClassicSwap.tsx +26 -24
- package/src/widget/components/ConnectWallet.tsx +4 -2
- package/src/widget/components/ConnectedWallets.tsx +2 -5
- package/src/widget/components/DirectTransfer.tsx +5 -2
- package/src/widget/components/EarnPools.tsx +1 -2
- package/src/widget/components/ExecutionStatusBadge.tsx +10 -4
- package/src/widget/components/Fund.tsx +169 -110
- package/src/widget/components/FundMethods.tsx +5 -9
- package/src/widget/components/HighPriceImpactBlock.tsx +44 -0
- package/src/widget/components/MeldHistory.tsx +4 -28
- package/src/widget/components/MeshExchangeSelection.tsx +218 -0
- package/src/widget/components/OnrampHistoryRow.tsx +3 -27
- package/src/widget/components/OnrampProviderConfirmation.tsx +0 -25
- package/src/widget/components/Pay.tsx +20 -36
- package/src/widget/components/PoolDeposit.tsx +14 -24
- package/src/widget/components/PoolWithdraw.tsx +1 -63
- package/src/widget/components/QRCodeWalletSelect.tsx +5 -2
- package/src/widget/components/QuoteDetails.tsx +113 -106
- package/src/widget/components/Receipt.tsx +0 -11
- package/src/widget/components/Recipients.tsx +2 -1
- package/src/widget/components/RefundWarning.tsx +5 -10
- package/src/widget/components/ThemeProvider.tsx +4 -4
- package/src/widget/components/TokenSelector.tsx +85 -16
- package/src/widget/components/TransactionDetails.tsx +46 -0
- package/src/widget/components/TransactionHistoryItem.tsx +14 -23
- package/src/widget/components/TransferPendingVertical.tsx +17 -11
- package/src/widget/components/WaasFeeOptions.tsx +4 -42
- package/src/widget/components/WalletConnect.tsx +2 -5
- package/src/widget/components/WalletImage.tsx +6 -18
- package/src/widget/components/WalletList.tsx +1 -1
- package/src/widget/components/Withdraw.tsx +22 -23
- package/src/widget/hooks/useAddressWalletIcon.ts +2 -1
- package/src/widget/hooks/useAmountUsd.ts +1 -1
- package/src/widget/hooks/useCombinedHistory.ts +37 -93
- package/src/widget/hooks/useCustomTokenSearch.tsx +63 -33
- package/src/widget/hooks/useDefaultDestinationToken.tsx +2 -5
- package/src/widget/hooks/useDefaultOriginToken.tsx +2 -5
- package/src/widget/hooks/useFiatOnRampCurrencies.ts +1 -1
- package/src/widget/hooks/useGetIntent.ts +5 -4
- package/src/widget/hooks/useIntentReceiptBalances.ts +3 -3
- package/src/widget/hooks/useIntentTransactionHistory.ts +24 -47
- package/src/widget/hooks/useMeldTransactionHistory.ts +4 -2
- package/src/widget/hooks/useMeldTransactionStatus.ts +13 -11
- package/src/widget/hooks/useOnRampQuote.ts +3 -3
- package/src/widget/hooks/useOnRampTransactionStatus.ts +8 -6
- package/src/widget/hooks/useQuote.ts +56 -48
- package/src/widget/hooks/useSelectedFundMethod.tsx +14 -1
- package/src/widget/hooks/useSendForm.ts +52 -31
- package/src/widget/hooks/useTokenList.ts +209 -140
- package/src/widget/hooks/useTrailsSendTransaction.ts +1 -1
- package/src/widget/hooks/useViewManager.tsx +1 -0
- package/src/widget/providers/TrailsProvider.tsx +5 -0
- package/src/widget/styles.ts +1 -1
- package/src/widget/utils/createWagmiConfig.ts +7 -2
- package/src/widget/utils/fundMethodSwitchState.ts +2 -0
- package/src/widget/utils/historyFilters.ts +157 -0
- package/src/widget/utils/meldProviderUtils.ts +8 -2
- package/src/widget/utils/meshSupportedTokens.ts +28 -0
- package/src/widget/utils/onrampConfig.ts +15 -0
- package/src/widget/utils/statusLabel.ts +3 -0
- package/src/widget/utils/trailsOnrampConfig.ts +39 -0
- package/src/widget/widget.tsx +235 -185
- package/dist/onramp-client/trails-onramp.gen.d.ts +0 -570
- package/dist/onramp-client/trails-onramp.gen.d.ts.map +0 -1
- package/dist/prices.d.ts +0 -34
- package/dist/prices.d.ts.map +0 -1
- package/dist/useGasEstimation.d.ts +0 -34
- package/dist/useGasEstimation.d.ts.map +0 -1
- package/dist/widget/hooks/useCustomTokenFetch.d.ts +0 -19
- package/dist/widget/hooks/useCustomTokenFetch.d.ts.map +0 -1
- package/dist/widget/hooks/useTokenWithFreshBalance.d.ts +0 -18
- package/dist/widget/hooks/useTokenWithFreshBalance.d.ts.map +0 -1
- package/src/onramp-client/trails-onramp.gen.ts +0 -1320
- package/src/prices.ts +0 -528
- package/src/useGasEstimation.ts +0 -147
- package/src/widget/assets/Binance_Icon_Logo.svg +0 -14
- package/src/widget/assets/Bitfinex_Icon_Logo.svg +0 -5
- package/src/widget/assets/Coinbase_Icon_Logo.svg +0 -1
- package/src/widget/assets/WalletConnect-logo-blue-bg.svg +0 -11
- package/src/widget/assets/sequence-logo.svg +0 -15
- package/src/widget/hooks/useCustomTokenFetch.tsx +0 -74
- package/src/widget/hooks/useTokenWithFreshBalance.ts +0 -246
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Info } from "lucide-react"
|
|
2
2
|
import { useEffect, useMemo, useRef, useState } from "react"
|
|
3
|
+
import type { WalletClient } from "viem"
|
|
3
4
|
import { useWalletClient } from "wagmi"
|
|
4
5
|
import { getExplorerUrl } from "../../explorer.js"
|
|
5
6
|
import type { Intent, IntentTransaction } from "../../index.js"
|
|
@@ -25,6 +26,7 @@ const TransactionHistoryItem: React.FC<{
|
|
|
25
26
|
fetchedIntent?: Intent | null
|
|
26
27
|
commitIntentMutation?: any
|
|
27
28
|
onCommitSuccess?: () => void
|
|
29
|
+
selectedWalletClient?: WalletClient | null
|
|
28
30
|
balancesByIntentAddress: {
|
|
29
31
|
[intentAddress: string]: {
|
|
30
32
|
tokenBalancesData: FlatTokenBalancesData | undefined
|
|
@@ -40,6 +42,7 @@ const TransactionHistoryItem: React.FC<{
|
|
|
40
42
|
fetchedIntent,
|
|
41
43
|
commitIntentMutation,
|
|
42
44
|
onCommitSuccess,
|
|
45
|
+
selectedWalletClient,
|
|
43
46
|
balancesByIntentAddress,
|
|
44
47
|
onRefetchBalances,
|
|
45
48
|
}) => {
|
|
@@ -48,6 +51,8 @@ const TransactionHistoryItem: React.FC<{
|
|
|
48
51
|
const dateInfo = formatRelativeDate(transaction.createdAt)
|
|
49
52
|
const { data: walletClient } = useWalletClient()
|
|
50
53
|
|
|
54
|
+
const effectiveWalletClient = selectedWalletClient || walletClient
|
|
55
|
+
|
|
51
56
|
// Track refund transaction hash per intent
|
|
52
57
|
const [refundTxHash, setRefundTxHash] = useState<`0x${string}` | null>(null)
|
|
53
58
|
|
|
@@ -83,7 +88,7 @@ const TransactionHistoryItem: React.FC<{
|
|
|
83
88
|
const { recover, recoverToken } = useIntentRecoverWithBalances({
|
|
84
89
|
intent: !refundTxHash ? intentDataForRecovery : null,
|
|
85
90
|
balancesByIntentAddress: balancesByIntentAddress,
|
|
86
|
-
walletClient:
|
|
91
|
+
walletClient: effectiveWalletClient || undefined,
|
|
87
92
|
})
|
|
88
93
|
|
|
89
94
|
// Create a wrapper for onRefetch that also refetches intent data
|
|
@@ -101,7 +106,10 @@ const TransactionHistoryItem: React.FC<{
|
|
|
101
106
|
|
|
102
107
|
// Allow recovery for any intent with balances, regardless of execution status
|
|
103
108
|
const canRecover =
|
|
104
|
-
transaction.intentId &&
|
|
109
|
+
transaction.intentId &&
|
|
110
|
+
effectiveWalletClient &&
|
|
111
|
+
!refundTxHash &&
|
|
112
|
+
hasIntentBalance
|
|
105
113
|
|
|
106
114
|
// Refetch balances when execution status changes (e.g. mining -> succeeded)
|
|
107
115
|
const prevExecutionStatusRef = useRef(transaction.executionStatus)
|
|
@@ -123,25 +131,6 @@ const TransactionHistoryItem: React.FC<{
|
|
|
123
131
|
// Balance data is already included in the API response (includeBalances: true),
|
|
124
132
|
// so no separate refetch on mount is needed.
|
|
125
133
|
|
|
126
|
-
// Debug logging for recovery button
|
|
127
|
-
useEffect(() => {
|
|
128
|
-
if (transaction.intentId) {
|
|
129
|
-
logger.console.log("[AccountIntentTransactionHistory] Recovery check:", {
|
|
130
|
-
intentId: transaction.intentId,
|
|
131
|
-
hasWalletClient: !!walletClient,
|
|
132
|
-
refundTxHash,
|
|
133
|
-
hasIntentBalance,
|
|
134
|
-
canRecover,
|
|
135
|
-
})
|
|
136
|
-
}
|
|
137
|
-
}, [
|
|
138
|
-
transaction.intentId,
|
|
139
|
-
walletClient,
|
|
140
|
-
refundTxHash,
|
|
141
|
-
hasIntentBalance,
|
|
142
|
-
canRecover,
|
|
143
|
-
])
|
|
144
|
-
|
|
145
134
|
const [isRecovering, setIsRecovering] = useState(false)
|
|
146
135
|
const [recoverError, setRecoverError] = useState<string | null>(null)
|
|
147
136
|
const [isCommitting, setIsCommitting] = useState(false)
|
|
@@ -307,7 +296,7 @@ const TransactionHistoryItem: React.FC<{
|
|
|
307
296
|
})
|
|
308
297
|
|
|
309
298
|
const handleRecover = async () => {
|
|
310
|
-
if (!transaction.intentId || !
|
|
299
|
+
if (!transaction.intentId || !effectiveWalletClient) {
|
|
311
300
|
logger.console.error(
|
|
312
301
|
"[AccountIntentTransactionHistory] Cannot recover: missing intentId or walletClient",
|
|
313
302
|
)
|
|
@@ -583,7 +572,9 @@ const TransactionHistoryItem: React.FC<{
|
|
|
583
572
|
{/* Bottom section with status, action buttons, and more details button */}
|
|
584
573
|
<div className="flex items-center justify-between mt-2">
|
|
585
574
|
<div className="flex items-center gap-2">
|
|
586
|
-
<ExecutionStatusBadge
|
|
575
|
+
<ExecutionStatusBadge
|
|
576
|
+
status={transaction.intentStatus || transaction.executionStatus}
|
|
577
|
+
/>
|
|
587
578
|
|
|
588
579
|
{/* Action Buttons - positioned next to status */}
|
|
589
580
|
{refundTxHash && refundExplorerUrl ? (
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ChevronRight, ExternalLink } from "lucide-react"
|
|
2
2
|
import type React from "react"
|
|
3
3
|
import { useEffect, useState } from "react"
|
|
4
|
+
import { mainnet } from "viem/chains"
|
|
4
5
|
import { TRAILS_SUPPORT_URL } from "../../constants.js"
|
|
5
6
|
import type { PrepareSendQuote } from "../../prepareSend.js"
|
|
6
7
|
import type { TransactionState } from "../../transactions.js"
|
|
@@ -29,7 +30,7 @@ const isOFTRoute = (routeProviders?: { id: string }[]): boolean => {
|
|
|
29
30
|
const OFT_TIMEOUT_MS = 60 * MINUTE_MS // 1 hour for OFT routes
|
|
30
31
|
const DEFAULT_TIMEOUT_MS = MINUTE_MS // 1 minute for normal routes
|
|
31
32
|
const MAINNET_TIMEOUT_MS = 2 * MINUTE_MS // 2 minutes for Ethereum mainnet routes
|
|
32
|
-
const
|
|
33
|
+
const MESH_ONRAMP_TIMEOUT_MS = 3 * MINUTE_MS // 3 minutes for Mesh onramp
|
|
33
34
|
|
|
34
35
|
// Checkmark icon for completed steps
|
|
35
36
|
const CheckmarkIcon = () => (
|
|
@@ -108,6 +109,7 @@ interface TransferPendingProps {
|
|
|
108
109
|
timestamp?: number
|
|
109
110
|
onContinue?: () => void
|
|
110
111
|
onRampQuote?: OnrampQuote | null
|
|
112
|
+
fundMethod?: string | null
|
|
111
113
|
}
|
|
112
114
|
|
|
113
115
|
export const TransferPending: React.FC<TransferPendingProps> = ({
|
|
@@ -117,10 +119,10 @@ export const TransferPending: React.FC<TransferPendingProps> = ({
|
|
|
117
119
|
onRampQuote,
|
|
118
120
|
timestamp,
|
|
119
121
|
onContinue,
|
|
122
|
+
fundMethod,
|
|
120
123
|
}) => {
|
|
121
124
|
const { mode } = useViewManager()
|
|
122
125
|
const [showContent, setShowContent] = useState(false)
|
|
123
|
-
const [activePendingIndex, setActivePendingIndex] = useState(-1)
|
|
124
126
|
const [showDots, setShowDots] = useState(false)
|
|
125
127
|
const [showLine, setShowLine] = useState(false)
|
|
126
128
|
const [showTimeoutWarning, setShowTimeoutWarning] = useState(false)
|
|
@@ -129,25 +131,28 @@ export const TransferPending: React.FC<TransferPendingProps> = ({
|
|
|
129
131
|
null,
|
|
130
132
|
)
|
|
131
133
|
const isOFT = isOFTRoute(quote?.routeProviders)
|
|
132
|
-
const isMainnetOrigin = quote?.originChain?.id ===
|
|
134
|
+
const isMainnetOrigin = quote?.originChain?.id === mainnet.id
|
|
133
135
|
|
|
134
136
|
const showContinueButton =
|
|
135
137
|
hasAnyFailedOrAbortedTransactions(transactionStates) && onContinue
|
|
136
138
|
|
|
137
139
|
// Timeout warning: OFT routes can take significantly longer than standard routes.
|
|
138
140
|
useEffect(() => {
|
|
139
|
-
const timeoutMs =
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
141
|
+
const timeoutMs =
|
|
142
|
+
fundMethod === "onramp-mesh"
|
|
143
|
+
? MESH_ONRAMP_TIMEOUT_MS
|
|
144
|
+
: isOFT
|
|
145
|
+
? OFT_TIMEOUT_MS
|
|
146
|
+
: isMainnetOrigin
|
|
147
|
+
? MAINNET_TIMEOUT_MS
|
|
148
|
+
: DEFAULT_TIMEOUT_MS
|
|
144
149
|
|
|
145
150
|
const timeoutTimer = setTimeout(() => {
|
|
146
151
|
setShowTimeoutWarning(true)
|
|
147
152
|
}, timeoutMs)
|
|
148
153
|
|
|
149
154
|
return () => clearTimeout(timeoutTimer)
|
|
150
|
-
}, [
|
|
155
|
+
}, [fundMethod, isMainnetOrigin, isOFT])
|
|
151
156
|
useEffect(() => {
|
|
152
157
|
const depositConfirmed = transactionStates?.[0]?.state === "confirmed"
|
|
153
158
|
|
|
@@ -182,14 +187,15 @@ export const TransferPending: React.FC<TransferPendingProps> = ({
|
|
|
182
187
|
}
|
|
183
188
|
}, [])
|
|
184
189
|
|
|
190
|
+
const [activePendingIndex, setActivePendingIndex] = useState(-1)
|
|
191
|
+
|
|
185
192
|
useEffect(() => {
|
|
186
|
-
// Update active pending index with animation
|
|
187
193
|
const newActiveIndex = transactionStates.findIndex(
|
|
188
194
|
(tx) => tx.state === "pending",
|
|
189
195
|
)
|
|
196
|
+
|
|
190
197
|
if (newActiveIndex !== activePendingIndex) {
|
|
191
198
|
setActivePendingIndex(newActiveIndex)
|
|
192
|
-
// Reset timer when active pending item changes
|
|
193
199
|
setActivePendingTimer(0)
|
|
194
200
|
}
|
|
195
201
|
}, [transactionStates, activePendingIndex])
|
|
@@ -155,7 +155,10 @@ export const WaasFeeOptions: React.FC<WaasFeeOptionsProps> = ({
|
|
|
155
155
|
useState<string>()
|
|
156
156
|
const [isExpanded, setIsExpanded] = useState(false)
|
|
157
157
|
const [isProcessing, setIsProcessing] = useState(false)
|
|
158
|
-
const
|
|
158
|
+
const isLoading =
|
|
159
|
+
!!pendingFeeOptionConfirmation &&
|
|
160
|
+
(!pendingFeeOptionConfirmation.options ||
|
|
161
|
+
pendingFeeOptionConfirmation.options.length === 0)
|
|
159
162
|
|
|
160
163
|
const originTokenAddress = useMemo(
|
|
161
164
|
() => originToken?.contractAddress?.toLowerCase() || null,
|
|
@@ -261,47 +264,6 @@ export const WaasFeeOptions: React.FC<WaasFeeOptionsProps> = ({
|
|
|
261
264
|
}
|
|
262
265
|
}, [])
|
|
263
266
|
|
|
264
|
-
// Debug logging
|
|
265
|
-
useEffect(() => {
|
|
266
|
-
logger.console.log(
|
|
267
|
-
"[trails-sdk] WaasFeeOptions component mounted/updated:",
|
|
268
|
-
{
|
|
269
|
-
chainId,
|
|
270
|
-
pendingFeeOptionConfirmation: !!pendingFeeOptionConfirmation,
|
|
271
|
-
optionsCount: pendingFeeOptionConfirmation?.options?.length || 0,
|
|
272
|
-
hasOptions: !!pendingFeeOptionConfirmation?.options,
|
|
273
|
-
confirmationId: pendingFeeOptionConfirmation?.id,
|
|
274
|
-
isLoading,
|
|
275
|
-
isProcessing,
|
|
276
|
-
},
|
|
277
|
-
)
|
|
278
|
-
}, [chainId, pendingFeeOptionConfirmation, isLoading, isProcessing])
|
|
279
|
-
|
|
280
|
-
// Log when component renders but has no pending confirmation
|
|
281
|
-
useEffect(() => {
|
|
282
|
-
if (!pendingFeeOptionConfirmation) {
|
|
283
|
-
logger.console.log(
|
|
284
|
-
"[trails-sdk] WaasFeeOptions: No pending fee confirmation - this is normal until a transaction requires fee payment",
|
|
285
|
-
)
|
|
286
|
-
}
|
|
287
|
-
}, [pendingFeeOptionConfirmation])
|
|
288
|
-
|
|
289
|
-
// Manage loading state
|
|
290
|
-
useEffect(() => {
|
|
291
|
-
if (
|
|
292
|
-
pendingFeeOptionConfirmation &&
|
|
293
|
-
pendingFeeOptionConfirmation.options?.length > 0
|
|
294
|
-
) {
|
|
295
|
-
setIsLoading(false)
|
|
296
|
-
} else if (
|
|
297
|
-
pendingFeeOptionConfirmation &&
|
|
298
|
-
(!pendingFeeOptionConfirmation.options ||
|
|
299
|
-
pendingFeeOptionConfirmation.options.length === 0)
|
|
300
|
-
) {
|
|
301
|
-
setIsLoading(true)
|
|
302
|
-
}
|
|
303
|
-
}, [pendingFeeOptionConfirmation])
|
|
304
|
-
|
|
305
267
|
// Initialize with first option when fee options become available
|
|
306
268
|
useEffect(() => {
|
|
307
269
|
if (pendingFeeOptionConfirmation) {
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
+
import { getWalletIcon, getWalletName } from "@0xtrails/wallet-registry"
|
|
1
2
|
import { type FC, useEffect, useMemo, useState } from "react"
|
|
2
3
|
import { useAccount, useConnect, useDisconnect } from "wagmi"
|
|
3
4
|
import { logger } from "../../logger.js"
|
|
4
5
|
import { isWalletConnectConnector as checkIsWalletConnectConnector } from "../../walletUtils.js"
|
|
5
|
-
import {
|
|
6
|
-
getWalletIcon,
|
|
7
|
-
getWalletName,
|
|
8
|
-
useWalletConfigs,
|
|
9
|
-
} from "../../wallets.js"
|
|
6
|
+
import { useWalletConfigs } from "../../wallets.js"
|
|
10
7
|
import { useConnector } from "../hooks/useConnector.js"
|
|
11
8
|
import { useIsMobile } from "../hooks/useIsMobile.js"
|
|
12
9
|
import { useWalletConnectUri } from "../hooks/useWalletConnectUri.js"
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getWalletIcon,
|
|
3
|
+
wagmiConnectorToWalletId,
|
|
4
|
+
} from "@0xtrails/wallet-registry"
|
|
1
5
|
import type React from "react"
|
|
2
6
|
import { useAccount } from "wagmi"
|
|
3
|
-
import { getWalletIcon, wagmiConnectorToWalletId } from "../../wallets.js"
|
|
4
7
|
import { Wallet } from "lucide-react"
|
|
5
8
|
|
|
6
9
|
interface WalletImageProps {
|
|
@@ -14,7 +17,7 @@ export const WalletImage: React.FC<WalletImageProps> = ({ size, walletId }) => {
|
|
|
14
17
|
// Use provided walletId or derive from current connector
|
|
15
18
|
const currentWalletId =
|
|
16
19
|
walletId || (connector ? wagmiConnectorToWalletId(connector) : null)
|
|
17
|
-
const walletIcon = currentWalletId ? getWalletIcon(currentWalletId) :
|
|
20
|
+
const walletIcon = currentWalletId ? getWalletIcon(currentWalletId) : ""
|
|
18
21
|
|
|
19
22
|
// If no icon found, show default wallet icon
|
|
20
23
|
if (!walletIcon) {
|
|
@@ -26,25 +29,10 @@ export const WalletImage: React.FC<WalletImageProps> = ({ size, walletId }) => {
|
|
|
26
29
|
)
|
|
27
30
|
}
|
|
28
31
|
|
|
29
|
-
// Handle React component icons (like WalletIcon from lucide-react)
|
|
30
|
-
if (typeof walletIcon === "function") {
|
|
31
|
-
const IconComponent = walletIcon as React.ComponentType<{
|
|
32
|
-
className?: string
|
|
33
|
-
style?: React.CSSProperties
|
|
34
|
-
}>
|
|
35
|
-
return (
|
|
36
|
-
<IconComponent
|
|
37
|
-
className="text-gray-500 dark:text-gray-400"
|
|
38
|
-
style={{ width: size, height: size }}
|
|
39
|
-
/>
|
|
40
|
-
)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Handle string URLs/data URIs
|
|
44
32
|
return (
|
|
45
33
|
<div className="relative inline-block">
|
|
46
34
|
<img
|
|
47
|
-
src={walletIcon
|
|
35
|
+
src={walletIcon}
|
|
48
36
|
alt={`${currentWalletId} wallet`}
|
|
49
37
|
style={{ width: size, height: size }}
|
|
50
38
|
onError={(e) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ChevronRight, Search, Wallet } from "lucide-react"
|
|
2
|
+
import { topShownWallets } from "@0xtrails/wallet-registry"
|
|
2
3
|
import type React from "react"
|
|
3
4
|
import { useMemo, useState } from "react"
|
|
4
5
|
import type { WalletConfig } from "../../wallets.js"
|
|
5
|
-
import { topShownWallets } from "../../wallets.js"
|
|
6
6
|
import { ScreenHeader } from "./ScreenHeader.js"
|
|
7
7
|
|
|
8
8
|
export interface WalletListProps {
|
|
@@ -19,9 +19,9 @@ import { useDestinationSelectedToken } from "../hooks/useDestinationSelectedToke
|
|
|
19
19
|
import { useOriginSelectedToken } from "../hooks/useOriginSelectedToken.js"
|
|
20
20
|
import type { ProcessedFeeOption } from "../hooks/useSelectedFeeOption.js"
|
|
21
21
|
import { useSelectedRecipient } from "../hooks/useSelectedRecipient.js"
|
|
22
|
-
import { useSendForm } from "../hooks/useSendForm.js"
|
|
22
|
+
import { useSendForm, type OnCompleteProps } from "../hooks/useSendForm.js"
|
|
23
23
|
import { useSwapState } from "../hooks/useSwapState.js"
|
|
24
|
-
import {
|
|
24
|
+
import { useAccountTokenBalanceOnchain } from "../../query/balance.hooks.js"
|
|
25
25
|
import type { BaseProps } from "../types/commonProps.js"
|
|
26
26
|
import { isWithinCooldown, SECOND_MS } from "../../utils/time.js"
|
|
27
27
|
import { forexRateStore } from "../utils/forexRateStore.js"
|
|
@@ -97,7 +97,7 @@ const Withdraw: React.FC<WithdrawProps> = ({
|
|
|
97
97
|
const {
|
|
98
98
|
token: freshOriginToken,
|
|
99
99
|
isLoadingBalance: isLoadingFreshOriginBalance,
|
|
100
|
-
} =
|
|
100
|
+
} = useAccountTokenBalanceOnchain(originToken, account?.address)
|
|
101
101
|
|
|
102
102
|
const { selectedRecipient, setSelectedRecipient } = useSelectedRecipient()
|
|
103
103
|
const prevToRecipientRef = useRef<string | undefined>(toRecipient)
|
|
@@ -126,6 +126,7 @@ const Withdraw: React.FC<WithdrawProps> = ({
|
|
|
126
126
|
setSellAmount,
|
|
127
127
|
buyAmount,
|
|
128
128
|
setBuyAmount,
|
|
129
|
+
resetSwapState,
|
|
129
130
|
enterFormMode,
|
|
130
131
|
} = useSwapState()
|
|
131
132
|
|
|
@@ -181,6 +182,23 @@ const Withdraw: React.FC<WithdrawProps> = ({
|
|
|
181
182
|
const [_isUserTyping, setIsUserTyping] = useState(false)
|
|
182
183
|
const typingTimeoutRef = useRef<NodeJS.Timeout | null>(null)
|
|
183
184
|
|
|
185
|
+
useEffect(() => {
|
|
186
|
+
return () => {
|
|
187
|
+
if (typingTimeoutRef.current) {
|
|
188
|
+
clearTimeout(typingTimeoutRef.current)
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}, [])
|
|
192
|
+
|
|
193
|
+
const handleCompleteAndClearAmounts = useCallback(
|
|
194
|
+
(result: OnCompleteProps) => {
|
|
195
|
+
setInputDisplayValue("")
|
|
196
|
+
resetSwapState()
|
|
197
|
+
onComplete(result)
|
|
198
|
+
},
|
|
199
|
+
[onComplete, resetSwapState],
|
|
200
|
+
)
|
|
201
|
+
|
|
184
202
|
const {
|
|
185
203
|
amount,
|
|
186
204
|
amountRaw,
|
|
@@ -194,7 +212,6 @@ const Withdraw: React.FC<WithdrawProps> = ({
|
|
|
194
212
|
isSubmitting,
|
|
195
213
|
isLoadingQuote,
|
|
196
214
|
selectedDestToken,
|
|
197
|
-
setAmount,
|
|
198
215
|
setSelectedDestinationChain,
|
|
199
216
|
setSelectedDestToken,
|
|
200
217
|
buttonText,
|
|
@@ -220,7 +237,7 @@ const Withdraw: React.FC<WithdrawProps> = ({
|
|
|
220
237
|
paymasterUrls,
|
|
221
238
|
onSend,
|
|
222
239
|
onConfirm,
|
|
223
|
-
onComplete,
|
|
240
|
+
onComplete: handleCompleteAndClearAmounts,
|
|
224
241
|
selectedToken: originToken ?? undefined,
|
|
225
242
|
setWalletConfirmRetryHandler,
|
|
226
243
|
tradeType: tradeType,
|
|
@@ -236,15 +253,6 @@ const Withdraw: React.FC<WithdrawProps> = ({
|
|
|
236
253
|
// Get the token price for USD conversions
|
|
237
254
|
const tokenPriceUsd = sourceTokenPrices?.[0]?.priceUsd || 0
|
|
238
255
|
|
|
239
|
-
// Update amount based on last input type
|
|
240
|
-
useEffect(() => {
|
|
241
|
-
if (tradeType === TradeType.EXACT_INPUT) {
|
|
242
|
-
setAmount(sellAmount)
|
|
243
|
-
} else {
|
|
244
|
-
setAmount(buyAmount)
|
|
245
|
-
}
|
|
246
|
-
}, [sellAmount, buyAmount, tradeType, setAmount])
|
|
247
|
-
|
|
248
256
|
// Handle sell amount input changes
|
|
249
257
|
const handleSellAmountChange = useCallback(
|
|
250
258
|
(value: string) => {
|
|
@@ -446,15 +454,6 @@ const Withdraw: React.FC<WithdrawProps> = ({
|
|
|
446
454
|
setHasManualDestinationSelection,
|
|
447
455
|
])
|
|
448
456
|
|
|
449
|
-
useEffect(() => {
|
|
450
|
-
if (selectedDestToken?.chainId) {
|
|
451
|
-
const chainInfo = getChainInfo(selectedDestToken.chainId)
|
|
452
|
-
if (chainInfo) {
|
|
453
|
-
setSelectedDestinationChain(chainInfo)
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
}, [selectedDestToken, setSelectedDestinationChain])
|
|
457
|
-
|
|
458
457
|
// Sync destination token from hook with useSendForm
|
|
459
458
|
useEffect(() => {
|
|
460
459
|
if (destinationToken) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useMemo } from "react"
|
|
2
|
-
import {
|
|
2
|
+
import { wagmiConnectorToWalletId } from "@0xtrails/wallet-registry"
|
|
3
3
|
import { type Connector, useConnections } from "wagmi"
|
|
4
4
|
import type { Address } from "viem"
|
|
5
|
+
import { useWallets } from "../../wallets.js"
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Hook to get the wallet icon for an connected address
|
|
@@ -5,23 +5,16 @@ import type { MeldTransactionData } from "./useMeldTransactionHistory.js"
|
|
|
5
5
|
import { useIntentTransactionHistory } from "./useIntentTransactionHistory.js"
|
|
6
6
|
import { useMeldTransactionHistory } from "./useMeldTransactionHistory.js"
|
|
7
7
|
import { logger } from "../../logger.js"
|
|
8
|
+
import {
|
|
9
|
+
matchesIntentHistoryFilter,
|
|
10
|
+
type HistoryFilterType,
|
|
11
|
+
} from "../utils/historyFilters.js"
|
|
8
12
|
|
|
9
13
|
// Combined history item type - discriminated union
|
|
10
14
|
export type CombinedHistoryItem =
|
|
11
15
|
| { type: "intent"; data: IntentTransaction; timestamp: string }
|
|
12
16
|
| { type: "onramp"; data: MeldTransactionData; timestamp: string }
|
|
13
17
|
|
|
14
|
-
// Filter types for history
|
|
15
|
-
export type HistoryFilterType =
|
|
16
|
-
| "all"
|
|
17
|
-
| "pending"
|
|
18
|
-
| "succeeded"
|
|
19
|
-
| "failed"
|
|
20
|
-
| "aborted"
|
|
21
|
-
| "mining"
|
|
22
|
-
| "committed"
|
|
23
|
-
| "onramp"
|
|
24
|
-
|
|
25
18
|
// Combined history state
|
|
26
19
|
export interface CombinedHistoryState {
|
|
27
20
|
items: CombinedHistoryItem[]
|
|
@@ -44,13 +37,14 @@ export interface UseCombinedHistoryParams {
|
|
|
44
37
|
enabled?: boolean
|
|
45
38
|
autoRefetch?: boolean
|
|
46
39
|
refetchInterval?: number
|
|
40
|
+
intentStatuses?: string[]
|
|
47
41
|
}
|
|
48
42
|
|
|
49
43
|
// Hook return type
|
|
50
44
|
export interface UseCombinedHistoryReturn extends CombinedHistoryState {
|
|
51
|
-
refetch: () => void
|
|
52
|
-
refetchIntent: () => void
|
|
53
|
-
refetchOnramp: () => void
|
|
45
|
+
refetch: () => Promise<void>
|
|
46
|
+
refetchIntent: () => Promise<void>
|
|
47
|
+
refetchOnramp: () => Promise<void>
|
|
54
48
|
loadMoreIntent: () => void
|
|
55
49
|
nextPageIntent: () => void
|
|
56
50
|
prevPageIntent: () => void
|
|
@@ -167,6 +161,7 @@ export function useCombinedHistory({
|
|
|
167
161
|
enabled = true,
|
|
168
162
|
autoRefetch = false,
|
|
169
163
|
refetchInterval = 10 * SECOND_MS,
|
|
164
|
+
intentStatuses,
|
|
170
165
|
}: UseCombinedHistoryParams = {}): UseCombinedHistoryReturn {
|
|
171
166
|
// Fetch intent history
|
|
172
167
|
const {
|
|
@@ -185,6 +180,7 @@ export function useCombinedHistory({
|
|
|
185
180
|
accountAddress,
|
|
186
181
|
pageSize: intentPageSize,
|
|
187
182
|
enabled: enabled && !!accountAddress,
|
|
183
|
+
intentStatuses,
|
|
188
184
|
})
|
|
189
185
|
|
|
190
186
|
// Fetch onramp history
|
|
@@ -263,10 +259,9 @@ export function useCombinedHistory({
|
|
|
263
259
|
}, [intentTransactions, onrampTransactions, intentPageSize])
|
|
264
260
|
|
|
265
261
|
// Combined refetch
|
|
266
|
-
const refetch = useCallback(() => {
|
|
262
|
+
const refetch = useCallback(async () => {
|
|
267
263
|
logger.console.log("[useCombinedHistory] Refetching both histories")
|
|
268
|
-
refetchIntent()
|
|
269
|
-
refetchOnramp()
|
|
264
|
+
await Promise.all([refetchIntent(), refetchOnramp()])
|
|
270
265
|
}, [refetchIntent, refetchOnramp])
|
|
271
266
|
|
|
272
267
|
// Search function
|
|
@@ -311,91 +306,40 @@ export function useCombinedHistory({
|
|
|
311
306
|
return combinedItems
|
|
312
307
|
|
|
313
308
|
case "onramp":
|
|
314
|
-
return
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
return status === "PENDING" || status === "PROCESSING"
|
|
331
|
-
}
|
|
332
|
-
})
|
|
333
|
-
|
|
309
|
+
return [...onrampTransactions]
|
|
310
|
+
.map((onramp) => ({
|
|
311
|
+
type: "onramp" as const,
|
|
312
|
+
data: onramp,
|
|
313
|
+
timestamp:
|
|
314
|
+
onramp.createdAt ||
|
|
315
|
+
onramp.updatedAt ||
|
|
316
|
+
new Date().toISOString(),
|
|
317
|
+
}))
|
|
318
|
+
.sort((a, b) => {
|
|
319
|
+
const timeA = new Date(a.timestamp).getTime()
|
|
320
|
+
const timeB = new Date(b.timestamp).getTime()
|
|
321
|
+
return timeB - timeA
|
|
322
|
+
})
|
|
323
|
+
|
|
324
|
+
case "executing":
|
|
334
325
|
case "succeeded":
|
|
335
|
-
return combinedItems.filter((item) => {
|
|
336
|
-
if (item.type === "intent") {
|
|
337
|
-
return item.data.executionStatus?.toUpperCase() === "SUCCEEDED"
|
|
338
|
-
} else {
|
|
339
|
-
return (
|
|
340
|
-
item.data.status === "COMPLETED" ||
|
|
341
|
-
item.data.status === "SETTLED"
|
|
342
|
-
)
|
|
343
|
-
}
|
|
344
|
-
})
|
|
345
|
-
|
|
346
326
|
case "failed":
|
|
347
|
-
return combinedItems.filter((item) => {
|
|
348
|
-
if (item.type === "intent") {
|
|
349
|
-
const status = item.data.executionStatus?.toUpperCase()
|
|
350
|
-
return (
|
|
351
|
-
status === "FAILED" ||
|
|
352
|
-
status === "REFUNDED" ||
|
|
353
|
-
status === "ERRORED"
|
|
354
|
-
)
|
|
355
|
-
} else {
|
|
356
|
-
const status = item.data.status
|
|
357
|
-
return (
|
|
358
|
-
status === "FAILED" ||
|
|
359
|
-
status === "DECLINED" ||
|
|
360
|
-
status === "CANCELLED" ||
|
|
361
|
-
status === "ERROR" ||
|
|
362
|
-
status === "REFUNDED"
|
|
363
|
-
)
|
|
364
|
-
}
|
|
365
|
-
})
|
|
366
|
-
|
|
367
327
|
case "aborted":
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
const status = item.data.executionStatus?.toUpperCase()
|
|
371
|
-
return status === "ABORTED"
|
|
372
|
-
}
|
|
373
|
-
return false // Onramp transactions don't have aborted status
|
|
374
|
-
})
|
|
375
|
-
|
|
376
|
-
case "mining":
|
|
377
|
-
return combinedItems.filter((item) => {
|
|
378
|
-
if (item.type === "intent") {
|
|
379
|
-
const status = item.data.executionStatus?.toUpperCase()
|
|
380
|
-
return status === "MINING"
|
|
381
|
-
}
|
|
382
|
-
return false // Onramp transactions don't have mining status
|
|
383
|
-
})
|
|
384
|
-
|
|
328
|
+
case "refunded":
|
|
329
|
+
case "invalid":
|
|
385
330
|
case "committed":
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
})
|
|
331
|
+
case "quoted":
|
|
332
|
+
return combinedItems.filter(
|
|
333
|
+
(item) =>
|
|
334
|
+
item.type === "intent" &&
|
|
335
|
+
matchesIntentHistoryFilter(item.data, filter),
|
|
336
|
+
)
|
|
393
337
|
|
|
394
338
|
default:
|
|
395
339
|
return combinedItems
|
|
396
340
|
}
|
|
397
341
|
},
|
|
398
|
-
[combinedItems],
|
|
342
|
+
[combinedItems, onrampTransactions],
|
|
399
343
|
)
|
|
400
344
|
|
|
401
345
|
// Combined filter and search
|