Hexadecimal strings are used to represent addresses and encode gas data and values. These scripts show you how to do it programmatically within your DApps.
Overview
Environment setup
npm install web3 ethers
Function to convert decimal to hex
utils.toHex()
function to take care of this operation, while ethers V6 uses the toBeHex()
function.The scripts show how to use those functions and log the result.Run the script
node YOUR_SCRIPTS_NAME