Skip to content

etherToWei

etherToWei(etherQuantity): bigint

Defined in: utils/ether-to-wei.ts:20

Convert Ether to Wei

Similar to “parseEther” in ethers.js

Similar to “toWei” in web3.js

Parameters

etherQuantity

the amount of ether to convert to wei

string | number | bigint

Returns

bigint

a bigint of wei equivalent to the specified ether

Example

etherToWei('1000').toString()
// '1000000000000000000000'
etherToWei(1000).toString()
// '1000000000000000000000'