Skip to main content

ResolveProvider

Trait ResolveProvider 

Source
pub(crate) trait ResolveProvider {
    type Provider: PaymentProvider;

    // Required method
    fn resolve_for(
        &self,
        opts: DiscoverOptions,
    ) -> TransportResult<Self::Provider>;

    // Provided methods
    fn resolve(&self) -> TransportResult<Self::Provider> { ... }
    fn set_key_provisioned(&self, _provisioned: bool) { ... }
    fn clear_channels(&self) { ... }
    fn flush_pending(&self) { ... }
    fn rollback_pending(&self) { ... }
    fn commit_topup_and_track_voucher(&self) { ... }
    fn invalidate_cached_provider(&self) { ... }
    fn funding_wallet_address(&self) -> Option<Address> { ... }
    fn funding_chain_id(&self) -> Option<u64> { ... }
    fn funding_context(&self, challenge: &PaymentChallenge) -> FundingContext { ... }
    fn lock_pay(
        &self,
    ) -> impl Future<Output = Option<OwnedMutexGuard<()>>> + Send { ... }
}
Expand description

Trait for resolving a concrete PaymentProvider from a potentially lazy wrapper.

Required Associated Types§

Source

type Provider: PaymentProvider

Required Methods§

Source

fn resolve_for(&self, opts: DiscoverOptions) -> TransportResult<Self::Provider>

Provided Methods§

Source

fn resolve(&self) -> TransportResult<Self::Provider>

Source

fn set_key_provisioned(&self, _provisioned: bool)

Source

fn clear_channels(&self)

Source

fn flush_pending(&self)

Source

fn rollback_pending(&self)

Source

fn commit_topup_and_track_voucher(&self)

Source

fn invalidate_cached_provider(&self)

Drop any cached payment provider so the next resolve_for re-runs discovery. Called after the device-code flow writes a fresh keys.toml entry.

Source

fn funding_wallet_address(&self) -> Option<Address>

Source

fn funding_chain_id(&self) -> Option<u64>

Source

fn funding_context(&self, challenge: &PaymentChallenge) -> FundingContext

Source

fn lock_pay(&self) -> impl Future<Output = Option<OwnedMutexGuard<()>>> + Send

Acquire the payment serialization lock. The returned guard must be held across the entire 402 → pay → retry → response cycle to prevent concurrent channel opens and colliding expiring-nonce transactions.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§