pub struct RedemptionWatcher { /* private fields */ }Expand description
Monitors wallets for redeemable positions after oracle resolution.
Implementations§
Source§impl RedemptionWatcher
impl RedemptionWatcher
pub fn new(client: Arc<PolyNodeClient>, config: RedemptionWatcherConfig) -> Self
Sourcepub async fn start(&mut self, wallets: &[&str]) -> Result<()>
pub async fn start(&mut self, wallets: &[&str]) -> Result<()>
Start watching. Fetches positions via REST, then spawns a background task that listens to oracle events and position changes.
Sourcepub async fn add_wallets(&mut self, wallets: &[&str]) -> Result<()>
pub async fn add_wallets(&mut self, wallets: &[&str]) -> Result<()>
Add wallets at runtime.
Sourcepub fn remove_wallets(&mut self, wallets: &[&str])
pub fn remove_wallets(&mut self, wallets: &[&str])
Remove wallets from tracking.
Sourcepub async fn next_alert(&mut self) -> Option<RedeemableAlert>
pub async fn next_alert(&mut self) -> Option<RedeemableAlert>
Receive the next alert. Returns None when the watcher is closed.
Sourcepub fn positions_for(&self, wallet: &str) -> Vec<TrackedPosition>
pub fn positions_for(&self, wallet: &str) -> Vec<TrackedPosition>
Get tracked positions for a wallet.
Auto Trait Implementations§
impl Freeze for RedemptionWatcher
impl !RefUnwindSafe for RedemptionWatcher
impl Send for RedemptionWatcher
impl Sync for RedemptionWatcher
impl Unpin for RedemptionWatcher
impl UnsafeUnpin for RedemptionWatcher
impl !UnwindSafe for RedemptionWatcher
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
Mutably borrows from an owned value. Read more