0xtrails 0.12.2 → 0.13.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/abis/trailsHydrate.d.ts.map +1 -1
- package/dist/analytics.d.ts +41 -0
- package/dist/analytics.d.ts.map +1 -1
- package/dist/{ccip-62W6LwH2.js → ccip-Cg9-lJ6K.js} +16 -16
- package/dist/chainSwitch.d.ts.map +1 -1
- package/dist/chains.d.ts +9 -3
- package/dist/chains.d.ts.map +1 -1
- package/dist/error.d.ts +1 -0
- package/dist/error.d.ts.map +1 -1
- package/dist/{index-C0QTNYIA.js → index-DEojZg7b.js} +50431 -50424
- package/dist/index.d.ts +1 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +377 -421
- package/dist/intentReceiptPoller.d.ts.map +1 -1
- package/dist/intents.d.ts +1 -3
- package/dist/intents.d.ts.map +1 -1
- package/dist/mutations.d.ts +1 -4
- package/dist/mutations.d.ts.map +1 -1
- package/dist/prepareSend.d.ts.map +1 -1
- package/dist/query/balance.hooks.d.ts.map +1 -1
- package/dist/query/chains.hooks.d.ts.map +1 -1
- package/dist/query/chains.queries.d.ts +4 -1
- package/dist/query/chains.queries.d.ts.map +1 -1
- package/dist/queryParams.d.ts.map +1 -1
- package/dist/recover.d.ts.map +1 -1
- package/dist/tokens.d.ts.map +1 -1
- package/dist/transactionIntent/deposits/depositOrchestrator.d.ts.map +1 -1
- package/dist/transactionIntent/deposits/gaslessDeposit.d.ts.map +1 -1
- package/dist/transactionIntent/deposits/standardDeposit.d.ts +1 -7
- 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 +10 -1
- package/dist/transactionIntent/helpers/transactionStateHelpers.d.ts.map +1 -1
- package/dist/transactionIntent/types.d.ts +3 -6
- package/dist/transactionIntent/types.d.ts.map +1 -1
- package/dist/transactionIntent/utils/resilientDepositTracker.d.ts +3 -3
- package/dist/transactionIntent/utils/resilientDepositTracker.d.ts.map +1 -1
- package/dist/transactions.d.ts +2 -0
- package/dist/transactions.d.ts.map +1 -1
- package/dist/umd/trails.min.js +200 -200
- package/dist/walletUtils.d.ts +4 -0
- package/dist/walletUtils.d.ts.map +1 -1
- package/dist/wallets.d.ts +2 -1
- package/dist/wallets.d.ts.map +1 -1
- package/dist/widget/components/AccountActionsDropdown.d.ts.map +1 -1
- package/dist/widget/components/AccountIntentTransactionHistoryButton.d.ts.map +1 -1
- package/dist/widget/components/AccountSettings.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 +5 -1
- package/dist/widget/components/ConnectedWallets.d.ts.map +1 -1
- package/dist/widget/components/DepositTracker.d.ts +1 -1
- package/dist/widget/components/DepositTracker.d.ts.map +1 -1
- package/dist/widget/components/DirectTransfer.d.ts +0 -8
- package/dist/widget/components/DirectTransfer.d.ts.map +1 -1
- package/dist/widget/components/Fund.d.ts +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/FundWalletSelection.d.ts +0 -8
- package/dist/widget/components/FundWalletSelection.d.ts.map +1 -1
- package/dist/widget/components/FundingMethodSelectorButton.d.ts +1 -1
- package/dist/widget/components/FundingMethodSelectorButton.d.ts.map +1 -1
- package/dist/widget/components/MeldStepsFlow.d.ts.map +1 -1
- package/dist/widget/components/OnrampErrorScreen.d.ts.map +1 -1
- package/dist/widget/components/OnrampPaymentMethods.d.ts.map +1 -1
- package/dist/widget/components/OnrampProviderConfirmation.d.ts +0 -6
- package/dist/widget/components/OnrampProviderConfirmation.d.ts.map +1 -1
- package/dist/widget/components/Pay.d.ts.map +1 -1
- package/dist/widget/components/QrCode.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/ReceiptRecoverableFunds.d.ts +25 -0
- package/dist/widget/components/ReceiptRecoverableFunds.d.ts.map +1 -0
- package/dist/widget/components/RecipientSelectorButton.d.ts +3 -1
- package/dist/widget/components/RecipientSelectorButton.d.ts.map +1 -1
- package/dist/widget/components/Recipients.d.ts.map +1 -1
- package/dist/widget/components/Swap.d.ts +2 -16
- package/dist/widget/components/Swap.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.map +1 -1
- package/dist/widget/components/TransferPendingVertical.d.ts.map +1 -1
- package/dist/widget/components/TruncatedTransactionHash.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.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/useClickTracking.d.ts.map +1 -1
- package/dist/widget/hooks/useDebugScreens.d.ts +1 -10
- package/dist/widget/hooks/useDebugScreens.d.ts.map +1 -1
- package/dist/widget/hooks/useDepositMonitor.d.ts +2 -4
- package/dist/widget/hooks/useDepositMonitor.d.ts.map +1 -1
- package/dist/widget/hooks/useExternalFundingReceiptSync.d.ts +11 -0
- package/dist/widget/hooks/useExternalFundingReceiptSync.d.ts.map +1 -0
- package/dist/widget/hooks/useIntentReceiptBalances.d.ts +16 -0
- package/dist/widget/hooks/useIntentReceiptBalances.d.ts.map +1 -0
- package/dist/widget/hooks/useQuote.d.ts +0 -4
- package/dist/widget/hooks/useQuote.d.ts.map +1 -1
- package/dist/widget/hooks/useScreenTracking.d.ts +2 -0
- package/dist/widget/hooks/useScreenTracking.d.ts.map +1 -0
- package/dist/widget/hooks/useSelectedFundMethod.d.ts +0 -2
- package/dist/widget/hooks/useSelectedFundMethod.d.ts.map +1 -1
- package/dist/widget/hooks/useSendForm.d.ts +0 -4
- package/dist/widget/hooks/useSendForm.d.ts.map +1 -1
- package/dist/widget/hooks/useTokenList.d.ts.map +1 -1
- package/dist/widget/hooks/useTrailsSendTransaction.d.ts.map +1 -1
- package/dist/widget/hooks/useViewManager.d.ts +89 -0
- package/dist/widget/hooks/useViewManager.d.ts.map +1 -0
- package/dist/widget/hooks/useWalletConnectUri.d.ts.map +1 -1
- package/dist/widget/hooks/useWalletConnectionContext.d.ts +1 -1
- package/dist/widget/hooks/useWalletConnectionContext.d.ts.map +1 -1
- package/dist/widget/index.d.ts +1 -1
- package/dist/widget/index.d.ts.map +1 -1
- package/dist/widget/index.js +7 -6
- package/dist/widget/providers/TrailsProvider.d.ts.map +1 -1
- package/dist/widget/types/commonProps.d.ts +1 -6
- package/dist/widget/types/commonProps.d.ts.map +1 -1
- package/dist/widget/utils/forexRateStore.d.ts.map +1 -1
- package/dist/widget/utils/fundMethodSwitchState.d.ts +10 -0
- package/dist/widget/utils/fundMethodSwitchState.d.ts.map +1 -0
- package/dist/widget/utils/localeStore.d.ts.map +1 -1
- package/dist/widget/utils/viewManagerGuards.d.ts +5 -0
- package/dist/widget/utils/viewManagerGuards.d.ts.map +1 -0
- package/dist/widget/widget.d.ts +23 -2
- package/dist/widget/widget.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/abis/trailsHydrate.ts +2 -1
- package/src/analytics.ts +60 -0
- package/src/chainSwitch.ts +11 -8
- package/src/chains.ts +82 -37
- package/src/constants.ts +2 -2
- package/src/error.ts +8 -0
- package/src/index.ts +1 -12
- package/src/intentReceiptPoller.ts +27 -0
- package/src/intents.ts +36 -87
- package/src/mutations.ts +11 -102
- package/src/onramp-client/index.ts +3 -3
- package/src/prepareSend.ts +6 -2
- package/src/query/balance.hooks.ts +31 -10
- package/src/query/chains.hooks.ts +7 -1
- package/src/query/chains.queries.ts +8 -5
- package/src/queryParams.ts +8 -6
- package/src/recover.ts +9 -9
- package/src/tokens.ts +4 -2
- package/src/transactionIntent/deposits/depositOrchestrator.ts +0 -2
- package/src/transactionIntent/deposits/gaslessDeposit.ts +8 -0
- package/src/transactionIntent/deposits/standardDeposit.ts +25 -35
- package/src/transactionIntent/handlers/intentHandler.ts +234 -138
- package/src/transactionIntent/helpers/transactionStateHelpers.ts +108 -1
- package/src/transactionIntent/types.ts +14 -8
- package/src/transactionIntent/utils/resilientDepositTracker.ts +72 -183
- package/src/transactions.ts +16 -0
- package/src/walletUtils.ts +188 -1
- package/src/wallets.ts +50 -15
- package/src/widget/compiled.css +1 -1
- package/src/widget/components/AccountActionsDropdown.tsx +4 -6
- package/src/widget/components/AccountIntentTransactionHistoryButton.tsx +4 -6
- package/src/widget/components/AccountSettings.tsx +36 -22
- package/src/widget/components/ClassicSwap.tsx +67 -9
- package/src/widget/components/ConnectWallet.tsx +5 -7
- package/src/widget/components/ConnectedWallets.tsx +143 -82
- package/src/widget/components/DepositTracker.tsx +4 -5
- package/src/widget/components/DirectTransfer.tsx +85 -84
- package/src/widget/components/Earn.tsx +3 -3
- package/src/widget/components/Fund.tsx +90 -17
- package/src/widget/components/FundMethods.tsx +77 -43
- package/src/widget/components/FundWalletSelection.tsx +13 -397
- package/src/widget/components/FundingMethodSelectorButton.tsx +11 -10
- package/src/widget/components/MeldStepsFlow.tsx +64 -30
- package/src/widget/components/OnrampErrorScreen.tsx +2 -18
- package/src/widget/components/OnrampPaymentMethods.tsx +4 -6
- package/src/widget/components/OnrampProviderConfirmation.tsx +91 -110
- package/src/widget/components/OriginTransferInformation.tsx +2 -2
- package/src/widget/components/Pay.tsx +27 -7
- package/src/widget/components/PaymentMethods.tsx +10 -10
- package/src/widget/components/PoolDeposit.tsx +2 -2
- package/src/widget/components/QrCode.tsx +13 -11
- package/src/widget/components/QuoteDetails.tsx +16 -6
- package/src/widget/components/Receipt.tsx +66 -6
- package/src/widget/components/ReceiptRecoverableFunds.tsx +135 -0
- package/src/widget/components/RecipientSelectorButton.tsx +6 -17
- package/src/widget/components/Recipients.tsx +38 -29
- package/src/widget/components/Swap.tsx +2 -25
- package/src/widget/components/TokenList.tsx +2 -2
- package/src/widget/components/TokenSelector.tsx +11 -11
- package/src/widget/components/TokenSelectorButton.tsx +3 -3
- package/src/widget/components/TrailsHookModal.tsx +1 -1
- package/src/widget/components/TransactionDetails.tsx +43 -37
- package/src/widget/components/TransactionHistoryItem.tsx +1 -42
- package/src/widget/components/TransferPendingVertical.tsx +11 -4
- package/src/widget/components/TruncatedTransactionHash.tsx +5 -0
- package/src/widget/components/WalletConfirmation.tsx +5 -8
- package/src/widget/components/WalletConnect.tsx +6 -2
- package/src/widget/components/WidgetProviders.tsx +34 -43
- package/src/widget/components/Withdraw.tsx +25 -11
- package/src/widget/hooks/useClickTracking.ts +5 -0
- package/src/widget/hooks/useDebugScreens.ts +40 -86
- package/src/widget/hooks/useDepositMonitor.ts +14 -149
- package/src/widget/hooks/useExternalFundingReceiptSync.ts +79 -0
- package/src/widget/hooks/useIntentReceiptBalances.ts +141 -0
- package/src/widget/hooks/useQuote.ts +7 -16
- package/src/widget/hooks/useScreenTracking.ts +14 -0
- package/src/widget/hooks/useSelectedFundMethod.tsx +0 -5
- package/src/widget/hooks/useSendForm.ts +5 -14
- package/src/widget/hooks/useTokenList.ts +3 -16
- package/src/widget/hooks/useTrailsSendTransaction.ts +1 -5
- package/src/widget/hooks/useViewManager.tsx +505 -0
- package/src/widget/hooks/useWalletConnectUri.tsx +77 -18
- package/src/widget/hooks/useWalletConnectionContext.tsx +1 -1
- package/src/widget/index.tsx +1 -0
- package/src/widget/providers/TrailsProvider.tsx +0 -41
- package/src/widget/styles.ts +1 -1
- package/src/widget/types/commonProps.ts +0 -8
- package/src/widget/utils/forexRateStore.ts +0 -2
- package/src/widget/utils/fundMethodSwitchState.ts +25 -0
- package/src/widget/utils/localeStore.ts +0 -1
- package/src/widget/utils/viewManagerGuards.ts +49 -0
- package/src/widget/widget.tsx +405 -316
- package/dist/intentStorage.d.ts +0 -24
- package/dist/intentStorage.d.ts.map +0 -1
- package/dist/mode.d.ts +0 -2
- package/dist/mode.d.ts.map +0 -1
- package/dist/widget/hooks/useBack.d.ts +0 -22
- package/dist/widget/hooks/useBack.d.ts.map +0 -1
- package/dist/widget/hooks/useCurrentScreen.d.ts +0 -13
- package/dist/widget/hooks/useCurrentScreen.d.ts.map +0 -1
- package/dist/widget/hooks/useInitialRedirect.d.ts +0 -7
- package/dist/widget/hooks/useInitialRedirect.d.ts.map +0 -1
- package/dist/widget/hooks/useMode.d.ts +0 -20
- package/dist/widget/hooks/useMode.d.ts.map +0 -1
- package/dist/widget/hooks/usePreviousScreen.d.ts +0 -12
- package/dist/widget/hooks/usePreviousScreen.d.ts.map +0 -1
- package/dist/widget/workers/intentExecutionWorker.d.ts +0 -73
- package/dist/widget/workers/intentExecutionWorker.d.ts.map +0 -1
- package/src/intentStorage.ts +0 -106
- package/src/mode.ts +0 -1
- package/src/widget/hooks/useBack.tsx +0 -210
- package/src/widget/hooks/useCurrentScreen.tsx +0 -73
- package/src/widget/hooks/useInitialRedirect.tsx +0 -70
- package/src/widget/hooks/useMode.tsx +0 -51
- package/src/widget/hooks/usePreviousScreen.ts +0 -36
- package/src/widget/workers/intentExecutionWorker.ts +0 -502
package/src/recover.ts
CHANGED
|
@@ -30,7 +30,11 @@ import {
|
|
|
30
30
|
} from "./query/balance.hooks.js"
|
|
31
31
|
import type { FlatTokenBalancesData } from "./query/balance.fetchers.js"
|
|
32
32
|
import type { Token } from "./tokens.js"
|
|
33
|
-
import {
|
|
33
|
+
import {
|
|
34
|
+
checkProviderHealth,
|
|
35
|
+
sendWalletTransaction,
|
|
36
|
+
signWithTimeout,
|
|
37
|
+
} from "./walletUtils.js"
|
|
34
38
|
import { getERC20TransferData } from "./utils.js"
|
|
35
39
|
import { useGetIntent } from "./widget/hooks/useGetIntent.js"
|
|
36
40
|
|
|
@@ -1067,8 +1071,6 @@ export function useIntentRecover({
|
|
|
1067
1071
|
refundToAddress: refundToAddress || walletAddress,
|
|
1068
1072
|
})
|
|
1069
1073
|
|
|
1070
|
-
// TODO: temporary ignore this Biome warning for now; do not refactor code in this pass.
|
|
1071
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies: Preserve current dependency shape per requested no-code-change rollback.
|
|
1072
1074
|
const signPayload = useCallback(async (): Promise<{
|
|
1073
1075
|
signature: string
|
|
1074
1076
|
payload: Payload.Calls
|
|
@@ -1099,10 +1101,8 @@ export function useIntentRecover({
|
|
|
1099
1101
|
)
|
|
1100
1102
|
|
|
1101
1103
|
return { signature, payload, refundCall }
|
|
1102
|
-
}, [walletClient, inner
|
|
1104
|
+
}, [walletClient, inner])
|
|
1103
1105
|
|
|
1104
|
-
// TODO: temporary ignore this Biome warning for now; do not refactor code in this pass.
|
|
1105
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies: Preserve current dependency shape per requested no-code-change rollback.
|
|
1106
1106
|
const getRecoverTx = useCallback(
|
|
1107
1107
|
async (params: {
|
|
1108
1108
|
signedHash: string
|
|
@@ -1117,7 +1117,7 @@ export function useIntentRecover({
|
|
|
1117
1117
|
signature: params.signedHash,
|
|
1118
1118
|
payload: params.payload,
|
|
1119
1119
|
}),
|
|
1120
|
-
[inner
|
|
1120
|
+
[inner],
|
|
1121
1121
|
)
|
|
1122
1122
|
|
|
1123
1123
|
const recover = useCallback(async (): Promise<{
|
|
@@ -1141,7 +1141,7 @@ export function useIntentRecover({
|
|
|
1141
1141
|
desiredChainId: recoverTx.chainId,
|
|
1142
1142
|
})
|
|
1143
1143
|
|
|
1144
|
-
const txHash = await walletClient
|
|
1144
|
+
const txHash = await sendWalletTransaction(walletClient, {
|
|
1145
1145
|
account: walletClient.account,
|
|
1146
1146
|
to: recoverTx.to,
|
|
1147
1147
|
data: recoverTx.data,
|
|
@@ -1609,7 +1609,7 @@ export function useIntentRecoverWithBalances({
|
|
|
1609
1609
|
desiredChainId: Number(recoverTx.chainId),
|
|
1610
1610
|
})
|
|
1611
1611
|
|
|
1612
|
-
const txHash = await walletClient
|
|
1612
|
+
const txHash = await sendWalletTransaction(walletClient, {
|
|
1613
1613
|
account: walletClient.account,
|
|
1614
1614
|
to: recoverTx.to,
|
|
1615
1615
|
data: recoverTx.data,
|
package/src/tokens.ts
CHANGED
|
@@ -418,8 +418,10 @@ export async function getSupportedTokens(config: {
|
|
|
418
418
|
trailsApiKey: string
|
|
419
419
|
trailsApiUrl: string
|
|
420
420
|
}): Promise<Token[]> {
|
|
421
|
-
|
|
422
|
-
|
|
421
|
+
const sequenceChains = await getSupportedSequenceChains({
|
|
422
|
+
trailsApiUrl: config.trailsApiUrl,
|
|
423
|
+
trailsApiKey: config.trailsApiKey,
|
|
424
|
+
})
|
|
423
425
|
const chainIds = sequenceChains.map((chain) => chain.id)
|
|
424
426
|
|
|
425
427
|
// Get trails client using provided config
|
|
@@ -205,6 +205,13 @@ export async function attemptGaslessDeposit({
|
|
|
205
205
|
const receipt = await publicClient.waitForTransactionReceipt({
|
|
206
206
|
hash: txHash as `0x${string}`,
|
|
207
207
|
retryCount: 10,
|
|
208
|
+
onReplaced: (replacement) => {
|
|
209
|
+
logger.console.log("[trails-sdk] Gasless deposit tx replaced", {
|
|
210
|
+
reason: replacement.reason,
|
|
211
|
+
replacedHash: replacement.replacedTransaction.hash,
|
|
212
|
+
replacementHash: replacement.transaction.hash,
|
|
213
|
+
})
|
|
214
|
+
},
|
|
208
215
|
})
|
|
209
216
|
logger.console.log("[trails-sdk] receipt", receipt)
|
|
210
217
|
|
|
@@ -523,6 +530,7 @@ export async function attemptGaslessDeposit({
|
|
|
523
530
|
if (checkoutOnHandlers?.triggerCheckoutSignatureRejected) {
|
|
524
531
|
checkoutOnHandlers.triggerCheckoutSignatureRejected(error)
|
|
525
532
|
}
|
|
533
|
+
throw error
|
|
526
534
|
}
|
|
527
535
|
if (getIsPopupBlockedError(error)) {
|
|
528
536
|
throw new Error(
|
|
@@ -6,7 +6,6 @@ import type {
|
|
|
6
6
|
TransactionReceipt,
|
|
7
7
|
} from "viem"
|
|
8
8
|
import { parseUnits } from "viem"
|
|
9
|
-
import type { ExecuteIntentResponse } from "@0xtrails/api"
|
|
10
9
|
import type { TransactionState } from "../../transactions.js"
|
|
11
10
|
import type { CheckoutOnHandlers } from "../../widget/hooks/useCheckout.js"
|
|
12
11
|
import { logger } from "../../logger.js"
|
|
@@ -25,10 +24,7 @@ import { SECOND_MS } from "../../utils/time.js"
|
|
|
25
24
|
import { updatePersistentToast } from "../../toast.js"
|
|
26
25
|
import { getChainInfo } from "../../chains.js"
|
|
27
26
|
import { trackTransactionConfirmed } from "../../analytics.js"
|
|
28
|
-
import {
|
|
29
|
-
getIsAlreadyExecutingError,
|
|
30
|
-
getIsUserRejectionError,
|
|
31
|
-
} from "../../error.js"
|
|
27
|
+
import { getIsUserRejectionError } from "../../error.js"
|
|
32
28
|
import {
|
|
33
29
|
trackDepositResilient,
|
|
34
30
|
isRecoverableDepositError,
|
|
@@ -71,8 +67,6 @@ export async function attemptStandardDeposit({
|
|
|
71
67
|
sequenceProjectAccessKey,
|
|
72
68
|
sequenceIndexerUrl,
|
|
73
69
|
abortSignal,
|
|
74
|
-
intentId,
|
|
75
|
-
executeIntentFn,
|
|
76
70
|
}: {
|
|
77
71
|
queryClient?: QueryClient
|
|
78
72
|
originTokenAddress: string
|
|
@@ -101,11 +95,6 @@ export async function attemptStandardDeposit({
|
|
|
101
95
|
sequenceProjectAccessKey?: string
|
|
102
96
|
sequenceIndexerUrl?: string
|
|
103
97
|
abortSignal?: AbortSignal
|
|
104
|
-
intentId?: string
|
|
105
|
-
executeIntentFn?: (params: {
|
|
106
|
-
intentId: string
|
|
107
|
-
depositTransactionHash?: string
|
|
108
|
-
}) => Promise<ExecuteIntentResponse>
|
|
109
98
|
depositTransaction?: {
|
|
110
99
|
to: string
|
|
111
100
|
data: string
|
|
@@ -330,6 +319,16 @@ export async function attemptStandardDeposit({
|
|
|
330
319
|
const receipt = await publicClient.waitForTransactionReceipt({
|
|
331
320
|
hash: txHash as `0x${string}`,
|
|
332
321
|
retryCount: 10,
|
|
322
|
+
onReplaced: (replacement) => {
|
|
323
|
+
logger.console.log(
|
|
324
|
+
"[trails-sdk] wallet_sendCalls deposit transaction replaced",
|
|
325
|
+
{
|
|
326
|
+
reason: replacement.reason,
|
|
327
|
+
replacedHash: replacement.replacedTransaction.hash,
|
|
328
|
+
replacementHash: replacement.transaction.hash,
|
|
329
|
+
},
|
|
330
|
+
)
|
|
331
|
+
},
|
|
333
332
|
})
|
|
334
333
|
logger.console.log("[trails-sdk] receipt", receipt)
|
|
335
334
|
depositUserTxnReceipt = receipt
|
|
@@ -365,6 +364,13 @@ export async function attemptStandardDeposit({
|
|
|
365
364
|
const feeReceipt = await publicClient.waitForTransactionReceipt({
|
|
366
365
|
hash: txHashNativeFee,
|
|
367
366
|
retryCount: 10,
|
|
367
|
+
onReplaced: (replacement) => {
|
|
368
|
+
logger.console.log("[trails-sdk] Native fee transaction replaced", {
|
|
369
|
+
reason: replacement.reason,
|
|
370
|
+
replacedHash: replacement.replacedTransaction.hash,
|
|
371
|
+
replacementHash: replacement.transaction.hash,
|
|
372
|
+
})
|
|
373
|
+
},
|
|
368
374
|
})
|
|
369
375
|
logger.console.log("[trails-sdk] nativeFeeReceipt", feeReceipt)
|
|
370
376
|
} catch (error) {
|
|
@@ -404,29 +410,6 @@ export async function attemptStandardDeposit({
|
|
|
404
410
|
) // TODO: Add proper type
|
|
405
411
|
logger.console.log("[trails-sdk] origin tx", txHash)
|
|
406
412
|
|
|
407
|
-
// Call executeIntent immediately after getting txHash (before waiting for receipt).
|
|
408
|
-
// This ensures the backend knows about the intent as soon as the tx is broadcast,
|
|
409
|
-
// allowing integrators to call WaitIntentReceipt right after onCheckoutSignatureConfirmed.
|
|
410
|
-
// Fire-and-forget: errors are logged but don't block the receipt wait.
|
|
411
|
-
if (intentId && txHash && executeIntentFn) {
|
|
412
|
-
executeIntentFn({
|
|
413
|
-
intentId,
|
|
414
|
-
depositTransactionHash: txHash,
|
|
415
|
-
}).catch((error) => {
|
|
416
|
-
// "EXECUTING" means the backend already picked up the intent — that's fine
|
|
417
|
-
if (getIsAlreadyExecutingError(error)) {
|
|
418
|
-
logger.console.log(
|
|
419
|
-
"[trails-sdk] Intent already executing after early executeIntent call, continuing...",
|
|
420
|
-
)
|
|
421
|
-
} else {
|
|
422
|
-
logger.console.error(
|
|
423
|
-
"[trails-sdk] Early executeIntent call failed (will retry after receipt):",
|
|
424
|
-
error,
|
|
425
|
-
)
|
|
426
|
-
}
|
|
427
|
-
})
|
|
428
|
-
}
|
|
429
|
-
|
|
430
413
|
// Trigger signature confirmed callback after early executeIntent
|
|
431
414
|
if (checkoutOnHandlers?.triggerCheckoutSignatureConfirmed) {
|
|
432
415
|
checkoutOnHandlers?.triggerCheckoutSignatureConfirmed?.()
|
|
@@ -483,6 +466,13 @@ export async function attemptStandardDeposit({
|
|
|
483
466
|
const receipt = await publicClient.waitForTransactionReceipt({
|
|
484
467
|
hash: txHash,
|
|
485
468
|
retryCount: 10,
|
|
469
|
+
onReplaced: (replacement) => {
|
|
470
|
+
logger.console.log("[trails-sdk] Deposit transaction replaced", {
|
|
471
|
+
reason: replacement.reason,
|
|
472
|
+
replacedHash: replacement.replacedTransaction.hash,
|
|
473
|
+
replacementHash: replacement.transaction.hash,
|
|
474
|
+
})
|
|
475
|
+
},
|
|
486
476
|
})
|
|
487
477
|
|
|
488
478
|
const chainInfo = getChainInfo(originChainId)
|