0xtrails 0.1.13 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. package/dist/aave.d.ts.map +1 -1
  2. package/dist/analytics.d.ts +11 -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/{proxyCaller.d.ts → balanceInjector.d.ts} +5 -4
  7. package/dist/balanceInjector.d.ts.map +1 -0
  8. package/dist/{ccip-D3gTQONK.js → ccip-D6ToCrWc.js} +12 -12
  9. package/dist/cctp.d.ts.map +1 -1
  10. package/dist/cctpqueue.d.ts +3 -3
  11. package/dist/cctpqueue.d.ts.map +1 -1
  12. package/dist/chains.d.ts.map +1 -1
  13. package/dist/config.d.ts +17 -3
  14. package/dist/config.d.ts.map +1 -1
  15. package/dist/constants.d.ts +5 -4
  16. package/dist/constants.d.ts.map +1 -1
  17. package/dist/contractUtils.d.ts +2 -0
  18. package/dist/contractUtils.d.ts.map +1 -1
  19. package/dist/customChains.d.ts +24 -0
  20. package/dist/customChains.d.ts.map +1 -0
  21. package/dist/{index-CnUM7lKf.js → index-BqgeTLL8.js} +34072 -30146
  22. package/dist/index.d.ts +5 -3
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +411 -400
  25. package/dist/intentEntrypoint.d.ts +96 -0
  26. package/dist/intentEntrypoint.d.ts.map +1 -0
  27. package/dist/intents.d.ts +5 -3
  28. package/dist/intents.d.ts.map +1 -1
  29. package/dist/metaTxnMonitor.d.ts.map +1 -1
  30. package/dist/morpho.d.ts.map +1 -1
  31. package/dist/pools.d.ts +3 -1
  32. package/dist/pools.d.ts.map +1 -1
  33. package/dist/prepareSend.d.ts +8 -2
  34. package/dist/prepareSend.d.ts.map +1 -1
  35. package/dist/prices.d.ts +1 -1
  36. package/dist/prices.d.ts.map +1 -1
  37. package/dist/relaySdk.d.ts.map +1 -1
  38. package/dist/relayer.d.ts.map +1 -1
  39. package/dist/toast.d.ts +9 -0
  40. package/dist/toast.d.ts.map +1 -0
  41. package/dist/tokenBalances.d.ts +6 -2
  42. package/dist/tokenBalances.d.ts.map +1 -1
  43. package/dist/tokens.d.ts.map +1 -1
  44. package/dist/trails.d.ts +6 -5
  45. package/dist/trails.d.ts.map +1 -1
  46. package/dist/trailsClient.d.ts +12 -0
  47. package/dist/trailsClient.d.ts.map +1 -0
  48. package/dist/transactions.d.ts +8 -0
  49. package/dist/transactions.d.ts.map +1 -1
  50. package/dist/wallets.d.ts.map +1 -1
  51. package/dist/widget/components/AccountActionsDropdown.d.ts.map +1 -1
  52. package/dist/widget/components/AccountIntentTransactionHistory.d.ts.map +1 -1
  53. package/dist/widget/components/AccountSettings.d.ts +7 -0
  54. package/dist/widget/components/AccountSettings.d.ts.map +1 -0
  55. package/dist/widget/components/ChainList.d.ts +0 -1
  56. package/dist/widget/components/ChainList.d.ts.map +1 -1
  57. package/dist/widget/components/ClassicSwap.d.ts +46 -0
  58. package/dist/widget/components/ClassicSwap.d.ts.map +1 -0
  59. package/dist/widget/components/ConfigDisplay.d.ts.map +1 -1
  60. package/dist/widget/components/ConnectedWallets.d.ts +9 -0
  61. package/dist/widget/components/ConnectedWallets.d.ts.map +1 -0
  62. package/dist/widget/components/DebugMenu.d.ts.map +1 -1
  63. package/dist/widget/components/DebugScreensList.d.ts.map +1 -1
  64. package/dist/widget/components/DebugToast.d.ts +3 -0
  65. package/dist/widget/components/DebugToast.d.ts.map +1 -0
  66. package/dist/widget/components/Earn.d.ts.map +1 -1
  67. package/dist/widget/components/EarnPools.d.ts.map +1 -1
  68. package/dist/widget/components/Fund.d.ts +44 -0
  69. package/dist/widget/components/Fund.d.ts.map +1 -0
  70. package/dist/widget/components/Identicon.d.ts +9 -0
  71. package/dist/widget/components/Identicon.d.ts.map +1 -0
  72. package/dist/widget/components/Pay.d.ts +46 -0
  73. package/dist/widget/components/Pay.d.ts.map +1 -0
  74. package/dist/widget/components/Receive.d.ts.map +1 -1
  75. package/dist/widget/components/RecentTokens.d.ts.map +1 -1
  76. package/dist/widget/components/Recipients.d.ts +9 -0
  77. package/dist/widget/components/Recipients.d.ts.map +1 -0
  78. package/dist/widget/components/RefundWarning.d.ts +9 -0
  79. package/dist/widget/components/RefundWarning.d.ts.map +1 -0
  80. package/dist/widget/components/SimpleSwap.d.ts.map +1 -1
  81. package/dist/widget/components/Swap.d.ts.map +1 -1
  82. package/dist/widget/components/SwapSettings.d.ts +1 -5
  83. package/dist/widget/components/SwapSettings.d.ts.map +1 -1
  84. package/dist/widget/components/ThemeProvider.d.ts.map +1 -1
  85. package/dist/widget/components/ThemeSyncer.d.ts +6 -0
  86. package/dist/widget/components/ThemeSyncer.d.ts.map +1 -0
  87. package/dist/widget/components/Toast.d.ts +24 -0
  88. package/dist/widget/components/Toast.d.ts.map +1 -0
  89. package/dist/widget/components/TokenList.d.ts.map +1 -1
  90. package/dist/widget/components/TransactionDetails.d.ts.map +1 -1
  91. package/dist/widget/components/TruncatedAddress.d.ts +2 -0
  92. package/dist/widget/components/TruncatedAddress.d.ts.map +1 -1
  93. package/dist/widget/components/UserPreferences.d.ts +7 -0
  94. package/dist/widget/components/UserPreferences.d.ts.map +1 -0
  95. package/dist/widget/hooks/useBalanceVisible.d.ts +1 -0
  96. package/dist/widget/hooks/useBalanceVisible.d.ts.map +1 -1
  97. package/dist/widget/hooks/useCheckout.d.ts.map +1 -1
  98. package/dist/widget/hooks/useCurrentScreen.d.ts +1 -1
  99. package/dist/widget/hooks/useCurrentScreen.d.ts.map +1 -1
  100. package/dist/widget/hooks/useDebugScreens.d.ts +1 -1
  101. package/dist/widget/hooks/useDebugScreens.d.ts.map +1 -1
  102. package/dist/widget/hooks/useDefaultTokenSelection.d.ts +54 -0
  103. package/dist/widget/hooks/useDefaultTokenSelection.d.ts.map +1 -0
  104. package/dist/widget/hooks/useIntentTransactionHistory.d.ts.map +1 -1
  105. package/dist/widget/hooks/usePayMessage.d.ts +34 -0
  106. package/dist/widget/hooks/usePayMessage.d.ts.map +1 -0
  107. package/dist/widget/hooks/useRecipients.d.ts +17 -0
  108. package/dist/widget/hooks/useRecipients.d.ts.map +1 -0
  109. package/dist/widget/hooks/useSelectedRecipient.d.ts +12 -0
  110. package/dist/widget/hooks/useSelectedRecipient.d.ts.map +1 -0
  111. package/dist/widget/hooks/useSendForm.d.ts +2 -0
  112. package/dist/widget/hooks/useSendForm.d.ts.map +1 -1
  113. package/dist/widget/hooks/useSwapAmount.d.ts +13 -0
  114. package/dist/widget/hooks/useSwapAmount.d.ts.map +1 -0
  115. package/dist/widget/hooks/useSwapSettings.d.ts +16 -0
  116. package/dist/widget/hooks/useSwapSettings.d.ts.map +1 -0
  117. package/dist/widget/hooks/useTargetAmount.d.ts +5 -0
  118. package/dist/widget/hooks/useTargetAmount.d.ts.map +1 -0
  119. package/dist/widget/hooks/useTheme.d.ts +14 -0
  120. package/dist/widget/hooks/useTheme.d.ts.map +1 -0
  121. package/dist/widget/hooks/useTokenList.d.ts.map +1 -1
  122. package/dist/widget/index.js +2 -2
  123. package/dist/widget/widget.d.ts +9 -0
  124. package/dist/widget/widget.d.ts.map +1 -1
  125. package/package.json +29 -28
  126. package/src/aave.ts +6 -1
  127. package/src/analytics.ts +103 -53
  128. package/src/apiClient.ts +1 -1
  129. package/src/{proxyCaller.ts → balanceInjector.ts} +22 -17
  130. package/src/cctp.ts +6 -2
  131. package/src/cctpqueue.ts +7 -7
  132. package/src/chains.ts +8 -0
  133. package/src/config.ts +40 -9
  134. package/src/constants.ts +11 -8
  135. package/src/contractUtils.ts +33 -2
  136. package/src/customChains.ts +24 -0
  137. package/src/index.ts +11 -1
  138. package/src/intentEntrypoint.ts +253 -0
  139. package/src/intents.ts +87 -54
  140. package/src/metaTxnMonitor.ts +1 -0
  141. package/src/morpho.ts +13 -2
  142. package/src/pools.ts +68 -86
  143. package/src/prepareSend.ts +437 -207
  144. package/src/prices.ts +51 -7
  145. package/src/relaySdk.ts +6 -4
  146. package/src/relayer.ts +2 -0
  147. package/src/toast.ts +110 -0
  148. package/src/tokenBalances.ts +112 -20
  149. package/src/tokens.ts +70 -7
  150. package/src/trails.ts +80 -77
  151. package/src/trailsClient.ts +45 -0
  152. package/src/transactions.ts +27 -35
  153. package/src/umd.tsx +1 -1
  154. package/src/wallets.ts +2 -1
  155. package/src/widget/assets/sequence-logo.svg +15 -0
  156. package/src/widget/compiled.css +2 -2
  157. package/src/widget/components/AccountActionsDropdown.tsx +18 -159
  158. package/src/widget/components/AccountIntentTransactionHistory.tsx +346 -63
  159. package/src/widget/components/AccountSettings.tsx +96 -0
  160. package/src/widget/components/ChainFilterDropdown.tsx +1 -1
  161. package/src/widget/components/ChainList.tsx +10 -20
  162. package/src/widget/components/ClassicSwap.tsx +923 -0
  163. package/src/widget/components/ConfigDisplay.tsx +8 -5
  164. package/src/widget/components/ConnectedWallets.tsx +260 -0
  165. package/src/widget/components/DebugMenu.tsx +2 -0
  166. package/src/widget/components/DebugScreensList.tsx +3 -0
  167. package/src/widget/components/DebugToast.tsx +63 -0
  168. package/src/widget/components/Earn.tsx +108 -116
  169. package/src/widget/components/EarnPools.tsx +2 -4
  170. package/src/widget/components/EarnPoolsFilters.tsx +6 -6
  171. package/src/widget/components/Fund.tsx +1245 -0
  172. package/src/widget/components/FundMethods.tsx +1 -1
  173. package/src/widget/components/FundSendForm.tsx +1 -1
  174. package/src/widget/components/Identicon.tsx +158 -0
  175. package/src/widget/components/Pay.tsx +1088 -0
  176. package/src/widget/components/PaySendForm.tsx +1 -1
  177. package/src/widget/components/QuoteDetails.tsx +1 -1
  178. package/src/widget/components/Receipt.tsx +1 -1
  179. package/src/widget/components/Receive.tsx +4 -2
  180. package/src/widget/components/RecentTokens.tsx +2 -1
  181. package/src/widget/components/Recipients.tsx +448 -0
  182. package/src/widget/components/RefundWarning.tsx +61 -0
  183. package/src/widget/components/ScreenHeader.tsx +1 -1
  184. package/src/widget/components/SimpleSwap.tsx +74 -58
  185. package/src/widget/components/Swap.tsx +35 -853
  186. package/src/widget/components/SwapSettings.tsx +5 -11
  187. package/src/widget/components/ThemeProvider.tsx +32 -0
  188. package/src/widget/components/ThemeSyncer.tsx +47 -0
  189. package/src/widget/components/Toast.tsx +315 -0
  190. package/src/widget/components/TokenList.tsx +2 -34
  191. package/src/widget/components/TokenSelector.tsx +3 -3
  192. package/src/widget/components/TransactionDetails.tsx +153 -13
  193. package/src/widget/components/TruncatedAddress.tsx +5 -1
  194. package/src/widget/components/UserPreferences.tsx +156 -0
  195. package/src/widget/components/WalletList.tsx +1 -1
  196. package/src/widget/hooks/useBalanceVisible.tsx +40 -2
  197. package/src/widget/hooks/useCheckout.ts +13 -0
  198. package/src/widget/hooks/useCurrentScreen.tsx +3 -0
  199. package/src/widget/hooks/useDebugScreens.ts +12 -2
  200. package/src/widget/hooks/useDefaultTokenSelection.tsx +475 -0
  201. package/src/widget/hooks/useIntentTransactionHistory.ts +212 -0
  202. package/src/widget/hooks/usePayMessage.tsx +370 -0
  203. package/src/widget/hooks/useRecipients.ts +168 -0
  204. package/src/widget/hooks/useSelectedRecipient.tsx +48 -0
  205. package/src/widget/hooks/useSendForm.ts +179 -26
  206. package/src/widget/hooks/useSwapAmount.tsx +50 -0
  207. package/src/widget/hooks/useSwapSettings.tsx +100 -0
  208. package/src/widget/hooks/useTargetAmount.ts +23 -0
  209. package/src/widget/hooks/useTheme.tsx +80 -0
  210. package/src/widget/hooks/useTokenList.ts +20 -11
  211. package/src/widget/index.css +45 -21
  212. package/src/widget/widget.tsx +164 -68
  213. package/dist/address.d.ts +0 -2
  214. package/dist/address.d.ts.map +0 -1
  215. package/dist/proxyCaller.d.ts.map +0 -1
  216. package/src/address.ts +0 -6
@@ -3,7 +3,7 @@ import { useEffect, useState } from "react"
3
3
  import {
4
4
  globalConfig,
5
5
  getSequenceEnv,
6
- getSequenceApiUrl,
6
+ getTrailsApiUrl,
7
7
  getSequenceIndexerUrl,
8
8
  getSequenceProjectAccessKey,
9
9
  getWalletConnectProjectId,
@@ -15,6 +15,7 @@ import type { RelayerEnv } from "../../relayer.js"
15
15
  import { getChainInfo } from "../../chains.js"
16
16
  import { mainnet } from "viem/chains"
17
17
  import { logger } from "../../logger.js"
18
+ import { useWidgetProps } from "../hooks/useWidgetProps.js"
18
19
 
19
20
  interface ConfigDisplayProps {
20
21
  className?: string
@@ -23,8 +24,9 @@ interface ConfigDisplayProps {
23
24
  export const ConfigDisplay: React.FC<ConfigDisplayProps> = ({
24
25
  className = "",
25
26
  }) => {
27
+ const { toast = false } = useWidgetProps()
26
28
  const [sequenceEnv, setSequenceEnv] = useState(getSequenceEnv())
27
- const [sequenceApiUrl, setSequenceApiUrl] = useState(getSequenceApiUrl())
29
+ const [trailsApiUrl, setTrailsApiUrl] = useState(getTrailsApiUrl())
28
30
  const [sequenceIndexerUrl, setSequenceIndexerUrl] = useState(
29
31
  getSequenceIndexerUrl(),
30
32
  )
@@ -51,7 +53,7 @@ export const ConfigDisplay: React.FC<ConfigDisplayProps> = ({
51
53
  const updateConfig = () => {
52
54
  logger.console.log("[trails-sdk] globalConfig", globalConfig)
53
55
  setSequenceEnv(getSequenceEnv())
54
- setSequenceApiUrl(getSequenceApiUrl())
56
+ setTrailsApiUrl(getTrailsApiUrl())
55
57
  setSequenceIndexerUrl(getSequenceIndexerUrl())
56
58
  setProjectAccessKey(getSequenceProjectAccessKey())
57
59
  setWalletConnectProjectId(getWalletConnectProjectId())
@@ -81,8 +83,8 @@ export const ConfigDisplay: React.FC<ConfigDisplayProps> = ({
81
83
  { label: "Sequence ENV", value: sequenceEnv, display: sequenceEnv },
82
84
  {
83
85
  label: "API URL",
84
- value: sequenceApiUrl,
85
- display: truncateString(sequenceApiUrl),
86
+ value: trailsApiUrl,
87
+ display: truncateString(trailsApiUrl),
86
88
  },
87
89
  {
88
90
  label: "Indexer URL",
@@ -111,6 +113,7 @@ export const ConfigDisplay: React.FC<ConfigDisplayProps> = ({
111
113
  },
112
114
  { label: "Slippage Tolerance", value: `${slippageTolerance}%` },
113
115
  { label: "Debug Mode", value: debugMode ? "Enabled" : "Disabled" },
116
+ { label: "Toast Notifications", value: toast ? "Enabled" : "Disabled" },
114
117
  ]
115
118
 
116
119
  return (
@@ -0,0 +1,260 @@
1
+ import { useState } from "react"
2
+ import type React from "react"
3
+ import { Wallet, Copy } from "lucide-react"
4
+ import { useAccount, useConnections, useSwitchAccount } from "wagmi"
5
+ import { useWallets, wagmiConnectorToWalletId } from "../../wallets.js"
6
+ import { logger } from "../../logger.js"
7
+ import { truncateAddress } from "../../utils.js"
8
+
9
+ export interface ConnectedWalletsProps {
10
+ onWalletSwitch?: (address: string) => void
11
+ showActiveWallet?: boolean
12
+ className?: string
13
+ }
14
+
15
+ export const ConnectedWallets: React.FC<ConnectedWalletsProps> = ({
16
+ onWalletSwitch,
17
+ showActiveWallet = true,
18
+ className = "",
19
+ }) => {
20
+ const { address, connector } = useAccount()
21
+ const connections = useConnections()
22
+ const { switchAccount } = useSwitchAccount()
23
+ const { wallets: allWallets } = useWallets()
24
+ const [error, setError] = useState<string | null>(null)
25
+ const [copiedAddress, setCopiedAddress] = useState<string | null>(null)
26
+
27
+ // Get all connected wallets with their details
28
+ const getConnectedWallets = () => {
29
+ const walletMap = new Map()
30
+
31
+ connections.forEach((connection) => {
32
+ // Process each account in the connection
33
+ connection.accounts.forEach((account) => {
34
+ if (account && !walletMap.has(account)) {
35
+ const walletId = wagmiConnectorToWalletId(connection.connector)
36
+ const walletConfig = allWallets.find(
37
+ (wallet) => wallet.id === walletId,
38
+ )
39
+
40
+ walletMap.set(account, {
41
+ address: account,
42
+ connector: connection.connector,
43
+ walletConfig,
44
+ walletId,
45
+ isActive:
46
+ connection.connector.id === connector?.id && account === address,
47
+ })
48
+ }
49
+ })
50
+ })
51
+
52
+ return Array.from(walletMap.values())
53
+ }
54
+
55
+ const connectedWallets = getConnectedWallets()
56
+
57
+ // Handle switching to a different connected wallet
58
+ const handleWalletSwitch = async (
59
+ walletAddress: string,
60
+ walletConnector: any,
61
+ ) => {
62
+ try {
63
+ setError(null)
64
+ // Find the connection for this wallet
65
+ const connection = connections.find(
66
+ (conn) =>
67
+ conn.accounts.includes(walletAddress as `0x${string}`) &&
68
+ conn.connector.id === walletConnector.id,
69
+ )
70
+
71
+ if (connection) {
72
+ await switchAccount({
73
+ connector: connection.connector,
74
+ })
75
+ logger.console.log(`[trails-sdk] Switched to wallet: ${walletAddress}`)
76
+
77
+ // Call the optional callback
78
+ if (onWalletSwitch) {
79
+ onWalletSwitch(walletAddress)
80
+ }
81
+ }
82
+ } catch (error) {
83
+ logger.console.error("[trails-sdk] Failed to switch wallet:", error)
84
+ setError(
85
+ error instanceof Error ? error.message : "Failed to switch wallet",
86
+ )
87
+ }
88
+ }
89
+
90
+ // Handle copy to clipboard with success indication
91
+ const handleCopyAddress = async (address: string, e: React.MouseEvent) => {
92
+ e.preventDefault()
93
+ e.stopPropagation()
94
+ try {
95
+ await navigator.clipboard.writeText(address)
96
+ setCopiedAddress(address)
97
+ setTimeout(() => setCopiedAddress(null), 2000) // Clear after 2 seconds
98
+ logger.console.log("[trails-sdk] Successfully copied address:", address)
99
+ } catch (error) {
100
+ logger.console.error("[trails-sdk] Failed to copy address:", error)
101
+ // Fallback for older browsers or when clipboard API is not available
102
+ try {
103
+ const textArea = document.createElement("textarea")
104
+ textArea.value = address
105
+ document.body.appendChild(textArea)
106
+ textArea.select()
107
+ document.execCommand("copy")
108
+ document.body.removeChild(textArea)
109
+ setCopiedAddress(address)
110
+ setTimeout(() => setCopiedAddress(null), 2000)
111
+ logger.console.log(
112
+ "[trails-sdk] Successfully copied address using fallback:",
113
+ address,
114
+ )
115
+ } catch (fallbackError) {
116
+ logger.console.error(
117
+ "[trails-sdk] Fallback copy also failed:",
118
+ fallbackError,
119
+ )
120
+ }
121
+ }
122
+ }
123
+
124
+ if (connectedWallets.length === 0) {
125
+ return null
126
+ }
127
+
128
+ return (
129
+ <div className={`space-y-2 ${className}`}>
130
+ {/* Header */}
131
+ <div className="flex items-center gap-2 mb-3">
132
+ <Wallet className="h-4 w-4 text-gray-400 dark:text-gray-500" />
133
+ <span className="text-sm font-medium text-gray-500 dark:text-gray-400">
134
+ Connected Wallets
135
+ </span>
136
+ </div>
137
+
138
+ {error && (
139
+ <div className="border rounded-lg p-4 bg-red-50 border-red-200 dark:bg-red-900/20 dark:border-red-800">
140
+ <p className="text-sm break-words text-red-600 dark:text-red-200">
141
+ {error}
142
+ </p>
143
+ </div>
144
+ )}
145
+
146
+ {/* Connected Wallets List */}
147
+ {connectedWallets.map((wallet) => {
148
+ // Skip active wallet if showActiveWallet is false
149
+ if (!showActiveWallet && wallet.isActive) {
150
+ return null
151
+ }
152
+
153
+ return (
154
+ <div key={wallet.address} className="space-y-1">
155
+ {/* Wallet Button */}
156
+ <div
157
+ onClick={() => {
158
+ if (!wallet.isActive) {
159
+ handleWalletSwitch(wallet.address, wallet.connector)
160
+ }
161
+ }}
162
+ onKeyDown={(e) => {
163
+ if ((e.key === "Enter" || e.key === " ") && !wallet.isActive) {
164
+ e.preventDefault()
165
+ handleWalletSwitch(wallet.address, wallet.connector)
166
+ }
167
+ }}
168
+ tabIndex={wallet.isActive ? -1 : 0}
169
+ className={`group w-full flex items-center justify-between font-medium py-2 px-3 rounded-lg transition-all duration-200 ${
170
+ wallet.isActive
171
+ ? "bg-blue-50 dark:bg-blue-900/20 text-gray-700 dark:text-gray-300 cursor-default"
172
+ : "bg-gray-50 dark:bg-gray-700 text-gray-700 dark:text-gray-300 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-600"
173
+ }`}
174
+ >
175
+ <div className="flex items-center space-x-3">
176
+ {typeof wallet.walletConfig?.icon === "string" ? (
177
+ <img
178
+ src={wallet.walletConfig.icon}
179
+ alt={wallet.walletConfig.name}
180
+ className="h-5 w-5"
181
+ />
182
+ ) : (
183
+ <Wallet className="h-5 w-5 text-gray-600 dark:text-gray-400" />
184
+ )}
185
+ <div className="flex flex-col items-start space-y-1">
186
+ <div className="flex items-center space-x-2">
187
+ <span className="text-sm">
188
+ {wallet.walletConfig?.name ||
189
+ wallet.connector?.name ||
190
+ "Wallet"}
191
+ </span>
192
+ </div>
193
+ <div className="flex items-center space-x-1">
194
+ <span className="text-xs text-gray-500 dark:text-gray-400 font-mono">
195
+ {truncateAddress(wallet.address)}
196
+ </span>
197
+ <button
198
+ type="button"
199
+ onClick={(e) => {
200
+ e.preventDefault()
201
+ e.stopPropagation()
202
+ handleCopyAddress(wallet.address, e)
203
+ }}
204
+ onMouseDown={(e) => e.stopPropagation()}
205
+ onMouseUp={(e) => e.stopPropagation()}
206
+ className={`p-0.5 rounded transition-all duration-200 cursor-pointer z-10 relative ${
207
+ copiedAddress === wallet.address
208
+ ? "bg-green-100 dark:bg-green-900/30"
209
+ : "hover:bg-gray-200 dark:hover:bg-gray-600"
210
+ }`}
211
+ title={
212
+ copiedAddress === wallet.address
213
+ ? "Copied!"
214
+ : "Copy full address"
215
+ }
216
+ >
217
+ {copiedAddress === wallet.address ? (
218
+ <svg
219
+ className="w-3 h-3 text-green-600 dark:text-green-400"
220
+ fill="none"
221
+ viewBox="0 0 24 24"
222
+ stroke="currentColor"
223
+ aria-label="Copied"
224
+ >
225
+ <title>Copied</title>
226
+ <path
227
+ strokeLinecap="round"
228
+ strokeLinejoin="round"
229
+ strokeWidth={2}
230
+ d="M5 13l4 4L19 7"
231
+ />
232
+ </svg>
233
+ ) : (
234
+ <Copy className="w-3 h-3 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300" />
235
+ )}
236
+ </button>
237
+ </div>
238
+ </div>
239
+ </div>
240
+
241
+ <div className="flex items-center">
242
+ {wallet.isActive ? (
243
+ <span className="text-xs px-2 py-1 rounded font-medium bg-blue-500 text-white">
244
+ Active
245
+ </span>
246
+ ) : (
247
+ <span className="text-xs px-2 py-1 rounded font-medium bg-gray-200 text-gray-700 dark:bg-gray-600 dark:text-gray-300 opacity-0 group-hover:opacity-100 transition-opacity duration-200">
248
+ Set as active
249
+ </span>
250
+ )}
251
+ </div>
252
+ </div>
253
+ </div>
254
+ )
255
+ })}
256
+ </div>
257
+ )
258
+ }
259
+
260
+ export default ConnectedWallets
@@ -4,6 +4,7 @@ import { useRef, useState } from "react"
4
4
  import { getDebug } from "../../config.js"
5
5
  import { ConfigDisplay } from "./ConfigDisplay.js"
6
6
  import { DebugScreensList } from "./DebugScreensList.js"
7
+ import { DebugToast } from "./DebugToast.js"
7
8
 
8
9
  interface DebugMenuProps {
9
10
  onScreenSelect: (screen: string) => void
@@ -39,6 +40,7 @@ export const DebugMenu: React.FC<DebugMenuProps> = ({ onScreenSelect }) => {
39
40
  {isOpen && (
40
41
  <div className="absolute bottom-full right-0 mb-1 w-80 border border-solid rounded-lg shadow-lg overflow-hidden max-h-[400px] overflow-y-auto custom-scrollbar bg-white border-gray-200 text-gray-700 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-200 z-50">
41
42
  <DebugScreensList onScreenSelect={handleScreenSelect} />
43
+ <DebugToast />
42
44
  <ConfigDisplay />
43
45
  </div>
44
46
  )}
@@ -16,6 +16,7 @@ const SCREENS = [
16
16
  "Chain List",
17
17
  "Send Form",
18
18
  "Fund Form",
19
+ "Recipients",
19
20
  "Earn",
20
21
  "Earn Pools",
21
22
  "Swap",
@@ -36,6 +37,8 @@ const SCREENS = [
36
37
  "Receipt Failed",
37
38
  "Receipt Refunded",
38
39
  "Account History",
40
+ "Account Settings",
41
+ "User Preferences",
39
42
  ] as const
40
43
 
41
44
  export const DebugScreensList: React.FC<DebugScreensListProps> = ({
@@ -0,0 +1,63 @@
1
+ import type React from "react"
2
+ import { useToast } from "./Toast.js"
3
+
4
+ export const DebugToast: React.FC = () => {
5
+ const { showToast } = useToast()
6
+
7
+ const handleShowSuccess = () => {
8
+ showToast(
9
+ "Transaction Complete",
10
+ "Your transaction has been successfully processed",
11
+ "success",
12
+ )
13
+ }
14
+
15
+ const handleShowInfo = () => {
16
+ showToast(
17
+ "Info Toast",
18
+ "This is an info message for testing purposes",
19
+ "info",
20
+ )
21
+ }
22
+
23
+ const handleShowError = () => {
24
+ showToast(
25
+ "Transaction Failed",
26
+ "An error occurred while processing your transaction",
27
+ "error",
28
+ )
29
+ }
30
+
31
+ return (
32
+ <div className="p-3 border-b border-gray-200 dark:border-gray-700">
33
+ <div className="flex items-center gap-2">
34
+ <div className="text-xs font-semibold text-gray-600 dark:text-gray-400">
35
+ Toast
36
+ </div>
37
+ <div className="flex gap-1 flex-1">
38
+ <button
39
+ type="button"
40
+ onClick={handleShowInfo}
41
+ className="px-2 py-1 text-xs font-medium rounded bg-blue-100 text-blue-700 hover:bg-blue-200 dark:bg-blue-900/30 dark:text-blue-400 dark:hover:bg-blue-900/50 transition-colors"
42
+ >
43
+ info
44
+ </button>
45
+ <button
46
+ type="button"
47
+ onClick={handleShowSuccess}
48
+ className="px-2 py-1 text-xs font-medium rounded bg-green-100 text-green-700 hover:bg-green-200 dark:bg-green-900/30 dark:text-green-400 dark:hover:bg-green-900/50 transition-colors"
49
+ >
50
+ success
51
+ </button>
52
+ <button
53
+ type="button"
54
+ onClick={handleShowError}
55
+ className="px-2 py-1 text-xs font-medium rounded bg-red-100 text-red-700 hover:bg-red-200 dark:bg-red-900/30 dark:text-red-400 dark:hover:bg-red-900/50 transition-colors"
56
+ >
57
+ error
58
+ </button>
59
+ </div>
60
+ </div>
61
+ </div>
62
+ )
63
+ }