pub struct SolanaPaymentProcessor { /* private fields */ }Expand description
Solana payment processor for handling blockchain operations
Implementations§
Source§impl SolanaPaymentProcessor
impl SolanaPaymentProcessor
Sourcepub fn new(
rpc_url: &str,
commitment: Option<CommitmentConfig>,
) -> SolanaPaymentProcessor
pub fn new( rpc_url: &str, commitment: Option<CommitmentConfig>, ) -> SolanaPaymentProcessor
Create a new Solana payment processor
§Arguments
rpc_url- Solana RPC endpoint URLcommitment- Transaction commitment level (default: confirmed)
Sourcepub fn default_rpc_url(network: &str) -> &'static str
pub fn default_rpc_url(network: &str) -> &'static str
Get the default RPC URL for a network
Sourcepub async fn create_payment(
&self,
request: &PaymentRequest,
payer: &Keypair,
) -> Result<PaymentAuthorization, X402Error>
pub async fn create_payment( &self, request: &PaymentRequest, payer: &Keypair, ) -> Result<PaymentAuthorization, X402Error>
Create a payment from a payment request
This creates, signs, and broadcasts a Solana SPL token transfer transaction
Sourcepub async fn verify_payment(
&self,
authorization: &PaymentAuthorization,
expected_amount: &str,
) -> Result<bool, X402Error>
pub async fn verify_payment( &self, authorization: &PaymentAuthorization, expected_amount: &str, ) -> Result<bool, X402Error>
Verify a payment transaction
This checks that the transaction exists on-chain and matches the expected parameters
Auto Trait Implementations§
impl !Freeze for SolanaPaymentProcessor
impl !RefUnwindSafe for SolanaPaymentProcessor
impl !UnwindSafe for SolanaPaymentProcessor
impl Send for SolanaPaymentProcessor
impl Sync for SolanaPaymentProcessor
impl Unpin for SolanaPaymentProcessor
impl UnsafeUnpin for SolanaPaymentProcessor
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