Enum deep_space::address::Address
source · pub enum Address {
Base(BaseAddress),
Derived(DerivedAddress),
}Expand description
An address representing a Cosmos Account, which is chain specific.
These are typically encoded using Bech32, where the prefix field forms the Bech32 hrp,
while for Protobuf transport they are encoded as Base64 byte strings.
Addresses have variable length depending on their purpose, the Base variant is the most common
Variants§
Base(BaseAddress)
A regular account derived from a PrivateKey, or a plain Module account. Has a 20 byte buffer.
Derived(DerivedAddress)
An account derived from a Module account and a key. Has a 32 byte buffer.
Implementations§
source§impl Address
impl Address
sourcepub fn from_slice<T: Into<String>>(
bytes: &[u8],
prefix: T
) -> Result<Self, AddressError>
pub fn from_slice<T: Into<String>>( bytes: &[u8], prefix: T ) -> Result<Self, AddressError>
Read a slice and a prefix into an account Address
sourcepub fn from_bech32(s: String) -> Result<Self, AddressError>
pub fn from_bech32(s: String) -> Result<Self, AddressError>
Parse a bech32 encoded address
s- A bech32 encoded address
sourcepub fn to_bech32<T: Into<String>>(&self, hrp: T) -> Result<String, AddressError>
pub fn to_bech32<T: Into<String>>(&self, hrp: T) -> Result<String, AddressError>
Encodes bytes and prefix into a Bech32 String
sourcepub fn change_prefix<T: Into<String>>(
&mut self,
prefix: T
) -> Result<(), AddressError>
pub fn change_prefix<T: Into<String>>( &mut self, prefix: T ) -> Result<(), AddressError>
Changes the prefix field to modify the resulting Bech32 hrp
sourcepub fn get_prefix(&self) -> String
pub fn get_prefix(&self) -> String
Returns the current prefix, used as the Bech32 hrp
Trait Implementations§
source§impl<'de> Deserialize<'de> for Address
impl<'de> Deserialize<'de> for Address
source§fn deserialize<D>(deserializer: D) -> Result<Address, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Address, D::Error>where D: Deserializer<'de>,
source§impl FromStr for Address
impl FromStr for Address
source§fn from_str(s: &str) -> Result<Self, AddressError>
fn from_str(s: &str) -> Result<Self, AddressError>
Parse an address from a string as bech32 OR as a base64 hex string
§type Err = AddressError
type Err = AddressError
source§impl PartialEq<Address> for Address
impl PartialEq<Address> for Address
impl Copy for Address
impl Eq for Address
impl StructuralEq for Address
impl StructuralPartialEq for Address
Auto Trait Implementations§
impl RefUnwindSafe for Address
impl Send for Address
impl Sync for Address
impl Unpin for Address
impl UnwindSafe for Address
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere T: CastFrom<U>,
self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read moresource§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request