@@ -20,6 +20,7 @@ import moment from "moment";
20
20
import { AccountHistoryFilterContext } from "api/contexts/AccountHistoryFilter" ;
21
21
import { PreferencesContext , Theme } from "api/contexts/Preferences" ;
22
22
import QuestionCircle from "components/QuestionCircle" ;
23
+ import { getAccountAddressFromText , isValidAccountAddress } from "components/utils" ;
23
24
import { TwoToneColors } from "components/utils" ;
24
25
25
26
import Export from "./Export" ;
@@ -181,7 +182,24 @@ const Filters: React.FC = () => {
181
182
</ Select >
182
183
< Controller
183
184
render = { ( { field } ) => (
184
- < Input { ...field } style = { { flexGrow : 1 } } placeholder = "nano_" />
185
+ < Input
186
+ { ...field }
187
+ style = { { flexGrow : 1 } }
188
+ placeholder = "nano_"
189
+ onPaste = { e => {
190
+ e . preventDefault ( ) ;
191
+
192
+ // @ts -ignore
193
+ const paste = ( e . clipboardData || window . clipboardData ) . getData ( "text" ) ;
194
+
195
+ const account = getAccountAddressFromText ( paste ) ;
196
+ if ( isValidAccountAddress ( account ) ) {
197
+ setValue ( "sender" , account ) ;
198
+ }
199
+
200
+ setValue ( "sender" , account ) ;
201
+ } }
202
+ />
185
203
) }
186
204
control = { control }
187
205
name = "sender"
@@ -227,7 +245,23 @@ const Filters: React.FC = () => {
227
245
</ Select >
228
246
< Controller
229
247
render = { ( { field } ) => (
230
- < Input { ...field } style = { { flexGrow : 1 } } placeholder = "nano_" />
248
+ < Input
249
+ { ...field }
250
+ name = "receiver"
251
+ style = { { flexGrow : 1 } }
252
+ placeholder = "nano_"
253
+ onPaste = { e => {
254
+ e . preventDefault ( ) ;
255
+
256
+ // @ts -ignore
257
+ const paste = ( e . clipboardData || window . clipboardData ) . getData ( "text" ) ;
258
+
259
+ const account = getAccountAddressFromText ( paste ) ;
260
+ if ( isValidAccountAddress ( account ) ) {
261
+ setValue ( "receiver" , account ) ;
262
+ }
263
+ } }
264
+ />
231
265
) }
232
266
control = { control }
233
267
name = "receiver"
0 commit comments