ethereum-checksum-address
v0.0.8
Published
Convert Ethereum address to a checksummed address
Downloads
32,646
Maintainers
Readme
ethereum-checksum-address
Convert Ethereum address to a checksummed address
Demo
https://lab.miguelmota.com/ethereum-checksum-address
Install
npm install ethereum-checksum-address
Getting started
Convert to a checksummed address:
const { toChecksumAddress } = require('ethereum-checksum-address')
console.log(toChecksumAddress('0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1')) // '0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1'
console.log(toChecksumAddress('0x90F8BF6A479F320EAD074411A4B0E7944EA8C9C1')) // '0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1'
Check if address is a checksummed address:
const { checkAddressChecksum } = require('ethereum-checksum-address')
console.log(checkAddressChecksum('0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1')) // true
console.log(checkAddressChecksum('0x90F8BF6A479F320EAD074411A4B0E7944EA8C9C1')) // false
CLI
Install:
npm install -g ethereum-checksum-address
Convert address to checksummed address:
$ ethereum_checksum_address 0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1
0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1
Check if address is a checksummed address
$ ethereum_checksum_address 0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1 --check
true
Piping address example:
$ echo 0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1 | ethereum_checksum_address --check
true
Test
npm test