Struct UserAccount

Source
pub struct UserAccount<D: KeyValueDB, P: PoolParams> {
    pub pool_id: BoundedNum<P::Fr, { constants::DIVERSIFIER_SIZE_BITS }>,
    pub keys: Keys<P>,
    pub params: P,
    pub state: State<D, P>,
    pub sign_callback: Option<Box<dyn Fn(&[u8]) -> Vec<u8>>>,
}

Fields§

§pool_id: BoundedNum<P::Fr, { constants::DIVERSIFIER_SIZE_BITS }>§keys: Keys<P>§params: P§state: State<D, P>§sign_callback: Option<Box<dyn Fn(&[u8]) -> Vec<u8>>>

Implementations§

Source§

impl<'p, D, P> UserAccount<D, P>
where D: KeyValueDB, P: PoolParams, P::Fr: 'static,

Source

pub fn new(sk: Num<P::Fs>, state: State<D, P>, params: P) -> Self

Initializes UserAccount with a spending key that has to be an element of the prime field Fs (p = 6554484396890773809930967563523245729705921265872317281365359162392183254199).

Source

pub fn from_seed(seed: &[u8], state: State<D, P>, params: P) -> Self

Same as constructor but accepts arbitrary data as spending key.

Source

pub fn generate_address(&self) -> String

Generates a new private address.

Source

pub fn decrypt_notes(&self, data: Vec<u8>) -> Vec<Option<Note<P::Fr>>>

Attempts to decrypt notes.

Source

pub fn decrypt_pair( &self, data: Vec<u8>, ) -> Option<(Account<P::Fr>, Vec<Note<P::Fr>>)>

Attempts to decrypt account and notes.

Source

pub fn is_own_address(&self, address: &str) -> bool

Source

pub fn create_tx( &self, tx: TxType<P::Fr>, delta_index: Option<u64>, extra_state: Option<StateFragment<P::Fr>>, ) -> Result<TransactionData<P::Fr>, CreateTxError>

Constructs a transaction.

Auto Trait Implementations§

§

impl<D, P> Freeze for UserAccount<D, P>
where P: Freeze, <P as PoolParams>::Fr: Freeze, <P as PoolParams>::Fs: Freeze, D: Freeze,

§

impl<D, P> !RefUnwindSafe for UserAccount<D, P>

§

impl<D, P> !Send for UserAccount<D, P>

§

impl<D, P> !Sync for UserAccount<D, P>

§

impl<D, P> Unpin for UserAccount<D, P>
where P: Unpin, <P as PoolParams>::Fr: Unpin, <P as PoolParams>::Fs: Unpin, D: Unpin,

§

impl<D, P> !UnwindSafe for UserAccount<D, P>

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<Out, S> FromSeed<S> for Out
where S: SeedBoxGen<Out>,

Source§

fn from_seed(seed: &[u8]) -> Out

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> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V