pub struct X402ExactEvmPermit2Payload {
pub permit2_authorization: X402ExactEvmPermit2PayloadPermit2Authorization,
pub signature: X402ExactEvmPermit2PayloadSignature,
}Expand description
The x402 protocol exact scheme payload for EVM networks using Permit2. Permit2 is a universal token approval mechanism that works with any ERC-20 token, unlike ERC-3009 which requires token-level support.
JSON schema
{
"title": "x402ExactEvmPermit2Payload",
"description": "The x402 protocol exact scheme payload for EVM networks using Permit2. Permit2 is a universal token approval mechanism that works with any ERC-20 token, unlike ERC-3009 which requires token-level support.",
"examples": [
{
"permit2Authorization": {
"deadline": "1716150000",
"from": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"nonce": "12345678901234567890",
"permitted": {
"amount": "1000000",
"token": "0x036CbD53842c5426634e7929541eC2318f3dCF7e"
},
"spender": "0x4020615294c913F045dc10f0a5cdEbd86c280001",
"witness": {
"extra": "0x",
"to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"validAfter": "1716150000"
}
},
"signature": "0xf3746613c2d920b5fdabc0856f2aeb2d4f88ee6037b8cc5d04a71a4462f134801234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1b"
}
],
"type": "object",
"required": [
"permit2Authorization",
"signature"
],
"properties": {
"permit2Authorization": {
"description": "The authorization data for the Permit2 PermitWitnessTransferFrom message.",
"examples": [
{
"deadline": "1716150000",
"from": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"nonce": "12345678901234567890",
"permitted": {
"amount": "1000000",
"token": "0x036CbD53842c5426634e7929541eC2318f3dCF7e"
},
"spender": "0x4020615294c913F045dc10f0a5cdEbd86c280001",
"witness": {
"extra": "0x",
"to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"validAfter": "1716150000"
}
}
],
"type": "object",
"required": [
"deadline",
"from",
"nonce",
"permitted",
"spender",
"witness"
],
"properties": {
"deadline": {
"description": "The unix timestamp before which the permit is valid.",
"examples": [
"1716150000"
],
"type": "string"
},
"from": {
"description": "The 0x-prefixed, checksum EVM address of the sender of the payment.",
"examples": [
"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"
],
"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 amount to transfer in atomic units.",
"examples": [
"1000000"
],
"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 (x402 Permit2 proxy contract).",
"examples": [
"0x4020615294c913F045dc10f0a5cdEbd86c280001"
],
"type": "string",
"pattern": "^0x[0-9a-fA-F]{40}$"
},
"witness": {
"description": "The witness data containing payment details.",
"type": "object",
"required": [
"to",
"validAfter"
],
"properties": {
"extra": {
"description": "Optional hex-encoded extra data.",
"examples": [
"0x"
],
"type": "string",
"pattern": "^0x[0-9a-fA-F]*$"
},
"to": {
"description": "The 0x-prefixed, checksum EVM address of the recipient.",
"examples": [
"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"
],
"type": "string",
"pattern": "^0x[0-9a-fA-F]{40}$"
},
"validAfter": {
"description": "The unix timestamp after which the payment is valid.",
"examples": [
"1716150000"
],
"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: X402ExactEvmPermit2PayloadSignatureThe EIP-712 hex-encoded signature of the Permit2 PermitWitnessTransferFrom message. Smart account signatures may be longer than 65 bytes.
Implementations§
Source§impl X402ExactEvmPermit2Payload
impl X402ExactEvmPermit2Payload
pub fn builder() -> X402ExactEvmPermit2Payload
Trait Implementations§
Source§impl Clone for X402ExactEvmPermit2Payload
impl Clone for X402ExactEvmPermit2Payload
Source§fn clone(&self) -> X402ExactEvmPermit2Payload
fn clone(&self) -> X402ExactEvmPermit2Payload
Returns a duplicate of the value. Read more
1.0.0 · 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 X402ExactEvmPermit2Payload
impl Debug for X402ExactEvmPermit2Payload
Source§impl<'de> Deserialize<'de> for X402ExactEvmPermit2Payload
impl<'de> Deserialize<'de> for X402ExactEvmPermit2Payload
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<&X402ExactEvmPermit2Payload> for X402ExactEvmPermit2Payload
impl From<&X402ExactEvmPermit2Payload> for X402ExactEvmPermit2Payload
Source§fn from(value: &X402ExactEvmPermit2Payload) -> Self
fn from(value: &X402ExactEvmPermit2Payload) -> Self
Converts to this type from the input type.
Source§impl From<X402ExactEvmPermit2Payload> for X402ExactEvmPermit2Payload
impl From<X402ExactEvmPermit2Payload> for X402ExactEvmPermit2Payload
Source§fn from(value: X402ExactEvmPermit2Payload) -> Self
fn from(value: X402ExactEvmPermit2Payload) -> Self
Converts to this type from the input type.
Source§impl From<X402ExactEvmPermit2Payload> for X402v1PaymentPayloadPayload
impl From<X402ExactEvmPermit2Payload> for X402v1PaymentPayloadPayload
Source§fn from(value: X402ExactEvmPermit2Payload) -> Self
fn from(value: X402ExactEvmPermit2Payload) -> Self
Converts to this type from the input type.
Source§impl From<X402ExactEvmPermit2Payload> for X402v2PaymentPayloadPayload
impl From<X402ExactEvmPermit2Payload> for X402v2PaymentPayloadPayload
Source§fn from(value: X402ExactEvmPermit2Payload) -> Self
fn from(value: X402ExactEvmPermit2Payload) -> Self
Converts to this type from the input type.
Source§impl TryFrom<X402ExactEvmPermit2Payload> for X402ExactEvmPermit2Payload
impl TryFrom<X402ExactEvmPermit2Payload> for X402ExactEvmPermit2Payload
Source§type Error = ConversionError
type Error = ConversionError
The type returned in the event of a conversion error.
Source§fn try_from(value: X402ExactEvmPermit2Payload) -> Result<Self, ConversionError>
fn try_from(value: X402ExactEvmPermit2Payload) -> Result<Self, ConversionError>
Performs the conversion.
Auto Trait Implementations§
impl Freeze for X402ExactEvmPermit2Payload
impl RefUnwindSafe for X402ExactEvmPermit2Payload
impl Send for X402ExactEvmPermit2Payload
impl Sync for X402ExactEvmPermit2Payload
impl Unpin for X402ExactEvmPermit2Payload
impl UnsafeUnpin for X402ExactEvmPermit2Payload
impl UnwindSafe for X402ExactEvmPermit2Payload
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