Skip to content

Latest commit

 

History

History
151 lines (69 loc) · 3.52 KB

address.md

File metadata and controls

151 lines (69 loc) · 3.52 KB

Module 0x2::address

use 0x1::ascii;
use 0x2::bcs;
use 0x2::hex;

Constants

Error from from_bytes when it is supplied too many or too few bytes.

const ErrorAddressParseError: u64 = 1;

Error from from_u256 when

The length of an address, in bytes

const LENGTH: u64 = 32;

const MAX: u256 = 115792089237316195423570985008687907853269984665640564039457584007913129639935;

const ZERO: address = 0x0;

Function from_bytes

Convert a into a u256 by interpreting a as the bytes of a big-endian integer (e.g., to_u256(0x1) == 1) Convert n into an address by encoding it as a big-endian integer (e.g., from_u256(1) = @0x1) Aborts if n > MAX_ADDRESS Convert bytes into an address. Aborts with ErrorAddressParseError if the length of bytes is invalid length

public fun from_bytes(bytes: vector<u8>): address

Function to_bytes

Convert a into BCS-encoded bytes.

public fun to_bytes(a: address): vector<u8>

Function to_ascii_string

Convert a to a hex-encoded ASCII string

public fun to_ascii_string(a: address): ascii::String

Function length

Convert a to a hex-encoded ASCII string Length of a Rooch address in bytes

public fun length(): u64

Function max

Largest possible address

public fun max(): u256

Function zero

all zeros address

public fun zero(): address