diff --git a/lib/address.js b/lib/address.js index 4015676..fb50e6f 100644 --- a/lib/address.js +++ b/lib/address.js @@ -10,6 +10,12 @@ function Address(obj) { this.set(obj); }; +Address.validate = function(addrstr) { + var address = new Address().fromString(addrstr); + address.validate(); + return this; +}; + Address.prototype.set = function(obj) { this.hashbuf = obj.hashbuf || this.hashbuf || null; this.networkstr = obj.networkstr || this.networkstr || 'mainnet'; diff --git a/test/test.address.js b/test/test.address.js index 45959a1..9b9ff50 100644 --- a/test/test.address.js +++ b/test/test.address.js @@ -12,6 +12,14 @@ describe('Address', function() { should.exist(address); }); + describe('@validate', function() { + + it('should validate this valid address string', function() { + should.exist(Address.validate(str)) + }); + + }); + describe('#fromPubkey', function() { it('should make this address from a compressed pubkey', function() {