Built-in X402.Scheme for exact payments on EVM (eip155:*) networks.
Implements both roles:
- Client — signs an EIP-3009
TransferWithAuthorizationthroughX402.EIP3009, producing the%{"signature" => ..., "authorization" => ...}scheme payload. An entry is signable when its EIP-712 domain can be derived from the requirements (extra.name/extra.versionpresent, defaulteip3009transfer method). - Server — runs the local pre-checks on the EIP-3009 authorization
object before the facilitator round-trip:
tomust equal the requirements'payTo,valuemust equal the advertisedamount, and thevalidAfter/validBeforewindow must cover now plus a settlement buffer (X402.Scheme.EVM.time_buffer_seconds/0). Payloads without apayload.authorizationmap are skipped.
Envelope validation of the PAYMENT-SIGNATURE payload is handled by
X402.PaymentSignature; this scheme adds no extra structural checks
(X402.Scheme.validate_payload/3 returns :ok).
Summary
Functions
Returns ["eip155:*"] — every EVM network.
Runs X402.Scheme.EVM.authorization_precheck/3 with exact-amount
equality enforced.
Returns "exact".
Signs the EIP-3009 scheme payload via X402.EIP3009.sign/3.
Whether the EIP-712 domain can be derived from the requirements.
Always :ok — envelope validation covers the exact payload shape.
Functions
@spec networks() :: [String.t()]
Returns ["eip155:*"] — every EVM network.
Examples
iex> X402.Scheme.ExactEVM.networks()
["eip155:*"]
@spec precheck(map(), map(), keyword()) :: :ok | {:error, {:precheck_failed, X402.Scheme.EVM.precheck_failure()}}
Runs X402.Scheme.EVM.authorization_precheck/3 with exact-amount
equality enforced.
@spec scheme() :: String.t()
Returns "exact".
Examples
iex> X402.Scheme.ExactEVM.scheme()
"exact"
@spec sign(map(), X402.Signer.t(), keyword()) :: {:ok, map()} | {:error, term()}
Signs the EIP-3009 scheme payload via X402.EIP3009.sign/3.
Honors the client's :valid_after_buffer option; other options are
ignored.
Whether the EIP-712 domain can be derived from the requirements.
Examples
iex> X402.Scheme.ExactEVM.signable?(%{
...> "network" => "eip155:84532",
...> "asset" => "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
...> "extra" => %{"name" => "USDC", "version" => "2"}
...> })
true
iex> X402.Scheme.ExactEVM.signable?(%{"extra" => %{}})
false
Always :ok — envelope validation covers the exact payload shape.
Examples
iex> X402.Scheme.ExactEVM.validate_payload(%{}, %{}, [])
:ok