wonism / coin-address-validator

MIT License
6 stars 5 forks source link

Coin Address Validator

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.

How to use

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');

Methods

validate(address, [, currency = 'bitcoin'[, networkType = 'prod']])

type of return value is boolean. (true or false)

getAddressType(address)

type of return value is string (if valid base58 addrses) or null

Supported Currencies