Struct libzeropool_rs::client::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
sourceimpl<'p, D, P> UserAccount<D, P>where
D: KeyValueDB,
P: PoolParams,
P::Fr: 'static,
impl<'p, D, P> UserAccount<D, P>where
D: KeyValueDB,
P: PoolParams,
P::Fr: 'static,
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 async fn create_tx<Fut, F>(
&self,
tx: TxType<P::Fr>,
delta_index: Option<u64>,
extra_state: Option<StateFragment<P::Fr>>,
sign: Option<F>,
tx_version: TxVersion
) -> Result<TransactionData<P::Fr>, CreateTxError>where
Fut: Future<Output = Vec<u8>>,
F: FnOnce(&[u8]) -> Fut,
pub async fn create_tx<Fut, F>(
&self,
tx: TxType<P::Fr>,
delta_index: Option<u64>,
extra_state: Option<StateFragment<P::Fr>>,
sign: Option<F>,
tx_version: TxVersion
) -> Result<TransactionData<P::Fr>, CreateTxError>where
Fut: Future<Output = Vec<u8>>,
F: FnOnce(&[u8]) -> Fut,
Constructs a transaction.
Auto Trait Implementations
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
D: Unpin,
P: Unpin,
<P as PoolParams>::Fr: Unpin,
<P as PoolParams>::Fs: Unpin,
impl<D, P> !UnwindSafe for UserAccount<D, P>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more