Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Koinos #106

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ npm install multicoin-address-validator
* Illuvium/ilv `'Illuvium'` or `'ilv'`
* Immutable/imx `'Immutable'` or `'imx'`
* Injective/inj `'Injective'` or `'inj'`
* Koinos/koin `'Koinos'` or `'koin'`
* Komodo/kmd `'Komodo'` or `'kmd'`
* LBRY Credits/lbc `'LBRY Credits'` or `'lbc'`
* Lido DAO Token/ldo `'Lido DAO Token'` or `'ldo'`
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"Illuvium","ilv",
"Immutable","imx",
"Injective","inj",
"Koinos","koin",
"Komodo","kmd",
"LBRY Credits","lbc",
"Lido DAO Token","ldo",
Expand Down
5 changes: 5 additions & 0 deletions src/currencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ var CURRENCIES = [{
symbol: 'btg',
addressTypes: { prod: ['26', '17'], testnet: ['6f', 'c4'] },
validator: BTCValidator
}, {
name: 'Koinos',
symbol: 'koin',
addressTypes: { prod: ['00'], testnet: ['00'] },
validator: BTCValidator
}, {
name: 'Komodo',
symbol: 'kmd',
Expand Down
24 changes: 24 additions & 0 deletions test/wallet_address_validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,12 @@ describe('WAValidator.validate()', function () {
valid('ztmWMDLWjbruCJxKmmfAZiT6QAQdiv5F291', 'zencash', 'testnet');
});

it('should return true for correct koin addresses', function () {
valid('1Dq1YYNrC3yLEDax527yVhX8Y66xCoJ684', 'koinos');
valid('1PRMZdT8me6eugZBpHihXYZKiHJMFUvpDh', 'KOIN');
valid('1McpB177XmfVzyQSFfi8XKV5LCDrY4GUM8', 'koinos', 'testnet');
});

it('should return true for correct komodo addresses', function () {
valid('R9R5HirAzqDcWrWGiJEL115dpV3QB3hobH', 'komodo');
valid('RAvj2KKVUohTu3hVdNJ4U6hQi7TNawpacH', 'KMD');
Expand Down Expand Up @@ -1095,6 +1101,15 @@ describe('WAValidator.validate()', function () {
invalid('ztYWMDLWjbruCJxKmmfAZiT6QAQdiv5F291', 'zencash', 'testnet');
});

it('should return false for incorrect koinos addresses', function () {
commonTests('koinos');
// koinos only supports p2pkh. No p2sh or segwit
invalid('3FyVFsEyyBPzHjD3qUEgX7Jsn4tcHNZFkn', 'koinos');
invalid('3NJZLcZEEYBpxYEUGewU4knsQRn1WM5Fkt', 'KOIN');
invalid('BC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3T4', 'koinos');
invalid('t2YNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'koinos', 'testnet');
});

it('should return false for incorrect komodo addresses', function () {
commonTests('komodo');
invalid('R9Y5HirAzqDcWrWGiJEL115dpV3QB3hobH', 'komodo');
Expand Down Expand Up @@ -1430,6 +1445,15 @@ describe('invalid results', function () {
invalid('ztYWMDLWjbruCJxKmmfAZiT6QAQdiv5F291', 'zencash', 'testnet');
});

it('should return false for incorrect koinos addresses', function () {
commonTests('koinos');
// koinos only supports p2pkh. No p2sh or segwit
invalid('3FyVFsEyyBPzHjD3qUEgX7Jsn4tcHNZFkn', 'koinos');
invalid('3NJZLcZEEYBpxYEUGewU4knsQRn1WM5Fkt', 'KOIN');
invalid('BC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3T4', 'koinos');
invalid('t2YNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'koinos', 'testnet');
});

it('should return false for incorrect komodo addresses', function () {
commonTests('komodo');
invalid('R9Y5HirAzqDcWrWGiJEL115dpV3QB3hobH', 'komodo');
Expand Down