#[non_exhaustive]pub struct PaymentRequirements<TScheme = CompactString, TAmount = CompactString, TAddress = CompactString, TExtra = Value> {
pub scheme: TScheme,
pub network: ChainId,
pub amount: TAmount,
pub pay_to: TAddress,
pub max_timeout_seconds: u64,
pub asset: TAddress,
pub extra: Option<TExtra>,
}Expand description
Payment terms set by the seller.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.scheme: TSchemePayment scheme, e.g. "exact" or "upto".
network: ChainIdCAIP-2 chain identifier (e.g. "eip155:8453").
amount: TAmountPayment amount in the token’s smallest unit (string for precision).
pay_to: TAddressRecipient address on the target chain.
max_timeout_seconds: u64Maximum time in seconds the authorization remains valid.
asset: TAddressToken asset address / mint.
extra: Option<TExtra>Scheme-specific auxiliary data.
Implementations§
Source§impl<TScheme, TAmount, TAddress, TExtra> PaymentRequirements<TScheme, TAmount, TAddress, TExtra>
impl<TScheme, TAmount, TAddress, TExtra> PaymentRequirements<TScheme, TAmount, TAddress, TExtra>
Sourcepub const fn new(
scheme: TScheme,
network: ChainId,
amount: TAmount,
pay_to: TAddress,
asset: TAddress,
max_timeout_seconds: u64,
) -> Self
pub const fn new( scheme: TScheme, network: ChainId, amount: TAmount, pay_to: TAddress, asset: TAddress, max_timeout_seconds: u64, ) -> Self
Constructs the six required wire fields.
Sourcepub fn with_extra(self, extra: TExtra) -> Self
pub fn with_extra(self, extra: TExtra) -> Self
Attaches the scheme-specific extra blob.
Sourcepub fn with_optional_extra(self, extra: Option<TExtra>) -> Self
pub fn with_optional_extra(self, extra: Option<TExtra>) -> Self
Passes through an optional extra blob.
Source§impl<TScheme, TAmount, TAddress, TExtra> PaymentRequirements<TScheme, TAmount, TAddress, TExtra>
impl<TScheme, TAmount, TAddress, TExtra> PaymentRequirements<TScheme, TAmount, TAddress, TExtra>
Sourcepub fn matches_payload_accepted(&self, accepted: &Self) -> bool
pub fn matches_payload_accepted(&self, accepted: &Self) -> bool
Core fields including maxTimeoutSeconds must be equal.
Server-declared extra is a subset of accepted.extra.
Sourcepub fn matches_payload_accepted_with_dynamic(
&self,
accepted: &Self,
dynamic_extra_fields: &[&str],
) -> bool
pub fn matches_payload_accepted_with_dynamic( &self, accepted: &Self, dynamic_extra_fields: &[&str], ) -> bool
Like Self::matches_payload_accepted, omitting dynamic_extra_fields
from both extras before the subset check.
Source§impl PaymentRequirements
impl PaymentRequirements
Sourcepub fn as_concrete<TScheme, TAmount, TAddress, TExtra>(
&self,
) -> Option<PaymentRequirements<TScheme, TAmount, TAddress, TExtra>>
pub fn as_concrete<TScheme, TAmount, TAddress, TExtra>( &self, ) -> Option<PaymentRequirements<TScheme, TAmount, TAddress, TExtra>>
Converts all-string wire requirements into a typed variant.
Returns None if any component fails to parse.
Trait Implementations§
Source§impl<TScheme: Clone, TAmount: Clone, TAddress: Clone, TExtra: Clone> Clone for PaymentRequirements<TScheme, TAmount, TAddress, TExtra>
impl<TScheme: Clone, TAmount: Clone, TAddress: Clone, TExtra: Clone> Clone for PaymentRequirements<TScheme, TAmount, TAddress, TExtra>
Source§fn clone(&self) -> PaymentRequirements<TScheme, TAmount, TAddress, TExtra>
fn clone(&self) -> PaymentRequirements<TScheme, TAmount, TAddress, TExtra>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more