Skip to content

Commit 77a7d02

Browse files
authored
Merge pull request #26 from ognus/qtum
Qtum validation
2 parents 4f17d54 + 0db0e04 commit 77a7d02

File tree

6 files changed

+24
-1
lines changed

6 files changed

+24
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ npm install wallet-address-validator
7171
* Primecoin/XPM, `'primecoin'` or `'XPM'`
7272
* Protoshares/PTS, `'protoshares'` or `'PTS'`
7373

74+
* Qtum/QTUM, `'qtum'` or `'QTUM'`
75+
7476
* Ripple/XRP, `'ripple'` or `'XRP'`
7577

7678
* Vertcoin/VTC, `'vertcoin'` or `'VTC'`

dist/wallet-address-validator.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3345,6 +3345,10 @@ var CURRENCIES = [{
33453345
name: 'neo',
33463346
symbol: 'neo',
33473347
addressTypes: {prod: ['17'], testnet: []}
3348+
},{
3349+
name: 'qtum',
3350+
symbol: 'qtum',
3351+
addressTypes: {prod: ['3a', '32'], testnet: ['6f', 'c4']}
33483352
}];
33493353

33503354

dist/wallet-address-validator.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"ripple",
1313
"dash",
1414
"neo",
15+
"qtum",
1516
"altcoin",
1617
"crypto",
1718
"address",

src/currencies.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ var CURRENCIES = [{
104104
name: 'neo',
105105
symbol: 'neo',
106106
addressTypes: {prod: ['17'], testnet: []}
107+
},{
108+
name: 'qtum',
109+
symbol: 'qtum',
110+
addressTypes: {prod: ['3a', '32'], testnet: ['6f', 'c4']}
107111
}];
108112

109113

test/wallet_address_validator.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,12 @@ describe('WAValidator.validate()', function () {
262262
valid('AR4QmqYENiZAD6oXe7ftm6eDcwtHk7rVTT', 'neo');
263263
valid('AKDVzYGLczmykdtRaejgvWeZrvdkVEvQ1X', 'NEO');
264264
});
265+
266+
it('should return true for correct qtum addresses', function () {
267+
valid('QNjUiD3bVVZwYTc5AhpeQbS1mfb2guyWhe', 'qtum');
268+
valid('QVZnSrMwKp6AL4FjUPPnfFgsma6j1DXQXu', 'QTUM');
269+
valid('2MxKEf2su6FGAUfCEAHreGFQvEYrfYNHvL7', 'qtum', 'testnet');
270+
});
265271
});
266272

267273
describe('invalid results', function () {
@@ -377,5 +383,11 @@ describe('WAValidator.validate()', function () {
377383
invalid('AR4QmqYENiZAD6oXe7ftm6eDcwtHk7rVTa', 'neo');
378384
invalid('AKDVzYGLczmykdtRaejgvWeZrvdkVEvQ10', 'NEO');
379385
});
386+
387+
it('should return false for incorrect qtum addresses', function () {
388+
commonTests('qtum');
389+
invalid('QNPhBbVhDghASxcUh2vHotQUgNeLRFTcfb', 'qtum');
390+
invalid('QOPhBbVhDghASxcUh2vHotQUgNeLRFTcfa', 'QTUM');
391+
});
380392
});
381393
});

0 commit comments

Comments
 (0)