Variable: parseEth()
December 9, 2025 ยท View on GitHub
Variable: parseEth()
constparseEth: (value,defaultUnit?) =>BN
parse a string formatted Eht value in wei big number
supported units: 'wei', 'kwei', 'mwei', 'gwei', 'szabo', 'finney', 'ether' (or 'eth') default unit 'wei'
example:
console.log('5 gwei =' + parseEth('5 gwei') + 'wei');
console.log('5 gwei =' + parseEth(5, 'gwei') + 'wei');
Parameters
value
string
defaultUnit?
string