@integraledger/lcp/x402-batch-settlement
x402 `batch-settlement`: one ATR per channel, its hash the EVM channel configuration's `salt`, the Solana opening transaction's seller Memo instruction, or, on Cloudflare, the echoed `extensions.legalContext` of each request.
For AI agents: this page as Markdown, and llms.txt, the index of every page.
x402 batch-settlement: one ATR per channel, its hash the EVM channel configuration's salt, the Solana opening
transaction's seller Memo instruction, or, on Cloudflare, the echoed extensions.legalContext of each request.
On EVM the channel id commits to the salt, and every signature signs it; on Solana the seller Memo instruction
(extra.memo) sits beside x402's receiver-authorizer binding memo; on Cloudflare there is no channel.
Interfaces
BatchEvmOpen
The buyer's inputs to the build of an x402 pairing on an eip155 chain: the document (required), the option chosen
from its accepts (accepted), the payer's address (from), and the current time in Unix seconds (now); the
authorization's deadline is now plus the option's maxTimeoutSeconds.
Extends
Properties
| Property | Type | Description | Inherited from |
|---|---|---|---|
accepted | PaymentRequirements | - | X402Choice.accepted |
authSalt | `0x${string}` | 32 bytes the caller draws at random: the deposit authorization's salt (ERC-3009) or the deposit permit's nonce (Permit2); under an option in the scheme's refund-authorizer mode, where H is that salt or nonce, the entropy the channel salt packs. | - |
deposit | bigint | - | - |
from | `0x${string}` | - | X402Choice.from |
now | number | - | X402Choice.now |
payerAuthorizer | `0x${string}` | - | - |
required | PaymentRequired | - | X402Choice.required |
BatchSvmOpen
Properties
| Property | Type |
|---|---|
accepted | PaymentRequirements |
computeUnitLimit? | number |
computeUnitPrice? | bigint |
deposit | bigint |
openSlot | bigint |
payer | string |
payerAuthorizer | string |
recentBlockhash | string |
required | PaymentRequired |
salt | bigint |
tokenProgram | string |
BatchUnsigned
Several signing requests, signed in order. complete takes one signature per request: 0x hex for eip712,
base58 for solana-message and ed25519-raw.
Properties
| Property | Type | Description |
|---|---|---|
authSalt? | `0x${string}` | On an EVM opening, the deposit authorization's salt: the ERC-3009 deposit's nonce is erc3009DepositNonce(channelId, authSalt) and the Permit2 deposit's nonce is authSalt as a uint256. It is the caller's authSalt, or H under an option in the refund-authorizer mode, so a client holds each nonce to it without repeating the mode test. No other build gives it. |
config? | ChannelConfig | On an EVM opening, the channel's configuration: batchChannelId(chainId, config) is the channelId the deposit authorization and the voucher sign, chainId their domain's. It names the receiver and the authorizers the signatures grant, so a client can show them and hold the channel id to them. No other build gives it. |
requests | readonly SigningRequest[] | - |
Methods
complete()
complete(
signatures):Refusal|BatchPaymentPayload
Parameters
| Parameter | Type |
|---|---|
signatures | readonly string[] |
Returns
BatchWithin
Properties
| Property | Type | Description |
|---|---|---|
accepted | PaymentRequirements | - |
channelConfig | Json | Exactly as sent at the opening. |
computeUnitLimit? | number | SVM refund's request_close: the Compute Budget values, 200 000 units and 1 microlamport when absent. |
computeUnitPrice? | bigint | - |
maxClaimableAmount | bigint | - |
recentBlockhash? | string | SVM refund: the blockhash of its request_close. Given, the refund carries that transaction, which x402 sends only on a retry after invalid_batch_settlement_svm_receiver_binding_unavailable. |
refund? | object | A refund. EVM: its amount, absent for a full refund. SVM: {}, a full refund carrying the voucher for maxClaimableAmount, the server's accepted cumulative amount, and, with recentBlockhash, a payer-signed request_close built here. |
refund.amount? | bigint | - |
required | PaymentRequired | - |
ChannelConfig
Properties
| Property | Type | Description |
|---|---|---|
payer | `0x${string}` | - |
payerAuthorizer | `0x${string}` | - |
receiver | `0x${string}` | - |
receiverAuthorizer | `0x${string}` | - |
salt | `0x${string}` | 0x and 64 hex digits. |
token | `0x${string}` | - |
withdrawDelay | number | - |
ChannelMembers
Properties
| Property | Type |
|---|---|
channel | object |
channel.boundWithin | Promise<Refusal | `0x${string}`> |
channel.kind | "open" | "close" | Refusal | "within" |
channel.ref | Promise<Refusal | { channel: string; network: string; }> |
channel.until | number | undefined |
Eip712Request
An EIP-712 request for the buyer's signer; numbers in message are decimal strings.
Properties
| Property | Type |
|---|---|
domain | object |
domain.chainId | number |
domain.name | string |
domain.verifyingContract | `0x${string}` |
domain.version? | string |
message | object |
primaryType | string |
types | object |
Type Aliases
SigningRequest
SigningRequest = {
kind:"eip712";typedData:Eip712Request|ReceiveTypedData|Permit2TypedData; } | {kind:"solana-message";message:Uint8Array<ArrayBuffer>; } | {kind:"ed25519-raw";message:Uint8Array<ArrayBuffer>;signer:string; }
A request to the buyer's signer.
Variables
BATCH_SETTLEMENT
constBATCH_SETTLEMENT:"0x4020074e9dF2ce1deE5A9C1b5c3f541D02a10003"
batchCloudflare
constbatchCloudflare:Readonly<{advertise:X402Advertise;bound: (presented) =>Promise<Refusal|`0x${string}`>;broadcaster: (presented) =>Promise<Refusal|Broadcaster>;build: (c,h) =>Promise<Refusal|CloudflarePaymentPayload>;claims:boolean;data:PairingData;id:"x402/batch-settlement/cloudflare";pattern:LcpPattern;read: (doc) =>Refusal|X402Read;tie: (accepts,request) => ["x402", {accepts: readonlyPaymentRequirements[];request:RequestCommitment|ToolCallCommitment; }];unplaced: (option) =>Refusal|PaymentRequirements; }>
x402/batch-settlement/cloudflare. The payee broadcasts (broadcaster answers "payee"): Cloudflare, for the
seller, verifies the agent's signed request and bills its registered identity off chain; no status reads it.
batchEvm
constbatchEvm:Readonly<{advertise: (doc,h,link,offer,agreementUrl?) =>Refusal|PaymentRequired;bound: (presented) =>Promise<Refusal|`0x${string}`>;broadcaster: (presented) =>Promise<Refusal|Broadcaster>;build: (c,h) =>Promise<Refusal|BatchUnsigned>;buildWithin: (w,h) =>Promise<Refusal|BatchUnsigned>;channel:Readonly<{boundWithin: (presented) =>Promise<Refusal|`0x${string}`>;kind: (p) =>"open"|"close"|Refusal|"within";ref: (p) =>Promise<Refusal| {channel:string;network:string; }>;until: (_p) =>number|undefined; }>;claims:boolean;data:PairingData;id:"x402/batch-settlement/eip155";pattern:LcpPattern;read: (doc) =>Refusal|X402Read;recover: (input,reader) =>Promise<Refusal|`0x${string}`>;reference: (presented,option) =>Promise<Refusal|BatchEvmRef>;status: (ref,reader,query) =>Promise<StatusAnswer<bigint,EvmMark>>;tie: (accepts,request) => ["x402", {accepts: readonlyPaymentRequirements[];request:RequestCommitment|ToolCallCommitment; }];unplaced: (option) =>Refusal|PaymentRequirements; }>
x402/batch-settlement/eip155. The payee broadcasts (broadcaster answers "payee" for each payment type
channel.kind takes): for every payment of the channel: the seller's facilitator executes the deposit's token
authorization, redeems vouchers when it claims, and executes a refund; status reads them, and channel.kind
classifies each payment. A payment of any other type gets x402/not-an-opening, as bound refuses it. bound reads
a deposit alone, so channel.kind reads the rest: a refund whose amount is not a positive decimal below 2^128 gets
x402/payload-malformed, as channel.kind refuses it.
batchSvm
constbatchSvm:Readonly<{advertise: (doc,h,link,offer,agreementUrl?) =>Refusal|PaymentRequired;bound: (presented) =>Promise<Refusal|`0x${string}`>;broadcaster: (presented) =>Promise<Refusal|Broadcaster>;build: (c,h) =>Promise<Refusal|BatchUnsigned>;buildWithin: (w,_h) =>Promise<Refusal|BatchUnsigned>;channel:Readonly<{boundWithin: (_p) =>Promise<Refusal|`0x${string}`>;kind: (p) =>"open"|"close"|Refusal|"within";ref: (p) =>Promise<Refusal| {channel:string;network:string; }>;until: (_p) =>number|undefined; }>;claims:boolean;data:PairingData;id:"x402/batch-settlement/solana";pattern:LcpPattern;read: (doc) =>Refusal|X402Read;recover: (input,reader) =>Promise<Refusal|`0x${string}`>;reference: (presented,option) =>Promise<Refusal|SvmRef>;status: (ref,reader,query) =>Promise<SvmStatus>;tie: (accepts,request) => ["x402", {accepts: readonlyPaymentRequirements[];request:RequestCommitment|ToolCallCommitment; }];unplaced: (option) =>Refusal|PaymentRequirements; }>
x402/batch-settlement/solana. The payee broadcasts (broadcaster answers "payee" for each payment type
channel.kind takes): for every payment of the channel: the seller's facilitator, the feePayer, co-signs and sends
the deposit and top-up transactions the payer signed, redeems vouchers when it settles, and sends the refund;
status reads them, and channel.kind classifies each payment. A payment of any other type gets
x402/not-an-opening, as bound refuses it.
CHANNEL_CONFIG_TYPEHASH
constCHANNEL_CONFIG_TYPEHASH:"0x1c9a06ceab9b0ebbd3301dc56c9111bb6d9af421356dc9ccb3b7084c755db308"
CHANNEL_CREATED_TOPIC
constCHANNEL_CREATED_TOPIC:"0x69d8248d5566bdb2ebc4d218970710d8378a2ff9b709a999e052b71970f808fa"
DEPOSITED_TOPIC
constDEPOSITED_TOPIC:"0x6c2a09353b5e75e70d0b9778b80a413809bb235d46c211811c474b3346791d89"
ERC3009_DEPOSIT_COLLECTOR
constERC3009_DEPOSIT_COLLECTOR:"0x4020806089470a89826cB9fB1f4059150b550004"
PERMIT2_DEPOSIT_COLLECTOR
constPERMIT2_DEPOSIT_COLLECTOR:"0x4020425FAf3B746C082C2f942b4E5159887B0005"
VOUCHER_TYPEHASH
constVOUCHER_TYPEHASH:"0x1e1bd6ff84c3e0d9029a292b212e039c0ca97ec497c55191a4a5874294609a69"
Functions
batchChannelCreated()
batchChannelCreated(
log,chainId):Refusal| {channelId:`0x${string}`;config:ChannelConfig; }
The config and id of a ChannelCreated(channelId, config) log, the id recomputed from the 7-word data.
Parameters
| Parameter | Type |
|---|---|
log | EvmLog |
chainId | number |
Returns
Refusal | { channelId: `0x${string}`; config: ChannelConfig; }
batchChannelId()
batchChannelId(
chainId,c):Refusal|`0x${string}`
The channel id: the EIP-712 digest of the configuration under the x402 Batch Settlement domain.
Parameters
| Parameter | Type |
|---|---|
chainId | number |
c | ChannelConfig |
Returns
Refusal | `0x${string}`
erc3009DepositNonce()
erc3009DepositNonce(
channelId,authSalt):Refusal|`0x${string}`
The EIP-3009 deposit's nonce: keccak256(abi.encode(bytes32 channelId, uint256 authSalt)). A channelId or
authSalt that is not a string of 0x and 64 hex digits is evm/field-malformed.
Parameters
| Parameter | Type |
|---|---|
channelId | `0x${string}` |
authSalt | `0x${string}` |
Returns
Refusal | `0x${string}`
References
BatchPaymentPayload
Re-exports BatchPaymentPayload
Broadcaster
Re-exports Broadcaster
CloudflarePaymentPayload
Re-exports CloudflarePaymentPayload
EvmMark
Re-exports EvmMark
EvmQuery
Re-exports EvmQuery
X402Advertise
Re-exports X402Advertise
X402Read
Re-exports X402Read
Last updated on
@integraledger/lcp/x402
x402 v2 documents, the request commitment, and the x402 pairings on eip155 chains: `exact` over EIP-3009, Permit2 and ERC-7710 (with its salt level), `upto` over Permit2, `auth-capture` over EIP-3009 and Permit2, and `exact` in Circle Gateway's batched domain.
@integraledger/lcp/x402-exact-solana
The `x402/exact/solana` pairing: the ATR hash placed as the option's `extra.memo` in LCP string form, written by the payer as the transaction's one Memo instruction, read back from the signed message, and read from the settlement.