[][src]Struct private_currency::SecretState

pub struct SecretState { /* fields omitted */ }

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]

Creates an uninitialized state. The keypair for cryptographic operations is generated randomly.

Creates an uninitialized state from the specified Ed25519 keypair.

Gets the public key of the wallet (aka verifying Ed25519 key for digital signatures).

Gets the current wallet balance.

Produces a CreateWallet transaction for this wallet.

Produces 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:

  • amount is out of bounds specified by service CONFIG
  • receiver is same as the sender
  • rollback_delay is not within acceptable range

Initializes the state.

Safety

This method should be called after CreateWallet transaction is committed. It should only be called once.

Verifies an incoming transfer.

Return value

Returns the decrypted opening for the transferred amount, or None if it cannot be decrypted from the 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).

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.

Checks if this state corresponds to the supplied public info about a Wallet.

Produces a public info about the state.

Trait Implementations

impl Debug for SecretState
[src]

Auto Trait Implementations

impl Send for SecretState

impl Sync for SecretState

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Erased for T

impl<T> Erased for T

impl<T> Same for T

Should always be Self