@tevm/voltaire / index / BrandedWei
BrandedWei
Type Aliases
BrandedWei
BrandedWei = WeiType
Defined in: src/primitives/Denomination/WeiType.ts:9
WeiType
WeiType =Defined in: src/primitives/Denomination/WeiType.ts:6 Branded Wei type - represents Ethereum amounts in wei (smallest unit: 10^-18 ETH)bigint&object
Type Declaration
[brand]
readonly[brand]:"Wei"
Variables
Wei
Defined in: src/primitives/Denomination/wei-index.ts:19constWei:object
Type Declaration
from()
from: (Create Wei from bigint, number, or stringvalue) =>WeiType
Parameters
value
Value to convert (bigint, number, or string)string | number | bigint
Returns
WeiType
Wei amount
See
https://voltaire.tevm.sh/primitives/denomination for Denomination documentationSince
0.0.0Throws
Example
fromEther()
fromEther: (Convert Ether to Wei Parses decimal ether string and converts to bigint wei value. Alias for Ether.toWei().ether) =>WeiType
Parameters
ether
EtherType
Amount in Ether (string, supports decimals like “1.5”)
Returns
WeiType
Amount in Wei (bigint)
See
https://voltaire.tevm.sh/primitives/denomination for Denomination documentationSince
0.0.0Throws
If ether value has more than 18 decimal placesExample
fromGwei()
fromGwei: (Convert Gwei to Wei Parses decimal gwei string and converts to bigint wei value. Alias for Gwei.toWei().gwei) =>WeiType
Parameters
gwei
GweiType
Amount in Gwei (string, supports decimals like “1.5”)
Returns
WeiType
Amount in Wei (bigint)
See
https://voltaire.tevm.sh/primitives/denomination for Denomination documentationSince
0.0.0Throws
If gwei value has more than 9 decimal placesExample
toEther()
toEther: (Convert Wei to Ether Converts bigint wei to decimal string ether value.wei) =>EtherType
Parameters
wei
WeiType
Amount in Wei (bigint)
Returns
EtherType
Amount in Ether (string with decimal precision)
See
https://voltaire.tevm.sh/primitives/denomination for Denomination documentationSince
0.0.0Throws
Example
toGwei()
toGwei: (Convert Wei to Gwei Converts bigint wei to decimal string gwei value.wei) =>GweiType
Parameters
wei
WeiType
Amount in Wei (bigint)
Returns
GweiType
Amount in Gwei (string with decimal precision)
See
https://voltaire.tevm.sh/primitives/denomination for Denomination documentationSince
0.0.0Throws
Example
toU256()
toU256: (Convert Wei to base Uint256 typewei) =>Type
Parameters
wei
WeiType
Amount in Wei
Returns
Type
Uint256 value (type cast, no conversion)
See
https://voltaire.tevm.sh/primitives/denomination for Denomination documentationSince
0.0.0Throws
Example
WEI_PER_ETHER
Defined in: src/primitives/Denomination/wei-constants.ts:15 Conversion constant: Wei per Ether (10^18)constWEI_PER_ETHER:1000000000000000000n=1_000_000_000_000_000_000n
See
https://voltaire.tevm.sh/primitives/denomination for Denomination documentationSince
0.0.0WEI_PER_GWEI
Defined in: src/primitives/Denomination/wei-constants.ts:7 Conversion constant: Wei per Gwei (10^9)constWEI_PER_GWEI:1000000000n=1_000_000_000n
See
https://voltaire.tevm.sh/primitives/denomination for Denomination documentationSince
0.0.0Functions
from()
from(Defined in: src/primitives/Denomination/wei-from.ts:20 Create Wei from bigint, number, or stringvalue):WeiType
Parameters
value
Value to convert (bigint, number, or string)string | number | bigint
Returns
WeiType
Wei amount
See
https://voltaire.tevm.sh/primitives/denomination for Denomination documentationSince
0.0.0Throws
Example
fromEther()
fromEther(Defined in: src/primitives/Denomination/wei-fromEther.ts:22 Convert Ether to Wei Parses decimal ether string and converts to bigint wei value. Alias for Ether.toWei().ether):WeiType
Parameters
ether
EtherType
Amount in Ether (string, supports decimals like “1.5”)
Returns
WeiType
Amount in Wei (bigint)
See
https://voltaire.tevm.sh/primitives/denomination for Denomination documentationSince
0.0.0Throws
If ether value has more than 18 decimal placesExample
fromGwei()
fromGwei(Defined in: src/primitives/Denomination/wei-fromGwei.ts:22 Convert Gwei to Wei Parses decimal gwei string and converts to bigint wei value. Alias for Gwei.toWei().gwei):WeiType
Parameters
gwei
GweiType
Amount in Gwei (string, supports decimals like “1.5”)
Returns
WeiType
Amount in Wei (bigint)
See
https://voltaire.tevm.sh/primitives/denomination for Denomination documentationSince
0.0.0Throws
If gwei value has more than 9 decimal placesExample
toEther()
toEther(Defined in: src/primitives/Denomination/wei-toEther.ts:23 Convert Wei to Ether Converts bigint wei to decimal string ether value.wei):EtherType
Parameters
wei
WeiType
Amount in Wei (bigint)
Returns
EtherType
Amount in Ether (string with decimal precision)
See
https://voltaire.tevm.sh/primitives/denomination for Denomination documentationSince
0.0.0Throws
Example
toGwei()
toGwei(Defined in: src/primitives/Denomination/wei-toGwei.ts:23 Convert Wei to Gwei Converts bigint wei to decimal string gwei value.wei):GweiType
Parameters
wei
WeiType
Amount in Wei (bigint)
Returns
GweiType
Amount in Gwei (string with decimal precision)
See
https://voltaire.tevm.sh/primitives/denomination for Denomination documentationSince
0.0.0Throws
Example
toU256()
toU256(Defined in: src/primitives/Denomination/wei-toU256.ts:19 Convert Wei to base Uint256 typewei):Type
Parameters
wei
WeiType
Amount in Wei
Returns
Type
Uint256 value (type cast, no conversion)

