0xtrails 0.1.13 → 0.2.1

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 (256) hide show
  1. package/dist/aave.d.ts.map +1 -1
  2. package/dist/analytics.d.ts +12 -2
  3. package/dist/analytics.d.ts.map +1 -1
  4. package/dist/apiClient.d.ts +1 -1
  5. package/dist/apiClient.d.ts.map +1 -1
  6. package/dist/{ccip-D3gTQONK.js → ccip-BbfANth7.js} +12 -12
  7. package/dist/cctp.d.ts.map +1 -1
  8. package/dist/cctpqueue.d.ts +3 -3
  9. package/dist/cctpqueue.d.ts.map +1 -1
  10. package/dist/chains.d.ts.map +1 -1
  11. package/dist/config.d.ts +18 -5
  12. package/dist/config.d.ts.map +1 -1
  13. package/dist/constants.d.ts +6 -5
  14. package/dist/constants.d.ts.map +1 -1
  15. package/dist/contractUtils.d.ts +2 -0
  16. package/dist/contractUtils.d.ts.map +1 -1
  17. package/dist/customChains.d.ts +24 -0
  18. package/dist/customChains.d.ts.map +1 -0
  19. package/dist/gasless.d.ts +19 -7
  20. package/dist/gasless.d.ts.map +1 -1
  21. package/dist/{index-CnUM7lKf.js → index-WpIVoh3X.js} +36741 -31761
  22. package/dist/index.d.ts +5 -3
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +405 -394
  25. package/dist/indexerClient.d.ts +10 -0
  26. package/dist/indexerClient.d.ts.map +1 -1
  27. package/dist/intentEntrypoint.d.ts +122 -0
  28. package/dist/intentEntrypoint.d.ts.map +1 -0
  29. package/dist/intents.d.ts +5 -3
  30. package/dist/intents.d.ts.map +1 -1
  31. package/dist/metaTxnMonitor.d.ts.map +1 -1
  32. package/dist/morpho.d.ts.map +1 -1
  33. package/dist/pools.d.ts +3 -1
  34. package/dist/pools.d.ts.map +1 -1
  35. package/dist/prepareSend.d.ts +18 -9
  36. package/dist/prepareSend.d.ts.map +1 -1
  37. package/dist/prices.d.ts +1 -1
  38. package/dist/prices.d.ts.map +1 -1
  39. package/dist/relaySdk.d.ts.map +1 -1
  40. package/dist/relayer.d.ts.map +1 -1
  41. package/dist/toast.d.ts +9 -0
  42. package/dist/toast.d.ts.map +1 -0
  43. package/dist/tokenBalances.d.ts +6 -2
  44. package/dist/tokenBalances.d.ts.map +1 -1
  45. package/dist/tokens.d.ts.map +1 -1
  46. package/dist/trails.d.ts +6 -5
  47. package/dist/trails.d.ts.map +1 -1
  48. package/dist/trailsClient.d.ts +12 -0
  49. package/dist/trailsClient.d.ts.map +1 -0
  50. package/dist/trailsRouter.d.ts +22 -0
  51. package/dist/trailsRouter.d.ts.map +1 -0
  52. package/dist/transactions.d.ts +8 -1
  53. package/dist/transactions.d.ts.map +1 -1
  54. package/dist/wallets.d.ts.map +1 -1
  55. package/dist/widget/components/AccountActionsDropdown.d.ts.map +1 -1
  56. package/dist/widget/components/AccountIntentTransactionHistory.d.ts.map +1 -1
  57. package/dist/widget/components/AccountSettings.d.ts +7 -0
  58. package/dist/widget/components/AccountSettings.d.ts.map +1 -0
  59. package/dist/widget/components/ChainList.d.ts +0 -1
  60. package/dist/widget/components/ChainList.d.ts.map +1 -1
  61. package/dist/widget/components/ClassicSwap.d.ts +46 -0
  62. package/dist/widget/components/ClassicSwap.d.ts.map +1 -0
  63. package/dist/widget/components/ConfigDisplay.d.ts.map +1 -1
  64. package/dist/widget/components/ConnectWallet.d.ts.map +1 -1
  65. package/dist/widget/components/ConnectedWallets.d.ts +9 -0
  66. package/dist/widget/components/ConnectedWallets.d.ts.map +1 -0
  67. package/dist/widget/components/DebugMenu.d.ts.map +1 -1
  68. package/dist/widget/components/DebugScreensList.d.ts.map +1 -1
  69. package/dist/widget/components/DebugToast.d.ts +3 -0
  70. package/dist/widget/components/DebugToast.d.ts.map +1 -0
  71. package/dist/widget/components/Earn.d.ts.map +1 -1
  72. package/dist/widget/components/EarnPools.d.ts.map +1 -1
  73. package/dist/widget/components/FeeOption.d.ts +22 -0
  74. package/dist/widget/components/FeeOption.d.ts.map +1 -0
  75. package/dist/widget/components/FeeOptions.d.ts +13 -17
  76. package/dist/widget/components/FeeOptions.d.ts.map +1 -1
  77. package/dist/widget/components/Fund.d.ts +44 -0
  78. package/dist/widget/components/Fund.d.ts.map +1 -0
  79. package/dist/widget/components/FundMethods.d.ts +1 -1
  80. package/dist/widget/components/FundMethods.d.ts.map +1 -1
  81. package/dist/widget/components/FundSendForm.d.ts.map +1 -1
  82. package/dist/widget/components/Identicon.d.ts +9 -0
  83. package/dist/widget/components/Identicon.d.ts.map +1 -0
  84. package/dist/widget/components/MeshConnectExchanges.d.ts +5 -2
  85. package/dist/widget/components/MeshConnectExchanges.d.ts.map +1 -1
  86. package/dist/widget/components/MeshConnectFlow.d.ts +2 -0
  87. package/dist/widget/components/MeshConnectFlow.d.ts.map +1 -1
  88. package/dist/widget/components/NativeGasOption.d.ts +12 -0
  89. package/dist/widget/components/NativeGasOption.d.ts.map +1 -0
  90. package/dist/widget/components/Pay.d.ts +46 -0
  91. package/dist/widget/components/Pay.d.ts.map +1 -0
  92. package/dist/widget/components/PaySendForm.d.ts.map +1 -1
  93. package/dist/widget/components/QuoteDetails.d.ts.map +1 -1
  94. package/dist/widget/components/Receive.d.ts.map +1 -1
  95. package/dist/widget/components/RecentTokens.d.ts.map +1 -1
  96. package/dist/widget/components/Recipients.d.ts +9 -0
  97. package/dist/widget/components/Recipients.d.ts.map +1 -0
  98. package/dist/widget/components/RefundWarning.d.ts +9 -0
  99. package/dist/widget/components/RefundWarning.d.ts.map +1 -0
  100. package/dist/widget/components/SimpleSwap.d.ts.map +1 -1
  101. package/dist/widget/components/Swap.d.ts.map +1 -1
  102. package/dist/widget/components/SwapSettings.d.ts +1 -5
  103. package/dist/widget/components/SwapSettings.d.ts.map +1 -1
  104. package/dist/widget/components/ThemeProvider.d.ts.map +1 -1
  105. package/dist/widget/components/ThemeSyncer.d.ts +6 -0
  106. package/dist/widget/components/ThemeSyncer.d.ts.map +1 -0
  107. package/dist/widget/components/Toast.d.ts +24 -0
  108. package/dist/widget/components/Toast.d.ts.map +1 -0
  109. package/dist/widget/components/TokenList.d.ts.map +1 -1
  110. package/dist/widget/components/TokenSelector.d.ts.map +1 -1
  111. package/dist/widget/components/TransactionDetails.d.ts.map +1 -1
  112. package/dist/widget/components/TruncatedAddress.d.ts +2 -0
  113. package/dist/widget/components/TruncatedAddress.d.ts.map +1 -1
  114. package/dist/widget/components/UserPreferences.d.ts +7 -0
  115. package/dist/widget/components/UserPreferences.d.ts.map +1 -0
  116. package/dist/widget/hooks/useBack.d.ts +2 -0
  117. package/dist/widget/hooks/useBack.d.ts.map +1 -1
  118. package/dist/widget/hooks/useBalanceVisible.d.ts +1 -0
  119. package/dist/widget/hooks/useBalanceVisible.d.ts.map +1 -1
  120. package/dist/widget/hooks/useCheckout.d.ts.map +1 -1
  121. package/dist/widget/hooks/useCurrentScreen.d.ts +1 -1
  122. package/dist/widget/hooks/useCurrentScreen.d.ts.map +1 -1
  123. package/dist/widget/hooks/useDebugScreens.d.ts +1 -1
  124. package/dist/widget/hooks/useDebugScreens.d.ts.map +1 -1
  125. package/dist/widget/hooks/useDefaultTokenSelection.d.ts +54 -0
  126. package/dist/widget/hooks/useDefaultTokenSelection.d.ts.map +1 -0
  127. package/dist/widget/hooks/useIntentTransactionHistory.d.ts.map +1 -1
  128. package/dist/widget/hooks/usePayMessage.d.ts +34 -0
  129. package/dist/widget/hooks/usePayMessage.d.ts.map +1 -0
  130. package/dist/widget/hooks/useRecipients.d.ts +17 -0
  131. package/dist/widget/hooks/useRecipients.d.ts.map +1 -0
  132. package/dist/widget/hooks/useSelectedFeeToken.d.ts +32 -0
  133. package/dist/widget/hooks/useSelectedFeeToken.d.ts.map +1 -0
  134. package/dist/widget/hooks/useSelectedMeshExchange.d.ts +14 -0
  135. package/dist/widget/hooks/useSelectedMeshExchange.d.ts.map +1 -0
  136. package/dist/widget/hooks/useSelectedRecipient.d.ts +12 -0
  137. package/dist/widget/hooks/useSelectedRecipient.d.ts.map +1 -0
  138. package/dist/widget/hooks/useSendForm.d.ts +10 -13
  139. package/dist/widget/hooks/useSendForm.d.ts.map +1 -1
  140. package/dist/widget/hooks/useSwapAmount.d.ts +13 -0
  141. package/dist/widget/hooks/useSwapAmount.d.ts.map +1 -0
  142. package/dist/widget/hooks/useSwapSettings.d.ts +16 -0
  143. package/dist/widget/hooks/useSwapSettings.d.ts.map +1 -0
  144. package/dist/widget/hooks/useTargetAmount.d.ts +5 -0
  145. package/dist/widget/hooks/useTargetAmount.d.ts.map +1 -0
  146. package/dist/widget/hooks/useTheme.d.ts +14 -0
  147. package/dist/widget/hooks/useTheme.d.ts.map +1 -0
  148. package/dist/widget/hooks/useTokenList.d.ts.map +1 -1
  149. package/dist/widget/index.js +2 -2
  150. package/dist/widget/widget.d.ts +9 -0
  151. package/dist/widget/widget.d.ts.map +1 -1
  152. package/package.json +38 -36
  153. package/src/aave.ts +6 -1
  154. package/src/analytics.ts +109 -53
  155. package/src/apiClient.ts +1 -1
  156. package/src/cctp.ts +6 -2
  157. package/src/cctpqueue.ts +7 -7
  158. package/src/chains.ts +18 -0
  159. package/src/config.ts +63 -17
  160. package/src/constants.ts +20 -16
  161. package/src/contractUtils.ts +33 -2
  162. package/src/customChains.ts +24 -0
  163. package/src/gasless.ts +162 -109
  164. package/src/index.ts +11 -1
  165. package/src/indexerClient.ts +73 -1
  166. package/src/intentEntrypoint.ts +218 -0
  167. package/src/intents.ts +85 -54
  168. package/src/metaTxnMonitor.ts +1 -0
  169. package/src/morpho.ts +13 -2
  170. package/src/pools.ts +68 -86
  171. package/src/prepareSend.ts +1719 -967
  172. package/src/prices.ts +51 -7
  173. package/src/relaySdk.ts +6 -4
  174. package/src/relayer.ts +6 -3
  175. package/src/toast.ts +110 -0
  176. package/src/tokenBalances.ts +112 -20
  177. package/src/tokens.ts +70 -7
  178. package/src/trails.ts +81 -80
  179. package/src/trailsClient.ts +48 -0
  180. package/src/{proxyCaller.ts → trailsRouter.ts} +25 -20
  181. package/src/transactions.ts +30 -88
  182. package/src/umd.tsx +1 -1
  183. package/src/wallets.ts +2 -1
  184. package/src/widget/assets/sequence-logo.svg +15 -0
  185. package/src/widget/compiled.css +2 -2
  186. package/src/widget/components/AccountActionsDropdown.tsx +18 -159
  187. package/src/widget/components/AccountIntentTransactionHistory.tsx +346 -63
  188. package/src/widget/components/AccountSettings.tsx +102 -0
  189. package/src/widget/components/ChainFilterDropdown.tsx +1 -1
  190. package/src/widget/components/ChainList.tsx +10 -20
  191. package/src/widget/components/ClassicSwap.tsx +921 -0
  192. package/src/widget/components/ConfigDisplay.tsx +41 -5
  193. package/src/widget/components/ConnectWallet.tsx +168 -11
  194. package/src/widget/components/ConnectedWallets.tsx +342 -0
  195. package/src/widget/components/DebugMenu.tsx +2 -0
  196. package/src/widget/components/DebugScreensList.tsx +3 -0
  197. package/src/widget/components/DebugToast.tsx +63 -0
  198. package/src/widget/components/Earn.tsx +112 -143
  199. package/src/widget/components/EarnPools.tsx +2 -4
  200. package/src/widget/components/EarnPoolsFilters.tsx +6 -6
  201. package/src/widget/components/FeeOption.tsx +78 -0
  202. package/src/widget/components/FeeOptions.tsx +192 -127
  203. package/src/widget/components/Fund.tsx +1236 -0
  204. package/src/widget/components/FundMethods.tsx +4 -4
  205. package/src/widget/components/FundSendForm.tsx +1 -34
  206. package/src/widget/components/Identicon.tsx +158 -0
  207. package/src/widget/components/MeshConnectExchanges.tsx +32 -3
  208. package/src/widget/components/MeshConnectFlow.tsx +23 -4
  209. package/src/widget/components/NativeGasOption.tsx +99 -0
  210. package/src/widget/components/Pay.tsx +1092 -0
  211. package/src/widget/components/PaySendForm.tsx +1 -38
  212. package/src/widget/components/QuoteDetails.tsx +1 -30
  213. package/src/widget/components/Receipt.tsx +1 -1
  214. package/src/widget/components/Receive.tsx +4 -2
  215. package/src/widget/components/RecentTokens.tsx +2 -1
  216. package/src/widget/components/Recipients.tsx +448 -0
  217. package/src/widget/components/RefundWarning.tsx +61 -0
  218. package/src/widget/components/ScreenHeader.tsx +1 -1
  219. package/src/widget/components/SimpleSwap.tsx +74 -58
  220. package/src/widget/components/Swap.tsx +35 -853
  221. package/src/widget/components/SwapSettings.tsx +5 -11
  222. package/src/widget/components/ThemeProvider.tsx +32 -0
  223. package/src/widget/components/ThemeSyncer.tsx +47 -0
  224. package/src/widget/components/Toast.tsx +315 -0
  225. package/src/widget/components/TokenList.tsx +2 -34
  226. package/src/widget/components/TokenSelector.tsx +14 -3
  227. package/src/widget/components/TransactionDetails.tsx +153 -13
  228. package/src/widget/components/TransferPendingVertical.tsx +1 -1
  229. package/src/widget/components/TruncatedAddress.tsx +5 -1
  230. package/src/widget/components/UserPreferences.tsx +155 -0
  231. package/src/widget/components/WalletList.tsx +1 -1
  232. package/src/widget/hooks/useBack.tsx +4 -0
  233. package/src/widget/hooks/useBalanceVisible.tsx +40 -2
  234. package/src/widget/hooks/useCheckout.ts +13 -0
  235. package/src/widget/hooks/useCurrentScreen.tsx +4 -0
  236. package/src/widget/hooks/useDebugScreens.ts +12 -2
  237. package/src/widget/hooks/useDefaultTokenSelection.tsx +471 -0
  238. package/src/widget/hooks/useIntentTransactionHistory.ts +212 -0
  239. package/src/widget/hooks/usePayMessage.tsx +370 -0
  240. package/src/widget/hooks/useRecipients.ts +168 -0
  241. package/src/widget/hooks/useSelectedFeeToken.tsx +299 -0
  242. package/src/widget/hooks/useSelectedMeshExchange.tsx +46 -0
  243. package/src/widget/hooks/useSelectedRecipient.tsx +48 -0
  244. package/src/widget/hooks/useSendForm.ts +257 -49
  245. package/src/widget/hooks/useSwapAmount.tsx +50 -0
  246. package/src/widget/hooks/useSwapSettings.tsx +100 -0
  247. package/src/widget/hooks/useTargetAmount.ts +23 -0
  248. package/src/widget/hooks/useTheme.tsx +80 -0
  249. package/src/widget/hooks/useTokenList.ts +20 -11
  250. package/src/widget/index.css +45 -21
  251. package/src/widget/widget.tsx +294 -136
  252. package/dist/address.d.ts +0 -2
  253. package/dist/address.d.ts.map +0 -1
  254. package/dist/proxyCaller.d.ts +0 -21
  255. package/dist/proxyCaller.d.ts.map +0 -1
  256. package/src/address.ts +0 -6
@@ -3,7 +3,7 @@ import type { IntentTransaction } from "../../transactions.js"
3
3
  import { TokenImage } from "./TokenImage.js"
4
4
  import { ChainImage } from "./ChainImage.js"
5
5
  import { getExplorerUrlForAddress } from "../../explorer.js"
6
- import { truncateAddress } from "../../address.js"
6
+ import { truncateAddress } from "../../utils.js"
7
7
  import { formatRawAmount } from "../../tokenBalances.js"
8
8
 
9
9
  interface TransactionDetailsProps {
@@ -20,7 +20,9 @@ export const TransactionDetails: React.FC<TransactionDetailsProps> = ({
20
20
  {/* Origin Intent */}
21
21
  {transaction.originIntentAddress && transaction.originToken && (
22
22
  <div className="flex justify-between items-center">
23
- <span className="text-xs text-gray-600">Origin Intent:</span>
23
+ <span className="text-xs text-gray-600 dark:text-gray-400">
24
+ Origin Intent:
25
+ </span>
24
26
  {transaction.originToken && (
25
27
  <a
26
28
  href={getExplorerUrlForAddress({
@@ -29,7 +31,7 @@ export const TransactionDetails: React.FC<TransactionDetailsProps> = ({
29
31
  })}
30
32
  target="_blank"
31
33
  rel="noopener noreferrer"
32
- className="text-xs hover:underline flex items-center gap-1 text-gray-900"
34
+ className="text-xs hover:underline flex items-center gap-1 text-gray-900 dark:text-gray-100"
33
35
  >
34
36
  <ChainImage chainId={transaction.originToken.chainId} size={16} />
35
37
  {truncateAddress(transaction.originIntentAddress)}
@@ -54,7 +56,9 @@ export const TransactionDetails: React.FC<TransactionDetailsProps> = ({
54
56
  {/* Origin Token */}
55
57
  {transaction.originToken && (
56
58
  <div className="flex justify-between items-start">
57
- <span className="text-xs text-gray-600">Origin Token:</span>
59
+ <span className="text-xs text-gray-600 dark:text-gray-400">
60
+ Origin Token:
61
+ </span>
58
62
  <div className="text-right">
59
63
  {transaction.originTokenAddress &&
60
64
  transaction.originTokenAddress !==
@@ -66,7 +70,7 @@ export const TransactionDetails: React.FC<TransactionDetailsProps> = ({
66
70
  })}
67
71
  target="_blank"
68
72
  rel="noopener noreferrer"
69
- className="flex items-center gap-1 justify-end hover:underline text-xs text-gray-900"
73
+ className="flex items-center gap-1 justify-end hover:underline text-xs text-gray-900 dark:text-gray-100"
70
74
  >
71
75
  <TokenImage
72
76
  symbol={transaction.originToken.symbol}
@@ -96,7 +100,7 @@ export const TransactionDetails: React.FC<TransactionDetailsProps> = ({
96
100
  </svg>
97
101
  </a>
98
102
  ) : (
99
- <div className="flex items-center gap-1 justify-end text-xs text-gray-900">
103
+ <div className="flex items-center gap-1 justify-end text-xs text-gray-900 dark:text-gray-100">
100
104
  <TokenImage
101
105
  symbol={transaction.originToken.symbol}
102
106
  imageUrl={transaction.originToken.imageUrl}
@@ -120,7 +124,9 @@ export const TransactionDetails: React.FC<TransactionDetailsProps> = ({
120
124
  {transaction.destinationIntentAddress &&
121
125
  transaction.destinationChainId && (
122
126
  <div className="flex justify-between items-center">
123
- <span className="text-xs text-gray-600">Destination Intent:</span>
127
+ <span className="text-xs text-gray-600 dark:text-gray-400">
128
+ Destination Intent:
129
+ </span>
124
130
  <a
125
131
  href={getExplorerUrlForAddress({
126
132
  address: transaction.destinationIntentAddress,
@@ -128,7 +134,7 @@ export const TransactionDetails: React.FC<TransactionDetailsProps> = ({
128
134
  })}
129
135
  target="_blank"
130
136
  rel="noopener noreferrer"
131
- className="text-xs hover:underline flex items-center gap-1 text-gray-900"
137
+ className="text-xs hover:underline flex items-center gap-1 text-gray-900 dark:text-gray-100"
132
138
  >
133
139
  <ChainImage chainId={transaction.destinationChainId} size={16} />
134
140
  {truncateAddress(transaction.destinationIntentAddress)}
@@ -152,7 +158,9 @@ export const TransactionDetails: React.FC<TransactionDetailsProps> = ({
152
158
  {/* Destination Token */}
153
159
  {transaction.destinationToken && (
154
160
  <div className="flex justify-between items-start">
155
- <span className="text-xs text-gray-600">Destination Token:</span>
161
+ <span className="text-xs text-gray-600 dark:text-gray-400">
162
+ Destination Token:
163
+ </span>
156
164
  <div className="text-right">
157
165
  {transaction.destinationTokenAddress &&
158
166
  transaction.destinationTokenAddress !==
@@ -164,7 +172,7 @@ export const TransactionDetails: React.FC<TransactionDetailsProps> = ({
164
172
  })}
165
173
  target="_blank"
166
174
  rel="noopener noreferrer"
167
- className="flex items-center gap-1 justify-end hover:underline text-xs text-gray-900"
175
+ className="flex items-center gap-1 justify-end hover:underline text-xs text-gray-900 dark:text-gray-100"
168
176
  >
169
177
  <TokenImage
170
178
  symbol={transaction.destinationToken.symbol}
@@ -194,7 +202,7 @@ export const TransactionDetails: React.FC<TransactionDetailsProps> = ({
194
202
  </svg>
195
203
  </a>
196
204
  ) : (
197
- <div className="flex items-center gap-1 justify-end text-xs text-gray-900">
205
+ <div className="flex items-center gap-1 justify-end text-xs text-gray-900 dark:text-gray-100">
198
206
  <TokenImage
199
207
  symbol={transaction.destinationToken.symbol}
200
208
  imageUrl={transaction.destinationToken.imageUrl}
@@ -219,7 +227,7 @@ export const TransactionDetails: React.FC<TransactionDetailsProps> = ({
219
227
  transaction.destinationToAddress !==
220
228
  "0x0000000000000000000000000000000000000000" && (
221
229
  <div className="flex justify-between items-center">
222
- <span className="text-xs text-gray-600">
230
+ <span className="text-xs text-gray-600 dark:text-gray-400">
223
231
  Destination To Address:
224
232
  </span>
225
233
  <a
@@ -229,7 +237,7 @@ export const TransactionDetails: React.FC<TransactionDetailsProps> = ({
229
237
  })}
230
238
  target="_blank"
231
239
  rel="noopener noreferrer"
232
- className="text-xs hover:underline flex items-center gap-1 text-gray-900"
240
+ className="text-xs hover:underline flex items-center gap-1 text-gray-900 dark:text-gray-100"
233
241
  >
234
242
  {transaction.destinationChainId && (
235
243
  <ChainImage
@@ -254,6 +262,138 @@ export const TransactionDetails: React.FC<TransactionDetailsProps> = ({
254
262
  </a>
255
263
  </div>
256
264
  )}
265
+
266
+ {/* Origin Intent Deposit Tx Hash */}
267
+ {transaction.originIntentDepositTxHash &&
268
+ transaction.originIntentDepositTxExplorerUrl &&
269
+ transaction.originChainId && (
270
+ <div className="flex justify-between items-center">
271
+ <span className="text-xs text-gray-600 dark:text-gray-400">
272
+ Origin Deposit Tx:
273
+ </span>
274
+ <a
275
+ href={transaction.originIntentDepositTxExplorerUrl}
276
+ target="_blank"
277
+ rel="noopener noreferrer"
278
+ className="text-xs hover:underline flex items-center gap-1 text-gray-900 dark:text-gray-100"
279
+ >
280
+ <ChainImage chainId={transaction.originChainId} size={16} />
281
+ {truncateAddress(transaction.originIntentDepositTxHash)}
282
+ <svg
283
+ className="w-3 h-3"
284
+ fill="none"
285
+ stroke="currentColor"
286
+ viewBox="0 0 24 24"
287
+ >
288
+ <path
289
+ strokeLinecap="round"
290
+ strokeLinejoin="round"
291
+ strokeWidth={2}
292
+ d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
293
+ />
294
+ </svg>
295
+ </a>
296
+ </div>
297
+ )}
298
+
299
+ {/* Origin Intent Action Tx Hash */}
300
+ {transaction.originIntentTxHash &&
301
+ transaction.originIntentTxExplorerUrl &&
302
+ transaction.originChainId && (
303
+ <div className="flex justify-between items-center">
304
+ <span className="text-xs text-gray-600 dark:text-gray-400">
305
+ Origin Intent Tx:
306
+ </span>
307
+ <a
308
+ href={transaction.originIntentTxExplorerUrl}
309
+ target="_blank"
310
+ rel="noopener noreferrer"
311
+ className="text-xs hover:underline flex items-center gap-1 text-gray-900 dark:text-gray-100"
312
+ >
313
+ <ChainImage chainId={transaction.originChainId} size={16} />
314
+ {truncateAddress(transaction.originIntentTxHash)}
315
+ <svg
316
+ className="w-3 h-3"
317
+ fill="none"
318
+ stroke="currentColor"
319
+ viewBox="0 0 24 24"
320
+ >
321
+ <path
322
+ strokeLinecap="round"
323
+ strokeLinejoin="round"
324
+ strokeWidth={2}
325
+ d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
326
+ />
327
+ </svg>
328
+ </a>
329
+ </div>
330
+ )}
331
+
332
+ {/* Destination Intent Deposit Tx Hash */}
333
+ {transaction.destinationIntentDepositTxHash &&
334
+ transaction.destinationIntentDepositTxExplorerUrl &&
335
+ transaction.destinationChainId && (
336
+ <div className="flex justify-between items-center">
337
+ <span className="text-xs text-gray-600 dark:text-gray-400">
338
+ Destination Deposit Tx:
339
+ </span>
340
+ <a
341
+ href={transaction.destinationIntentDepositTxExplorerUrl}
342
+ target="_blank"
343
+ rel="noopener noreferrer"
344
+ className="text-xs hover:underline flex items-center gap-1 text-gray-900 dark:text-gray-100"
345
+ >
346
+ <ChainImage chainId={transaction.destinationChainId} size={16} />
347
+ {truncateAddress(transaction.destinationIntentDepositTxHash)}
348
+ <svg
349
+ className="w-3 h-3"
350
+ fill="none"
351
+ stroke="currentColor"
352
+ viewBox="0 0 24 24"
353
+ >
354
+ <path
355
+ strokeLinecap="round"
356
+ strokeLinejoin="round"
357
+ strokeWidth={2}
358
+ d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
359
+ />
360
+ </svg>
361
+ </a>
362
+ </div>
363
+ )}
364
+
365
+ {/* Destination Intent Action Tx Hash */}
366
+ {transaction.destinationIntentTxHash &&
367
+ transaction.destinationIntentTxExplorerUrl &&
368
+ transaction.destinationChainId && (
369
+ <div className="flex justify-between items-center">
370
+ <span className="text-xs text-gray-600 dark:text-gray-400">
371
+ Destination Intent Tx:
372
+ </span>
373
+ <a
374
+ href={transaction.destinationIntentTxExplorerUrl}
375
+ target="_blank"
376
+ rel="noopener noreferrer"
377
+ className="text-xs hover:underline flex items-center gap-1 text-gray-900 dark:text-gray-100"
378
+ >
379
+ <ChainImage chainId={transaction.destinationChainId} size={16} />
380
+ {truncateAddress(transaction.destinationIntentTxHash)}
381
+ <svg
382
+ className="w-3 h-3"
383
+ fill="none"
384
+ stroke="currentColor"
385
+ viewBox="0 0 24 24"
386
+ >
387
+ <path
388
+ strokeLinecap="round"
389
+ strokeLinejoin="round"
390
+ strokeWidth={2}
391
+ d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
392
+ />
393
+ </svg>
394
+ </a>
395
+ </div>
396
+ )}
257
397
  </div>
258
398
  )
259
399
  }
@@ -368,7 +368,7 @@ export const TransferPending: React.FC<TransferPendingProps> = ({
368
368
  headerContent={
369
369
  mode === "swap" ? "Swap in progress" : "Transaction Status"
370
370
  }
371
- headerContentAlign="left"
371
+ headerContentAlign="center"
372
372
  />
373
373
  </div>
374
374
 
@@ -7,6 +7,8 @@ interface TruncatedAddressProps {
7
7
  chainId: number
8
8
  className?: string
9
9
  expandOnHover?: boolean
10
+ sliceStart?: number
11
+ sliceEnd?: number
10
12
  }
11
13
 
12
14
  export const TruncatedAddress: React.FC<TruncatedAddressProps> = ({
@@ -14,10 +16,12 @@ export const TruncatedAddress: React.FC<TruncatedAddressProps> = ({
14
16
  chainId,
15
17
  className = "",
16
18
  expandOnHover = false,
19
+ sliceStart = 6,
20
+ sliceEnd = 4,
17
21
  }) => {
18
22
  const [isHovered, setIsHovered] = useState(false)
19
23
 
20
- const truncatedAddress = `${address.slice(0, 6)}…${address.slice(-4)}`
24
+ const truncatedAddress = `${address.slice(0, sliceStart)}…${address.slice(-sliceEnd)}`
21
25
  const explorerUrl = getExplorerUrlForAddress({ address, chainId })
22
26
 
23
27
  if (!expandOnHover) {
@@ -0,0 +1,155 @@
1
+ import { ChevronDown, RotateCcw } from "lucide-react"
2
+ import type React from "react"
3
+ import { useBalanceVisible } from "../hooks/useBalanceVisible.js"
4
+ import { useSwapSettings } from "../hooks/useSwapSettings.js"
5
+ import { useThemePreference } from "../hooks/useTheme.js"
6
+ import { useWidgetProps } from "../hooks/useWidgetProps.js"
7
+ import { ScreenHeader } from "./ScreenHeader.js"
8
+ import { logger } from "../../logger.js"
9
+
10
+ interface UserPreferencesProps {
11
+ onBack?: () => void
12
+ }
13
+
14
+ export const UserPreferences: React.FC<UserPreferencesProps> = ({ onBack }) => {
15
+ const { isBalanceVisible, toggleBalanceVisible, resetBalanceVisible } =
16
+ useBalanceVisible()
17
+ const { resetSwapSettings } = useSwapSettings()
18
+ const { selectedTheme, setSelectedTheme, resetThemePreference } =
19
+ useThemePreference()
20
+ const { customCss, theme: widgetTheme } = useWidgetProps()
21
+
22
+ const handleThemeChange = (newTheme: "auto" | "light" | "dark") => {
23
+ // Only allow theme changes if customCss is not set
24
+ if (!customCss) {
25
+ setSelectedTheme(newTheme)
26
+ // ThemeSyncer component will handle applying the theme
27
+ }
28
+ }
29
+
30
+ const handleResetPreferences = () => {
31
+ try {
32
+ // Reset all preferences using their respective hook methods
33
+ resetBalanceVisible()
34
+ resetSwapSettings()
35
+ resetThemePreference()
36
+
37
+ logger.console.log(
38
+ "[UserPreferences] All preferences have been reset to defaults",
39
+ )
40
+ } catch (error) {
41
+ logger.console.warn(
42
+ "[UserPreferences] Failed to reset preferences:",
43
+ error,
44
+ )
45
+ }
46
+ }
47
+
48
+ return (
49
+ <div className="flex flex-col h-full">
50
+ <ScreenHeader
51
+ headerContent="User Preferences"
52
+ headerContentAlign="left"
53
+ onBack={onBack}
54
+ showAccountActions={false}
55
+ />
56
+
57
+ <div className="space-y-6">
58
+ {/* Hide Balances Setting */}
59
+ <div className="flex items-center justify-between">
60
+ <span className="text-sm font-medium text-gray-900 dark:text-gray-100">
61
+ Hide Balances
62
+ </span>
63
+ <button
64
+ type="button"
65
+ onClick={toggleBalanceVisible}
66
+ className={`relative inline-flex h-6 w-11 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 ${
67
+ !isBalanceVisible ? "bg-blue-600" : "bg-gray-200 dark:bg-gray-700"
68
+ }`}
69
+ >
70
+ <span
71
+ className={`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${
72
+ !isBalanceVisible ? "translate-x-6" : "translate-x-1"
73
+ }`}
74
+ />
75
+ </button>
76
+ </div>
77
+
78
+ {/* Simple Swap UI Setting */}
79
+ {/* <div className="flex items-center justify-between">
80
+ <span className="text-sm font-medium text-gray-900 dark:text-gray-100">
81
+ Simple Swap UI
82
+ </span>
83
+ <button
84
+ type="button"
85
+ onClick={toggleSimpleSwapMode}
86
+ className={`relative inline-flex h-6 w-11 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 ${
87
+ isSimpleSwapMode ? "bg-blue-600" : "bg-gray-200 dark:bg-gray-700"
88
+ }`}
89
+ >
90
+ <span
91
+ className={`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${
92
+ isSimpleSwapMode ? "translate-x-6" : "translate-x-1"
93
+ }`}
94
+ />
95
+ </button>
96
+ </div> */}
97
+
98
+ {/* Theme Setting */}
99
+ <div className="flex items-center justify-between">
100
+ <span
101
+ className={`text-sm font-medium ${
102
+ customCss
103
+ ? "text-gray-500 dark:text-gray-500"
104
+ : "text-gray-900 dark:text-gray-100"
105
+ }`}
106
+ >
107
+ Theme
108
+ {customCss && (
109
+ <span className="text-xs text-gray-400 dark:text-gray-500 block">
110
+ Controlled by custom CSS
111
+ </span>
112
+ )}
113
+ </span>
114
+ <div className="relative">
115
+ <select
116
+ value={selectedTheme || widgetTheme || "auto"}
117
+ onChange={(e) =>
118
+ handleThemeChange(e.target.value as "auto" | "light" | "dark")
119
+ }
120
+ disabled={!!customCss}
121
+ className={`appearance-none border text-sm rounded-xl focus:ring-blue-500 focus:border-blue-500 block w-24 p-2 pr-8 ${
122
+ customCss
123
+ ? "bg-gray-100 dark:bg-gray-800 border-gray-200 dark:border-gray-700 text-gray-500 dark:text-gray-500 cursor-not-allowed"
124
+ : "bg-gray-50 dark:bg-gray-700 border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 cursor-pointer"
125
+ }`}
126
+ >
127
+ <option value="auto">Auto</option>
128
+ <option value="light">Light</option>
129
+ <option value="dark">Dark</option>
130
+ </select>
131
+ <ChevronDown
132
+ className={`absolute right-2 top-1/2 transform -translate-y-1/2 h-4 w-4 pointer-events-none ${
133
+ customCss ? "text-gray-300 dark:text-gray-600" : "text-gray-400"
134
+ }`}
135
+ />
136
+ </div>
137
+ </div>
138
+
139
+ {/* Reset Preferences Button */}
140
+ <div className="pt-4 dark:border-gray-700">
141
+ <button
142
+ type="button"
143
+ onClick={handleResetPreferences}
144
+ className="flex items-center gap-1 px-2 py-1.5 text-xs font-medium text-gray-700 dark:text-gray-300 trails-bg-secondary rounded-xl hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors cursor-pointer"
145
+ >
146
+ <RotateCcw className="w-3 h-3" />
147
+ Reset
148
+ </button>
149
+ </div>
150
+ </div>
151
+ </div>
152
+ )
153
+ }
154
+
155
+ export default UserPreferences
@@ -87,7 +87,7 @@ export const WalletList: React.FC<WalletListProps> = ({
87
87
  key={wallet.id}
88
88
  data-wallet-id={wallet.id}
89
89
  onClick={() => handleWalletSelect(wallet.id)}
90
- className="w-full flex items-center justify-between cursor-pointer font-semibold py-4 px-6 trails-border-radius-large-button transition-all duration-200 trails-bg-secondary trails-hover-bg trails-text-primary"
90
+ className="w-full flex items-center justify-between cursor-pointer font-semibold py-4 px-6 trails-border-radius-large-button transition-all duration-200 trails-list-item trails-text-primary"
91
91
  >
92
92
  <div className="flex items-center space-x-3">
93
93
  {wallet.icon ? (
@@ -8,6 +8,7 @@ interface BackContextType {
8
8
  canGoBack: boolean
9
9
  clearHistory: () => void
10
10
  isNavigatingBack: boolean
11
+ getHistory: () => Screen[]
11
12
  }
12
13
 
13
14
  const BackContext = createContext<BackContextType | null>(null)
@@ -83,11 +84,14 @@ export function BackProvider({ children }: BackProviderProps) {
83
84
  setHistory([currentScreen])
84
85
  }
85
86
 
87
+ const getHistory = () => history
88
+
86
89
  const value: BackContextType = {
87
90
  goBack,
88
91
  canGoBack,
89
92
  clearHistory,
90
93
  isNavigatingBack,
94
+ getHistory,
91
95
  }
92
96
 
93
97
  return <BackContext.Provider value={value}>{children}</BackContext.Provider>
@@ -2,6 +2,7 @@ import React, {
2
2
  createContext,
3
3
  useContext,
4
4
  useState,
5
+ useEffect,
5
6
  type ReactNode,
6
7
  } from "react"
7
8
 
@@ -9,6 +10,7 @@ interface BalanceVisibleContextType {
9
10
  isBalanceVisible: boolean
10
11
  setIsBalanceVisible: (visible: boolean) => void
11
12
  toggleBalanceVisible: () => void
13
+ resetBalanceVisible: () => void
12
14
  }
13
15
 
14
16
  const BalanceVisibleContext = createContext<
@@ -20,21 +22,57 @@ interface BalanceVisibleProviderProps {
20
22
  initialVisible?: boolean
21
23
  }
22
24
 
25
+ const BALANCE_VISIBLE_KEY = "trails-balance-visible"
26
+
23
27
  export const BalanceVisibleProvider: React.FC<BalanceVisibleProviderProps> = ({
24
28
  children,
25
29
  initialVisible = true,
26
30
  }) => {
27
- const [isBalanceVisible, setIsBalanceVisible] =
28
- useState<boolean>(initialVisible)
31
+ // Initialize state from localStorage or use initialVisible as fallback
32
+ const [isBalanceVisible, setIsBalanceVisible] = useState<boolean>(() => {
33
+ try {
34
+ const stored = localStorage.getItem(BALANCE_VISIBLE_KEY)
35
+ return stored !== null ? JSON.parse(stored) : initialVisible
36
+ } catch (error) {
37
+ console.warn(
38
+ "Failed to read balance visibility from localStorage:",
39
+ error,
40
+ )
41
+ return initialVisible
42
+ }
43
+ })
44
+
45
+ // Update localStorage whenever isBalanceVisible changes
46
+ useEffect(() => {
47
+ try {
48
+ localStorage.setItem(
49
+ BALANCE_VISIBLE_KEY,
50
+ JSON.stringify(isBalanceVisible),
51
+ )
52
+ } catch (error) {
53
+ console.warn("Failed to save balance visibility to localStorage:", error)
54
+ }
55
+ }, [isBalanceVisible])
29
56
 
30
57
  const toggleBalanceVisible = () => {
31
58
  setIsBalanceVisible(!isBalanceVisible)
32
59
  }
33
60
 
61
+ const resetBalanceVisible = () => {
62
+ try {
63
+ localStorage.removeItem(BALANCE_VISIBLE_KEY)
64
+ setIsBalanceVisible(true) // Default: balances visible
65
+ } catch (error) {
66
+ console.warn("Failed to reset balance visibility:", error)
67
+ setIsBalanceVisible(true) // Still reset state even if localStorage fails
68
+ }
69
+ }
70
+
34
71
  const value: BalanceVisibleContextType = {
35
72
  isBalanceVisible,
36
73
  setIsBalanceVisible,
37
74
  toggleBalanceVisible,
75
+ resetBalanceVisible,
38
76
  }
39
77
 
40
78
  return (
@@ -1,6 +1,7 @@
1
1
  import { useCallback, useRef } from "react"
2
2
  import { getSessionId } from "../../analytics.js"
3
3
  import { logger } from "../../logger.js"
4
+ import { updatePersistentToast } from "../../toast.js"
4
5
 
5
6
  export type CheckoutCallbacks = {
6
7
  onCheckoutStart?: (data: { sessionId: string }) => void
@@ -93,6 +94,12 @@ export function useCheckout({
93
94
  )
94
95
  }
95
96
  }
97
+
98
+ updatePersistentToast(
99
+ "Transaction Complete",
100
+ "Your transaction has been successfully processed",
101
+ "success",
102
+ )
96
103
  }, [onCheckoutComplete])
97
104
 
98
105
  const triggerCheckoutError = useCallback(
@@ -110,6 +117,12 @@ export function useCheckout({
110
117
  )
111
118
  }
112
119
  }
120
+
121
+ updatePersistentToast(
122
+ "Transaction Failed",
123
+ error || "An error occurred while processing your transaction",
124
+ "error",
125
+ )
113
126
  },
114
127
  [onCheckoutError],
115
128
  )
@@ -6,6 +6,7 @@ export type Screen =
6
6
  | "send-form"
7
7
  | "fund-form"
8
8
  | "fund-methods"
9
+ | "recipients"
9
10
  | "earn-pools"
10
11
  | "earn"
11
12
  | "swap"
@@ -15,10 +16,13 @@ export type Screen =
15
16
  | "pending"
16
17
  | "receipt"
17
18
  | "mesh-connect"
19
+ | "mesh-connect-exchanges"
18
20
  | "wallet-connect"
19
21
  | "wallet-list"
20
22
  | "wallet-connection-pending"
21
23
  | "account-history"
24
+ | "account-settings"
25
+ | "user-preferences"
22
26
  | "chain-list"
23
27
  | "disconnect"
24
28
 
@@ -10,6 +10,7 @@ type Screen =
10
10
  | "send-form"
11
11
  | "fund-form"
12
12
  | "fund-methods"
13
+ | "recipients"
13
14
  | "earn"
14
15
  | "earn-pools"
15
16
  | "swap"
@@ -23,6 +24,8 @@ type Screen =
23
24
  | "wallet-list"
24
25
  | "wallet-connection-pending"
25
26
  | "account-history"
27
+ | "account-settings"
28
+ | "user-preferences"
26
29
  | "chain-list"
27
30
 
28
31
  interface UseDebugScreensProps {
@@ -118,6 +121,9 @@ export const useDebugScreens = ({
118
121
  setTransactionStates([])
119
122
  setCurrentScreen("fund-form")
120
123
  break
124
+ case "recipients":
125
+ setCurrentScreen("recipients")
126
+ break
121
127
  case "wallet-confirmation":
122
128
  // Set dummy USDC token for debug mode
123
129
  setSelectedToken(dummySelectedToken)
@@ -577,10 +583,14 @@ export const useDebugScreens = ({
577
583
  setCurrentScreen("receive")
578
584
  break
579
585
  case "account-history":
580
- setSelectedToken(null)
581
- setTransactionStates([])
582
586
  setCurrentScreen("account-history")
583
587
  break
588
+ case "account-settings":
589
+ setCurrentScreen("account-settings")
590
+ break
591
+ case "user-preferences":
592
+ setCurrentScreen("user-preferences")
593
+ break
584
594
  }
585
595
  },
586
596
  [