File tree Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -387,6 +387,16 @@ class Step1ES extends Component {
387
387
let fromAccount = userInput . sysxFromAccount ;
388
388
let assetGUID = userInput . toSysAssetGUID ;
389
389
let syscoinWitnessAddress = userInput . syscoinWitnessAddress ;
390
+ try {
391
+ sjs . utils . bitcoinjs . address . toOutputScript ( syscoinWitnessAddress , CONFIGURATION . SysNetwork )
392
+ } catch ( e ) {
393
+ console . log ( 'e ' + e . message , " address " + syscoinWitnessAddress )
394
+ validateNewInput . buttonVal = false ;
395
+ validateNewInput . buttonValMsg = this . props . t ( "step1FSInvalidDestination" ) ;
396
+ this . setState ( Object . assign ( userInput , validateNewInput , this . _validationErrors ( validateNewInput ) ) ) ;
397
+ this . setState ( { working : false } ) ;
398
+ return ;
399
+ }
390
400
let allowance = web3 . utils . toBN ( 0 ) ;
391
401
if ( assetGUID !== CONFIGURATION . SYSXAsset ) {
392
402
allowance = await contractBase . methods . allowance ( fromAccount , CONFIGURATION . ERC20Manager ) . call ( ) ;
Original file line number Diff line number Diff line change 1
1
2
2
import React , { Component } from 'react' ;
3
3
import CONFIGURATION from '../config' ;
4
+ import Web3 from 'web3' ;
4
5
const satoshibitcoin = require ( "satoshi-bitcoin" ) ;
5
- const sjs = require ( 'syscoinjs-lib' )
6
+ const sjs = require ( 'syscoinjs-lib' ) ;
7
+ const web3 = new Web3 ( Web3 . givenProvider ) ;
6
8
class Step1 extends Component {
7
9
constructor ( props ) {
8
10
super ( props ) ;
@@ -137,14 +139,20 @@ class Step1 extends Component {
137
139
if ( ! userInput . ethaddress || userInput . ethaddress === "" ) {
138
140
validateNewInput . ethaddressVal = false ;
139
141
valid = false ;
140
- }
142
+ }
143
+ if ( ! web3 . utils . isAddress ( userInput . ethaddress ) ) {
144
+ validateNewInput . buttonVal = false ;
145
+ validateNewInput . buttonValMsg = this . props . t ( "step1FSInvalidDestination" ) ;
146
+ self . setState ( { working : false } ) ;
147
+ self . setState ( Object . assign ( userInput , validateNewInput , this . _validationErrors ( validateNewInput ) ) ) ;
148
+ return ;
149
+ }
141
150
let self = this ;
142
151
143
152
if ( valid === true ) {
144
153
this . setState ( { working : true } ) ;
145
154
if ( userInput . asset . length > 0 && userInput . asset !== 0 && userInput . asset !== "0" ) {
146
155
let assetGuid = userInput . asset . toString ( ) ;
147
-
148
156
let ethAddressStripped = userInput . ethaddress . toString ( ) ;
149
157
if ( ethAddressStripped && ethAddressStripped . startsWith ( "0x" ) ) {
150
158
ethAddressStripped = ethAddressStripped . substr ( 2 , ethAddressStripped . length ) ;
You can’t perform that action at this time.
0 commit comments