crypto-address-validators
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

crypto-address-validators

Wallet address validator for validating Bitcoin and other altcoins addresses in Node.js and browser.

Installation

 yarn crypto-address-validators
 or
 npm install crypto-address-validators

API

validate (address [, currency = 'bitcoin'[, networkType = 'prod']])
Parameters
  • address - Wallet address to validate.
  • currency - Optional. Currency name or symbol, e.g. 'bitcoin' (default)
  • networkType - Optional. Use 'prod' (default) to enforce standard address, 'testnet' to enforce testnet address and 'both' to enforce nothing.

Returns true if the address (string) is a valid wallet address for the crypto currency specified, see below for supported currencies.

Supported crypto currencies

  • Bitcoin/BTC, 'bitcoin' or 'BTC'

  • Ethereum/ETH, 'ethereum' or 'ETH'

  • Tether/USDT (ERC20), 'usdt' or 'USDT' & networkType 'ERC20'

  • Tether/USDT (TRC20), 'usdt' or 'USDT' & networkType 'TRC20'

  • Hoge finance/HOGE, 'hoge' or 'HOGE'

  • Safemoon/SFM, 'sfm' or 'SFM'

  • Safemars/SMARS, 'smars' or 'SMARS'

Usage example

TS

import validate from "crypto-address-validators";

const valid = validate('1KFzzGtDdnq5hrwxXGjwVnKzRbvf8WVxck', 'BTC');

if (valid) {
	console.log('This is a valid address');
}
else {
	console.log('Address INVALID');
}

// This will log 'This is a valid address' to the console.

Package Sidebar

Install

npm i crypto-address-validators

Weekly Downloads

260

Version

1.0.3

License

none

Unpacked Size

288 kB

Total Files

24

Last publish

Collaborators

  • oleksii_pyvovarov