pub struct Address(/* private fields */);Implementations§
Source§impl Address
impl Address
Sourcepub fn header(&self) -> u8
pub fn header(&self) -> u8
header has 4 bits addr type discrim then 4 bits network discrim. Copied from shelley.cddl:
base address bits 7-6: 00 bit 5: stake cred is keyhash/scripthash bit 4: payment cred is keyhash/scripthash bits 3-0: network id
pointer address bits 7-5: 010 bit 4: payment cred is keyhash/scripthash bits 3-0: network id
enterprise address bits 7-5: 010 bit 4: payment cred is keyhash/scripthash bits 3-0: network id
reward addresses: bits 7-5: 111 bit 4: credential is keyhash/scripthash bits 3-0: network id
byron addresses: bits 7-4: 1000 bits 3-0: unrelated data (recall: no network ID in Byron addresses)
pub fn header_matches_kind(header: u8, kind: AddressHeaderKind) -> bool
pub fn to_bech32(&self, prefix: Option<String>) -> Result<String, JsError>
pub fn from_bech32(bech_str: String) -> Result<Address, JsError>
Sourcepub fn is_valid_bech32(bech_str: String) -> bool
pub fn is_valid_bech32(bech_str: String) -> bool
- Note: bech32-encoded Byron addresses will also pass validation here
pub fn is_valid(bech_str: String) -> bool
pub fn network_id(&self) -> Result<u8, JsError>
Sourcepub fn payment_cred(&self) -> Option<StakeCredential>
pub fn payment_cred(&self) -> Option<StakeCredential>
Note: by convention, the key inside reward addresses are considered payment credentials
Sourcepub fn staking_cred(&self) -> Option<StakeCredential>
pub fn staking_cred(&self) -> Option<StakeCredential>
Note: by convention, the key inside reward addresses are NOT considered staking credentials Note: None is returned pointer addresses as the chain history is required to resolve its associated cred
pub fn kind(&self) -> AddressKind
pub fn to_raw_bytes(&self) -> Vec<u8> ⓘ
pub fn from_raw_bytes(data: &[u8]) -> Result<Address, JsError>
pub fn to_hex(&self) -> String
pub fn from_hex(hex: &str) -> Result<Address, JsError>
Trait Implementations§
Source§impl FromWasmAbi for Address
impl FromWasmAbi for Address
Source§impl IntoWasmAbi for Address
impl IntoWasmAbi for Address
Source§impl LongRefFromWasmAbi for Address
impl LongRefFromWasmAbi for Address
Source§impl OptionFromWasmAbi for Address
impl OptionFromWasmAbi for Address
Source§impl OptionIntoWasmAbi for Address
impl OptionIntoWasmAbi for Address
Source§impl RefFromWasmAbi for Address
impl RefFromWasmAbi for Address
Source§impl RefMutFromWasmAbi for Address
impl RefMutFromWasmAbi for Address
Source§impl TryFromJsValue for Address
impl TryFromJsValue for Address
Source§impl VectorFromWasmAbi for Address
impl VectorFromWasmAbi for Address
Source§impl VectorIntoWasmAbi for Address
impl VectorIntoWasmAbi for Address
impl SupportsConstructor for Address
impl SupportsInstanceProperty for Address
impl SupportsStaticProperty for Address
Auto Trait Implementations§
impl Freeze for Address
impl RefUnwindSafe for Address
impl Send for Address
impl Sync for Address
impl Unpin for Address
impl UnwindSafe for Address
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.