Struct iapyx::controller::Controller
source · pub struct Controller {
pub backend: ValgrindClient,
pub wallet: Wallet,
pub settings: Settings,
pub block_date_generator: BlockDateGenerator,
}
Expand description
Responsible for all wallet operations from voting to retrieving information about proposals or voting power
Fields§
§backend: ValgrindClient
Catalyst backend client
wallet: Wallet
Wallet state
settings: Settings
Cached blockchain settings
block_date_generator: BlockDateGenerator
Expiry date generator
Implementations§
source§impl Controller
impl Controller
sourcepub fn switch_backend(
&mut self,
proxy_address: String,
backend_settings: RestSettings
) -> Result<(), ControllerError>
pub fn switch_backend( &mut self, proxy_address: String, backend_settings: RestSettings ) -> Result<(), ControllerError>
sourcepub fn account(&self, discrimination: Discrimination) -> Address
pub fn account(&self, discrimination: Discrimination) -> Address
Gets account
sourcepub fn id(&self) -> AccountId
pub fn id(&self) -> AccountId
Gets account identifier. This is something different that account method since we are not retrieving entire object but only the identifier which helps of find records in blockchain
sourcepub fn send_fragment(
&self,
transaction: &[u8]
) -> Result<FragmentId, ControllerError>
pub fn send_fragment( &self, transaction: &[u8] ) -> Result<FragmentId, ControllerError>
sourcepub fn set_block_date_generator(
&mut self,
block_date_generator: BlockDateGenerator
)
pub fn set_block_date_generator( &mut self, block_date_generator: BlockDateGenerator )
Sets transaction ttl definition. Usually when we are sending some fragments we need to define how long
we want to wait until it will be put in block. BlockDateGenerator
helps us define ttl without calculating
it each time
sourcepub fn send_fragments(
&self,
transaction: Vec<Vec<u8>>
) -> Result<Vec<FragmentId>, ControllerError>
pub fn send_fragments( &self, transaction: Vec<Vec<u8>> ) -> Result<Vec<FragmentId>, ControllerError>
sourcepub fn confirm_all_transactions(&mut self)
pub fn confirm_all_transactions(&mut self)
Confirms all transactions means to remove them from pending transaction collection and as a result remove trace needed to track their status in node
sourcepub fn confirm_transaction(&mut self, id: FragmentId)
pub fn confirm_transaction(&mut self, id: FragmentId)
Confirms transaction by it id. This means to remove it from pending transaction collection and as a result remove trace needed to track their status in node
sourcepub fn pending_transactions(&self) -> Vec<FragmentId>
pub fn pending_transactions(&self) -> Vec<FragmentId>
Unconfirmed collection of transactions (which statuses we still want to track)
sourcepub fn wait_for_pending_transactions(
&mut self,
pace: Duration
) -> Result<(), ControllerError>
pub fn wait_for_pending_transactions( &mut self, pace: Duration ) -> Result<(), ControllerError>
Waits until all transaction will have final states (either InABlock
or Reject
)
for given duration
Errors
On connection issues
sourcepub fn remove_pending_transaction(&mut self, id: FragmentId)
pub fn remove_pending_transaction(&mut self, id: FragmentId)
remove specific transaction from assumed pending
sourcepub fn total_value(&self) -> Value
pub fn total_value(&self) -> Value
gets total value ada
sourcepub fn refresh_state(&mut self) -> Result<(), ControllerError>
pub fn refresh_state(&mut self) -> Result<(), ControllerError>
sourcepub fn get_account_state(&self) -> Result<AccountState, ControllerError>
pub fn get_account_state(&self) -> Result<AccountState, ControllerError>
sourcepub fn proposals(
&self,
group: &str
) -> Result<Vec<FullProposalInfo>, ControllerError>
pub fn proposals( &self, group: &str ) -> Result<Vec<FullProposalInfo>, ControllerError>
sourcepub fn funds(&self) -> Result<Fund, ControllerError>
pub fn funds(&self) -> Result<Fund, ControllerError>
sourcepub fn settings(&self) -> Result<SettingsDto, ControllerError>
pub fn settings(&self) -> Result<SettingsDto, ControllerError>
sourcepub fn vote_for(
&mut self,
voteplan_id: &str,
proposal_index: u32,
choice: u8
) -> Result<FragmentId, ControllerError>
pub fn vote_for( &mut self, voteplan_id: &str, proposal_index: u32, choice: u8 ) -> Result<FragmentId, ControllerError>
Send specialized transaction (with vote certificates) based on low level parameters
Errors
On connection issues
sourcepub fn vote(
&mut self,
proposal: &FullProposalInfo,
choice: Choice
) -> Result<FragmentId, ControllerError>
pub fn vote( &mut self, proposal: &FullProposalInfo, choice: Choice ) -> Result<FragmentId, ControllerError>
Send specialized transaction (with vote certificates) based on FullProposalInfo
struct
Errors
On connection issues
sourcepub fn votes_batch(
&mut self,
votes_data: Vec<(&FullProposalInfo, Choice)>
) -> Result<Vec<FragmentId>, ControllerError>
pub fn votes_batch( &mut self, votes_data: Vec<(&FullProposalInfo, Choice)> ) -> Result<Vec<FragmentId>, ControllerError>
sourcepub fn get_proposals(
&mut self,
group: &str
) -> Result<Vec<FullProposalInfo>, ControllerError>
pub fn get_proposals( &mut self, group: &str ) -> Result<Vec<FullProposalInfo>, ControllerError>
sourcepub fn fragment_logs(
&self
) -> Result<HashMap<FragmentId, FragmentLog>, ControllerError>
pub fn fragment_logs( &self ) -> Result<HashMap<FragmentId, FragmentLog>, ControllerError>
sourcepub fn vote_plan_history(
&self,
vote_plan_id: VotePlanId
) -> Result<Option<Vec<u8>>, ControllerError>
pub fn vote_plan_history( &self, vote_plan_id: VotePlanId ) -> Result<Option<Vec<u8>>, ControllerError>
sourcepub fn votes_history(
&self
) -> Result<Option<Vec<AccountVotes>>, ControllerError>
pub fn votes_history( &self ) -> Result<Option<Vec<AccountVotes>>, ControllerError>
fn wallet_address(&self) -> Result<Address, ControllerError>
sourcepub fn active_vote_plan(&self) -> Result<Vec<VotePlanStatus>, ControllerError>
pub fn active_vote_plan(&self) -> Result<Vec<VotePlanStatus>, ControllerError>
Auto Trait Implementations§
impl !RefUnwindSafe for Controller
impl Send for Controller
impl Sync for Controller
impl Unpin for Controller
impl !UnwindSafe for Controller
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