signer-test-sdk-react 0.0.20 → 0.0.22
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.
- package/dist/src/AbstraxnProvider.d.ts +2 -2
- package/dist/src/AbstraxnProvider.js +627 -602
- package/dist/src/AbstraxnProvider.js.map +1 -1
- package/dist/src/ConnectButton.css +1 -1
- package/dist/src/ExternalWalletButtons.css +1 -1
- package/dist/src/WalletModal.css +373 -193
- package/dist/src/WalletModal.d.ts +1 -1
- package/dist/src/WalletModal.js +45 -108
- package/dist/src/WalletModal.js.map +1 -1
- package/dist/src/chains.d.ts +3 -4
- package/dist/src/chains.js +84 -154
- package/dist/src/chains.js.map +1 -1
- package/dist/src/components/OnboardingUI/OnboardingUI.css +5 -6
- package/dist/src/components/OnboardingUI/OnboardingUIReact.js +9 -3
- package/dist/src/components/OnboardingUI/OnboardingUIReact.js.map +1 -1
- package/dist/src/components/OnboardingUI/OnboardingUIWeb.js +0 -6
- package/dist/src/components/OnboardingUI/OnboardingUIWeb.js.map +1 -1
- package/dist/src/components/OnboardingUI/hooks/useAuthMethods.js +57 -0
- package/dist/src/components/OnboardingUI/hooks/useAuthMethods.js.map +1 -1
- package/dist/src/components/WalletModal/components/ChainSelector.css +102 -249
- package/dist/src/components/WalletModal/components/ChainSelector.d.ts +6 -7
- package/dist/src/components/WalletModal/components/ChainSelector.js +27 -68
- package/dist/src/components/WalletModal/components/ChainSelector.js.map +1 -1
- package/dist/src/components/WalletModal/components/ExportKeyModal.css +88 -89
- package/dist/src/components/WalletModal/components/ExportKeyModal.d.ts +1 -6
- package/dist/src/components/WalletModal/components/ExportKeyModal.js +11 -6
- package/dist/src/components/WalletModal/components/ExportKeyModal.js.map +1 -1
- package/dist/src/components/WalletModal/components/ExportWarningModal.css +2 -107
- package/dist/src/components/WalletModal/components/ExportWarningModal.d.ts +1 -7
- package/dist/src/components/WalletModal/components/ExportWarningModal.js +3 -5
- package/dist/src/components/WalletModal/components/ExportWarningModal.js.map +1 -1
- package/dist/src/components/WalletModal/components/ManageWalletModal.css +4 -90
- package/dist/src/components/WalletModal/components/ManageWalletModal.d.ts +3 -3
- package/dist/src/components/WalletModal/components/ManageWalletModal.js +13 -28
- package/dist/src/components/WalletModal/components/ManageWalletModal.js.map +1 -1
- package/dist/src/components/WalletModal/components/PreviewTransactionModal.css +4 -3
- package/dist/src/components/WalletModal/components/ReceiveModal.css +58 -93
- package/dist/src/components/WalletModal/components/ReceiveModal.js +1 -1
- package/dist/src/components/WalletModal/components/ReceiveModal.js.map +1 -1
- package/dist/src/components/WalletModal/components/SendModal.css +127 -170
- package/dist/src/components/WalletModal/components/SendModal.d.ts +6 -4
- package/dist/src/components/WalletModal/components/SendModal.js +39 -131
- package/dist/src/components/WalletModal/components/SendModal.js.map +1 -1
- package/dist/src/components/WalletModal/components/SuccessModal.css +8 -7
- package/dist/src/components/WalletModal/components/index.d.ts +0 -2
- package/dist/src/components/WalletModal/components/index.js +0 -1
- package/dist/src/components/WalletModal/components/index.js.map +1 -1
- package/dist/src/hooks.d.ts +4399 -448
- package/dist/src/hooks.js +53 -47
- package/dist/src/hooks.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/src/components/WalletModal/components/TokenSelectorModal.css +0 -240
- package/dist/src/components/WalletModal/components/TokenSelectorModal.d.ts +0 -21
- package/dist/src/components/WalletModal/components/TokenSelectorModal.js +0 -44
- package/dist/src/components/WalletModal/components/TokenSelectorModal.js.map +0 -1
|
@@ -1,327 +1,180 @@
|
|
|
1
|
-
/*
|
|
2
|
-
.wallet-modal-chain-selector
|
|
1
|
+
/* Chain Selector Styles - extracted from WalletModal.css */
|
|
2
|
+
.wallet-modal-chain-selector {
|
|
3
3
|
position: relative;
|
|
4
4
|
width: 100%;
|
|
5
|
-
height: 100%;
|
|
6
|
-
min-height: 450px;
|
|
7
|
-
background: #ffffff;
|
|
8
|
-
display: flex;
|
|
9
|
-
flex-direction: column;
|
|
10
|
-
animation: slideInRight 0.3s ease-out;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
@keyframes slideInRight {
|
|
14
|
-
from { transform: translateX(100%); }
|
|
15
|
-
to { transform: translateX(0); }
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.wallet-modal-chain-selector-header {
|
|
19
|
-
display: flex;
|
|
20
|
-
align-items: center;
|
|
21
|
-
justify-content: space-between;
|
|
22
|
-
padding: 0;
|
|
23
|
-
border-bottom: 1px solid #f1f5f9;
|
|
24
|
-
padding-bottom: 16px;
|
|
25
|
-
margin-bottom: 16px;
|
|
26
5
|
}
|
|
27
6
|
|
|
28
|
-
.wallet-modal-chain-selector-
|
|
29
|
-
|
|
7
|
+
.wallet-modal-chain-selector-button {
|
|
8
|
+
width: 100%;
|
|
9
|
+
padding: 10px 14px;
|
|
10
|
+
border-radius: 10px;
|
|
11
|
+
border: 1px solid;
|
|
30
12
|
background: transparent;
|
|
31
|
-
border: none;
|
|
32
13
|
cursor: pointer;
|
|
33
|
-
padding: 8px;
|
|
34
|
-
border-radius: 8px;
|
|
35
|
-
color: #64748b;
|
|
36
14
|
transition: all 0.2s;
|
|
37
15
|
display: flex;
|
|
38
16
|
align-items: center;
|
|
39
|
-
justify-content:
|
|
40
|
-
|
|
41
|
-
user-select: none;
|
|
42
|
-
-webkit-user-select: none;
|
|
43
|
-
width: 36px;
|
|
44
|
-
height: 36px;
|
|
45
|
-
flex-shrink: 0;
|
|
17
|
+
justify-content: space-between;
|
|
18
|
+
gap: 8px;
|
|
46
19
|
}
|
|
47
20
|
|
|
48
|
-
.wallet-modal-chain-selector-
|
|
49
|
-
|
|
50
|
-
background: #
|
|
51
|
-
color: #
|
|
21
|
+
.wallet-modal-theme-dark .wallet-modal-chain-selector-button {
|
|
22
|
+
border-color: #3a3a3a;
|
|
23
|
+
background: #2a2a2a;
|
|
24
|
+
color: #ffffff;
|
|
52
25
|
}
|
|
53
26
|
|
|
54
|
-
.wallet-modal-chain-selector-
|
|
55
|
-
|
|
56
|
-
|
|
27
|
+
.wallet-modal-theme-light .wallet-modal-chain-selector-button {
|
|
28
|
+
border-color: #e5e7eb;
|
|
29
|
+
background: #f9fafb;
|
|
30
|
+
color: #111827;
|
|
57
31
|
}
|
|
58
32
|
|
|
59
|
-
.wallet-modal-
|
|
60
|
-
|
|
61
|
-
font-weight: 500;
|
|
62
|
-
margin: 0;
|
|
63
|
-
color: #111827;
|
|
64
|
-
flex: 1;
|
|
65
|
-
text-align: center;
|
|
33
|
+
.wallet-modal-chain-selector-button:hover {
|
|
34
|
+
opacity: 0.8;
|
|
66
35
|
}
|
|
67
36
|
|
|
68
|
-
.wallet-modal-chain-selector-
|
|
69
|
-
flex: 1;
|
|
70
|
-
overflow-y: auto;
|
|
71
|
-
padding: 0;
|
|
37
|
+
.wallet-modal-chain-selector-info {
|
|
72
38
|
display: flex;
|
|
73
|
-
|
|
74
|
-
gap:
|
|
39
|
+
align-items: center;
|
|
40
|
+
gap: 8px;
|
|
41
|
+
flex: 1;
|
|
42
|
+
min-width: 0;
|
|
75
43
|
}
|
|
76
44
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
45
|
+
.wallet-modal-chain-icon {
|
|
46
|
+
width: 20px;
|
|
47
|
+
height: 20px;
|
|
48
|
+
flex-shrink: 0;
|
|
49
|
+
display: flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
justify-content: center;
|
|
80
52
|
}
|
|
81
53
|
|
|
82
|
-
.wallet-modal-chain-
|
|
83
|
-
|
|
54
|
+
.wallet-modal-chain-name {
|
|
55
|
+
font-size: 14px;
|
|
56
|
+
font-weight: 500;
|
|
57
|
+
white-space: nowrap;
|
|
58
|
+
overflow: hidden;
|
|
59
|
+
text-overflow: ellipsis;
|
|
60
|
+
min-width: 0;
|
|
84
61
|
}
|
|
85
62
|
|
|
86
|
-
.wallet-modal-chain-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
63
|
+
.wallet-modal-chain-dropdown {
|
|
64
|
+
position: absolute;
|
|
65
|
+
top: calc(100% + 8px);
|
|
66
|
+
left: 0;
|
|
67
|
+
right: 0;
|
|
68
|
+
width: 100%;
|
|
69
|
+
z-index: 10001;
|
|
70
|
+
border-radius: 12px;
|
|
71
|
+
border: 1px solid;
|
|
72
|
+
overflow: hidden;
|
|
73
|
+
box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
|
|
91
74
|
}
|
|
92
75
|
|
|
93
|
-
.wallet-modal-
|
|
94
|
-
background: #
|
|
95
|
-
|
|
76
|
+
.wallet-modal-theme-dark .wallet-modal-chain-dropdown {
|
|
77
|
+
background: #1a1a1a;
|
|
78
|
+
border-color: #3a3a3a;
|
|
96
79
|
}
|
|
97
80
|
|
|
98
|
-
.wallet-modal-theme-
|
|
99
|
-
background: #
|
|
81
|
+
.wallet-modal-theme-light .wallet-modal-chain-dropdown {
|
|
82
|
+
background: #ffffff;
|
|
83
|
+
border-color: #e5e7eb;
|
|
100
84
|
}
|
|
101
85
|
|
|
102
|
-
/* Tabs */
|
|
103
86
|
.wallet-modal-chain-tabs {
|
|
104
87
|
display: flex;
|
|
105
|
-
|
|
88
|
+
border-bottom: 1px solid;
|
|
89
|
+
padding: 0 12px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.wallet-modal-theme-dark .wallet-modal-chain-tabs {
|
|
93
|
+
border-color: #3a3a3a;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.wallet-modal-theme-light .wallet-modal-chain-tabs {
|
|
97
|
+
border-color: #e5e7eb;
|
|
106
98
|
}
|
|
107
99
|
|
|
108
100
|
.wallet-modal-chain-tab {
|
|
109
|
-
padding:
|
|
110
|
-
border-radius: 10px;
|
|
101
|
+
padding: 12px 16px;
|
|
111
102
|
border: none;
|
|
112
103
|
background: transparent;
|
|
113
104
|
cursor: pointer;
|
|
114
105
|
font-size: 14px;
|
|
115
|
-
font-weight:
|
|
116
|
-
|
|
117
|
-
transition: all 0.2s;
|
|
118
|
-
pointer-events: auto;
|
|
119
|
-
user-select: none;
|
|
120
|
-
-webkit-user-select: none;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.wallet-modal-chain-tab:hover {
|
|
124
|
-
color: #111827;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.wallet-modal-chain-tab.active {
|
|
128
|
-
background: #f1f5f9;
|
|
129
|
-
color: #111827;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/* Search */
|
|
133
|
-
.wallet-modal-chain-search-container {
|
|
134
|
-
position: relative;
|
|
135
|
-
width: 100%;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.wallet-modal-chain-search-icon {
|
|
139
|
-
position: absolute;
|
|
140
|
-
left: 16px;
|
|
141
|
-
top: 50%;
|
|
142
|
-
transform: translateY(-50%);
|
|
143
|
-
color: #94a3b8;
|
|
144
|
-
pointer-events: none;
|
|
145
|
-
display: flex;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
.wallet-modal-chain-search-input {
|
|
149
|
-
width: 100%;
|
|
150
|
-
padding: 12px 16px 12px 48px;
|
|
151
|
-
border-radius: 12px;
|
|
152
|
-
border: 1px solid #e2e8f0;
|
|
153
|
-
background: #ffffff;
|
|
154
|
-
font-size: 15px;
|
|
155
|
-
outline: none;
|
|
106
|
+
font-weight: 500;
|
|
107
|
+
border-bottom: 2px solid transparent;
|
|
156
108
|
transition: all 0.2s;
|
|
157
|
-
|
|
158
|
-
box-sizing: border-box;
|
|
159
|
-
pointer-events: auto;
|
|
160
|
-
user-select: text;
|
|
161
|
-
-webkit-user-select: text;
|
|
109
|
+
margin-bottom: -1px;
|
|
162
110
|
}
|
|
163
111
|
|
|
164
|
-
.wallet-modal-chain-
|
|
165
|
-
|
|
112
|
+
.wallet-modal-theme-dark .wallet-modal-chain-tab {
|
|
113
|
+
color: #9ca3af;
|
|
166
114
|
}
|
|
167
115
|
|
|
168
|
-
.wallet-modal-chain-
|
|
169
|
-
color: #
|
|
116
|
+
.wallet-modal-theme-light .wallet-modal-chain-tab {
|
|
117
|
+
color: #6b7280;
|
|
170
118
|
}
|
|
171
119
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
flex-direction: column;
|
|
176
|
-
gap: 8px;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.wallet-modal-chain-list-header {
|
|
180
|
-
font-size: 13px;
|
|
181
|
-
font-weight: 600;
|
|
182
|
-
color: #94a3b8;
|
|
183
|
-
text-transform: uppercase;
|
|
184
|
-
letter-spacing: 0.05em;
|
|
185
|
-
padding-left: 0;
|
|
120
|
+
.wallet-modal-chain-tab.active {
|
|
121
|
+
border-bottom-color: #9333ea;
|
|
122
|
+
color: #9333ea;
|
|
186
123
|
}
|
|
187
124
|
|
|
188
125
|
.wallet-modal-chain-list {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
126
|
+
max-height: 300px;
|
|
127
|
+
overflow-y: auto;
|
|
128
|
+
padding: 8px;
|
|
192
129
|
}
|
|
193
130
|
|
|
194
131
|
.wallet-modal-chain-item {
|
|
195
132
|
width: 100%;
|
|
196
|
-
padding:
|
|
197
|
-
border-radius:
|
|
133
|
+
padding: 12px;
|
|
134
|
+
border-radius: 8px;
|
|
198
135
|
border: none;
|
|
199
136
|
background: transparent;
|
|
200
137
|
cursor: pointer;
|
|
201
138
|
transition: all 0.2s;
|
|
202
139
|
display: flex;
|
|
203
140
|
align-items: center;
|
|
204
|
-
gap:
|
|
141
|
+
gap: 12px;
|
|
205
142
|
text-align: left;
|
|
206
|
-
pointer-events: auto;
|
|
207
|
-
user-select: none;
|
|
208
|
-
-webkit-user-select: none;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
.wallet-modal-chain-item:hover {
|
|
212
|
-
background: #f8fafc;
|
|
213
143
|
}
|
|
214
144
|
|
|
215
|
-
.wallet-modal-chain-item
|
|
216
|
-
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
.wallet-modal-chain-item:active {
|
|
220
|
-
transform: scale(0.98);
|
|
145
|
+
.wallet-modal-theme-dark .wallet-modal-chain-item {
|
|
146
|
+
color: #ffffff;
|
|
221
147
|
}
|
|
222
148
|
|
|
223
|
-
.wallet-modal-chain-item
|
|
224
|
-
|
|
225
|
-
cursor: not-allowed;
|
|
226
|
-
pointer-events: none;
|
|
149
|
+
.wallet-modal-theme-light .wallet-modal-chain-item {
|
|
150
|
+
color: #111827;
|
|
227
151
|
}
|
|
228
152
|
|
|
229
|
-
.wallet-modal-chain-item
|
|
230
|
-
|
|
231
|
-
pointer-events: none;
|
|
153
|
+
.wallet-modal-theme-dark .wallet-modal-chain-item:hover {
|
|
154
|
+
background: #2a2a2a;
|
|
232
155
|
}
|
|
233
156
|
|
|
234
|
-
.wallet-modal-chain-item
|
|
235
|
-
|
|
236
|
-
width: 36px;
|
|
237
|
-
height: 36px;
|
|
238
|
-
flex-shrink: 0;
|
|
157
|
+
.wallet-modal-theme-light .wallet-modal-chain-item:hover {
|
|
158
|
+
background: #f3f4f6;
|
|
239
159
|
}
|
|
240
160
|
|
|
241
|
-
.wallet-modal-chain-item
|
|
242
|
-
|
|
243
|
-
height: 100%;
|
|
244
|
-
border-radius: 50%;
|
|
245
|
-
object-fit: cover;
|
|
161
|
+
.wallet-modal-chain-item.active {
|
|
162
|
+
background: rgba(147, 51, 234, 0.1);
|
|
246
163
|
}
|
|
247
164
|
|
|
248
|
-
.wallet-modal-chain-
|
|
249
|
-
width: 100%;
|
|
250
|
-
height: 100%;
|
|
251
|
-
border-radius: 50%;
|
|
252
|
-
background: #f1f5f9;
|
|
165
|
+
.wallet-modal-chain-info {
|
|
253
166
|
display: flex;
|
|
254
167
|
align-items: center;
|
|
255
|
-
|
|
256
|
-
font-weight: 700;
|
|
257
|
-
color: #64748b;
|
|
258
|
-
font-size: 14px;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
.wallet-modal-chain-item-status {
|
|
262
|
-
position: absolute;
|
|
263
|
-
bottom: -2px;
|
|
264
|
-
right: -2px;
|
|
265
|
-
width: 10px;
|
|
266
|
-
height: 10px;
|
|
267
|
-
border-radius: 50%;
|
|
268
|
-
background: #10b981;
|
|
269
|
-
border: 2px solid #ffffff;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
.wallet-modal-chain-item-name {
|
|
168
|
+
gap: 8px;
|
|
273
169
|
flex: 1;
|
|
274
|
-
|
|
275
|
-
font-weight: 600;
|
|
276
|
-
color: #111827;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
.wallet-modal-chain-item-checkmark {
|
|
280
|
-
color: #10b981;
|
|
281
|
-
display: flex;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
.wallet-modal-chain-no-results {
|
|
285
|
-
padding: 40px 20px;
|
|
286
|
-
text-align: center;
|
|
287
|
-
color: #64748b;
|
|
288
|
-
font-size: 15px;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
/* Dark Theme Support */
|
|
292
|
-
.wallet-modal-theme-dark.wallet-modal-chain-selector-view {
|
|
293
|
-
background: #1a1a1a;
|
|
170
|
+
min-width: 0;
|
|
294
171
|
}
|
|
295
172
|
|
|
296
|
-
.wallet-modal-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
color: #
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
.wallet-modal-theme-dark .wallet-modal-chain-tab.active {
|
|
305
|
-
background: #2a2a2a;
|
|
306
|
-
color: #ffffff;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
.wallet-modal-theme-dark .wallet-modal-chain-search-input {
|
|
310
|
-
background: #2a2a2a;
|
|
311
|
-
border-color: #3a3a3a;
|
|
312
|
-
color: #ffffff;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
.wallet-modal-theme-dark .wallet-modal-chain-item:hover {
|
|
316
|
-
background: #2a2a2a;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
.wallet-modal-theme-dark .wallet-modal-chain-item-name {
|
|
320
|
-
color: #ffffff;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
.wallet-modal-theme-dark .wallet-modal-chain-item-status {
|
|
324
|
-
border-color: #1a1a1a;
|
|
173
|
+
.wallet-modal-chain-badge {
|
|
174
|
+
font-size: 10px;
|
|
175
|
+
padding: 2px 6px;
|
|
176
|
+
border-radius: 4px;
|
|
177
|
+
background: rgba(147, 51, 234, 0.2);
|
|
178
|
+
color: #9333ea;
|
|
179
|
+
font-weight: 500;
|
|
325
180
|
}
|
|
326
|
-
|
|
327
|
-
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type { ChainData } from
|
|
2
|
-
import
|
|
1
|
+
import type { ChainData } from '../../../chains';
|
|
2
|
+
import './ChainSelector.css';
|
|
3
3
|
export interface ChainSelectorProps {
|
|
4
4
|
currentChain: ChainData | null;
|
|
5
5
|
availableChains: ChainData[];
|
|
6
|
-
onChainSelect: (chainId: number) =>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
isOpen: boolean;
|
|
6
|
+
onChainSelect: (chainId: number) => void;
|
|
7
|
+
theme?: 'light' | 'dark';
|
|
8
|
+
className?: string;
|
|
10
9
|
}
|
|
11
|
-
export declare function ChainSelector({ currentChain, availableChains, onChainSelect,
|
|
10
|
+
export declare function ChainSelector({ currentChain, availableChains, onChainSelect, theme, className, }: ChainSelectorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,74 +2,33 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
/**
|
|
3
3
|
* Chain Selector Component
|
|
4
4
|
*/
|
|
5
|
-
import { useState, useEffect
|
|
6
|
-
import
|
|
7
|
-
export function ChainSelector({ currentChain, availableChains, onChainSelect,
|
|
8
|
-
const [
|
|
9
|
-
const [
|
|
10
|
-
|
|
11
|
-
const [switchingChainId, setSwitchingChainId] = useState(null);
|
|
12
|
-
// Reset state when opened
|
|
5
|
+
import { useState, useEffect } from 'react';
|
|
6
|
+
import './ChainSelector.css';
|
|
7
|
+
export function ChainSelector({ currentChain, availableChains, onChainSelect, theme = 'dark', className = '', }) {
|
|
8
|
+
const [showDropdown, setShowDropdown] = useState(false);
|
|
9
|
+
const [selectedChainType, setSelectedChainType] = useState('evm');
|
|
10
|
+
// Close dropdown when clicking outside
|
|
13
11
|
useEffect(() => {
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
onClose();
|
|
36
|
-
}, children: _jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: _jsx("polyline", { points: "15 18 9 12 15 6" }) }) }), _jsx("h2", { className: "wallet-modal-chain-selector-title", children: "Select Network" }), _jsx("button", { className: "wallet-modal-chain-selector-close", onClick: (e) => {
|
|
37
|
-
e.stopPropagation();
|
|
38
|
-
onClose();
|
|
39
|
-
}, children: _jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [_jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), _jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })] }) })] }), _jsxs("div", { className: "wallet-modal-chain-selector-content", children: [_jsxs("div", { className: "wallet-modal-chain-tabs", children: [_jsx("button", { className: `wallet-modal-chain-tab ${filterType === "all" ? "active" : ""}`, onClick: (e) => {
|
|
40
|
-
e.stopPropagation();
|
|
41
|
-
setFilterType("all");
|
|
42
|
-
}, children: "All" }), _jsx("button", { className: `wallet-modal-chain-tab ${filterType === "mainnet" ? "active" : ""}`, onClick: (e) => {
|
|
43
|
-
e.stopPropagation();
|
|
44
|
-
setFilterType("mainnet");
|
|
45
|
-
}, children: "Mainnets" }), _jsx("button", { className: `wallet-modal-chain-tab ${filterType === "testnet" ? "active" : ""}`, onClick: (e) => {
|
|
46
|
-
e.stopPropagation();
|
|
47
|
-
setFilterType("testnet");
|
|
48
|
-
}, children: "Testnets" })] }), _jsxs("div", { className: "wallet-modal-chain-search-container", children: [_jsx("div", { className: "wallet-modal-chain-search-icon", children: _jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [_jsx("circle", { cx: "11", cy: "11", r: "8" }), _jsx("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })] }) }), _jsx("input", { type: "text", className: "wallet-modal-chain-search-input", placeholder: "Search Network or Chain ID", value: searchQuery, onChange: (e) => {
|
|
49
|
-
e.stopPropagation();
|
|
50
|
-
setSearchQuery(e.target.value);
|
|
51
|
-
}, onClick: (e) => e.stopPropagation(), autoFocus: true })] }), _jsxs("div", { className: "wallet-modal-chain-list-container", children: [_jsx("div", { className: "wallet-modal-chain-list-header", children: filterType === "all"
|
|
52
|
-
? "ALL NETWORKS"
|
|
53
|
-
: filterType === "mainnet"
|
|
54
|
-
? "MAINNETS"
|
|
55
|
-
: "TESTNETS" }), _jsxs("div", { className: "wallet-modal-chain-list", children: [filteredChains.map((chain) => (_jsxs("button", { className: `wallet-modal-chain-item ${currentChain?.id === chain.id ? "active" : ""} ${isSwitching && switchingChainId === chain.id
|
|
56
|
-
? "switching"
|
|
57
|
-
: ""}`, disabled: isSwitching, onClick: async (e) => {
|
|
58
|
-
e.stopPropagation();
|
|
59
|
-
if (isSwitching)
|
|
60
|
-
return;
|
|
61
|
-
try {
|
|
62
|
-
setIsSwitching(true);
|
|
63
|
-
setSwitchingChainId(chain.id);
|
|
64
|
-
await onChainSelect(chain.id);
|
|
65
|
-
}
|
|
66
|
-
catch (error) {
|
|
67
|
-
console.error("Chain switch error:", error);
|
|
68
|
-
}
|
|
69
|
-
finally {
|
|
70
|
-
setIsSwitching(false);
|
|
71
|
-
setSwitchingChainId(null);
|
|
72
|
-
}
|
|
73
|
-
}, children: [_jsxs("div", { className: "wallet-modal-chain-item-icon-wrapper", children: [chain.iconUrl ? (_jsx("img", { src: chain.iconUrl, alt: chain.displayName, className: "wallet-modal-chain-item-icon-img" })) : (_jsx("div", { className: "wallet-modal-chain-item-icon-placeholder", children: chain.displayName.charAt(0) })), currentChain?.id === chain.id && (_jsx("span", { className: "wallet-modal-chain-item-status" }))] }), _jsx("span", { className: "wallet-modal-chain-item-name", children: chain.displayName }), currentChain?.id === chain.id && (_jsx("div", { className: "wallet-modal-chain-item-checkmark", children: _jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round", children: _jsx("polyline", { points: "20 6 9 17 4 12" }) }) }))] }, chain.id))), filteredChains.length === 0 && (_jsxs("div", { className: "wallet-modal-chain-no-results", children: ["No networks found for \"", searchQuery, "\""] }))] })] })] })] }));
|
|
12
|
+
if (!showDropdown)
|
|
13
|
+
return;
|
|
14
|
+
const handleClickOutside = (e) => {
|
|
15
|
+
if (e.target instanceof Element) {
|
|
16
|
+
const target = e.target;
|
|
17
|
+
if (!target.closest('.wallet-modal-chain-selector')) {
|
|
18
|
+
setShowDropdown(false);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
23
|
+
return () => document.removeEventListener('mousedown', handleClickOutside);
|
|
24
|
+
}, [showDropdown]);
|
|
25
|
+
const evmChains = availableChains.filter((c) => c.type === 'evm');
|
|
26
|
+
const solanaChains = availableChains.filter((c) => c.type === 'solana');
|
|
27
|
+
return (_jsxs("div", { className: `wallet-modal-chain-selector ${className}`, children: [_jsxs("button", { className: "wallet-modal-chain-selector-button", onClick: () => setShowDropdown(!showDropdown), children: [_jsxs("div", { className: "wallet-modal-chain-selector-info", children: [_jsx("div", { className: "wallet-modal-chain-icon", children: _jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: [_jsx("circle", { cx: "10", cy: "10", r: "8", stroke: "currentColor", strokeWidth: "2", fill: "none" }), _jsx("path", { d: "M10 2L10 6M10 14L10 18M2 10L6 10M14 10L18 10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" })] }) }), _jsx("span", { className: "wallet-modal-chain-name", children: currentChain?.displayName || 'Select Chain' })] }), _jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", className: showDropdown ? 'open' : '', style: { transform: showDropdown ? 'rotate(180deg)' : 'none', transition: 'transform 0.2s' }, children: _jsx("path", { d: "M4 6L8 10L12 6", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })] }), showDropdown && availableChains.length > 0 && (_jsxs("div", { className: `wallet-modal-chain-dropdown wallet-modal-theme-${theme}`, children: [_jsxs("div", { className: "wallet-modal-chain-tabs", children: [evmChains.length > 0 && (_jsx("button", { className: `wallet-modal-chain-tab ${selectedChainType === 'evm' ? 'active' : ''}`, onClick: () => setSelectedChainType('evm'), children: "EVM" })), solanaChains.length > 0 && (_jsx("button", { className: `wallet-modal-chain-tab ${selectedChainType === 'solana' ? 'active' : ''}`, onClick: () => setSelectedChainType('solana'), children: "Solana" }))] }), _jsx("div", { className: "wallet-modal-chain-list", children: availableChains
|
|
28
|
+
.filter((chain) => chain.type === selectedChainType)
|
|
29
|
+
.map((chain) => (_jsxs("button", { className: `wallet-modal-chain-item ${currentChain?.id === chain.id ? 'active' : ''}`, onClick: () => {
|
|
30
|
+
onChainSelect(chain.id);
|
|
31
|
+
setShowDropdown(false);
|
|
32
|
+
}, children: [_jsx("div", { className: "wallet-modal-chain-icon", children: _jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: [_jsx("circle", { cx: "10", cy: "10", r: "8", stroke: "currentColor", strokeWidth: "2", fill: "none" }), _jsx("path", { d: "M10 2L10 6M10 14L10 18M2 10L6 10M14 10L18 10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" })] }) }), _jsxs("div", { className: "wallet-modal-chain-info", children: [_jsx("span", { className: "wallet-modal-chain-name", children: chain.displayName }), chain.isTestnet && (_jsx("span", { className: "wallet-modal-chain-badge", children: "Testnet" }))] }), currentChain?.id === chain.id && (_jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: _jsx("path", { d: "M13.5 4L6 11.5L2.5 8", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }))] }, chain.id))) })] }))] }));
|
|
74
33
|
}
|
|
75
34
|
//# sourceMappingURL=ChainSelector.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChainSelector.js","sourceRoot":"","sources":["../../../../../src/components/WalletModal/components/ChainSelector.tsx"],"names":[],"mappings":";AAAA;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"ChainSelector.js","sourceRoot":"","sources":["../../../../../src/components/WalletModal/components/ChainSelector.tsx"],"names":[],"mappings":";AAAA;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,qBAAqB,CAAC;AAU7B,MAAM,UAAU,aAAa,CAAC,EAC5B,YAAY,EACZ,eAAe,EACf,aAAa,EACb,KAAK,GAAG,MAAM,EACd,SAAS,GAAG,EAAE,GACK;IACnB,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxD,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,QA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