View Source Ethers.Types (Ethers v0.0.3)
EVM types and compound type definitions
Link to this section Summary
Types
Ethereum address in its hex format with 0x or in its binary format
keccak hash in its hex format with 0x
Functions
Returns the default value in the given type if supported.
Returns the maximum possible value in the given type if supported.
Returns the minimum possible value in the given type if supported.
Converts EVM data types to typespecs for documentation
Link to this section Types
@type t_address() :: <<_::336>> | <<_::160>>
Ethereum address in its hex format with 0x or in its binary format
examples
Examples
"0xdAC17F958D2ee523a2206206994597C13D831ec7"
<<218, 193, 127, 149, 141, 46, 229, 35, 162, 32, 98, 6, 153, 69, 151, 193, 61, 131, 30, 199>>
@type t_hash() :: <<_::528>>
keccak hash in its hex format with 0x
examples
Examples
"0xd4288c8e733eb71a39fe2e8dd4912ce54d8d26d9874f30309b26b4b071260422"
Link to this section Functions
Returns the default value in the given type if supported.
examples
Examples
iex> Ethers.Types.default(:address)
"0x0000000000000000000000000000000000000000"
iex> Ethers.Types.default({:int, 32})
0
iex> Ethers.Types.default({:uint, 8})
0
iex> Ethers.Types.default({:int, 128})
0
iex> Ethers.Types.default(:string)
""
iex> Ethers.Types.default(:bytes)
""
iex> Ethers.Types.default({:bytes, 8})
<<0, 0, 0, 0, 0, 0, 0, 0>>
Returns the maximum possible value in the given type if supported.
examples
Examples
iex> Ethers.Types.max({:uint, 8})
255
iex> Ethers.Types.max({:int, 8})
127
iex> Ethers.Types.max({:uint, 16})
65535
iex> Ethers.Types.max({:int, 16})
32767
Returns the minimum possible value in the given type if supported.
examples
Examples
iex> Ethers.Types.min({:uint, 8})
0
iex> Ethers.Types.min({:int, 8})
-128
iex> Ethers.Types.min({:uint, 16})
0
iex> Ethers.Types.min({:int, 16})
-32768
iex> Ethers.Types.min({:int, 24})
-8388608
Converts EVM data types to typespecs for documentation