Struct iapyx::MultiController
source · pub struct MultiController {
pub(super) backend: ValgrindClient,
pub(super) wallets: Vec<Wallet>,
pub(super) settings: Settings,
}
Expand description
Responsible for controlling more than one wallet at one time. Useful for load scenario or wallets which handles many users
Fields§
§backend: ValgrindClient
§wallets: Vec<Wallet>
§settings: Settings
Implementations§
source§impl MultiController
impl MultiController
sourcepub fn recover_from_qrs<P: AsRef<Path>>(
wallet_backend_address: &str,
qrs: &[P],
pin_mode: &PinReadModeSettings,
backend_settings: RestSettings
) -> Result<Self, MultiControllerError>
pub fn recover_from_qrs<P: AsRef<Path>>( wallet_backend_address: &str, qrs: &[P], pin_mode: &PinReadModeSettings, backend_settings: RestSettings ) -> Result<Self, MultiControllerError>
sourcepub fn recover_from_sks<P: AsRef<Path>>(
proxy_address: &str,
private_keys: &[P],
backend_settings: RestSettings
) -> Result<Self, MultiControllerError>
pub fn recover_from_sks<P: AsRef<Path>>( proxy_address: &str, private_keys: &[P], backend_settings: RestSettings ) -> Result<Self, MultiControllerError>
sourcepub fn proposals(
&self,
group: &str
) -> Result<Vec<FullProposalInfo>, MultiControllerError>
pub fn proposals( &self, group: &str ) -> Result<Vec<FullProposalInfo>, MultiControllerError>
sourcepub(crate) fn backend(&self) -> &ValgrindClient
pub(crate) fn backend(&self) -> &ValgrindClient
Get inner backend client which can perform some custom REST API operations over the node or servicing-station
sourcepub fn update_wallets_state(&mut self) -> Result<(), MultiControllerError>
pub fn update_wallets_state(&mut self) -> Result<(), MultiControllerError>
Update wallet state for entire wallets collection based on current state in blockchain
Errors
On connection issues
sourcepub fn update_wallet_state(
&mut self,
wallet_index: usize
) -> Result<(), MultiControllerError>
pub fn update_wallet_state( &mut self, wallet_index: usize ) -> Result<(), MultiControllerError>
sourcepub fn update_wallet_state_if(
&mut self,
wallet_index: usize,
predicate: &dyn Fn(&Wallet) -> bool
) -> Result<(), MultiControllerError>
pub fn update_wallet_state_if( &mut self, wallet_index: usize, predicate: &dyn Fn(&Wallet) -> bool ) -> Result<(), MultiControllerError>
Update wallet states based on current state in blockchain if condition is satisfied. For example only if wallet spending counter is 0 which means it is in initial state
Errors
On connection issues
sourcepub fn vote(
&mut self,
wallet_index: usize,
proposal: &FullProposalInfo,
choice: Choice,
valid_until: BlockDate
) -> Result<FragmentId, MultiControllerError>
pub fn vote( &mut self, wallet_index: usize, proposal: &FullProposalInfo, choice: Choice, valid_until: BlockDate ) -> Result<FragmentId, MultiControllerError>
Sends vote transaction on behalf of wallet with index wallet_index
on proposal with
given choice. Sets expiry slot equal to valid_until
.
Errors
On connection issues
sourcepub fn votes_batch(
&mut self,
wallet_index: usize,
use_v1: bool,
votes_data: Vec<(&FullProposalInfo, Choice)>,
valid_until: &BlockDate
) -> Result<Vec<FragmentId>, MultiControllerError>
pub fn votes_batch( &mut self, wallet_index: usize, use_v1: bool, votes_data: Vec<(&FullProposalInfo, Choice)>, valid_until: &BlockDate ) -> Result<Vec<FragmentId>, MultiControllerError>
Sends bunch of vote transactions on behalf of wallet with index wallet_index
with map of proposals and respectful choices. Sets expiry slot equal to valid_until
.
Method can use V0 or V1 api based on preference. V1 enable to send all transactions in a batch
as single call whether legacy V0 is able to send them as one vote per call
Errors
On connection issues
Panics
On connection problem
sourcepub fn confirm_all_transactions(&mut self)
pub fn confirm_all_transactions(&mut self)
Confirms all transactions for all wallets. Confirms means loose interest in tracking their statuses. This method should be call when we are sure our transactions all in final states (in block or failed).
sourcepub fn confirm_transaction(&mut self, fragment_id: FragmentId)
pub fn confirm_transaction(&mut self, fragment_id: FragmentId)
Confirms all transactions for wallet. Confirms means loose interest in tracking their statuses. This method should be call when we are sure our transactions all in final states (in block or failed).
sourcepub fn wallet_count(&self) -> usize
pub fn wallet_count(&self) -> usize
Wallet counts
Trait Implementations§
source§impl From<MultiController> for Vec<Wallet>
impl From<MultiController> for Vec<Wallet>
source§fn from(controller: MultiController) -> Self
fn from(controller: MultiController) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for MultiController
impl Send for MultiController
impl Sync for MultiController
impl Unpin for MultiController
impl !UnwindSafe for MultiController
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Fake for T
impl<T> Fake for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
§impl<T> IntoSql for T
impl<T> IntoSql for T
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where C: Color,
§fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
§fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
§fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
§fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
§fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
§fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
§fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
§fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
§fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
§fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
§fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
§fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
§fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
§fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
§fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
§fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
§fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
§fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
§fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
§fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where Color: DynColor,
OwoColorize::fg
or
a color-specific method, such as OwoColorize::green
, Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where Color: DynColor,
OwoColorize::bg
or
a color-specific method, such as OwoColorize::on_yellow
, Read more