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.
Files changed (307) hide show
  1. package/dist/{ccip-Cg9-lJ6K.js → ccip-CT_An6eM.js} +39 -39
  2. package/dist/chains.d.ts +4 -3
  3. package/dist/chains.d.ts.map +1 -1
  4. package/dist/constants.d.ts +1 -0
  5. package/dist/constants.d.ts.map +1 -1
  6. package/dist/customTokens.d.ts.map +1 -1
  7. package/dist/error.d.ts +1 -0
  8. package/dist/error.d.ts.map +1 -1
  9. package/dist/gasless.d.ts +1 -2
  10. package/dist/gasless.d.ts.map +1 -1
  11. package/dist/{index-DEojZg7b.js → index-RfqL5Foz.js} +56672 -43550
  12. package/dist/index.d.ts +5 -2
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +385 -333
  15. package/dist/intents.d.ts +8 -2
  16. package/dist/intents.d.ts.map +1 -1
  17. package/dist/keyMachineClient.d.ts +9 -0
  18. package/dist/keyMachineClient.d.ts.map +1 -0
  19. package/dist/keymachine/index.d.ts +14 -0
  20. package/dist/keymachine/index.d.ts.map +1 -0
  21. package/dist/keymachine/key-machine.gen.d.ts +461 -0
  22. package/dist/keymachine/key-machine.gen.d.ts.map +1 -0
  23. package/dist/onramp/MeshConnectFlow.d.ts +18 -0
  24. package/dist/onramp/MeshConnectFlow.d.ts.map +1 -0
  25. package/dist/onramp/MeshConnectIframe.d.ts +13 -0
  26. package/dist/onramp/MeshConnectIframe.d.ts.map +1 -0
  27. package/dist/onramp/SendFromExchangeButton.d.ts +16 -0
  28. package/dist/onramp/SendFromExchangeButton.d.ts.map +1 -0
  29. package/dist/onramp/TrailsOnRampProvider.d.ts +31 -0
  30. package/dist/onramp/TrailsOnRampProvider.d.ts.map +1 -0
  31. package/dist/onramp/index.d.ts +13 -0
  32. package/dist/onramp/index.d.ts.map +1 -0
  33. package/dist/onramp/meshconnect.d.ts +30 -0
  34. package/dist/onramp/meshconnect.d.ts.map +1 -0
  35. package/dist/onramp/trailsOnramp.d.ts +24 -0
  36. package/dist/onramp/trailsOnramp.d.ts.map +1 -0
  37. package/dist/onramp-client/index.d.ts +3 -3
  38. package/dist/onramp-client/index.d.ts.map +1 -1
  39. package/dist/paymasterSend.d.ts.map +1 -1
  40. package/dist/prepareSend.d.ts.map +1 -1
  41. package/dist/query/balance.fetchers.d.ts +31 -2
  42. package/dist/query/balance.fetchers.d.ts.map +1 -1
  43. package/dist/query/balance.hooks.d.ts +21 -2
  44. package/dist/query/balance.hooks.d.ts.map +1 -1
  45. package/dist/query/balance.queries.d.ts +18 -1
  46. package/dist/query/balance.queries.d.ts.map +1 -1
  47. package/dist/query/chains.queries.d.ts.map +1 -1
  48. package/dist/query/meld.fetchers.d.ts +1 -1
  49. package/dist/query/meld.fetchers.d.ts.map +1 -1
  50. package/dist/query/meld.hooks.d.ts +3 -3
  51. package/dist/query/meld.hooks.d.ts.map +1 -1
  52. package/dist/query/meld.queries.d.ts +1 -1
  53. package/dist/query/meld.queries.d.ts.map +1 -1
  54. package/dist/query/price.fetchers.d.ts +15 -0
  55. package/dist/query/price.fetchers.d.ts.map +1 -0
  56. package/dist/query/price.hooks.d.ts +352 -0
  57. package/dist/query/price.hooks.d.ts.map +1 -0
  58. package/dist/query/price.queries.d.ts +34 -0
  59. package/dist/query/price.queries.d.ts.map +1 -0
  60. package/dist/query/tokenList.queries.d.ts +54 -0
  61. package/dist/query/tokenList.queries.d.ts.map +1 -0
  62. package/dist/recover.d.ts +6 -4
  63. package/dist/recover.d.ts.map +1 -1
  64. package/dist/tokens.d.ts +13 -0
  65. package/dist/tokens.d.ts.map +1 -1
  66. package/dist/transactionIntent/deposits/depositOrchestrator.d.ts +2 -2
  67. package/dist/transactionIntent/deposits/depositOrchestrator.d.ts.map +1 -1
  68. package/dist/transactionIntent/deposits/gaslessDeposit.d.ts +2 -2
  69. package/dist/transactionIntent/deposits/gaslessDeposit.d.ts.map +1 -1
  70. package/dist/transactionIntent/deposits/standardDeposit.d.ts +1 -1
  71. package/dist/transactionIntent/deposits/standardDeposit.d.ts.map +1 -1
  72. package/dist/transactionIntent/handlers/intentHandler.d.ts.map +1 -1
  73. package/dist/transactionIntent/helpers/transactionStateHelpers.d.ts.map +1 -1
  74. package/dist/transactionIntent/quote/normalizeQuote.d.ts.map +1 -1
  75. package/dist/transactionIntent/types.d.ts +1 -1
  76. package/dist/transactionIntent/types.d.ts.map +1 -1
  77. package/dist/transactions.d.ts +4 -0
  78. package/dist/transactions.d.ts.map +1 -1
  79. package/dist/umd/trails.min.js +291 -202
  80. package/dist/utils/format.d.ts +7 -0
  81. package/dist/utils/format.d.ts.map +1 -1
  82. package/dist/walletUtils.d.ts +2 -1
  83. package/dist/walletUtils.d.ts.map +1 -1
  84. package/dist/wallets.d.ts +13 -54
  85. package/dist/wallets.d.ts.map +1 -1
  86. package/dist/widget/components/AccountIntentTransactionHistory.d.ts.map +1 -1
  87. package/dist/widget/components/ClassicSwap.d.ts.map +1 -1
  88. package/dist/widget/components/ConnectWallet.d.ts.map +1 -1
  89. package/dist/widget/components/ConnectedWallets.d.ts.map +1 -1
  90. package/dist/widget/components/DirectTransfer.d.ts +1 -1
  91. package/dist/widget/components/DirectTransfer.d.ts.map +1 -1
  92. package/dist/widget/components/EarnPools.d.ts.map +1 -1
  93. package/dist/widget/components/ExecutionStatusBadge.d.ts.map +1 -1
  94. package/dist/widget/components/Fund.d.ts.map +1 -1
  95. package/dist/widget/components/FundMethods.d.ts.map +1 -1
  96. package/dist/widget/components/HighPriceImpactBlock.d.ts +7 -0
  97. package/dist/widget/components/HighPriceImpactBlock.d.ts.map +1 -0
  98. package/dist/widget/components/MeldHistory.d.ts.map +1 -1
  99. package/dist/widget/components/MeshExchangeSelection.d.ts +11 -0
  100. package/dist/widget/components/MeshExchangeSelection.d.ts.map +1 -0
  101. package/dist/widget/components/OnrampHistoryRow.d.ts +1 -1
  102. package/dist/widget/components/OnrampHistoryRow.d.ts.map +1 -1
  103. package/dist/widget/components/OnrampProviderConfirmation.d.ts.map +1 -1
  104. package/dist/widget/components/Pay.d.ts.map +1 -1
  105. package/dist/widget/components/PoolDeposit.d.ts.map +1 -1
  106. package/dist/widget/components/PoolWithdraw.d.ts.map +1 -1
  107. package/dist/widget/components/QRCodeWalletSelect.d.ts +1 -1
  108. package/dist/widget/components/QRCodeWalletSelect.d.ts.map +1 -1
  109. package/dist/widget/components/QuoteDetails.d.ts.map +1 -1
  110. package/dist/widget/components/Receipt.d.ts.map +1 -1
  111. package/dist/widget/components/Recipients.d.ts.map +1 -1
  112. package/dist/widget/components/RefundWarning.d.ts.map +1 -1
  113. package/dist/widget/components/TokenSelector.d.ts.map +1 -1
  114. package/dist/widget/components/TransactionDetails.d.ts.map +1 -1
  115. package/dist/widget/components/TransactionHistoryItem.d.ts +2 -0
  116. package/dist/widget/components/TransactionHistoryItem.d.ts.map +1 -1
  117. package/dist/widget/components/TransferPendingVertical.d.ts +1 -0
  118. package/dist/widget/components/TransferPendingVertical.d.ts.map +1 -1
  119. package/dist/widget/components/WaasFeeOptions.d.ts.map +1 -1
  120. package/dist/widget/components/WalletConnect.d.ts.map +1 -1
  121. package/dist/widget/components/WalletImage.d.ts.map +1 -1
  122. package/dist/widget/components/WalletList.d.ts.map +1 -1
  123. package/dist/widget/components/Withdraw.d.ts.map +1 -1
  124. package/dist/widget/css/compiled.css +1 -1
  125. package/dist/widget/hooks/useAddressWalletIcon.d.ts.map +1 -1
  126. package/dist/widget/hooks/useCombinedHistory.d.ts +6 -5
  127. package/dist/widget/hooks/useCombinedHistory.d.ts.map +1 -1
  128. package/dist/widget/hooks/useCustomTokenSearch.d.ts +6 -1
  129. package/dist/widget/hooks/useCustomTokenSearch.d.ts.map +1 -1
  130. package/dist/widget/hooks/useDefaultDestinationToken.d.ts.map +1 -1
  131. package/dist/widget/hooks/useDefaultOriginToken.d.ts.map +1 -1
  132. package/dist/widget/hooks/useFiatOnRampCurrencies.d.ts +1 -1
  133. package/dist/widget/hooks/useFiatOnRampCurrencies.d.ts.map +1 -1
  134. package/dist/widget/hooks/useGetIntent.d.ts +3 -2
  135. package/dist/widget/hooks/useGetIntent.d.ts.map +1 -1
  136. package/dist/widget/hooks/useIntentReceiptBalances.d.ts +1 -1
  137. package/dist/widget/hooks/useIntentReceiptBalances.d.ts.map +1 -1
  138. package/dist/widget/hooks/useIntentTransactionHistory.d.ts +3 -2
  139. package/dist/widget/hooks/useIntentTransactionHistory.d.ts.map +1 -1
  140. package/dist/widget/hooks/useMeldTransactionHistory.d.ts +1 -1
  141. package/dist/widget/hooks/useMeldTransactionHistory.d.ts.map +1 -1
  142. package/dist/widget/hooks/useMeldTransactionStatus.d.ts +1 -1
  143. package/dist/widget/hooks/useMeldTransactionStatus.d.ts.map +1 -1
  144. package/dist/widget/hooks/useOnRampQuote.d.ts +1 -1
  145. package/dist/widget/hooks/useOnRampQuote.d.ts.map +1 -1
  146. package/dist/widget/hooks/useOnRampTransactionStatus.d.ts +1 -1
  147. package/dist/widget/hooks/useOnRampTransactionStatus.d.ts.map +1 -1
  148. package/dist/widget/hooks/useQuote.d.ts +2 -2
  149. package/dist/widget/hooks/useQuote.d.ts.map +1 -1
  150. package/dist/widget/hooks/useSelectedFundMethod.d.ts +7 -0
  151. package/dist/widget/hooks/useSelectedFundMethod.d.ts.map +1 -1
  152. package/dist/widget/hooks/useSendForm.d.ts +0 -1
  153. package/dist/widget/hooks/useSendForm.d.ts.map +1 -1
  154. package/dist/widget/hooks/useTokenList.d.ts +7 -1
  155. package/dist/widget/hooks/useTokenList.d.ts.map +1 -1
  156. package/dist/widget/hooks/useViewManager.d.ts +1 -1
  157. package/dist/widget/hooks/useViewManager.d.ts.map +1 -1
  158. package/dist/widget/index.js +1 -1
  159. package/dist/widget/providers/TrailsProvider.d.ts +2 -0
  160. package/dist/widget/providers/TrailsProvider.d.ts.map +1 -1
  161. package/dist/widget/utils/createWagmiConfig.d.ts +2 -2
  162. package/dist/widget/utils/createWagmiConfig.d.ts.map +1 -1
  163. package/dist/widget/utils/fundMethodSwitchState.d.ts +1 -0
  164. package/dist/widget/utils/fundMethodSwitchState.d.ts.map +1 -1
  165. package/dist/widget/utils/historyFilters.d.ts +13 -0
  166. package/dist/widget/utils/historyFilters.d.ts.map +1 -0
  167. package/dist/widget/utils/meldProviderUtils.d.ts +1 -1
  168. package/dist/widget/utils/meldProviderUtils.d.ts.map +1 -1
  169. package/dist/widget/utils/meshSupportedTokens.d.ts +4 -0
  170. package/dist/widget/utils/meshSupportedTokens.d.ts.map +1 -0
  171. package/dist/widget/utils/onrampConfig.d.ts +11 -0
  172. package/dist/widget/utils/onrampConfig.d.ts.map +1 -0
  173. package/dist/widget/utils/statusLabel.d.ts +2 -0
  174. package/dist/widget/utils/statusLabel.d.ts.map +1 -0
  175. package/dist/widget/utils/trailsOnrampConfig.d.ts +18 -0
  176. package/dist/widget/utils/trailsOnrampConfig.d.ts.map +1 -0
  177. package/dist/widget/widget.d.ts +24 -8
  178. package/dist/widget/widget.d.ts.map +1 -1
  179. package/package.json +9 -7
  180. package/src/chains.ts +26 -9
  181. package/src/constants.ts +2 -0
  182. package/src/customTokens.ts +22 -7
  183. package/src/error.ts +7 -0
  184. package/src/gasless.ts +5 -2
  185. package/src/index.ts +8 -5
  186. package/src/intents.ts +56 -60
  187. package/src/keyMachineClient.ts +29 -0
  188. package/src/keymachine/index.ts +175 -0
  189. package/src/keymachine/key-machine.gen.ts +993 -0
  190. package/src/onramp/MeshConnectFlow.tsx +86 -0
  191. package/src/onramp/MeshConnectIframe.tsx +661 -0
  192. package/src/onramp/SendFromExchangeButton.tsx +81 -0
  193. package/src/onramp/TrailsOnRampProvider.tsx +59 -0
  194. package/src/onramp/index.ts +31 -0
  195. package/src/onramp/meshconnect.ts +277 -0
  196. package/src/onramp/trailsOnramp.tsx +130 -0
  197. package/src/onramp-client/index.ts +4 -6
  198. package/src/paymasterSend.ts +0 -5
  199. package/src/prepareSend.ts +45 -44
  200. package/src/query/balance.fetchers.ts +172 -17
  201. package/src/query/balance.hooks.ts +69 -6
  202. package/src/query/balance.queries.ts +63 -0
  203. package/src/query/chains.queries.ts +1 -6
  204. package/src/query/meld.fetchers.ts +1 -1
  205. package/src/query/meld.hooks.ts +1 -1
  206. package/src/query/meld.queries.ts +1 -1
  207. package/src/query/price.fetchers.ts +53 -0
  208. package/src/query/price.hooks.ts +46 -0
  209. package/src/query/price.queries.ts +364 -0
  210. package/src/query/tokenList.queries.ts +118 -0
  211. package/src/recover.ts +89 -26
  212. package/src/tokens.ts +108 -26
  213. package/src/transactionIntent/deposits/depositOrchestrator.ts +11 -11
  214. package/src/transactionIntent/deposits/gaslessDeposit.ts +38 -39
  215. package/src/transactionIntent/deposits/standardDeposit.ts +5 -30
  216. package/src/transactionIntent/handlers/intentHandler.ts +29 -12
  217. package/src/transactionIntent/helpers/transactionStateHelpers.ts +5 -2
  218. package/src/transactionIntent/quote/normalizeQuote.ts +11 -5
  219. package/src/transactionIntent/types.ts +1 -1
  220. package/src/transactions.ts +5 -1
  221. package/src/utils/format.ts +85 -1
  222. package/src/walletUtils.ts +2 -1
  223. package/src/wallets.ts +184 -380
  224. package/src/widget/compiled.css +1 -1
  225. package/src/widget/components/AccountIntentTransactionHistory.tsx +134 -109
  226. package/src/widget/components/ClassicSwap.tsx +26 -24
  227. package/src/widget/components/ConnectWallet.tsx +4 -2
  228. package/src/widget/components/ConnectedWallets.tsx +2 -5
  229. package/src/widget/components/DirectTransfer.tsx +5 -2
  230. package/src/widget/components/EarnPools.tsx +1 -2
  231. package/src/widget/components/ExecutionStatusBadge.tsx +10 -4
  232. package/src/widget/components/Fund.tsx +169 -110
  233. package/src/widget/components/FundMethods.tsx +5 -9
  234. package/src/widget/components/HighPriceImpactBlock.tsx +44 -0
  235. package/src/widget/components/MeldHistory.tsx +4 -28
  236. package/src/widget/components/MeshExchangeSelection.tsx +218 -0
  237. package/src/widget/components/OnrampHistoryRow.tsx +3 -27
  238. package/src/widget/components/OnrampProviderConfirmation.tsx +0 -25
  239. package/src/widget/components/Pay.tsx +20 -36
  240. package/src/widget/components/PoolDeposit.tsx +14 -24
  241. package/src/widget/components/PoolWithdraw.tsx +1 -63
  242. package/src/widget/components/QRCodeWalletSelect.tsx +5 -2
  243. package/src/widget/components/QuoteDetails.tsx +113 -106
  244. package/src/widget/components/Receipt.tsx +0 -11
  245. package/src/widget/components/Recipients.tsx +2 -1
  246. package/src/widget/components/RefundWarning.tsx +5 -10
  247. package/src/widget/components/ThemeProvider.tsx +4 -4
  248. package/src/widget/components/TokenSelector.tsx +85 -16
  249. package/src/widget/components/TransactionDetails.tsx +46 -0
  250. package/src/widget/components/TransactionHistoryItem.tsx +14 -23
  251. package/src/widget/components/TransferPendingVertical.tsx +17 -11
  252. package/src/widget/components/WaasFeeOptions.tsx +4 -42
  253. package/src/widget/components/WalletConnect.tsx +2 -5
  254. package/src/widget/components/WalletImage.tsx +6 -18
  255. package/src/widget/components/WalletList.tsx +1 -1
  256. package/src/widget/components/Withdraw.tsx +22 -23
  257. package/src/widget/hooks/useAddressWalletIcon.ts +2 -1
  258. package/src/widget/hooks/useAmountUsd.ts +1 -1
  259. package/src/widget/hooks/useCombinedHistory.ts +37 -93
  260. package/src/widget/hooks/useCustomTokenSearch.tsx +63 -33
  261. package/src/widget/hooks/useDefaultDestinationToken.tsx +2 -5
  262. package/src/widget/hooks/useDefaultOriginToken.tsx +2 -5
  263. package/src/widget/hooks/useFiatOnRampCurrencies.ts +1 -1
  264. package/src/widget/hooks/useGetIntent.ts +5 -4
  265. package/src/widget/hooks/useIntentReceiptBalances.ts +3 -3
  266. package/src/widget/hooks/useIntentTransactionHistory.ts +24 -47
  267. package/src/widget/hooks/useMeldTransactionHistory.ts +4 -2
  268. package/src/widget/hooks/useMeldTransactionStatus.ts +13 -11
  269. package/src/widget/hooks/useOnRampQuote.ts +3 -3
  270. package/src/widget/hooks/useOnRampTransactionStatus.ts +8 -6
  271. package/src/widget/hooks/useQuote.ts +56 -48
  272. package/src/widget/hooks/useSelectedFundMethod.tsx +14 -1
  273. package/src/widget/hooks/useSendForm.ts +52 -31
  274. package/src/widget/hooks/useTokenList.ts +209 -140
  275. package/src/widget/hooks/useTrailsSendTransaction.ts +1 -1
  276. package/src/widget/hooks/useViewManager.tsx +1 -0
  277. package/src/widget/providers/TrailsProvider.tsx +5 -0
  278. package/src/widget/styles.ts +1 -1
  279. package/src/widget/utils/createWagmiConfig.ts +7 -2
  280. package/src/widget/utils/fundMethodSwitchState.ts +2 -0
  281. package/src/widget/utils/historyFilters.ts +157 -0
  282. package/src/widget/utils/meldProviderUtils.ts +8 -2
  283. package/src/widget/utils/meshSupportedTokens.ts +28 -0
  284. package/src/widget/utils/onrampConfig.ts +15 -0
  285. package/src/widget/utils/statusLabel.ts +3 -0
  286. package/src/widget/utils/trailsOnrampConfig.ts +39 -0
  287. package/src/widget/widget.tsx +235 -185
  288. package/dist/onramp-client/trails-onramp.gen.d.ts +0 -570
  289. package/dist/onramp-client/trails-onramp.gen.d.ts.map +0 -1
  290. package/dist/prices.d.ts +0 -34
  291. package/dist/prices.d.ts.map +0 -1
  292. package/dist/useGasEstimation.d.ts +0 -34
  293. package/dist/useGasEstimation.d.ts.map +0 -1
  294. package/dist/widget/hooks/useCustomTokenFetch.d.ts +0 -19
  295. package/dist/widget/hooks/useCustomTokenFetch.d.ts.map +0 -1
  296. package/dist/widget/hooks/useTokenWithFreshBalance.d.ts +0 -18
  297. package/dist/widget/hooks/useTokenWithFreshBalance.d.ts.map +0 -1
  298. package/src/onramp-client/trails-onramp.gen.ts +0 -1320
  299. package/src/prices.ts +0 -528
  300. package/src/useGasEstimation.ts +0 -147
  301. package/src/widget/assets/Binance_Icon_Logo.svg +0 -14
  302. package/src/widget/assets/Bitfinex_Icon_Logo.svg +0 -5
  303. package/src/widget/assets/Coinbase_Icon_Logo.svg +0 -1
  304. package/src/widget/assets/WalletConnect-logo-blue-bg.svg +0 -11
  305. package/src/widget/assets/sequence-logo.svg +0 -15
  306. package/src/widget/hooks/useCustomTokenFetch.tsx +0 -74
  307. package/src/widget/hooks/useTokenWithFreshBalance.ts +0 -246
@@ -6,7 +6,7 @@ import {
6
6
  TriangleAlert,
7
7
  } from "lucide-react"
8
8
  import type React from "react"
9
- import { useCallback, useEffect, useRef, useState } from "react"
9
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react"
10
10
  import { getExplorerUrl, getExplorerUrlForAddress } from "../../explorer.js"
11
11
  import { logger } from "../../logger.js"
12
12
  import type { MeldQuote } from "../../meld/utils/meld.js"
@@ -67,6 +67,12 @@ export const QuoteDetails: React.FC<QuoteDetailsProps> = ({
67
67
  const [showCalldata, setShowCalldata] = useState(false)
68
68
  const [showOriginRate, setShowOriginRate] = useState(true)
69
69
  const [isExpanded, setIsExpanded] = useState(initialExpanded)
70
+ const [prevInitialExpanded, setPrevInitialExpanded] =
71
+ useState(initialExpanded)
72
+ if (initialExpanded !== prevInitialExpanded) {
73
+ setPrevInitialExpanded(initialExpanded)
74
+ setIsExpanded(initialExpanded)
75
+ }
70
76
  const containerRef = useRef<HTMLDivElement>(null)
71
77
  const { trailsAppUrl } = useTrails()
72
78
  const calldataRef = useRef<HTMLDivElement>(null)
@@ -86,13 +92,6 @@ export const QuoteDetails: React.FC<QuoteDetailsProps> = ({
86
92
  })
87
93
  }
88
94
 
89
- // Sync with initialExpanded prop changes
90
- useEffect(() => {
91
- if (initialExpanded !== undefined) {
92
- setIsExpanded(initialExpanded)
93
- }
94
- }, [initialExpanded])
95
-
96
95
  // Notify parent when expansion state changes
97
96
  useEffect(() => {
98
97
  onExpand?.(isExpanded)
@@ -132,42 +131,48 @@ export const QuoteDetails: React.FC<QuoteDetailsProps> = ({
132
131
  }
133
132
  }, [onRampQuote, quote])
134
133
 
135
- // Calculate total fees in USD
136
- const [totalFeeUsd, setTotalFeeUsd] = useState(0)
137
- const [totalFeeUsdDisplay, setTotalFeeUsdDisplay] = useState("$0.00")
138
- const [totalFeeUsdLocaleDisplay, setTotalFeeUsdLocaleDisplay] =
139
- useState("$0.00")
140
-
141
- useEffect(() => {
142
- if (onRampQuote) {
143
- const feeInUsd =
144
- totalOnRampFeeInUsd + parseFloat(quote?.fees.totalFeeAmountUsd || "0")
145
-
146
- setTotalFeeUsd(feeInUsd)
147
- setTotalFeeUsdDisplay(formatUsdAmountDisplay(feeInUsd))
148
- setTotalFeeUsdLocaleDisplay(formatUsdAmountLocaleDisplay(feeInUsd))
149
- } else if (quote?.fees?.totalFeeAmountUsd) {
150
- const feeInUsd = parseFloat(quote.fees.totalFeeAmountUsd)
151
- setTotalFeeUsd(feeInUsd)
152
- setTotalFeeUsdDisplay(
153
- quote.fees.totalFeeAmountUsdDisplay ?? formatUsdAmountDisplay(feeInUsd),
154
- )
155
- setTotalFeeUsdLocaleDisplay(
156
- quote.fees.totalFeeAmountUsdLocaleDisplay ??
157
- formatUsdAmountLocaleDisplay(feeInUsd),
158
- )
159
- } else {
160
- setTotalFeeUsd(0)
161
- setTotalFeeUsdDisplay("$0.00")
162
- setTotalFeeUsdLocaleDisplay(formatUsdAmountLocaleDisplay(0))
163
- }
164
- }, [onRampQuote, quote?.fees, totalOnRampFeeInUsd])
134
+ const { totalFeeUsd, totalFeeUsdDisplay, totalFeeUsdLocaleDisplay } =
135
+ useMemo(() => {
136
+ if (onRampQuote) {
137
+ const feeInUsd =
138
+ totalOnRampFeeInUsd + parseFloat(quote?.fees.totalFeeAmountUsd || "0")
139
+ return {
140
+ totalFeeUsd: feeInUsd,
141
+ totalFeeUsdDisplay: formatUsdAmountDisplay(feeInUsd),
142
+ totalFeeUsdLocaleDisplay: formatUsdAmountLocaleDisplay(feeInUsd),
143
+ }
144
+ }
145
+ if (quote?.fees?.totalFeeAmountUsd) {
146
+ const feeInUsd = parseFloat(quote.fees.totalFeeAmountUsd)
147
+ return {
148
+ totalFeeUsd: feeInUsd,
149
+ totalFeeUsdDisplay:
150
+ quote.fees.totalFeeAmountUsdDisplay ??
151
+ formatUsdAmountDisplay(feeInUsd),
152
+ totalFeeUsdLocaleDisplay:
153
+ quote.fees.totalFeeAmountUsdLocaleDisplay ??
154
+ formatUsdAmountLocaleDisplay(feeInUsd),
155
+ }
156
+ }
157
+ return {
158
+ totalFeeUsd: 0,
159
+ totalFeeUsdDisplay: "$0.00",
160
+ totalFeeUsdLocaleDisplay: formatUsdAmountLocaleDisplay(0),
161
+ }
162
+ }, [onRampQuote, quote?.fees, totalOnRampFeeInUsd])
165
163
 
166
164
  const parseSlippageTolerance = useCallback(() => {
167
165
  if (!quote?.slippageTolerance) return null
168
166
  return parseFloat(quote.slippageTolerance) * 100
169
167
  }, [quote?.slippageTolerance])
170
168
 
169
+ const protocolVersionDisplay = useMemo(() => {
170
+ const normalized = (quote?.intentProtocol || "v1")
171
+ .replace("_", ".")
172
+ .toUpperCase()
173
+ return normalized.startsWith("V") ? normalized : `V${normalized}`
174
+ }, [quote?.intentProtocol])
175
+
171
176
  if (!showContent) return null
172
177
 
173
178
  return (
@@ -996,38 +1001,40 @@ export const QuoteDetails: React.FC<QuoteDetailsProps> = ({
996
1001
  {/* Custom Calldata */}
997
1002
  {quote?.destinationCalldata && (
998
1003
  <div className="space-y-2">
999
- <button
1000
- type="button"
1001
- onClick={() => {
1002
- setShowCalldata(!showCalldata)
1003
- // Auto-scroll to calldata when expanding
1004
- if (!showCalldata) {
1005
- setTimeout(() => {
1006
- if (calldataRef.current) {
1007
- calldataRef.current.scrollIntoView({
1008
- behavior: "smooth",
1009
- block: "nearest",
1010
- })
1011
- }
1012
- }, 150) // Delay to let the expansion animation start
1004
+ <div className="space-y-0.5">
1005
+ <button
1006
+ type="button"
1007
+ onClick={() => {
1008
+ setShowCalldata(!showCalldata)
1009
+ // Auto-scroll to calldata when expanding
1010
+ if (!showCalldata) {
1011
+ setTimeout(() => {
1012
+ if (calldataRef.current) {
1013
+ calldataRef.current.scrollIntoView({
1014
+ behavior: "smooth",
1015
+ block: "nearest",
1016
+ })
1017
+ }
1018
+ }, 150) // Delay to let the expansion animation start
1019
+ }
1020
+ }}
1021
+ className="flex items-center gap-1 text-xs hover:underline cursor-pointer transition-colors duration-200 text-gray-600 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"
1022
+ aria-label={
1023
+ showCalldata
1024
+ ? "Hide custom calldata"
1025
+ : "Show custom calldata"
1013
1026
  }
1014
- }}
1015
- className="flex items-center gap-1 text-xs hover:underline cursor-pointer transition-colors duration-200 text-gray-600 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"
1016
- aria-label={
1017
- showCalldata
1018
- ? "Hide custom calldata"
1019
- : "Show custom calldata"
1020
- }
1021
- >
1022
- <span className="text-[10px]">
1023
- Includes custom destination calldata
1024
- </span>
1025
- <ChevronDown
1026
- className={`size-3 transition-transform duration-300 ease-out ${
1027
- showCalldata ? "rotate-180" : ""
1028
- }`}
1029
- />
1030
- </button>
1027
+ >
1028
+ <span className="text-[10px]">
1029
+ Includes custom destination calldata
1030
+ </span>
1031
+ <ChevronDown
1032
+ className={`size-3 transition-transform duration-300 ease-out ${
1033
+ showCalldata ? "rotate-180" : ""
1034
+ }`}
1035
+ />
1036
+ </button>
1037
+ </div>
1031
1038
  <div
1032
1039
  ref={calldataRef}
1033
1040
  className={`overflow-hidden transition-all duration-300 ease-out ${
@@ -1137,49 +1144,43 @@ export const QuoteDetails: React.FC<QuoteDetailsProps> = ({
1137
1144
  )}
1138
1145
  </span>
1139
1146
  </div>
1140
- {hasLiveStates && (
1147
+ {hasLiveStates && hasTxHash && txExplorerUrl && (
1141
1148
  <div className="mt-1 flex justify-between items-center">
1142
1149
  <span className="text-xs text-gray-600 dark:text-gray-400">
1143
1150
  Hash
1144
1151
  </span>
1145
- {hasTxHash && txExplorerUrl ? (
1146
- <a
1147
- href={txExplorerUrl}
1148
- target="_blank"
1149
- rel="noopener noreferrer"
1150
- className="text-xs flex items-center gap-1 hover:underline text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300"
1151
- >
1152
- {txHasMetaError && (
1153
- <svg
1154
- className="w-4 h-4 text-orange-500"
1155
- fill="none"
1156
- viewBox="0 0 24 24"
1157
- stroke="currentColor"
1158
- >
1159
- <title>
1160
- An internal meta transaction failure
1161
- occurred
1162
- </title>
1163
- <path
1164
- strokeLinecap="round"
1165
- strokeLinejoin="round"
1166
- strokeWidth={2}
1167
- d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"
1168
- />
1169
- </svg>
1152
+ <a
1153
+ href={txExplorerUrl}
1154
+ target="_blank"
1155
+ rel="noopener noreferrer"
1156
+ className="text-xs flex items-center gap-1 hover:underline text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300"
1157
+ >
1158
+ {txHasMetaError && (
1159
+ <svg
1160
+ className="w-4 h-4 text-orange-500"
1161
+ fill="none"
1162
+ viewBox="0 0 24 24"
1163
+ stroke="currentColor"
1164
+ >
1165
+ <title>
1166
+ An internal meta transaction failure
1167
+ occurred
1168
+ </title>
1169
+ <path
1170
+ strokeLinecap="round"
1171
+ strokeLinejoin="round"
1172
+ strokeWidth={2}
1173
+ d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"
1174
+ />
1175
+ </svg>
1176
+ )}
1177
+ <span>
1178
+ {truncateAddress(
1179
+ liveTxState.transactionHash,
1170
1180
  )}
1171
- <span>
1172
- {truncateAddress(
1173
- liveTxState.transactionHash,
1174
- )}
1175
- </span>
1176
- <ExternalLink className="w-3 h-3" />
1177
- </a>
1178
- ) : (
1179
- <span className="text-xs text-gray-400 dark:text-gray-500">
1180
- ...
1181
1181
  </span>
1182
- )}
1182
+ <ExternalLink className="w-3 h-3" />
1183
+ </a>
1183
1184
  </div>
1184
1185
  )}
1185
1186
  </div>
@@ -1190,6 +1191,12 @@ export const QuoteDetails: React.FC<QuoteDetailsProps> = ({
1190
1191
  )
1191
1192
  })()}
1192
1193
 
1194
+ {protocolVersionDisplay.length > 0 && (
1195
+ <div className="pt-1 text-[10px] opacity-50 text-gray-600 dark:text-gray-400">
1196
+ Protocol version: {protocolVersionDisplay}
1197
+ </div>
1198
+ )}
1199
+
1193
1200
  {/* Children content */}
1194
1201
  {children && <div className="mb-0">{children}</div>}
1195
1202
  </div>
@@ -5,7 +5,6 @@ import { useEffect, useMemo, useState } from "react"
5
5
  import { useAccount } from "wagmi"
6
6
  import { getChainInfo } from "../../chains.js"
7
7
  import { getExplorerUrl } from "../../explorer.js"
8
- import { logger } from "../../logger.js"
9
8
  import type { PrepareSendQuote } from "../../prepareSend.js"
10
9
  import {
11
10
  type TransactionState,
@@ -302,16 +301,6 @@ export const Receipt: React.FC<ReceiptProps> = ({
302
301
  isDisplayableTransactionHash(tx.transactionHash),
303
302
  )
304
303
 
305
- // Log intent ID if available when aborted (for debugging)
306
- useEffect(() => {
307
- if (hasAborted && quote?.intentId) {
308
- logger.console.error(
309
- "[trails-sdk] Transaction aborted with intent ID:",
310
- quote.intentId,
311
- )
312
- }
313
- }, [hasAborted, quote?.intentId])
314
-
315
304
  if (
316
305
  (!finalExplorerUrl && !shouldShowRefundInfo && !hasAnyTransactionHash) ||
317
306
  (hasFailedOrAborted && !hasRefunded)
@@ -1,4 +1,5 @@
1
1
  import { Plus, X } from "lucide-react"
2
+ import { wagmiConnectorToWalletId } from "@0xtrails/wallet-registry"
2
3
  import type React from "react"
3
4
  import { useCallback, useEffect, useState } from "react"
4
5
  import { isAddress } from "viem"
@@ -6,7 +7,7 @@ import { useAccount, useConnections } from "wagmi"
6
7
  import { useResolveEnsAddress, useResolveEnsName } from "../../ens.js"
7
8
  import { logger } from "../../logger.js"
8
9
  import { addressEqual, truncateAddress } from "../../utils/address.js"
9
- import { useWallets, wagmiConnectorToWalletId } from "../../wallets.js"
10
+ import { useWallets } from "../../wallets.js"
10
11
  import {
11
12
  useViewManager,
12
13
  type Mode,
@@ -9,17 +9,15 @@ interface RefundWarningProps {
9
9
  }
10
10
 
11
11
  export const RefundWarning: React.FC<RefundWarningProps> = ({
12
- fundMethod,
13
12
  isSenderContractOnOrigin,
14
13
  isSenderContractOnDestination,
15
14
  isSequenceWallet = false,
16
15
  }) => {
17
16
  // Determine if we should show the warning
18
17
  const shouldShowWarning =
19
- fundMethod === "onramp-mesh" ||
20
- (isSenderContractOnOrigin &&
21
- !isSenderContractOnDestination &&
22
- !isSequenceWallet)
18
+ isSenderContractOnOrigin &&
19
+ !isSenderContractOnDestination &&
20
+ !isSequenceWallet
23
21
 
24
22
  if (!shouldShowWarning) {
25
23
  return null
@@ -27,16 +25,13 @@ export const RefundWarning: React.FC<RefundWarningProps> = ({
27
25
 
28
26
  // Determine the warning message
29
27
  let warningMessage = ""
30
- if (fundMethod === "onramp-mesh") {
31
- warningMessage =
32
- "Using exchange funding may result in loss of funds if the transaction fails and the sender address cannot accept refunds on the origin chain."
33
- } else if (isSenderContractOnOrigin && !isSenderContractOnDestination) {
28
+ if (isSenderContractOnOrigin && !isSenderContractOnDestination) {
34
29
  warningMessage =
35
30
  "The sender is a contract address. Funds may be lost if the transaction fails and the contract cannot accept refunds on the destination chain."
36
31
  }
37
32
 
38
33
  return (
39
- <div className="px-2 py-3 rounded-lg bg-amber-500/10 border border-solid border-amber-500/30">
34
+ <div className="mb-2 px-2 py-3 rounded-lg bg-amber-500/10 border border-solid border-amber-500/30">
40
35
  <div className="flex items-start space-x-2">
41
36
  <svg
42
37
  className="w-4 h-4 text-amber-500 flex-shrink-0 mt-0.5"
@@ -33,12 +33,12 @@ export const ThemeProvider: React.FC<ThemeProviderProps> = ({
33
33
  }) => {
34
34
  const [theme, setTheme] = useState<Theme>(initialTheme)
35
35
  const [isDark, setIsDark] = useState(getIsDark(initialTheme))
36
-
37
- // Update theme when initialTheme prop changes
38
- useEffect(() => {
36
+ const [prevInitialTheme, setPrevInitialTheme] = useState(initialTheme)
37
+ if (initialTheme !== prevInitialTheme) {
38
+ setPrevInitialTheme(initialTheme)
39
39
  setTheme(initialTheme)
40
40
  setIsDark(getIsDark(initialTheme))
41
- }, [initialTheme])
41
+ }
42
42
 
43
43
  // Listen for system theme changes when in auto mode
44
44
  useEffect(() => {
@@ -11,6 +11,7 @@ import {
11
11
  useRef,
12
12
  useState,
13
13
  } from "react"
14
+ import { isAddress } from "viem"
14
15
  import { useAccount } from "wagmi"
15
16
  import { getChainInfo } from "../../chains.js"
16
17
  import type { Token } from "../../tokens.js"
@@ -24,7 +25,6 @@ import {
24
25
  import { isValueZero } from "../../utils.js"
25
26
  import { useBalanceVisible } from "../hooks/useBalanceVisible.js"
26
27
  import { useChainFilter } from "../hooks/useChainFilter.js"
27
- import { useCustomTokenSearch } from "../hooks/useCustomTokenSearch.js"
28
28
  import { useTokenList } from "../hooks/useTokenList.js"
29
29
  import { useSupportedChains } from "../../query/chains.hooks.js"
30
30
  import { ChainFilterDropdown } from "./ChainFilterDropdown.js"
@@ -409,10 +409,13 @@ export const TokenSelector: React.FC<TokenSelectorProps> = ({
409
409
  setSearchQuery,
410
410
  handleTokenSelect,
411
411
  filteredTokens,
412
+ chainFilteredTokens: rawChainFilteredTokens,
413
+ foundTokensAllChains,
412
414
  isLoadingTokens,
415
+ isLoadingCustomToken,
413
416
  isSearching,
417
+ customTokenError,
414
418
  isTokenSelected,
415
- filteredTokensFormatted,
416
419
  balanceError,
417
420
  } = useTokenList({
418
421
  onContinue: onTokenSelect, // Use onTokenSelect for the hook
@@ -428,20 +431,25 @@ export const TokenSelector: React.FC<TokenSelectorProps> = ({
428
431
  } = useChainFilter()
429
432
  const { data: supportedChains = [] } = useSupportedChains()
430
433
 
431
- // Handle custom token search and integration
432
- // Only enable custom token search after initial load is complete
433
- const {
434
- chainFilteredTokens: rawChainFilteredTokens,
435
- isLoadingCustomToken,
436
- customTokenError,
437
- } = useCustomTokenSearch({
438
- searchQuery: hasInitiallyLoaded ? searchQuery : "", // Disable during initial load
439
- filteredTokensFormatted,
440
- filterByChainId,
441
- })
442
-
443
434
  const chainFilteredTokens = useDeferredValue(rawChainFilteredTokens)
444
435
 
436
+ // When searching by address with a chain filter active, the token may not
437
+ // exist on the selected chain but may have been found on other chains.
438
+ // Compute those "other chain" results so we can offer them to the user.
439
+ const tokensFoundOnOtherChains = useMemo(() => {
440
+ if (
441
+ filterByChainId === null ||
442
+ chainFilteredTokens.length > 0 ||
443
+ foundTokensAllChains.length === 0 ||
444
+ !isAddress(searchQuery.trim())
445
+ ) {
446
+ return []
447
+ }
448
+ return foundTokensAllChains.filter(
449
+ (t) => (t.chainId || 0) !== filterByChainId,
450
+ )
451
+ }, [filterByChainId, chainFilteredTokens, foundTokensAllChains, searchQuery])
452
+
445
453
  // Track when initial load is complete
446
454
  useEffect(() => {
447
455
  if (!isLoadingTokens && !hasInitiallyLoaded) {
@@ -638,8 +646,69 @@ export const TokenSelector: React.FC<TokenSelectorProps> = ({
638
646
  filteredTokens.length === 0 &&
639
647
  chainFilteredTokens.length === 0 &&
640
648
  errorMessage && (
641
- <div className="text-center py-4 rounded-lg trails-bg-secondary">
642
- <p className="text-gray-500 dark:text-gray-400">{errorMessage}</p>
649
+ <div className="space-y-3">
650
+ <div className="text-center py-4 rounded-lg trails-bg-secondary">
651
+ <p className="text-gray-500 dark:text-gray-400">{errorMessage}</p>
652
+ </div>
653
+
654
+ {/* Show tokens found on other chains when address search has results on non-selected chains */}
655
+ {tokensFoundOnOtherChains.length > 0 && (
656
+ <div className="space-y-2">
657
+ <p className="text-xs font-medium text-gray-500 dark:text-gray-400 px-2">
658
+ {tokensFoundOnOtherChains.length === 1
659
+ ? "Found on another chain"
660
+ : `Found on ${tokensFoundOnOtherChains.length} other chains`}
661
+ </p>
662
+ <div className="max-h-48 overflow-y-auto trails-scrollbar">
663
+ {tokensFoundOnOtherChains.map((token) => {
664
+ const chainInfo = getChainInfo(token.chainId || 0)
665
+ const chainName =
666
+ token.chainName ||
667
+ chainInfo?.name ||
668
+ `Chain ${token.chainId || 0}`
669
+ return (
670
+ <div
671
+ key={`${token.chainId}-${token.contractAddress}`}
672
+ onClick={() => handleTokenSelectWithReset(token)}
673
+ onKeyDown={(e) => {
674
+ if (e.key === "Enter" || e.key === " ") {
675
+ e.preventDefault()
676
+ handleTokenSelectWithReset(token)
677
+ }
678
+ }}
679
+ className="w-full py-2 px-4 flex items-center space-x-3 transition-all duration-200 trails-list-item trails-border-radius-list-button cursor-pointer"
680
+ >
681
+ <div className="relative shrink-0 mr-2">
682
+ <div className="rounded-full flex items-center justify-center bg-gray-100 dark:bg-gray-700">
683
+ {token.contractAddress ? (
684
+ <TokenImage
685
+ symbol={token.symbol}
686
+ imageUrl={token.imageUrl}
687
+ chainId={token.chainId}
688
+ contractAddress={token.contractAddress}
689
+ size={32}
690
+ />
691
+ ) : (
692
+ <span className="text-base font-medium text-gray-600 dark:text-gray-300">
693
+ {token.symbol}
694
+ </span>
695
+ )}
696
+ </div>
697
+ </div>
698
+ <div className="flex-1 min-w-0 text-left">
699
+ <h3 className="text-sm font-medium truncate text-gray-900 dark:text-white">
700
+ {token.name}
701
+ </h3>
702
+ <span className="text-xs text-gray-500 dark:text-gray-400">
703
+ {token.symbol} on {chainName}
704
+ </span>
705
+ </div>
706
+ </div>
707
+ )
708
+ })}
709
+ </div>
710
+ </div>
711
+ )}
643
712
  </div>
644
713
  )}
645
714
 
@@ -95,6 +95,52 @@ export const TransactionDetails: React.FC<TransactionDetailsProps> = ({
95
95
  </div>
96
96
  )}
97
97
 
98
+ {/* Refund Transaction Hash */}
99
+ {isDisplayableTransactionHash(transaction.refundTransactionHash) &&
100
+ (transaction.refundTransactionChainId || transaction.originChainId) && (
101
+ <div className="flex justify-between items-center">
102
+ <span className="text-xs text-gray-600 dark:text-gray-400">
103
+ Refund Tx:
104
+ </span>
105
+ <a
106
+ href={getExplorerUrl({
107
+ txHash: transaction.refundTransactionHash,
108
+ chainId:
109
+ transaction.refundTransactionChainId ||
110
+ transaction.originChainId ||
111
+ 0,
112
+ })}
113
+ target="_blank"
114
+ rel="noopener noreferrer"
115
+ className="text-xs font-mono hover:underline flex items-center gap-1 text-gray-900 dark:text-gray-100"
116
+ >
117
+ <ChainImage
118
+ chainId={
119
+ transaction.refundTransactionChainId ||
120
+ transaction.originChainId ||
121
+ 0
122
+ }
123
+ size={16}
124
+ />
125
+ {truncateAddress(transaction.refundTransactionHash)}
126
+ <svg
127
+ aria-hidden="true"
128
+ className="w-3 h-3"
129
+ fill="none"
130
+ stroke="currentColor"
131
+ viewBox="0 0 24 24"
132
+ >
133
+ <path
134
+ strokeLinecap="round"
135
+ strokeLinejoin="round"
136
+ strokeWidth={2}
137
+ d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
138
+ />
139
+ </svg>
140
+ </a>
141
+ </div>
142
+ )}
143
+
98
144
  {/* Origin Token - Moved before Origin Intent */}
99
145
  {transaction.originToken && (
100
146
  <div className="flex justify-between items-start">