[−][src]Struct private_currency::SecretState
Secret state of an account owner.
Usage
SecretState can be used to create transactions originating from the wallet.
The state also should be updated based on the wallet history, which can be retrieved
with HTTP API. Each transaction in the history should be applied to the state
exactly once.
Methods
impl SecretState[src]
impl SecretStatepub fn with_random_keypair() -> Self[src]
pub fn with_random_keypair() -> SelfCreates an uninitialized state. The keypair for cryptographic operations is generated randomly.
pub fn from_keypair(verifying_key: PublicKey, signing_key: SecretKey) -> Self[src]
pub fn from_keypair(verifying_key: PublicKey, signing_key: SecretKey) -> SelfCreates an uninitialized state from the specified Ed25519 keypair.
pub fn public_key(&self) -> &PublicKey[src]
pub fn public_key(&self) -> &PublicKeyGets the public key of the wallet (aka verifying Ed25519 key for digital signatures).
pub fn balance(&self) -> u64[src]
pub fn balance(&self) -> u64Gets the current wallet balance.
pub fn create_wallet(&self) -> CreateWallet[src]
pub fn create_wallet(&self) -> CreateWalletProduces a CreateWallet transaction for this wallet.
pub fn create_transfer(
&self,
amount: u64,
receiver: &PublicKey,
rollback_delay: u32
) -> Transfer[src]
pub fn create_transfer(
&self,
amount: u64,
receiver: &PublicKey,
rollback_delay: u32
) -> TransferProduces a Transfer transaction from this wallet to the specified receiver.
Panics
This method will panic if the transfer violates constraints imposed by the transaction logic of the service:
amountis out of bounds specified by serviceCONFIGreceiveris same as the senderrollback_delayis not within acceptable range
pub fn initialize(&mut self)[src]
pub fn initialize(&mut self)Initializes the state.
Safety
This method should be called after CreateWallet transaction is committed. It should
only be called once.
pub fn verify_transfer(&self, transfer: &Transfer) -> Option<VerifiedTransfer>[src]
pub fn verify_transfer(&self, transfer: &Transfer) -> Option<VerifiedTransfer>Verifies an incoming transfer.
Return value
Returns the decrypted opening for the transferred amount, or None if it cannot
be decrypted from the transfer.
pub fn transfer(&mut self, transfer: &Transfer)[src]
pub fn transfer(&mut self, transfer: &Transfer)Updates the state according to a Transfer transaction.
Safety
The transfer is assumed to be previously verified or originating from self. It is also assumed to be sourced from the blockchain (i.e., verified according to the blockchain rules).
pub fn rollback(&mut self, transfer: &Transfer)[src]
pub fn rollback(&mut self, transfer: &Transfer)Rolls back a previously committed transfer.
Safety
The transfer is assumed to be originating from the blockchain and rolled back according to the wallet history.
pub fn corresponds_to(&self, wallet: &WalletInfo) -> bool[src]
pub fn corresponds_to(&self, wallet: &WalletInfo) -> boolChecks if this state corresponds to the supplied public info about a Wallet.
pub fn to_public(&self) -> WalletInfo[src]
pub fn to_public(&self) -> WalletInfoProduces a public info about the state.
Trait Implementations
Auto Trait Implementations
impl Send for SecretState
impl Send for SecretStateimpl Sync for SecretState
impl Sync for SecretStateBlanket Implementations
impl<T> From for T[src]
impl<T> From for Timpl<T, U> Into for T where
U: From<T>, [src]
impl<T, U> Into for T where
U: From<T>, impl<T, U> TryFrom for T where
T: From<U>, [src]
impl<T, U> TryFrom for T where
T: From<U>, type Error = !
try_from)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>impl<T> Borrow for T where
T: ?Sized, [src]
impl<T> Borrow for T where
T: ?Sized, impl<T> Any for T where
T: 'static + ?Sized, [src]
impl<T> Any for T where
T: 'static + ?Sized, fn get_type_id(&self) -> TypeId[src]
fn get_type_id(&self) -> TypeIdimpl<T, U> TryInto for T where
U: TryFrom<T>, [src]
impl<T, U> TryInto for T where
U: TryFrom<T>, type Error = <U as TryFrom<T>>::Error
try_from)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>impl<T> BorrowMut for T where
T: ?Sized, [src]
impl<T> BorrowMut for T where
T: ?Sized, fn borrow_mut(&mut self) -> &mut T[src]
fn borrow_mut(&mut self) -> &mut Timpl<T> Erased for T
impl<T> Erased for Timpl<T> Erased for T
impl<T> Erased for Timpl<T> Same for T
impl<T> Same for Ttype Output = T
Should always be Self