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.
Files changed (243) hide show
  1. package/dist/abis/trailsHydrate.d.ts.map +1 -1
  2. package/dist/analytics.d.ts +41 -0
  3. package/dist/analytics.d.ts.map +1 -1
  4. package/dist/{ccip-62W6LwH2.js → ccip-Cg9-lJ6K.js} +16 -16
  5. package/dist/chainSwitch.d.ts.map +1 -1
  6. package/dist/chains.d.ts +9 -3
  7. package/dist/chains.d.ts.map +1 -1
  8. package/dist/error.d.ts +1 -0
  9. package/dist/error.d.ts.map +1 -1
  10. package/dist/{index-C0QTNYIA.js → index-DEojZg7b.js} +50431 -50424
  11. package/dist/index.d.ts +1 -3
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +377 -421
  14. package/dist/intentReceiptPoller.d.ts.map +1 -1
  15. package/dist/intents.d.ts +1 -3
  16. package/dist/intents.d.ts.map +1 -1
  17. package/dist/mutations.d.ts +1 -4
  18. package/dist/mutations.d.ts.map +1 -1
  19. package/dist/prepareSend.d.ts.map +1 -1
  20. package/dist/query/balance.hooks.d.ts.map +1 -1
  21. package/dist/query/chains.hooks.d.ts.map +1 -1
  22. package/dist/query/chains.queries.d.ts +4 -1
  23. package/dist/query/chains.queries.d.ts.map +1 -1
  24. package/dist/queryParams.d.ts.map +1 -1
  25. package/dist/recover.d.ts.map +1 -1
  26. package/dist/tokens.d.ts.map +1 -1
  27. package/dist/transactionIntent/deposits/depositOrchestrator.d.ts.map +1 -1
  28. package/dist/transactionIntent/deposits/gaslessDeposit.d.ts.map +1 -1
  29. package/dist/transactionIntent/deposits/standardDeposit.d.ts +1 -7
  30. package/dist/transactionIntent/deposits/standardDeposit.d.ts.map +1 -1
  31. package/dist/transactionIntent/handlers/intentHandler.d.ts.map +1 -1
  32. package/dist/transactionIntent/helpers/transactionStateHelpers.d.ts +10 -1
  33. package/dist/transactionIntent/helpers/transactionStateHelpers.d.ts.map +1 -1
  34. package/dist/transactionIntent/types.d.ts +3 -6
  35. package/dist/transactionIntent/types.d.ts.map +1 -1
  36. package/dist/transactionIntent/utils/resilientDepositTracker.d.ts +3 -3
  37. package/dist/transactionIntent/utils/resilientDepositTracker.d.ts.map +1 -1
  38. package/dist/transactions.d.ts +2 -0
  39. package/dist/transactions.d.ts.map +1 -1
  40. package/dist/umd/trails.min.js +200 -200
  41. package/dist/walletUtils.d.ts +4 -0
  42. package/dist/walletUtils.d.ts.map +1 -1
  43. package/dist/wallets.d.ts +2 -1
  44. package/dist/wallets.d.ts.map +1 -1
  45. package/dist/widget/components/AccountActionsDropdown.d.ts.map +1 -1
  46. package/dist/widget/components/AccountIntentTransactionHistoryButton.d.ts.map +1 -1
  47. package/dist/widget/components/AccountSettings.d.ts.map +1 -1
  48. package/dist/widget/components/ClassicSwap.d.ts.map +1 -1
  49. package/dist/widget/components/ConnectWallet.d.ts.map +1 -1
  50. package/dist/widget/components/ConnectedWallets.d.ts +5 -1
  51. package/dist/widget/components/ConnectedWallets.d.ts.map +1 -1
  52. package/dist/widget/components/DepositTracker.d.ts +1 -1
  53. package/dist/widget/components/DepositTracker.d.ts.map +1 -1
  54. package/dist/widget/components/DirectTransfer.d.ts +0 -8
  55. package/dist/widget/components/DirectTransfer.d.ts.map +1 -1
  56. package/dist/widget/components/Fund.d.ts +1 -1
  57. package/dist/widget/components/Fund.d.ts.map +1 -1
  58. package/dist/widget/components/FundMethods.d.ts.map +1 -1
  59. package/dist/widget/components/FundWalletSelection.d.ts +0 -8
  60. package/dist/widget/components/FundWalletSelection.d.ts.map +1 -1
  61. package/dist/widget/components/FundingMethodSelectorButton.d.ts +1 -1
  62. package/dist/widget/components/FundingMethodSelectorButton.d.ts.map +1 -1
  63. package/dist/widget/components/MeldStepsFlow.d.ts.map +1 -1
  64. package/dist/widget/components/OnrampErrorScreen.d.ts.map +1 -1
  65. package/dist/widget/components/OnrampPaymentMethods.d.ts.map +1 -1
  66. package/dist/widget/components/OnrampProviderConfirmation.d.ts +0 -6
  67. package/dist/widget/components/OnrampProviderConfirmation.d.ts.map +1 -1
  68. package/dist/widget/components/Pay.d.ts.map +1 -1
  69. package/dist/widget/components/QrCode.d.ts.map +1 -1
  70. package/dist/widget/components/QuoteDetails.d.ts.map +1 -1
  71. package/dist/widget/components/Receipt.d.ts.map +1 -1
  72. package/dist/widget/components/ReceiptRecoverableFunds.d.ts +25 -0
  73. package/dist/widget/components/ReceiptRecoverableFunds.d.ts.map +1 -0
  74. package/dist/widget/components/RecipientSelectorButton.d.ts +3 -1
  75. package/dist/widget/components/RecipientSelectorButton.d.ts.map +1 -1
  76. package/dist/widget/components/Recipients.d.ts.map +1 -1
  77. package/dist/widget/components/Swap.d.ts +2 -16
  78. package/dist/widget/components/Swap.d.ts.map +1 -1
  79. package/dist/widget/components/TokenSelector.d.ts.map +1 -1
  80. package/dist/widget/components/TransactionDetails.d.ts.map +1 -1
  81. package/dist/widget/components/TransactionHistoryItem.d.ts.map +1 -1
  82. package/dist/widget/components/TransferPendingVertical.d.ts.map +1 -1
  83. package/dist/widget/components/TruncatedTransactionHash.d.ts.map +1 -1
  84. package/dist/widget/components/WalletConfirmation.d.ts.map +1 -1
  85. package/dist/widget/components/WalletConnect.d.ts.map +1 -1
  86. package/dist/widget/components/WidgetProviders.d.ts.map +1 -1
  87. package/dist/widget/components/Withdraw.d.ts.map +1 -1
  88. package/dist/widget/css/compiled.css +1 -1
  89. package/dist/widget/hooks/useClickTracking.d.ts.map +1 -1
  90. package/dist/widget/hooks/useDebugScreens.d.ts +1 -10
  91. package/dist/widget/hooks/useDebugScreens.d.ts.map +1 -1
  92. package/dist/widget/hooks/useDepositMonitor.d.ts +2 -4
  93. package/dist/widget/hooks/useDepositMonitor.d.ts.map +1 -1
  94. package/dist/widget/hooks/useExternalFundingReceiptSync.d.ts +11 -0
  95. package/dist/widget/hooks/useExternalFundingReceiptSync.d.ts.map +1 -0
  96. package/dist/widget/hooks/useIntentReceiptBalances.d.ts +16 -0
  97. package/dist/widget/hooks/useIntentReceiptBalances.d.ts.map +1 -0
  98. package/dist/widget/hooks/useQuote.d.ts +0 -4
  99. package/dist/widget/hooks/useQuote.d.ts.map +1 -1
  100. package/dist/widget/hooks/useScreenTracking.d.ts +2 -0
  101. package/dist/widget/hooks/useScreenTracking.d.ts.map +1 -0
  102. package/dist/widget/hooks/useSelectedFundMethod.d.ts +0 -2
  103. package/dist/widget/hooks/useSelectedFundMethod.d.ts.map +1 -1
  104. package/dist/widget/hooks/useSendForm.d.ts +0 -4
  105. package/dist/widget/hooks/useSendForm.d.ts.map +1 -1
  106. package/dist/widget/hooks/useTokenList.d.ts.map +1 -1
  107. package/dist/widget/hooks/useTrailsSendTransaction.d.ts.map +1 -1
  108. package/dist/widget/hooks/useViewManager.d.ts +89 -0
  109. package/dist/widget/hooks/useViewManager.d.ts.map +1 -0
  110. package/dist/widget/hooks/useWalletConnectUri.d.ts.map +1 -1
  111. package/dist/widget/hooks/useWalletConnectionContext.d.ts +1 -1
  112. package/dist/widget/hooks/useWalletConnectionContext.d.ts.map +1 -1
  113. package/dist/widget/index.d.ts +1 -1
  114. package/dist/widget/index.d.ts.map +1 -1
  115. package/dist/widget/index.js +7 -6
  116. package/dist/widget/providers/TrailsProvider.d.ts.map +1 -1
  117. package/dist/widget/types/commonProps.d.ts +1 -6
  118. package/dist/widget/types/commonProps.d.ts.map +1 -1
  119. package/dist/widget/utils/forexRateStore.d.ts.map +1 -1
  120. package/dist/widget/utils/fundMethodSwitchState.d.ts +10 -0
  121. package/dist/widget/utils/fundMethodSwitchState.d.ts.map +1 -0
  122. package/dist/widget/utils/localeStore.d.ts.map +1 -1
  123. package/dist/widget/utils/viewManagerGuards.d.ts +5 -0
  124. package/dist/widget/utils/viewManagerGuards.d.ts.map +1 -0
  125. package/dist/widget/widget.d.ts +23 -2
  126. package/dist/widget/widget.d.ts.map +1 -1
  127. package/package.json +2 -2
  128. package/src/abis/trailsHydrate.ts +2 -1
  129. package/src/analytics.ts +60 -0
  130. package/src/chainSwitch.ts +11 -8
  131. package/src/chains.ts +82 -37
  132. package/src/constants.ts +2 -2
  133. package/src/error.ts +8 -0
  134. package/src/index.ts +1 -12
  135. package/src/intentReceiptPoller.ts +27 -0
  136. package/src/intents.ts +36 -87
  137. package/src/mutations.ts +11 -102
  138. package/src/onramp-client/index.ts +3 -3
  139. package/src/prepareSend.ts +6 -2
  140. package/src/query/balance.hooks.ts +31 -10
  141. package/src/query/chains.hooks.ts +7 -1
  142. package/src/query/chains.queries.ts +8 -5
  143. package/src/queryParams.ts +8 -6
  144. package/src/recover.ts +9 -9
  145. package/src/tokens.ts +4 -2
  146. package/src/transactionIntent/deposits/depositOrchestrator.ts +0 -2
  147. package/src/transactionIntent/deposits/gaslessDeposit.ts +8 -0
  148. package/src/transactionIntent/deposits/standardDeposit.ts +25 -35
  149. package/src/transactionIntent/handlers/intentHandler.ts +234 -138
  150. package/src/transactionIntent/helpers/transactionStateHelpers.ts +108 -1
  151. package/src/transactionIntent/types.ts +14 -8
  152. package/src/transactionIntent/utils/resilientDepositTracker.ts +72 -183
  153. package/src/transactions.ts +16 -0
  154. package/src/walletUtils.ts +188 -1
  155. package/src/wallets.ts +50 -15
  156. package/src/widget/compiled.css +1 -1
  157. package/src/widget/components/AccountActionsDropdown.tsx +4 -6
  158. package/src/widget/components/AccountIntentTransactionHistoryButton.tsx +4 -6
  159. package/src/widget/components/AccountSettings.tsx +36 -22
  160. package/src/widget/components/ClassicSwap.tsx +67 -9
  161. package/src/widget/components/ConnectWallet.tsx +5 -7
  162. package/src/widget/components/ConnectedWallets.tsx +143 -82
  163. package/src/widget/components/DepositTracker.tsx +4 -5
  164. package/src/widget/components/DirectTransfer.tsx +85 -84
  165. package/src/widget/components/Earn.tsx +3 -3
  166. package/src/widget/components/Fund.tsx +90 -17
  167. package/src/widget/components/FundMethods.tsx +77 -43
  168. package/src/widget/components/FundWalletSelection.tsx +13 -397
  169. package/src/widget/components/FundingMethodSelectorButton.tsx +11 -10
  170. package/src/widget/components/MeldStepsFlow.tsx +64 -30
  171. package/src/widget/components/OnrampErrorScreen.tsx +2 -18
  172. package/src/widget/components/OnrampPaymentMethods.tsx +4 -6
  173. package/src/widget/components/OnrampProviderConfirmation.tsx +91 -110
  174. package/src/widget/components/OriginTransferInformation.tsx +2 -2
  175. package/src/widget/components/Pay.tsx +27 -7
  176. package/src/widget/components/PaymentMethods.tsx +10 -10
  177. package/src/widget/components/PoolDeposit.tsx +2 -2
  178. package/src/widget/components/QrCode.tsx +13 -11
  179. package/src/widget/components/QuoteDetails.tsx +16 -6
  180. package/src/widget/components/Receipt.tsx +66 -6
  181. package/src/widget/components/ReceiptRecoverableFunds.tsx +135 -0
  182. package/src/widget/components/RecipientSelectorButton.tsx +6 -17
  183. package/src/widget/components/Recipients.tsx +38 -29
  184. package/src/widget/components/Swap.tsx +2 -25
  185. package/src/widget/components/TokenList.tsx +2 -2
  186. package/src/widget/components/TokenSelector.tsx +11 -11
  187. package/src/widget/components/TokenSelectorButton.tsx +3 -3
  188. package/src/widget/components/TrailsHookModal.tsx +1 -1
  189. package/src/widget/components/TransactionDetails.tsx +43 -37
  190. package/src/widget/components/TransactionHistoryItem.tsx +1 -42
  191. package/src/widget/components/TransferPendingVertical.tsx +11 -4
  192. package/src/widget/components/TruncatedTransactionHash.tsx +5 -0
  193. package/src/widget/components/WalletConfirmation.tsx +5 -8
  194. package/src/widget/components/WalletConnect.tsx +6 -2
  195. package/src/widget/components/WidgetProviders.tsx +34 -43
  196. package/src/widget/components/Withdraw.tsx +25 -11
  197. package/src/widget/hooks/useClickTracking.ts +5 -0
  198. package/src/widget/hooks/useDebugScreens.ts +40 -86
  199. package/src/widget/hooks/useDepositMonitor.ts +14 -149
  200. package/src/widget/hooks/useExternalFundingReceiptSync.ts +79 -0
  201. package/src/widget/hooks/useIntentReceiptBalances.ts +141 -0
  202. package/src/widget/hooks/useQuote.ts +7 -16
  203. package/src/widget/hooks/useScreenTracking.ts +14 -0
  204. package/src/widget/hooks/useSelectedFundMethod.tsx +0 -5
  205. package/src/widget/hooks/useSendForm.ts +5 -14
  206. package/src/widget/hooks/useTokenList.ts +3 -16
  207. package/src/widget/hooks/useTrailsSendTransaction.ts +1 -5
  208. package/src/widget/hooks/useViewManager.tsx +505 -0
  209. package/src/widget/hooks/useWalletConnectUri.tsx +77 -18
  210. package/src/widget/hooks/useWalletConnectionContext.tsx +1 -1
  211. package/src/widget/index.tsx +1 -0
  212. package/src/widget/providers/TrailsProvider.tsx +0 -41
  213. package/src/widget/styles.ts +1 -1
  214. package/src/widget/types/commonProps.ts +0 -8
  215. package/src/widget/utils/forexRateStore.ts +0 -2
  216. package/src/widget/utils/fundMethodSwitchState.ts +25 -0
  217. package/src/widget/utils/localeStore.ts +0 -1
  218. package/src/widget/utils/viewManagerGuards.ts +49 -0
  219. package/src/widget/widget.tsx +405 -316
  220. package/dist/intentStorage.d.ts +0 -24
  221. package/dist/intentStorage.d.ts.map +0 -1
  222. package/dist/mode.d.ts +0 -2
  223. package/dist/mode.d.ts.map +0 -1
  224. package/dist/widget/hooks/useBack.d.ts +0 -22
  225. package/dist/widget/hooks/useBack.d.ts.map +0 -1
  226. package/dist/widget/hooks/useCurrentScreen.d.ts +0 -13
  227. package/dist/widget/hooks/useCurrentScreen.d.ts.map +0 -1
  228. package/dist/widget/hooks/useInitialRedirect.d.ts +0 -7
  229. package/dist/widget/hooks/useInitialRedirect.d.ts.map +0 -1
  230. package/dist/widget/hooks/useMode.d.ts +0 -20
  231. package/dist/widget/hooks/useMode.d.ts.map +0 -1
  232. package/dist/widget/hooks/usePreviousScreen.d.ts +0 -12
  233. package/dist/widget/hooks/usePreviousScreen.d.ts.map +0 -1
  234. package/dist/widget/workers/intentExecutionWorker.d.ts +0 -73
  235. package/dist/widget/workers/intentExecutionWorker.d.ts.map +0 -1
  236. package/src/intentStorage.ts +0 -106
  237. package/src/mode.ts +0 -1
  238. package/src/widget/hooks/useBack.tsx +0 -210
  239. package/src/widget/hooks/useCurrentScreen.tsx +0 -73
  240. package/src/widget/hooks/useInitialRedirect.tsx +0 -70
  241. package/src/widget/hooks/useMode.tsx +0 -51
  242. package/src/widget/hooks/usePreviousScreen.ts +0 -36
  243. 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 { checkProviderHealth, signWithTimeout } from "./walletUtils.js"
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.getDataToSign])
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.getRecoverTx],
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.sendTransaction({
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.sendTransaction({
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
- // Get chainIds from getSupportedSequenceChains
422
- const sequenceChains = await getSupportedSequenceChains()
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
@@ -236,8 +236,6 @@ export async function attemptUserDepositTx({
236
236
  sequenceIndexerUrl,
237
237
  abortSignal,
238
238
  depositTransaction: depositTransaction,
239
- intentId,
240
- executeIntentFn,
241
239
  })
242
240
  }
243
241
 
@@ -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)