signer-test-sdk-react 0.0.22 → 0.0.24
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/CHANGELOG.md +29 -0
- package/README.md +4 -0
- package/dist/src/AbstraxnProvider.d.ts +5 -13
- package/dist/src/AbstraxnProvider.js +14 -3126
- 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/ExternalWalletButtons.js +2 -2
- package/dist/src/ExternalWalletButtons.js.map +1 -1
- package/dist/src/OnboardingUI.d.ts +1 -1
- package/dist/src/WalletModal.css +193 -373
- package/dist/src/WalletModal.d.ts +1 -1
- package/dist/src/WalletModal.js +108 -45
- package/dist/src/WalletModal.js.map +1 -1
- package/dist/src/chains.d.ts +4 -3
- package/dist/src/chains.js +154 -84
- package/dist/src/chains.js.map +1 -1
- package/dist/src/components/AbstraxnProvider/AbstraxnProvider.d.ts +12 -0
- package/dist/src/components/AbstraxnProvider/AbstraxnProvider.js +146 -0
- package/dist/src/components/AbstraxnProvider/AbstraxnProvider.js.map +1 -0
- package/dist/src/components/AbstraxnProvider/AbstraxnProviderInner.d.ts +25 -0
- package/dist/src/components/AbstraxnProvider/AbstraxnProviderInner.js +3086 -0
- package/dist/src/components/AbstraxnProvider/AbstraxnProviderInner.js.map +1 -0
- package/dist/src/components/AbstraxnProvider/AbstraxnProviderWithWagmi.d.ts +8 -0
- package/dist/src/components/AbstraxnProvider/AbstraxnProviderWithWagmi.js +46 -0
- package/dist/src/components/AbstraxnProvider/AbstraxnProviderWithWagmi.js.map +1 -0
- package/dist/src/components/AbstraxnProvider/AbstraxnProviderWithoutWagmi.d.ts +8 -0
- package/dist/src/components/AbstraxnProvider/AbstraxnProviderWithoutWagmi.js +12 -0
- package/dist/src/components/AbstraxnProvider/AbstraxnProviderWithoutWagmi.js.map +1 -0
- package/dist/src/components/AbstraxnProvider/context.d.ts +2 -0
- package/dist/src/components/AbstraxnProvider/context.js +6 -0
- package/dist/src/components/AbstraxnProvider/context.js.map +1 -0
- package/dist/src/components/AbstraxnProvider/index.d.ts +6 -0
- package/dist/src/components/AbstraxnProvider/index.js +7 -0
- package/dist/src/components/AbstraxnProvider/index.js.map +1 -0
- package/dist/src/components/AbstraxnProvider/useAbstraxnProviderBase.d.ts +30 -0
- package/dist/src/components/AbstraxnProvider/useAbstraxnProviderBase.js +49 -0
- package/dist/src/components/AbstraxnProvider/useAbstraxnProviderBase.js.map +1 -0
- package/dist/src/components/AbstraxnProvider/useAbstraxnWallet.d.ts +2 -0
- package/dist/src/components/AbstraxnProvider/useAbstraxnWallet.js +13 -0
- package/dist/src/components/AbstraxnProvider/useAbstraxnWallet.js.map +1 -0
- package/dist/src/components/AbstraxnProvider/useOAuthCallbacks.d.ts +22 -0
- package/dist/src/components/AbstraxnProvider/useOAuthCallbacks.js +242 -0
- package/dist/src/components/AbstraxnProvider/useOAuthCallbacks.js.map +1 -0
- package/dist/src/components/AbstraxnProvider/useWalletInitialization.d.ts +25 -0
- package/dist/src/components/AbstraxnProvider/useWalletInitialization.js +539 -0
- package/dist/src/components/AbstraxnProvider/useWalletInitialization.js.map +1 -0
- package/dist/src/components/AbstraxnProvider/utils.d.ts +41 -0
- package/dist/src/components/AbstraxnProvider/utils.js +139 -0
- package/dist/src/components/AbstraxnProvider/utils.js.map +1 -0
- package/dist/src/components/OnboardingUI/OnboardingUI.css +8 -5
- package/dist/src/components/OnboardingUI/OnboardingUIReact.d.ts +1 -1
- package/dist/src/components/OnboardingUI/OnboardingUIWeb.d.ts +1 -1
- package/dist/src/components/OnboardingUI/OnboardingUIWeb.js +7 -1
- package/dist/src/components/OnboardingUI/OnboardingUIWeb.js.map +1 -1
- package/dist/src/components/OnboardingUI/components/EmailForm.d.ts +1 -1
- package/dist/src/components/OnboardingUI/components/EmailForm.js +1 -1
- package/dist/src/components/OnboardingUI/components/EmailForm.js.map +1 -1
- package/dist/src/components/OnboardingUI/components/OtpForm.d.ts +1 -1
- package/dist/src/components/OnboardingUI/components/PasskeyButton.d.ts +1 -1
- package/dist/src/components/OnboardingUI/components/SocialButtons.d.ts +1 -1
- package/dist/src/components/OnboardingUI/hooks/useAuthMethods.d.ts +1 -1
- package/dist/src/components/OnboardingUI/hooks/useOnboarding.d.ts +1 -1
- package/dist/src/components/OnboardingUI/index.d.ts +1 -1
- package/dist/src/components/WalletModal/components/ChainSelector.css +249 -102
- package/dist/src/components/WalletModal/components/ChainSelector.d.ts +7 -6
- package/dist/src/components/WalletModal/components/ChainSelector.js +68 -27
- package/dist/src/components/WalletModal/components/ChainSelector.js.map +1 -1
- package/dist/src/components/WalletModal/components/ExportKeyModal.css +89 -88
- package/dist/src/components/WalletModal/components/ExportKeyModal.d.ts +6 -1
- package/dist/src/components/WalletModal/components/ExportKeyModal.js +6 -11
- package/dist/src/components/WalletModal/components/ExportKeyModal.js.map +1 -1
- package/dist/src/components/WalletModal/components/ExportWarningModal.css +107 -2
- package/dist/src/components/WalletModal/components/ExportWarningModal.d.ts +7 -1
- package/dist/src/components/WalletModal/components/ExportWarningModal.js +5 -3
- package/dist/src/components/WalletModal/components/ExportWarningModal.js.map +1 -1
- package/dist/src/components/WalletModal/components/ManageWalletModal.css +90 -4
- package/dist/src/components/WalletModal/components/ManageWalletModal.d.ts +3 -3
- package/dist/src/components/WalletModal/components/ManageWalletModal.js +28 -13
- package/dist/src/components/WalletModal/components/ManageWalletModal.js.map +1 -1
- package/dist/src/components/WalletModal/components/PreviewTransactionModal.css +3 -4
- package/dist/src/components/WalletModal/components/ReceiveModal.css +93 -58
- 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 +170 -127
- package/dist/src/components/WalletModal/components/SendModal.d.ts +4 -6
- package/dist/src/components/WalletModal/components/SendModal.js +131 -39
- package/dist/src/components/WalletModal/components/SendModal.js.map +1 -1
- package/dist/src/components/WalletModal/components/SuccessModal.css +7 -8
- package/dist/src/components/WalletModal/components/TokenSelectorModal.css +240 -0
- package/dist/src/components/WalletModal/components/TokenSelectorModal.d.ts +21 -0
- package/dist/src/components/WalletModal/components/TokenSelectorModal.js +44 -0
- package/dist/src/components/WalletModal/components/TokenSelectorModal.js.map +1 -0
- package/dist/src/components/WalletModal/components/UserAvatar.d.ts +1 -1
- package/dist/src/components/WalletModal/components/index.d.ts +2 -0
- package/dist/src/components/WalletModal/components/index.js +1 -0
- package/dist/src/components/WalletModal/components/index.js.map +1 -1
- package/dist/src/components/WalletModal/hooks/useSendTransaction.d.ts +1 -1
- package/dist/src/hooks.d.ts +402 -362
- package/dist/src/hooks.js +486 -244
- package/dist/src/hooks.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/types.d.ts +6 -6
- package/dist/src/wagmiConfig.d.ts +2 -2
- package/dist/src/wagmiConfig.js +34 -21
- package/dist/src/wagmiConfig.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -4
|
@@ -1,9 +1,38 @@
|
|
|
1
|
-
/* Send Modal Styles -
|
|
1
|
+
/* Send Modal Styles - Clean minimal design */
|
|
2
|
+
|
|
3
|
+
/* Override modal padding for send modal */
|
|
4
|
+
.wallet-modal-content.wallet-modal-send {
|
|
5
|
+
padding: 20px;
|
|
6
|
+
gap: 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/* Header */
|
|
10
|
+
.wallet-modal-send-header {
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
justify-content: space-between;
|
|
14
|
+
padding: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.wallet-modal-send-title {
|
|
18
|
+
font-size: 18px;
|
|
19
|
+
font-weight: 600;
|
|
20
|
+
margin: 0;
|
|
21
|
+
color: #111827;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.wallet-modal-theme-dark .wallet-modal-send-title {
|
|
25
|
+
color: #ffffff;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
/* Content */
|
|
2
30
|
.wallet-modal-send-content {
|
|
3
31
|
display: flex;
|
|
4
32
|
flex-direction: column;
|
|
5
|
-
gap:
|
|
6
|
-
padding:
|
|
33
|
+
gap: 16px;
|
|
34
|
+
padding: 0;
|
|
35
|
+
margin-top: 16px;
|
|
7
36
|
}
|
|
8
37
|
|
|
9
38
|
.wallet-modal-send-field {
|
|
@@ -15,6 +44,7 @@
|
|
|
15
44
|
.wallet-modal-send-label {
|
|
16
45
|
font-size: 14px;
|
|
17
46
|
font-weight: 500;
|
|
47
|
+
color: #374151;
|
|
18
48
|
text-align: left;
|
|
19
49
|
}
|
|
20
50
|
|
|
@@ -22,175 +52,208 @@
|
|
|
22
52
|
color: #9ca3af;
|
|
23
53
|
}
|
|
24
54
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.wallet-modal-send-token-selector-wrapper {
|
|
30
|
-
position: relative;
|
|
31
|
-
width: 100%;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.wallet-modal-send-chain-selector {
|
|
35
|
-
width: 100%;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.wallet-modal-send-amount-wrapper {
|
|
55
|
+
/* Token Card */
|
|
56
|
+
.wallet-modal-send-token-card {
|
|
39
57
|
display: flex;
|
|
40
58
|
align-items: center;
|
|
59
|
+
gap: 12px;
|
|
60
|
+
width: 100%;
|
|
61
|
+
padding: 12px;
|
|
41
62
|
border-radius: 12px;
|
|
42
|
-
border: 1px solid;
|
|
43
|
-
|
|
44
|
-
|
|
63
|
+
border: 1px solid #e5e7eb;
|
|
64
|
+
background: #ffffff;
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
transition: all 0.2s;
|
|
67
|
+
text-align: left;
|
|
45
68
|
}
|
|
46
69
|
|
|
47
|
-
.wallet-modal-
|
|
48
|
-
border-color: #
|
|
49
|
-
background: #2a2a2a;
|
|
70
|
+
.wallet-modal-send-token-card:hover {
|
|
71
|
+
border-color: #3b82f6;
|
|
50
72
|
}
|
|
51
73
|
|
|
52
|
-
.wallet-modal-theme-
|
|
53
|
-
border-color: #
|
|
54
|
-
background: #
|
|
74
|
+
.wallet-modal-theme-dark .wallet-modal-send-token-card {
|
|
75
|
+
border-color: #3a3a3a;
|
|
76
|
+
background: #1a1a1a;
|
|
55
77
|
}
|
|
56
78
|
|
|
57
|
-
.wallet-modal-send-
|
|
58
|
-
border-color: #
|
|
79
|
+
.wallet-modal-theme-dark .wallet-modal-send-token-card:hover {
|
|
80
|
+
border-color: #3b82f6;
|
|
59
81
|
}
|
|
60
82
|
|
|
61
|
-
.wallet-modal-send-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
font-weight: 500;
|
|
83
|
+
.wallet-modal-send-token-icon {
|
|
84
|
+
width: 40px;
|
|
85
|
+
height: 40px;
|
|
65
86
|
flex-shrink: 0;
|
|
66
|
-
|
|
87
|
+
display: flex;
|
|
88
|
+
align-items: center;
|
|
89
|
+
justify-content: center;
|
|
67
90
|
}
|
|
68
91
|
|
|
69
|
-
.wallet-modal-
|
|
70
|
-
|
|
71
|
-
|
|
92
|
+
.wallet-modal-send-token-icon img {
|
|
93
|
+
width: 100%;
|
|
94
|
+
height: 100%;
|
|
95
|
+
border-radius: 50%;
|
|
96
|
+
object-fit: cover;
|
|
72
97
|
}
|
|
73
98
|
|
|
74
|
-
.wallet-modal-
|
|
75
|
-
|
|
76
|
-
|
|
99
|
+
.wallet-modal-send-token-icon-placeholder {
|
|
100
|
+
width: 100%;
|
|
101
|
+
height: 100%;
|
|
102
|
+
border-radius: 50%;
|
|
103
|
+
background: #e5e7eb;
|
|
104
|
+
display: flex;
|
|
105
|
+
align-items: center;
|
|
106
|
+
justify-content: center;
|
|
107
|
+
font-weight: 600;
|
|
108
|
+
font-size: 16px;
|
|
109
|
+
color: #6b7280;
|
|
77
110
|
}
|
|
78
111
|
|
|
79
|
-
.wallet-modal-send-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
border: none;
|
|
83
|
-
background: transparent;
|
|
84
|
-
font-size: 16px;
|
|
85
|
-
font-weight: 500;
|
|
86
|
-
outline: none;
|
|
87
|
-
min-width: 0;
|
|
112
|
+
.wallet-modal-theme-dark .wallet-modal-send-token-icon-placeholder {
|
|
113
|
+
background: #2a2a2a;
|
|
114
|
+
color: #9ca3af;
|
|
88
115
|
}
|
|
89
116
|
|
|
90
|
-
.wallet-modal-
|
|
91
|
-
|
|
117
|
+
.wallet-modal-send-token-details {
|
|
118
|
+
display: flex;
|
|
119
|
+
flex-direction: column;
|
|
120
|
+
gap: 2px;
|
|
92
121
|
}
|
|
93
122
|
|
|
94
|
-
.wallet-modal-
|
|
123
|
+
.wallet-modal-send-token-name {
|
|
124
|
+
font-size: 16px;
|
|
125
|
+
font-weight: 600;
|
|
95
126
|
color: #111827;
|
|
96
127
|
}
|
|
97
128
|
|
|
98
|
-
.wallet-modal-send-
|
|
99
|
-
|
|
129
|
+
.wallet-modal-theme-dark .wallet-modal-send-token-name {
|
|
130
|
+
color: #ffffff;
|
|
100
131
|
}
|
|
101
132
|
|
|
102
|
-
.wallet-modal-send-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
flex-shrink: 0;
|
|
106
|
-
opacity: 0.7;
|
|
133
|
+
.wallet-modal-send-token-balance {
|
|
134
|
+
font-size: 13px;
|
|
135
|
+
color: #6b7280;
|
|
107
136
|
}
|
|
108
137
|
|
|
109
|
-
.wallet-modal-theme-dark .wallet-modal-send-
|
|
138
|
+
.wallet-modal-theme-dark .wallet-modal-send-token-balance {
|
|
110
139
|
color: #9ca3af;
|
|
111
140
|
}
|
|
112
141
|
|
|
113
|
-
|
|
114
|
-
|
|
142
|
+
/* Input Fields */
|
|
143
|
+
.wallet-modal-send-input {
|
|
144
|
+
width: 100%;
|
|
145
|
+
padding: 12px 14px;
|
|
146
|
+
border-radius: 12px;
|
|
147
|
+
border: 1px solid #e5e7eb;
|
|
148
|
+
background: #ffffff;
|
|
149
|
+
font-size: 15px;
|
|
150
|
+
outline: none;
|
|
151
|
+
transition: all 0.2s;
|
|
152
|
+
box-sizing: border-box;
|
|
153
|
+
color: #111827;
|
|
115
154
|
}
|
|
116
155
|
|
|
117
|
-
.wallet-modal-send-
|
|
118
|
-
|
|
119
|
-
align-items: center;
|
|
120
|
-
gap: 8px;
|
|
121
|
-
font-size: 12px;
|
|
122
|
-
margin-top: 4px;
|
|
156
|
+
.wallet-modal-send-input::placeholder {
|
|
157
|
+
color: #9ca3af;
|
|
123
158
|
}
|
|
124
159
|
|
|
125
|
-
.wallet-modal-send-
|
|
126
|
-
|
|
160
|
+
.wallet-modal-send-input:focus {
|
|
161
|
+
border-color: #3b82f6;
|
|
127
162
|
}
|
|
128
163
|
|
|
129
|
-
.wallet-modal-send-
|
|
130
|
-
|
|
164
|
+
.wallet-modal-send-input.error {
|
|
165
|
+
border-color: #ef4444;
|
|
131
166
|
}
|
|
132
167
|
|
|
133
|
-
.wallet-modal-theme-dark .wallet-modal-send-
|
|
134
|
-
color: #
|
|
168
|
+
.wallet-modal-theme-dark .wallet-modal-send-input {
|
|
169
|
+
border-color: #3a3a3a;
|
|
170
|
+
background: #1a1a1a;
|
|
171
|
+
color: #ffffff;
|
|
135
172
|
}
|
|
136
173
|
|
|
137
|
-
.wallet-modal-theme-
|
|
174
|
+
.wallet-modal-theme-dark .wallet-modal-send-input::placeholder {
|
|
138
175
|
color: #6b7280;
|
|
139
176
|
}
|
|
140
177
|
|
|
141
|
-
.wallet-modal-send-
|
|
178
|
+
.wallet-modal-theme-dark .wallet-modal-send-input:focus {
|
|
179
|
+
border-color: #3b82f6;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/* Amount Box */
|
|
183
|
+
.wallet-modal-send-amount-box {
|
|
184
|
+
display: flex;
|
|
185
|
+
align-items: center;
|
|
186
|
+
justify-content: space-between;
|
|
142
187
|
width: 100%;
|
|
143
|
-
padding: 14px
|
|
188
|
+
padding: 12px 14px;
|
|
144
189
|
border-radius: 12px;
|
|
145
|
-
border: 1px solid;
|
|
146
|
-
background:
|
|
147
|
-
font-size: 14px;
|
|
148
|
-
font-family: monospace;
|
|
149
|
-
outline: none;
|
|
150
|
-
transition: all 0.2s;
|
|
190
|
+
border: 1px solid #e5e7eb;
|
|
191
|
+
background: #ffffff;
|
|
151
192
|
box-sizing: border-box;
|
|
193
|
+
transition: all 0.2s;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.wallet-modal-send-amount-box:focus-within {
|
|
197
|
+
border-color: #3b82f6;
|
|
152
198
|
}
|
|
153
199
|
|
|
154
|
-
.wallet-modal-
|
|
200
|
+
.wallet-modal-send-amount-box.error {
|
|
201
|
+
border-color: #ef4444;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.wallet-modal-theme-dark .wallet-modal-send-amount-box {
|
|
155
205
|
border-color: #3a3a3a;
|
|
156
|
-
background: #
|
|
157
|
-
|
|
206
|
+
background: #1a1a1a;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.wallet-modal-theme-dark .wallet-modal-send-amount-box:focus-within {
|
|
210
|
+
border-color: #3b82f6;
|
|
158
211
|
}
|
|
159
212
|
|
|
160
|
-
.wallet-modal-
|
|
161
|
-
|
|
162
|
-
|
|
213
|
+
.wallet-modal-send-amount-input {
|
|
214
|
+
flex: 1;
|
|
215
|
+
border: none;
|
|
216
|
+
background: transparent;
|
|
217
|
+
font-size: 15px;
|
|
218
|
+
outline: none;
|
|
219
|
+
min-width: 0;
|
|
163
220
|
color: #111827;
|
|
221
|
+
padding: 0;
|
|
164
222
|
}
|
|
165
223
|
|
|
166
|
-
.wallet-modal-send-
|
|
167
|
-
|
|
224
|
+
.wallet-modal-send-amount-input::placeholder {
|
|
225
|
+
color: #9ca3af;
|
|
168
226
|
}
|
|
169
227
|
|
|
170
|
-
.wallet-modal-send-
|
|
171
|
-
|
|
228
|
+
.wallet-modal-theme-dark .wallet-modal-send-amount-input {
|
|
229
|
+
color: #ffffff;
|
|
172
230
|
}
|
|
173
231
|
|
|
174
|
-
.wallet-modal-theme-dark .wallet-modal-send-
|
|
175
|
-
|
|
232
|
+
.wallet-modal-theme-dark .wallet-modal-send-amount-input::placeholder {
|
|
233
|
+
color: #6b7280;
|
|
176
234
|
}
|
|
177
235
|
|
|
178
|
-
.wallet-modal-
|
|
179
|
-
|
|
236
|
+
.wallet-modal-send-amount-symbol {
|
|
237
|
+
font-size: 15px;
|
|
238
|
+
font-weight: 500;
|
|
239
|
+
color: #6b7280;
|
|
240
|
+
flex-shrink: 0;
|
|
241
|
+
margin-left: 8px;
|
|
180
242
|
}
|
|
181
243
|
|
|
182
|
-
.wallet-modal-send-
|
|
183
|
-
|
|
244
|
+
.wallet-modal-theme-dark .wallet-modal-send-amount-symbol {
|
|
245
|
+
color: #9ca3af;
|
|
184
246
|
}
|
|
185
247
|
|
|
248
|
+
/* Error Message */
|
|
186
249
|
.wallet-modal-send-error {
|
|
187
250
|
font-size: 12px;
|
|
188
251
|
color: #ef4444;
|
|
189
|
-
margin-top: 4px;
|
|
190
252
|
text-align: left;
|
|
191
253
|
}
|
|
192
254
|
|
|
193
|
-
|
|
255
|
+
/* Send Button */
|
|
256
|
+
.wallet-modal-send-btn {
|
|
194
257
|
width: 100%;
|
|
195
258
|
padding: 14px 24px;
|
|
196
259
|
border-radius: 12px;
|
|
@@ -199,36 +262,16 @@
|
|
|
199
262
|
font-weight: 600;
|
|
200
263
|
cursor: pointer;
|
|
201
264
|
transition: all 0.2s;
|
|
202
|
-
|
|
203
|
-
align-items: center;
|
|
204
|
-
justify-content: center;
|
|
205
|
-
gap: 8px;
|
|
206
|
-
margin-top: 8px;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
.wallet-modal-send-preview-btn.disabled {
|
|
210
|
-
opacity: 0.5;
|
|
211
|
-
cursor: not-allowed;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
.wallet-modal-theme-dark .wallet-modal-send-preview-btn {
|
|
215
|
-
background: linear-gradient(135deg, #9333ea 0%, #7e22ce 100%);
|
|
216
|
-
color: #ffffff;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
.wallet-modal-theme-light .wallet-modal-send-preview-btn {
|
|
220
|
-
background: linear-gradient(135deg, #9333ea 0%, #7e22ce 100%);
|
|
265
|
+
background: #3b82f6;
|
|
221
266
|
color: #ffffff;
|
|
267
|
+
margin-top: 8px;
|
|
222
268
|
}
|
|
223
269
|
|
|
224
|
-
.wallet-modal-
|
|
225
|
-
background:
|
|
226
|
-
transform: translateY(-1px);
|
|
227
|
-
box-shadow: 0 4px 12px rgba(147, 51, 234, 0.3);
|
|
270
|
+
.wallet-modal-send-btn:hover:not(.disabled) {
|
|
271
|
+
background: #2563eb;
|
|
228
272
|
}
|
|
229
273
|
|
|
230
|
-
.wallet-modal-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
box-shadow: 0 4px 12px rgba(147, 51, 234, 0.2);
|
|
274
|
+
.wallet-modal-send-btn.disabled {
|
|
275
|
+
opacity: 0.5;
|
|
276
|
+
cursor: not-allowed;
|
|
234
277
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type { ChainData } from
|
|
2
|
-
import
|
|
1
|
+
import type { ChainData } from "../../../chains";
|
|
2
|
+
import "./SendModal.css";
|
|
3
3
|
export interface SendModalProps {
|
|
4
4
|
isOpen: boolean;
|
|
5
5
|
onClose: () => void;
|
|
6
6
|
currentChain: ChainData | null;
|
|
7
|
-
availableChains: ChainData[];
|
|
8
7
|
displayAddress: string | null;
|
|
9
8
|
availableBalance: bigint | null;
|
|
10
9
|
externalWalletBalance: bigint | null;
|
|
@@ -12,7 +11,6 @@ export interface SendModalProps {
|
|
|
12
11
|
sendTransaction?: (tx: any) => Promise<{
|
|
13
12
|
hash: string;
|
|
14
13
|
}>;
|
|
15
|
-
|
|
16
|
-
theme?: 'light' | 'dark';
|
|
14
|
+
theme?: "light" | "dark";
|
|
17
15
|
}
|
|
18
|
-
export declare function SendModal({ isOpen, onClose, currentChain,
|
|
16
|
+
export declare function SendModal({ isOpen, onClose, currentChain, displayAddress, availableBalance, externalWalletBalance, walletBalance, sendTransaction, theme, }: SendModalProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -2,22 +2,114 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
/**
|
|
3
3
|
* Send Modal Component
|
|
4
4
|
*/
|
|
5
|
-
import { useState, useCallback, useMemo, useEffect } from
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { useAddressValidation } from
|
|
10
|
-
import { useAmountValidation } from
|
|
11
|
-
import { useSendTransaction } from
|
|
12
|
-
import { formatBalanceValue } from
|
|
13
|
-
import
|
|
14
|
-
export function SendModal({ isOpen, onClose, currentChain,
|
|
15
|
-
const [recipientAddress, setRecipientAddress] = useState(
|
|
16
|
-
const [amount, setAmount] = useState(
|
|
17
|
-
const [addressError, setAddressError] = useState(
|
|
18
|
-
const [amountError, setAmountError] = useState(
|
|
5
|
+
import { useState, useCallback, useMemo, useEffect } from "react";
|
|
6
|
+
import { PreviewTransactionModal } from "./PreviewTransactionModal";
|
|
7
|
+
import { SuccessModal } from "./SuccessModal";
|
|
8
|
+
import { TokenSelectorModal } from "./TokenSelectorModal";
|
|
9
|
+
import { useAddressValidation } from "../hooks/useAddressValidation";
|
|
10
|
+
import { useAmountValidation } from "../hooks/useAmountValidation";
|
|
11
|
+
import { useSendTransaction } from "../hooks/useSendTransaction";
|
|
12
|
+
import { formatBalanceValue } from "../utils/formatUtils";
|
|
13
|
+
import "./SendModal.css";
|
|
14
|
+
export function SendModal({ isOpen, onClose, currentChain, displayAddress, availableBalance, externalWalletBalance, walletBalance, sendTransaction, theme = "dark", }) {
|
|
15
|
+
const [recipientAddress, setRecipientAddress] = useState("");
|
|
16
|
+
const [amount, setAmount] = useState("");
|
|
17
|
+
const [addressError, setAddressError] = useState("");
|
|
18
|
+
const [amountError, setAmountError] = useState("");
|
|
19
19
|
const [showPreview, setShowPreview] = useState(false);
|
|
20
|
+
const [showTokenSelector, setShowTokenSelector] = useState(false);
|
|
21
|
+
const [selectedToken, setSelectedToken] = useState(null);
|
|
20
22
|
const balance = externalWalletBalance || walletBalance || availableBalance;
|
|
23
|
+
// Get available tokens for the current chain
|
|
24
|
+
const availableTokens = useMemo(() => {
|
|
25
|
+
if (!currentChain)
|
|
26
|
+
return [];
|
|
27
|
+
const nativeToken = {
|
|
28
|
+
address: "0x0",
|
|
29
|
+
symbol: currentChain.nativeCurrency.symbol,
|
|
30
|
+
name: currentChain.nativeCurrency.name,
|
|
31
|
+
decimals: currentChain.nativeCurrency.decimals,
|
|
32
|
+
iconUrl: currentChain.iconUrl,
|
|
33
|
+
balance: balance || 0n,
|
|
34
|
+
isNative: true,
|
|
35
|
+
};
|
|
36
|
+
// Example tokens for Ethereum (you can expand this for other chains)
|
|
37
|
+
const tokensByChain = {
|
|
38
|
+
1: [
|
|
39
|
+
// Ethereum Mainnet
|
|
40
|
+
nativeToken,
|
|
41
|
+
{
|
|
42
|
+
address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
|
43
|
+
symbol: "WETH",
|
|
44
|
+
name: "Wrapped Ether",
|
|
45
|
+
decimals: 18,
|
|
46
|
+
iconUrl: "https://raw.githubusercontent.com/spothq/cryptocurrency-icons/master/128/color/eth.png",
|
|
47
|
+
balance: 0n,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
address: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
|
|
51
|
+
symbol: "USDT",
|
|
52
|
+
name: "Tether USD",
|
|
53
|
+
decimals: 6,
|
|
54
|
+
iconUrl: "https://raw.githubusercontent.com/spothq/cryptocurrency-icons/master/128/color/usdt.png",
|
|
55
|
+
balance: 0n,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
59
|
+
symbol: "USDC",
|
|
60
|
+
name: "USD Coin",
|
|
61
|
+
decimals: 6,
|
|
62
|
+
iconUrl: "https://raw.githubusercontent.com/spothq/cryptocurrency-icons/master/128/color/usdc.png",
|
|
63
|
+
balance: 0n,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
address: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",
|
|
67
|
+
symbol: "WBTC",
|
|
68
|
+
name: "Wrapped Bitcoin",
|
|
69
|
+
decimals: 8,
|
|
70
|
+
iconUrl: "https://raw.githubusercontent.com/spothq/cryptocurrency-icons/master/128/color/btc.png",
|
|
71
|
+
balance: 0n,
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
137: [
|
|
75
|
+
// Polygon Mainnet
|
|
76
|
+
nativeToken,
|
|
77
|
+
{
|
|
78
|
+
address: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",
|
|
79
|
+
symbol: "WMATIC",
|
|
80
|
+
name: "Wrapped Matic",
|
|
81
|
+
decimals: 18,
|
|
82
|
+
iconUrl: "https://raw.githubusercontent.com/spothq/cryptocurrency-icons/master/128/color/matic.png",
|
|
83
|
+
balance: 0n,
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
address: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F",
|
|
87
|
+
symbol: "USDT",
|
|
88
|
+
name: "Tether USD",
|
|
89
|
+
decimals: 6,
|
|
90
|
+
iconUrl: "https://raw.githubusercontent.com/spothq/cryptocurrency-icons/master/128/color/usdt.png",
|
|
91
|
+
balance: 0n,
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
address: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
|
|
95
|
+
symbol: "USDC",
|
|
96
|
+
name: "USD Coin",
|
|
97
|
+
decimals: 6,
|
|
98
|
+
iconUrl: "https://raw.githubusercontent.com/spothq/cryptocurrency-icons/master/128/color/usdc.png",
|
|
99
|
+
balance: 0n,
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
};
|
|
103
|
+
return tokensByChain[currentChain.id] || [nativeToken];
|
|
104
|
+
}, [currentChain, balance]);
|
|
105
|
+
// Initialize selected token when chain changes
|
|
106
|
+
useEffect(() => {
|
|
107
|
+
if (currentChain && availableTokens.length > 0) {
|
|
108
|
+
// Set native token as default
|
|
109
|
+
const nativeToken = availableTokens.find((t) => t.isNative);
|
|
110
|
+
setSelectedToken(nativeToken || availableTokens[0]);
|
|
111
|
+
}
|
|
112
|
+
}, [currentChain, availableTokens]);
|
|
21
113
|
const { validate: validateAddress } = useAddressValidation(displayAddress, currentChain);
|
|
22
114
|
const { validate: validateAmount } = useAmountValidation(balance, currentChain);
|
|
23
115
|
const { send, isSending, txHash, reset } = useSendTransaction({
|
|
@@ -43,22 +135,22 @@ export function SendModal({ isOpen, onClose, currentChain, availableChains, disp
|
|
|
43
135
|
setAddressError(error);
|
|
44
136
|
}
|
|
45
137
|
else {
|
|
46
|
-
setAddressError(
|
|
138
|
+
setAddressError("");
|
|
47
139
|
}
|
|
48
140
|
}, [validateAddress]);
|
|
49
141
|
const handleAmountChange = useCallback((value) => {
|
|
50
142
|
// Only allow numbers and decimal point
|
|
51
|
-
const sanitized = value.replace(/[^0-9.]/g,
|
|
143
|
+
const sanitized = value.replace(/[^0-9.]/g, "");
|
|
52
144
|
// Prevent multiple decimal points
|
|
53
|
-
const parts = sanitized.split(
|
|
54
|
-
const finalValue = parts.length > 2 ? parts[0] +
|
|
145
|
+
const parts = sanitized.split(".");
|
|
146
|
+
const finalValue = parts.length > 2 ? parts[0] + "." + parts.slice(1).join("") : sanitized;
|
|
55
147
|
setAmount(finalValue);
|
|
56
148
|
if (finalValue) {
|
|
57
149
|
const error = validateAmount(finalValue);
|
|
58
150
|
setAmountError(error);
|
|
59
151
|
}
|
|
60
152
|
else {
|
|
61
|
-
setAmountError(
|
|
153
|
+
setAmountError("");
|
|
62
154
|
}
|
|
63
155
|
}, [validateAmount]);
|
|
64
156
|
const handlePreviewTransaction = useCallback(() => {
|
|
@@ -80,13 +172,18 @@ export function SendModal({ isOpen, onClose, currentChain, availableChains, disp
|
|
|
80
172
|
}
|
|
81
173
|
}, [send, recipientAddress, amount]);
|
|
82
174
|
const handleReset = useCallback(() => {
|
|
83
|
-
setRecipientAddress(
|
|
84
|
-
setAmount(
|
|
85
|
-
setAddressError(
|
|
86
|
-
setAmountError(
|
|
175
|
+
setRecipientAddress("");
|
|
176
|
+
setAmount("");
|
|
177
|
+
setAddressError("");
|
|
178
|
+
setAmountError("");
|
|
87
179
|
setShowPreview(false);
|
|
180
|
+
setShowTokenSelector(false);
|
|
88
181
|
reset();
|
|
89
182
|
}, [reset]);
|
|
183
|
+
const handleTokenSelect = useCallback((token) => {
|
|
184
|
+
setSelectedToken(token);
|
|
185
|
+
setShowTokenSelector(false);
|
|
186
|
+
}, []);
|
|
90
187
|
useEffect(() => {
|
|
91
188
|
if (!isOpen) {
|
|
92
189
|
handleReset();
|
|
@@ -95,12 +192,12 @@ export function SendModal({ isOpen, onClose, currentChain, availableChains, disp
|
|
|
95
192
|
if (!isOpen)
|
|
96
193
|
return null;
|
|
97
194
|
const availableBalanceValue = useMemo(() => {
|
|
98
|
-
if (!balance || !
|
|
99
|
-
return
|
|
100
|
-
return formatBalanceValue(balance,
|
|
101
|
-
}, [balance,
|
|
102
|
-
const symbol = currentChain?.nativeCurrency.symbol ||
|
|
103
|
-
const chainName = currentChain?.displayName ||
|
|
195
|
+
if (!balance || !selectedToken)
|
|
196
|
+
return "0";
|
|
197
|
+
return formatBalanceValue(balance, selectedToken.decimals);
|
|
198
|
+
}, [balance, selectedToken]);
|
|
199
|
+
const symbol = selectedToken?.symbol || currentChain?.nativeCurrency.symbol || "ETH";
|
|
200
|
+
const chainName = currentChain?.displayName || "Select Chain";
|
|
104
201
|
const isFormValid = !addressError && !amountError && recipientAddress && amount;
|
|
105
202
|
// Show success modal
|
|
106
203
|
if (txHash && !showPreview) {
|
|
@@ -113,15 +210,10 @@ export function SendModal({ isOpen, onClose, currentChain, availableChains, disp
|
|
|
113
210
|
if (showPreview) {
|
|
114
211
|
return (_jsx(PreviewTransactionModal, { isOpen: true, onClose: () => setShowPreview(false), onConfirm: handleConfirmSend, recipientAddress: recipientAddress, amount: amount, displayAddress: displayAddress, currentChain: currentChain, isSending: isSending, theme: theme }));
|
|
115
212
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
catch (error) {
|
|
122
|
-
console.error('Failed to switch chain:', error);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}, theme: theme, className: "wallet-modal-send-chain-selector" }) })] }), _jsxs("div", { className: "wallet-modal-send-field", children: [_jsxs("div", { className: "wallet-modal-send-amount-wrapper", children: [_jsx("div", { className: "wallet-modal-send-amount-prefix", children: symbol }), _jsx("input", { type: "text", className: `wallet-modal-send-amount-input ${amountError ? 'error' : ''}`, placeholder: "Enter amount", value: amount, onChange: (e) => handleAmountChange(e.target.value) }), _jsx("div", { className: "wallet-modal-send-amount-suffix", children: "$ --" })] }), amountError && _jsx("div", { className: "wallet-modal-send-error", children: amountError }), _jsxs("div", { className: "wallet-modal-send-balance", children: [_jsx("span", { className: "wallet-modal-send-balance-label", children: "Available:" }), _jsxs("span", { className: "wallet-modal-send-balance-value", children: [availableBalanceValue, " ", symbol] })] })] }), _jsxs("div", { className: "wallet-modal-send-field", children: [_jsx("label", { className: "wallet-modal-send-label", children: "Recipient Address" }), _jsx("input", { type: "text", className: `wallet-modal-send-address-input ${addressError ? 'error' : ''}`, placeholder: "Address", value: recipientAddress, onChange: (e) => handleRecipientAddressChange(e.target.value) }), addressError && _jsx("div", { className: "wallet-modal-send-error", children: addressError })] }), _jsx("button", { className: `wallet-modal-send-preview-btn wallet-modal-theme-${theme} ${!isFormValid ? 'disabled' : ''}`, onClick: handlePreviewTransaction, disabled: !isFormValid, children: "Preview transaction" })] })] }) }));
|
|
213
|
+
// Show token selector modal
|
|
214
|
+
if (showTokenSelector) {
|
|
215
|
+
return (_jsx(TokenSelectorModal, { isOpen: true, onClose: () => setShowTokenSelector(false), onTokenSelect: handleTokenSelect, currentChain: currentChain, tokens: availableTokens, selectedToken: selectedToken || undefined, theme: theme }));
|
|
216
|
+
}
|
|
217
|
+
return (_jsx("div", { className: `wallet-modal-overlay wallet-modal-theme-${theme}`, onClick: onClose, children: _jsxs("div", { className: `wallet-modal-content wallet-modal-theme-${theme} wallet-modal-send`, onClick: (e) => e.stopPropagation(), children: [_jsxs("div", { className: "wallet-modal-send-header", children: [_jsx("button", { className: "wallet-modal-back", onClick: onClose, "aria-label": "Go back", children: _jsx("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: _jsx("path", { d: "M12.5 15L7.5 10L12.5 5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }), _jsx("h2", { className: "wallet-modal-send-title", children: "Send Funds" }), _jsx("button", { className: "wallet-modal-close", onClick: onClose, "aria-label": "Close", children: _jsx("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: _jsx("path", { d: "M15 5L5 15M5 5L15 15", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) })] }), _jsxs("div", { className: "wallet-modal-send-content", children: [_jsxs("div", { className: "wallet-modal-send-field", children: [_jsx("label", { className: "wallet-modal-send-label", children: "Token" }), _jsxs("button", { className: "wallet-modal-send-token-card", onClick: () => setShowTokenSelector(true), type: "button", children: [_jsx("div", { className: "wallet-modal-send-token-icon", children: selectedToken?.iconUrl ? (_jsx("img", { src: selectedToken.iconUrl, alt: selectedToken.name })) : (_jsx("div", { className: "wallet-modal-send-token-icon-placeholder", children: selectedToken?.symbol?.charAt(0) || "?" })) }), _jsxs("div", { className: "wallet-modal-send-token-details", children: [_jsx("span", { className: "wallet-modal-send-token-name", children: selectedToken?.name || "Ether" }), _jsxs("span", { className: "wallet-modal-send-token-balance", children: [availableBalanceValue, " ", symbol] })] })] })] }), _jsxs("div", { className: "wallet-modal-send-field", children: [_jsx("label", { className: "wallet-modal-send-label", children: "Send to" }), _jsx("input", { type: "text", className: `wallet-modal-send-input ${addressError ? "error" : ""}`, placeholder: "0x... or ENS name", value: recipientAddress, onChange: (e) => handleRecipientAddressChange(e.target.value) }), addressError && (_jsx("div", { className: "wallet-modal-send-error", children: addressError }))] }), _jsxs("div", { className: "wallet-modal-send-field", children: [_jsx("label", { className: "wallet-modal-send-label", children: "Amount" }), _jsxs("div", { className: `wallet-modal-send-amount-box ${amountError ? "error" : ""}`, children: [_jsx("input", { type: "text", className: "wallet-modal-send-amount-input", placeholder: "0", value: amount, onChange: (e) => handleAmountChange(e.target.value) }), _jsx("span", { className: "wallet-modal-send-amount-symbol", children: symbol })] }), amountError && (_jsx("div", { className: "wallet-modal-send-error", children: amountError }))] }), _jsx("button", { className: `wallet-modal-send-btn ${!isFormValid ? "disabled" : ""}`, onClick: handlePreviewTransaction, disabled: !isFormValid, children: "Send" })] })] }) }));
|
|
126
218
|
}
|
|
127
219
|
//# sourceMappingURL=SendModal.js.map
|