js 校验 btc eth 地址
Posted 跌倒不要紧,要紧的是赶快爬起来。
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了js 校验 btc eth 地址相关的知识,希望对你有一定的参考价值。
NPM 安装
npm install wallet-address-validator
Browser
<script src="wallet-address-validator.min.js">
API
validate (address [, currency = ‘bitcoin‘[, networkType = ‘prod‘]])
支持币种
Supported crypto currencies
-
Auroracoin/AUR,
‘auroracoin‘
or‘AUR‘
-
Bankex/BKX,
‘bankex‘
or‘BKX‘
-
BeaverCoin/BVC,
‘beavercoin‘
or‘BVC‘
-
Biocoin/BIO,
‘biocoin‘
or‘BIO‘
-
Bitcoin/BTC,
‘bitcoin‘
or‘BTC‘
-
BitcoinCash/BCH,
‘bitcoincash‘
or‘BCH‘
-
BitcoinGold/BTG,
‘bitcoingold‘
or‘BTG‘
-
BitcoinPrivate/BTCP,
‘bitcoinprivate‘
or‘BTCP‘
-
BitcoinZ/BTCZ,
‘bitcoinz‘
or‘BTCZ‘
-
Callisto/CLO,
‘callisto‘
or‘CLO‘
-
Dash,
‘dash‘
or‘DASH‘
-
Decred/DCR,
‘decred‘
or‘DCR‘
-
Digibyte/DGB,
‘digibyte‘
or‘DGB‘
-
Dogecoin/DOGE,
‘dogecoin‘
or‘DOGE‘
-
Ethereum/ETH,
‘ethereum‘
or‘ETH‘
-
EthereumClassic/ETH,
‘ethereumclassic‘
or‘ETC‘
-
EthereumZero/ETZ,
‘etherzero‘
or‘ETZ‘
-
Freicoin/FRC,
‘freicoin‘
or‘FRC‘
-
Garlicoin/GRLC,
‘garlicoin‘
or‘GRLC‘
-
Hush/HUSH,
‘hush‘
or‘HUSH‘
-
Komodo/KMD,
‘komodo‘
or‘KMD‘
-
Litecoin/LTC,
‘litecoin‘
or‘LTC‘
-
Megacoin/MEC,
‘megacoin‘
or‘MEC‘
-
Namecoin/NMC,
‘namecoin‘
or‘NMC‘
-
NEO/NEO,
‘NEO‘
or‘NEO‘
-
NeoGas/GAS,
‘neogas‘
or‘GAS‘
-
Peercoin/PPCoin/PPC,
‘peercoin‘
or‘PPC‘
-
Primecoin/XPM,
‘primecoin‘
or‘XPM‘
-
Protoshares/PTS,
‘protoshares‘
or‘PTS‘
-
Qtum/QTUM,
‘qtum‘
or‘QTUM‘
-
Ripple/XRP,
‘ripple‘
or‘XRP‘
-
Snowgem/SNG,
‘snowgem‘
or‘SNG‘
-
Vertcoin/VTC,
‘vertcoin‘
or‘VTC‘
-
Votecoin/VTC,
‘votecoin‘
or‘VOT‘
-
Zcash/ZEC,
‘zcash‘
or‘ZEC‘
-
Zclassic/ZCL,
‘zclassic‘
or‘ZCL‘
-
ZenCash/ZEN,
‘zencash‘
or‘ZEN‘
example
NOde用法
require(‘wallet-address-validator‘); var valid = WAValidator.validate(‘1KFzzGtDdnq5hrwxXGjwVnKzRbvf8WVxck‘, ‘litecoin‘, ‘testnet‘); if(valid) console.log(‘This is a valid address‘); else console.log(‘Address INVALID‘); // As this is a invalid litecoin address ‘Address INVALID‘ will be logged to console.
Browser
<script src="wallet-address-validator.min.js">
ionic3 用法
import * as WAValidator from ‘wallet-address-validator‘
let valid = WAValidator.validate(this.address, ‘ETH‘);
console.log(‘valid‘,valid)
this.zziftrue = valid
以上是关于js 校验 btc eth 地址的主要内容,如果未能解决你的问题,请参考以下文章
数字货币钱包地址生成器 API 使用文档(支持BTC/ETH/TRX/BCH/ETC/BSC/LTC/DOGE等17种币-持续更新中)