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>
impl<'p, D, P> UserAccount<D, P>
Sourcepub fn new(sk: Num<P::Fs>, state: State<D, P>, params: P) -> Self
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).
Sourcepub fn from_seed(seed: &[u8], state: State<D, P>, params: P) -> Self
pub fn from_seed(seed: &[u8], state: State<D, P>, params: P) -> Self
Same as constructor but accepts arbitrary data as spending key.
Sourcepub fn generate_address(&self) -> String
pub fn generate_address(&self) -> String
Generates a new private address.
Sourcepub fn decrypt_notes(&self, data: Vec<u8>) -> Vec<Option<Note<P::Fr>>>
pub fn decrypt_notes(&self, data: Vec<u8>) -> Vec<Option<Note<P::Fr>>>
Attempts to decrypt notes.
Sourcepub fn decrypt_pair(
&self,
data: Vec<u8>,
) -> Option<(Account<P::Fr>, Vec<Note<P::Fr>>)>
pub fn decrypt_pair( &self, data: Vec<u8>, ) -> Option<(Account<P::Fr>, Vec<Note<P::Fr>>)>
Attempts to decrypt account and notes.
pub fn is_own_address(&self, address: &str) -> bool
Sourcepub fn create_tx(
&self,
tx: TxType<P::Fr>,
delta_index: Option<u64>,
extra_state: Option<StateFragment<P::Fr>>,
) -> Result<TransactionData<P::Fr>, CreateTxError>
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>
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>
impl<D, P> !UnwindSafe for UserAccount<D, P>
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
Mutably borrows from an owned value. Read more
Source§impl<Out, S> FromSeed<S> for Outwhere
S: SeedBoxGen<Out>,
impl<Out, S> FromSeed<S> for Outwhere
S: SeedBoxGen<Out>,
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>
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 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>
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