diff --git a/dist/wallet-address-validator.js b/dist/wallet-address-validator.js index 1af045f4..e2996f97 100644 --- a/dist/wallet-address-validator.js +++ b/dist/wallet-address-validator.js @@ -10788,399 +10788,398 @@ var EOSValidator = require('./eos_validator'); var XTZValidator = require('./tezos_validator'); // defines P2PKH and P2SH address types for standard (prod) and testnet networks -var CURRENCIES = [ - { - name: 'Bitcoin', - symbol: 'btc', - addressTypes: { prod: ['00', '05'], testnet: ['6f', 'c4', '3c', '26'] }, - validator: BTCValidator - }, { - name: 'BitcoinCash', - symbol: 'bch', - regexp: '^[qQpP]{1}[0-9a-zA-Z]{41}$', - addressTypes: { prod: ['00', '05'], testnet: ['6f', 'c4'] }, - validator: BCHValidator - }, { - name: 'Bitcoin SV', - symbol: 'bsv', - regexp: '^[qQ]{1}[0-9a-zA-Z]{41}$', - addressTypes: { prod: ['00', '05'], testnet: ['6f', 'c4'] }, - validator: BCHValidator - }, { - name: 'LiteCoin', - symbol: 'ltc', - addressTypes: { prod: ['30', '05', '32'], testnet: ['6f', 'c4', '3a'] }, - validator: BTCValidator - }, { - name: 'PeerCoin', - symbol: 'ppc', - addressTypes: { prod: ['37', '75'], testnet: ['6f', 'c4'] }, - validator: BTCValidator - }, { - name: 'DogeCoin', - symbol: 'doge', - addressTypes: { prod: ['1e', '16'], testnet: ['71', 'c4'] }, - validator: BTCValidator - }, { - name: 'BeaverCoin', - symbol: 'bvc', - addressTypes: { prod: ['19', '05'], testnet: ['6f', 'c4'] }, - validator: BTCValidator, - }, { - name: 'FreiCoin', - symbol: 'frc', - addressTypes: { prod: ['00', '05'], testnet: ['6f', 'c4'] }, - validator: BTCValidator - }, { - name: 'ProtoShares', - symbol: 'pts', - addressTypes: { prod: ['38', '05'], testnet: ['6f', 'c4'] }, - validator: BTCValidator - }, { - name: 'MegaCoin', - symbol: 'mec', - addressTypes: { prod: ['32', '05'], testnet: ['6f', 'c4'] }, - validator: BTCValidator - }, { - name: 'PrimeCoin', - symbol: 'xpm', - addressTypes: { prod: ['17', '53'], testnet: ['6f', 'c4'] }, - validator: BTCValidator - }, { - name: 'AuroraCoin', - symbol: 'aur', - addressTypes: { prod: ['17', '05'], testnet: ['6f', 'c4'] }, - validator: BTCValidator - }, { - name: 'NameCoin', - symbol: 'nmc', - addressTypes: { prod: ['34'], testnet: [] }, - validator: BTCValidator - }, { - name: 'BioCoin', - symbol: 'bio', - addressTypes: { prod: ['19', '14'], testnet: ['6f', 'c4'] }, - validator: BTCValidator - }, { - name: 'GarliCoin', - symbol: 'grlc', - addressTypes: { prod: ['26', '05'], testnet: ['6f', 'c4'] }, - validator: BTCValidator - }, { - name: 'VertCoin', - symbol: 'vtc', - addressTypes: { prod: ['0x', '47', '71', '05'], testnet: ['6f', 'c4'] }, - validator: BTCValidator - - }, { - name: 'BitcoinGold', - symbol: 'btg', - addressTypes: { prod: ['26', '17'], testnet: ['6f', 'c4'] }, - validator: BTCValidator - }, { - name: 'Komodo', - symbol: 'kmd', - addressTypes: { prod: ['3c', '55'], testnet: ['0', '5'] }, - validator: BTCValidator - }, { - name: 'BitcoinZ', - symbol: 'btcz', - expectedLength: 26, - addressTypes: { prod: ['1cb8', '1cbd'], testnet: ['1d25', '1cba'] }, - validator: BTCValidator - }, { - name: 'BitcoinPrivate', - symbol: 'btcp', - expectedLength: 26, - addressTypes: { prod: ['1325', '13af'], testnet: ['1957', '19e0'] }, - validator: BTCValidator - }, { - name: 'Hush', - symbol: 'hush', - expectedLength: 26, - addressTypes: { prod: ['1cb8', '1cbd'], testnet: ['1d25', '1cba'] }, - validator: BTCValidator - }, { - name: 'SnowGem', - symbol: 'sng', - expectedLength: 26, - addressTypes: { prod: ['1c28', '1c2d'], testnet: ['1d25', '1cba'] }, - validator: BTCValidator - }, { - name: 'ZCash', - symbol: 'zec', - expectedLength: 26, - addressTypes: { prod: ['1cb8', '1cbd'], testnet: ['1d25', '1cba'] }, - validator: BTCValidator - }, { - name: 'ZClassic', - symbol: 'zcl', - expectedLength: 26, - addressTypes: { prod: ['1cb8', '1cbd'], testnet: ['1d25', '1cba'] }, - validator: BTCValidator - }, { - name: 'ZenCash', - symbol: 'zen', - expectedLength: 26, - addressTypes: { prod: ['2089', '2096'], testnet: ['2092', '2098'] }, - validator: BTCValidator - }, { - name: 'VoteCoin', - symbol: 'vot', - expectedLength: 26, - addressTypes: { prod: ['1cb8', '1cbd'], testnet: ['1d25', '1cba'] }, - validator: BTCValidator - }, { - name: 'Decred', - symbol: 'dcr', - addressTypes: { prod: ['073f', '071a'], testnet: ['0f21', '0efc'] }, - hashFunction: 'blake256', - expectedLength: 26, - validator: BTCValidator - }, { - name: 'GameCredits', - symbol: 'game', - addressTypes: { prod: ['26', '05'], testnet: [] }, - validator: BTCValidator - }, { - name: 'PIVX', - symbol: 'pivx', - addressTypes: { prod: ['1e', '0d'], testnet: [] }, - validator: BTCValidator - }, { - name: 'SolarCoin', - symbol: 'slr', - addressTypes: { prod: ['12', '05'], testnet: [] }, - validator: BTCValidator - }, { - name: 'MonaCoin', - symbol: 'mona', - addressTypes: { prod: ['32', '37'], testnet: [] }, - validator: BTCValidator - }, { - name: 'DigiByte', - symbol: 'dgb', - addressTypes: { prod: ['1e'], testnet: [] }, - validator: BTCValidator - }, { - name: 'Tether', - symbol: 'usdt', - addressTypes: { prod: ['00', '05'], testnet: ['6f', 'c4'] }, - validator: BTCValidator - }, { - name: 'Ripple', - symbol: 'xrp', - validator: XRPValidator, - }, { - name: 'Dash', - symbol: 'dash', - addressTypes: { prod: ['4c', '10'], testnet: ['8c', '13'] }, - validator: BTCValidator - }, { - name: 'Neo', - symbol: 'neo', - addressTypes: { prod: ['17'], testnet: [] }, - validator: BTCValidator - }, { - name: 'NeoGas', - symbol: 'gas', - addressTypes: { prod: ['17'], testnet: [] }, - validator: BTCValidator - }, { - name: 'Qtum', - symbol: 'qtum', - addressTypes: { prod: ['3a', '32'], testnet: ['78', '6e'] }, - validator: BTCValidator - }, { - name: 'Waves', - symbol: 'waves', - addressTypes: { prod: ['0157'], testnet: ['0154'] }, - expectedLength: 26, - hashFunction: 'blake256keccak256', - regex: /^[a-zA-Z0-9]{35}$/, - validator: BTCValidator - }, { - name: 'Ethereum', - symbol: 'eth', - validator: ETHValidator, - }, { - name: 'EtherZero', - symbol: 'etz', - validator: ETHValidator, - }, { - name: 'EthereumClassic', - symbol: 'etc', - validator: ETHValidator, - }, { - name: 'Callisto', - symbol: 'clo', - validator: ETHValidator, - }, { - name: 'Bankex', - symbol: 'bkx', - validator: ETHValidator - }, { - name: 'Cardano', - symbol: 'ada', - validator: ADAValidator - }, { - name: 'Monero', - symbol: 'xmr', - addressTypes: { prod: ['18', '42'], testnet: ['53', '63'] }, - iAddressTypes: { prod: ['19'], testnet: ['54'] }, - validator: XMRValidator - }, { - name: 'Aragon', - symbol: 'ant', - validator: ETHValidator - }, { - name: 'Basic Attention Token', - symbol: 'bat', - validator: ETHValidator - }, { - name: 'Bancor', - symbol: 'bnt', - validator: ETHValidator - }, { - name: 'Civic', - symbol: 'cvc', - validator: ETHValidator - }, { - name: 'District0x', - symbol: 'dnt', - validator: ETHValidator - }, { - name: 'Gnosis', - symbol: 'gno', - validator: ETHValidator - }, { - name: 'Golem', - symbol: 'gnt', - validator: ETHValidator - }, { - name: 'Matchpool', - symbol: 'gup', - validator: ETHValidator - }, { - name: 'Melon', - symbol: 'mln', - validator: ETHValidator - }, { - name: 'Numeraire', - symbol: 'nmr', - validator: ETHValidator - }, { - name: 'OmiseGO', - symbol: 'omg', - validator: ETHValidator - }, { - name: 'TenX', - symbol: 'pay', - validator: ETHValidator - }, { - name: 'Ripio Credit Network', - symbol: 'rcn', - validator: ETHValidator - }, { - name: 'Augur', - symbol: 'rep', - validator: ETHValidator - }, { - name: 'iExec RLC', - symbol: 'rlc', - validator: ETHValidator - }, { - name: 'Salt', - symbol: 'salt', - validator: ETHValidator - }, { - name: 'Status', - symbol: 'snt', - validator: ETHValidator - }, { - name: 'Storj', - symbol: 'storj', - validator: ETHValidator - }, { - name: 'Swarm City', - symbol: 'swt', - validator: ETHValidator - }, { - name: 'TrueUSD', - symbol: 'tusd', - validator: ETHValidator - }, { - name: 'Wings', - symbol: 'wings', - validator: ETHValidator - }, { - name: '0x', - symbol: 'zrx', - validator: ETHValidator - }, { - name: 'Expanse', - symbol: 'exp', - validator: ETHValidator - }, { - name: 'Viberate', - symbol: 'vib', - validator: ETHValidator - }, { - name: 'Odyssey', - symbol: 'ocn', - validator: ETHValidator - }, { - name: 'Polymath', - symbol: 'poly', - validator: ETHValidator - }, { - name: 'Storm', - symbol: 'storm', - validator: ETHValidator - }, { - name: 'Nano', - symbol: 'nano', - validator: NANOValidator, - }, { - name: 'RaiBlocks', - symbol: 'xrb', - validator: NANOValidator, - }, { - name: 'Siacoin', - symbol: 'sc', - validator: SCValidator - }, { - name: 'HyperSpace', - symbol: 'xsc', - validator: SCValidator - }, { - name: 'loki', - symbol: 'loki', - addressTypes: { prod: ['114', '115', '116'], testnet: [] }, - iAddressTypes: { prod: ['115'], testnet: [] }, - validator: XMRValidator - }, { - name: 'LBRY Credits', - symbol: 'lbc', - addressTypes: { prod: ['55'], testnet: [] }, - validator: BTCValidator - }, { +var CURRENCIES = [{ + name: 'Bitcoin', + symbol: 'btc', + addressTypes: { prod: ['00', '05'], testnet: ['6f', 'c4', '3c', '26'] }, + validator: BTCValidator +}, { + name: 'BitcoinCash', + symbol: 'bch', + regexp: '^[qQpP]{1}[0-9a-zA-Z]{41}$', + addressTypes: { prod: ['00', '05'], testnet: ['6f', 'c4'] }, + validator: BCHValidator +}, { + name: 'Bitcoin SV', + symbol: 'bsv', + regexp: '^[qQ]{1}[0-9a-zA-Z]{41}$', + addressTypes: { prod: ['00', '05'], testnet: ['6f', 'c4'] }, + validator: BCHValidator +}, { + name: 'LiteCoin', + symbol: 'ltc', + addressTypes: { prod: ['30', '05', '32'], testnet: ['6f', 'c4', '3a'] }, + validator: BTCValidator +}, { + name: 'PeerCoin', + symbol: 'ppc', + addressTypes: { prod: ['37', '75'], testnet: ['6f', 'c4'] }, + validator: BTCValidator +}, { + name: 'DogeCoin', + symbol: 'doge', + addressTypes: { prod: ['1e', '16'], testnet: ['71', 'c4'] }, + validator: BTCValidator +}, { + name: 'BeaverCoin', + symbol: 'bvc', + addressTypes: { prod: ['19', '05'], testnet: ['6f', 'c4'] }, + validator: BTCValidator, +}, { + name: 'FreiCoin', + symbol: 'frc', + addressTypes: { prod: ['00', '05'], testnet: ['6f', 'c4'] }, + validator: BTCValidator +}, { + name: 'ProtoShares', + symbol: 'pts', + addressTypes: { prod: ['38', '05'], testnet: ['6f', 'c4'] }, + validator: BTCValidator +}, { + name: 'MegaCoin', + symbol: 'mec', + addressTypes: { prod: ['32', '05'], testnet: ['6f', 'c4'] }, + validator: BTCValidator +}, { + name: 'PrimeCoin', + symbol: 'xpm', + addressTypes: { prod: ['17', '53'], testnet: ['6f', 'c4'] }, + validator: BTCValidator +}, { + name: 'AuroraCoin', + symbol: 'aur', + addressTypes: { prod: ['17', '05'], testnet: ['6f', 'c4'] }, + validator: BTCValidator +}, { + name: 'NameCoin', + symbol: 'nmc', + addressTypes: { prod: ['34'], testnet: [] }, + validator: BTCValidator +}, { + name: 'BioCoin', + symbol: 'bio', + addressTypes: { prod: ['19', '14'], testnet: ['6f', 'c4'] }, + validator: BTCValidator +}, { + name: 'GarliCoin', + symbol: 'grlc', + addressTypes: { prod: ['26', '05'], testnet: ['6f', 'c4'] }, + validator: BTCValidator +}, { + name: 'VertCoin', + symbol: 'vtc', + addressTypes: { prod: ['0x', '47', '71', '05'], testnet: ['6f', 'c4'] }, + validator: BTCValidator + +}, { + name: 'BitcoinGold', + symbol: 'btg', + addressTypes: { prod: ['26', '17'], testnet: ['6f', 'c4'] }, + validator: BTCValidator +}, { + name: 'Komodo', + symbol: 'kmd', + addressTypes: { prod: ['3c', '55'], testnet: ['0', '5'] }, + validator: BTCValidator +}, { + name: 'BitcoinZ', + symbol: 'btcz', + expectedLength: 26, + addressTypes: { prod: ['1cb8', '1cbd'], testnet: ['1d25', '1cba'] }, + validator: BTCValidator +}, { + name: 'BitcoinPrivate', + symbol: 'btcp', + expectedLength: 26, + addressTypes: { prod: ['1325', '13af'], testnet: ['1957', '19e0'] }, + validator: BTCValidator +}, { + name: 'Hush', + symbol: 'hush', + expectedLength: 26, + addressTypes: { prod: ['1cb8', '1cbd'], testnet: ['1d25', '1cba'] }, + validator: BTCValidator +}, { + name: 'SnowGem', + symbol: 'sng', + expectedLength: 26, + addressTypes: { prod: ['1c28', '1c2d'], testnet: ['1d25', '1cba'] }, + validator: BTCValidator +}, { + name: 'ZCash', + symbol: 'zec', + expectedLength: 26, + addressTypes: { prod: ['1cb8', '1cbd'], testnet: ['1d25', '1cba'] }, + validator: BTCValidator +}, { + name: 'ZClassic', + symbol: 'zcl', + expectedLength: 26, + addressTypes: { prod: ['1cb8', '1cbd'], testnet: ['1d25', '1cba'] }, + validator: BTCValidator +}, { + name: 'ZenCash', + symbol: 'zen', + expectedLength: 26, + addressTypes: { prod: ['2089', '2096'], testnet: ['2092', '2098'] }, + validator: BTCValidator +}, { + name: 'VoteCoin', + symbol: 'vot', + expectedLength: 26, + addressTypes: { prod: ['1cb8', '1cbd'], testnet: ['1d25', '1cba'] }, + validator: BTCValidator +}, { + name: 'Decred', + symbol: 'dcr', + addressTypes: { prod: ['073f', '071a'], testnet: ['0f21', '0efc'] }, + hashFunction: 'blake256', + expectedLength: 26, + validator: BTCValidator +}, { + name: 'GameCredits', + symbol: 'game', + addressTypes: { prod: ['26', '05'], testnet: [] }, + validator: BTCValidator +}, { + name: 'PIVX', + symbol: 'pivx', + addressTypes: { prod: ['1e', '0d'], testnet: [] }, + validator: BTCValidator +}, { + name: 'SolarCoin', + symbol: 'slr', + addressTypes: { prod: ['12', '05'], testnet: [] }, + validator: BTCValidator +}, { + name: 'MonaCoin', + symbol: 'mona', + addressTypes: { prod: ['32', '37'], testnet: [] }, + validator: BTCValidator +}, { + name: 'DigiByte', + symbol: 'dgb', + addressTypes: { prod: ['1e'], testnet: [] }, + validator: BTCValidator +}, { + name: 'Tether', + symbol: 'usdt', + addressTypes: { prod: ['00', '05'], testnet: ['6f', 'c4'] }, + validator: BTCValidator +}, { + name: 'Ripple', + symbol: 'xrp', + validator: XRPValidator, +}, { + name: 'Dash', + symbol: 'dash', + addressTypes: { prod: ['4c', '10'], testnet: ['8c', '13'] }, + validator: BTCValidator +}, { + name: 'Neo', + symbol: 'neo', + addressTypes: { prod: ['17'], testnet: [] }, + validator: BTCValidator +}, { + name: 'NeoGas', + symbol: 'gas', + addressTypes: { prod: ['17'], testnet: [] }, + validator: BTCValidator +}, { + name: 'Qtum', + symbol: 'qtum', + addressTypes: { prod: ['3a', '32'], testnet: ['78', '6e'] }, + validator: BTCValidator +}, { + name: 'Waves', + symbol: 'waves', + addressTypes: { prod: ['0157'], testnet: ['0154'] }, + expectedLength: 26, + hashFunction: 'blake256keccak256', + regex: /^[a-zA-Z0-9]{35}$/, + validator: BTCValidator +}, { + name: 'Ethereum', + symbol: 'eth', + validator: ETHValidator, +}, { + name: 'EtherZero', + symbol: 'etz', + validator: ETHValidator, +}, { + name: 'EthereumClassic', + symbol: 'etc', + validator: ETHValidator, +}, { + name: 'Callisto', + symbol: 'clo', + validator: ETHValidator, +}, { + name: 'Bankex', + symbol: 'bkx', + validator: ETHValidator +}, { + name: 'Cardano', + symbol: 'ada', + validator: ADAValidator +}, { + name: 'Monero', + symbol: 'xmr', + addressTypes: { prod: ['18', '42'], testnet: ['53', '63'], stagenet: ['24'] }, + iAddressTypes: { prod: ['19'], testnet: ['54'], stagenet: ['25'] }, + validator: XMRValidator +}, { + name: 'Aragon', + symbol: 'ant', + validator: ETHValidator +}, { + name: 'Basic Attention Token', + symbol: 'bat', + validator: ETHValidator +}, { + name: 'Bancor', + symbol: 'bnt', + validator: ETHValidator +}, { + name: 'Civic', + symbol: 'cvc', + validator: ETHValidator +}, { + name: 'District0x', + symbol: 'dnt', + validator: ETHValidator +}, { + name: 'Gnosis', + symbol: 'gno', + validator: ETHValidator +}, { + name: 'Golem', + symbol: 'gnt', + validator: ETHValidator +}, { + name: 'Matchpool', + symbol: 'gup', + validator: ETHValidator +}, { + name: 'Melon', + symbol: 'mln', + validator: ETHValidator +}, { + name: 'Numeraire', + symbol: 'nmr', + validator: ETHValidator +}, { + name: 'OmiseGO', + symbol: 'omg', + validator: ETHValidator +}, { + name: 'TenX', + symbol: 'pay', + validator: ETHValidator +}, { + name: 'Ripio Credit Network', + symbol: 'rcn', + validator: ETHValidator +}, { + name: 'Augur', + symbol: 'rep', + validator: ETHValidator +}, { + name: 'iExec RLC', + symbol: 'rlc', + validator: ETHValidator +}, { + name: 'Salt', + symbol: 'salt', + validator: ETHValidator +}, { + name: 'Status', + symbol: 'snt', + validator: ETHValidator +}, { + name: 'Storj', + symbol: 'storj', + validator: ETHValidator +}, { + name: 'Swarm City', + symbol: 'swt', + validator: ETHValidator +}, { + name: 'TrueUSD', + symbol: 'tusd', + validator: ETHValidator +}, { + name: 'Wings', + symbol: 'wings', + validator: ETHValidator +}, { + name: '0x', + symbol: 'zrx', + validator: ETHValidator +}, { + name: 'Expanse', + symbol: 'exp', + validator: ETHValidator +}, { + name: 'Viberate', + symbol: 'vib', + validator: ETHValidator +}, { + name: 'Odyssey', + symbol: 'ocn', + validator: ETHValidator +}, { + name: 'Polymath', + symbol: 'poly', + validator: ETHValidator +}, { + name: 'Storm', + symbol: 'storm', + validator: ETHValidator +}, { + name: 'Nano', + symbol: 'nano', + validator: NANOValidator, +}, { + name: 'RaiBlocks', + symbol: 'xrb', + validator: NANOValidator, +}, { + name: 'Siacoin', + symbol: 'sc', + validator: SCValidator +}, { + name: 'HyperSpace', + symbol: 'xsc', + validator: SCValidator +}, { + name: 'loki', + symbol: 'loki', + addressTypes: { prod: ['114', '115', '116'], testnet: [] }, + iAddressTypes: { prod: ['115'], testnet: [] }, + validator: XMRValidator +}, { + name: 'LBRY Credits', + symbol: 'lbc', + addressTypes: { prod: ['55'], testnet: [] }, + validator: BTCValidator +}, { name: 'Tron', - symbol: 'trx', - addressTypes: { prod: [0x41], testnet: [0xa0] }, - validator: TRXValidator - }, { + symbol: 'trx', + addressTypes: { prod: [0x41], testnet: [0xa0] }, + validator: TRXValidator +}, { name: 'Nem', - symbol: 'xem', - validator: NEMValidator - }, { + symbol: 'xem', + validator: NEMValidator +}, { name: 'Lisk', - symbol: 'lsk', - validator: LSKValidator - }, { + symbol: 'lsk', + validator: LSKValidator +}, { name: 'Stellar', - symbol: 'xlm', - validator: XLMValidator, + symbol: 'xlm', + validator: XLMValidator, }, { name: 'BTU Protocol', symbol: 'btu', @@ -11379,8 +11378,10 @@ function validateNetwork(decoded, currency, networkType, addressType) { return network.prod.indexOf(at) >= 0 case 'testnet': return network.testnet.indexOf(at) >= 0 + case 'stagenet': + return network.stagenet.indexOf(at) >= 0 case 'both': - return network.prod.indexOf(at) >= 0 || network.testnet.indexOf(at) >= 0 + return network.prod.indexOf(at) >= 0 || network.testnet.indexOf(at) >= 0 || network.stagenet.indexOf(at) >= 0 default: return false } diff --git a/dist/wallet-address-validator.min.js b/dist/wallet-address-validator.min.js index 0a233a7a..359b32e8 100644 --- a/dist/wallet-address-validator.min.js +++ b/dist/wallet-address-validator.min.js @@ -1 +1 @@ -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).WAValidator=t()}}(function(){return function(){return function t(e,r,n){function i(a,s){if(!r[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var c=r[a]={exports:{}};e[a][0].call(c.exports,function(t){return i(e[a][1][t]||t)},c,c.exports,t,e,r,n)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;a=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r>>0,c=new Uint8Array(a);t[r];){var l=e[t.charCodeAt(r)];if(255===l)return;for(var h=0,d=a-1;(0!==l||h>>0,c[d]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");o=h,r++}if(" "!==t[r]){for(var p=a-o;p!==a&&0===c[p];)p++;var v=n.allocUnsafe(i+(a-p));v.fill(0,0,i);for(var y=i;p!==a;)v[y++]=c[p++];return v}}}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=n.from(e)),!n.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var r=0,i=0,o=0,a=e.length;o!==a&&0===e[o];)o++,r++;for(var f=(a-o)*c+1>>>0,l=new Uint8Array(f);o!==a;){for(var h=e[o],d=0,p=f-1;(0!==h||d>>0,l[p]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");i=d,o++}for(var v=f-i;v!==f&&0===l[v];)v++;for(var y=u.repeat(r);v0?n-4:n,l=0;l>16&255,s[u++]=e>>8&255,s[u++]=255&e;2===a&&(e=i[t.charCodeAt(l)]<<2|i[t.charCodeAt(l+1)]>>4,s[u++]=255&e);1===a&&(e=i[t.charCodeAt(l)]<<10|i[t.charCodeAt(l+1)]<<4|i[t.charCodeAt(l+2)]>>2,s[u++]=e>>8&255,s[u++]=255&e);return s},r.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],a=0,s=r-i;as?s:a+16383));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=a.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function c(t,e,r){for(var i,o,a=[],s=e;s>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],3:[function(t,e,r){(function(t){var r,n=20,i=4,o=-7,a=21,s=-1e9,u=1e9,f=!0,c=parseInt,l=g.prototype,h="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",d=0,p=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,v=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},y=g(1);function g(t,e){var o,a,c,l,y,w,_=this;if(!(_ instanceof g))return new g(t,e);if(t instanceof g){if(d=0,e===o)return _.s=t.s,_.e=t.e,void(_.c=(t=t.c)?t.slice():t);t+=""}if("string"!=typeof t&&(t=(c="number"==typeof t||"[object Number]"==Object.prototype.toString.call(t))&&0===t&&1/t<0?"-0":t+""),w=t,e===o&&p.test(t))_.s="-"==t.charAt(0)?(t=t.slice(1),-1):1;else{if(10==e)return E(t,n,i);if(t=v.call(t).replace(/^\+(?!-)/,""),_.s="-"==t.charAt(0)?(t=t.replace(/^-(?!-)/,""),-1):1,null!=e?e!=(0|e)&&f||(r=!(e>=2&&e<65))?(b(e,2),y=p.test(t)):(l="["+h.slice(0,e|=0)+"]+",t=t.replace(/\.$/,"").replace(/^\./,"0."),(y=new RegExp("^"+l+"(?:\\."+l+")?$",e<37?"i":"").test(t))?(c&&(t.replace(/^0\.0*|\./,"").length>15&&b(w,0),c=!c),t=m(t,10,e,_.s)):"Infinity"!=t&&"NaN"!=t&&(b(w,1,e),t="NaN")):y=p.test(t),!y)return _.c=_.e=null,"Infinity"!=t&&("NaN"!=t&&b(w,3),_.s=null),void(d=0)}for((o=t.indexOf("."))>-1&&(t=t.replace(".","")),(a=t.search(/e/i))>0?(o<0&&(o=a),o+=+t.slice(a+1),t=t.substring(0,a)):o<0&&(o=t.length),a=0;"0"==t.charAt(a);a++);if(e=t.length,c&&e>15&&t.slice(a).length>15&&b(w,0),d=0,(o-=a+1)>u)_.c=_.e=null;else if(a==e||oe-1&&(null==u[i+1]&&(u[i+1]=0),u[i+1]+=u[i]/e^0,u[i]%=e)}return u.reverse()}function l(t){for(var e=0,r=t.length,n="";e-1)if(i=t.length-i-1,o=c(new g(r).pow(i).toF(),10),a=c((s=t.split("."))[1]),s=c(s[0]),u=(f=w(a,o,a.length-o.length,n,e,1&s[s.length-1])).c,i=f.e){for(;++i;u.unshift(0));t=l(s)+"."+l(u)}else u[0]?s[i=s.length-1]w?1:-1;else for(d=-1,h=0;++dm[d]?1:-1;break}if(!(h<0))break;for(c=w==f?e:p;w;){if(m[--w]B&&A(_,n,o,a,null!=m[0]),_.e>u?_.c=_.e=null:_.e++e&&A(t,n,10),n=0==i[0]?n+1:r?e:t.e+n+1;i.length1?(i.splice(1,0,"."),i.join("")):i[0])+(n<0?"e":"e+")+n:t.toS()}function A(t,e,r,n,o){var a=t.c,s=t.s<0,u=r/2,f=t.e+e+1,c=a[f],l=o||f<0||null!=a[f+1];if(o=i<4?(null!=c||l)&&(0==i||2==i&&!s||3==i&&s):c>u||c==u&&(4==i||l||6==i&&(1&a[f-1]||!e&&n)||7==i&&!s||8==i&&s),f<1||!a[0])return a.length=0,a.push(0),o?(a[0]=1,t.e=-e):t.e=0,t;if(a.length=f--,o)for(--r;++a[f]>r;)a[f]=0,f--||(++t.e,a.unshift(1));for(f=a.length;!a[--f];a.pop());return t}function E(t,e,r){var n=i;return i=r,(t=new g(t)).c&&A(t,e,10),i=n,t}g.ROUND_UP=0,g.ROUND_DOWN=1,g.ROUND_CEIL=2,g.ROUND_FLOOR=3,g.ROUND_HALF_UP=4,g.ROUND_HALF_DOWN=5,g.ROUND_HALF_EVEN=6,g.ROUND_HALF_CEIL=7,g.ROUND_HALF_FLOOR=8,g.fromBuffer=function(t,e){e||(e={});var r={1:"big","-1":"little"}[e.endian]||e.endian||"big",n="auto"===e.size?Math.ceil(t.length):e.size||1;if(t.length%n!=0)throw new RangeError("Buffer length ("+t.length+") must be a multiple of size ("+n+")");for(var i=[],o=0;on)||c(t)!=t&&0!==t)},m=v&&"object"==typeof v?function(){if(v.hasOwnProperty(e))return null!=(t=v[e])}:function(){if(p.length>l)return null!=(t=p[l++])};return m(e="DECIMAL_PLACES")&&(g(t,0,1e9)?n=0|t:b(t,e,y)),h[e]=n,m(e="ROUNDING_MODE")&&(g(t,0,8)?i=0|t:b(t,e,y)),h[e]=i,m(e="EXPONENTIAL_AT")&&(g(t,-1e9,1e9)?o=-(a=~~(t<0?-t:+t)):!r&&t&&g(t[0],-1e9,0)&&g(t[1],0,1e9)?(o=~~t[0],a=~~t[1]):b(t,e,y,1)),h[e]=[o,a],m(e="RANGE")&&(g(t,-1e9,1e9)&&~~t?s=-(u=~~(t<0?-t:+t)):!r&&t&&g(t[0],-1e9,-1)&&g(t[1],1,1e9)?(s=~~t[0],u=~~t[1]):b(t,e,y,1,1)),h[e]=[s,u],m(e="ERRORS")&&(t===!!t||1===t||0===t?(r=d=0,c=(f=!!t)?parseInt:parseFloat):b(t,e,y,0,0,1)),h[e]=f,h},l.abs=l.absoluteValue=function(){var t=new g(this);return t.s<0&&(t.s=1),t},l.bitLength=function(){return this.toString(2).length},l.ceil=function(){return E(this,0,2)},l.comparedTo=l.cmp=function(t,e){var r,n=this,i=n.c,o=(d=-d,t=new g(t,e)).c,a=n.s,s=t.s,u=n.e,f=t.e;if(!a||!s)return null;if(r=i&&!i[0],e=o&&!o[0],r||e)return r?e?0:-s:a;if(a!=s)return a;if(r=a<0,e=u==f,!i||!o)return e?0:!i^r?1:-1;if(!e)return u>f^r?1:-1;for(a=-1,s=(u=i.length)<(f=o.length)?u:f;++ao[a]^r?1:-1;return u==f?0:u>f^r?1:-1},l.dividedBy=l.div=function(t,e){var r=this.c,n=this.e,i=this.s,o=(d=2,t=new g(t,e)).c,a=t.e,s=t.s,u=i==s?1:-1;return(n||r&&r[0])&&(a||o&&o[0])?w(r,o,n-a,u,10):new g(i&&s&&(r?!o||r[0]!=o[0]:o)?r&&0==r[0]||!o?0*u:u/0:NaN)},l.equals=l.eq=function(t,e){return d=3,0===this.cmp(t,e)},l.floor=function(){return E(this,0,3)},l.greaterThan=l.gt=function(t,e){return d=4,this.cmp(t,e)>0},l.greaterThanOrEqualTo=l.gte=l.gt=function(t,e){return d=5,1==(e=this.cmp(t,e))||0===e},l.isFinite=l.isF=function(){return!!this.c},l.isNaN=function(){return!this.s},l.isNegative=l.isNeg=function(){return this.s<0},l.isZero=l.isZ=function(){return!!this.c&&0==this.c[0]},l.lessThan=l.lt=function(t,e){return d=6,this.cmp(t,e)<0},l.lessThanOrEqualTo=l.lte=l.le=function(t,e){return d=7,-1==(e=this.cmp(t,e))||0===e},l.minus=l.sub=function(t,e){var r,n,o,a,u=this,f=u.s;if(e=(d=8,t=new g(t,e)).s,!f||!e)return new g(NaN);if(f!=e)return t.s=-e,u.plus(t);var c=u.c,l=u.e,h=t.c,p=t.e;if(!l||!p){if(!c||!h)return c?(t.s=-e,t):new g(h?u:NaN);if(!c[0]||!h[0])return h[0]?(t.s=-e,t):new g(c[0]?u:3==i?-0:0)}if(c=c.slice(),f=l-p){for((r=(a=f<0)?(f=-f,c):(p=l,h)).reverse(),e=f;e--;r.push(0));r.reverse()}else for(o=((a=c.length0)for(;e--;c[o++]=0);for(e=h.length;e>f;){if(c[--e]0?(s=o,f):(i=-i,a)).reverse();i--;r.push(0));r.reverse()}for(a.length-f.length<0&&(r=f,f=a,a=r),i=f.length,e=0;i;e=(a[--i]=a[i]+f[i]+e)/10^0,a[i]%=10);for(e&&(a.unshift(e),++s>u&&(a=s=null)),i=a.length;0==a[--i];a.pop());return t.c=a,t.e=s,t},l.toPower=l.pow=function(t){var e=0*t==0?0|t:t,n=new g(this),i=new g(y);if(((r=t<-1e6||t>1e6)&&(e=1*t/0)||c(t)!=t&&0!==t&&!(e=NaN))&&!b(t,"exponent","pow")||!e)return new g(Math.pow(n.toS(),e));for(e=e<0?-e:e;1&e&&(i=i.times(n)),e>>=1;)n=n.times(n);return t<0?y.div(i):i},l.powm=function(t,e){return this.pow(t).mod(e)},l.round=function(t,e){return E(this,t=null==t||((r=t<0||t>1e9)||c(t)!=t)&&!b(t,"decimal places","round")?0:0|t,e=null==e||((r=e<0||e>8)||c(e)!=e&&0!==e)&&!b(e,"mode","round")?i:0|e)},l.squareRoot=l.sqrt=function(){var t,e,r,o,a=this,s=a.c,u=a.s,f=a.e,c=n,l=i,h=new g("0.5");if(1!==u||!s||!s[0])return new g(!u||u<0&&(!s||s[0])?NaN:s?a:1/0);for(u=Math.sqrt(a.toS()),i=1,0==u||u==1/0?((t=s.join("")).length+f&1||(t+="0"),(e=new g(Math.sqrt(t)+"")).c||(e.c=[1]),e.e=((f+1)/2|0)-(f<0||1&f)):e=new g(t=u.toString()),(u=(r=e.e)+(n+=4))<3&&(u=0),f=u;;)if(o=e,e=h.times(o.plus(a.div(o))),o.c.slice(0,u).join("")===e.c.slice(0,u).join("")){if(9!=(s=e.c)[u-=t&&e.ef-2&&(s.length=f-2),e.times(e).eq(a)))){for(;s.length-1;a--){for(e=0,f=c+a;f>a;e=r[f]+o[a]*i[f-a-1]+e,r[f--]=e%10|0,e=e/10|0);e&&(r[f]=(r[f]+e)%10)}for(e&&++t.e,!r[0]&&r.shift(),f=r.length;!r[--f];r.pop());return t.c=t.e>u?t.e=null:t.e0&&c.copy(i,4+(128&c[0]?1:0)),128&c[0]&&(i[4]=0),i[0]=n&255<<24,i[1]=n&255<<16,i[2]=65280&n,i[3]=255&n;var o=this.lt(0);if(o)for(var a=4;a0}).forEach(function(t,e){for(var r=0;r1e9)||c(t)!=t&&0!==t)&&!b(t,"decimal places","toE"))&&this.c?this.c.length-1:0|t,1)},l.toFixed=l.toF=function(t){var e,n,i,s=this;return null==t||((r=t<0||t>1e9)||c(t)!=t&&0!==t)&&!b(t,"decimal places","toF")||(i=s.e+(0|t)),e=o,t=a,o=-(a=1/0),i==n?n=s.toS():(n=_(s,i),s.s<0&&s.c&&(s.c[0]?n.indexOf("-")<0&&(n="-"+n):n=n.replace(/^-/,""))),o=e,a=t,n},l.toFraction=l.toFr=function(t){var e,o,a,s,c,l,h,p=s=new g(y),v=a=new g("0"),m=this,w=m.c,_=u,A=n,E=i,x=new g(y);if(!w)return m.toS();for(h=x.e=w.length-m.e-1,(null==t||(!(d=12,l=new g(t)).s||(r=l.cmp(p)<0||!l.c)||f&&l.e0)&&(t=h>0?x:p),u=1/0,l=new g(w.join("")),n=0,i=1;e=l.div(x),1!=(c=s.plus(e.times(v))).cmp(t);)s=v,v=c,p=a.plus(e.times(c=p)),a=c,x=l.minus(e.times(c=x)),l=c;return c=t.minus(s).div(v),a=a.plus(c.times(p)),s=s.plus(c.times(v)),a.s=p.s=m.s,n=2*h,i=E,o=p.div(v).minus(m).abs().cmp(a.div(s).minus(m).abs())<1?[p.toS(),v.toS()]:[a.toS(),s.toS()],u=_,n=A,o},l.toPrecision=l.toP=function(t){return null==t||((r=t<1||t>1e9)||c(t)!=t)&&!b(t,"precision","toP")?this.toS():_(this,0|--t,2)},l.toString=l.toS=function(t){var e,n,i,s=this,u=s.e;if(null===u)n=s.s?"Infinity":"NaN";else{if(t===e&&(u<=o||u>=a))return _(s,s.c.length-1,1);if(n=s.c.join(""),u<0){for(;++u;n="0"+n);n="0."+n}else if(i=n.length,u>0)if(++u>i)for(u-=i;u--;n+="0");else u1)n=e+"."+n.slice(1);else if("0"==e)return e;if(null!=t)if((r=!(t>=2&&t<65))||t!=(0|t)&&f)b(t,"base","toS");else if("0"==(n=m(n,0|t,10,s.s)))return n}return s.s<0?"-"+n:n},l.valueOf=function(){return this.toS()},e.exports=g}).call(this,t("buffer").Buffer)},{buffer:4}],4:[function(t,e,r){"use strict";var n=t("base64-js"),i=t("ieee754");r.Buffer=s,r.SlowBuffer=function(t){+t!=t&&(t=0);return s.alloc(+t)},r.INSPECT_MAX_BYTES=50;var o=2147483647;function a(t){if(t>o)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return e.__proto__=s.prototype,e}function s(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return c(t)}return u(t,e,r)}function u(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|d(t,e),n=a(r),i=n.write(t,e);i!==r&&(n=n.slice(0,i));return n}(t,e);if(ArrayBuffer.isView(t))return l(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(P(t,ArrayBuffer)||t&&P(t.buffer,ArrayBuffer))return function(t,e,r){if(e<0||t.byteLength=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|t}function d(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||P(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return L(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(t).length;default:if(i)return n?-1:L(t).length;e=(""+e).toLowerCase(),i=!0}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function v(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),H(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:y(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):y(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function y(t,e,r,n,i){var o,a=1,s=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,r/=2}function f(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var c=-1;for(o=r;os&&(r=s-u),o=r;o>=0;o--){for(var l=!0,h=0;hi&&(n=i):n=i;var o=e.length;n>o/2&&(n=o/2);for(var a=0;a>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function E(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function x(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:f>223?3:f>191?2:1;if(i+l<=r)switch(l){case 1:f<128&&(c=f);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&f)<<6|63&o)>127&&(c=u);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(u=(15&f)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&f)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,l=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=l}return function(t){var e=t.length;if(e<=B)return String.fromCharCode.apply(String,t);var r="",n=0;for(;nthis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return C(this,e,r);case"utf8":case"utf-8":return x(this,e,r);case"ascii":return k(this,e,r);case"latin1":case"binary":return U(this,e,r);case"base64":return E(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===s.compare(this,t)},s.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),""},s.prototype.compare=function(t,e,r,n,i){if(P(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;for(var o=i-n,a=r-e,u=Math.min(o,a),f=this.slice(n,i),c=t.slice(e,r),l=0;l>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return g(this,t,e,r);case"utf8":case"utf-8":return b(this,t,e,r);case"ascii":return m(this,t,e,r);case"latin1":case"binary":return w(this,t,e,r);case"base64":return _(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var B=4096;function k(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;in)&&(r=n);for(var i="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function O(t,e,r,n,i,o){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function R(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function I(t,e,r,n,o){return e=+e,r>>>=0,o||R(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function j(t,e,r,n,o){return e=+e,r>>>=0,o||R(t,0,r,8),i.write(t,e,r,n,52,8),r+8}s.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||T(t,e,this.length);for(var n=this[t],i=1,o=0;++o>>=0,e>>>=0,r||T(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},s.prototype.readUInt8=function(t,e){return t>>>=0,e||T(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||T(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||T(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||T(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUInt32BE=function(t,e){return t>>>=0,e||T(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||T(t,e,this.length);for(var n=this[t],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||T(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},s.prototype.readInt8=function(t,e){return t>>>=0,e||T(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||T(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(t,e){t>>>=0,e||T(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(t,e){return t>>>=0,e||T(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return t>>>=0,e||T(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readFloatLE=function(t,e){return t>>>=0,e||T(t,4,this.length),i.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||T(t,4,this.length),i.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||T(t,8,this.length),i.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||T(t,8,this.length),i.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o>>=0,r>>>=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},s.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,1,255,0),this[e]=255&t,e+1},s.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);O(this,t,e,r,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o>0)-s&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);O(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},s.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeFloatLE=function(t,e,r){return I(this,t,e,!0,r)},s.prototype.writeFloatBE=function(t,e,r){return I(this,t,e,!1,r)},s.prototype.writeDoubleLE=function(t,e,r){return j(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return j(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return i},s.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var i=t.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(t=i)}}else"number"==typeof t&&(t&=255);if(e<0||this.length>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function F(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(M,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function z(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function P(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function H(t){return t!=t}},{"base64-js":2,ieee754:31}],5:[function(t,e,r){!function(t,r){"use strict";var n=Math.pow(2,-24),i=Math.pow(2,32),o=Math.pow(2,53);var a={encode:function(t){var e,n=new ArrayBuffer(256),a=new DataView(n),s=0;function u(t){for(var r=n.byteLength,i=s+t;r>2,f=0;f>6),i.push(128|63&a)):a<55296?(i.push(224|a>>12),i.push(128|a>>6&63),i.push(128|63&a)):(a=(1023&a)<<10,a|=1023&e.charCodeAt(++n),a+=65536,i.push(240|a>>18),i.push(128|a>>12&63),i.push(128|a>>6&63),i.push(128|63&a))}return h(3,i.length),l(i);default:var d;if(Array.isArray(e))for(h(4,d=e.length),n=0;n>5!==t)throw"Invalid indefinite length element";return r}function y(t,e){for(var r=0;r>10),t.push(56320|1023&n))}}"function"!=typeof e&&(e=function(t){return t}),"function"!=typeof o&&(o=function(){return r});var g=function t(){var i,h,g=c(),b=g>>5,m=31&g;if(7===b)switch(m){case 25:return function(){var t=new ArrayBuffer(4),e=new DataView(t),r=l(),i=32768&r,o=31744&r,a=1023&r;if(31744===o)o=261120;else if(0!==o)o+=114688;else if(0!==a)return a*n;return e.setUint32(0,i<<16|o<<13|a<<13),e.getFloat32(0)}();case 26:return u(a.getFloat32(s),4);case 27:return u(a.getFloat64(s),8)}if((h=p(m))<0&&(b<2||6=0;)_+=h,w.push(f(h));var A=new Uint8Array(_),E=0;for(i=0;i=0;)y(x,h);else y(x,h);return String.fromCharCode.apply(null,x);case 4:var B;if(h<0)for(B=[];!d();)B.push(t());else for(B=new Array(h),i=0;i>8)}return r});r.default=u},{"./create_buffer":28,"./define_crc":29,buffer:4}],19:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),i=a(t("./create_buffer")),o=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,o.default)("ccitt",function(t,e){n.Buffer.isBuffer(t)||(t=(0,i.default)(t));for(var r=void 0!==e?~~e:65535,o=0;o>8^a)]^r<<8)}return r});r.default=u},{"./create_buffer":28,"./define_crc":29,buffer:4}],20:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),i=a(t("./create_buffer")),o=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,4489,8978,12955,17956,22445,25910,29887,35912,40385,44890,48851,51820,56293,59774,63735,4225,264,13203,8730,22181,18220,30135,25662,40137,36160,49115,44626,56045,52068,63999,59510,8450,12427,528,5017,26406,30383,17460,21949,44362,48323,36440,40913,60270,64231,51324,55797,12675,8202,4753,792,30631,26158,21685,17724,48587,44098,40665,36688,64495,60006,55549,51572,16900,21389,24854,28831,1056,5545,10034,14011,52812,57285,60766,64727,34920,39393,43898,47859,21125,17164,29079,24606,5281,1320,14259,9786,57037,53060,64991,60502,39145,35168,48123,43634,25350,29327,16404,20893,9506,13483,1584,6073,61262,65223,52316,56789,43370,47331,35448,39921,29575,25102,20629,16668,13731,9258,5809,1848,65487,60998,56541,52564,47595,43106,39673,35696,33800,38273,42778,46739,49708,54181,57662,61623,2112,6601,11090,15067,20068,24557,28022,31999,38025,34048,47003,42514,53933,49956,61887,57398,6337,2376,15315,10842,24293,20332,32247,27774,42250,46211,34328,38801,58158,62119,49212,53685,10562,14539,2640,7129,28518,32495,19572,24061,46475,41986,38553,34576,62383,57894,53437,49460,14787,10314,6865,2904,32743,28270,23797,19836,50700,55173,58654,62615,32808,37281,41786,45747,19012,23501,26966,30943,3168,7657,12146,16123,54925,50948,62879,58390,37033,33056,46011,41522,23237,19276,31191,26718,7393,3432,16371,11898,59150,63111,50204,54677,41258,45219,33336,37809,27462,31439,18516,23005,11618,15595,3696,8185,63375,58886,54429,50452,45483,40994,37561,33584,31687,27214,22741,18780,15843,11370,7921,3960];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,o.default)("kermit",function(t,e){n.Buffer.isBuffer(t)||(t=(0,i.default)(t));for(var r=void 0!==e?~~e:0,o=0;o>8)}return r});r.default=u},{"./create_buffer":28,"./define_crc":29,buffer:4}],21:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),i=a(t("./create_buffer")),o=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,49345,49537,320,49921,960,640,49729,50689,1728,1920,51009,1280,50625,50305,1088,52225,3264,3456,52545,3840,53185,52865,3648,2560,51905,52097,2880,51457,2496,2176,51265,55297,6336,6528,55617,6912,56257,55937,6720,7680,57025,57217,8e3,56577,7616,7296,56385,5120,54465,54657,5440,55041,6080,5760,54849,53761,4800,4992,54081,4352,53697,53377,4160,61441,12480,12672,61761,13056,62401,62081,12864,13824,63169,63361,14144,62721,13760,13440,62529,15360,64705,64897,15680,65281,16320,16e3,65089,64001,15040,15232,64321,14592,63937,63617,14400,10240,59585,59777,10560,60161,11200,10880,59969,60929,11968,12160,61249,11520,60865,60545,11328,58369,9408,9600,58689,9984,59329,59009,9792,8704,58049,58241,9024,57601,8640,8320,57409,40961,24768,24960,41281,25344,41921,41601,25152,26112,42689,42881,26432,42241,26048,25728,42049,27648,44225,44417,27968,44801,28608,28288,44609,43521,27328,27520,43841,26880,43457,43137,26688,30720,47297,47489,31040,47873,31680,31360,47681,48641,32448,32640,48961,32e3,48577,48257,31808,46081,29888,30080,46401,30464,47041,46721,30272,29184,45761,45953,29504,45313,29120,28800,45121,20480,37057,37249,20800,37633,21440,21120,37441,38401,22208,22400,38721,21760,38337,38017,21568,39937,23744,23936,40257,24320,40897,40577,24128,23040,39617,39809,23360,39169,22976,22656,38977,34817,18624,18816,35137,19200,35777,35457,19008,19968,36545,36737,20288,36097,19904,19584,35905,17408,33985,34177,17728,34561,18368,18048,34369,33281,17088,17280,33601,16640,33217,32897,16448];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,o.default)("crc-16-modbus",function(t,e){n.Buffer.isBuffer(t)||(t=(0,i.default)(t));for(var r=void 0!==e?~~e:65535,o=0;o>8)}return r});r.default=u},{"./create_buffer":28,"./define_crc":29,buffer:4}],22:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),i=o(t("./create_buffer"));function o(t){return t&&t.__esModule?t:{default:t}}var a=(0,o(t("./define_crc")).default)("xmodem",function(t,e){n.Buffer.isBuffer(t)||(t=(0,i.default)(t));for(var r=void 0!==e?~~e:0,o=0;o>>8&255;a^=255&t[o],r=r<<8&65535,r^=a^=a>>>4,r^=a=a<<5&65535,r^=a=a<<7&65535}return r});r.default=a},{"./create_buffer":28,"./define_crc":29,buffer:4}],23:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),i=a(t("./create_buffer")),o=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,8801531,9098509,825846,9692897,1419802,1651692,10452759,10584377,2608578,2839604,11344079,3303384,11807523,12104405,4128302,12930697,4391538,5217156,13227903,5679208,13690003,14450021,5910942,6606768,14844747,15604413,6837830,16197969,7431594,8256604,16494759,840169,9084178,8783076,18463,10434312,1670131,1434117,9678590,11358416,2825259,2590173,10602790,4109873,12122826,11821884,3289031,13213536,5231515,4409965,12912278,5929345,14431610,13675660,5693559,6823513,15618722,14863188,6588335,16513208,8238147,7417269,16212302,1680338,10481449,9664223,1391140,9061683,788936,36926,8838341,12067563,4091408,3340262,11844381,2868234,11372785,10555655,2579964,14478683,5939616,5650518,13661357,5180346,13190977,12967607,4428364,8219746,16457881,16234863,7468436,15633027,6866552,6578062,14816117,1405499,9649856,10463030,1698765,8819930,55329,803287,9047340,11858690,3325945,4072975,12086004,2561507,10574104,11387118,2853909,13647026,5664841,5958079,14460228,4446803,12949160,13176670,5194661,7454091,16249200,16476294,8201341,14834538,6559633,6852199,15647388,3360676,11864927,12161705,4185682,10527045,2551230,2782280,11286707,9619101,1346150,1577872,10379115,73852,8875143,9172337,899466,16124205,7357910,8182816,16421083,6680524,14918455,15678145,6911546,5736468,13747439,14507289,5968354,12873461,4334094,5159928,13170435,4167245,12180150,11879232,3346363,11301036,2767959,2532769,10545498,10360692,1596303,1360505,9604738,913813,9157998,8856728,92259,16439492,8164415,7343561,16138546,6897189,15692510,14936872,6662099,5986813,14488838,13733104,5750795,13156124,5174247,4352529,12855018,2810998,11315341,10498427,2522496,12124823,4148844,3397530,11901793,9135439,862644,110658,8912057,1606574,10407765,9590435,1317464,15706879,6940164,6651890,14889737,8145950,16384229,16161043,7394792,5123014,13133629,12910283,4370992,14535975,5997020,5707818,13718737,2504095,10516836,11329682,2796649,11916158,3383173,4130419,12143240,8893606,129117,876971,9121104,1331783,9576124,10389322,1625009,14908182,6633453,6925851,15721184,7380471,16175372,16402682,8127489,4389423,12891860,13119266,5137369,13704398,5722165,6015427,14517560];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,o.default)("crc-24",function(t,e){n.Buffer.isBuffer(t)||(t=(0,i.default)(t));for(var r=void 0!==e?~~e:11994318,o=0;o>16^a)]^r<<8)}return r});r.default=u},{"./create_buffer":28,"./define_crc":29,buffer:4}],24:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),i=a(t("./create_buffer")),o=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,o.default)("crc-32",function(t,e){n.Buffer.isBuffer(t)||(t=(0,i.default)(t));for(var r=0===e?0:-1^~~e,o=0;o>>8}return-1^r});r.default=u},{"./create_buffer":28,"./define_crc":29,buffer:4}],25:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),i=a(t("./create_buffer")),o=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,7,14,9,28,27,18,21,56,63,54,49,36,35,42,45,112,119,126,121,108,107,98,101,72,79,70,65,84,83,90,93,224,231,238,233,252,251,242,245,216,223,214,209,196,195,202,205,144,151,158,153,140,139,130,133,168,175,166,161,180,179,186,189,199,192,201,206,219,220,213,210,255,248,241,246,227,228,237,234,183,176,185,190,171,172,165,162,143,136,129,134,147,148,157,154,39,32,41,46,59,60,53,50,31,24,17,22,3,4,13,10,87,80,89,94,75,76,69,66,111,104,97,102,115,116,125,122,137,142,135,128,149,146,155,156,177,182,191,184,173,170,163,164,249,254,247,240,229,226,235,236,193,198,207,200,221,218,211,212,105,110,103,96,117,114,123,124,81,86,95,88,77,74,67,68,25,30,23,16,5,2,11,12,33,38,47,40,61,58,51,52,78,73,64,71,82,85,92,91,118,113,120,127,106,109,100,99,62,57,48,55,34,37,44,43,6,1,8,15,26,29,20,19,174,169,160,167,178,181,188,187,150,145,152,159,138,141,132,131,222,217,208,215,194,197,204,203,230,225,232,239,250,253,244,243];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,o.default)("crc-8",function(t,e){n.Buffer.isBuffer(t)||(t=(0,i.default)(t));for(var r=~~e,o=0;o1&&void 0!==arguments[1]?arguments[1]:-1;n.Buffer.isBuffer(t)||(t=(0,i.default)(t));for(var r=0===e?0:~~e,o=0;o>>8}return r});r.default=u},{"./create_buffer":28,"./define_crc":29,buffer:4}],28:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),i=n.Buffer.from&&n.Buffer.alloc&&n.Buffer.allocUnsafe&&n.Buffer.allocUnsafeSlow?n.Buffer.from:function(t){return new n.Buffer(t)};r.default=i},{buffer:4}],29:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t,e){var r=function(t,r){return e(t,r)>>>0};return r.signed=e,r.unsigned=r,r.model=t,r}},{}],30:[function(t,e,r){"use strict";e.exports={crc1:t("./crc1"),crc8:t("./crc8"),crc81wire:t("./crc8_1wire"),crc16:t("./crc16"),crc16ccitt:t("./crc16_ccitt"),crc16modbus:t("./crc16_modbus"),crc16xmodem:t("./crc16_xmodem"),crc16kermit:t("./crc16_kermit"),crc24:t("./crc24"),crc32:t("./crc32"),crcjam:t("./crcjam")}},{"./crc1":6,"./crc16":7,"./crc16_ccitt":8,"./crc16_kermit":9,"./crc16_modbus":10,"./crc16_xmodem":11,"./crc24":12,"./crc32":13,"./crc8":14,"./crc8_1wire":15,"./crcjam":16}],31:[function(t,e,r){r.read=function(t,e,r,n,i){var o,a,s=8*i-n-1,u=(1<>1,c=-7,l=r?i-1:0,h=r?-1:1,d=t[e+l];for(l+=h,o=d&(1<<-c)-1,d>>=-c,c+=s;c>0;o=256*o+t[e+l],l+=h,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=256*a+t[e+l],l+=h,c-=8);if(0===o)o=1-f;else{if(o===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),o-=f}return(d?-1:1)*a*Math.pow(2,o-n)},r.write=function(t,e,r,n,i,o){var a,s,u,f=8*o-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,v=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+l>=1?h/u:h*Math.pow(2,1-l))*u>=2&&(a++,u/=2),a+l>=c?(s=0,a=c):a+l>=1?(s=(e*u-1)*Math.pow(2,i),a+=l):(s=e*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;t[r+d]=255&s,d+=p,s/=256,i-=8);for(a=a<0;t[r+d]=255&a,d+=p,a/=256,f-=8);t[r+d-p]|=128*v}},{}],32:[function(t,e,r){"use strict";!function(t){function n(t,e,r){var n,i,o,d,p,v,y,g,b,m=0,w=[],_=0,A=!1,B=[],k=[],U=!1;if(n=(r=r||{}).encoding||"UTF8",(b=r.numRounds||1)!==parseInt(b,10)||1>b)throw Error("numRounds must a integer >= 1");if(0!==t.lastIndexOf("SHA-",0))throw Error("Chosen SHA variant is not supported");if(v=function(e,r){return x(e,r,t)},y=function(e,r,n,i){var o,a;if("SHA-224"!==t&&"SHA-256"!==t)throw Error("Unexpected error in SHA-2 implementation");for(o=15+(r+65>>>9<<4),a=16;e.length<=o;)e.push(0);for(e[r>>>5]|=128<<24-r%32,r+=n,e[o]=4294967295&r,e[o-1]=r/4294967296|0,n=e.length,r=0;r>>3)/4-1,a>>5;for(t=(e=o(t,w,_)).binLen,r=e.value,e=t>>>5,n=0;n>>5),_=t%p,U=!0},this.getHash=function(e,r){var n,o,h,p;if(!0===A)throw Error("Cannot call getHash after setting HMAC key");switch(h=l(r),e){case"HEX":n=function(t){return a(t,d,h)};break;case"B64":n=function(t){return s(t,d,h)};break;case"BYTES":n=function(t){return u(t,d)};break;case"ARRAYBUFFER":try{o=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}n=function(t){return f(t,d)};break;case"UINT8ARRAY":try{o=new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}n=function(t){return c(t,d)};break;default:throw Error("format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}for(p=y(w.slice(),_,m,g(i)),o=1;o>>3,n=0;n>>2,e.length<=o&&e.push(0),e[o]|=t[n]<<8*(3+a%4*-1);return{value:e,binLen:8*t.length+r}}function a(t,e,r){var n,i,o="";for(e/=8,n=0;n>>2]>>>8*(3+n%4*-1),o+="0123456789abcdef".charAt(i>>>4&15)+"0123456789abcdef".charAt(15&i);return r.outputUpper?o.toUpperCase():o}function s(t,e,r){var n,i,o,a="",s=e/8;for(n=0;n>>2]:0,o=n+2>>2]:0,o=(t[n>>>2]>>>8*(3+n%4*-1)&255)<<16|(i>>>8*(3+(n+1)%4*-1)&255)<<8|o>>>8*(3+(n+2)%4*-1)&255,i=0;4>i;i+=1)a+=8*n+6*i<=e?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(o>>>6*(3-i)&63):r.b64Pad;return a}function u(t,e){var r,n,i="",o=e/8;for(r=0;r>>2]>>>8*(3+r%4*-1)&255,i+=String.fromCharCode(n);return i}function f(t,e){var r,n,i=e/8,o=new ArrayBuffer(i);for(n=new Uint8Array(o),r=0;r>>2]>>>8*(3+r%4*-1)&255;return o}function c(t,e){var r,n=e/8,i=new Uint8Array(n);for(r=0;r>>2]>>>8*(3+r%4*-1)&255;return i}function l(t){var e={outputUpper:!1,b64Pad:"=",shakeLen:-1};if(t=t||{},e.outputUpper=t.outputUpper||!1,!0===t.hasOwnProperty("b64Pad")&&(e.b64Pad=t.b64Pad),"boolean"!=typeof e.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof e.b64Pad)throw Error("Invalid b64Pad formatting option");return e}function h(t,e){var r;switch(e){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(t){case"HEX":r=function(t,e,r){var n,i,o,a,s,u=t.length;if(0!=u%2)throw Error("String of HEX type must be in byte increments");for(e=e||[0],s=(r=r||0)>>>3,n=0;n>>1)+s)>>>2;e.length<=o;)e.push(0);e[o]|=i<<8*(3+a%4*-1)}return{value:e,binLen:4*u+r}};break;case"TEXT":r=function(t,r,n){var i,o,a,s,u,f,c,l,h=0;if(r=r||[0],u=(n=n||0)>>>3,"UTF8"===e)for(l=3,a=0;a(i=t.charCodeAt(a))?o.push(i):2048>i?(o.push(192|i>>>6),o.push(128|63&i)):55296>i||57344<=i?o.push(224|i>>>12,128|i>>>6&63,128|63&i):(a+=1,i=65536+((1023&i)<<10|1023&t.charCodeAt(a)),o.push(240|i>>>18,128|i>>>12&63,128|i>>>6&63,128|63&i)),s=0;s>>2;r.length<=f;)r.push(0);r[f]|=o[s]<<8*(l+c%4*-1),h+=1}else if("UTF16BE"===e||"UTF16LE"===e)for(l=2,o="UTF16LE"===e||"UTF16LE"!==e&&!1,a=0;a>>8),f=(c=h+u)>>>2;r.length<=f;)r.push(0);r[f]|=i<<8*(l+c%4*-1),h+=2}return{value:r,binLen:8*h+n}};break;case"B64":r=function(t,e,r){var n,i,o,a,s,u,f,c=0;if(-1===t.search(/^[a-zA-Z0-9=+\/]+$/))throw Error("Invalid character in base-64 string");if(i=t.indexOf("="),t=t.replace(/\=/g,""),-1!==i&&i=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r>>0,c=new Uint8Array(a);t[r];){var l=e[t.charCodeAt(r)];if(255===l)return;for(var h=0,d=a-1;(0!==l||h>>0,c[d]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");o=h,r++}if(" "!==t[r]){for(var p=a-o;p!==a&&0===c[p];)p++;var v=n.allocUnsafe(i+(a-p));v.fill(0,0,i);for(var y=i;p!==a;)v[y++]=c[p++];return v}}}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=n.from(e)),!n.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var r=0,i=0,o=0,a=e.length;o!==a&&0===e[o];)o++,r++;for(var f=(a-o)*c+1>>>0,l=new Uint8Array(f);o!==a;){for(var h=e[o],d=0,p=f-1;(0!==h||d>>0,l[p]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");i=d,o++}for(var v=f-i;v!==f&&0===l[v];)v++;for(var y=u.repeat(r);v0?n-4:n,l=0;l>16&255,s[u++]=e>>8&255,s[u++]=255&e;2===a&&(e=i[t.charCodeAt(l)]<<2|i[t.charCodeAt(l+1)]>>4,s[u++]=255&e);1===a&&(e=i[t.charCodeAt(l)]<<10|i[t.charCodeAt(l+1)]<<4|i[t.charCodeAt(l+2)]>>2,s[u++]=e>>8&255,s[u++]=255&e);return s},r.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],a=0,s=r-i;as?s:a+16383));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=a.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function c(t,e,r){for(var i,o,a=[],s=e;s>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],3:[function(t,e,r){(function(t){var r,n=20,i=4,o=-7,a=21,s=-1e9,u=1e9,f=!0,c=parseInt,l=g.prototype,h="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",d=0,p=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,v=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},y=g(1);function g(t,e){var o,a,c,l,y,w,_=this;if(!(_ instanceof g))return new g(t,e);if(t instanceof g){if(d=0,e===o)return _.s=t.s,_.e=t.e,void(_.c=(t=t.c)?t.slice():t);t+=""}if("string"!=typeof t&&(t=(c="number"==typeof t||"[object Number]"==Object.prototype.toString.call(t))&&0===t&&1/t<0?"-0":t+""),w=t,e===o&&p.test(t))_.s="-"==t.charAt(0)?(t=t.slice(1),-1):1;else{if(10==e)return E(t,n,i);if(t=v.call(t).replace(/^\+(?!-)/,""),_.s="-"==t.charAt(0)?(t=t.replace(/^-(?!-)/,""),-1):1,null!=e?e!=(0|e)&&f||(r=!(e>=2&&e<65))?(b(e,2),y=p.test(t)):(l="["+h.slice(0,e|=0)+"]+",t=t.replace(/\.$/,"").replace(/^\./,"0."),(y=new RegExp("^"+l+"(?:\\."+l+")?$",e<37?"i":"").test(t))?(c&&(t.replace(/^0\.0*|\./,"").length>15&&b(w,0),c=!c),t=m(t,10,e,_.s)):"Infinity"!=t&&"NaN"!=t&&(b(w,1,e),t="NaN")):y=p.test(t),!y)return _.c=_.e=null,"Infinity"!=t&&("NaN"!=t&&b(w,3),_.s=null),void(d=0)}for((o=t.indexOf("."))>-1&&(t=t.replace(".","")),(a=t.search(/e/i))>0?(o<0&&(o=a),o+=+t.slice(a+1),t=t.substring(0,a)):o<0&&(o=t.length),a=0;"0"==t.charAt(a);a++);if(e=t.length,c&&e>15&&t.slice(a).length>15&&b(w,0),d=0,(o-=a+1)>u)_.c=_.e=null;else if(a==e||oe-1&&(null==u[i+1]&&(u[i+1]=0),u[i+1]+=u[i]/e^0,u[i]%=e)}return u.reverse()}function l(t){for(var e=0,r=t.length,n="";e-1)if(i=t.length-i-1,o=c(new g(r).pow(i).toF(),10),a=c((s=t.split("."))[1]),s=c(s[0]),u=(f=w(a,o,a.length-o.length,n,e,1&s[s.length-1])).c,i=f.e){for(;++i;u.unshift(0));t=l(s)+"."+l(u)}else u[0]?s[i=s.length-1]w?1:-1;else for(d=-1,h=0;++dm[d]?1:-1;break}if(!(h<0))break;for(c=w==f?e:p;w;){if(m[--w]B&&A(_,n,o,a,null!=m[0]),_.e>u?_.c=_.e=null:_.e++e&&A(t,n,10),n=0==i[0]?n+1:r?e:t.e+n+1;i.length1?(i.splice(1,0,"."),i.join("")):i[0])+(n<0?"e":"e+")+n:t.toS()}function A(t,e,r,n,o){var a=t.c,s=t.s<0,u=r/2,f=t.e+e+1,c=a[f],l=o||f<0||null!=a[f+1];if(o=i<4?(null!=c||l)&&(0==i||2==i&&!s||3==i&&s):c>u||c==u&&(4==i||l||6==i&&(1&a[f-1]||!e&&n)||7==i&&!s||8==i&&s),f<1||!a[0])return a.length=0,a.push(0),o?(a[0]=1,t.e=-e):t.e=0,t;if(a.length=f--,o)for(--r;++a[f]>r;)a[f]=0,f--||(++t.e,a.unshift(1));for(f=a.length;!a[--f];a.pop());return t}function E(t,e,r){var n=i;return i=r,(t=new g(t)).c&&A(t,e,10),i=n,t}g.ROUND_UP=0,g.ROUND_DOWN=1,g.ROUND_CEIL=2,g.ROUND_FLOOR=3,g.ROUND_HALF_UP=4,g.ROUND_HALF_DOWN=5,g.ROUND_HALF_EVEN=6,g.ROUND_HALF_CEIL=7,g.ROUND_HALF_FLOOR=8,g.fromBuffer=function(t,e){e||(e={});var r={1:"big","-1":"little"}[e.endian]||e.endian||"big",n="auto"===e.size?Math.ceil(t.length):e.size||1;if(t.length%n!=0)throw new RangeError("Buffer length ("+t.length+") must be a multiple of size ("+n+")");for(var i=[],o=0;on)||c(t)!=t&&0!==t)},m=v&&"object"==typeof v?function(){if(v.hasOwnProperty(e))return null!=(t=v[e])}:function(){if(p.length>l)return null!=(t=p[l++])};return m(e="DECIMAL_PLACES")&&(g(t,0,1e9)?n=0|t:b(t,e,y)),h[e]=n,m(e="ROUNDING_MODE")&&(g(t,0,8)?i=0|t:b(t,e,y)),h[e]=i,m(e="EXPONENTIAL_AT")&&(g(t,-1e9,1e9)?o=-(a=~~(t<0?-t:+t)):!r&&t&&g(t[0],-1e9,0)&&g(t[1],0,1e9)?(o=~~t[0],a=~~t[1]):b(t,e,y,1)),h[e]=[o,a],m(e="RANGE")&&(g(t,-1e9,1e9)&&~~t?s=-(u=~~(t<0?-t:+t)):!r&&t&&g(t[0],-1e9,-1)&&g(t[1],1,1e9)?(s=~~t[0],u=~~t[1]):b(t,e,y,1,1)),h[e]=[s,u],m(e="ERRORS")&&(t===!!t||1===t||0===t?(r=d=0,c=(f=!!t)?parseInt:parseFloat):b(t,e,y,0,0,1)),h[e]=f,h},l.abs=l.absoluteValue=function(){var t=new g(this);return t.s<0&&(t.s=1),t},l.bitLength=function(){return this.toString(2).length},l.ceil=function(){return E(this,0,2)},l.comparedTo=l.cmp=function(t,e){var r,n=this,i=n.c,o=(d=-d,t=new g(t,e)).c,a=n.s,s=t.s,u=n.e,f=t.e;if(!a||!s)return null;if(r=i&&!i[0],e=o&&!o[0],r||e)return r?e?0:-s:a;if(a!=s)return a;if(r=a<0,e=u==f,!i||!o)return e?0:!i^r?1:-1;if(!e)return u>f^r?1:-1;for(a=-1,s=(u=i.length)<(f=o.length)?u:f;++ao[a]^r?1:-1;return u==f?0:u>f^r?1:-1},l.dividedBy=l.div=function(t,e){var r=this.c,n=this.e,i=this.s,o=(d=2,t=new g(t,e)).c,a=t.e,s=t.s,u=i==s?1:-1;return(n||r&&r[0])&&(a||o&&o[0])?w(r,o,n-a,u,10):new g(i&&s&&(r?!o||r[0]!=o[0]:o)?r&&0==r[0]||!o?0*u:u/0:NaN)},l.equals=l.eq=function(t,e){return d=3,0===this.cmp(t,e)},l.floor=function(){return E(this,0,3)},l.greaterThan=l.gt=function(t,e){return d=4,this.cmp(t,e)>0},l.greaterThanOrEqualTo=l.gte=l.gt=function(t,e){return d=5,1==(e=this.cmp(t,e))||0===e},l.isFinite=l.isF=function(){return!!this.c},l.isNaN=function(){return!this.s},l.isNegative=l.isNeg=function(){return this.s<0},l.isZero=l.isZ=function(){return!!this.c&&0==this.c[0]},l.lessThan=l.lt=function(t,e){return d=6,this.cmp(t,e)<0},l.lessThanOrEqualTo=l.lte=l.le=function(t,e){return d=7,-1==(e=this.cmp(t,e))||0===e},l.minus=l.sub=function(t,e){var r,n,o,a,u=this,f=u.s;if(e=(d=8,t=new g(t,e)).s,!f||!e)return new g(NaN);if(f!=e)return t.s=-e,u.plus(t);var c=u.c,l=u.e,h=t.c,p=t.e;if(!l||!p){if(!c||!h)return c?(t.s=-e,t):new g(h?u:NaN);if(!c[0]||!h[0])return h[0]?(t.s=-e,t):new g(c[0]?u:3==i?-0:0)}if(c=c.slice(),f=l-p){for((r=(a=f<0)?(f=-f,c):(p=l,h)).reverse(),e=f;e--;r.push(0));r.reverse()}else for(o=((a=c.length0)for(;e--;c[o++]=0);for(e=h.length;e>f;){if(c[--e]0?(s=o,f):(i=-i,a)).reverse();i--;r.push(0));r.reverse()}for(a.length-f.length<0&&(r=f,f=a,a=r),i=f.length,e=0;i;e=(a[--i]=a[i]+f[i]+e)/10^0,a[i]%=10);for(e&&(a.unshift(e),++s>u&&(a=s=null)),i=a.length;0==a[--i];a.pop());return t.c=a,t.e=s,t},l.toPower=l.pow=function(t){var e=0*t==0?0|t:t,n=new g(this),i=new g(y);if(((r=t<-1e6||t>1e6)&&(e=1*t/0)||c(t)!=t&&0!==t&&!(e=NaN))&&!b(t,"exponent","pow")||!e)return new g(Math.pow(n.toS(),e));for(e=e<0?-e:e;1&e&&(i=i.times(n)),e>>=1;)n=n.times(n);return t<0?y.div(i):i},l.powm=function(t,e){return this.pow(t).mod(e)},l.round=function(t,e){return E(this,t=null==t||((r=t<0||t>1e9)||c(t)!=t)&&!b(t,"decimal places","round")?0:0|t,e=null==e||((r=e<0||e>8)||c(e)!=e&&0!==e)&&!b(e,"mode","round")?i:0|e)},l.squareRoot=l.sqrt=function(){var t,e,r,o,a=this,s=a.c,u=a.s,f=a.e,c=n,l=i,h=new g("0.5");if(1!==u||!s||!s[0])return new g(!u||u<0&&(!s||s[0])?NaN:s?a:1/0);for(u=Math.sqrt(a.toS()),i=1,0==u||u==1/0?((t=s.join("")).length+f&1||(t+="0"),(e=new g(Math.sqrt(t)+"")).c||(e.c=[1]),e.e=((f+1)/2|0)-(f<0||1&f)):e=new g(t=u.toString()),(u=(r=e.e)+(n+=4))<3&&(u=0),f=u;;)if(o=e,e=h.times(o.plus(a.div(o))),o.c.slice(0,u).join("")===e.c.slice(0,u).join("")){if(9!=(s=e.c)[u-=t&&e.ef-2&&(s.length=f-2),e.times(e).eq(a)))){for(;s.length-1;a--){for(e=0,f=c+a;f>a;e=r[f]+o[a]*i[f-a-1]+e,r[f--]=e%10|0,e=e/10|0);e&&(r[f]=(r[f]+e)%10)}for(e&&++t.e,!r[0]&&r.shift(),f=r.length;!r[--f];r.pop());return t.c=t.e>u?t.e=null:t.e0&&c.copy(i,4+(128&c[0]?1:0)),128&c[0]&&(i[4]=0),i[0]=n&255<<24,i[1]=n&255<<16,i[2]=65280&n,i[3]=255&n;var o=this.lt(0);if(o)for(var a=4;a0}).forEach(function(t,e){for(var r=0;r1e9)||c(t)!=t&&0!==t)&&!b(t,"decimal places","toE"))&&this.c?this.c.length-1:0|t,1)},l.toFixed=l.toF=function(t){var e,n,i,s=this;return null==t||((r=t<0||t>1e9)||c(t)!=t&&0!==t)&&!b(t,"decimal places","toF")||(i=s.e+(0|t)),e=o,t=a,o=-(a=1/0),i==n?n=s.toS():(n=_(s,i),s.s<0&&s.c&&(s.c[0]?n.indexOf("-")<0&&(n="-"+n):n=n.replace(/^-/,""))),o=e,a=t,n},l.toFraction=l.toFr=function(t){var e,o,a,s,c,l,h,p=s=new g(y),v=a=new g("0"),m=this,w=m.c,_=u,A=n,E=i,x=new g(y);if(!w)return m.toS();for(h=x.e=w.length-m.e-1,(null==t||(!(d=12,l=new g(t)).s||(r=l.cmp(p)<0||!l.c)||f&&l.e0)&&(t=h>0?x:p),u=1/0,l=new g(w.join("")),n=0,i=1;e=l.div(x),1!=(c=s.plus(e.times(v))).cmp(t);)s=v,v=c,p=a.plus(e.times(c=p)),a=c,x=l.minus(e.times(c=x)),l=c;return c=t.minus(s).div(v),a=a.plus(c.times(p)),s=s.plus(c.times(v)),a.s=p.s=m.s,n=2*h,i=E,o=p.div(v).minus(m).abs().cmp(a.div(s).minus(m).abs())<1?[p.toS(),v.toS()]:[a.toS(),s.toS()],u=_,n=A,o},l.toPrecision=l.toP=function(t){return null==t||((r=t<1||t>1e9)||c(t)!=t)&&!b(t,"precision","toP")?this.toS():_(this,0|--t,2)},l.toString=l.toS=function(t){var e,n,i,s=this,u=s.e;if(null===u)n=s.s?"Infinity":"NaN";else{if(t===e&&(u<=o||u>=a))return _(s,s.c.length-1,1);if(n=s.c.join(""),u<0){for(;++u;n="0"+n);n="0."+n}else if(i=n.length,u>0)if(++u>i)for(u-=i;u--;n+="0");else u1)n=e+"."+n.slice(1);else if("0"==e)return e;if(null!=t)if((r=!(t>=2&&t<65))||t!=(0|t)&&f)b(t,"base","toS");else if("0"==(n=m(n,0|t,10,s.s)))return n}return s.s<0?"-"+n:n},l.valueOf=function(){return this.toS()},e.exports=g}).call(this,t("buffer").Buffer)},{buffer:4}],4:[function(t,e,r){"use strict";var n=t("base64-js"),i=t("ieee754");r.Buffer=s,r.SlowBuffer=function(t){+t!=t&&(t=0);return s.alloc(+t)},r.INSPECT_MAX_BYTES=50;var o=2147483647;function a(t){if(t>o)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return e.__proto__=s.prototype,e}function s(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return c(t)}return u(t,e,r)}function u(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|d(t,e),n=a(r),i=n.write(t,e);i!==r&&(n=n.slice(0,i));return n}(t,e);if(ArrayBuffer.isView(t))return l(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(P(t,ArrayBuffer)||t&&P(t.buffer,ArrayBuffer))return function(t,e,r){if(e<0||t.byteLength=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|t}function d(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||P(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return L(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(t).length;default:if(i)return n?-1:L(t).length;e=(""+e).toLowerCase(),i=!0}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function v(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),H(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:y(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):y(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function y(t,e,r,n,i){var o,a=1,s=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,r/=2}function f(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var c=-1;for(o=r;os&&(r=s-u),o=r;o>=0;o--){for(var l=!0,h=0;hi&&(n=i):n=i;var o=e.length;n>o/2&&(n=o/2);for(var a=0;a>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function E(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function x(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:f>223?3:f>191?2:1;if(i+l<=r)switch(l){case 1:f<128&&(c=f);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&f)<<6|63&o)>127&&(c=u);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(u=(15&f)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&f)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,l=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=l}return function(t){var e=t.length;if(e<=B)return String.fromCharCode.apply(String,t);var r="",n=0;for(;nthis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return C(this,e,r);case"utf8":case"utf-8":return x(this,e,r);case"ascii":return k(this,e,r);case"latin1":case"binary":return U(this,e,r);case"base64":return E(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===s.compare(this,t)},s.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),""},s.prototype.compare=function(t,e,r,n,i){if(P(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;for(var o=i-n,a=r-e,u=Math.min(o,a),f=this.slice(n,i),c=t.slice(e,r),l=0;l>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return g(this,t,e,r);case"utf8":case"utf-8":return b(this,t,e,r);case"ascii":return m(this,t,e,r);case"latin1":case"binary":return w(this,t,e,r);case"base64":return _(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var B=4096;function k(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;in)&&(r=n);for(var i="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function O(t,e,r,n,i,o){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function R(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function I(t,e,r,n,o){return e=+e,r>>>=0,o||R(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function j(t,e,r,n,o){return e=+e,r>>>=0,o||R(t,0,r,8),i.write(t,e,r,n,52,8),r+8}s.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||T(t,e,this.length);for(var n=this[t],i=1,o=0;++o>>=0,e>>>=0,r||T(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},s.prototype.readUInt8=function(t,e){return t>>>=0,e||T(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||T(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||T(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||T(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUInt32BE=function(t,e){return t>>>=0,e||T(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||T(t,e,this.length);for(var n=this[t],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||T(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},s.prototype.readInt8=function(t,e){return t>>>=0,e||T(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||T(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(t,e){t>>>=0,e||T(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(t,e){return t>>>=0,e||T(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return t>>>=0,e||T(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readFloatLE=function(t,e){return t>>>=0,e||T(t,4,this.length),i.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||T(t,4,this.length),i.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||T(t,8,this.length),i.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||T(t,8,this.length),i.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o>>=0,r>>>=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},s.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,1,255,0),this[e]=255&t,e+1},s.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);O(this,t,e,r,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o>0)-s&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);O(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},s.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeFloatLE=function(t,e,r){return I(this,t,e,!0,r)},s.prototype.writeFloatBE=function(t,e,r){return I(this,t,e,!1,r)},s.prototype.writeDoubleLE=function(t,e,r){return j(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return j(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return i},s.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var i=t.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(t=i)}}else"number"==typeof t&&(t&=255);if(e<0||this.length>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function F(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(M,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function z(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function P(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function H(t){return t!=t}},{"base64-js":2,ieee754:31}],5:[function(t,e,r){!function(t,r){"use strict";var n=Math.pow(2,-24),i=Math.pow(2,32),o=Math.pow(2,53);var a={encode:function(t){var e,n=new ArrayBuffer(256),a=new DataView(n),s=0;function u(t){for(var r=n.byteLength,i=s+t;r>2,f=0;f>6),i.push(128|63&a)):a<55296?(i.push(224|a>>12),i.push(128|a>>6&63),i.push(128|63&a)):(a=(1023&a)<<10,a|=1023&e.charCodeAt(++n),a+=65536,i.push(240|a>>18),i.push(128|a>>12&63),i.push(128|a>>6&63),i.push(128|63&a))}return h(3,i.length),l(i);default:var d;if(Array.isArray(e))for(h(4,d=e.length),n=0;n>5!==t)throw"Invalid indefinite length element";return r}function y(t,e){for(var r=0;r>10),t.push(56320|1023&n))}}"function"!=typeof e&&(e=function(t){return t}),"function"!=typeof o&&(o=function(){return r});var g=function t(){var i,h,g=c(),b=g>>5,m=31&g;if(7===b)switch(m){case 25:return function(){var t=new ArrayBuffer(4),e=new DataView(t),r=l(),i=32768&r,o=31744&r,a=1023&r;if(31744===o)o=261120;else if(0!==o)o+=114688;else if(0!==a)return a*n;return e.setUint32(0,i<<16|o<<13|a<<13),e.getFloat32(0)}();case 26:return u(a.getFloat32(s),4);case 27:return u(a.getFloat64(s),8)}if((h=p(m))<0&&(b<2||6=0;)_+=h,w.push(f(h));var A=new Uint8Array(_),E=0;for(i=0;i=0;)y(x,h);else y(x,h);return String.fromCharCode.apply(null,x);case 4:var B;if(h<0)for(B=[];!d();)B.push(t());else for(B=new Array(h),i=0;i>8)}return r});r.default=u},{"./create_buffer":28,"./define_crc":29,buffer:4}],19:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),i=a(t("./create_buffer")),o=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,o.default)("ccitt",function(t,e){n.Buffer.isBuffer(t)||(t=(0,i.default)(t));for(var r=void 0!==e?~~e:65535,o=0;o>8^a)]^r<<8)}return r});r.default=u},{"./create_buffer":28,"./define_crc":29,buffer:4}],20:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),i=a(t("./create_buffer")),o=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,4489,8978,12955,17956,22445,25910,29887,35912,40385,44890,48851,51820,56293,59774,63735,4225,264,13203,8730,22181,18220,30135,25662,40137,36160,49115,44626,56045,52068,63999,59510,8450,12427,528,5017,26406,30383,17460,21949,44362,48323,36440,40913,60270,64231,51324,55797,12675,8202,4753,792,30631,26158,21685,17724,48587,44098,40665,36688,64495,60006,55549,51572,16900,21389,24854,28831,1056,5545,10034,14011,52812,57285,60766,64727,34920,39393,43898,47859,21125,17164,29079,24606,5281,1320,14259,9786,57037,53060,64991,60502,39145,35168,48123,43634,25350,29327,16404,20893,9506,13483,1584,6073,61262,65223,52316,56789,43370,47331,35448,39921,29575,25102,20629,16668,13731,9258,5809,1848,65487,60998,56541,52564,47595,43106,39673,35696,33800,38273,42778,46739,49708,54181,57662,61623,2112,6601,11090,15067,20068,24557,28022,31999,38025,34048,47003,42514,53933,49956,61887,57398,6337,2376,15315,10842,24293,20332,32247,27774,42250,46211,34328,38801,58158,62119,49212,53685,10562,14539,2640,7129,28518,32495,19572,24061,46475,41986,38553,34576,62383,57894,53437,49460,14787,10314,6865,2904,32743,28270,23797,19836,50700,55173,58654,62615,32808,37281,41786,45747,19012,23501,26966,30943,3168,7657,12146,16123,54925,50948,62879,58390,37033,33056,46011,41522,23237,19276,31191,26718,7393,3432,16371,11898,59150,63111,50204,54677,41258,45219,33336,37809,27462,31439,18516,23005,11618,15595,3696,8185,63375,58886,54429,50452,45483,40994,37561,33584,31687,27214,22741,18780,15843,11370,7921,3960];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,o.default)("kermit",function(t,e){n.Buffer.isBuffer(t)||(t=(0,i.default)(t));for(var r=void 0!==e?~~e:0,o=0;o>8)}return r});r.default=u},{"./create_buffer":28,"./define_crc":29,buffer:4}],21:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),i=a(t("./create_buffer")),o=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,49345,49537,320,49921,960,640,49729,50689,1728,1920,51009,1280,50625,50305,1088,52225,3264,3456,52545,3840,53185,52865,3648,2560,51905,52097,2880,51457,2496,2176,51265,55297,6336,6528,55617,6912,56257,55937,6720,7680,57025,57217,8e3,56577,7616,7296,56385,5120,54465,54657,5440,55041,6080,5760,54849,53761,4800,4992,54081,4352,53697,53377,4160,61441,12480,12672,61761,13056,62401,62081,12864,13824,63169,63361,14144,62721,13760,13440,62529,15360,64705,64897,15680,65281,16320,16e3,65089,64001,15040,15232,64321,14592,63937,63617,14400,10240,59585,59777,10560,60161,11200,10880,59969,60929,11968,12160,61249,11520,60865,60545,11328,58369,9408,9600,58689,9984,59329,59009,9792,8704,58049,58241,9024,57601,8640,8320,57409,40961,24768,24960,41281,25344,41921,41601,25152,26112,42689,42881,26432,42241,26048,25728,42049,27648,44225,44417,27968,44801,28608,28288,44609,43521,27328,27520,43841,26880,43457,43137,26688,30720,47297,47489,31040,47873,31680,31360,47681,48641,32448,32640,48961,32e3,48577,48257,31808,46081,29888,30080,46401,30464,47041,46721,30272,29184,45761,45953,29504,45313,29120,28800,45121,20480,37057,37249,20800,37633,21440,21120,37441,38401,22208,22400,38721,21760,38337,38017,21568,39937,23744,23936,40257,24320,40897,40577,24128,23040,39617,39809,23360,39169,22976,22656,38977,34817,18624,18816,35137,19200,35777,35457,19008,19968,36545,36737,20288,36097,19904,19584,35905,17408,33985,34177,17728,34561,18368,18048,34369,33281,17088,17280,33601,16640,33217,32897,16448];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,o.default)("crc-16-modbus",function(t,e){n.Buffer.isBuffer(t)||(t=(0,i.default)(t));for(var r=void 0!==e?~~e:65535,o=0;o>8)}return r});r.default=u},{"./create_buffer":28,"./define_crc":29,buffer:4}],22:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),i=o(t("./create_buffer"));function o(t){return t&&t.__esModule?t:{default:t}}var a=(0,o(t("./define_crc")).default)("xmodem",function(t,e){n.Buffer.isBuffer(t)||(t=(0,i.default)(t));for(var r=void 0!==e?~~e:0,o=0;o>>8&255;a^=255&t[o],r=r<<8&65535,r^=a^=a>>>4,r^=a=a<<5&65535,r^=a=a<<7&65535}return r});r.default=a},{"./create_buffer":28,"./define_crc":29,buffer:4}],23:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),i=a(t("./create_buffer")),o=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,8801531,9098509,825846,9692897,1419802,1651692,10452759,10584377,2608578,2839604,11344079,3303384,11807523,12104405,4128302,12930697,4391538,5217156,13227903,5679208,13690003,14450021,5910942,6606768,14844747,15604413,6837830,16197969,7431594,8256604,16494759,840169,9084178,8783076,18463,10434312,1670131,1434117,9678590,11358416,2825259,2590173,10602790,4109873,12122826,11821884,3289031,13213536,5231515,4409965,12912278,5929345,14431610,13675660,5693559,6823513,15618722,14863188,6588335,16513208,8238147,7417269,16212302,1680338,10481449,9664223,1391140,9061683,788936,36926,8838341,12067563,4091408,3340262,11844381,2868234,11372785,10555655,2579964,14478683,5939616,5650518,13661357,5180346,13190977,12967607,4428364,8219746,16457881,16234863,7468436,15633027,6866552,6578062,14816117,1405499,9649856,10463030,1698765,8819930,55329,803287,9047340,11858690,3325945,4072975,12086004,2561507,10574104,11387118,2853909,13647026,5664841,5958079,14460228,4446803,12949160,13176670,5194661,7454091,16249200,16476294,8201341,14834538,6559633,6852199,15647388,3360676,11864927,12161705,4185682,10527045,2551230,2782280,11286707,9619101,1346150,1577872,10379115,73852,8875143,9172337,899466,16124205,7357910,8182816,16421083,6680524,14918455,15678145,6911546,5736468,13747439,14507289,5968354,12873461,4334094,5159928,13170435,4167245,12180150,11879232,3346363,11301036,2767959,2532769,10545498,10360692,1596303,1360505,9604738,913813,9157998,8856728,92259,16439492,8164415,7343561,16138546,6897189,15692510,14936872,6662099,5986813,14488838,13733104,5750795,13156124,5174247,4352529,12855018,2810998,11315341,10498427,2522496,12124823,4148844,3397530,11901793,9135439,862644,110658,8912057,1606574,10407765,9590435,1317464,15706879,6940164,6651890,14889737,8145950,16384229,16161043,7394792,5123014,13133629,12910283,4370992,14535975,5997020,5707818,13718737,2504095,10516836,11329682,2796649,11916158,3383173,4130419,12143240,8893606,129117,876971,9121104,1331783,9576124,10389322,1625009,14908182,6633453,6925851,15721184,7380471,16175372,16402682,8127489,4389423,12891860,13119266,5137369,13704398,5722165,6015427,14517560];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,o.default)("crc-24",function(t,e){n.Buffer.isBuffer(t)||(t=(0,i.default)(t));for(var r=void 0!==e?~~e:11994318,o=0;o>16^a)]^r<<8)}return r});r.default=u},{"./create_buffer":28,"./define_crc":29,buffer:4}],24:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),i=a(t("./create_buffer")),o=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,o.default)("crc-32",function(t,e){n.Buffer.isBuffer(t)||(t=(0,i.default)(t));for(var r=0===e?0:-1^~~e,o=0;o>>8}return-1^r});r.default=u},{"./create_buffer":28,"./define_crc":29,buffer:4}],25:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),i=a(t("./create_buffer")),o=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,7,14,9,28,27,18,21,56,63,54,49,36,35,42,45,112,119,126,121,108,107,98,101,72,79,70,65,84,83,90,93,224,231,238,233,252,251,242,245,216,223,214,209,196,195,202,205,144,151,158,153,140,139,130,133,168,175,166,161,180,179,186,189,199,192,201,206,219,220,213,210,255,248,241,246,227,228,237,234,183,176,185,190,171,172,165,162,143,136,129,134,147,148,157,154,39,32,41,46,59,60,53,50,31,24,17,22,3,4,13,10,87,80,89,94,75,76,69,66,111,104,97,102,115,116,125,122,137,142,135,128,149,146,155,156,177,182,191,184,173,170,163,164,249,254,247,240,229,226,235,236,193,198,207,200,221,218,211,212,105,110,103,96,117,114,123,124,81,86,95,88,77,74,67,68,25,30,23,16,5,2,11,12,33,38,47,40,61,58,51,52,78,73,64,71,82,85,92,91,118,113,120,127,106,109,100,99,62,57,48,55,34,37,44,43,6,1,8,15,26,29,20,19,174,169,160,167,178,181,188,187,150,145,152,159,138,141,132,131,222,217,208,215,194,197,204,203,230,225,232,239,250,253,244,243];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,o.default)("crc-8",function(t,e){n.Buffer.isBuffer(t)||(t=(0,i.default)(t));for(var r=~~e,o=0;o1&&void 0!==arguments[1]?arguments[1]:-1;n.Buffer.isBuffer(t)||(t=(0,i.default)(t));for(var r=0===e?0:~~e,o=0;o>>8}return r});r.default=u},{"./create_buffer":28,"./define_crc":29,buffer:4}],28:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),i=n.Buffer.from&&n.Buffer.alloc&&n.Buffer.allocUnsafe&&n.Buffer.allocUnsafeSlow?n.Buffer.from:function(t){return new n.Buffer(t)};r.default=i},{buffer:4}],29:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t,e){var r=function(t,r){return e(t,r)>>>0};return r.signed=e,r.unsigned=r,r.model=t,r}},{}],30:[function(t,e,r){"use strict";e.exports={crc1:t("./crc1"),crc8:t("./crc8"),crc81wire:t("./crc8_1wire"),crc16:t("./crc16"),crc16ccitt:t("./crc16_ccitt"),crc16modbus:t("./crc16_modbus"),crc16xmodem:t("./crc16_xmodem"),crc16kermit:t("./crc16_kermit"),crc24:t("./crc24"),crc32:t("./crc32"),crcjam:t("./crcjam")}},{"./crc1":6,"./crc16":7,"./crc16_ccitt":8,"./crc16_kermit":9,"./crc16_modbus":10,"./crc16_xmodem":11,"./crc24":12,"./crc32":13,"./crc8":14,"./crc8_1wire":15,"./crcjam":16}],31:[function(t,e,r){r.read=function(t,e,r,n,i){var o,a,s=8*i-n-1,u=(1<>1,c=-7,l=r?i-1:0,h=r?-1:1,d=t[e+l];for(l+=h,o=d&(1<<-c)-1,d>>=-c,c+=s;c>0;o=256*o+t[e+l],l+=h,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=256*a+t[e+l],l+=h,c-=8);if(0===o)o=1-f;else{if(o===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),o-=f}return(d?-1:1)*a*Math.pow(2,o-n)},r.write=function(t,e,r,n,i,o){var a,s,u,f=8*o-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,v=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+l>=1?h/u:h*Math.pow(2,1-l))*u>=2&&(a++,u/=2),a+l>=c?(s=0,a=c):a+l>=1?(s=(e*u-1)*Math.pow(2,i),a+=l):(s=e*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;t[r+d]=255&s,d+=p,s/=256,i-=8);for(a=a<0;t[r+d]=255&a,d+=p,a/=256,f-=8);t[r+d-p]|=128*v}},{}],32:[function(t,e,r){"use strict";!function(t){function n(t,e,r){var n,i,o,d,p,v,y,g,b,m=0,w=[],_=0,A=!1,B=[],k=[],U=!1;if(n=(r=r||{}).encoding||"UTF8",(b=r.numRounds||1)!==parseInt(b,10)||1>b)throw Error("numRounds must a integer >= 1");if(0!==t.lastIndexOf("SHA-",0))throw Error("Chosen SHA variant is not supported");if(v=function(e,r){return x(e,r,t)},y=function(e,r,n,i){var o,a;if("SHA-224"!==t&&"SHA-256"!==t)throw Error("Unexpected error in SHA-2 implementation");for(o=15+(r+65>>>9<<4),a=16;e.length<=o;)e.push(0);for(e[r>>>5]|=128<<24-r%32,r+=n,e[o]=4294967295&r,e[o-1]=r/4294967296|0,n=e.length,r=0;r>>3)/4-1,a>>5;for(t=(e=o(t,w,_)).binLen,r=e.value,e=t>>>5,n=0;n>>5),_=t%p,U=!0},this.getHash=function(e,r){var n,o,h,p;if(!0===A)throw Error("Cannot call getHash after setting HMAC key");switch(h=l(r),e){case"HEX":n=function(t){return a(t,d,h)};break;case"B64":n=function(t){return s(t,d,h)};break;case"BYTES":n=function(t){return u(t,d)};break;case"ARRAYBUFFER":try{o=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}n=function(t){return f(t,d)};break;case"UINT8ARRAY":try{o=new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}n=function(t){return c(t,d)};break;default:throw Error("format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}for(p=y(w.slice(),_,m,g(i)),o=1;o>>3,n=0;n>>2,e.length<=o&&e.push(0),e[o]|=t[n]<<8*(3+a%4*-1);return{value:e,binLen:8*t.length+r}}function a(t,e,r){var n,i,o="";for(e/=8,n=0;n>>2]>>>8*(3+n%4*-1),o+="0123456789abcdef".charAt(i>>>4&15)+"0123456789abcdef".charAt(15&i);return r.outputUpper?o.toUpperCase():o}function s(t,e,r){var n,i,o,a="",s=e/8;for(n=0;n>>2]:0,o=n+2>>2]:0,o=(t[n>>>2]>>>8*(3+n%4*-1)&255)<<16|(i>>>8*(3+(n+1)%4*-1)&255)<<8|o>>>8*(3+(n+2)%4*-1)&255,i=0;4>i;i+=1)a+=8*n+6*i<=e?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(o>>>6*(3-i)&63):r.b64Pad;return a}function u(t,e){var r,n,i="",o=e/8;for(r=0;r>>2]>>>8*(3+r%4*-1)&255,i+=String.fromCharCode(n);return i}function f(t,e){var r,n,i=e/8,o=new ArrayBuffer(i);for(n=new Uint8Array(o),r=0;r>>2]>>>8*(3+r%4*-1)&255;return o}function c(t,e){var r,n=e/8,i=new Uint8Array(n);for(r=0;r>>2]>>>8*(3+r%4*-1)&255;return i}function l(t){var e={outputUpper:!1,b64Pad:"=",shakeLen:-1};if(t=t||{},e.outputUpper=t.outputUpper||!1,!0===t.hasOwnProperty("b64Pad")&&(e.b64Pad=t.b64Pad),"boolean"!=typeof e.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof e.b64Pad)throw Error("Invalid b64Pad formatting option");return e}function h(t,e){var r;switch(e){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(t){case"HEX":r=function(t,e,r){var n,i,o,a,s,u=t.length;if(0!=u%2)throw Error("String of HEX type must be in byte increments");for(e=e||[0],s=(r=r||0)>>>3,n=0;n>>1)+s)>>>2;e.length<=o;)e.push(0);e[o]|=i<<8*(3+a%4*-1)}return{value:e,binLen:4*u+r}};break;case"TEXT":r=function(t,r,n){var i,o,a,s,u,f,c,l,h=0;if(r=r||[0],u=(n=n||0)>>>3,"UTF8"===e)for(l=3,a=0;a(i=t.charCodeAt(a))?o.push(i):2048>i?(o.push(192|i>>>6),o.push(128|63&i)):55296>i||57344<=i?o.push(224|i>>>12,128|i>>>6&63,128|63&i):(a+=1,i=65536+((1023&i)<<10|1023&t.charCodeAt(a)),o.push(240|i>>>18,128|i>>>12&63,128|i>>>6&63,128|63&i)),s=0;s>>2;r.length<=f;)r.push(0);r[f]|=o[s]<<8*(l+c%4*-1),h+=1}else if("UTF16BE"===e||"UTF16LE"===e)for(l=2,o="UTF16LE"===e||"UTF16LE"!==e&&!1,a=0;a>>8),f=(c=h+u)>>>2;r.length<=f;)r.push(0);r[f]|=i<<8*(l+c%4*-1),h+=2}return{value:r,binLen:8*h+n}};break;case"B64":r=function(t,e,r){var n,i,o,a,s,u,f,c=0;if(-1===t.search(/^[a-zA-Z0-9=+\/]+$/))throw Error("Invalid character in base-64 string");if(i=t.indexOf("="),t=t.replace(/\=/g,""),-1!==i&&i= 0 case 'testnet': return network.testnet.indexOf(at) >= 0 + case 'stagenet': + return network.stagenet.indexOf(at) >= 0 case 'both': - return network.prod.indexOf(at) >= 0 || network.testnet.indexOf(at) >= 0 + return network.prod.indexOf(at) >= 0 || network.testnet.indexOf(at) >= 0 || network.stagenet.indexOf(at) >= 0 default: return false } diff --git a/test/wallet_address_validator.js b/test/wallet_address_validator.js index d75a521d..4ae493ec 100644 --- a/test/wallet_address_validator.js +++ b/test/wallet_address_validator.js @@ -1,907 +1,1390 @@ var isNode = typeof module !== 'undefined' && typeof module.exports !== 'undefined' var chai = isNode ? require('chai') : window.chai, - expect = chai.expect + expect = chai.expect var WAValidator = isNode ? require('../src/wallet_address_validator') : window.WAValidator function valid(address, currency, networkType) { - var valid = WAValidator.validate(address, currency, networkType); - expect({ address, currency, valid }).to.deep.equal({ address, currency, valid: true }); + var valid = WAValidator.validate(address, currency, networkType); + expect({ address, currency, valid }).to.deep.equal({ address, currency, valid: true }); } function invalid(address, currency, networkType) { - var valid = WAValidator.validate(address, currency, networkType); - expect({ address, currency, valid }).to.deep.equal({ address, currency, valid: false }); + var valid = WAValidator.validate(address, currency, networkType); + expect({ address, currency, valid }).to.deep.equal({ address, currency, valid: false }); } describe('WAValidator.validate()', function () { - describe('valid results', function () { - it('should return true for correct bitcoin addresses', function () { - valid('12KYrjTdVGjFMtaxERSk3gphreJ5US8aUP', 'bitcoin'); - valid('12QeMLzSrB8XH8FvEzPMVoRxVAzTr5XM2y', 'bitcoin'); - valid('12QeMLzSrB8XH8FvEzPMVoRxVAzTr5XM2y', 'BTC'); - valid('12QeMLzSrB8XH8FvEzPMVoRxVAzTr5XM2y', 'Bitcoin'); - valid('12QeMLzSrB8XH8FvEzPMVoRxVAzTr5XM2y', 'btc'); - valid('12QeMLzSrB8XH8FvEzPMVoRxVAzTr5XM2y', 'btc', 'prod'); - valid('12QeMLzSrB8XH8FvEzPMVoRxVAzTr5XM2y', 'btc', 'both'); - valid('15uwigGExiNQxTNr1QSZYPXJMp9Px2YnVU', 'btc', 'prod'); - valid('3FyVFsEyyBPzHjD3qUEgX7Jsn4tcHNZFkn', 'btc', 'prod'); - valid('38mKdURe1zcQyrFqRLzR8PRao3iLGEPVsU', 'btc', 'prod'); - valid('mptPo5AvLzJXi4T82vR6g82fT5uJ6HsQCu', 'btc', 'both'); - valid('1oNLrsHnBcR6dpaBpwz3LSwutbUNkNSjs', 'bitcoin'); - valid('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef', 'bitcoin', 'testnet'); - valid('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef', 'bitcoin', 'both'); - - valid('1SQHtwR5oJRKLfiWQ2APsAd9miUc4k2ez'); - valid('116CGDLddrZhMrTwhCVJXtXQpxygTT1kHd'); - - // p2sh addresses - valid('3NJZLcZEEYBpxYEUGewU4knsQRn1WM5Fkt'); - valid('3NJZLcZEEYBpxYEUGewU4knsQRn1WM5Fkt', 'bitcoin'); - valid('2MxKEf2su6FGAUfCEAHreGFQvEYrfYNHvL7', 'bitcoin', 'testnet'); - - // regtest - valid('GSa5espVLNseXEfKt46zEdS6jrPkmFghBU', 'bitcoin', 'testnet'); - - // segwit addresses - valid('BC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3T4', 'bitcoin'); - valid('tb1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3q0sl5k7', 'bitcoin'); - valid('bc1pw508d6qejxtdg4y5r3zarvary0c5xw7kw508d6qejxtdg4y5r3zarvary0c5xw7k7grplx', 'bitcoin'); - valid('BC1SW50QA3JX3S', 'bitcoin'); - valid('bc1zw508d6qejxtdg4y5r3zarvaryvg6kdaj', 'bitcoin'); - valid('tb1qqqqqp399et2xygdj5xreqhjjvcmzhxw4aywxecjdzew6hylgvsesrxh6hy', 'bitcoin'); - - invalid("tc1qw508d6qejxtdg4y5r3zarvary0c5xw7kg3g4ty", 'bitcoin'), - invalid("bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t5", 'bitcoin'), - invalid("BC13W508D6QEJXTDG4Y5R3ZARVARY0C5XW7KN40WF2", 'bitcoin'), - invalid("bc1rw5uspcuh", 'bitcoin'), - invalid("bc10w508d6qejxtdg4y5r3zarvary0c5xw7kw508d6qejxtdg4y5r3zarvary0c5xw7kw5rljs90", 'bitcoin'), - invalid("BC1QR508D6QEJXTDG4Y5R3ZARVARYV98GJ9P", 'bitcoin'), - invalid("tb1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3q0sL5k7", 'bitcoin'), - invalid("bc1zw508d6qejxtdg4y5r3zarvaryvqyzf3du", 'bitcoin'), - invalid("tb1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3pjxtptv", 'bitcoin'), - invalid("bc1gmk9yu", 'bitcoin') - }); - - it('should return true for correct bitcoincash addresses', function () { - valid('12KYrjTdVGjFMtaxERSk3gphreJ5US8aUP', 'bitcoincash'); - valid('12QeMLzSrB8XH8FvEzPMVoRxVAzTr5XM2y', 'bitcoincash'); - valid('12QeMLzSrB8XH8FvEzPMVoRxVAzTr5XM2y', 'BCH'); - valid('12QeMLzSrB8XH8FvEzPMVoRxVAzTr5XM2y', 'Bitcoin'); - valid('12QeMLzSrB8XH8FvEzPMVoRxVAzTr5XM2y', 'bch'); - valid('12QeMLzSrB8XH8FvEzPMVoRxVAzTr5XM2y', 'bch', 'prod'); - valid('12QeMLzSrB8XH8FvEzPMVoRxVAzTr5XM2y', 'bch', 'both'); - valid('1oNLrsHnBcR6dpaBpwz3LSwutbUNkNSjs', 'bitcoincash'); - valid('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef', 'bitcoincash', 'testnet'); - valid('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef', 'bitcoincash', 'both'); - - // p2sh addresses - valid('3NJZLcZEEYBpxYEUGewU4knsQRn1WM5Fkt', 'bitcoincash'); - valid('2MxKEf2su6FGAUfCEAHreGFQvEYrfYNHvL7', 'bitcoincash', 'testnet'); - - valid('bitcoincash:qq4v32mtagxac29my6gwj6fd4tmqg8rysu23dax807', 'bch'); - - }); - - it('should return true for correct litecoin addresses', function () { - valid('LVg2kJoFNg45Nbpy53h7Fe1wKyeXVRhMH9', 'litecoin'); - valid('LVg2kJoFNg45Nbpy53h7Fe1wKyeXVRhMH9', 'LTC'); - valid('LTpYZG19YmfvY2bBDYtCKpunVRw7nVgRHW', 'litecoin'); - valid('Lb6wDP2kHGyWC7vrZuZAgV7V4ECyDdH7a6', 'litecoin'); - valid('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef', 'litecoin', 'testnet'); - - // p2sh addresses - valid('3NJZLcZEEYBpxYEUGewU4knsQRn1WM5Fkt', 'litecoin'); - valid('2MxKEf2su6FGAUfCEAHreGFQvEYrfYNHvL7', 'litecoin', 'testnet'); - valid('QW2SvwjaJU8LD6GSmtm1PHnBG2xPuxwZFy', 'litecoin', 'testnet'); - valid('QjpzxpbLp5pCGsCczMbfh1uhC3P89QZavY', 'litecoin', 'testnet'); - }); - - it('should return true for correct peercoin addresses', function () { - valid('PHCEsP6od3WJ8K2WKWEDBYKhH95pc9kiZN', 'peercoin'); - valid('PSbM1pGoE9dnAuVWvpQqTTYVpKZU41dNAz', 'peercoin'); - valid('PUULeHrJL2WujJkorc2RsUAR3SardKUauu', 'peercoin'); - valid('PUULeHrJL2WujJkorc2RsUAR3SardKUauu', 'PPC'); - valid('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef', 'peercoin', 'testnet'); - - // p2sh addresses - valid('pNms4CaWqgZUxbNZaA1yP2gPr3BYnez9EM', 'peercoin'); - valid('2MxKEf2su6FGAUfCEAHreGFQvEYrfYNHvL7', 'peercoin', 'testnet'); - }); - - it('should return true for correct dogecoin addresses', function () { - valid('DPpJVPpvPNP6i6tMj4rTycAGh8wReTqaSU', 'dogecoin'); - valid('DNzLUN6MyYVS5zf4Xc2yK69V3dXs6Mxia5', 'dogecoin'); - valid('DPS6iZj7roHquvwRYXNBua9QtKPzigUUhM', 'dogecoin'); - valid('DPS6iZj7roHquvwRYXNBua9QtKPzigUUhM', 'DOGE'); - //TODO: NEED A DOGECOIN TESTNET ADDRESS - - //p2sh addresses - valid('A7JjzK9k9x5b2MkkQzqt91WZsuu7wTu6iS', 'dogecoin'); - valid('2MxKEf2su6FGAUfCEAHreGFQvEYrfYNHvL7', 'dogecoin', 'testnet'); - }); - - it('should return true for correct beavercoin addresses', function () { - valid('BPPtB4EpPi5wCaGXZuNyKQgng8ya579qUh', 'beavercoin'); - valid('BC1LLYoE4mTCHTJhVYvLGxhRTwAHyWTQ49', 'beavercoin'); - valid('BBuyeg2vjtyFdMNj3LTxuVra4wJMKVAY9C', 'beavercoin'); - valid('BBuyeg2vjtyFdMNj3LTxuVra4wJMKVAY9C', 'BVC'); - valid('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef', 'beavercoin', 'testnet'); - - // p2sh addresses - valid('3NJZLcZEEYBpxYEUGewU4knsQRn1WM5Fkt', 'beavercoin'); - valid('2MxKEf2su6FGAUfCEAHreGFQvEYrfYNHvL7', 'beavercoin', 'testnet'); - }); - - it('should return true for correct freicoin addresses', function () { - valid('1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa', 'freicoin'); - valid('1oNLrsHnBcR6dpaBpwz3LSwutbUNkNSjs', 'freicoin'); - valid('1SQHtwR5oJRKLfiWQ2APsAd9miUc4k2ez', 'freicoin'); - valid('1SQHtwR5oJRKLfiWQ2APsAd9miUc4k2ez', 'FRC'); - valid('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef', 'freicoin', 'testnet'); - - // p2sh addresse - valid('3NJZLcZEEYBpxYEUGewU4knsQRn1WM5Fkt', 'freicoin'); - valid('2MxKEf2su6FGAUfCEAHreGFQvEYrfYNHvL7', 'freicoin', 'testnet'); - }); - - it('should return true for correct protoshares addresses', function () { - valid('PaNGELmZgzRQCKeEKM6ifgTqNkC4ceiAWw', 'protoshares'); - valid('Piev8TMX2fT5mFtgxx2TXJaqXP37weMPuD', 'protoshares'); - valid('PgsuLoe9ojRKFGJGVpqqk37gAqNJ4ozboD', 'protoshares'); - valid('PgsuLoe9ojRKFGJGVpqqk37gAqNJ4ozboD', 'PTS'); - valid('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef', 'protoshares', 'testnet'); - - //p2sh addresses - valid('3NJZLcZEEYBpxYEUGewU4knsQRn1WM5Fkt', 'protoshares'); - valid('2MxKEf2su6FGAUfCEAHreGFQvEYrfYNHvL7', 'protoshares', 'testnet'); - }); - - it('should return true for correct megacoin addresses', function () { - valid('MWUHaNxjXGZUYTh92i3zuDmsnH1rHSBk5M', 'megacoin'); - valid('MSAkrhRyte7bz999Ga5SqYjzypFFYa2oEb', 'megacoin'); - valid('MLUTAtDQFcfo1QACWocLuufFq5fBDTpCHE', 'megacoin'); - valid('MLUTAtDQFcfo1QACWocLuufFq5fBDTpCHE', 'MEC'); - valid('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef', 'megacoin', 'testnet'); - - //p2sh addresses - valid('3NJZLcZEEYBpxYEUGewU4knsQRn1WM5Fkt', 'megacoin'); - valid('2MxKEf2su6FGAUfCEAHreGFQvEYrfYNHvL7', 'megacoin', 'testnet'); - }); - - it('should return true for correct primecoin addresses', function () { - valid('AVKeiZ5JadfWdH2EYVgVRfX4ufoyd4ehuM', 'primecoin'); - valid('AQXBRPyob4dywUJ21RUKrR1xetQCDVenKD', 'primecoin'); - valid('ANHfTZnskKqaBU7oZuSha9SpbHU3YBfeKf', 'primecoin'); - valid('AYdiYMKSGYxLcZNDmqB8jNcck7SQibrfiK', 'primecoin'); - valid('AYdiYMKSGYxLcZNDmqB8jNcck7SQibrfiK', 'XPM'); - valid('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef', 'primecoin', 'testnet'); - - //p2sh addresses - valid('af5CvTQq7agDh717Wszb5QDbWb7nT2mukP', 'primecoin'); - valid('2MxKEf2su6FGAUfCEAHreGFQvEYrfYNHvL7', 'primecoin', 'testnet'); - }); - - it('should return true for correct auroracoin addresses', function () { - valid('ARM3GLZXF1PDTZ5vz3wh5MVahbK9BHTWAN', 'auroracoin'); - valid('AUtfc6ThCLb7FuEu7QPrWpJuaXaJRPciDF', 'auroracoin'); - valid('AUN1oaj5hjispGnczt8Aruw3TxgGyRqB3V', 'auroracoin'); - valid('AXGcBkGX6NiaDXj85C5dCrhTRUgwxSkKDK', 'auroracoin'); - valid('AXGcBkGX6NiaDXj85C5dCrhTRUgwxSkKDK', 'AUR'); - valid('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef', 'auroracoin', 'testnet'); - - //p2sh addresses - valid('3NJZLcZEEYBpxYEUGewU4knsQRn1WM5Fkt', 'auroracoin'); - valid('2MxKEf2su6FGAUfCEAHreGFQvEYrfYNHvL7', 'auroracoin', 'testnet'); - }); - - it('should return true for correct namecoin addresses', function () { - valid('NEpeRmS775fnti8TDgJA28m8KLEfNNRZvT', 'namecoin'); - valid('MyJ691bGJ48RBK2LS8n1U57wcFLFScFXxi', 'namecoin'); - valid('NFY9aw1RXLGtWpeqgNQXprnUcZXyKNinTh', 'namecoin'); - valid('NCPPc7Pzb75CpRPJQPRRh6ouJTq7BCy1H4', 'namecoin'); - valid('NCPPc7Pzb75CpRPJQPRRh6ouJTq7BCy1H4', 'NMC'); - }); - - it('should return true for correct BioCoin addresses', function () { - valid('B7xseoLGk7hEpMDDeSvZDKmmiAMHWiccok', 'biocoin'); - valid('B8zjmYFGhWmiaQSJshfrnefE72xCapCkvo', 'biocoin'); - valid('muH8LL42DiMs8GEQ6Grfi8KUw2uFvuKr1J', 'biocoin', 'testnet'); - valid('muH8LL42DiMs8GEQ6Grfi8KUw2uFvuKr1J', 'BIO', 'testnet'); - valid('B8zjmYFGhWmiaQSJshfrnefE72xCapCkvo', 'BIO'); - }); - - it('should return true for correct Garlicoin addresses', function () { - valid('GU2NtcNotWFiZjTp2Vdgf5CjeMfgsWYCua', 'garlicoin'); - valid('GNWeWaoQ6rv21ZFjJWT9vb91hXUzFTLkru', 'garlicoin'); - valid('mjKbQTkgwzmsL3J86tdVzhyW9pc4NePqTb', 'garlicoin', 'testnet'); - valid('mnYp36NuyRavMKQ9Q9Q6oGqoorAs9p3zYn', 'GRLC', 'testnet'); - valid('GU2NtcNotWFiZjTp2Vdgf5CjeMfgsWYCua', 'GRLC'); - }); - - it('should return true for correct Vertcoin addresses', function () { - valid('3PgeyhEJEnS5CeBu3iFcu3JHVKemeHx1AW', 'VTC'); - valid('353nERPQKhGj4WGzoiWcareA76TPgRCVNA', 'VTC'); - valid('376g4TmL8uQKFYsRFrbv5iz9srmb5bocEt', 'VTC'); - valid('3AMtM4Zk5oNHu9i4jDiwKB6Kg5YEReBsav', 'VTC'); - - valid('VmoMjGf3zgZLy8sk3PMKd3xikZHXWvnYi7', 'vertcoin'); - valid('VmhHwXr3J8xMZpy62WuBGpu3xVvThWzcTQ', 'vertcoin'); - valid('mvww6DEJ18dbyQUukpVQXvLgrNDJazZn1Y', 'vertcoin', 'testnet'); - valid('mn3mdEE6cf1snxVsknNz4GRTdSrWXqYp7c', 'VTC', 'testnet'); - valid('Vri6Q4GgNFfdtcpxD961TotJwaSaYQCaL5', 'VTC'); - }); - - it('should return true for correct BitcoinGold addresses', function () { - valid('GW3JrQyHtoVfEFES3Y9JagiX3VSKQStLwj', 'bitcoingold'); - valid('GUDWdeMyAXQbrNFFivAhkJQ1GfBCFdc7JF', 'bitcoingold'); - valid('mvww6DEJ18dbyQUukpVQXvLgrNDJazZn1Y', 'bitcoingold', 'testnet'); - valid('mn3mdEE6cf1snxVsknNz4GRTdSrWXqYp7c', 'BTG', 'testnet'); - valid('GSNFPRsdaM3MXrU5HW1AxgFwmUQC8HXK9F', 'BTG'); - }); - - it('should return true for correct Decred addresses', function () { - valid('Dsesax2GJnMN4wwmWo5rJGq73dDK217Rh85', 'DCR'); - valid('DsYuxtvGRfN8rncXAndtLUpJm55F77K17RA', 'decred'); - valid('DsaXDG2NrJW8g4tFAb8n9MNx81Sn3Qc8AEV', 'decred'); - valid('TsijUgejaRnLKF5WAbpUxNtwKGUiKVeXLr7', 'decred', 'testnet'); - valid('TsZ9QmAoadF12hGvyALp6qvaF4be3BmLqG9', 'dcr', 'testnet'); - }); - - it('should return true for correct Digibyte addresses', function () { - valid('DG2rM2orU2JH5i4ACh3AKNpRTNESdv5xf8', 'DGB'); - valid('DBR2Lj1F17eHGHXgbpae2Wb4m39bDyA1qo', 'DGB'); - valid('D9TDZTR9Z9Mx2NoDJnhqhnYhDLKRAmsL9n', 'digibyte'); - valid('DHRzA1YHA1kFWpz2apRckZJy6KZRyGq4EV', 'digibyte'); - valid('DJ53hTyLBdZp2wMi5BsCS3rtEL1ioYUkva', 'digibyte'); - }); - - it('should return true for correct Ethereum addresses', function () { - valid('0xE37c0D48d68da5c5b14E5c1a9f1CFE802776D9FF', 'ethereum'); - valid('0xa00354276d2fC74ee91e37D085d35748613f4748', 'ethereum'); - valid('0xAff4d6793F584a473348EbA058deb8caad77a288', 'ETH'); - valid('0xc6d9d2cd449a754c494264e1809c50e34d64562b', 'ETH'); - valid('0x52908400098527886E0F7030069857D2E4169EE7', 'ETH'); - valid('0x8617E340B3D01FA5F11F306F4090FD50E238070D', 'ETH'); - valid('0xde709f2102306220921060314715629080e2fb77', 'ETH'); - valid('0x27b1fdb04752bbc536007a920d24acb045561c26', 'ETH'); - valid('0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed', 'ETH'); - valid('0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359', 'ETH'); - valid('0xdbF03B407c01E7cD3CBea99509d93f8DDDC8C6FB', 'ETH'); - valid('0xD1220A0cf47c7B9Be7A2E6BA89F429762e7b9aDb', 'ETH'); - - valid('0xD1220A0cf47c7B9Be7A2E6BA89F429762e7b9aDb', 'ethereumclassic'); - valid('0xD1220A0cf47c7B9Be7A2E6BA89F429762e7b9aDb', 'ETC'); - valid('0xD1220A0cf47c7B9Be7A2E6BA89F429762e7b9aDb', 'etherzero'); - valid('0xD1220A0cf47c7B9Be7A2E6BA89F429762e7b9aDb', 'ETZ'); - valid('0xD1220A0cf47c7B9Be7A2E6BA89F429762e7b9aDb', 'callisto'); - valid('0xD1220A0cf47c7B9Be7A2E6BA89F429762e7b9aDb', 'CLO'); - }); - - it('should return true for correct Ripple addresses', function () { - valid('rG1QQv2nh2gr7RCZ1P8YYcBUKCCN633jCn', 'ripple'); - valid('rG1QQv2nh2gr7RCZ1P8YYcBUKCCN633jCn', 'XRP'); - valid('r3kmLJN5D28dHuH8vZNUZpMC43pEHpaocV', 'XRP'); - valid('rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh', 'XRP'); - valid('rDTXLQ7ZKZVKz33zJbHjgVShjsBnqMBhmN', 'XRP'); - }); - - it('should return true for correct dash addresses', function () { - valid('Xx4dYKgz3Zcv6kheaqog3fynaKWjbahb6b', 'dash'); - valid('XcY4WJ6Z2Q8w7vcYER1JypC8s2oa3SQ1b1', 'DASH'); - valid('XqMkVUZnqe3w4xvgdZRtZoe7gMitDudGs4', 'dash'); - valid('yPv7h2i8v3dJjfSH4L3x91JSJszjdbsJJA', 'dash', 'testnet'); - valid('XoAAqv3oUYZ6xRjX3brfbf9PotrGanS6Th', 'dash'); - valid('yP5oXZQXBfBf9FyfZDpFiKDypxuNUKUV2E', 'dash', 'testnet'); - }); - - it('should return true for correct neo addresses', function () { - valid('AR4QmqYENiZAD6oXe7ftm6eDcwtHk7rVTT', 'neo'); - valid('AKDVzYGLczmykdtRaejgvWeZrvdkVEvQ1X', 'NEO'); - }); - - it('should return true for correct neo gas addresses', function () { - valid('AR4QmqYENiZAD6oXe7ftm6eDcwtHk7rVTT', 'neogas'); - }); - - it('should return true for correct qtum addresses', function () { - valid('QNjUiD3bVVZwYTc5AhpeQbS1mfb2guyWhe', 'qtum'); - valid('QVZnSrMwKp6AL4FjUPPnfFgsma6j1DXQXu', 'QTUM'); - valid('MCgyroQse81wuv5RwPpY5DXDNxeafzLFJ8', 'QTUM'); - valid('QQYySVc5WEe3g6PnNFYmspqG5CfSG8rnma', 'QTUM'); - valid('MSvJQBJMZs1dhxz7UAWa2si4iyMD2FHQd5', 'QTUM'); - - valid('qcSLSxN1sngCWSrKFZ6UC7ri4hhVSdq9SU', 'qtum', 'testnet'); - valid('qJnbEdrm9ybjVqDCaX5SWNBHmZy2X7YbPT', 'qtum', 'testnet'); - valid('qchBPDUYswobzpDmY5DsTStt74sTYQtaQv', 'qtum', 'testnet'); - }); - - it('should return true for correct votecoin addresses', function () { - valid('t1U9yhDa5XEjgfnTgZoKddeSiEN1aoLkQxq', 'votecoin'); - valid('t3Vz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd', 'VOT'); - valid('t2UNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'votecoin', 'testnet'); - }); - - it('should return true for correct bitcoinz addresses', function () { - valid('t1U9yhDa5XEjgfnTgZoKddeSiEN1aoLkQxq', 'bitcoinz'); - valid('t3Vz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd', 'BTCZ'); - valid('t2UNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'bitcoinz', 'testnet'); - }); - - it('should return true for correct zclassic addresses', function () { - valid('t1U9yhDa5XEjgfnTgZoKddeSiEN1aoLkQxq', 'zclassic'); - valid('t3Vz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd', 'ZCL'); - valid('t2UNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'zclassic', 'testnet'); - }); - - it('should return true for correct hush addresses', function () { - valid('t1U9yhDa5XEjgfnTgZoKddeSiEN1aoLkQxq', 'hush'); - valid('t3Vz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd', 'HUSH'); - valid('t2UNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'hush', 'testnet'); - }); - - it('should return true for correct zcash addresses', function () { - valid('t1U9yhDa5XEjgfnTgZoKddeSiEN1aoLkQxq', 'zcash'); - valid('t3Vz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd', 'ZEC'); - valid('t2UNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'zcash', 'testnet'); - }); - - it('should return true for correct bitcoinprivate addresses', function () { - valid('b1M4XXPFhwMb1SP33yhzn3h9qWXjujkgep4', 'bitcoinprivate'); - //valid('bx....', 'BTCP'); - //valid('nx....', 'bitcoinprivate', 'testnet'); - }); - - it('should return true for correct snowgem addresses', function () { - valid('s1fx7WBkjB4UH6qQjPp6Ysmtr1C1JiTK2Yw', 'snowgem'); - valid('s3d27MhkBRt3ha2UuxhjXaYF4DCnttTMnL1', 'SNG'); - valid('t2UNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'snowgem', 'testnet'); - }); - - it('should return true for correct zencash addresses', function () { - valid('znhiGGfYRepxkBjXYvA2kFrXiC351i9ta4z', 'zencash'); - valid('zssEdGnZCQ9G86LZFtbynMn1hYTVhn6eYCL', 'ZEN'); - valid('ztmWMDLWjbruCJxKmmfAZiT6QAQdiv5F291', 'zencash', 'testnet'); - }); - - it('should return true for correct komodo addresses', function () { - valid('R9R5HirAzqDcWrWGiJEL115dpV3QB3hobH', 'komodo'); - valid('RAvj2KKVUohTu3hVdNJ4U6hQi7TNawpacH', 'KMD'); - //valid('t2UNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'komodo', 'testnet'); - }); - - it('should return true for correct Bankex addresses', function () { - valid('0xeac39e1bc802baae3d4b9cb518f3f60374bbad6c', 'bankex'); - valid('0x45245bc59219eeaaf6cd3f382e078a461ff9de7b', 'BKX'); - valid('0xf40d80FCfa5cdEa0bB1E570c2D52132ac9bC6aEC', 'bankex', 'testnet'); - valid('0x8A7395f281EeCf2B471B689E87Cf4C7fa8bb957d', 'BKX', 'testnet'); - }); - - - it('should return true for correct Cardano addresses', function () { - valid( 'Ae2tdPwUPEYzs5BRbGcoS3DXvK8mwgggmESz4HqUwMyaS9eNksZGz1LMS9v', 'ada'); - valid('Ae2tdPwUPEYxYNJw1He1esdZYvjmr4NtPzUsGTiqL9zd8ohjZYQcwu6kom7', 'cardano'); - valid('DdzFFzCqrhsfdzUZxvuBkhV8Lpm9p43p9ubh79GCTkxJikAjKh51qhtCFMqUniC5tv5ZExyvSmAte2Du2tGimavSo6qSgXbjiy8qZRTg', 'ada'); - valid('Ae2tdPwUPEZKmwoy3AU3cXb5Chnasj6mvVNxV1H11997q3VW5ihbSfQwGpm', 'ada'); - valid('4swhHtxKapQbj3TZEipgtp7NQzcRWDYqCxXYoPQWjGyHmhxS1w1TjUEszCQT1sQucGwmPQMYdv1FYs3d51KgoubviPBf', 'cardano'); - }); - - it('should return true for correct monero addresses', function () { - valid('47zQ5LAivg6hNCgijXSEFVLX7mke1bgM6YGLFaANDoJbgXDymcAAZvvMNt2PmMpqEe5qRy2zyfMYXdwpmdyitiFh84xnPG2', 'monero'); - valid('48bWuoDG75CXMDHbmPEvUF2hm1vLDic7ZJ7hqRkL65QR9p13AQAX4eEACXNk4YP115Q4KRVZnAvmMBHrcGfv9FvKPZnH6vH', 'XMR'); - valid('88WB4JKdQVhWfkc8cBT9EEJ6vejSAqKJHbV1dXBAXdpgQovtNDNRxfKCS7wB8rHQ5D5zH2Pd1YkyMNNQDie6ZfeZ311fPgn', 'XMR'); - valid('A2be3UvzMtkJtxRYgcCbQt2y7Rp2eLVGqNTWfZeankrWimSMM4y7uMP6B9oAZaHsXTj8KFSerkSkkVRuEuEca9QM8VhxCNU', 'monero', 'testnet'); - - //integrated addresses - valid('4Gd4DLiXzBmbVX2FZZ3Cvu6fUaWACup1qDowprUCje1kSP4FmbftiJMSfV8kWZXNqmVwj4m52xqtgFNUudVmsmGkGvkLcCibWfVUfUFVB7', 'monero'); - valid('4J5sF94AzXgFgx8LuWc9dcWkJkGkD3cL3L2AuhX6QA9jFvSxxj6QhHqHXqM2b2Go7G8RyDzEbHxYd9G26XUUbuJChipEyBz9fENMU2Ua9b', 'XMR'); - - valid('9uXRFi4PZMqhsnthBF6bGdfVnBSZtfKkR7Td8qPM7jUKZeTfR1tLhCoTLqYNE12xuiQg3aWGiLw83bWsqwTRLaM4Jk47xYM', 'XMR', 'testnet'); - valid('9tFTaQM39JXhULZsHauPHhjFrjcGSGXoijEPYoRgAky9Veck2mFp3EifQ2tKHmEHuuUoFfgYRNR2bVaborz5oi8JA8xkqjY', 'monero', 'testnet') - }); - - it('should return true for correct gamecredits addresses', function () { - valid('GU5BBtW9gxSKvAknvFi9yUaXKUNW9zUN2p', 'game'); - valid('GYxQMVzP6YpzX59QNRYqmJeHNtUMYSZPri', 'game'); - }); - - it('should return true for correct monacoin addresses', function () { - valid('MMN1Q1aRVUzanmg9DJjcRYzQSJQoBeQPui', 'mona'); - valid('PFMzNYnBm5X4c9qJkJPkfgdCyd9fuuy2vT', 'mona'); - valid('PCtN7VUYHW8w4g59BaphrfPs8g7pNgAzxn', 'mona'); - valid('MXCcYFGRmsd4d3CcQugFiqG8uarj5tVu76', 'mona'); - valid('MNK1pGsBf9WdoE54fZM9VFhkeYHW6VUf2u', 'mona'); - }); - - it('should return true for correct pivx addresses', function () { - valid('DJXFW9oJJBUX7QKrG6GKvmTs63MYKzwtpZ', 'pivx'); - valid('DEaYb8EHQgyKvX6VXDS3DZQautJrHBmK3T', 'pivx'); - valid('DDeCGR3QSgqsBxVR23bJvteiyYE34ZmxAc', 'pivx'); - valid('DSqQM8DPpBHHoZXHgRdwmaf6hZPEoZcFkh', 'pivx'); - }); - - it('should return true for correct solarcoin addresses', function () { - valid('8VxVLzwB26E2YZZ82o1NcQe96QSM2z6GwW', 'slr'); - valid('8YW5qcTjeyqX5kESsqu2BUdXiedgssegtQ', 'SolarCoin'); - }); - - it('should return true for correct tether addresses', function () { - valid('3MbYQMMmSkC3AgWkj9FMo5LsPTW1zBTwXL', 'usdt'); - valid('1KdXaqcBeoMAFVAPwTmYvDbEq6RnvNPF6J', 'tether'); - }); - - it('should return true for correct expanse addresses', function () { - valid('0xbab463743603a253bdf1f84975b1a9517505ae05', 'exp'); - valid('0x5d0777cb5d6977873904864c6ab531f4b3261f0b', 'expanse'); - }); - - it('should return true for correct waves addresses', function () { - valid('3P93mVrYnQ4ahaRMYwA2BeWY32eDxTpLVEs', 'waves'); - valid('3P4eeU7v1LMHQFwwT2GW9W99c6vZyytHajj', 'waves'); - - valid('3Myrq5QDgRq3nBVRSSv9UYrP36xTtpJND5y', 'waves', 'testnet'); - valid('3My3KZgFQ3CrVHgz6vGRt8687sH4oAA1qp8', 'waves', 'testnet'); - }); - - it('should return true for correct nano addresses', function () { - valid('xrb_3t6k35gi95xu6tergt6p69ck76ogmitsa8mnijtpxm9fkcm736xtoncuohr3', 'nano'); - valid('xrb_13ezf4od79h1tgj9aiu4djzcmmguendtjfuhwfukhuucboua8cpoihmh8byo', 'nano'); - valid('xrb_35jjmmmh81kydepzeuf9oec8hzkay7msr6yxagzxpcht7thwa5bus5tomgz9', 'nano'); - valid('xrb_1111111111111111111111111111111111111111111111111111hifc8npp', 'nano'); - valid('xrb_1ipx847tk8o46pwxt5qjdbncjqcbwcc1rrmqnkztrfjy5k7z4imsrata9est', 'nano'); - valid('xrb_3wm37qz19zhei7nzscjcopbrbnnachs4p1gnwo5oroi3qonw6inwgoeuufdp', 'nano'); - valid('xrb_3arg3asgtigae3xckabaaewkx3bzsh7nwz7jkmjos79ihyaxwphhm6qgjps4', 'nano'); - valid('xrb_1f5e4w33ndqbkx4bw5jtp13kp5xghebfxcmw9hdt1f7goid1s4373w6tjmgu', 'nano'); - valid('xrb_1q79ahdr36uqn38p5tp5sqwkn73rnpj1k8obtuetdbjcx37d5gahhd1u9cuh', 'nano'); - valid('nano_1q79ahdr36uqn38p5tp5sqwkn73rnpj1k8obtuetdbjcx37d5gahhd1u9cuh', 'nano'); - }); - - it('should return true for correct siacoin addresses', function () { - valid( - 'a9b01c85163638682b170d82de02b8bb99ba86092e9ab1b0d25111284fe618e93456915820f1', - 'siacoin' - ) - valid( - 'a9b01c85163638682b170d82de02b8bb99ba86092e9ab1b0d25111284fe618e93456915820f1', - 'siacoin' - ) - valid( - 'ab0c327982abfcc6055a6c9551589167d8a73501aca8769f106371fbc937ad100c955c3b7ba9', - 'siacoin' - ) - valid( - 'ffe1308c044ade30392a0cdc1fd5a4dbe94f9616a95faf888ed36123d9e711557aa497530373', - 'siacoin' - ) - }) - - it('should return true for correct loki addresses', function () { - // public - valid( - 'L63ymg8cb5aRz1PhXrEQ22PWw9KBhBS8rMsgqbABhTGFfh53U3Rc2iWCJpCPsHZT5hfyt7fPQa612a5Z1tBnGYEA9h6YHnn', - 'loki' - ) - valid( - 'L5QKRGMNpQU3eCAdjMVTCR631bRKqnW1oEWWBEHAtFJLieA5VvuxyyubCd9FczEEatg8jfy39UJZ13npLJqZG6dtMtM99ha', - 'loki' - ) - // integrated - valid( - 'LK8CGQ17G9R3ys3Xf33wCeViD2B95jgdpjAhcRsjuheJ784dumXn7g3RPAzedWpFq364jJKYL9dkQ8mY66sZG9BiD1xbPb6dpYo7toNRqk', - 'loki' - ) - valid( - 'LK8CGQ17G9R3ys3Xf33wCeViD2B95jgdpjAhcRsjuheJ784dumXn7g3RPAzedWpFq364jJKYL9dkQ8mY66sZG9BiCtWq1AYo1oJTVqgUcQ', - 'loki' - ) - // subaddress - valid( - 'LW1VMYcvWPZZJ2h1pKGEku2y9WeDiAU2VhgrgVgvjybaRuCdcEkg6FhXjVNSd37Bp7fhYH8tVa5T9VmRaYiWyxYdCpEGBg8', - 'loki' - ) - }) - - it('should return true for correct lbry addresses', function () { - valid('bDb6NmobyDVeNGpizWQQBZkYjKCRQBdKdG', 'LBC') - valid('bTFXPcV3a8iVDezogvHTHezWZ1mZGWpPDc', 'lbc') - valid('bK2uEVn6UuwjCTUZ1Dfj5HhWYi9BtqZDDm', 'lbc') - valid('bNEMVqeUZUqTrYUxud5ehnUhtTAiWDXQ5e', 'lbc') - }) - - it('should return true for correct trx addresses', function () { - valid('TNDzfERDpxLDS2w1q6yaFC7pzqaSQ3Bg3r', 'trx'); - valid('27bLJCYjbH6MT8DBF9xcrK6yZnm43vx7MNQ', 'trx', 'testnet'); - }); - - it('should return true for correct nem addresses', function () { - valid('NBZMQO7ZPBYNBDUR7F75MAKA2S3DHDCIFG775N3D', 'xem'); - valid('TDWTRGT6GVWCV7GRWFNI45S53PGOJBKNUF3GE6PB', 'xem', 'testnet'); - }); - - it('should return true for correct lsk addresses', function () { - valid('469226551L', 'lsk'); - valid('15823701926930889868L', 'lsk'); - valid('1657699692452120239L', 'lsk'); - valid('555666666999992L', 'lsk'); - valid('6853061742992593192L', 'lsk'); - valid('530464791801L', 'lsk'); - }); - - it('should return true for correct bsv addresses', function () { - valid('qzwryn9fxnpqkf7zt878tp2g9cg8kpl65qh2ml0w0r', 'bsv'); - valid('qp65yngy5uds4wxtrkynptal4f76qzmrh52pa3mpaf', 'bsv'); - valid('bitcoincash:qq4v32mtagxac29my6gwj6fd4tmqg8rysu23dax807', 'bsv'); - valid('qq4v32mtagxac29my6gwj6fd4tmqg8rysu23dax807', 'bsv'); - valid('qz97s7ee0rvwlymtxrwafmvs87x6027jwuf3wepug7', 'bsv'); - valid('bitcoincash:qpp32ssez340wfspnt79h6c4xds4fzf3m5j0cplx0l', 'bsv'); - valid('qqg82u7tq2eahs3gkh9m6kjnmjehr69m5v37alepq4', 'bsv'); - valid('bitcoincash:qrwkk9a3es2wu7mdvzh0vekfvjuzysq8tv7r3hcwr5', 'bsv'); - valid('1DrNXqCj2B8FKyx66RAWDkiEJhw2yrvhT3', 'bsv'); - }); - - it('should return true for correct stellar addresses', function () { - valid('GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB', 'stellar'); - valid('GB7KKHHVYLDIZEKYJPAJUOTBE5E3NJAXPSDZK7O6O44WR3EBRO5HRPVT', 'stellar'); - valid('GD6WVYRVID442Y4JVWFWKWCZKB45UGHJAABBJRS22TUSTWGJYXIUR7N2', 'stellar'); - valid('GBCG42WTVWPO4Q6OZCYI3D6ZSTFSJIXIS6INCIUF23L6VN3ADE4337AP', 'stellar'); - valid('GDFX463YPLCO2EY7NGFMI7SXWWDQAMASGYZXCG2LATOF3PP5NQIUKBPT', 'stellar'); - valid('GBXEODUMM3SJ3QSX2VYUWFU3NRP7BQRC2ERWS7E2LZXDJXL2N66ZQ5PT', 'stellar'); - valid('GAJHORKJKDDEPYCD6URDFODV7CVLJ5AAOJKR6PG2VQOLWFQOF3X7XLOG', 'stellar'); - valid('GACXQEAXYBEZLBMQ2XETOBRO4P66FZAJENDHOQRYPUIXZIIXLKMZEXBJ', 'stellar'); - valid('GDD3XRXU3G4DXHVRUDH7LJM4CD4PDZTVP4QHOO4Q6DELKXUATR657OZV', 'stellar'); - valid('GDTYVCTAUQVPKEDZIBWEJGKBQHB4UGGXI2SXXUEW7LXMD4B7MK37CWLJ', 'stellar'); - }); - - it('should return true for correct xtz(tezos) address', function () { - valid('tz1Lhf4J9Qxoe3DZ2nfe8FGDnvVj7oKjnMY6', 'xtz'); - valid('tz1PyxsQ7xVTa5J7gtBeT7pST5Zi5nk5GSjg', 'xtz'); - valid('tz1LcuQHNVQEWP2fZjk1QYZGNrfLDwrT3SyZ', 'xtz'); - valid('tz1Lhf4J9Qxoe3DZ2nfe8FGDnvVj7oKjnMY6', 'xtz'); - valid('tz1RR6wETy9BeXG3Fjk25YmkSMGHxTtKkhpX', 'xtz'); - valid('tz1h3rQ8wBxFd8L9B3d7Jhaawu6Z568XU3xY', 'xtz'); - valid('KT1EM2LvxxFGB3Svh9p9HCP2jEEYyHjABMbK', 'xtz'); - }); - - it('should return true for correct eos addresses', function () { - valid('bittrexacct1', 'eos'); - valid('binancecleos', 'eos'); - valid('123456789012', 'eos'); - }); - }); - - describe('invalid results', function () { - function commonTests(currency) { - invalid('', currency); //reject blank - invalid('%%@', currency); //reject invalid base58 string - invalid('1A1zP1ePQGefi2DMPTifTL5SLmv7DivfNa', currency); //reject invalid address - invalid('bd839e4f6fadb293ba580df5dea7814399989983', currency); //reject transaction id's - //testnet - invalid('', currency, 'testnet'); //reject blank - invalid('%%@', currency, 'testnet'); //reject invalid base58 string - invalid('1A1zP1ePQGefi2DMPTifTL5SLmv7DivfNa', currency, 'testnet'); //reject invalid address - invalid('bd839e4f6fadb293ba580df5dea7814399989983', currency, 'testnet'); //reject transaction id's - } - - it('should return false for incorrect bitcoin addresses', function () { - commonTests('bitcoin'); - }); - - it('should return false for incorrect bitcoincash addresses', function () { - commonTests('bitcoincash'); - }); - - it('should return false for incorrect litecoin addresses', function () { - commonTests('litecoin'); - }); - - it('should return false for incorrect peercoin addresses', function () { - commonTests('peercoin'); - }); - - it('should return false for incorrect dogecoin addresses', function () { - commonTests('dogecoin'); - }); - - it('should return false for incorrect beavercoin addresses', function () { - commonTests('beavercoin'); - }); - - it('should return false for incorrect freicoin addresses', function () { - commonTests('freicoin'); - }); - - it('should return false for incorrect protoshares addresses', function () { - commonTests('protoshares'); - }); - - it('should return false for incorrect megacoin addresses', function () { - commonTests('megacoin'); - }); - - it('should return false for incorrect primecoin addresses', function () { - commonTests('primecoin'); - }); - - it('should return false for incorrect auroracoin addresses', function () { - commonTests('auroracoin'); - }); - - it('should return false for incorrect namecoin addresses', function () { - commonTests('namecoin'); - }); - - it('should return false for incorrect biocoin addresses', function () { - commonTests('biocoin'); - }); - - it('should return false for incorrect garlicoin addresses', function () { - commonTests('garlicoin'); - }); - - it('should return false for incorrect vertcoin addresses', function () { - commonTests('vertcoin'); - }); - - it('should return false for incorrect bitcoingold addresses', function () { - commonTests('bitcoingold'); - }); - - it('should return false for incorrect decred addresses', function () { - commonTests('decred'); - }); - - it('should return false for incorrect gamecredits addresses', function () { - commonTests('game'); - }); - - it('should return false for incorrect monacoin addresses', function () { - commonTests('mona'); - }); - - it('should return false for incorrect solarcoin addresses', function () { - commonTests('slr'); - }); - - it('should return false for incorrect tether addresses', function () { - commonTests('usdt'); - }); - - it('should return false for incorrect expanse addresses', function () { - commonTests('exp'); - }); - - it('should return false for incorrect usdt addresses', function () { - commonTests('usdt'); - }); - - it('should return false for incorrect bankex addresses', function () { - invalid('1SQHtwR5oJRKLfiWQ2APsAd9miUc4k2ez', 'bankex'); - invalid('116CGDLddrZhMrTwhCVJXtXQpxygTT1kHd', 'BKX'); - invalid('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef', 'bankex', 'testnet'); - invalid('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef', 'BKX', 'testnet'); - }); - - it('should return false for incorrect digibyte addresses', function () { - commonTests('digibyte'); - }); - - it('should return false for incorrect eip55 addresses', function () { - invalid('6xAff4d6793F584a473348EbA058deb8caad77a288', 'ethereum'); - invalid('0x02fcd51aAbB814FfFe17908fbc888A8975D839A5', 'ethereum'); - invalid('0XD1220A0CF47C7B9BE7A2E6BA89F429762E7B9ADB', 'ethereum'); - invalid('aFf4d6793f584a473348ebA058deb8caad77a2885', 'ethereum'); - invalid('0xff4d6793F584a473', 'ethereum'); - - invalid('0x02fcd51aAbB814FfFe17908fbc888A8975D839A5', 'ethereumclassic'); - invalid('0x02fcd51aAbB814FfFe17908fbc888A8975D839A5', 'etherzero'); - invalid('0x02fcd51aAbB814FfFe17908fbc888A8975D839A5', 'callisto'); - }); - - it('should return false for incorrect ripple addresses', function () { - invalid('rG1QQv2nh2gr7RCZ1P8YYcBUKCCN633jCN', 'ripple'); - invalid('rDTXLQ7ZKZVKz33zJbHjgVShjsBnqMBhMN', 'XRP'); - invalid('6xAff4d6793F584a473348EbA058deb8ca', 'ripple'); - invalid('DJ53hTyLBdZp2wMi5BsCS3rtEL1ioYUkva', 'ripple'); - }); - - it('should return false for incorrect dash addresses', function () { - commonTests('dash'); - }); - - it('should return false for incorrect neo addresses', function () { - commonTests('neo'); - invalid('AR4QmqYENiZAD6oXe7ftm6eDcwtHk7rVTa', 'neo'); - invalid('AKDVzYGLczmykdtRaejgvWeZrvdkVEvQ10', 'NEO'); - }); - - it('should return false for incorrect qtum addresses', function () { - commonTests('qtum'); - invalid('QNPhBbVhDghASxcUh2vHotQUgNeLRFTcfb', 'qtum'); - invalid('QOPhBbVhDghASxcUh2vHotQUgNeLRFTcfa', 'QTUM'); - }); - - it('should return false for incorrect votecoin addresses', function () { - commonTests('votecoin'); - invalid('t1Y9yhDa5XEjgfnTgZoKddeSiEN1aoLkQxq', 'votecoin'); - invalid('t3Yz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd', 'VOT'); - invalid('t2YNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'votecoin', 'testnet'); - }); - - it('should return false for incorrect bitcoinz addresses', function () { - commonTests('bitcoinz'); - invalid('t1Y9yhDa5XEjgfnTgZoKddeSiEN1aoLkQxq', 'bitcoinz'); - invalid('t3Yz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd', 'BTCZ'); - invalid('t2YNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'bitcoinz', 'testnet'); - }); - - it('should return false for incorrect zclassic addresses', function () { - commonTests('zclassic'); - invalid('t1Y9yhDa5XEjgfnTgZoKddeSiEN1aoLkQxq', 'zclassic'); - invalid('t3Yz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd', 'ZCL'); - invalid('t2YNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'zclassic', 'testnet'); - }); - - it('should return false for incorrect hush addresses', function () { - invalid('t1Y9yhDa5XEjgfnTgZoKddeSiEN1aoLkQxq', 'hush'); - invalid('t3Yz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd', 'HUSH'); - invalid('t2YNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'hush', 'testnet'); - }); - - it('should return false for incorrect zcash addresses', function () { - commonTests('zcash'); - invalid('t1Y9yhDa5XEjgfnTgZoKddeSiEN1aoLkQxq', 'zcash'); - invalid('t3Yz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd', 'ZEC'); - invalid('t2YNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'zcash', 'testnet'); - }); - - it('should return false for incorrect bitcoinprivate addresses', function () { - commonTests('bitcoinprivate'); - invalid('b1Y4XXPFhwMb1SP33yhzn3h9qWXjujkgep4', 'bitcoinprivate'); - //invalid('bx....', 'BTCP'); - //invalid('nx....', 'bitcoinprivate', 'testnet'); - }); - - it('should return false for incorrect snowgem addresses', function () { - commonTests('snowgem'); - invalid('s1Yx7WBkjB4UH6qQjPp6Ysmtr1C1JiTK2Yw', 'snowgem'); - invalid('s3Y27MhkBRt3ha2UuxhjXaYF4DCnttTMnL1', 'SNG'); - invalid('t2YNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'snowgem', 'testnet'); - }); - - it('should return false for incorrect zencash addresses', function () { - commonTests('zencash'); - invalid('znYiGGfYRepxkBjXYvA2kFrXiC351i9ta4z', 'zencash'); - invalid('zsYEdGnZCQ9G86LZFtbynMn1hYTVhn6eYCL', 'ZEN'); - invalid('ztYWMDLWjbruCJxKmmfAZiT6QAQdiv5F291', 'zencash', 'testnet'); - }); - - it('should return false for incorrect komodo addresses', function () { - commonTests('komodo'); - invalid('R9Y5HirAzqDcWrWGiJEL115dpV3QB3hobH', 'komodo'); - invalid('RAYj2KKVUohTu3hVdNJ4U6hQi7TNawpacH', 'KMD'); - //invalid('t2YNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'komodo', 'testnet'); - }); - - it('should return false for incorrect cardano addresses', function () { - commonTests('cardano'); - invalid('Ae2tdPwUPEYxYNJw1He1esdZYvjmr4NtPzUsGTiqL9zd8ohjZYQcwu6lom7', 'cardano'); - invalid('DdzFFzCqrhsfdzUZxvuBkhV8Lpm9p43p9ubh79GCTkxJikAjKh51qhtCFMqUniC5tv5ZExyvSmAte2Du2tGimavSo6qSgXbjiy8qZRTg1', 'cardano'); - invalid('DdzFFzCqrhsfdzUZxvuBkhV8Lpm9p43p9ubh79GCTkxJikAjKh51qhtCFMqUniC5tv5ZExyvSmAte2Du2tGimavSo6qSgXbjiy8qZRT', 'ada'); - //invalid('t2YNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'komodo', 'testnet'); - }); - - it('should return false for incorrect monero addresses', function () { - commonTests('monero'); - invalid('4AWygwA3hHNE4e4Yr9PtRWJiorXTjZkCi57g4ExYzfXDFFQ8DRFEFyui1dLqVknpqQjGUBdTMbgaFAZaDbrVHdk3GAKBZ3E', 'monero'); - invalid('44643dtxcxjgMWEQLo6mh1c4d9Zxx9GbgK9hEj9iGSiFEryCkbwHyJ3JqxZJRqeC3Hb7ZBLKq5NkaJwR1x95EYnR1bTgN6d', 'xmr'); - invalid('A17N9ztrxjQD3v3JJtHGvHVnq6BAbujDNEuensB6PFwBYFpkjAicih8hDtX76HBuEag5NeaCuMZmRMe6eE5NMRGxFTQn8nJ', 'monero', 'testnet'); - - //integrated - invalid('4LNSCKNSTPNbJYkyAEgL966eHJHLDHiq1PpwKoiFBybcSqNGYfLBJApC62uQEeGAFxfYEd29uXBBrJFo7DhKqFVNi3GhmN79EtD5dgycYz', 'monero'); - invalid('4JpzTwf3i1GeCV76beVr19179oa8j1L8xNSC1bXMtAxxdf4aTTLqubL8EvXfQmUGKt9MMigFtKy91VtoTTSfg1LU7LocPruT6KcGC9RKJV', 'xmr'); - }); - - it('should return false for incorrect waves addresses', function () { - commonTests('waves'); - invalid('3P93mVrYnQ4ahaRMYwA2BeWY32eDxTpLVEs1', 'waves'); - invalid('3P4eeU7v1LMHQFwwT2GW9W99c6vZyytHaj', 'waves'); - invalid('2P93mVrYnQ4ahaRMYwA2BeWY32eDxTpLVEs', 'waves'); - - invalid('3Myrq5QDgRq3nBVRSSv9UYRP36xTtpJND5y', 'waves', 'testnet'); - invalid('3My3KZgFQ3CrVHgz6vGRt8787sH4oAA1qp8', 'waves', 'testnet'); - }); - - it('should return false for incorrect nano addresses', function () { - commonTests('nano'); - invalid('xrb_1f5e4w33ndqbkx4bw5jtp13kp5xghebfxcmw9hdt1f7goid1s4373w6tjdgu', 'nano'); - invalid('nano_1f5e4w33ndqbkx4bw5jtp13kp5xghebfxcmw9hdt1f7goid1s4373w6tjdgu', 'nano'); - invalid('xrb_1111111112111111111111111111111111111111111111111111hifc8npp', 'nano'); - invalid('nano_111111111111111111111111111111111111111111111111111hifc8npp', 'nano'); - }); - - it('should return false for incorrect siacoin addresses', function () { - commonTests('siacoin') - invalid( - 'ffe1308c044ade30392a0cdc1fd5a4dbe94f9616a95faf888ed36123d9e711557aa497530372', - 'siacoin' - ) - }) - - it('should return false for incorrect lbry addresses', function () { - commonTests('lbc') - invalid('ffe1308c044ade30392a0cdc1fd5a4dbe94f9616a95faf888ed36123d9e711557aa497530372') - }) - - it('should return false for incorrect tron addresses', function () { - commonTests('trx'); - invalid('xrb_1111111112111111111111111111111111111111111111111111hifc8npp', 'trx'); - invalid('TNDzfERDpxLDS2w1q6yaFC7pzqaSQ3Bg31', 'trx'); - }); - - it('should return false for incorrect nem addresses', function () { - commonTests('nem'); - invalid('xrb_1111111112111111111111111111111111111111111111111111hifc8npp', 'nem'); - invalid('TNDzfERDpxLDS2w1q6yaFC7pzqaSQ3Bg31', 'nem'); - - invalid('3Myrq5QDgRq3nBVRSSv9UYRP36xTtpJND5y', 'nem', 'testnet'); - invalid('3My3KZgFQ3CrVHgz6vGRt8787sH4oAA1qp8', 'nem', 'testnet'); - }); - //15823701926930889868L - it('should return false for incorrect lsk addresses', function () { - commonTests('lsk'); - invalid('xrb_1111111112111111111111111111111111111111111111111111hifc8npp', 'lsk'); - invalid('TNDzfERDpxLDS2w1q6yaFC7pzqaSQ3Bg31', 'lsk'); - - invalid('158237019269308898689L', 'lsk'); - invalid('158237A192B930C898689L', 'lsk'); - }); - - it('should return false for incorrect bsv addresses', function () { - commonTests('bsv'); - invalid('xrb_1111111112111111111111111111111111111111111111111111hifc8npp', 'bsv'); - invalid('TNDzfERDpxLDS2w1q6yaFC7pzqaSQ3Bg31', 'bsv'); - - invalid('158237019269308898689L', 'bsv'); - invalid('158237A192B930C898689L', 'bsv'); - invalid('bitcoin:qzpuefrpg3kl2ykQe52rxn96pd3Kp4qudywr5pyrsf', 'bsv'); - invalid('pzuefrpg3kl2ykqe52rxn96pd3kp4qudywr5py', 'bsv'); - invalid('rlt2c2wuxr644encp3as0hygtj9djrsaumku3cex5', 'bsv'); - invalid('qra607y4wnkmnpy3wcmrxmltzkrxywcq85c7watpdx09', 'bsv'); - }); - - it('should return false for incorrect stellar addresses', function () { - commonTests('stellar'); - invalid('SBGWKM3CD4IL47QN6X54N6Y33T3JDNVI6AIJ6CD5IM47HG3IG4O36XCU', 'stellar'); - invalid('GBPXX0A5N4JYPESHAADMQKBPWZWQDQ64ZV6ZL2S3LAGW4SY7NTCMWIVL', 'stellar'); - invalid('GCFZB6L25D26RQFDWSSBDEYQ32JHLRMTT44ZYE3DZQUTYOL7WY43PLBG++', 'stellar'); - invalid('GADE5QJ2TY7S5ZB65Q43DFGWYWCPHIYDJ2326KZGAGBN7AE5UY6JVDRRA', 'stellar'); - invalid('GB6OWYST45X57HCJY5XWOHDEBULB6XUROWPIKW77L5DSNANBEQGUPADT2', 'stellar'); - invalid('GB6OWYST45X57HCJY5XWOHDEBULB6XUROWPIKW77L5DSNANBEQGUPADT2T', 'stellar'); - invalid('GDXIIZTKTLVYCBHURXL2UPMTYXOVNI7BRAEFQCP6EZCY4JLKY4VKFNLT', 'stellar'); - invalid('SAB5556L5AN5KSR5WF7UOEFDCIODEWEO7H2UR4S5R62DFTQOGLKOVZDY', 'stellar'); - invalid('gWRYUerEKuz53tstxEuR3NCkiQDcV4wzFHmvLnZmj7PUqxW2wt', 'stellar'); - invalid('g4VPBPrHZkfE8CsjuG2S4yBQNd455UWmk', 'stellar'); - }); - - it('should return false for incorrect xtz(tezos) address', function () { - commonTests('xtz'); - invalid('SBGWKM3CD4IL47QN6X54N6Y33T3JDNVI6AIJ6CD5IM47HG3IG4O36XCU', 'xtz'); - invalid('GBPXX0A5N4JYPESHAADMQKBPWZWQDQ64ZV6ZL2S3LAGW4SY7NTCMWIVL', 'xtz'); - invalid('GCFZB6L25D26RQFDWSSBDEYQ32JHLRMTT44ZYE3DZQUTYOL7WY43PLBG', 'xtz'); - invalid('tz1RR6wy9BeXG3Fjk25YmkSMGHxTtKkhpX', 'xtz'); - invalid('tz1h3rQ8wBxFd8L9B3d7JhaPQawu6Z568XU3xY', 'xtz'); - invalid('tz1Lhf4J9Qxoe4DZ2nfe8FGDnvVj7oKjnMY6', 'xtz'); - invalid('KT1E2LvxxFGB3Svh9p9HCP2jEEYyHjABMbK', 'xtz'); - - }); - - it('should return false for incorrect eos addresses', function () { - commonTests('eos'); - invalid('1234567890123', 'eos'); - invalid('12345678901', 'eos'); - invalid('12345678901@', 'eos'); - }); + describe('valid results', function () { + it('should return true for correct bitcoin addresses', function () { + valid('12KYrjTdVGjFMtaxERSk3gphreJ5US8aUP', 'bitcoin'); + valid('12QeMLzSrB8XH8FvEzPMVoRxVAzTr5XM2y', 'bitcoin'); + valid('12QeMLzSrB8XH8FvEzPMVoRxVAzTr5XM2y', 'BTC'); + valid('12QeMLzSrB8XH8FvEzPMVoRxVAzTr5XM2y', 'Bitcoin'); + valid('12QeMLzSrB8XH8FvEzPMVoRxVAzTr5XM2y', 'btc'); + valid('12QeMLzSrB8XH8FvEzPMVoRxVAzTr5XM2y', 'btc', 'prod'); + valid('12QeMLzSrB8XH8FvEzPMVoRxVAzTr5XM2y', 'btc', 'both'); + valid('15uwigGExiNQxTNr1QSZYPXJMp9Px2YnVU', 'btc', 'prod'); + valid('3FyVFsEyyBPzHjD3qUEgX7Jsn4tcHNZFkn', 'btc', 'prod'); + valid('38mKdURe1zcQyrFqRLzR8PRao3iLGEPVsU', 'btc', 'prod'); + valid('mptPo5AvLzJXi4T82vR6g82fT5uJ6HsQCu', 'btc', 'both'); + valid('1oNLrsHnBcR6dpaBpwz3LSwutbUNkNSjs', 'bitcoin'); + valid('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef', 'bitcoin', 'testnet'); + valid('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef', 'bitcoin', 'both'); + + valid('1SQHtwR5oJRKLfiWQ2APsAd9miUc4k2ez'); + valid('116CGDLddrZhMrTwhCVJXtXQpxygTT1kHd'); + + // p2sh addresses + valid('3NJZLcZEEYBpxYEUGewU4knsQRn1WM5Fkt'); + valid('3NJZLcZEEYBpxYEUGewU4knsQRn1WM5Fkt', 'bitcoin'); + valid('2MxKEf2su6FGAUfCEAHreGFQvEYrfYNHvL7', 'bitcoin', 'testnet'); + + // regtest + valid('GSa5espVLNseXEfKt46zEdS6jrPkmFghBU', 'bitcoin', 'testnet'); + + // segwit addresses + valid('BC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3T4', 'bitcoin'); + valid('tb1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3q0sl5k7', 'bitcoin'); + valid('bc1pw508d6qejxtdg4y5r3zarvary0c5xw7kw508d6qejxtdg4y5r3zarvary0c5xw7k7grplx', 'bitcoin'); + valid('BC1SW50QA3JX3S', 'bitcoin'); + valid('bc1zw508d6qejxtdg4y5r3zarvaryvg6kdaj', 'bitcoin'); + valid('tb1qqqqqp399et2xygdj5xreqhjjvcmzhxw4aywxecjdzew6hylgvsesrxh6hy', 'bitcoin'); + + invalid("tc1qw508d6qejxtdg4y5r3zarvary0c5xw7kg3g4ty", 'bitcoin'), + invalid("bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t5", 'bitcoin'), + invalid("BC13W508D6QEJXTDG4Y5R3ZARVARY0C5XW7KN40WF2", 'bitcoin'), + invalid("bc1rw5uspcuh", 'bitcoin'), + invalid("bc10w508d6qejxtdg4y5r3zarvary0c5xw7kw508d6qejxtdg4y5r3zarvary0c5xw7kw5rljs90", 'bitcoin'), + invalid("BC1QR508D6QEJXTDG4Y5R3ZARVARYV98GJ9P", 'bitcoin'), + invalid("tb1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3q0sL5k7", 'bitcoin'), + invalid("bc1zw508d6qejxtdg4y5r3zarvaryvqyzf3du", 'bitcoin'), + invalid("tb1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3pjxtptv", 'bitcoin'), + invalid("bc1gmk9yu", 'bitcoin') + }); + + it('should return true for correct bitcoincash addresses', function () { + valid('12KYrjTdVGjFMtaxERSk3gphreJ5US8aUP', 'bitcoincash'); + valid('12QeMLzSrB8XH8FvEzPMVoRxVAzTr5XM2y', 'bitcoincash'); + valid('12QeMLzSrB8XH8FvEzPMVoRxVAzTr5XM2y', 'BCH'); + valid('12QeMLzSrB8XH8FvEzPMVoRxVAzTr5XM2y', 'Bitcoin'); + valid('12QeMLzSrB8XH8FvEzPMVoRxVAzTr5XM2y', 'bch'); + valid('12QeMLzSrB8XH8FvEzPMVoRxVAzTr5XM2y', 'bch', 'prod'); + valid('12QeMLzSrB8XH8FvEzPMVoRxVAzTr5XM2y', 'bch', 'both'); + valid('1oNLrsHnBcR6dpaBpwz3LSwutbUNkNSjs', 'bitcoincash'); + valid('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef', 'bitcoincash', 'testnet'); + valid('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef', 'bitcoincash', 'both'); + + // p2sh addresses + valid('3NJZLcZEEYBpxYEUGewU4knsQRn1WM5Fkt', 'bitcoincash'); + valid('2MxKEf2su6FGAUfCEAHreGFQvEYrfYNHvL7', 'bitcoincash', 'testnet'); + + valid('bitcoincash:qq4v32mtagxac29my6gwj6fd4tmqg8rysu23dax807', 'bch'); + + }); + + it('should return true for correct litecoin addresses', function () { + valid('LVg2kJoFNg45Nbpy53h7Fe1wKyeXVRhMH9', 'litecoin'); + valid('LVg2kJoFNg45Nbpy53h7Fe1wKyeXVRhMH9', 'LTC'); + valid('LTpYZG19YmfvY2bBDYtCKpunVRw7nVgRHW', 'litecoin'); + valid('Lb6wDP2kHGyWC7vrZuZAgV7V4ECyDdH7a6', 'litecoin'); + valid('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef', 'litecoin', 'testnet'); + + // p2sh addresses + valid('3NJZLcZEEYBpxYEUGewU4knsQRn1WM5Fkt', 'litecoin'); + valid('2MxKEf2su6FGAUfCEAHreGFQvEYrfYNHvL7', 'litecoin', 'testnet'); + valid('QW2SvwjaJU8LD6GSmtm1PHnBG2xPuxwZFy', 'litecoin', 'testnet'); + valid('QjpzxpbLp5pCGsCczMbfh1uhC3P89QZavY', 'litecoin', 'testnet'); + }); + + it('should return true for correct peercoin addresses', function () { + valid('PHCEsP6od3WJ8K2WKWEDBYKhH95pc9kiZN', 'peercoin'); + valid('PSbM1pGoE9dnAuVWvpQqTTYVpKZU41dNAz', 'peercoin'); + valid('PUULeHrJL2WujJkorc2RsUAR3SardKUauu', 'peercoin'); + valid('PUULeHrJL2WujJkorc2RsUAR3SardKUauu', 'PPC'); + valid('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef', 'peercoin', 'testnet'); + + // p2sh addresses + valid('pNms4CaWqgZUxbNZaA1yP2gPr3BYnez9EM', 'peercoin'); + valid('2MxKEf2su6FGAUfCEAHreGFQvEYrfYNHvL7', 'peercoin', 'testnet'); + }); + + it('should return true for correct dogecoin addresses', function () { + valid('DPpJVPpvPNP6i6tMj4rTycAGh8wReTqaSU', 'dogecoin'); + valid('DNzLUN6MyYVS5zf4Xc2yK69V3dXs6Mxia5', 'dogecoin'); + valid('DPS6iZj7roHquvwRYXNBua9QtKPzigUUhM', 'dogecoin'); + valid('DPS6iZj7roHquvwRYXNBua9QtKPzigUUhM', 'DOGE'); + //TODO: NEED A DOGECOIN TESTNET ADDRESS + + //p2sh addresses + valid('A7JjzK9k9x5b2MkkQzqt91WZsuu7wTu6iS', 'dogecoin'); + valid('2MxKEf2su6FGAUfCEAHreGFQvEYrfYNHvL7', 'dogecoin', 'testnet'); + }); + + it('should return true for correct beavercoin addresses', function () { + valid('BPPtB4EpPi5wCaGXZuNyKQgng8ya579qUh', 'beavercoin'); + valid('BC1LLYoE4mTCHTJhVYvLGxhRTwAHyWTQ49', 'beavercoin'); + valid('BBuyeg2vjtyFdMNj3LTxuVra4wJMKVAY9C', 'beavercoin'); + valid('BBuyeg2vjtyFdMNj3LTxuVra4wJMKVAY9C', 'BVC'); + valid('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef', 'beavercoin', 'testnet'); + + // p2sh addresses + valid('3NJZLcZEEYBpxYEUGewU4knsQRn1WM5Fkt', 'beavercoin'); + valid('2MxKEf2su6FGAUfCEAHreGFQvEYrfYNHvL7', 'beavercoin', 'testnet'); + }); + + it('should return true for correct freicoin addresses', function () { + valid('1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa', 'freicoin'); + valid('1oNLrsHnBcR6dpaBpwz3LSwutbUNkNSjs', 'freicoin'); + valid('1SQHtwR5oJRKLfiWQ2APsAd9miUc4k2ez', 'freicoin'); + valid('1SQHtwR5oJRKLfiWQ2APsAd9miUc4k2ez', 'FRC'); + valid('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef', 'freicoin', 'testnet'); + + // p2sh addresse + valid('3NJZLcZEEYBpxYEUGewU4knsQRn1WM5Fkt', 'freicoin'); + valid('2MxKEf2su6FGAUfCEAHreGFQvEYrfYNHvL7', 'freicoin', 'testnet'); + }); + + it('should return true for correct protoshares addresses', function () { + valid('PaNGELmZgzRQCKeEKM6ifgTqNkC4ceiAWw', 'protoshares'); + valid('Piev8TMX2fT5mFtgxx2TXJaqXP37weMPuD', 'protoshares'); + valid('PgsuLoe9ojRKFGJGVpqqk37gAqNJ4ozboD', 'protoshares'); + valid('PgsuLoe9ojRKFGJGVpqqk37gAqNJ4ozboD', 'PTS'); + valid('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef', 'protoshares', 'testnet'); + + //p2sh addresses + valid('3NJZLcZEEYBpxYEUGewU4knsQRn1WM5Fkt', 'protoshares'); + valid('2MxKEf2su6FGAUfCEAHreGFQvEYrfYNHvL7', 'protoshares', 'testnet'); + }); + + it('should return true for correct megacoin addresses', function () { + valid('MWUHaNxjXGZUYTh92i3zuDmsnH1rHSBk5M', 'megacoin'); + valid('MSAkrhRyte7bz999Ga5SqYjzypFFYa2oEb', 'megacoin'); + valid('MLUTAtDQFcfo1QACWocLuufFq5fBDTpCHE', 'megacoin'); + valid('MLUTAtDQFcfo1QACWocLuufFq5fBDTpCHE', 'MEC'); + valid('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef', 'megacoin', 'testnet'); + + //p2sh addresses + valid('3NJZLcZEEYBpxYEUGewU4knsQRn1WM5Fkt', 'megacoin'); + valid('2MxKEf2su6FGAUfCEAHreGFQvEYrfYNHvL7', 'megacoin', 'testnet'); + }); + + it('should return true for correct primecoin addresses', function () { + valid('AVKeiZ5JadfWdH2EYVgVRfX4ufoyd4ehuM', 'primecoin'); + valid('AQXBRPyob4dywUJ21RUKrR1xetQCDVenKD', 'primecoin'); + valid('ANHfTZnskKqaBU7oZuSha9SpbHU3YBfeKf', 'primecoin'); + valid('AYdiYMKSGYxLcZNDmqB8jNcck7SQibrfiK', 'primecoin'); + valid('AYdiYMKSGYxLcZNDmqB8jNcck7SQibrfiK', 'XPM'); + valid('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef', 'primecoin', 'testnet'); + + //p2sh addresses + valid('af5CvTQq7agDh717Wszb5QDbWb7nT2mukP', 'primecoin'); + valid('2MxKEf2su6FGAUfCEAHreGFQvEYrfYNHvL7', 'primecoin', 'testnet'); + }); + + it('should return true for correct auroracoin addresses', function () { + valid('ARM3GLZXF1PDTZ5vz3wh5MVahbK9BHTWAN', 'auroracoin'); + valid('AUtfc6ThCLb7FuEu7QPrWpJuaXaJRPciDF', 'auroracoin'); + valid('AUN1oaj5hjispGnczt8Aruw3TxgGyRqB3V', 'auroracoin'); + valid('AXGcBkGX6NiaDXj85C5dCrhTRUgwxSkKDK', 'auroracoin'); + valid('AXGcBkGX6NiaDXj85C5dCrhTRUgwxSkKDK', 'AUR'); + valid('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef', 'auroracoin', 'testnet'); + + //p2sh addresses + valid('3NJZLcZEEYBpxYEUGewU4knsQRn1WM5Fkt', 'auroracoin'); + valid('2MxKEf2su6FGAUfCEAHreGFQvEYrfYNHvL7', 'auroracoin', 'testnet'); + }); + + it('should return true for correct namecoin addresses', function () { + valid('NEpeRmS775fnti8TDgJA28m8KLEfNNRZvT', 'namecoin'); + valid('MyJ691bGJ48RBK2LS8n1U57wcFLFScFXxi', 'namecoin'); + valid('NFY9aw1RXLGtWpeqgNQXprnUcZXyKNinTh', 'namecoin'); + valid('NCPPc7Pzb75CpRPJQPRRh6ouJTq7BCy1H4', 'namecoin'); + valid('NCPPc7Pzb75CpRPJQPRRh6ouJTq7BCy1H4', 'NMC'); + }); + + it('should return true for correct BioCoin addresses', function () { + valid('B7xseoLGk7hEpMDDeSvZDKmmiAMHWiccok', 'biocoin'); + valid('B8zjmYFGhWmiaQSJshfrnefE72xCapCkvo', 'biocoin'); + valid('muH8LL42DiMs8GEQ6Grfi8KUw2uFvuKr1J', 'biocoin', 'testnet'); + valid('muH8LL42DiMs8GEQ6Grfi8KUw2uFvuKr1J', 'BIO', 'testnet'); + valid('B8zjmYFGhWmiaQSJshfrnefE72xCapCkvo', 'BIO'); + }); + + it('should return true for correct Garlicoin addresses', function () { + valid('GU2NtcNotWFiZjTp2Vdgf5CjeMfgsWYCua', 'garlicoin'); + valid('GNWeWaoQ6rv21ZFjJWT9vb91hXUzFTLkru', 'garlicoin'); + valid('mjKbQTkgwzmsL3J86tdVzhyW9pc4NePqTb', 'garlicoin', 'testnet'); + valid('mnYp36NuyRavMKQ9Q9Q6oGqoorAs9p3zYn', 'GRLC', 'testnet'); + valid('GU2NtcNotWFiZjTp2Vdgf5CjeMfgsWYCua', 'GRLC'); + }); + + it('should return true for correct Vertcoin addresses', function () { + valid('3PgeyhEJEnS5CeBu3iFcu3JHVKemeHx1AW', 'VTC'); + valid('353nERPQKhGj4WGzoiWcareA76TPgRCVNA', 'VTC'); + valid('376g4TmL8uQKFYsRFrbv5iz9srmb5bocEt', 'VTC'); + valid('3AMtM4Zk5oNHu9i4jDiwKB6Kg5YEReBsav', 'VTC'); + + valid('VmoMjGf3zgZLy8sk3PMKd3xikZHXWvnYi7', 'vertcoin'); + valid('VmhHwXr3J8xMZpy62WuBGpu3xVvThWzcTQ', 'vertcoin'); + valid('mvww6DEJ18dbyQUukpVQXvLgrNDJazZn1Y', 'vertcoin', 'testnet'); + valid('mn3mdEE6cf1snxVsknNz4GRTdSrWXqYp7c', 'VTC', 'testnet'); + valid('Vri6Q4GgNFfdtcpxD961TotJwaSaYQCaL5', 'VTC'); + }); + + it('should return true for correct BitcoinGold addresses', function () { + valid('GW3JrQyHtoVfEFES3Y9JagiX3VSKQStLwj', 'bitcoingold'); + valid('GUDWdeMyAXQbrNFFivAhkJQ1GfBCFdc7JF', 'bitcoingold'); + valid('mvww6DEJ18dbyQUukpVQXvLgrNDJazZn1Y', 'bitcoingold', 'testnet'); + valid('mn3mdEE6cf1snxVsknNz4GRTdSrWXqYp7c', 'BTG', 'testnet'); + valid('GSNFPRsdaM3MXrU5HW1AxgFwmUQC8HXK9F', 'BTG'); + }); + + it('should return true for correct Decred addresses', function () { + valid('Dsesax2GJnMN4wwmWo5rJGq73dDK217Rh85', 'DCR'); + valid('DsYuxtvGRfN8rncXAndtLUpJm55F77K17RA', 'decred'); + valid('DsaXDG2NrJW8g4tFAb8n9MNx81Sn3Qc8AEV', 'decred'); + valid('TsijUgejaRnLKF5WAbpUxNtwKGUiKVeXLr7', 'decred', 'testnet'); + valid('TsZ9QmAoadF12hGvyALp6qvaF4be3BmLqG9', 'dcr', 'testnet'); + }); + + it('should return true for correct Digibyte addresses', function () { + valid('DG2rM2orU2JH5i4ACh3AKNpRTNESdv5xf8', 'DGB'); + valid('DBR2Lj1F17eHGHXgbpae2Wb4m39bDyA1qo', 'DGB'); + valid('D9TDZTR9Z9Mx2NoDJnhqhnYhDLKRAmsL9n', 'digibyte'); + valid('DHRzA1YHA1kFWpz2apRckZJy6KZRyGq4EV', 'digibyte'); + valid('DJ53hTyLBdZp2wMi5BsCS3rtEL1ioYUkva', 'digibyte'); + }); + + it('should return true for correct Ethereum addresses', function () { + valid('0xE37c0D48d68da5c5b14E5c1a9f1CFE802776D9FF', 'ethereum'); + valid('0xa00354276d2fC74ee91e37D085d35748613f4748', 'ethereum'); + valid('0xAff4d6793F584a473348EbA058deb8caad77a288', 'ETH'); + valid('0xc6d9d2cd449a754c494264e1809c50e34d64562b', 'ETH'); + valid('0x52908400098527886E0F7030069857D2E4169EE7', 'ETH'); + valid('0x8617E340B3D01FA5F11F306F4090FD50E238070D', 'ETH'); + valid('0xde709f2102306220921060314715629080e2fb77', 'ETH'); + valid('0x27b1fdb04752bbc536007a920d24acb045561c26', 'ETH'); + valid('0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed', 'ETH'); + valid('0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359', 'ETH'); + valid('0xdbF03B407c01E7cD3CBea99509d93f8DDDC8C6FB', 'ETH'); + valid('0xD1220A0cf47c7B9Be7A2E6BA89F429762e7b9aDb', 'ETH'); + + valid('0xD1220A0cf47c7B9Be7A2E6BA89F429762e7b9aDb', 'ethereumclassic'); + valid('0xD1220A0cf47c7B9Be7A2E6BA89F429762e7b9aDb', 'ETC'); + valid('0xD1220A0cf47c7B9Be7A2E6BA89F429762e7b9aDb', 'etherzero'); + valid('0xD1220A0cf47c7B9Be7A2E6BA89F429762e7b9aDb', 'ETZ'); + valid('0xD1220A0cf47c7B9Be7A2E6BA89F429762e7b9aDb', 'callisto'); + valid('0xD1220A0cf47c7B9Be7A2E6BA89F429762e7b9aDb', 'CLO'); + }); + + it('should return true for correct Ripple addresses', function () { + valid('rG1QQv2nh2gr7RCZ1P8YYcBUKCCN633jCn', 'ripple'); + valid('rG1QQv2nh2gr7RCZ1P8YYcBUKCCN633jCn', 'XRP'); + valid('r3kmLJN5D28dHuH8vZNUZpMC43pEHpaocV', 'XRP'); + valid('rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh', 'XRP'); + valid('rDTXLQ7ZKZVKz33zJbHjgVShjsBnqMBhmN', 'XRP'); + }); + + it('should return true for correct dash addresses', function () { + valid('Xx4dYKgz3Zcv6kheaqog3fynaKWjbahb6b', 'dash'); + valid('XcY4WJ6Z2Q8w7vcYER1JypC8s2oa3SQ1b1', 'DASH'); + valid('XqMkVUZnqe3w4xvgdZRtZoe7gMitDudGs4', 'dash'); + valid('yPv7h2i8v3dJjfSH4L3x91JSJszjdbsJJA', 'dash', 'testnet'); + valid('XoAAqv3oUYZ6xRjX3brfbf9PotrGanS6Th', 'dash'); + valid('yP5oXZQXBfBf9FyfZDpFiKDypxuNUKUV2E', 'dash', 'testnet'); + }); + + it('should return true for correct neo addresses', function () { + valid('AR4QmqYENiZAD6oXe7ftm6eDcwtHk7rVTT', 'neo'); + valid('AKDVzYGLczmykdtRaejgvWeZrvdkVEvQ1X', 'NEO'); + }); + + it('should return true for correct neo gas addresses', function () { + valid('AR4QmqYENiZAD6oXe7ftm6eDcwtHk7rVTT', 'neogas'); + }); + + it('should return true for correct qtum addresses', function () { + valid('QNjUiD3bVVZwYTc5AhpeQbS1mfb2guyWhe', 'qtum'); + valid('QVZnSrMwKp6AL4FjUPPnfFgsma6j1DXQXu', 'QTUM'); + valid('MCgyroQse81wuv5RwPpY5DXDNxeafzLFJ8', 'QTUM'); + valid('QQYySVc5WEe3g6PnNFYmspqG5CfSG8rnma', 'QTUM'); + valid('MSvJQBJMZs1dhxz7UAWa2si4iyMD2FHQd5', 'QTUM'); + valid('qcSLSxN1sngCWSrKFZ6UC7ri4hhVSdq9SU', 'qtum', 'testnet'); + valid('qJnbEdrm9ybjVqDCaX5SWNBHmZy2X7YbPT', 'qtum', 'testnet'); + valid('qchBPDUYswobzpDmY5DsTStt74sTYQtaQv', 'qtum', 'testnet'); }); + + it('should return true for correct votecoin addresses', function () { + valid('t1U9yhDa5XEjgfnTgZoKddeSiEN1aoLkQxq', 'votecoin'); + valid('t3Vz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd', 'VOT'); + valid('t2UNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'votecoin', 'testnet'); + }); + + it('should return true for correct bitcoinz addresses', function () { + valid('t1U9yhDa5XEjgfnTgZoKddeSiEN1aoLkQxq', 'bitcoinz'); + valid('t3Vz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd', 'BTCZ'); + valid('t2UNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'bitcoinz', 'testnet'); + }); + + it('should return true for correct zclassic addresses', function () { + valid('t1U9yhDa5XEjgfnTgZoKddeSiEN1aoLkQxq', 'zclassic'); + valid('t3Vz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd', 'ZCL'); + valid('t2UNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'zclassic', 'testnet'); + }); + + it('should return true for correct hush addresses', function () { + valid('t1U9yhDa5XEjgfnTgZoKddeSiEN1aoLkQxq', 'hush'); + valid('t3Vz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd', 'HUSH'); + valid('t2UNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'hush', 'testnet'); + }); + + it('should return true for correct zcash addresses', function () { + valid('t1U9yhDa5XEjgfnTgZoKddeSiEN1aoLkQxq', 'zcash'); + valid('t3Vz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd', 'ZEC'); + valid('t2UNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'zcash', 'testnet'); + }); + + it('should return true for correct bitcoinprivate addresses', function () { + valid('b1M4XXPFhwMb1SP33yhzn3h9qWXjujkgep4', 'bitcoinprivate'); + //valid('bx....', 'BTCP'); + //valid('nx....', 'bitcoinprivate', 'testnet'); + }); + + it('should return true for correct snowgem addresses', function () { + valid('s1fx7WBkjB4UH6qQjPp6Ysmtr1C1JiTK2Yw', 'snowgem'); + valid('s3d27MhkBRt3ha2UuxhjXaYF4DCnttTMnL1', 'SNG'); + valid('t2UNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'snowgem', 'testnet'); + }); + + it('should return true for correct zencash addresses', function () { + valid('znhiGGfYRepxkBjXYvA2kFrXiC351i9ta4z', 'zencash'); + valid('zssEdGnZCQ9G86LZFtbynMn1hYTVhn6eYCL', 'ZEN'); + valid('ztmWMDLWjbruCJxKmmfAZiT6QAQdiv5F291', 'zencash', 'testnet'); + }); + + it('should return true for correct komodo addresses', function () { + valid('R9R5HirAzqDcWrWGiJEL115dpV3QB3hobH', 'komodo'); + valid('RAvj2KKVUohTu3hVdNJ4U6hQi7TNawpacH', 'KMD'); + //valid('t2UNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'komodo', 'testnet'); + }); + + it('should return true for correct Bankex addresses', function () { + valid('0xeac39e1bc802baae3d4b9cb518f3f60374bbad6c', 'bankex'); + valid('0x45245bc59219eeaaf6cd3f382e078a461ff9de7b', 'BKX'); + valid('0xf40d80FCfa5cdEa0bB1E570c2D52132ac9bC6aEC', 'bankex', 'testnet'); + valid('0x8A7395f281EeCf2B471B689E87Cf4C7fa8bb957d', 'BKX', 'testnet'); + }); + + + it('should return true for correct Cardano addresses', function () { + valid('Ae2tdPwUPEYzs5BRbGcoS3DXvK8mwgggmESz4HqUwMyaS9eNksZGz1LMS9v', 'ada'); + valid('Ae2tdPwUPEYxYNJw1He1esdZYvjmr4NtPzUsGTiqL9zd8ohjZYQcwu6kom7', 'cardano'); + valid('DdzFFzCqrhsfdzUZxvuBkhV8Lpm9p43p9ubh79GCTkxJikAjKh51qhtCFMqUniC5tv5ZExyvSmAte2Du2tGimavSo6qSgXbjiy8qZRTg', 'ada'); + valid('Ae2tdPwUPEZKmwoy3AU3cXb5Chnasj6mvVNxV1H11997q3VW5ihbSfQwGpm', 'ada'); + valid('4swhHtxKapQbj3TZEipgtp7NQzcRWDYqCxXYoPQWjGyHmhxS1w1TjUEszCQT1sQucGwmPQMYdv1FYs3d51KgoubviPBf', 'cardano'); + }); + + it('should return true for correct monero addresses', function () { + valid('47zQ5LAivg6hNCgijXSEFVLX7mke1bgM6YGLFaANDoJbgXDymcAAZvvMNt2PmMpqEe5qRy2zyfMYXdwpmdyitiFh84xnPG2', 'monero'); + valid('48bWuoDG75CXMDHbmPEvUF2hm1vLDic7ZJ7hqRkL65QR9p13AQAX4eEACXNk4YP115Q4KRVZnAvmMBHrcGfv9FvKPZnH6vH', 'XMR'); + valid('88WB4JKdQVhWfkc8cBT9EEJ6vejSAqKJHbV1dXBAXdpgQovtNDNRxfKCS7wB8rHQ5D5zH2Pd1YkyMNNQDie6ZfeZ311fPgn', 'XMR'); + valid('A2be3UvzMtkJtxRYgcCbQt2y7Rp2eLVGqNTWfZeankrWimSMM4y7uMP6B9oAZaHsXTj8KFSerkSkkVRuEuEca9QM8VhxCNU', 'monero', 'testnet'); + + //integrated addresses + valid('4Gd4DLiXzBmbVX2FZZ3Cvu6fUaWACup1qDowprUCje1kSP4FmbftiJMSfV8kWZXNqmVwj4m52xqtgFNUudVmsmGkGvkLcCibWfVUfUFVB7', 'monero'); + valid('4J5sF94AzXgFgx8LuWc9dcWkJkGkD3cL3L2AuhX6QA9jFvSxxj6QhHqHXqM2b2Go7G8RyDzEbHxYd9G26XUUbuJChipEyBz9fENMU2Ua9b', 'XMR'); + + valid('9uXRFi4PZMqhsnthBF6bGdfVnBSZtfKkR7Td8qPM7jUKZeTfR1tLhCoTLqYNE12xuiQg3aWGiLw83bWsqwTRLaM4Jk47xYM', 'XMR', 'testnet'); + valid('9tFTaQM39JXhULZsHauPHhjFrjcGSGXoijEPYoRgAky9Veck2mFp3EifQ2tKHmEHuuUoFfgYRNR2bVaborz5oi8JA8xkqjY', 'monero', 'testnet') + }); + + it('should return true for correct gamecredits addresses', function () { + valid('GU5BBtW9gxSKvAknvFi9yUaXKUNW9zUN2p', 'game'); + valid('GYxQMVzP6YpzX59QNRYqmJeHNtUMYSZPri', 'game'); + }); + + it('should return true for correct monacoin addresses', function () { + valid('MMN1Q1aRVUzanmg9DJjcRYzQSJQoBeQPui', 'mona'); + valid('PFMzNYnBm5X4c9qJkJPkfgdCyd9fuuy2vT', 'mona'); + valid('PCtN7VUYHW8w4g59BaphrfPs8g7pNgAzxn', 'mona'); + valid('MXCcYFGRmsd4d3CcQugFiqG8uarj5tVu76', 'mona'); + valid('MNK1pGsBf9WdoE54fZM9VFhkeYHW6VUf2u', 'mona'); + }); + + it('should return true for correct pivx addresses', function () { + valid('DJXFW9oJJBUX7QKrG6GKvmTs63MYKzwtpZ', 'pivx'); + valid('DEaYb8EHQgyKvX6VXDS3DZQautJrHBmK3T', 'pivx'); + valid('DDeCGR3QSgqsBxVR23bJvteiyYE34ZmxAc', 'pivx'); + valid('DSqQM8DPpBHHoZXHgRdwmaf6hZPEoZcFkh', 'pivx'); + }); + + it('should return true for correct solarcoin addresses', function () { + valid('8VxVLzwB26E2YZZ82o1NcQe96QSM2z6GwW', 'slr'); + valid('8YW5qcTjeyqX5kESsqu2BUdXiedgssegtQ', 'SolarCoin'); + }); + + it('should return true for correct tether addresses', function () { + valid('3MbYQMMmSkC3AgWkj9FMo5LsPTW1zBTwXL', 'usdt'); + valid('1KdXaqcBeoMAFVAPwTmYvDbEq6RnvNPF6J', 'tether'); + }); + + it('should return true for correct expanse addresses', function () { + valid('0xbab463743603a253bdf1f84975b1a9517505ae05', 'exp'); + valid('0x5d0777cb5d6977873904864c6ab531f4b3261f0b', 'expanse'); + }); + + it('should return true for correct waves addresses', function () { + valid('3P93mVrYnQ4ahaRMYwA2BeWY32eDxTpLVEs', 'waves'); + valid('3P4eeU7v1LMHQFwwT2GW9W99c6vZyytHajj', 'waves'); + + valid('3Myrq5QDgRq3nBVRSSv9UYrP36xTtpJND5y', 'waves', 'testnet'); + valid('3My3KZgFQ3CrVHgz6vGRt8687sH4oAA1qp8', 'waves', 'testnet'); + }); + + it('should return true for correct nano addresses', function () { + valid('xrb_3t6k35gi95xu6tergt6p69ck76ogmitsa8mnijtpxm9fkcm736xtoncuohr3', 'nano'); + valid('xrb_13ezf4od79h1tgj9aiu4djzcmmguendtjfuhwfukhuucboua8cpoihmh8byo', 'nano'); + valid('xrb_35jjmmmh81kydepzeuf9oec8hzkay7msr6yxagzxpcht7thwa5bus5tomgz9', 'nano'); + valid('xrb_1111111111111111111111111111111111111111111111111111hifc8npp', 'nano'); + valid('xrb_1ipx847tk8o46pwxt5qjdbncjqcbwcc1rrmqnkztrfjy5k7z4imsrata9est', 'nano'); + valid('xrb_3wm37qz19zhei7nzscjcopbrbnnachs4p1gnwo5oroi3qonw6inwgoeuufdp', 'nano'); + valid('xrb_3arg3asgtigae3xckabaaewkx3bzsh7nwz7jkmjos79ihyaxwphhm6qgjps4', 'nano'); + valid('xrb_1f5e4w33ndqbkx4bw5jtp13kp5xghebfxcmw9hdt1f7goid1s4373w6tjmgu', 'nano'); + valid('xrb_1q79ahdr36uqn38p5tp5sqwkn73rnpj1k8obtuetdbjcx37d5gahhd1u9cuh', 'nano'); + valid('nano_1q79ahdr36uqn38p5tp5sqwkn73rnpj1k8obtuetdbjcx37d5gahhd1u9cuh', 'nano'); + }); + + it('should return true for correct siacoin addresses', function () { + valid( + 'a9b01c85163638682b170d82de02b8bb99ba86092e9ab1b0d25111284fe618e93456915820f1', + 'siacoin' + ) + valid( + 'a9b01c85163638682b170d82de02b8bb99ba86092e9ab1b0d25111284fe618e93456915820f1', + 'siacoin' + ) + valid( + 'ab0c327982abfcc6055a6c9551589167d8a73501aca8769f106371fbc937ad100c955c3b7ba9', + 'siacoin' + ) + valid( + 'ffe1308c044ade30392a0cdc1fd5a4dbe94f9616a95faf888ed36123d9e711557aa497530373', + 'siacoin' + ) + }) + + it('should return true for correct loki addresses', function () { + // public + valid( + 'L63ymg8cb5aRz1PhXrEQ22PWw9KBhBS8rMsgqbABhTGFfh53U3Rc2iWCJpCPsHZT5hfyt7fPQa612a5Z1tBnGYEA9h6YHnn', + 'loki' + ) + valid( + 'L5QKRGMNpQU3eCAdjMVTCR631bRKqnW1oEWWBEHAtFJLieA5VvuxyyubCd9FczEEatg8jfy39UJZ13npLJqZG6dtMtM99ha', + 'loki' + ) + // integrated + valid( + 'LK8CGQ17G9R3ys3Xf33wCeViD2B95jgdpjAhcRsjuheJ784dumXn7g3RPAzedWpFq364jJKYL9dkQ8mY66sZG9BiD1xbPb6dpYo7toNRqk', + 'loki' + ) + valid( + 'LK8CGQ17G9R3ys3Xf33wCeViD2B95jgdpjAhcRsjuheJ784dumXn7g3RPAzedWpFq364jJKYL9dkQ8mY66sZG9BiCtWq1AYo1oJTVqgUcQ', + 'loki' + ) + // subaddress + valid( + 'LW1VMYcvWPZZJ2h1pKGEku2y9WeDiAU2VhgrgVgvjybaRuCdcEkg6FhXjVNSd37Bp7fhYH8tVa5T9VmRaYiWyxYdCpEGBg8', + 'loki' + ) + }) + + it('should return true for correct lbry addresses', function () { + valid('bDb6NmobyDVeNGpizWQQBZkYjKCRQBdKdG', 'LBC') + valid('bTFXPcV3a8iVDezogvHTHezWZ1mZGWpPDc', 'lbc') + valid('bK2uEVn6UuwjCTUZ1Dfj5HhWYi9BtqZDDm', 'lbc') + valid('bNEMVqeUZUqTrYUxud5ehnUhtTAiWDXQ5e', 'lbc') + }) + + it('should return true for correct trx addresses', function () { + valid('TNDzfERDpxLDS2w1q6yaFC7pzqaSQ3Bg3r', 'trx'); + valid('27bLJCYjbH6MT8DBF9xcrK6yZnm43vx7MNQ', 'trx', 'testnet'); + }); + + it('should return true for correct nem addresses', function () { + valid('NBZMQO7ZPBYNBDUR7F75MAKA2S3DHDCIFG775N3D', 'xem'); + valid('TDWTRGT6GVWCV7GRWFNI45S53PGOJBKNUF3GE6PB', 'xem', 'testnet'); + }); + + it('should return true for correct lsk addresses', function () { + valid('469226551L', 'lsk'); + valid('15823701926930889868L', 'lsk'); + valid('1657699692452120239L', 'lsk'); + valid('555666666999992L', 'lsk'); + valid('6853061742992593192L', 'lsk'); + valid('530464791801L', 'lsk'); + }); + + it('should return true for correct bsv addresses', function () { + valid('qzwryn9fxnpqkf7zt878tp2g9cg8kpl65qh2ml0w0r', 'bsv'); + valid('qp65yngy5uds4wxtrkynptal4f76qzmrh52pa3mpaf', 'bsv'); + valid('bitcoincash:qq4v32mtagxac29my6gwj6fd4tmqg8rysu23dax807', 'bsv'); + valid('qq4v32mtagxac29my6gwj6fd4tmqg8rysu23dax807', 'bsv'); + valid('qz97s7ee0rvwlymtxrwafmvs87x6027jwuf3wepug7', 'bsv'); + valid('bitcoincash:qpp32ssez340wfspnt79h6c4xds4fzf3m5j0cplx0l', 'bsv'); + valid('qqg82u7tq2eahs3gkh9m6kjnmjehr69m5v37alepq4', 'bsv'); + valid('bitcoincash:qrwkk9a3es2wu7mdvzh0vekfvjuzysq8tv7r3hcwr5', 'bsv'); + valid('1DrNXqCj2B8FKyx66RAWDkiEJhw2yrvhT3', 'bsv'); + }); + + it('should return true for correct stellar addresses', function () { + valid('GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB', 'stellar'); + valid('GB7KKHHVYLDIZEKYJPAJUOTBE5E3NJAXPSDZK7O6O44WR3EBRO5HRPVT', 'stellar'); + valid('GD6WVYRVID442Y4JVWFWKWCZKB45UGHJAABBJRS22TUSTWGJYXIUR7N2', 'stellar'); + valid('GBCG42WTVWPO4Q6OZCYI3D6ZSTFSJIXIS6INCIUF23L6VN3ADE4337AP', 'stellar'); + valid('GDFX463YPLCO2EY7NGFMI7SXWWDQAMASGYZXCG2LATOF3PP5NQIUKBPT', 'stellar'); + valid('GBXEODUMM3SJ3QSX2VYUWFU3NRP7BQRC2ERWS7E2LZXDJXL2N66ZQ5PT', 'stellar'); + valid('GAJHORKJKDDEPYCD6URDFODV7CVLJ5AAOJKR6PG2VQOLWFQOF3X7XLOG', 'stellar'); + valid('GACXQEAXYBEZLBMQ2XETOBRO4P66FZAJENDHOQRYPUIXZIIXLKMZEXBJ', 'stellar'); + valid('GDD3XRXU3G4DXHVRUDH7LJM4CD4PDZTVP4QHOO4Q6DELKXUATR657OZV', 'stellar'); + valid('GDTYVCTAUQVPKEDZIBWEJGKBQHB4UGGXI2SXXUEW7LXMD4B7MK37CWLJ', 'stellar'); + }); + + it('should return true for correct xtz(tezos) address', function () { + valid('tz1Lhf4J9Qxoe3DZ2nfe8FGDnvVj7oKjnMY6', 'xtz'); + valid('tz1PyxsQ7xVTa5J7gtBeT7pST5Zi5nk5GSjg', 'xtz'); + valid('tz1LcuQHNVQEWP2fZjk1QYZGNrfLDwrT3SyZ', 'xtz'); + valid('tz1Lhf4J9Qxoe3DZ2nfe8FGDnvVj7oKjnMY6', 'xtz'); + valid('tz1RR6wETy9BeXG3Fjk25YmkSMGHxTtKkhpX', 'xtz'); + valid('tz1h3rQ8wBxFd8L9B3d7Jhaawu6Z568XU3xY', 'xtz'); + valid('KT1EM2LvxxFGB3Svh9p9HCP2jEEYyHjABMbK', 'xtz'); + }); + + it('should return true for correct eos addresses', function () { + valid('bittrexacct1', 'eos'); + valid('binancecleos', 'eos'); + valid('123456789012', 'eos'); + }); + }); + + describe('invalid results', function () { + function commonTests(currency) { + invalid('', currency); //reject blank + invalid('%%@', currency); //reject invalid base58 string + invalid('1A1zP1ePQGefi2DMPTifTL5SLmv7DivfNa', currency); //reject invalid address + invalid('bd839e4f6fadb293ba580df5dea7814399989983', currency); //reject transaction id's + //testnet + invalid('', currency, 'testnet'); //reject blank + invalid('%%@', currency, 'testnet'); //reject invalid base58 string + invalid('1A1zP1ePQGefi2DMPTifTL5SLmv7DivfNa', currency, 'testnet'); //reject invalid address + invalid('bd839e4f6fadb293ba580df5dea7814399989983', currency, 'testnet'); //reject transaction id's + } + + it('should return false for incorrect bitcoin addresses', function () { + commonTests('bitcoin'); + }); + + it('should return false for incorrect bitcoincash addresses', function () { + commonTests('bitcoincash'); + }); + + it('should return false for incorrect litecoin addresses', function () { + commonTests('litecoin'); + }); + + it('should return false for incorrect peercoin addresses', function () { + commonTests('peercoin'); + }); + + it('should return false for incorrect dogecoin addresses', function () { + commonTests('dogecoin'); + }); + + it('should return false for incorrect beavercoin addresses', function () { + commonTests('beavercoin'); + }); + + it('should return false for incorrect freicoin addresses', function () { + commonTests('freicoin'); + }); + + it('should return false for incorrect protoshares addresses', function () { + commonTests('protoshares'); + }); + + it('should return false for incorrect megacoin addresses', function () { + commonTests('megacoin'); + }); + + it('should return false for incorrect primecoin addresses', function () { + commonTests('primecoin'); + }); + + it('should return false for incorrect auroracoin addresses', function () { + commonTests('auroracoin'); + }); + + it('should return false for incorrect namecoin addresses', function () { + commonTests('namecoin'); + }); + + it('should return false for incorrect biocoin addresses', function () { + commonTests('biocoin'); + }); + + it('should return false for incorrect garlicoin addresses', function () { + commonTests('garlicoin'); + }); + + it('should return false for incorrect vertcoin addresses', function () { + commonTests('vertcoin'); + }); + + it('should return false for incorrect bitcoingold addresses', function () { + commonTests('bitcoingold'); + }); + + it('should return false for incorrect decred addresses', function () { + commonTests('decred'); + }); + + it('should return false for incorrect gamecredits addresses', function () { + commonTests('game'); + }); + + it('should return false for incorrect monacoin addresses', function () { + commonTests('mona'); + }); + + it('should return false for incorrect solarcoin addresses', function () { + commonTests('slr'); + }); + + it('should return false for incorrect tether addresses', function () { + commonTests('usdt'); + }); + + it('should return false for incorrect expanse addresses', function () { + commonTests('exp'); + }); + + it('should return false for incorrect usdt addresses', function () { + commonTests('usdt'); + }); + + it('should return false for incorrect bankex addresses', function () { + invalid('1SQHtwR5oJRKLfiWQ2APsAd9miUc4k2ez', 'bankex'); + invalid('116CGDLddrZhMrTwhCVJXtXQpxygTT1kHd', 'BKX'); + invalid('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef', 'bankex', 'testnet'); + invalid('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef', 'BKX', 'testnet'); + }); + + it('should return false for incorrect digibyte addresses', function () { + commonTests('digibyte'); + }); + + it('should return false for incorrect eip55 addresses', function () { + invalid('6xAff4d6793F584a473348EbA058deb8caad77a288', 'ethereum'); + invalid('0x02fcd51aAbB814FfFe17908fbc888A8975D839A5', 'ethereum'); + invalid('0XD1220A0CF47C7B9BE7A2E6BA89F429762E7B9ADB', 'ethereum'); + invalid('aFf4d6793f584a473348ebA058deb8caad77a2885', 'ethereum'); + invalid('0xff4d6793F584a473', 'ethereum'); + + invalid('0x02fcd51aAbB814FfFe17908fbc888A8975D839A5', 'ethereumclassic'); + invalid('0x02fcd51aAbB814FfFe17908fbc888A8975D839A5', 'etherzero'); + invalid('0x02fcd51aAbB814FfFe17908fbc888A8975D839A5', 'callisto'); + }); + + it('should return false for incorrect ripple addresses', function () { + invalid('rG1QQv2nh2gr7RCZ1P8YYcBUKCCN633jCN', 'ripple'); + invalid('rDTXLQ7ZKZVKz33zJbHjgVShjsBnqMBhMN', 'XRP'); + invalid('6xAff4d6793F584a473348EbA058deb8ca', 'ripple'); + invalid('DJ53hTyLBdZp2wMi5BsCS3rtEL1ioYUkva', 'ripple'); + }); + + it('should return false for incorrect dash addresses', function () { + commonTests('dash'); + }); + + it('should return false for incorrect neo addresses', function () { + commonTests('neo'); + invalid('AR4QmqYENiZAD6oXe7ftm6eDcwtHk7rVTa', 'neo'); + invalid('AKDVzYGLczmykdtRaejgvWeZrvdkVEvQ10', 'NEO'); + }); + + it('should return false for incorrect qtum addresses', function () { + commonTests('qtum'); + invalid('QNPhBbVhDghASxcUh2vHotQUgNeLRFTcfb', 'qtum'); + invalid('QOPhBbVhDghASxcUh2vHotQUgNeLRFTcfa', 'QTUM'); + }); + + it('should return false for incorrect votecoin addresses', function () { + commonTests('votecoin'); + invalid('t1Y9yhDa5XEjgfnTgZoKddeSiEN1aoLkQxq', 'votecoin'); + invalid('t3Yz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd', 'VOT'); + invalid('t2YNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'votecoin', 'testnet'); + }); + + it('should return false for incorrect bitcoinz addresses', function () { + commonTests('bitcoinz'); + invalid('t1Y9yhDa5XEjgfnTgZoKddeSiEN1aoLkQxq', 'bitcoinz'); + invalid('t3Yz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd', 'BTCZ'); + invalid('t2YNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'bitcoinz', 'testnet'); + }); + + it('should return false for incorrect zclassic addresses', function () { + commonTests('zclassic'); + invalid('t1Y9yhDa5XEjgfnTgZoKddeSiEN1aoLkQxq', 'zclassic'); + invalid('t3Yz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd', 'ZCL'); + invalid('t2YNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'zclassic', 'testnet'); + }); + + it('should return false for incorrect hush addresses', function () { + invalid('t1Y9yhDa5XEjgfnTgZoKddeSiEN1aoLkQxq', 'hush'); + invalid('t3Yz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd', 'HUSH'); + invalid('t2YNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'hush', 'testnet'); + }); + + it('should return false for incorrect zcash addresses', function () { + commonTests('zcash'); + invalid('t1Y9yhDa5XEjgfnTgZoKddeSiEN1aoLkQxq', 'zcash'); + invalid('t3Yz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd', 'ZEC'); + invalid('t2YNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'zcash', 'testnet'); + }); + + it('should return false for incorrect bitcoinprivate addresses', function () { + commonTests('bitcoinprivate'); + invalid('b1Y4XXPFhwMb1SP33yhzn3h9qWXjujkgep4', 'bitcoinprivate'); + //invalid('bx....', 'BTCP'); + //invalid('nx....', 'bitcoinprivate', 'testnet'); + }); + + it('should return false for incorrect snowgem addresses', function () { + commonTests('snowgem'); + invalid('s1Yx7WBkjB4UH6qQjPp6Ysmtr1C1JiTK2Yw', 'snowgem'); + invalid('s3Y27MhkBRt3ha2UuxhjXaYF4DCnttTMnL1', 'SNG'); + invalid('t2YNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'snowgem', 'testnet'); + }); + + it('should return false for incorrect zencash addresses', function () { + commonTests('zencash'); + invalid('znYiGGfYRepxkBjXYvA2kFrXiC351i9ta4z', 'zencash'); + invalid('zsYEdGnZCQ9G86LZFtbynMn1hYTVhn6eYCL', 'ZEN'); + invalid('ztYWMDLWjbruCJxKmmfAZiT6QAQdiv5F291', 'zencash', 'testnet'); + }); + + it('should return false for incorrect komodo addresses', function () { + commonTests('komodo'); + invalid('R9Y5HirAzqDcWrWGiJEL115dpV3QB3hobH', 'komodo'); + invalid('RAYj2KKVUohTu3hVdNJ4U6hQi7TNawpacH', 'KMD'); + //invalid('t2YNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'komodo', 'testnet'); + }); + + it('should return false for incorrect cardano addresses', function () { + commonTests('cardano'); + invalid('Ae2tdPwUPEYxYNJw1He1esdZYvjmr4NtPzUsGTiqL9zd8ohjZYQcwu6lom7', 'cardano'); + invalid('DdzFFzCqrhsfdzUZxvuBkhV8Lpm9p43p9ubh79GCTkxJikAjKh51qhtCFMqUniC5tv5ZExyvSmAte2Du2tGimavSo6qSgXbjiy8qZRTg1', 'cardano'); + invalid('DdzFFzCqrhsfdzUZxvuBkhV8Lpm9p43p9ubh79GCTkxJikAjKh51qhtCFMqUniC5tv5ZExyvSmAte2Du2tGimavSo6qSgXbjiy8qZRT', 'ada'); + //invalid('t2YNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'komodo', 'testnet'); + }); + + it('should return false for incorrect monero addresses', function () { + commonTests('monero'); + invalid('4AWygwA3hHNE4e4Yr9PtRWJiorXTjZkCi57g4ExYzfXDFFQ8DRFEFyui1dLqVknpqQjGUBdTMbgaFAZaDbrVHdk3GAKBZ3E', 'monero'); + invalid('44643dtxcxjgMWEQLo6mh1c4d9Zxx9GbgK9hEj9iGSiFEryCkbwHyJ3JqxZJRqeC3Hb7ZBLKq5NkaJwR1x95EYnR1bTgN6d', 'xmr'); + invalid('A17N9ztrxjQD3v3JJtHGvHVnq6BAbujDNEuensB6PFwBYFpkjAicih8hDtX76HBuEag5NeaCuMZmRMe6eE5NMRGxFTQn8nJ', 'monero', 'testnet'); + + //integrated + invalid('4LNSCKNSTPNbJYkyAEgL966eHJHLDHiq1PpwKoiFBybcSqNGYfLBJApC62uQEeGAFxfYEd29uXBBrJFo7DhKqFVNi3GhmN79EtD5dgycYz', 'monero'); + invalid('4JpzTwf3i1GeCV76beVr19179oa8j1L8xNSC1bXMtAxxdf4aTTLqubL8EvXfQmUGKt9MMigFtKy91VtoTTSfg1LU7LocPruT6KcGC9RKJV', 'xmr'); + }); + + it('should return false for incorrect waves addresses', function () { + commonTests('waves'); + invalid('3P93mVrYnQ4ahaRMYwA2BeWY32eDxTpLVEs1', 'waves'); + invalid('3P4eeU7v1LMHQFwwT2GW9W99c6vZyytHaj', 'waves'); + invalid('2P93mVrYnQ4ahaRMYwA2BeWY32eDxTpLVEs', 'waves'); + + invalid('3Myrq5QDgRq3nBVRSSv9UYRP36xTtpJND5y', 'waves', 'testnet'); + invalid('3My3KZgFQ3CrVHgz6vGRt8787sH4oAA1qp8', 'waves', 'testnet'); + }); + + it('should return false for incorrect nano addresses', function () { + commonTests('nano'); + invalid('xrb_1f5e4w33ndqbkx4bw5jtp13kp5xghebfxcmw9hdt1f7goid1s4373w6tjdgu', 'nano'); + invalid('nano_1f5e4w33ndqbkx4bw5jtp13kp5xghebfxcmw9hdt1f7goid1s4373w6tjdgu', 'nano'); + invalid('xrb_1111111112111111111111111111111111111111111111111111hifc8npp', 'nano'); + invalid('nano_111111111111111111111111111111111111111111111111111hifc8npp', 'nano'); + }); + + it('should return false for incorrect siacoin addresses', function () { + commonTests('siacoin') + invalid( + 'ffe1308c044ade30392a0cdc1fd5a4dbe94f9616a95faf888ed36123d9e711557aa497530372', + 'siacoin' + ) + }) + + it('should return false for incorrect lbry addresses', function () { + commonTests('lbc') + invalid('ffe1308c044ade30392a0cdc1fd5a4dbe94f9616a95faf888ed36123d9e711557aa497530372') + }) + + it('should return false for incorrect tron addresses', function () { + commonTests('trx'); + invalid('xrb_1111111112111111111111111111111111111111111111111111hifc8npp', 'trx'); + invalid('TNDzfERDpxLDS2w1q6yaFC7pzqaSQ3Bg31', 'trx'); + }); + + it('should return false for incorrect nem addresses', function () { + commonTests('nem'); + invalid('xrb_1111111112111111111111111111111111111111111111111111hifc8npp', 'nem'); + invalid('TNDzfERDpxLDS2w1q6yaFC7pzqaSQ3Bg31', 'nem'); + + invalid('3Myrq5QDgRq3nBVRSSv9UYRP36xTtpJND5y', 'nem', 'testnet'); + invalid('3My3KZgFQ3CrVHgz6vGRt8787sH4oAA1qp8', 'nem', 'testnet'); + }); + //15823701926930889868L + it('should return false for incorrect lsk addresses', function () { + commonTests('lsk'); + invalid('xrb_1111111112111111111111111111111111111111111111111111hifc8npp', 'lsk'); + invalid('TNDzfERDpxLDS2w1q6yaFC7pzqaSQ3Bg31', 'lsk'); + + invalid('158237019269308898689L', 'lsk'); + invalid('158237A192B930C898689L', 'lsk'); + }); + + it('should return false for incorrect bsv addresses', function () { + commonTests('bsv'); + invalid('xrb_1111111112111111111111111111111111111111111111111111hifc8npp', 'bsv'); + invalid('TNDzfERDpxLDS2w1q6yaFC7pzqaSQ3Bg31', 'bsv'); + + invalid('158237019269308898689L', 'bsv'); + invalid('158237A192B930C898689L', 'bsv'); + invalid('bitcoin:qzpuefrpg3kl2ykQe52rxn96pd3Kp4qudywr5pyrsf', 'bsv'); + invalid('pzuefrpg3kl2ykqe52rxn96pd3kp4qudywr5py', 'bsv'); + invalid('rlt2c2wuxr644encp3as0hygtj9djrsaumku3cex5', 'bsv'); + invalid('qra607y4wnkmnpy3wcmrxmltzkrxywcq85c7watpdx09', 'bsv'); + }); + + it('should return false for incorrect stellar addresses', function () { + commonTests('stellar'); + invalid('SBGWKM3CD4IL47QN6X54N6Y33T3JDNVI6AIJ6CD5IM47HG3IG4O36XCU', 'stellar'); + invalid('GBPXX0A5N4JYPESHAADMQKBPWZWQDQ64ZV6ZL2S3LAGW4SY7NTCMWIVL', 'stellar'); + invalid('GCFZB6L25D26RQFDWSSBDEYQ32JHLRMTT44ZYE3DZQUTYOL7WY43PLBG++', 'stellar'); + invalid('GADE5QJ2TY7S5ZB65Q43DFGWYWCPHIYDJ2326KZGAGBN7AE5UY6JVDRRA', 'stellar'); + invalid('GB6OWYST45X57HCJY5XWOHDEBULB6XUROWPIKW77L5DSNANBEQGUPADT2', 'stellar'); + invalid('GB6OWYST45X57HCJY5XWOHDEBULB6XUROWPIKW77L5DSNANBEQGUPADT2T', 'stellar'); + invalid('GDXIIZTKTLVYCBHURXL2UPMTYXOVNI7BRAEFQCP6EZCY4JLKY4VKFNLT', 'stellar'); + invalid('SAB5556L5AN5KSR5WF7UOEFDCIODEWEO7H2UR4S5R62DFTQOGLKOVZDY', 'stellar'); + invalid('gWRYUerEKuz53tstxEuR3NCkiQDcV4wzFHmvLnZmj7PUqxW2wt', 'stellar'); + invalid('g4VPBPrHZkfE8CsjuG2S4yBQNd455UWmk', 'stellar'); + }); + + it('should return false for incorrect xtz(tezos) address', function () { + commonTests('xtz'); + invalid('SBGWKM3CD4IL47QN6X54N6Y33T3JDNVI6AIJ6CD5IM47HG3IG4O36XCU', 'xtz'); + invalid('GBPXX0A5N4JYPESHAADMQKBPWZWQDQ64ZV6ZL2S3LAGW4SY7NTCMWIVL', 'xtz'); + invalid('GCFZB6L25D26RQFDWSSBDEYQ32JHLRMTT44ZYE3DZQUTYOL7WY43PLBG', 'xtz'); + invalid('tz1RR6wy9BeXG3Fjk25YmkSMGHxTtKkhpX', 'xtz'); + invalid('tz1h3rQ8wBxFd8L9B3d7JhaPQawu6Z568XU3xY', 'xtz'); + invalid('tz1Lhf4J9Qxoe4DZ2nfe8FGDnvVj7oKjnMY6', 'xtz'); + invalid('KT1E2LvxxFGB3Svh9p9HCP2jEEYyHjABMbK', 'xtz'); + + }); + + it('should return false for incorrect eos addresses', function () { + commonTests('eos'); + invalid('1234567890123', 'eos'); + invalid('12345678901', 'eos'); + invalid('12345678901@', 'eos'); + }); + + }); + + it('should return true for correct monero addresses', function () { + valid('47zQ5LAivg6hNCgijXSEFVLX7mke1bgM6YGLFaANDoJbgXDymcAAZvvMNt2PmMpqEe5qRy2zyfMYXdwpmdyitiFh84xnPG2', 'monero'); + valid('48bWuoDG75CXMDHbmPEvUF2hm1vLDic7ZJ7hqRkL65QR9p13AQAX4eEACXNk4YP115Q4KRVZnAvmMBHrcGfv9FvKPZnH6vH', 'XMR'); + valid('A2be3UvzMtkJtxRYgcCbQt2y7Rp2eLVGqNTWfZeankrWimSMM4y7uMP6B9oAZaHsXTj8KFSerkSkkVRuEuEca9QM8VhxCNU', 'monero', 'testnet'); + + //integrated addresses + valid('4Gd4DLiXzBmbVX2FZZ3Cvu6fUaWACup1qDowprUCje1kSP4FmbftiJMSfV8kWZXNqmVwj4m52xqtgFNUudVmsmGkGvkLcCibWfVUfUFVB7', 'monero'); + valid('4J5sF94AzXgFgx8LuWc9dcWkJkGkD3cL3L2AuhX6QA9jFvSxxj6QhHqHXqM2b2Go7G8RyDzEbHxYd9G26XUUbuJChipEyBz9fENMU2Ua9b', 'XMR'); + + //stagenet public address + valid('5BAP9qLbRseYrGneYVRaFANMajuaD4KZrf3fGWvt5cVDR1xUXm6qoFYLkgU6Vp12fs2R24r4269inAWHFEdsLnE87rGCxYK', 'XMR', 'stagenet'); + + //stagenet integrated address + valid('5Ls4AeA639AYrGneYVRaFANMajuaD4KZrf3fGWvt5cVDR1xUXm6qoFYLkgU6Vp12fs2R24r4269inAWHFEdsLnE8BCU5Q2gDkbq2HYDrn2', 'monero', 'both'); + }); + + it('should return true for correct gamecredits addresses', function () { + valid('GU5BBtW9gxSKvAknvFi9yUaXKUNW9zUN2p', 'game'); + valid('GYxQMVzP6YpzX59QNRYqmJeHNtUMYSZPri', 'game'); + }); + + it('should return true for correct monacoin addresses', function () { + valid('MMN1Q1aRVUzanmg9DJjcRYzQSJQoBeQPui', 'mona'); + valid('PFMzNYnBm5X4c9qJkJPkfgdCyd9fuuy2vT', 'mona'); + valid('PCtN7VUYHW8w4g59BaphrfPs8g7pNgAzxn', 'mona'); + valid('MXCcYFGRmsd4d3CcQugFiqG8uarj5tVu76', 'mona'); + valid('MNK1pGsBf9WdoE54fZM9VFhkeYHW6VUf2u', 'mona'); + }); + + it('should return true for correct pivx addresses', function () { + valid('DJXFW9oJJBUX7QKrG6GKvmTs63MYKzwtpZ', 'pivx'); + valid('DEaYb8EHQgyKvX6VXDS3DZQautJrHBmK3T', 'pivx'); + valid('DDeCGR3QSgqsBxVR23bJvteiyYE34ZmxAc', 'pivx'); + valid('DSqQM8DPpBHHoZXHgRdwmaf6hZPEoZcFkh', 'pivx'); + }); + + it('should return true for correct solarcoin addresses', function () { + valid('8VxVLzwB26E2YZZ82o1NcQe96QSM2z6GwW', 'slr'); + valid('8YW5qcTjeyqX5kESsqu2BUdXiedgssegtQ', 'SolarCoin'); + }); + + it('should return true for correct tether addresses', function () { + valid('3MbYQMMmSkC3AgWkj9FMo5LsPTW1zBTwXL', 'usdt'); + valid('1KdXaqcBeoMAFVAPwTmYvDbEq6RnvNPF6J', 'tether'); + }); + + it('should return true for correct expanse addresses', function () { + valid('0xbab463743603a253bdf1f84975b1a9517505ae05', 'exp'); + valid('0x5d0777cb5d6977873904864c6ab531f4b3261f0b', 'expanse'); + }); + + it('should return true for correct waves addresses', function () { + valid('3P93mVrYnQ4ahaRMYwA2BeWY32eDxTpLVEs', 'waves'); + valid('3P4eeU7v1LMHQFwwT2GW9W99c6vZyytHajj', 'waves'); + + valid('3Myrq5QDgRq3nBVRSSv9UYrP36xTtpJND5y', 'waves', 'testnet'); + valid('3My3KZgFQ3CrVHgz6vGRt8687sH4oAA1qp8', 'waves', 'testnet'); + }); + + it('should return true for correct nano addresses', function () { + valid('xrb_3t6k35gi95xu6tergt6p69ck76ogmitsa8mnijtpxm9fkcm736xtoncuohr3', 'nano'); + valid('xrb_13ezf4od79h1tgj9aiu4djzcmmguendtjfuhwfukhuucboua8cpoihmh8byo', 'nano'); + valid('xrb_35jjmmmh81kydepzeuf9oec8hzkay7msr6yxagzxpcht7thwa5bus5tomgz9', 'nano'); + valid('xrb_1111111111111111111111111111111111111111111111111111hifc8npp', 'nano'); + valid('xrb_1ipx847tk8o46pwxt5qjdbncjqcbwcc1rrmqnkztrfjy5k7z4imsrata9est', 'nano'); + valid('xrb_3wm37qz19zhei7nzscjcopbrbnnachs4p1gnwo5oroi3qonw6inwgoeuufdp', 'nano'); + valid('xrb_3arg3asgtigae3xckabaaewkx3bzsh7nwz7jkmjos79ihyaxwphhm6qgjps4', 'nano'); + valid('xrb_1f5e4w33ndqbkx4bw5jtp13kp5xghebfxcmw9hdt1f7goid1s4373w6tjmgu', 'nano'); + valid('xrb_1q79ahdr36uqn38p5tp5sqwkn73rnpj1k8obtuetdbjcx37d5gahhd1u9cuh', 'nano'); + valid('nano_1q79ahdr36uqn38p5tp5sqwkn73rnpj1k8obtuetdbjcx37d5gahhd1u9cuh', 'nano'); + }); + + it('should return true for correct siacoin addresses', function () { + valid( + 'a9b01c85163638682b170d82de02b8bb99ba86092e9ab1b0d25111284fe618e93456915820f1', + 'siacoin' + ) + valid( + 'a9b01c85163638682b170d82de02b8bb99ba86092e9ab1b0d25111284fe618e93456915820f1', + 'siacoin' + ) + valid( + 'ab0c327982abfcc6055a6c9551589167d8a73501aca8769f106371fbc937ad100c955c3b7ba9', + 'siacoin' + ) + valid( + 'ffe1308c044ade30392a0cdc1fd5a4dbe94f9616a95faf888ed36123d9e711557aa497530373', + 'siacoin' + ) + }) + + it('should return true for correct loki addresses', function () { + // public + valid( + 'L63ymg8cb5aRz1PhXrEQ22PWw9KBhBS8rMsgqbABhTGFfh53U3Rc2iWCJpCPsHZT5hfyt7fPQa612a5Z1tBnGYEA9h6YHnn', + 'loki' + ) + valid( + 'L5QKRGMNpQU3eCAdjMVTCR631bRKqnW1oEWWBEHAtFJLieA5VvuxyyubCd9FczEEatg8jfy39UJZ13npLJqZG6dtMtM99ha', + 'loki' + ) + // integrated + valid( + 'LK8CGQ17G9R3ys3Xf33wCeViD2B95jgdpjAhcRsjuheJ784dumXn7g3RPAzedWpFq364jJKYL9dkQ8mY66sZG9BiD1xbPb6dpYo7toNRqk', + 'loki' + ) + valid( + 'LK8CGQ17G9R3ys3Xf33wCeViD2B95jgdpjAhcRsjuheJ784dumXn7g3RPAzedWpFq364jJKYL9dkQ8mY66sZG9BiCtWq1AYo1oJTVqgUcQ', + 'loki' + ) + // subaddress + valid( + 'LW1VMYcvWPZZJ2h1pKGEku2y9WeDiAU2VhgrgVgvjybaRuCdcEkg6FhXjVNSd37Bp7fhYH8tVa5T9VmRaYiWyxYdCpEGBg8', + 'loki' + ) + }) + + it('should return true for correct lbry addresses', function () { + valid('bNEMVqeUZUqTrYUxud5ehnUhtTAiWDXQ5e', 'lbc') + valid('bDb6NmobyDVeNGpizWQQBZkYjKCRQBdKdG', 'LBC') + valid('bTFXPcV3a8iVDezogvHTHezWZ1mZGWpPDc', 'lbc') + valid('bK2uEVn6UuwjCTUZ1Dfj5HhWYi9BtqZDDm', 'LBRY Credits') + }) + + it('should return true for correct trx addresses', function () { + valid('TNDzfERDpxLDS2w1q6yaFC7pzqaSQ3Bg3r', 'trx'); + valid('27bLJCYjbH6MT8DBF9xcrK6yZnm43vx7MNQ', 'trx', 'testnet'); + }); + + it('should return true for correct nem addresses', function () { + valid('NBZMQO7ZPBYNBDUR7F75MAKA2S3DHDCIFG775N3D', 'xem'); + valid('TDWTRGT6GVWCV7GRWFNI45S53PGOJBKNUF3GE6PB', 'xem', 'testnet'); + }); + + it('should return true for correct lsk addresses', function () { + valid('469226551L', 'lsk'); + valid('15823701926930889868L', 'lsk'); + valid('1657699692452120239L', 'lsk'); + valid('555666666999992L', 'lsk'); + valid('6853061742992593192L', 'lsk'); + valid('530464791801L', 'lsk'); + }); + + it('should return true for correct bsv addresses', function () { + valid('qzwryn9fxnpqkf7zt878tp2g9cg8kpl65qh2ml0w0r', 'bsv'); + valid('qp65yngy5uds4wxtrkynptal4f76qzmrh52pa3mpaf', 'bsv'); + valid('bitcoincash:qq4v32mtagxac29my6gwj6fd4tmqg8rysu23dax807', 'bsv'); + valid('qq4v32mtagxac29my6gwj6fd4tmqg8rysu23dax807', 'bsv'); + valid('qz97s7ee0rvwlymtxrwafmvs87x6027jwuf3wepug7', 'bsv'); + valid('bitcoincash:qpp32ssez340wfspnt79h6c4xds4fzf3m5j0cplx0l', 'bsv'); + valid('qqg82u7tq2eahs3gkh9m6kjnmjehr69m5v37alepq4', 'bsv'); + valid('bitcoincash:qrwkk9a3es2wu7mdvzh0vekfvjuzysq8tv7r3hcwr5', 'bsv'); + valid('1DrNXqCj2B8FKyx66RAWDkiEJhw2yrvhT3', 'bsv'); + }); + + it('should return true for correct stellar addresses', function () { + valid('GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB', 'stellar'); + valid('GB7KKHHVYLDIZEKYJPAJUOTBE5E3NJAXPSDZK7O6O44WR3EBRO5HRPVT', 'stellar'); + valid('GD6WVYRVID442Y4JVWFWKWCZKB45UGHJAABBJRS22TUSTWGJYXIUR7N2', 'stellar'); + valid('GBCG42WTVWPO4Q6OZCYI3D6ZSTFSJIXIS6INCIUF23L6VN3ADE4337AP', 'stellar'); + valid('GDFX463YPLCO2EY7NGFMI7SXWWDQAMASGYZXCG2LATOF3PP5NQIUKBPT', 'stellar'); + valid('GBXEODUMM3SJ3QSX2VYUWFU3NRP7BQRC2ERWS7E2LZXDJXL2N66ZQ5PT', 'stellar'); + valid('GAJHORKJKDDEPYCD6URDFODV7CVLJ5AAOJKR6PG2VQOLWFQOF3X7XLOG', 'stellar'); + valid('GACXQEAXYBEZLBMQ2XETOBRO4P66FZAJENDHOQRYPUIXZIIXLKMZEXBJ', 'stellar'); + valid('GDD3XRXU3G4DXHVRUDH7LJM4CD4PDZTVP4QHOO4Q6DELKXUATR657OZV', 'stellar'); + valid('GDTYVCTAUQVPKEDZIBWEJGKBQHB4UGGXI2SXXUEW7LXMD4B7MK37CWLJ', 'stellar'); + }); +}); + +describe('invalid results', function () { + function commonTests(currency) { + invalid('', currency); //reject blank + invalid('%%@', currency); //reject invalid base58 string + invalid('1A1zP1ePQGefi2DMPTifTL5SLmv7DivfNa', currency); //reject invalid address + invalid('bd839e4f6fadb293ba580df5dea7814399989983', currency); //reject transaction id's + //testnet + invalid('', currency, 'testnet'); //reject blank + invalid('%%@', currency, 'testnet'); //reject invalid base58 string + invalid('1A1zP1ePQGefi2DMPTifTL5SLmv7DivfNa', currency, 'testnet'); //reject invalid address + invalid('bd839e4f6fadb293ba580df5dea7814399989983', currency, 'testnet'); //reject transaction id's + } + + it('should return false for incorrect bitcoin addresses', function () { + commonTests('bitcoin'); + }); + + it('should return false for incorrect bitcoincash addresses', function () { + commonTests('bitcoincash'); + }); + + it('should return false for incorrect litecoin addresses', function () { + commonTests('litecoin'); + }); + + it('should return false for incorrect peercoin addresses', function () { + commonTests('peercoin'); + }); + + it('should return false for incorrect dogecoin addresses', function () { + commonTests('dogecoin'); + }); + + it('should return false for incorrect beavercoin addresses', function () { + commonTests('beavercoin'); + }); + + it('should return false for incorrect freicoin addresses', function () { + commonTests('freicoin'); + }); + + it('should return false for incorrect protoshares addresses', function () { + commonTests('protoshares'); + }); + + it('should return false for incorrect megacoin addresses', function () { + commonTests('megacoin'); + }); + + it('should return false for incorrect primecoin addresses', function () { + commonTests('primecoin'); + }); + + it('should return false for incorrect auroracoin addresses', function () { + commonTests('auroracoin'); + }); + + it('should return false for incorrect namecoin addresses', function () { + commonTests('namecoin'); + }); + + it('should return false for incorrect biocoin addresses', function () { + commonTests('biocoin'); + }); + + it('should return false for incorrect garlicoin addresses', function () { + commonTests('garlicoin'); + }); + + it('should return false for incorrect vertcoin addresses', function () { + commonTests('vertcoin'); + }); + + it('should return false for incorrect bitcoingold addresses', function () { + commonTests('bitcoingold'); + }); + + it('should return false for incorrect decred addresses', function () { + commonTests('decred'); + }); + + it('should return false for incorrect gamecredits addresses', function () { + commonTests('game'); + }); + + it('should return false for incorrect monacoin addresses', function () { + commonTests('mona'); + }); + + it('should return false for incorrect solarcoin addresses', function () { + commonTests('slr'); + }); + + it('should return false for incorrect tether addresses', function () { + commonTests('usdt'); + }); + + it('should return false for incorrect expanse addresses', function () { + commonTests('exp'); + }); + + it('should return false for incorrect usdt addresses', function () { + commonTests('usdt'); + }); + + it('should return false for incorrect bankex addresses', function () { + invalid('1SQHtwR5oJRKLfiWQ2APsAd9miUc4k2ez', 'bankex'); + invalid('116CGDLddrZhMrTwhCVJXtXQpxygTT1kHd', 'BKX'); + invalid('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef', 'bankex', 'testnet'); + invalid('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef', 'BKX', 'testnet'); + }); + + it('should return false for incorrect digibyte addresses', function () { + commonTests('digibyte'); + }); + + it('should return false for incorrect eip55 addresses', function () { + invalid('6xAff4d6793F584a473348EbA058deb8caad77a288', 'ethereum'); + invalid('0x02fcd51aAbB814FfFe17908fbc888A8975D839A5', 'ethereum'); + invalid('0XD1220A0CF47C7B9BE7A2E6BA89F429762E7B9ADB', 'ethereum'); + invalid('aFf4d6793f584a473348ebA058deb8caad77a2885', 'ethereum'); + invalid('0xff4d6793F584a473', 'ethereum'); + + invalid('0x02fcd51aAbB814FfFe17908fbc888A8975D839A5', 'ethereumclassic'); + invalid('0x02fcd51aAbB814FfFe17908fbc888A8975D839A5', 'etherzero'); + invalid('0x02fcd51aAbB814FfFe17908fbc888A8975D839A5', 'callisto'); + }); + + it('should return false for incorrect ripple addresses', function () { + invalid('rG1QQv2nh2gr7RCZ1P8YYcBUKCCN633jCN', 'ripple'); + invalid('rDTXLQ7ZKZVKz33zJbHjgVShjsBnqMBhMN', 'XRP'); + invalid('6xAff4d6793F584a473348EbA058deb8ca', 'ripple'); + invalid('DJ53hTyLBdZp2wMi5BsCS3rtEL1ioYUkva', 'ripple'); + }); + + it('should return false for incorrect dash addresses', function () { + commonTests('dash'); + }); + + it('should return false for incorrect neo addresses', function () { + commonTests('neo'); + invalid('AR4QmqYENiZAD6oXe7ftm6eDcwtHk7rVTa', 'neo'); + invalid('AKDVzYGLczmykdtRaejgvWeZrvdkVEvQ10', 'NEO'); + }); + + it('should return false for incorrect qtum addresses', function () { + commonTests('qtum'); + invalid('QNPhBbVhDghASxcUh2vHotQUgNeLRFTcfb', 'qtum'); + invalid('QOPhBbVhDghASxcUh2vHotQUgNeLRFTcfa', 'QTUM'); + }); + + it('should return false for incorrect votecoin addresses', function () { + commonTests('votecoin'); + invalid('t1Y9yhDa5XEjgfnTgZoKddeSiEN1aoLkQxq', 'votecoin'); + invalid('t3Yz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd', 'VOT'); + invalid('t2YNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'votecoin', 'testnet'); + }); + + it('should return false for incorrect bitcoinz addresses', function () { + commonTests('bitcoinz'); + invalid('t1Y9yhDa5XEjgfnTgZoKddeSiEN1aoLkQxq', 'bitcoinz'); + invalid('t3Yz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd', 'BTCZ'); + invalid('t2YNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'bitcoinz', 'testnet'); + }); + + it('should return false for incorrect zclassic addresses', function () { + commonTests('zclassic'); + invalid('t1Y9yhDa5XEjgfnTgZoKddeSiEN1aoLkQxq', 'zclassic'); + invalid('t3Yz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd', 'ZCL'); + invalid('t2YNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'zclassic', 'testnet'); + }); + + it('should return false for incorrect hush addresses', function () { + invalid('t1Y9yhDa5XEjgfnTgZoKddeSiEN1aoLkQxq', 'hush'); + invalid('t3Yz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd', 'HUSH'); + invalid('t2YNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'hush', 'testnet'); + }); + + it('should return false for incorrect zcash addresses', function () { + commonTests('zcash'); + invalid('t1Y9yhDa5XEjgfnTgZoKddeSiEN1aoLkQxq', 'zcash'); + invalid('t3Yz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd', 'ZEC'); + invalid('t2YNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'zcash', 'testnet'); + }); + + it('should return false for incorrect bitcoinprivate addresses', function () { + commonTests('bitcoinprivate'); + invalid('b1Y4XXPFhwMb1SP33yhzn3h9qWXjujkgep4', 'bitcoinprivate'); + //invalid('bx....', 'BTCP'); + //invalid('nx....', 'bitcoinprivate', 'testnet'); + }); + + it('should return false for incorrect snowgem addresses', function () { + commonTests('snowgem'); + invalid('s1Yx7WBkjB4UH6qQjPp6Ysmtr1C1JiTK2Yw', 'snowgem'); + invalid('s3Y27MhkBRt3ha2UuxhjXaYF4DCnttTMnL1', 'SNG'); + invalid('t2YNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'snowgem', 'testnet'); + }); + + it('should return false for incorrect zencash addresses', function () { + commonTests('zencash'); + invalid('znYiGGfYRepxkBjXYvA2kFrXiC351i9ta4z', 'zencash'); + invalid('zsYEdGnZCQ9G86LZFtbynMn1hYTVhn6eYCL', 'ZEN'); + invalid('ztYWMDLWjbruCJxKmmfAZiT6QAQdiv5F291', 'zencash', 'testnet'); + }); + + it('should return false for incorrect komodo addresses', function () { + commonTests('komodo'); + invalid('R9Y5HirAzqDcWrWGiJEL115dpV3QB3hobH', 'komodo'); + invalid('RAYj2KKVUohTu3hVdNJ4U6hQi7TNawpacH', 'KMD'); + //invalid('t2YNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'komodo', 'testnet'); + }); + + it('should return false for incorrect cardano addresses', function () { + commonTests('cardano'); + invalid('Ae2tdPwUPEYxYNJw1He1esdZYvjmr4NtPzUsGTiqL9zd8ohjZYQcwu6lom7', 'cardano'); + invalid('DdzFFzCqrhsfdzUZxvuBkhV8Lpm9p43p9ubh79GCTkxJikAjKh51qhtCFMqUniC5tv5ZExyvSmAte2Du2tGimavSo6qSgXbjiy8qZRTg1', 'cardano'); + invalid('DdzFFzCqrhsfdzUZxvuBkhV8Lpm9p43p9ubh79GCTkxJikAjKh51qhtCFMqUniC5tv5ZExyvSmAte2Du2tGimavSo6qSgXbjiy8qZRT', 'ada'); + //invalid('t2YNzUUx8mWBCRYPRezvA363EYXyEpHokyi', 'komodo', 'testnet'); + }); + + it('should return false for incorrect monero addresses', function () { + commonTests('monero'); + invalid('4AWygwA3hHNE4e4Yr9PtRWJiorXTjZkCi57g4ExYzfXDFFQ8DRFEFyui1dLqVknpqQjGUBdTMbgaFAZaDbrVHdk3GAKBZ3E', 'monero'); + invalid('44643dtxcxjgMWEQLo6mh1c4d9Zxx9GbgK9hEj9iGSiFEryCkbwHyJ3JqxZJRqeC3Hb7ZBLKq5NkaJwR1x95EYnR1bTgN6d', 'xmr'); + invalid('A17N9ztrxjQD3v3JJtHGvHVnq6BAbujDNEuensB6PFwBYFpkjAicih8hDtX76HBuEag5NeaCuMZmRMe6eE5NMRGxFTQn8nJ', 'monero', 'testnet'); + + //integrated + invalid('4LNSCKNSTPNbJYkyAEgL966eHJHLDHiq1PpwKoiFBybcSqNGYfLBJApC62uQEeGAFxfYEd29uXBBrJFo7DhKqFVNi3GhmN79EtD5dgycYz', 'monero'); + invalid('4JpzTwf3i1GeCV76beVr19179oa8j1L8xNSC1bXMtAxxdf4aTTLqubL8EvXfQmUGKt9MMigFtKy91VtoTTSfg1LU7LocPruT6KcGC9RKJV', 'xmr'); + }); + + it('should return false for incorrect waves addresses', function () { + commonTests('waves'); + invalid('3P93mVrYnQ4ahaRMYwA2BeWY32eDxTpLVEs1', 'waves'); + invalid('3P4eeU7v1LMHQFwwT2GW9W99c6vZyytHaj', 'waves'); + invalid('2P93mVrYnQ4ahaRMYwA2BeWY32eDxTpLVEs', 'waves'); + + invalid('3Myrq5QDgRq3nBVRSSv9UYRP36xTtpJND5y', 'waves', 'testnet'); + invalid('3My3KZgFQ3CrVHgz6vGRt8787sH4oAA1qp8', 'waves', 'testnet'); + }); + + it('should return false for incorrect nano addresses', function () { + commonTests('nano'); + invalid('xrb_1f5e4w33ndqbkx4bw5jtp13kp5xghebfxcmw9hdt1f7goid1s4373w6tjdgu', 'nano'); + invalid('nano_1f5e4w33ndqbkx4bw5jtp13kp5xghebfxcmw9hdt1f7goid1s4373w6tjdgu', 'nano'); + invalid('xrb_1111111112111111111111111111111111111111111111111111hifc8npp', 'nano'); + invalid('nano_111111111111111111111111111111111111111111111111111hifc8npp', 'nano'); + }); + + it('should return false for incorrect siacoin addresses', function () { + commonTests('siacoin') + invalid( + 'ffe1308c044ade30392a0cdc1fd5a4dbe94f9616a95faf888ed36123d9e711557aa497530372', + 'siacoin' + ) + }) + + it('should return false for incorrect lbry addresses', function () { + commonTests('lbc') + invalid('ffe1308c044ade30392a0cdc1fd5a4dbe94f9616a95faf888ed36123d9e711557aa497530372') + }) + + it('should return false for incorrect tron addresses', function () { + commonTests('trx'); + invalid('xrb_1111111112111111111111111111111111111111111111111111hifc8npp', 'trx'); + invalid('TNDzfERDpxLDS2w1q6yaFC7pzqaSQ3Bg31', 'trx'); + }); + + it('should return false for incorrect nem addresses', function () { + commonTests('nem'); + invalid('xrb_1111111112111111111111111111111111111111111111111111hifc8npp', 'nem'); + invalid('TNDzfERDpxLDS2w1q6yaFC7pzqaSQ3Bg31', 'nem'); + + invalid('3Myrq5QDgRq3nBVRSSv9UYRP36xTtpJND5y', 'nem', 'testnet'); + invalid('3My3KZgFQ3CrVHgz6vGRt8787sH4oAA1qp8', 'nem', 'testnet'); + }); + //15823701926930889868L + it('should return false for incorrect lsk addresses', function () { + commonTests('lsk'); + invalid('xrb_1111111112111111111111111111111111111111111111111111hifc8npp', 'lsk'); + invalid('TNDzfERDpxLDS2w1q6yaFC7pzqaSQ3Bg31', 'lsk'); + + invalid('158237019269308898689L', 'lsk'); + invalid('158237A192B930C898689L', 'lsk'); + }); + + it('should return false for incorrect bsv addresses', function () { + commonTests('bsv'); + invalid('xrb_1111111112111111111111111111111111111111111111111111hifc8npp', 'bsv'); + invalid('TNDzfERDpxLDS2w1q6yaFC7pzqaSQ3Bg31', 'bsv'); + + invalid('158237019269308898689L', 'bsv'); + invalid('158237A192B930C898689L', 'bsv'); + invalid('bitcoin:qzpuefrpg3kl2ykQe52rxn96pd3Kp4qudywr5pyrsf', 'bsv'); + invalid('pzuefrpg3kl2ykqe52rxn96pd3kp4qudywr5py', 'bsv'); + invalid('rlt2c2wuxr644encp3as0hygtj9djrsaumku3cex5', 'bsv'); + invalid('qra607y4wnkmnpy3wcmrxmltzkrxywcq85c7watpdx09', 'bsv'); + }); + + it('should return false for incorrect stellar addresses', function () { + commonTests('stellar'); + invalid('SBGWKM3CD4IL47QN6X54N6Y33T3JDNVI6AIJ6CD5IM47HG3IG4O36XCU', 'stellar'); + invalid('GBPXX0A5N4JYPESHAADMQKBPWZWQDQ64ZV6ZL2S3LAGW4SY7NTCMWIVL', 'stellar'); + invalid('GCFZB6L25D26RQFDWSSBDEYQ32JHLRMTT44ZYE3DZQUTYOL7WY43PLBG++', 'stellar'); + invalid('GADE5QJ2TY7S5ZB65Q43DFGWYWCPHIYDJ2326KZGAGBN7AE5UY6JVDRRA', 'stellar'); + invalid('GB6OWYST45X57HCJY5XWOHDEBULB6XUROWPIKW77L5DSNANBEQGUPADT2', 'stellar'); + invalid('GB6OWYST45X57HCJY5XWOHDEBULB6XUROWPIKW77L5DSNANBEQGUPADT2T', 'stellar'); + invalid('GDXIIZTKTLVYCBHURXL2UPMTYXOVNI7BRAEFQCP6EZCY4JLKY4VKFNLT', 'stellar'); + invalid('SAB5556L5AN5KSR5WF7UOEFDCIODEWEO7H2UR4S5R62DFTQOGLKOVZDY', 'stellar'); + invalid('gWRYUerEKuz53tstxEuR3NCkiQDcV4wzFHmvLnZmj7PUqxW2wt', 'stellar'); + invalid('g4VPBPrHZkfE8CsjuG2S4yBQNd455UWmk', 'stellar'); + }); });