To validate crypto currency's wallet address on Node.js and Browser even React Native. And It has no dependencies with Node.js core modules.
This project was created with reference to wallet-address-validator.
import coinAddressValidator from 'coin-address-validator';
const isBtcAddress = coinAddressValidator.validate('1Gz3SRHzmzV8NwhUe5LQkTy5ysH1aqevAP', 'btc', 'prod');
const isEthAddress = coinAddressValidator.validate('0x9e093a64da766c6f1400158db028cc9946b8ae1f', 'eth', 'prod');
const isXrpAddress = coinAddressValidator.validate('rh5yrZSwXTAXdiHyc7xiyZ95FdjsfYWmSY', 'xrp', 'prod');
const isLtcAddress = coinAddressValidator.validate('LRitYWYuMvnJyrms4jVTiAj5rcTVomHvPx', 'ltc', 'prod');
validate(address, [, currency = 'bitcoin'[, networkType = 'prod']])
type of return value is boolean. (true
or false
)
prod
to enforce standard address. or Use testnet
to enforce testnet address. Use both
for both of them)getAddressType(address)
type of return value is string (if valid base58 addrses) or null
'auroracoin'
or 'AUR'
'beavercoin'
or 'BVC'
'biocoin'
or 'BIO'
'bitcoin'
or 'BTC'
'bitcoincash'
or 'BCH'
'bitcoingold'
or 'BTG'
'bitcoinprivate'
or 'BTCP'
'bitcoinz'
or 'BTCZ'
'callisto'
or 'CLO'
'dash'
or 'DASH'
'decred'
or 'DCR'
'digibyte'
or 'DGB'
'dogecoin'
or 'DOGE'
'ethereum'
or 'ETH'
'ethereumclassic'
or 'ETC'
'etherzero'
or 'ETZ'
'freicoin'
or 'FRC'
'garlicoin'
or 'GRLC'
'hush'
or 'HUSH'
'komodo'
or 'KMD'
'litecoin'
or 'LTC'
'megacoin'
or 'MEC'
'monero'
or 'XMR'
'namecoin'
or 'NMC'
'NEO'
or 'NEO'
'neogas'
or 'GAS'
'peercoin'
or 'PPC'
'primecoin'
or 'XPM'
'protoshares'
or 'PTS'
'qtum'
or 'QTUM'
'ripple'
or 'XRP'
'snowgem'
or 'SNG'
'vertcoin'
or 'VTC'
'votecoin'
or 'VOT'
'zcash'
or 'ZEC'
'zclassic'
or 'ZCL'
'zencash'
or 'ZEN'