pub struct X402AutoClient { /* private fields */ }Expand description
X402 HTTP client with automatic payment handling
This client automatically detects 402 Payment Required responses, creates and sends payments, and retries the original request.
Implementations§
Source§impl X402AutoClient
impl X402AutoClient
Sourcepub fn new(
keypair: Keypair,
rpc_url: Option<&str>,
options: Option<AutoClientOptions>,
) -> Self
pub fn new( keypair: Keypair, rpc_url: Option<&str>, options: Option<AutoClientOptions>, ) -> Self
Create a new auto client
§Arguments
keypair- Solana keypair for signing transactionsrpc_url- Optional Solana RPC URL (defaults to devnet)options- Optional configuration (uses defaults if None)
Sourcepub async fn get(&self, url: &str) -> X402Result<Response>
pub async fn get(&self, url: &str) -> X402Result<Response>
Make a GET request with automatic payment handling
Sourcepub async fn post(
&self,
url: &str,
body: Option<String>,
) -> X402Result<Response>
pub async fn post( &self, url: &str, body: Option<String>, ) -> X402Result<Response>
Make a POST request with automatic payment handling
Sourcepub fn client(&self) -> &X402Client
pub fn client(&self) -> &X402Client
Get the underlying client for manual operations
Sourcepub fn options(&self) -> &AutoClientOptions
pub fn options(&self) -> &AutoClientOptions
Get the client options
Auto Trait Implementations§
impl !Freeze for X402AutoClient
impl !RefUnwindSafe for X402AutoClient
impl !UnwindSafe for X402AutoClient
impl Send for X402AutoClient
impl Sync for X402AutoClient
impl Unpin for X402AutoClient
impl UnsafeUnpin for X402AutoClient
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
Mutably borrows from an owned value. Read more
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> ⓘ
Converts
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> ⓘ
Converts
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