pub struct DevnetUsdcSettler { /* private fields */ }Expand description
A devnet settler: the EscrowBondEngine state machine plus a real SPL-USDC
transfer on slash. See the crate docs for the devnet-only caveat.
Implementations§
Source§impl DevnetUsdcSettler
impl DevnetUsdcSettler
Sourcepub fn new(
rpc_url: impl Into<String>,
agent: Arc<Keypair>,
usdc_mint: Pubkey,
beneficiary_token_account: Pubkey,
config: BondConfig,
) -> Self
pub fn new( rpc_url: impl Into<String>, agent: Arc<Keypair>, usdc_mint: Pubkey, beneficiary_token_account: Pubkey, config: BondConfig, ) -> Self
Construct against an explicit RPC endpoint and bond configuration.
Sourcepub fn devnet(
agent: Arc<Keypair>,
usdc_mint: Pubkey,
beneficiary_token_account: Pubkey,
) -> Self
pub fn devnet( agent: Arc<Keypair>, usdc_mint: Pubkey, beneficiary_token_account: Pubkey, ) -> Self
Convenience: the public devnet RPC with the default BondConfig.
Sourcepub fn agent_usdc_account(&self) -> Pubkey
pub fn agent_usdc_account(&self) -> Pubkey
The agent’s USDC associated-token account (the bond’s funding source).
Sourcepub fn quote_fee(&self, conviction: Conviction) -> Usdc
pub fn quote_fee(&self, conviction: Conviction) -> Usdc
The inference fee for a given conviction (delegates to the inner engine).
Sourcepub fn ledger(&self) -> BondLedger
pub fn ledger(&self) -> BondLedger
Snapshot of the honored/slashed ledger.
Sourcepub fn open_bonds(&self) -> usize
pub fn open_bonds(&self) -> usize
Number of bonds currently escrowed (awaiting settlement).
Sourcepub fn last_signature(&self) -> Option<Signature>
pub fn last_signature(&self) -> Option<Signature>
The signature of the most recent on-chain slash transfer, if any.
Sourcepub async fn settle_onchain(
&self,
bond: &Bond,
fill: &Fill,
) -> Result<(BondOutcome, Option<Signature>)>
pub async fn settle_onchain( &self, bond: &Bond, fill: &Fill, ) -> Result<(BondOutcome, Option<Signature>)>
Like BondEngine::settle but also returns the on-chain transfer
signature when the bond was slashed (None when honored).
Trait Implementations§
Source§impl BondEngine for DevnetUsdcSettler
impl BondEngine for DevnetUsdcSettler
Source§fn settle<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
bond: &'life1 Bond,
fill: &'life2 Fill,
) -> Pin<Box<dyn Future<Output = Result<BondOutcome>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn settle<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
bond: &'life1 Bond,
fill: &'life2 Fill,
) -> Pin<Box<dyn Future<Output = Result<BondOutcome>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Settles the bond and, on slash, performs the devnet USDC transfer. Use
DevnetUsdcSettler::settle_onchain if you need the transfer signature.
Auto Trait Implementations§
impl !Freeze for DevnetUsdcSettler
impl !RefUnwindSafe for DevnetUsdcSettler
impl !UnwindSafe for DevnetUsdcSettler
impl Send for DevnetUsdcSettler
impl Sync for DevnetUsdcSettler
impl Unpin for DevnetUsdcSettler
impl UnsafeUnpin for DevnetUsdcSettler
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more