pub struct X402UptoEvmPermit2Payload {
pub permit2_authorization: X402UptoEvmPermit2PayloadPermit2Authorization,
pub signature: X402UptoEvmPermit2PayloadSignature,
}Expand description
The x402 protocol upto scheme payload for EVM networks using Permit2. The upto scheme authorizes a maximum amount and lets the facilitator settle for the actual amount used. Structurally identical to x402ExactEvmPermit2Payload except permit2Authorization.witness carries an additional facilitator address that binds the authorization to a specific facilitator (the one announced via extra.facilitatorAddress in the payment requirements). For more details, see EVM Upto Scheme Details.
JSON schema
{
"title": "x402UptoEvmPermit2Payload",
"description": "The x402 protocol upto scheme payload for EVM networks using Permit2. The `upto` scheme authorizes a maximum amount and lets the facilitator settle for the actual amount used. Structurally identical to `x402ExactEvmPermit2Payload` except `permit2Authorization.witness` carries an additional `facilitator` address that binds the authorization to a specific facilitator (the one announced via `extra.facilitatorAddress` in the payment requirements). For more details, see [EVM Upto Scheme Details](https://github.com/x402-foundation/x402/blob/main/specs/schemes/upto/scheme_upto_evm.md).",
"examples": [
{
"permit2Authorization": {
"deadline": "1740672154",
"from": "0x857b06519E91e3A54538791bDbb0E22373e36b66",
"nonce": "12345678901234567890",
"permitted": {
"amount": "5000000",
"token": "0x036CbD53842c5426634e7929541eC2318f3dCF7e"
},
"spender": "0x4020A4f3b7b90ccA423B9fabCc0CE57C6C240002",
"witness": {
"facilitator": "0x1111111111111111111111111111111111111111",
"to": "0x209693Bc6afc0C5328bA36FaF03C514EF312287C",
"validAfter": "1740672089"
}
},
"signature": "0x2d6a7588d6acca505cbf0d9a4a227e0c52c6c34008c8e8986a1283259764173608a2ce6496642e377d6da8dbbf5836e9bd15092f9ecab05ded3d6293af148b571c"
}
],
"type": "object",
"required": [
"permit2Authorization",
"signature"
],
"properties": {
"permit2Authorization": {
"description": "The authorization data for the Permit2 PermitWitnessTransferFrom message. The `permitted.amount` is the maximum the client authorizes; the actual settled amount is decided by the resource server at settle time and MUST be less than or equal to it.",
"type": "object",
"required": [
"deadline",
"from",
"nonce",
"permitted",
"spender",
"witness"
],
"properties": {
"deadline": {
"description": "The unix timestamp before which the permit is valid.",
"examples": [
"1740672154"
],
"type": "string"
},
"from": {
"description": "The 0x-prefixed, checksum EVM address of the sender of the payment.",
"examples": [
"0x857b06519E91e3A54538791bDbb0E22373e36b66"
],
"type": "string",
"pattern": "^0x[0-9a-fA-F]{40}$"
},
"nonce": {
"description": "The Permit2 nonce as a decimal string (uint256).",
"examples": [
"12345678901234567890"
],
"type": "string",
"pattern": "^[0-9]+$"
},
"permitted": {
"description": "The token permissions for the transfer.",
"type": "object",
"required": [
"amount",
"token"
],
"properties": {
"amount": {
"description": "The maximum amount the client authorizes to transfer in atomic units.",
"examples": [
"5000000"
],
"type": "string"
},
"token": {
"description": "The 0x-prefixed, checksum EVM address of the token to transfer.",
"examples": [
"0x036CbD53842c5426634e7929541eC2318f3dCF7e"
],
"type": "string",
"pattern": "^0x[0-9a-fA-F]{40}$"
}
}
},
"spender": {
"description": "The 0x-prefixed, checksum EVM address of the spender (the x402 Upto Permit2 proxy contract).",
"examples": [
"0x4020A4f3b7b90ccA423B9fabCc0CE57C6C240002"
],
"type": "string",
"pattern": "^0x[0-9a-fA-F]{40}$"
},
"witness": {
"description": "The witness data containing payment details. Includes a `facilitator` field to bind the authorization to a specific facilitator address.",
"type": "object",
"required": [
"facilitator",
"to",
"validAfter"
],
"properties": {
"facilitator": {
"description": "The 0x-prefixed, checksum EVM address of the facilitator authorized to settle this payment. MUST match the `facilitatorAddress` advertised in the payment requirements `extra` field.",
"examples": [
"0x1111111111111111111111111111111111111111"
],
"type": "string",
"pattern": "^0x[0-9a-fA-F]{40}$"
},
"to": {
"description": "The 0x-prefixed, checksum EVM address of the recipient.",
"examples": [
"0x209693Bc6afc0C5328bA36FaF03C514EF312287C"
],
"type": "string",
"pattern": "^0x[0-9a-fA-F]{40}$"
},
"validAfter": {
"description": "The unix timestamp after which the payment is valid.",
"examples": [
"1740672089"
],
"type": "string"
}
}
}
}
},
"signature": {
"description": "The EIP-712 hex-encoded signature of the Permit2 PermitWitnessTransferFrom message. Smart account signatures may be longer than 65 bytes.",
"examples": [
"0xf3746613c2d920b5fdabc0856f2aeb2d4f88ee6037b8cc5d04a71a4462f134801234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1b"
],
"type": "string",
"pattern": "^0x[0-9a-fA-F]{130,}$"
}
}
}Fields§
§signature: X402UptoEvmPermit2PayloadSignatureThe EIP-712 hex-encoded signature of the Permit2 PermitWitnessTransferFrom message. Smart account signatures may be longer than 65 bytes.
Implementations§
Source§impl X402UptoEvmPermit2Payload
impl X402UptoEvmPermit2Payload
pub fn builder() -> X402UptoEvmPermit2Payload
Trait Implementations§
Source§impl Clone for X402UptoEvmPermit2Payload
impl Clone for X402UptoEvmPermit2Payload
Source§fn clone(&self) -> X402UptoEvmPermit2Payload
fn clone(&self) -> X402UptoEvmPermit2Payload
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for X402UptoEvmPermit2Payload
impl Debug for X402UptoEvmPermit2Payload
Source§impl<'de> Deserialize<'de> for X402UptoEvmPermit2Payload
impl<'de> Deserialize<'de> for X402UptoEvmPermit2Payload
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<&X402UptoEvmPermit2Payload> for X402UptoEvmPermit2Payload
impl From<&X402UptoEvmPermit2Payload> for X402UptoEvmPermit2Payload
Source§fn from(value: &X402UptoEvmPermit2Payload) -> Self
fn from(value: &X402UptoEvmPermit2Payload) -> Self
Converts to this type from the input type.
Source§impl From<X402UptoEvmPermit2Payload> for X402UptoEvmPermit2Payload
impl From<X402UptoEvmPermit2Payload> for X402UptoEvmPermit2Payload
Source§fn from(value: X402UptoEvmPermit2Payload) -> Self
fn from(value: X402UptoEvmPermit2Payload) -> Self
Converts to this type from the input type.
Source§impl From<X402UptoEvmPermit2Payload> for X402v2PaymentPayloadPayload
impl From<X402UptoEvmPermit2Payload> for X402v2PaymentPayloadPayload
Source§fn from(value: X402UptoEvmPermit2Payload) -> Self
fn from(value: X402UptoEvmPermit2Payload) -> Self
Converts to this type from the input type.
Source§impl TryFrom<X402UptoEvmPermit2Payload> for X402UptoEvmPermit2Payload
impl TryFrom<X402UptoEvmPermit2Payload> for X402UptoEvmPermit2Payload
Source§type Error = ConversionError
type Error = ConversionError
The type returned in the event of a conversion error.
Source§fn try_from(value: X402UptoEvmPermit2Payload) -> Result<Self, ConversionError>
fn try_from(value: X402UptoEvmPermit2Payload) -> Result<Self, ConversionError>
Performs the conversion.
Auto Trait Implementations§
impl Freeze for X402UptoEvmPermit2Payload
impl RefUnwindSafe for X402UptoEvmPermit2Payload
impl Send for X402UptoEvmPermit2Payload
impl Sync for X402UptoEvmPermit2Payload
impl Unpin for X402UptoEvmPermit2Payload
impl UnsafeUnpin for X402UptoEvmPermit2Payload
impl UnwindSafe for X402UptoEvmPermit2Payload
Blanket Implementations§
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