snarkvm_console_account

Struct Address

Source
pub struct Address<E>
where E: Environment,
{ /* private fields */ }

Implementations§

Source§

impl<E> Address<E>
where E: Environment,

Source

pub const fn to_group(&self) -> &Group<E>

Returns the address as a group element.

Source§

impl<E> Address<E>
where E: Environment,

Source

pub const fn new(group: Group<E>) -> Address<E>

Initializes an address from a group element.

Source

pub fn zero() -> Address<E>

Initializes a zero address.

Methods from Deref<Target = Group<E>>§

Source

pub fn to_x_coordinate(&self) -> Field<E>

Returns the x-coordinate in the affine coordinates of the group.

Source

pub fn to_xy_coordinates(&self) -> (Field<E>, Field<E>)

Returns the x-coordinate and y-coordinate in the affine coordinates of the group.

Source

pub fn to_y_coordinate(&self) -> Field<E>

Returns the y-coordinate in the affine coordinates of the group.

Source

pub const EDWARDS_A: Field<E> = _

Source

pub const EDWARDS_D: Field<E> = _

Source

pub const MONTGOMERY_A: Field<E> = _

Source

pub const MONTGOMERY_B: Field<E> = _

Source

pub fn mul_by_cofactor(&self) -> Group<E>

Returns self * COFACTOR.

Source

pub fn div_by_cofactor(&self) -> Group<E>

Returns self / COFACTOR.

Trait Implementations§

Source§

impl<E> Clone for Address<E>
where E: Clone + Environment,

Source§

fn clone(&self) -> Address<E>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<E> Compare for Address<E>
where E: Environment,

Source§

fn is_less_than(&self, other: &Address<E>) -> <Address<E> as Compare>::Output

Returns true if self is less than other.

Source§

fn is_greater_than(&self, other: &Address<E>) -> <Address<E> as Compare>::Output

Returns true if self is greater than other.

Source§

fn is_less_than_or_equal( &self, other: &Address<E>, ) -> <Address<E> as Compare>::Output

Returns true if self is less than or equal to other.

Source§

fn is_greater_than_or_equal( &self, other: &Address<E>, ) -> <Address<E> as Compare>::Output

Returns true if self is greater than or equal to other.

Source§

type Output = Boolean<E>

Source§

impl<E> Debug for Address<E>
where E: Environment,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<E> Deref for Address<E>
where E: Environment,

Source§

fn deref(&self) -> &<Address<E> as Deref>::Target

Returns the address as a group element.

Source§

type Target = Group<E>

The resulting type after dereferencing.
Source§

impl<'de, E> Deserialize<'de> for Address<E>
where E: Environment,

Source§

fn deserialize<D>( deserializer: D, ) -> Result<Address<E>, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserializes an account address from a string or bytes.

Source§

impl<E> Display for Address<E>
where E: Environment,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Writes an account address as a bech32m string.

Source§

impl<E> Distribution<Address<E>> for Standard
where E: Environment,

Source§

fn sample<R>(&self, rng: &mut R) -> Address<E>
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

fn map<F, S>(self, func: F) -> DistMap<Self, F, T, S>
where F: Fn(T) -> S, Self: Sized,

Create a distribution of values of ‘S’ by mapping the output of Self through the closure F Read more
Source§

impl<E> Equal for Address<E>
where E: Environment,

Source§

fn is_equal(&self, other: &Address<E>) -> <Address<E> as Equal>::Output

Returns true if self and other are equal.

Source§

fn is_not_equal(&self, other: &Address<E>) -> <Address<E> as Equal>::Output

Returns true if self and other are not equal.

Source§

type Output = Boolean<E>

Source§

impl<E> FromBits for Address<E>
where E: Environment,

Source§

fn from_bits_le(bits_le: &[bool]) -> Result<Address<E>, Error>

Initializes a new address by recovering the x-coordinate of an affine group from a list of little-endian bits.

Source§

fn from_bits_be(bits_be: &[bool]) -> Result<Address<E>, Error>

Initializes a new address by recovering the x-coordinate of an affine group from a list of big-endian bits.

Source§

impl<E> FromBytes for Address<E>
where E: Environment,

Source§

fn read_le<R>(reader: R) -> Result<Address<E>, Error>
where R: Read,

Reads in an account address from a buffer.

Source§

fn from_bytes_le(bytes: &[u8]) -> Result<Self, Error>
where Self: Sized,

Returns Self from a byte array in little-endian order.
Source§

impl<E> FromField for Address<E>
where E: Environment,

Source§

fn from_field( field: &<Address<E> as FromField>::Field, ) -> Result<Address<E>, Error>

Initializes a new address by recovering the x-coordinate of an affine group from a field element.

Source§

type Field = Field<E>

Source§

impl<E> FromFields for Address<E>
where E: Environment,

Source§

fn from_fields( fields: &[<Address<E> as FromFields>::Field], ) -> Result<Address<E>, Error>

Initializes a new address by recovering the x-coordinate of an affine group from a field element.

Source§

type Field = Field<E>

Source§

impl<E> FromStr for Address<E>
where E: Environment,

Source§

fn from_str(address: &str) -> Result<Address<E>, <Address<E> as FromStr>::Err>

Reads in an account address string.

Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

impl<E> Hash for Address<E>
where E: Hash + Environment,

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<E> Parser for Address<E>
where E: Environment,

Source§

fn parse(string: &str) -> Result<(&str, Address<E>), Err<VerboseError<&str>>>

Parses a string into an address.

Source§

impl<E> PartialEq for Address<E>

Source§

fn eq(&self, other: &Address<E>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<E> Serialize for Address<E>
where E: Environment,

Source§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serializes an account address into a string or as bytes.

Source§

impl<E> SizeInBits for Address<E>
where E: Environment,

Source§

fn size_in_bits() -> usize

Returns the address size in bits.

Source§

impl<E> SizeInBytes for Address<E>
where E: Environment,

Source§

fn size_in_bytes() -> usize

Returns the address size in bytes.

Source§

impl<E> Ternary for Address<E>
where E: Environment,

Source§

fn ternary( condition: &<Address<E> as Ternary>::Boolean, first: &Address<E>, second: &Address<E>, ) -> <Address<E> as Ternary>::Output

Returns first if condition is true, otherwise returns second.

Source§

type Boolean = Boolean<E>

Source§

type Output = Address<E>

Source§

impl<E> ToBits for Address<E>
where E: Environment,

Source§

fn write_bits_le(&self, vec: &mut Vec<bool>)

Outputs the little-endian bit representation of self.to_x_coordinate() without trailing zeros.

Source§

fn write_bits_be(&self, vec: &mut Vec<bool>)

Outputs the big-endian bit representation of self.to_x_coordinate() without leading zeros.

Source§

fn to_bits_le(&self) -> Vec<bool>

Returns self as a boolean array in little-endian order.
Source§

fn to_bits_be(&self) -> Vec<bool>

Returns self as a boolean array in big-endian order.
Source§

fn num_bits() -> Option<usize>

An optional indication of how many bits an object can be represented with.
Source§

impl<E> ToBytes for Address<E>
where E: Environment,

Source§

fn write_le<W>(&self, writer: W) -> Result<(), Error>
where W: Write,

Writes an account address to a buffer.

Source§

fn to_bytes_le(&self) -> Result<Vec<u8>, Error>
where Self: Sized,

Returns self as a byte array in little-endian order.
Source§

impl<E> ToField for Address<E>
where E: Environment,

Source§

fn to_field(&self) -> Result<<Address<E> as ToField>::Field, Error>

Returns the address as a field element.

Source§

type Field = Field<E>

Source§

impl<E> ToFields for Address<E>
where E: Environment,

Source§

fn to_fields(&self) -> Result<Vec<<Address<E> as ToFields>::Field>, Error>

Returns the address as field elements.

Source§

type Field = Field<E>

Source§

impl<N: Network> TryFrom<&ComputeKey<N>> for Address<N>

Source§

fn try_from(compute_key: &ComputeKey<N>) -> Result<Self, Self::Error>

Derives the account address from an account compute key.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl<N: Network> TryFrom<&PrivateKey<N>> for Address<N>

Source§

fn try_from(private_key: &PrivateKey<N>) -> Result<Self, Self::Error>

Derives the account address from an account private key.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl<N: Network> TryFrom<&ViewKey<N>> for Address<N>

Source§

fn try_from(view_key: &ViewKey<N>) -> Result<Self, Self::Error>

Derives the account address from an account view key.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl<N: Network> TryFrom<ComputeKey<N>> for Address<N>

Source§

fn try_from(compute_key: ComputeKey<N>) -> Result<Self, Self::Error>

Derives the account address from an account compute key.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl<N: Network> TryFrom<PrivateKey<N>> for Address<N>

Source§

fn try_from(private_key: PrivateKey<N>) -> Result<Self, Self::Error>

Derives the account address from an account private key.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl<N: Network> TryFrom<ViewKey<N>> for Address<N>

Source§

fn try_from(view_key: ViewKey<N>) -> Result<Self, Self::Error>

Derives the account address from an account view key.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl<E> TypeName for Address<E>
where E: Environment,

Source§

fn type_name() -> &'static str

Returns the type name as a string.

Source§

impl<E> Visibility for Address<E>
where E: Environment,

Source§

fn size_in_fields(&self) -> Result<u16, Error>

Returns the number of field elements to encode self.

Source§

type Boolean = Boolean<E>

Source§

impl<E> AddressTrait for Address<E>
where E: Environment,

Source§

impl<E> Copy for Address<E>
where E: Copy + Environment,

Source§

impl<E> Eq for Address<E>
where E: Eq + Environment,

Source§

impl<E> StructuralPartialEq for Address<E>
where E: Environment,

Auto Trait Implementations§

§

impl<E> Freeze for Address<E>
where <E as Environment>::Projective: Freeze,

§

impl<E> RefUnwindSafe for Address<E>

§

impl<E> Send for Address<E>

§

impl<E> Sync for Address<E>

§

impl<E> Unpin for Address<E>
where <E as Environment>::Projective: Unpin,

§

impl<E> UnwindSafe for Address<E>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<'de, T> DeserializeExt<'de> for T

Source§

fn take_from_value<D>( value: &mut Value, field: &str, ) -> Result<T, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize = _

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToSmolStr for T
where T: Display + ?Sized,

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Uniform for T

Source§

fn rand<R>(rng: &mut R) -> T
where R: Rng + ?Sized,

Samples a random value from a uniform distribution.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,