Struct Wallet

Source
pub struct Wallet {
    pub public_key: SaitoPublicKey,
    pub private_key: SaitoPrivateKey,
    pub slips: AHashMap<SaitoUTXOSetKey, WalletSlip>,
    pub unspent_slips: AHashSet<SaitoUTXOSetKey>,
    pub staking_slips: AHashSet<SaitoUTXOSetKey>,
    pub filename: String,
    pub filepass: String,
    pub pending_txs: AHashMap<SaitoHash, Transaction>,
    pub wallet_version: Version,
    pub core_version: Version,
    pub key_list: Vec<SaitoPublicKey>,
    pub nfts: Vec<NFT>,
    /* private fields */
}
Expand description

The Wallet manages the public and private keypair of the node and holds the slips that are used to form transactions on the network.

Fields§

§public_key: SaitoPublicKey§private_key: SaitoPrivateKey§slips: AHashMap<SaitoUTXOSetKey, WalletSlip>§unspent_slips: AHashSet<SaitoUTXOSetKey>§staking_slips: AHashSet<SaitoUTXOSetKey>§filename: String§filepass: String§pending_txs: AHashMap<SaitoHash, Transaction>§wallet_version: Version§core_version: Version§key_list: Vec<SaitoPublicKey>§nfts: Vec<NFT>

Implementations§

Source§

impl Wallet

Source

pub fn new(private_key: SaitoPrivateKey, public_key: SaitoPublicKey) -> Wallet

Source

pub async fn load(wallet: &mut Wallet, io: &(dyn InterfaceIO + Send + Sync))

Source

pub async fn save(wallet: &mut Wallet, io: &(dyn InterfaceIO + Send + Sync))

Source

pub async fn reset( &mut self, _storage: &mut Storage, network: Option<&Network>, keep_keys: bool, )

Source

pub fn serialize_for_disk(&self) -> Vec<u8>

[private_key - 32 bytes] [public_key - 33 bytes]

Source

pub fn deserialize_from_disk(&mut self, bytes: &[u8])

[private_key - 32 bytes] [public_key - 33 bytes]

Source

pub fn on_chain_reorganization( &mut self, block: &Block, lc: bool, genesis_period: BlockId, ) -> WalletUpdateStatus

Source

pub fn delete_block(&mut self, block: &Block) -> WalletUpdateStatus

Source

pub fn remove_old_slips(&mut self, block_id: BlockId)

Source

pub fn add_slip( &mut self, block_id: u64, tx_index: u64, slip: &Slip, lc: bool, network: Option<&Network>, )

Source

pub fn delete_slip(&mut self, slip: &Slip, network: Option<&Network>)

Source

pub fn get_available_balance(&self) -> Currency

Source

pub fn get_unspent_slip_count(&self) -> u64

Source

pub fn generate_slips( &mut self, nolan_requested: Currency, network: Option<&Network>, latest_block_id: u64, genesis_period: u64, ) -> (Vec<Slip>, Vec<Slip>)

Source

pub fn sign(&self, message_bytes: &[u8]) -> SaitoSignature

Source

pub async fn create_bound_transaction( &mut self, nft_input_amount: Currency, nft_uuid_block_id: u64, nft_uuid_transaction_id: u64, nft_uuid_slip_id: u64, nft_create_deposit_amt: Currency, nft_data: Vec<u32>, recipient: &SaitoPublicKey, network: Option<&Network>, latest_block_id: u64, genesis_period: u64, nft_type: String, ) -> Result<Transaction, Error>

Source

pub async fn create_send_bound_transaction( &mut self, nft_amount: Currency, nft_id: Vec<u8>, nft_data: Vec<u32>, recipient_public_key: &SaitoPublicKey, ) -> Result<Transaction, Error>

Source

pub fn create_nft_uuid(input_slip: &Slip, nft_type: &str) -> [u8; 33]

Source

pub async fn create_golden_ticket_transaction( golden_ticket: GoldenTicket, public_key: &SaitoPublicKey, private_key: &SaitoPrivateKey, ) -> Transaction

Source

pub fn add_to_pending(&mut self, tx: Transaction)

Source

pub fn delete_pending_transaction(&mut self, tx: &Transaction) -> bool

Source

pub fn update_from_balance_snapshot( &mut self, snapshot: BalanceSnapshot, network: Option<&Network>, )

Source

pub fn set_key_list(&mut self, key_list: Vec<SaitoPublicKey>)

Source

pub fn create_staking_transaction( &mut self, staking_amount: Currency, latest_unlocked_block_id: BlockId, last_valid_slips_in_block_id: BlockId, ) -> Result<Transaction, Error>

Source

pub fn get_nft_list(&self) -> &[NFT]

Trait Implementations§

Source§

impl Clone for Wallet

Source§

fn clone(&self) -> Wallet

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Wallet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Wallet

Source§

fn eq(&self, other: &Wallet) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Wallet

Auto Trait Implementations§

§

impl Freeze for Wallet

§

impl RefUnwindSafe for Wallet

§

impl Send for Wallet

§

impl Sync for Wallet

§

impl Unpin for Wallet

§

impl UnwindSafe for Wallet

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more