Created
December 13, 2021 14:16
-
-
Save eftalyurtseven/6694db1d13f43751e5b90a583f5ace5e to your computer and use it in GitHub Desktop.
How to check ETH address is valid or not? Tutorial is here: https://youtu.be/b_GnjbVWSo4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Web3 = require('web3'); | |
class Web3Helper { | |
constructor() { | |
this.web3 = new Web3(); | |
} | |
isValidAddress = (address) => { | |
try { | |
this.web3.utils.toChecksumAddress(address); | |
return true; | |
} catch (ex) { | |
console.error(ex); | |
return false; | |
} | |
}; | |
} | |
const web3Helper = new Web3Helper(); | |
console.log( | |
web3Helper.isValidAddress('0xEA9D2766692e47be0c57Abb9C0225Acf33f763e7') | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment