Module 0x2::address
- Constants
- Function
to_u256
- Function
from_u256
- Function
from_bytes
- Function
to_bytes
- Function
to_ascii_string
- Function
to_string
- Function
from_ascii_bytes
- Function
hex_char_value
- Function
length
- Function
max
use 0x1::ascii;
use 0x1::bcs;
use 0x1::string;
use 0x2::hex;
Constants
Error from from_bytes when it is supplied too many or too few bytes.
const EAddressParseError: u64 = 0;
The length of an address, in bytes
const LENGTH: u64 = 32;
const MAX: u256 = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
Function to_u256
Convert a into a u256 by interpreting a as the bytes of a big-endian integer (e.g., to_u256(0x1) == 1)
public fun to_u256(a: address): u256
Implementation
public native fun to_u256(a: address): u256;
Function from_u256
Convert n into an address by encoding it as a big-endian integer (e.g., from_u256(1) = @0x1) Aborts if n > MAX_ADDRESS
public fun from_u256(n: u256): address
Implementation
public native fun from_u256(n: u256): address;