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
@@ -1,5 +1,5 @@
1
1
  import type React from "react"
2
- import { useState, useRef } from "react"
2
+ import { useState, useRef, useMemo } from "react"
3
3
  import { useIntentTransactionHistory } from "../hooks/useIntentTransactionHistory.js"
4
4
  import type { IntentTransaction } from "../../transactions.js"
5
5
  import { TokenImage } from "./TokenImage.js"
@@ -7,6 +7,11 @@ import { ScreenHeader } from "./ScreenHeader.js"
7
7
  import { TransactionDetails } from "./TransactionDetails.js"
8
8
  import { formatRawAmount } from "../../tokenBalances.js"
9
9
  import { formatRelativeDate } from "../../time.js"
10
+ import { SearchInputField } from "./SearchInputField.js"
11
+ import { Identicon } from "./Identicon.js"
12
+ import { truncateAddress } from "../../utils.js"
13
+ import { useConnections, useAccount } from "wagmi"
14
+ import { ChevronDown } from "lucide-react"
10
15
 
11
16
  interface AccountIntentTransactionHistoryProps {
12
17
  accountAddress?: string
@@ -18,17 +23,18 @@ const ExecutionStatusBadge: React.FC<{ status?: string }> = ({ status }) => {
18
23
  const getStatusColor = (status?: string) => {
19
24
  switch (status) {
20
25
  case "executed":
21
- return "bg-green-100 text-green-800"
26
+ case "completed":
27
+ return "bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200"
22
28
  case "processing":
23
- return "bg-blue-100 text-blue-800"
29
+ return "bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200"
24
30
  case "pending":
25
- return "bg-yellow-100 text-yellow-800"
31
+ return "bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-200"
26
32
  case "failed":
27
- return "bg-red-100 text-red-800"
33
+ return "bg-yellow-100 text-gray-800 dark:bg-yellow-900 dark:text-gray-200"
28
34
  case "created":
29
- return "bg-gray-100 text-gray-800"
35
+ return "bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-200"
30
36
  default:
31
- return "bg-gray-100 text-gray-800"
37
+ return "bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-200"
32
38
  }
33
39
  }
34
40
 
@@ -38,7 +44,7 @@ const ExecutionStatusBadge: React.FC<{ status?: string }> = ({ status }) => {
38
44
  status,
39
45
  )}`}
40
46
  >
41
- {status || "unknown status"}
47
+ {status || "unknown"}
42
48
  </span>
43
49
  )
44
50
  }
@@ -52,17 +58,17 @@ const TransactionItem: React.FC<{
52
58
  const dateInfo = formatRelativeDate(transaction.createdAt)
53
59
 
54
60
  return (
55
- <div className="border border-gray-200 rounded-lg p-3 hover:bg-gray-50 transition-colors">
61
+ <div className="border border-gray-200 dark:border-gray-700 rounded-lg p-3 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors">
56
62
  {/* Header with status and metadata */}
57
63
  <div className="flex items-center justify-between mb-2">
58
64
  <div className="flex items-center gap-2">
59
- <span className="text-xs font-medium text-gray-600">
65
+ <span className="text-xs font-medium text-gray-600 dark:text-gray-400">
60
66
  #{index + 1}
61
67
  </span>
62
68
  <ExecutionStatusBadge status={transaction.executionStatus} />
63
69
  {dateInfo.relative && (
64
70
  <span
65
- className="text-xs text-gray-500 cursor-help"
71
+ className="text-xs text-gray-500 dark:text-gray-400 cursor-help"
66
72
  title={dateInfo.full || undefined}
67
73
  >
68
74
  {dateInfo.relative}
@@ -74,7 +80,7 @@ const TransactionItem: React.FC<{
74
80
  href={`https://etherscan.io/tx/${transaction.txnHash}`}
75
81
  target="_blank"
76
82
  rel="noopener noreferrer"
77
- className="text-blue-600 hover:text-blue-800 text-xs"
83
+ className="text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300 text-xs"
78
84
  >
79
85
  View on Explorer ↗
80
86
  </a>
@@ -93,7 +99,7 @@ const TransactionItem: React.FC<{
93
99
  chainId={transaction.originToken.chainId}
94
100
  size={20}
95
101
  />
96
- <span className="text-xs font-medium text-gray-900">
102
+ <span className="text-xs font-medium text-gray-900 dark:text-gray-100">
97
103
  {formatRawAmount(
98
104
  transaction.originTokenAmount || "0",
99
105
  transaction.originToken.decimals,
@@ -129,7 +135,7 @@ const TransactionItem: React.FC<{
129
135
  chainId={transaction.destinationToken.chainId}
130
136
  size={20}
131
137
  />
132
- <span className="text-xs font-medium text-gray-900">
138
+ <span className="text-xs font-medium text-gray-900 dark:text-gray-100">
133
139
  {formatRawAmount(
134
140
  transaction.destinationTokenAmount || "0",
135
141
  transaction.destinationToken.decimals,
@@ -147,7 +153,7 @@ const TransactionItem: React.FC<{
147
153
  <button
148
154
  type="button"
149
155
  onClick={() => setIsExpanded(true)}
150
- className="flex items-center justify-center gap-1 py-1 px-3 rounded-md transition-colors cursor-pointer text-xs text-gray-500 hover:text-gray-700 hover:bg-gray-100"
156
+ className="flex items-center justify-center gap-1 py-1 px-3 rounded-md transition-colors cursor-pointer text-xs text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700"
151
157
  aria-label="Show more details"
152
158
  >
153
159
  <span>More Details</span>
@@ -176,13 +182,13 @@ const TransactionItem: React.FC<{
176
182
  isExpanded ? "max-h-[400px] opacity-100" : "max-h-0 opacity-0"
177
183
  }`}
178
184
  >
179
- <div className="p-3 rounded-lg bg-gray-50">
185
+ <div className="p-3 rounded-lg bg-gray-50 dark:bg-gray-800">
180
186
  {/* Close Button - only visible when expanded, at top center */}
181
187
  <div className="flex justify-center mb-3 -mt-1">
182
188
  <button
183
189
  type="button"
184
190
  onClick={() => setIsExpanded(false)}
185
- className="flex items-center gap-1 px-3 py-1 text-xs bg-gray-200 hover:bg-gray-300 rounded-md transition-colors duration-200 text-gray-600 hover:text-gray-700 cursor-pointer"
191
+ className="flex items-center gap-1 px-3 py-1 text-xs bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 rounded-md transition-colors duration-200 text-gray-600 dark:text-gray-300 hover:text-gray-700 dark:hover:text-gray-200 cursor-pointer"
186
192
  aria-label="Close details"
187
193
  >
188
194
  <span>Close</span>
@@ -211,11 +217,48 @@ const TransactionItem: React.FC<{
211
217
  )
212
218
  }
213
219
 
214
- const ITEMS_PER_PAGE = 2
220
+ const ITEMS_PER_PAGE = 10
215
221
 
216
222
  export const AccountIntentTransactionHistory: React.FC<
217
223
  AccountIntentTransactionHistoryProps
218
224
  > = ({ accountAddress, className = "", onBack }) => {
225
+ const [searchQuery, setSearchQuery] = useState("")
226
+ const [statusFilter, setStatusFilter] = useState<string | null>(null)
227
+ const [isWalletDropdownOpen, setIsWalletDropdownOpen] = useState(false)
228
+ const [selectedWalletAddress, setSelectedWalletAddress] = useState<
229
+ string | null
230
+ >(null)
231
+ const walletDropdownRef = useRef<HTMLDivElement>(null)
232
+
233
+ const { address: currentAddress, connector } = useAccount()
234
+ const connections = useConnections()
235
+
236
+ // Get all connected wallets
237
+ const getConnectedWallets = () => {
238
+ const walletMap = new Map()
239
+
240
+ connections.forEach((connection) => {
241
+ connection.accounts.forEach((account) => {
242
+ if (account && !walletMap.has(account)) {
243
+ walletMap.set(account, {
244
+ address: account,
245
+ connector: connection.connector,
246
+ isActive:
247
+ connection.connector.id === connector?.id &&
248
+ account === currentAddress,
249
+ })
250
+ }
251
+ })
252
+ })
253
+
254
+ return Array.from(walletMap.values())
255
+ }
256
+
257
+ const connectedWallets = getConnectedWallets()
258
+
259
+ // Use selected wallet or fall back to accountAddress
260
+ const effectiveAccountAddress = selectedWalletAddress || accountAddress
261
+
219
262
  const {
220
263
  transactions,
221
264
  loading,
@@ -227,20 +270,99 @@ export const AccountIntentTransactionHistory: React.FC<
227
270
  prevPage,
228
271
  hasPrev,
229
272
  } = useIntentTransactionHistory({
230
- accountAddress,
273
+ accountAddress: effectiveAccountAddress,
231
274
  pageSize: ITEMS_PER_PAGE,
232
- enabled: !!accountAddress,
275
+ enabled: !!effectiveAccountAddress,
233
276
  })
234
277
 
278
+ // Filter transactions based on search query and status filter
279
+ const filteredTransactions = useMemo(() => {
280
+ let filtered = transactions
281
+
282
+ // Apply status filter
283
+ if (statusFilter) {
284
+ filtered = filtered.filter((tx) => {
285
+ const status = tx.executionStatus?.toLowerCase()
286
+ // "pending" filter includes both "pending" and "created" statuses
287
+ if (statusFilter === "pending") {
288
+ return status === "pending" || status === "created"
289
+ }
290
+ return status === statusFilter.toLowerCase()
291
+ })
292
+ }
293
+
294
+ // Apply search query filter
295
+ if (!searchQuery.trim()) {
296
+ return filtered
297
+ }
298
+
299
+ const query = searchQuery.toLowerCase()
300
+
301
+ return filtered.filter((tx) => {
302
+ // Search in addresses
303
+ if (
304
+ tx.originIntentAddress?.toLowerCase().includes(query) ||
305
+ tx.destinationIntentAddress?.toLowerCase().includes(query) ||
306
+ tx.mainSigner?.toLowerCase().includes(query) ||
307
+ tx.destinationToAddress?.toLowerCase().includes(query)
308
+ ) {
309
+ return true
310
+ }
311
+
312
+ // Search in transaction hashes
313
+ if (
314
+ tx.txnHash?.toLowerCase().includes(query) ||
315
+ tx.metaTxnId?.toLowerCase().includes(query) ||
316
+ tx.originIntentTxHash?.toLowerCase().includes(query) ||
317
+ tx.destinationIntentTxHash?.toLowerCase().includes(query) ||
318
+ tx.originIntentDepositTxHash?.toLowerCase().includes(query) ||
319
+ tx.destinationIntentDepositTxHash?.toLowerCase().includes(query)
320
+ ) {
321
+ return true
322
+ }
323
+
324
+ // Search in token addresses
325
+ if (
326
+ tx.originTokenAddress?.toLowerCase().includes(query) ||
327
+ tx.destinationTokenAddress?.toLowerCase().includes(query)
328
+ ) {
329
+ return true
330
+ }
331
+
332
+ // Search in token symbols
333
+ if (
334
+ tx.originToken?.symbol?.toLowerCase().includes(query) ||
335
+ tx.destinationToken?.symbol?.toLowerCase().includes(query)
336
+ ) {
337
+ return true
338
+ }
339
+
340
+ // Search in status
341
+ if (tx.executionStatus?.toLowerCase().includes(query)) {
342
+ return true
343
+ }
344
+
345
+ // Search in chain IDs
346
+ if (
347
+ tx.originChainId?.toString().includes(query) ||
348
+ tx.destinationChainId?.toString().includes(query)
349
+ ) {
350
+ return true
351
+ }
352
+
353
+ return false
354
+ })
355
+ }, [transactions, searchQuery, statusFilter])
356
+
235
357
  if (!accountAddress) {
236
358
  return (
237
359
  <div
238
360
  className={`flex flex-col items-center justify-center py-12 ${className}`}
239
361
  >
240
362
  <div className="text-center">
241
- <div className="w-16 h-16 mx-auto mb-4 bg-gray-100 rounded-full flex items-center justify-center">
363
+ <div className="w-16 h-16 mx-auto mb-4 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center">
242
364
  <svg
243
- className="w-8 h-8 text-gray-400"
365
+ className="w-8 h-8 text-gray-400 dark:text-gray-500"
244
366
  fill="none"
245
367
  stroke="currentColor"
246
368
  viewBox="0 0 24 24"
@@ -253,10 +375,10 @@ export const AccountIntentTransactionHistory: React.FC<
253
375
  />
254
376
  </svg>
255
377
  </div>
256
- <h3 className="text-lg font-medium text-gray-900 mb-2">
378
+ <h3 className="text-lg font-medium text-gray-900 dark:text-gray-100 mb-2">
257
379
  Connect Wallet
258
380
  </h3>
259
- <p className="text-gray-600 max-w-sm">
381
+ <p className="text-gray-600 dark:text-gray-400 max-w-sm">
260
382
  Please connect your wallet to view your intent transaction history.
261
383
  </p>
262
384
  </div>
@@ -268,9 +390,9 @@ export const AccountIntentTransactionHistory: React.FC<
268
390
  return (
269
391
  <div className={`py-8 ${className}`}>
270
392
  <div className="text-center">
271
- <div className="w-16 h-16 mx-auto mb-4 bg-red-100 rounded-full flex items-center justify-center">
393
+ <div className="w-16 h-16 mx-auto mb-4 bg-red-100 dark:bg-red-900/20 rounded-full flex items-center justify-center">
272
394
  <svg
273
- className="w-8 h-8 text-red-400"
395
+ className="w-8 h-8 text-red-400 dark:text-red-500"
274
396
  fill="none"
275
397
  stroke="currentColor"
276
398
  viewBox="0 0 24 24"
@@ -283,13 +405,13 @@ export const AccountIntentTransactionHistory: React.FC<
283
405
  />
284
406
  </svg>
285
407
  </div>
286
- <h3 className="text-lg font-medium text-gray-900 mb-2">
408
+ <h3 className="text-lg font-medium text-gray-900 dark:text-gray-100 mb-2">
287
409
  Error Loading Transactions
288
410
  </h3>
289
- <p className="text-gray-600 mb-4">{error}</p>
411
+ <p className="text-gray-600 dark:text-gray-400 mb-4">{error}</p>
290
412
  <button
291
413
  onClick={refetch}
292
- className="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"
414
+ className="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 dark:bg-blue-700 dark:hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"
293
415
  >
294
416
  Try Again
295
417
  </button>
@@ -304,47 +426,176 @@ export const AccountIntentTransactionHistory: React.FC<
304
426
  onBack={onBack}
305
427
  headerContent="History"
306
428
  rightSideContent={
307
- <button
308
- onClick={refetch}
309
- disabled={loading}
310
- className={`p-2 rounded-md transition-colors cursor-pointer ${
311
- loading
312
- ? "opacity-50 cursor-not-allowed text-gray-400"
313
- : "text-gray-600 hover:bg-gray-50 hover:text-gray-700"
314
- } focus:outline-none focus:ring-2 focus:ring-blue-500`}
315
- title="Refresh"
316
- >
317
- <svg
318
- className={`w-4 h-4 ${loading ? "animate-spin" : ""}`}
319
- fill="none"
320
- stroke="currentColor"
321
- viewBox="0 0 24 24"
429
+ <div className="flex items-center gap-2">
430
+ {/* Refresh Button */}
431
+ <button
432
+ onClick={refetch}
433
+ disabled={loading}
434
+ className={`p-2 rounded-md transition-colors cursor-pointer ${
435
+ loading
436
+ ? "opacity-50 cursor-not-allowed text-gray-400 dark:text-gray-500"
437
+ : "text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-700 hover:text-gray-700 dark:hover:text-gray-200"
438
+ } focus:outline-none focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400`}
439
+ title="Refresh"
322
440
  >
323
- <path
324
- strokeLinecap="round"
325
- strokeLinejoin="round"
326
- strokeWidth={2}
327
- d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"
328
- />
329
- </svg>
330
- </button>
441
+ <svg
442
+ className={`w-4 h-4 ${loading ? "animate-spin" : ""}`}
443
+ fill="none"
444
+ stroke="currentColor"
445
+ viewBox="0 0 24 24"
446
+ >
447
+ <path
448
+ strokeLinecap="round"
449
+ strokeLinejoin="round"
450
+ strokeWidth={2}
451
+ d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"
452
+ />
453
+ </svg>
454
+ </button>
455
+
456
+ {/* Wallet Filter Dropdown */}
457
+ {connectedWallets.length > 1 && (
458
+ <div className="relative" ref={walletDropdownRef}>
459
+ <button
460
+ type="button"
461
+ onClick={() => setIsWalletDropdownOpen(!isWalletDropdownOpen)}
462
+ className="flex h-8 px-4 justify-between items-center gap-2 rounded-full border border-gray-300 bg-gray-50 dark:border-gray-600 dark:bg-gray-700 cursor-pointer transition-colors text-gray-900 dark:text-gray-200 hover:bg-gray-50 dark:hover:bg-gray-600"
463
+ title="Filter by wallet"
464
+ >
465
+ <div className="flex items-center gap-2">
466
+ <Identicon value={effectiveAccountAddress} size={16} />
467
+ <span className="text-xs text-gray-600 dark:text-gray-400 font-medium whitespace-nowrap">
468
+ {truncateAddress(effectiveAccountAddress, 4, 2)}
469
+ </span>
470
+ </div>
471
+ <ChevronDown className="w-4 h-4" />
472
+ </button>
473
+
474
+ {isWalletDropdownOpen && (
475
+ <div className="absolute top-full right-0 mt-0.5 min-w-[140px] max-w-[180px] trails-bg-secondary border border-gray-200 dark:border-gray-700 rounded-xl shadow-lg z-20 whitespace-nowrap">
476
+ {connectedWallets.map((wallet) => (
477
+ <button
478
+ key={wallet.address}
479
+ type="button"
480
+ onClick={() => {
481
+ setSelectedWalletAddress(wallet.address)
482
+ setIsWalletDropdownOpen(false)
483
+ }}
484
+ className={`w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors cursor-pointer first:rounded-t-xl last:rounded-b-xl ${
485
+ effectiveAccountAddress === wallet.address
486
+ ? "bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400"
487
+ : "text-gray-700 dark:text-gray-300"
488
+ }`}
489
+ >
490
+ <Identicon value={wallet.address} size={16} />
491
+ <span className="text-xs font-mono">
492
+ {truncateAddress(wallet.address, 4, 4)}
493
+ </span>
494
+ </button>
495
+ ))}
496
+ </div>
497
+ )}
498
+ </div>
499
+ )}
500
+ </div>
331
501
  }
332
502
  />
333
503
 
504
+ {/* Search Input */}
505
+ <div className="py-2">
506
+ <SearchInputField
507
+ value={searchQuery}
508
+ onChange={setSearchQuery}
509
+ placeholder="Search history..."
510
+ rightAlignedComponent={
511
+ searchQuery && (
512
+ <button
513
+ onClick={() => setSearchQuery("")}
514
+ className="p-2 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 transition-colors cursor-pointer"
515
+ title="Clear search"
516
+ >
517
+ <svg
518
+ className="w-4 h-4"
519
+ fill="none"
520
+ stroke="currentColor"
521
+ viewBox="0 0 24 24"
522
+ >
523
+ <path
524
+ strokeLinecap="round"
525
+ strokeLinejoin="round"
526
+ strokeWidth={2}
527
+ d="M6 18L18 6M6 6l12 12"
528
+ />
529
+ </svg>
530
+ </button>
531
+ )
532
+ }
533
+ />
534
+
535
+ {/* Status Filter Buttons */}
536
+ <div className="flex items-center gap-2 mt-2">
537
+ <button
538
+ onClick={() =>
539
+ setStatusFilter(statusFilter === "completed" ? null : "completed")
540
+ }
541
+ className={`px-2 py-1.5 rounded-xl transition-colors cursor-pointer text-xs ${
542
+ statusFilter === "completed"
543
+ ? "bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/20"
544
+ : "trails-bg-secondary text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600"
545
+ }`}
546
+ >
547
+ <span className="text-xs font-medium">Completed</span>
548
+ </button>
549
+ <button
550
+ onClick={() =>
551
+ setStatusFilter(statusFilter === "pending" ? null : "pending")
552
+ }
553
+ className={`px-2 py-1.5 rounded-xl transition-colors cursor-pointer text-xs ${
554
+ statusFilter === "pending"
555
+ ? "bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/20"
556
+ : "trails-bg-secondary text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600"
557
+ }`}
558
+ >
559
+ <span className="text-xs font-medium">Pending</span>
560
+ </button>
561
+ <button
562
+ onClick={() =>
563
+ setStatusFilter(statusFilter === "failed" ? null : "failed")
564
+ }
565
+ className={`px-2 py-1.5 rounded-xl transition-colors cursor-pointer text-xs ${
566
+ statusFilter === "failed"
567
+ ? "bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/20"
568
+ : "trails-bg-secondary text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600"
569
+ }`}
570
+ >
571
+ <span className="text-xs font-medium">Failed</span>
572
+ </button>
573
+ </div>
574
+
575
+ {(searchQuery || statusFilter) && transactions.length > 0 && (
576
+ <div className="text-xs text-gray-500 dark:text-gray-400 mt-2 px-1">
577
+ Showing {filteredTransactions.length} of {transactions.length}{" "}
578
+ transaction{transactions.length !== 1 ? "s" : ""}
579
+ </div>
580
+ )}
581
+ </div>
582
+
334
583
  <div className="flex-1 overflow-hidden flex flex-col">
335
584
  {loading && transactions.length === 0 ? (
336
585
  <div className="flex items-center justify-center flex-1">
337
586
  <div className="flex flex-col items-center">
338
- <div className="animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mb-4"></div>
339
- <p className="text-gray-600">Loading intent transactions...</p>
587
+ <div className="animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 dark:border-blue-400 mb-4"></div>
588
+ <p className="text-gray-600 dark:text-gray-400">
589
+ Loading intent transactions...
590
+ </p>
340
591
  </div>
341
592
  </div>
342
593
  ) : transactions.length === 0 ? (
343
594
  <div className="text-center flex-1 flex items-center justify-center">
344
595
  <div>
345
- <div className="w-16 h-16 mx-auto mb-4 bg-gray-100 rounded-full flex items-center justify-center">
596
+ <div className="w-16 h-16 mx-auto mb-4 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center">
346
597
  <svg
347
- className="w-8 h-8 text-gray-400"
598
+ className="w-8 h-8 text-gray-400 dark:text-gray-500"
348
599
  fill="none"
349
600
  stroke="currentColor"
350
601
  viewBox="0 0 24 24"
@@ -357,18 +608,50 @@ export const AccountIntentTransactionHistory: React.FC<
357
608
  />
358
609
  </svg>
359
610
  </div>
360
- <h3 className="text-lg font-medium text-gray-900 mb-2">
611
+ <h3 className="text-lg font-medium text-gray-900 dark:text-gray-100 mb-2">
361
612
  No Intent Transactions
362
613
  </h3>
363
- <p className="text-gray-600">
614
+ <p className="text-gray-600 dark:text-gray-400">
364
615
  No intent transactions found for this account. Create your first
365
616
  intent transaction to see it here.
366
617
  </p>
367
618
  </div>
368
619
  </div>
620
+ ) : filteredTransactions.length === 0 ? (
621
+ <div className="text-center flex-1 flex items-center justify-center">
622
+ <div>
623
+ <div className="w-16 h-16 mx-auto mb-4 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center">
624
+ <svg
625
+ className="w-8 h-8 text-gray-400 dark:text-gray-500"
626
+ fill="none"
627
+ stroke="currentColor"
628
+ viewBox="0 0 24 24"
629
+ >
630
+ <path
631
+ strokeLinecap="round"
632
+ strokeLinejoin="round"
633
+ strokeWidth={2}
634
+ d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
635
+ />
636
+ </svg>
637
+ </div>
638
+ <h3 className="text-lg font-medium text-gray-900 dark:text-gray-100 mb-2">
639
+ No Results Found
640
+ </h3>
641
+ <p className="text-gray-600 dark:text-gray-400">
642
+ {searchQuery && statusFilter
643
+ ? `No ${statusFilter} transactions match "${searchQuery}".`
644
+ : searchQuery
645
+ ? `No transactions match your search "${searchQuery}".`
646
+ : statusFilter
647
+ ? `No ${statusFilter} transactions found.`
648
+ : "No transactions found."}
649
+ </p>
650
+ </div>
651
+ </div>
369
652
  ) : (
370
653
  <div className="flex-1 overflow-y-auto space-y-3 pr-2">
371
- {transactions.map((transaction, index) => (
654
+ {filteredTransactions.map((transaction, index) => (
372
655
  <TransactionItem
373
656
  key={`${transaction.originIntentAddress}-${transaction.destinationIntentAddress}-${index}`}
374
657
  transaction={transaction}
@@ -378,13 +661,13 @@ export const AccountIntentTransactionHistory: React.FC<
378
661
  </div>
379
662
  )}
380
663
 
381
- {/* Pagination Controls - Always show unless no transactions on first page */}
382
- {!(transactions.length === 0 && page === 0) && (
664
+ {/* Pagination Controls - Hide when searching, always show unless no transactions on first page */}
665
+ {!searchQuery && !(transactions.length === 0 && page === 0) && (
383
666
  <div className="flex items-center justify-center pt-2 mt-2 gap-4">
384
667
  <button
385
668
  onClick={prevPage}
386
669
  disabled={!hasPrev || loading}
387
- className="p-2 rounded-full transition-colors text-gray-600 hover:bg-gray-50 hover:text-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer"
670
+ className="p-2 rounded-full transition-colors text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-700 hover:text-gray-700 dark:hover:text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer"
388
671
  >
389
672
  <svg
390
673
  className="w-4 h-4"
@@ -404,7 +687,7 @@ export const AccountIntentTransactionHistory: React.FC<
404
687
  <button
405
688
  onClick={nextPage}
406
689
  disabled={!hasMore || loading}
407
- className="p-2 rounded-full transition-colors text-gray-600 hover:bg-gray-50 hover:text-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer"
690
+ className="p-2 rounded-full transition-colors text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-700 hover:text-gray-700 dark:hover:text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer"
408
691
  >
409
692
  <svg
410
693
  className="w-4 h-4"