Create Validator class and add deps to package.json

This commit is contained in:
Daniel Ternyak 2017-06-24 01:08:57 -05:00
parent bc9765d99b
commit c77f8430c5
2 changed files with 18 additions and 0 deletions

16
common/libs/validator.js Normal file
View File

@ -0,0 +1,16 @@
import WalletAddressValidator from 'wallet-address-validator';
import ethUtil from 'ethereumjs-util';
export default class Validator {
isValidETHAddress = function(address) {
if (address && address === '0x0000000000000000000000000000000000000000')
return false;
if (address) {
return ethUtil.isValidAddress(address);
}
return false;
};
isValidBTCAddress = function(address) {
return WalletAddressValidator.validate(address, 'BTC');
};
}

View File

@ -5,6 +5,7 @@
"description": "MyEtherWallet v4",
"dependencies": {
"axios": "^0.16.2",
"ethereumjs-util": "^5.1.2",
"lodash": "^4.17.4",
"prop-types": "^15.5.8",
"react": "^15.4.2",
@ -17,6 +18,7 @@
"redux-logger": "^3.0.1",
"redux-saga": "^0.15.3",
"store2": "^2.5.0",
"wallet-address-validator": "^0.1.0",
"whatwg-fetch": "^2.0.2"
},
"devDependencies": {