0xtrails 0.9.2 → 0.9.4

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 (79) hide show
  1. package/dist/{ccip-g6lDdnrD.js → ccip-lAtzqne5.js} +1 -1
  2. package/dist/config.d.ts +1 -0
  3. package/dist/config.d.ts.map +1 -1
  4. package/dist/constants.d.ts +1 -0
  5. package/dist/constants.d.ts.map +1 -1
  6. package/dist/error.d.ts.map +1 -1
  7. package/dist/{index-D-QngA_s.js → index-D5AG6huo.js} +22290 -21786
  8. package/dist/index.js +3 -3
  9. package/dist/intents.d.ts +1 -1
  10. package/dist/intents.d.ts.map +1 -1
  11. package/dist/mutations.d.ts +5 -2
  12. package/dist/mutations.d.ts.map +1 -1
  13. package/dist/tokens.d.ts.map +1 -1
  14. package/dist/transactionIntent/constants.d.ts +1 -0
  15. package/dist/transactionIntent/constants.d.ts.map +1 -1
  16. package/dist/transactionIntent/deposits/depositOrchestrator.d.ts +3 -1
  17. package/dist/transactionIntent/deposits/depositOrchestrator.d.ts.map +1 -1
  18. package/dist/transactionIntent/deposits/standardDeposit.d.ts +4 -1
  19. package/dist/transactionIntent/deposits/standardDeposit.d.ts.map +1 -1
  20. package/dist/transactionIntent/handlers/crossChain.d.ts.map +1 -1
  21. package/dist/transactionIntent/handlers/sameChainSameToken.d.ts.map +1 -1
  22. package/dist/transactionIntent/quote/normalizeQuote.d.ts.map +1 -1
  23. package/dist/transactionIntent/types.d.ts +2 -0
  24. package/dist/transactionIntent/types.d.ts.map +1 -1
  25. package/dist/transactionIntent/utils/resilientDepositTracker.d.ts +25 -0
  26. package/dist/transactionIntent/utils/resilientDepositTracker.d.ts.map +1 -0
  27. package/dist/widget/components/AccountIntentTransactionHistory.d.ts.map +1 -1
  28. package/dist/widget/components/ClassicSwap.d.ts.map +1 -1
  29. package/dist/widget/components/ConfigDisplay.d.ts.map +1 -1
  30. package/dist/widget/components/DynamicInputStyles.d.ts +2 -2
  31. package/dist/widget/components/Earn.d.ts.map +1 -1
  32. package/dist/widget/components/EarnPools.d.ts.map +1 -1
  33. package/dist/widget/components/Fund.d.ts.map +1 -1
  34. package/dist/widget/components/QuoteDetails.d.ts.map +1 -1
  35. package/dist/widget/components/Receipt.d.ts.map +1 -1
  36. package/dist/widget/components/SlippageToleranceSettings.d.ts.map +1 -1
  37. package/dist/widget/components/TransactionDetails.d.ts.map +1 -1
  38. package/dist/widget/components/UserPreferences.d.ts.map +1 -1
  39. package/dist/widget/components/WalletConnect.d.ts.map +1 -1
  40. package/dist/widget/css/compiled.css +1 -1
  41. package/dist/widget/hooks/useQuote.d.ts +2 -0
  42. package/dist/widget/hooks/useQuote.d.ts.map +1 -1
  43. package/dist/widget/index.js +1 -1
  44. package/dist/widget/providers/TrailsProvider.d.ts +2 -0
  45. package/dist/widget/providers/TrailsProvider.d.ts.map +1 -1
  46. package/dist/widget/widget.d.ts +1 -0
  47. package/dist/widget/widget.d.ts.map +1 -1
  48. package/package.json +2 -2
  49. package/src/config.ts +1 -0
  50. package/src/constants.ts +1 -0
  51. package/src/error.ts +6 -1
  52. package/src/intents.ts +22 -1
  53. package/src/prices.ts +1 -1
  54. package/src/tokens.ts +4 -3
  55. package/src/transactionIntent/constants.ts +2 -0
  56. package/src/transactionIntent/deposits/depositOrchestrator.ts +7 -0
  57. package/src/transactionIntent/deposits/standardDeposit.ts +194 -37
  58. package/src/transactionIntent/handlers/crossChain.ts +152 -105
  59. package/src/transactionIntent/handlers/sameChainSameToken.ts +1 -0
  60. package/src/transactionIntent/quote/normalizeQuote.ts +7 -4
  61. package/src/transactionIntent/types.ts +2 -0
  62. package/src/transactionIntent/utils/resilientDepositTracker.ts +281 -0
  63. package/src/widget/compiled.css +1 -1
  64. package/src/widget/components/AccountIntentTransactionHistory.tsx +170 -87
  65. package/src/widget/components/ClassicSwap.tsx +7 -1
  66. package/src/widget/components/ConfigDisplay.tsx +5 -0
  67. package/src/widget/components/Earn.tsx +14 -1
  68. package/src/widget/components/EarnPools.tsx +180 -59
  69. package/src/widget/components/Fund.tsx +3 -1
  70. package/src/widget/components/PoolWithdraw.tsx +1 -1
  71. package/src/widget/components/QuoteDetails.tsx +12 -35
  72. package/src/widget/components/Receipt.tsx +66 -40
  73. package/src/widget/components/SlippageToleranceSettings.tsx +86 -44
  74. package/src/widget/components/TransactionDetails.tsx +138 -218
  75. package/src/widget/components/UserPreferences.tsx +114 -41
  76. package/src/widget/components/WalletConnect.tsx +111 -48
  77. package/src/widget/hooks/useQuote.ts +389 -352
  78. package/src/widget/providers/TrailsProvider.tsx +5 -0
  79. package/src/widget/widget.tsx +2 -0
@@ -1,4 +1,4 @@
1
- import { ChevronDown, RotateCcw } from "lucide-react"
1
+ import { RotateCcw } from "lucide-react"
2
2
  import type React from "react"
3
3
  import { useBalanceVisible } from "../hooks/useBalanceVisible.js"
4
4
  import { useThemePreference } from "../hooks/useTheme.js"
@@ -18,7 +18,7 @@ export const UserPreferences: React.FC<UserPreferencesProps> = ({ onBack }) => {
18
18
  useThemePreference()
19
19
  const { customCss, theme: widgetTheme } = useWidgetProps()
20
20
 
21
- const handleThemeChange = (newTheme: "auto" | "light" | "dark") => {
21
+ const handleThemeChange = (newTheme: "light" | "dark") => {
22
22
  // Only allow theme changes if customCss is not set
23
23
  if (!customCss) {
24
24
  setSelectedTheme(newTheme)
@@ -52,24 +52,9 @@ export const UserPreferences: React.FC<UserPreferencesProps> = ({ onBack }) => {
52
52
  />
53
53
 
54
54
  <div className="space-y-6">
55
- {/* Hide Balances Setting */}
56
- <div className="flex items-center justify-between">
57
- <span className="text-sm font-medium text-gray-900 dark:text-gray-100">
58
- Hide Balances
59
- </span>
60
- <button
61
- type="button"
62
- onClick={toggleBalanceVisible}
63
- 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 ${
64
- !isBalanceVisible ? "bg-blue-600" : "bg-gray-200 dark:bg-gray-700"
65
- }`}
66
- >
67
- <span
68
- className={`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${
69
- !isBalanceVisible ? "translate-x-6" : "translate-x-1"
70
- }`}
71
- />
72
- </button>
55
+ {/* Slippage Settings */}
56
+ <div>
57
+ <SlippageToleranceSettings />
73
58
  </div>
74
59
 
75
60
  {/* Theme Setting */}
@@ -88,34 +73,122 @@ export const UserPreferences: React.FC<UserPreferencesProps> = ({ onBack }) => {
88
73
  </span>
89
74
  )}
90
75
  </span>
91
- <div className="relative">
92
- <select
93
- value={selectedTheme || widgetTheme || "auto"}
94
- onChange={(e) =>
95
- handleThemeChange(e.target.value as "auto" | "light" | "dark")
96
- }
76
+ <div className="flex items-center gap-2">
77
+ {/* Light mode button */}
78
+ <button
79
+ type="button"
80
+ onClick={() => handleThemeChange("light")}
97
81
  disabled={!!customCss}
98
- className={`appearance-none border text-sm rounded-xl focus:ring-blue-500 focus:border-blue-500 block w-24 p-2 pr-8 ${
99
- customCss
100
- ? "bg-gray-100 dark:bg-gray-800 border-gray-200 dark:border-gray-700 text-gray-500 dark:text-gray-500 cursor-not-allowed"
101
- : "bg-gray-50 dark:bg-gray-700 border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 cursor-pointer"
82
+ className={`flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-medium transition-colors ${
83
+ selectedTheme === "light" ||
84
+ (!selectedTheme && widgetTheme === "light") ||
85
+ (
86
+ !selectedTheme &&
87
+ !widgetTheme &&
88
+ typeof window !== "undefined" &&
89
+ !window.matchMedia("(prefers-color-scheme: dark)").matches
90
+ )
91
+ ? "bg-[#DBEAFE] text-[#2563EB]"
92
+ : "bg-transparent text-gray-900 dark:text-gray-100 hover:text-gray-700 dark:hover:text-gray-300"
93
+ } ${
94
+ customCss ? "cursor-not-allowed opacity-50" : "cursor-pointer"
102
95
  }`}
103
96
  >
104
- <option value="auto">Auto</option>
105
- <option value="light">Light</option>
106
- <option value="dark">Dark</option>
107
- </select>
108
- <ChevronDown
109
- className={`absolute right-2 top-1/2 transform -translate-y-1/2 h-4 w-4 pointer-events-none ${
110
- customCss ? "text-gray-300 dark:text-gray-600" : "text-gray-400"
97
+ <svg
98
+ width="16"
99
+ height="16"
100
+ viewBox="0 0 16 16"
101
+ fill="none"
102
+ xmlns="http://www.w3.org/2000/svg"
103
+ >
104
+ <title>Light Mode</title>
105
+ <g clipPath="url(#clip0_light_icon)">
106
+ <path
107
+ d="M7.33335 14.6665V13.3332C7.33335 12.965 7.63183 12.6665 8.00002 12.6665C8.36821 12.6665 8.66669 12.965 8.66669 13.3332V14.6665C8.66669 15.0347 8.36821 15.3332 8.00002 15.3332C7.63183 15.3332 7.33335 15.0347 7.33335 14.6665ZM3.75523 11.3019C4.01558 11.0416 4.43759 11.0416 4.69794 11.3019C4.95823 11.5623 4.95827 11.9843 4.69794 12.2446L3.75783 13.1847C3.49748 13.4449 3.07541 13.445 2.81512 13.1847C2.55485 12.9245 2.55499 12.5024 2.81512 12.242L3.75523 11.3019ZM11.3021 11.3019C11.5625 11.0416 11.9845 11.0416 12.2448 11.3019L13.1849 12.242C13.445 12.5024 13.4452 12.9245 13.1849 13.1847C12.9247 13.445 12.5026 13.4448 12.2422 13.1847L11.3021 12.2446C11.0418 11.9843 11.0418 11.5623 11.3021 11.3019ZM10 7.99984C10 6.89527 9.10459 5.99984 8.00002 5.99984C6.89545 5.99984 6.00002 6.89527 6.00002 7.99984C6.00002 9.10441 6.89545 9.99984 8.00002 9.99984C9.10459 9.99984 10 9.10441 10 7.99984ZM2.66669 7.33317C3.03488 7.33317 3.33335 7.63165 3.33335 7.99984C3.33335 8.36803 3.03488 8.6665 2.66669 8.6665H1.33335C0.965164 8.6665 0.666687 8.36803 0.666687 7.99984C0.666687 7.63165 0.965164 7.33317 1.33335 7.33317H2.66669ZM14.6667 7.33317C15.0349 7.33317 15.3334 7.63165 15.3334 7.99984C15.3334 8.36803 15.0349 8.6665 14.6667 8.6665H13.3334C12.9652 8.6665 12.6667 8.36803 12.6667 7.99984C12.6667 7.63165 12.9652 7.33317 13.3334 7.33317H14.6667ZM2.81512 2.81494C3.07542 2.55465 3.49747 2.55475 3.75783 2.81494L4.69794 3.75505C4.95829 4.0154 4.95829 4.4374 4.69794 4.69775C4.43759 4.9581 4.01558 4.9581 3.75523 4.69775L2.81512 3.75765C2.55494 3.49729 2.55483 3.07524 2.81512 2.81494ZM12.2422 2.81494C12.5026 2.55481 12.9246 2.55466 13.1849 2.81494C13.4451 3.07522 13.445 3.4973 13.1849 3.75765L12.2448 4.69775C11.9845 4.95809 11.5625 4.95805 11.3021 4.69775C11.0418 4.4374 11.0418 4.0154 11.3021 3.75505L12.2422 2.81494ZM7.33335 2.6665V1.33317C7.33335 0.964981 7.63183 0.666504 8.00002 0.666504C8.36821 0.666504 8.66669 0.964981 8.66669 1.33317V2.6665C8.66669 3.03469 8.36821 3.33317 8.00002 3.33317C7.63183 3.33317 7.33335 3.03469 7.33335 2.6665ZM11.3334 7.99984C11.3334 9.84079 9.84097 11.3332 8.00002 11.3332C6.15907 11.3332 4.66669 9.84079 4.66669 7.99984C4.66669 6.15889 6.15907 4.6665 8.00002 4.6665C9.84097 4.6665 11.3334 6.15889 11.3334 7.99984Z"
108
+ fill="currentColor"
109
+ />
110
+ </g>
111
+ <defs>
112
+ <clipPath id="clip0_light_icon">
113
+ <rect width="16" height="16" fill="white" />
114
+ </clipPath>
115
+ </defs>
116
+ </svg>
117
+ <span>Light</span>
118
+ </button>
119
+ {/* Dark mode button */}
120
+ <button
121
+ type="button"
122
+ onClick={() => handleThemeChange("dark")}
123
+ disabled={!!customCss}
124
+ className={`flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-medium transition-colors ${
125
+ selectedTheme === "dark" ||
126
+ (!selectedTheme && widgetTheme === "dark") ||
127
+ (
128
+ !selectedTheme &&
129
+ !widgetTheme &&
130
+ typeof window !== "undefined" &&
131
+ window.matchMedia("(prefers-color-scheme: dark)").matches
132
+ )
133
+ ? "bg-[#DBEAFE] text-[#2563EB]"
134
+ : "bg-transparent text-gray-900 dark:text-gray-100 hover:text-gray-700 dark:hover:text-gray-300"
135
+ } ${
136
+ customCss ? "cursor-not-allowed opacity-50" : "cursor-pointer"
111
137
  }`}
112
- />
138
+ >
139
+ <svg
140
+ width="16"
141
+ height="16"
142
+ viewBox="0 0 16 16"
143
+ fill="none"
144
+ xmlns="http://www.w3.org/2000/svg"
145
+ >
146
+ <title>Dark Mode</title>
147
+ <path
148
+ d="M7.7207 1.34229C8.12353 1.35288 8.42496 1.60511 8.5651 1.89827C8.70858 2.19855 8.70802 2.57945 8.50781 2.89893L8.50716 2.89827C8.10787 3.53737 7.93751 4.29341 8.02278 5.04216C8.10811 5.79102 8.4449 6.48902 8.97786 7.02197C9.51083 7.55485 10.2088 7.89112 10.9577 7.9764C11.7065 8.06164 12.4624 7.89084 13.1016 7.49137L13.2233 7.42562C13.5135 7.29382 13.8376 7.30794 14.1009 7.43343C14.4146 7.58299 14.6797 7.91693 14.6556 8.36051C14.5861 9.64638 14.1455 10.8847 13.3874 11.9256C12.6291 12.9666 11.5855 13.7658 10.3828 14.2264C9.18016 14.6869 7.8696 14.7895 6.61002 14.5213C5.35045 14.2531 4.19583 13.6253 3.28515 12.7147C2.37445 11.8041 1.74687 10.6494 1.47851 9.38981C1.21017 8.13019 1.3123 6.81977 1.77278 5.61702C2.23329 4.41426 3.03259 3.3708 4.07356 2.61247C5.11452 1.85416 6.35267 1.41314 7.63867 1.34359L7.7207 1.34229ZM7.08072 2.74723C6.28037 2.88708 5.51928 3.20826 4.85807 3.68994C4.02544 4.29656 3.38661 5.13153 3.01822 6.09359C2.64983 7.05577 2.56789 8.10413 2.78255 9.11182C2.99723 10.1195 3.49927 11.0435 4.22786 11.772C4.95644 12.5005 5.88029 13.0027 6.88801 13.2173C7.89573 13.4318 8.94409 13.3495 9.90624 12.981C10.8684 12.6124 11.7033 11.9733 12.3099 11.1405C12.7914 10.4794 13.1115 9.71859 13.2513 8.91846C12.489 9.26194 11.645 9.39674 10.8066 9.30127C9.75813 9.18186 8.7807 8.71088 8.0345 7.96468C7.28837 7.2185 6.81731 6.241 6.69791 5.19255C6.60247 4.354 6.73706 3.50961 7.08072 2.74723Z"
149
+ fill="currentColor"
150
+ />
151
+ </svg>
152
+ <span>Dark</span>
153
+ </button>
113
154
  </div>
114
155
  </div>
115
156
 
116
- {/* Slippage Tolerance Settings */}
117
- <div className="pt-2">
118
- <SlippageToleranceSettings />
157
+ {/* Hide Balances Setting */}
158
+ <div className="flex items-center justify-between">
159
+ <span className="text-sm font-medium text-gray-900 dark:text-gray-100">
160
+ Hide Balances
161
+ </span>
162
+ <button
163
+ type="button"
164
+ onClick={toggleBalanceVisible}
165
+ className={`relative inline-flex h-8 w-14 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 ${
166
+ !isBalanceVisible ? "bg-blue-600" : "bg-gray-200 dark:bg-gray-700"
167
+ }`}
168
+ >
169
+ <span
170
+ className={`inline-flex items-center justify-center h-6 w-6 transform rounded-full bg-white transition-transform ${
171
+ !isBalanceVisible ? "translate-x-7" : "translate-x-1"
172
+ }`}
173
+ >
174
+ {!isBalanceVisible && (
175
+ <svg
176
+ className="w-3.5 h-3.5 text-blue-600"
177
+ fill="none"
178
+ viewBox="0 0 24 24"
179
+ stroke="currentColor"
180
+ strokeWidth="3"
181
+ >
182
+ <title>Enabled</title>
183
+ <path
184
+ strokeLinecap="round"
185
+ strokeLinejoin="round"
186
+ d="M5 13l4 4L19 7"
187
+ />
188
+ </svg>
189
+ )}
190
+ </span>
191
+ </button>
119
192
  </div>
120
193
 
121
194
  {/* Reset Preferences Button */}
@@ -1,7 +1,6 @@
1
1
  import React, { useEffect, useMemo, useState } from "react"
2
- import { useAccount, useConnect } from "wagmi"
2
+ import { useAccount, useConnect, useDisconnect } from "wagmi"
3
3
  import { QrCode } from "./QrCode.js"
4
- import { TruncatedAddress } from "./TruncatedAddress.js"
5
4
  import { ScreenHeader } from "./ScreenHeader.js"
6
5
  import {
7
6
  getWalletIcon,
@@ -28,10 +27,12 @@ export const WalletConnectScreen: React.FC<WalletConnectProps> = ({
28
27
  selectedWalletId,
29
28
  }) => {
30
29
  const { status, connectAsync } = useConnect() as any
31
- const { isConnected, address, connector } = useAccount()
30
+ const { isConnected, connector } = useAccount()
31
+ const { disconnect } = useDisconnect()
32
32
  const [showUri, setShowUri] = useState(false)
33
33
  const [showQrCodeMobile, setShowQrCodeMobile] = useState(false)
34
34
  const [copied, setCopied] = useState(false)
35
+ const [isResetting, setIsResetting] = useState(false)
35
36
  const isMobile = useIsMobile()
36
37
  const walletConfigs = useWalletConfigs()
37
38
 
@@ -46,8 +47,11 @@ export const WalletConnectScreen: React.FC<WalletConnectProps> = ({
46
47
  }
47
48
 
48
49
  // Use the WalletConnect URI hook to manage connection and URI
49
- const { walletConnectUri: wcUri, isConnecting } =
50
- useWalletConnectUri(projectIdProp)
50
+ const {
51
+ walletConnectUri: wcUri,
52
+ isConnecting,
53
+ reconnect,
54
+ } = useWalletConnectUri(projectIdProp)
51
55
 
52
56
  // Get connector for the selected wallet
53
57
  const coinbaseConnector = useConnector(
@@ -58,21 +62,96 @@ export const WalletConnectScreen: React.FC<WalletConnectProps> = ({
58
62
  return connector?.name === "WalletConnect" && isConnected
59
63
  }, [connector, isConnected])
60
64
 
61
- // Track if we were connected when the component mounted
62
- const wasConnectedOnMount = React.useRef(isConnected)
65
+ // Track if we've already processed the initial disconnect
66
+ const [hasDisconnected, setHasDisconnected] = useState(false)
67
+ const [hasAutoContined, setHasAutoContined] = useState(false)
63
68
 
64
- // Only auto-navigate back if we successfully connect a new wallet
65
- // Don't auto-navigate if user was already connected when they entered this screen
69
+ // Disconnect from WalletConnect on mount to ensure QR code is shown
70
+ // biome-ignore lint/correctness/useExhaustiveDependencies: This effect should only run on mount to reset the connection
66
71
  useEffect(() => {
72
+ const resetWalletConnect = async () => {
73
+ // Check if we're connected via WalletConnect
74
+ if (isWalletConnectConnector || connector?.id === "walletConnect") {
75
+ setIsResetting(true)
76
+ logger.console.log(
77
+ "[trails-sdk] [WalletConnect] Resetting WalletConnect connection to show fresh QR code",
78
+ )
79
+ try {
80
+ // Disconnect first
81
+ await disconnect()
82
+
83
+ // Wait a bit for disconnect to complete
84
+ await new Promise((resolve) => setTimeout(resolve, 500))
85
+
86
+ // Force reconnect to generate new QR
87
+ logger.console.log(
88
+ "[trails-sdk] [WalletConnect] Forcing new connection for QR code",
89
+ )
90
+ reconnect()
91
+ } catch (error) {
92
+ logger.console.error(
93
+ "[trails-sdk] [WalletConnect] Error resetting connection:",
94
+ error,
95
+ )
96
+ // Even if disconnect fails, try to reconnect
97
+ reconnect()
98
+ } finally {
99
+ setIsResetting(false)
100
+ // Mark that we've disconnected after resetting is done
101
+ setTimeout(() => setHasDisconnected(true), 100)
102
+ }
103
+ } else {
104
+ // If not connected, mark as ready and trigger QR generation if needed
105
+ setHasDisconnected(true)
106
+ if (!wcUri) {
107
+ logger.console.log(
108
+ "[trails-sdk] [WalletConnect] No existing connection, triggering QR generation",
109
+ )
110
+ reconnect()
111
+ }
112
+ }
113
+ }
114
+ resetWalletConnect()
115
+ }, [])
116
+
117
+ // Auto-continue when wallet successfully connects
118
+ useEffect(() => {
119
+ logger.console.log("[trails-sdk] [WalletConnect] Auto-continue check:", {
120
+ isConnected,
121
+ status,
122
+ hasDisconnected,
123
+ isResetting,
124
+ hasAutoContined,
125
+ connectorId: connector?.id,
126
+ isWalletConnectConnector,
127
+ })
128
+
129
+ // Check if we're connected with WalletConnect after initial setup
67
130
  if (
68
131
  isConnected &&
69
- status === "success" &&
70
- !wasConnectedOnMount.current &&
71
- onBack
132
+ connector?.id === "walletConnect" &&
133
+ hasDisconnected &&
134
+ !isResetting &&
135
+ !hasAutoContined
72
136
  ) {
73
- onBack()
137
+ logger.console.log(
138
+ "[trails-sdk] [WalletConnect] Wallet connected via WalletConnect, auto-continuing",
139
+ )
140
+ setHasAutoContined(true)
141
+ setTimeout(() => {
142
+ onContinue()
143
+ }, 100)
74
144
  }
75
- }, [isConnected, status, onBack])
145
+ }, [
146
+ isConnected,
147
+ connector?.id,
148
+ hasDisconnected,
149
+ isResetting,
150
+ hasAutoContined,
151
+ onContinue,
152
+ isWalletConnectConnector,
153
+ status,
154
+ ])
76
155
 
77
156
  const title = useMemo(() => {
78
157
  const walletName = getWalletName(selectedWalletId)
@@ -177,41 +256,25 @@ export const WalletConnectScreen: React.FC<WalletConnectProps> = ({
177
256
 
178
257
  <div className="flex-1 flex items-center justify-center">
179
258
  <div className="text-center p-6 w-full sm:max-w-sm sm:mx-auto trails-border-radius-container trails-bg-secondary">
180
- {isWalletConnectConnector ? (
259
+ {isResetting || (isWalletConnectConnector && !wcUri) ? (
181
260
  <div className="flex flex-col items-center">
182
- <div className="w-16 h-16 bg-green-100 dark:bg-green-900 rounded-full flex items-center justify-center mb-4">
183
- <svg
184
- className="w-8 h-8 text-green-600 dark:text-green-400"
185
- fill="none"
186
- stroke="currentColor"
187
- viewBox="0 0 24 24"
188
- >
189
- <path
190
- strokeLinecap="round"
191
- strokeLinejoin="round"
192
- strokeWidth={2}
193
- d="M5 13l4 4L19 7"
194
- />
195
- </svg>
196
- </div>
197
- <h3 className="text-lg font-semibold text-gray-900 dark:text-gray-100 mb-2">
198
- Wallet Connected
199
- </h3>
200
- <div className="mb-4">
201
- <TruncatedAddress
202
- address={address || ""}
203
- chainId={1}
204
- className="text-sm text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 hover:underline"
205
- />
206
- </div>
207
- <div className="flex gap-3">
208
- <button
209
- onClick={() => onContinue()}
210
- className="px-4 py-2 text-sm transition-all duration-200 cursor-pointer hover:scale-[1.02] shadow-sm hover:shadow-md trails-border-radius-button font-medium trails-primary-button-bg trails-primary-button-text bg-blue-500 hover:bg-blue-600 disabled:bg-gray-300 text-white"
211
- >
212
- Continue
213
- </button>
214
- </div>
261
+ {isMobile ? (
262
+ <div className="flex flex-col items-center">
263
+ <div className="animate-spin rounded-full h-8 w-8 border-solid border-b-2 border-blue-600"></div>
264
+ <p className="mt-2 text-sm text-gray-600 dark:text-gray-400">
265
+ Preparing connection...
266
+ </p>
267
+ </div>
268
+ ) : (
269
+ <div className="w-[300px] h-[300px] bg-gray-200 dark:bg-gray-700 rounded-lg flex items-center justify-center trails-border-radius-container">
270
+ <div className="text-center">
271
+ <div className="animate-spin rounded-full h-8 w-8 border-solid border-b-2 border-blue-600 mx-auto mb-2"></div>
272
+ <p className="text-sm text-gray-600 dark:text-gray-400">
273
+ Preparing QR code...
274
+ </p>
275
+ </div>
276
+ </div>
277
+ )}
215
278
  </div>
216
279
  ) : wcUri ? (
217
280
  <div className="flex flex-col items-center">