mod builder;
mod template;
pub use builder::MainnetWalletStateBuilder;
use std::fmt::{Debug, Formatter};
pub use template::{build, build_default, Actor, Error as TemplateError, ExternalProvider};
use cardano_serialization_lib::address::Address;
use cardano_serialization_lib::Transaction;
use jormungandr_lib::crypto::account::Identifier;
pub struct MainnetWalletState {
pub rep: Option<Identifier>,
pub registration_tx: Option<Transaction>,
pub stake: u64,
pub stake_address: Address,
}
impl Debug for MainnetWalletState {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let mut fmt = f.debug_struct("MainnetWalletState");
fmt.field("rep", &self.rep);
fmt.field("stake", &self.stake);
fmt.field("stake_address", &self.stake_address.to_hex());
fmt.field(
"metadata",
&self
.registration_tx
.as_ref()
.map(Transaction::auxiliary_data),
);
fmt.finish()
}
}
impl MainnetWalletState {
#[must_use]
pub fn rep(&self) -> &Option<Identifier> {
&self.rep
}
#[must_use]
pub fn registration(&self) -> &Option<Transaction> {
&self.registration_tx
}
#[must_use]
pub fn stake(&self) -> u64 {
self.stake
}
#[must_use]
pub fn stake_address(&self) -> &Address {
&self.stake_address
}
}