Skip to content

Commit

Permalink
Merge pull request #26 from ognus/qtum
Browse files Browse the repository at this point in the history
Qtum validation
  • Loading branch information
ognus authored Apr 9, 2018
2 parents 4f17d54 + 0db0e04 commit 77a7d02
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ npm install wallet-address-validator
* Primecoin/XPM, `'primecoin'` or `'XPM'`
* Protoshares/PTS, `'protoshares'` or `'PTS'`

* Qtum/QTUM, `'qtum'` or `'QTUM'`

* Ripple/XRP, `'ripple'` or `'XRP'`

* Vertcoin/VTC, `'vertcoin'` or `'VTC'`
Expand Down
4 changes: 4 additions & 0 deletions dist/wallet-address-validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -3345,6 +3345,10 @@ var CURRENCIES = [{
name: 'neo',
symbol: 'neo',
addressTypes: {prod: ['17'], testnet: []}
},{
name: 'qtum',
symbol: 'qtum',
addressTypes: {prod: ['3a', '32'], testnet: ['6f', 'c4']}
}];


Expand Down
2 changes: 1 addition & 1 deletion dist/wallet-address-validator.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"ripple",
"dash",
"neo",
"qtum",
"altcoin",
"crypto",
"address",
Expand Down
4 changes: 4 additions & 0 deletions src/currencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ var CURRENCIES = [{
name: 'neo',
symbol: 'neo',
addressTypes: {prod: ['17'], testnet: []}
},{
name: 'qtum',
symbol: 'qtum',
addressTypes: {prod: ['3a', '32'], testnet: ['6f', 'c4']}
}];


Expand Down
12 changes: 12 additions & 0 deletions test/wallet_address_validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,12 @@ describe('WAValidator.validate()', function () {
valid('AR4QmqYENiZAD6oXe7ftm6eDcwtHk7rVTT', 'neo');
valid('AKDVzYGLczmykdtRaejgvWeZrvdkVEvQ1X', 'NEO');
});

it('should return true for correct qtum addresses', function () {
valid('QNjUiD3bVVZwYTc5AhpeQbS1mfb2guyWhe', 'qtum');
valid('QVZnSrMwKp6AL4FjUPPnfFgsma6j1DXQXu', 'QTUM');
valid('2MxKEf2su6FGAUfCEAHreGFQvEYrfYNHvL7', 'qtum', 'testnet');
});
});

describe('invalid results', function () {
Expand Down Expand Up @@ -377,5 +383,11 @@ describe('WAValidator.validate()', function () {
invalid('AR4QmqYENiZAD6oXe7ftm6eDcwtHk7rVTa', 'neo');
invalid('AKDVzYGLczmykdtRaejgvWeZrvdkVEvQ10', 'NEO');
});

it('should return false for incorrect qtum addresses', function () {
commonTests('qtum');
invalid('QNPhBbVhDghASxcUh2vHotQUgNeLRFTcfb', 'qtum');
invalid('QOPhBbVhDghASxcUh2vHotQUgNeLRFTcfa', 'QTUM');
});
});
});

0 comments on commit 77a7d02

Please sign in to comment.