pub struct Address(pub [u8; 32]);Expand description
An address on Tenzro Network
Addresses are derived from public keys and identify accounts, smart contracts, and other entities on the network.
Tuple Fields§
§0: [u8; 32]Implementations§
Source§impl Address
impl Address
Sourcepub fn from_bytes(bytes: &[u8]) -> Option<Self>
pub fn from_bytes(bytes: &[u8]) -> Option<Self>
Creates an Address from a byte slice
Returns None if the slice is not exactly 32 bytes
Sourcepub fn from_base58(s: &str) -> Result<Self, Error>
pub fn from_base58(s: &str) -> Result<Self, Error>
Decodes an address from a base58 string
Sourcepub fn is_valid_hex(s: &str) -> bool
pub fn is_valid_hex(s: &str) -> bool
Validates that a hex string is properly formatted
Returns true if the string is valid hexadecimal (with or without 0x prefix)
Sourcepub fn from_hex(s: &str) -> Result<Self, TenzroError>
pub fn from_hex(s: &str) -> Result<Self, TenzroError>
Creates an address from a hex string.
For 20-byte Ethereum addresses (40 hex chars), validates EIP-55 checksum. For 32-byte Tenzro addresses (64 hex chars), validates hex format. Use this as the default entry point for hex address parsing.
Sourcepub fn from_hex_checksummed(s: &str) -> Result<Self, TenzroError>
pub fn from_hex_checksummed(s: &str) -> Result<Self, TenzroError>
Creates an address from a hex string with EIP-55 checksum validation
For Ethereum-style addresses (20 bytes), this validates the EIP-55 mixed-case checksum. The hex string should be 40 characters (or 42 with 0x prefix).