@integraledger/profile-facilitator 0.5.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/CHANGELOG.md +449 -0
  2. package/README.md +551 -47
  3. package/dist/core.d.ts +1 -1
  4. package/dist/core.js +683 -66
  5. package/dist/http.d.ts +19 -4
  6. package/dist/http.js +16 -6
  7. package/dist/module.d.ts +108 -21
  8. package/dist/module.js +39 -0
  9. package/dist/modules/casper/index.js +14 -2
  10. package/dist/modules/erc7710/index.d.ts +8 -5
  11. package/dist/modules/erc7710/index.js +1110 -33
  12. package/dist/modules/evm/escrow.d.ts +125 -0
  13. package/dist/modules/evm/escrow.js +619 -0
  14. package/dist/modules/evm/forms.d.ts +37 -9
  15. package/dist/modules/evm/forms.js +165 -21
  16. package/dist/modules/evm/index.d.ts +41 -6
  17. package/dist/modules/evm/index.js +1127 -18
  18. package/dist/modules/evm/node.d.ts +16 -1
  19. package/dist/modules/evm/node.js +181 -26
  20. package/dist/modules/evm/nonce-proof.d.ts +186 -0
  21. package/dist/modules/evm/nonce-proof.js +779 -0
  22. package/dist/modules/solana/index.d.ts +3 -0
  23. package/dist/modules/solana/index.js +94 -7
  24. package/dist/modules/solana/reader.d.ts +2 -1
  25. package/dist/modules/solana/reader.js +42 -4
  26. package/dist/modules/solana/upto-claim.d.ts +58 -0
  27. package/dist/modules/solana/upto-claim.js +269 -0
  28. package/dist/modules/stellar/index.d.ts +5 -0
  29. package/dist/modules/stellar/index.js +17 -7
  30. package/dist/modules/stellar/node.d.ts +7 -1
  31. package/dist/modules/stellar/node.js +51 -7
  32. package/dist/modules/sui/index.js +63 -18
  33. package/dist/modules/sui/node.d.ts +13 -0
  34. package/dist/modules/sui/node.js +60 -0
  35. package/dist/modules/ton/index.js +5 -1
  36. package/dist/modules/xrpl/index.js +60 -11
  37. package/dist/modules/xrpl/node.d.ts +31 -2
  38. package/dist/modules/xrpl/node.js +88 -17
  39. package/dist/modules/xrpl/upto.js +105 -19
  40. package/dist/record.d.ts +52 -8
  41. package/dist/record.js +39 -5
  42. package/dist/wrapper.d.ts +3 -1
  43. package/dist/wrapper.js +4 -2
  44. package/package.json +3 -3
package/README.md CHANGED
@@ -31,7 +31,9 @@ settler adds three things:
31
31
  - **The record**: one row per payment in Postgres, keyed as its profile names the payment (the single-use value its
32
32
  signer signed, or its transaction id), so that one payment is submitted once and answered success once, across
33
33
  every process that shares the database.
34
- - **lcp's read of the chain**, which decides whether a payment the class did not answer success for is final.
34
+ - **lcp's read of the chain**, which decides whether a payment the class did not answer success for is final, and
35
+ makes final a payment an EVM class answered success for on one receipt at the head: the success is given at once,
36
+ and the row stays open, naming its transaction, until a read shows the payment on the finalized chain.
35
37
 
36
38
  ```mermaid
37
39
  sequenceDiagram
@@ -60,11 +62,11 @@ or legal logic beyond that.
60
62
  ## Install
61
63
 
62
64
  ```sh
63
- npm install @integraledger/profile-facilitator @integraledger/lcp@~0.6.3
65
+ npm install @integraledger/profile-facilitator @integraledger/lcp@~0.7.0
64
66
  ```
65
67
 
66
68
  It needs Node.js `>=24.22.1`, Postgres 11 or later ([The database](#the-database)), and, for each network it serves,
67
- the node its module reads. It is ESM only. `@integraledger/lcp` is its peer dependency, at `~0.6.3`: install it with
69
+ the node its module reads. It is ESM only. `@integraledger/lcp` is its peer dependency, at `~0.7.0`: install it with
68
70
  the settler ([Versions](#versions)). A module that holds a key takes it as the signer object of x402's class for that
69
71
  chain; make it with that chain's x402 package at 2.31.0, the release the settler's classes are pinned to
70
72
  (`@x402/evm`, `@x402/svm`, `@x402/avm`, and so on).
@@ -207,6 +209,13 @@ const signer = toFacilitatorEvmSigner(
207
209
  // Below settleWaitMs, so /settle answers settlement_pending instead of waiting up to x402's default 180 s.
208
210
  { confirmationTimeoutMs: 25_000 },
209
211
  );
212
+ // For auth-capture, the key also signs without sending, and sends what it signed, so that the settler names each
213
+ // escrow call before it is sent.
214
+ Object.assign(signer, {
215
+ signTransaction: async (r: { to: Hex; data: Hex; gas?: bigint; nonce?: number }) =>
216
+ client.signTransaction((await client.prepareTransactionRequest({ ...r })) as never),
217
+ sendRawTransaction: (r: { serializedTransaction: Hex }) => client.sendRawTransaction(r as never),
218
+ });
210
219
 
211
220
  const listen = process.env.LISTEN ?? "127.0.0.1:4021";
212
221
  const settler = await serveProfileFacilitator({
@@ -296,14 +305,14 @@ names, and the table gives the ones each module takes.
296
305
 
297
306
  | Member | Chain | Networks | Scheme: pairings (`confirmed`) | `extra.key` | `extra.acceptsZero` | Facilitator |
298
307
  |---|---|---|---|---|---|---|
299
- | `algorand` | Algorand | `algorand:<genesis hash prefix>` | `exact`: `x402/exact/algorand` (yes) | `fee-payer` | `x402/exact/algorand` | `@x402/avm`'s class; the settler's own path for a rekeyed payer signing with one key and a Falcon-key payer |
300
- | `aptos` | Aptos | `aptos:<chain id>` | `exact`: `x402/exact/aptos` (yes) | `fee-payer`, or `none` with `sponsor: false` | `[]` | `@x402/aptos`'s class |
308
+ | `algorand` | Algorand | `algorand:wGHE2Pwdvd7S12BL5FaOP20EGYesN73k` (mainnet), `algorand:SGO1GKSzyE7IEPItTxCByw9x8FmnrCDe` (testnet), the two `@x402/avm`'s class takes | `exact`: `x402/exact/algorand` (yes) | `fee-payer` | `x402/exact/algorand` | `@x402/avm`'s class; the settler's own path for a rekeyed payer signing with one key and a Falcon-key payer |
309
+ | `aptos` | Aptos | `aptos:1`, `aptos:2`, the two `@x402/aptos`'s class takes | `exact`: `x402/exact/aptos` (yes) | `fee-payer`, or `none` with `sponsor: false` | `[]` | `@x402/aptos`'s class |
301
310
  | `cardano` | Cardano | `cardano:mainnet`, `cardano:preprod`, `cardano:preview` | `exact`: `x402/exact/cardano` (yes), `x402/exact/cardano/lock` (yes) | `none` | `[]` | `@x402/cardano`'s class |
302
311
  | `casper` | Casper | `casper:casper-test` | `exact`: `x402/exact/casper` (no) | `relayer` | `[]` | `@x402/casper`'s class |
303
312
  | `concordium` | Concordium | `ccd:<genesis hash prefix>` | `exact`: `x402/exact/ccd` (no) | `fee-payer` | `x402/exact/ccd` | `@x402/concordium`'s class |
304
313
  | `evm` | EVM | `eip155:<chain id>` | `exact`: `x402/exact/eip155/eip3009` (yes), `x402/exact/eip155/permit2` (yes); `upto`: `x402/upto/eip155/permit2` (yes); `auth-capture`: `x402/auth-capture/eip155/eip3009` (yes), `x402/auth-capture/eip155/permit2` (yes); `batch-settlement`: `x402/batch-settlement/eip155` (yes) | `relayer` | `x402/exact/eip155/eip3009` on `exact`; `[]` on the others | `@x402/evm`'s classes |
305
314
  | `erc7710` | EVM | `eip155:<chain id>`, where `evm` registers `exact` | `exact` with `erc7710`: `x402/exact/eip155/erc7710` (yes), `x402/exact/eip155/erc7710-salt` (yes) | `relayer` | `[]` | the settler's own, behind the `evm` module's `exact` |
306
- | `hedera` | Hedera | `hedera:mainnet`, `hedera:testnet`, `hedera:previewnet`, `hedera:devnet` | `exact`: `x402/exact/hedera` (yes) | `fee-payer` | `[]` | `@x402/hedera`'s class |
315
+ | `hedera` | Hedera | `hedera:mainnet`, `hedera:testnet`, the two `@x402/hedera`'s class takes | `exact`: `x402/exact/hedera` (yes) | `fee-payer` | `[]` | `@x402/hedera`'s class |
307
316
  | `lnbtc` | Lightning | `lnbtc:000000000019d6689c085ae165831e93`, `lnbtc:000000000933ea01ad0ee984209779ba` | `exact`: `x402/exact/lnbtc/payment-hash` (yes) | `none` | `[]` | the settler's own |
308
317
  | `near` | NEAR | `near:mainnet`, `near:testnet` | `exact`: `x402/exact/near` (yes) | `relayer` | `[]` | `@x402/near`'s class |
309
318
  | `polkadot` | Polkadot Asset Hub | `polkadot:68d56f15f85d3136970ec16946040bc1`, `polkadot:67f9723393ef76214df0118c34bbbd3d` | `exact`: `x402/exact/polkadot/lcp-assets-remark` (yes) | `none` | `[]` | the settler's own |
@@ -370,28 +379,323 @@ Each member, one entry per network unless it says otherwise:
370
379
  `reader`, lcp's `CcdReader` over the seller's node. The record names each payment by the digest of what its sender
371
380
  signed, so a payment is never sent twice.
372
381
  - **`evm`**: `network`; `rpc`, the seller's JSON-RPC endpoint, which lcp's reads and the fee's read go through; `signer`,
373
- the seller's gas key (`FacilitatorEvmSigner`, made with `toFacilitatorEvmSigner` over the same node); `schemes`,
382
+ the seller's gas key (`FacilitatorEvmSigner`, made with `toFacilitatorEvmSigner` over the same node; for
383
+ `auth-capture` also `signTransaction` and `sendRawTransaction`, `EvmSender`, as the example composes them); `schemes`,
374
384
  optional, the schemes registered (`exact`, `upto`, `auth-capture`, `batch-settlement`; all four where absent);
375
385
  `eip6492AllowedFactories`, optional, the ERC-6492 factories `exact` and `batch-settlement` may call to deploy a payer's
376
386
  wallet (none where absent); `authCapture`, optional, `auth-capture`'s own configuration, passed to its class
377
387
  unchanged. Before the class is asked, `exact` refuses an option that pays several payees (a non-empty
378
388
  `extra.splits`) and Circle's batched option (`extra.name` `GatewayWalletBatched`, or an `extra.verifyingContract`
379
- other than the asset), which no published EVM class settles. At `/settle`, `upto` settles the amount its requirements
389
+ other than the asset), which no published EVM class settles. An EIP-3009 authorization that has already landed, by
390
+ whatever route, is answered at `/verify` as the class answers it where the record holds no row for it: within its
391
+ validity window, `invalid_exact_evm_nonce_already_used`. At `/settle`, `upto` settles the amount its requirements
380
392
  state, the charge: requirements that are the option the payment accepted in every member but an `amount` at or below
381
393
  the accepted one are held as that option, and the class checks the permit against the accepted maximum, as its own
382
- settle does; any other requirements are refused `invalid_payload`. `exact`'s `extra.acceptsZero` names
394
+ settle does; any other requirements are refused `invalid_payload`. Where another transaction
395
+ of the gas key took the nonce of a settle's transaction, viem's `waitForTransactionReceipt` answers that
396
+ transaction's receipt. A settle of `exact` (Permit2 or EIP-3009), `upto` or a `batch-settlement` claim takes it as
397
+ its own only where the node shows that transaction, by its hash, as the same call (the same contract and call data)
398
+ of the same account at the same nonce: the transaction sent, signed again at another fee, which executed this
399
+ payment, and which the answer names. Any other receipt executed nothing of this payment, and the settle is answered
400
+ `settlement_pending` naming its own transaction; so is a settle whose receipt names no transaction (x402's own
401
+ receipt type, a status and logs), unless the node shows the receipt of the transaction waited for. Where the gas key
402
+ gives `signTransaction` and `sendRawTransaction`, as the example composes them, each call of these classes is signed
403
+ before it is sent, so that its account, nonce and call are known whatever the node later shows of it; with a key that
404
+ does not, they are learnt from the node's answer by the transaction's hash, and of a transaction the node never showed
405
+ only the account and nonce are known, once viem answers the receipt of the transaction that took its nonce: any
406
+ transaction a finalized block shows there then lets it go. The transaction `exact` and `upto` keep as a pending settlement, and wait for again on a repeat
407
+ instead of sending, is let go only where one finalized block, read by its hash, shows a different transaction of the
408
+ gas key at its nonce that did not execute its call (another call, or the same call reverted), searched from the node's head as it was signed, so that a node that
409
+ keeps recent state only can show it; the repeat then checks the payment again and sends the same signed
410
+ authorization, which the token or Permit2 executes once. Where that block shows the same call there, executed, nothing is let
411
+ go, and lcp's read answers the payment. Where no finalized block shows it, a repeat waits for the transaction the
412
+ class keeps. The module's own node calls hold a settle at most two seconds before the class's wait for a receipt (the
413
+ proof, on a repeat of a pending settlement; one that takes longer goes on beside the wait, and the next repeat has
414
+ its answer) and at most two seconds after a wait that ended with a receipt that does not name the transaction waited
415
+ for; a wait that ends with the transaction's own receipt, or with none, is held by none. A `batch-settlement` deposit
416
+ whose transaction the node dropped while another transaction of the gas key took its nonce stays `settlement_pending`
417
+ on every repeat, and nothing is sent for it again: the settler gives a deposit's repeat back to no class. `exact`'s `extra.acceptsZero` names
383
418
  `x402/exact/eip155/eip3009` alone, and every other kind's is `[]`. On Base Sepolia, USDC's EIP-3009
384
419
  `transferWithAuthorization` of 0 succeeds, emitting `AuthorizationUsed` and a `Transfer` of 0 (`eth_simulateV1` at
385
420
  block 61198157); at block 61194449, x402's `exact` and `upto` Permit2 proxies revert `InvalidAmount` and the
386
421
  commerce-payments escrow's `authorize` reverts `ZeroAmount`; batch settlement's facilitator requires a deposit above
387
- 0.
422
+ 0. The later messages of the two multi-step schemes, which a resource server sends after the payment opened, go to
423
+ the class as x402's own code sends them: `auth-capture`'s `capture`, `void` and `refund` (x402's lifecycle manager,
424
+ and the hold's own payload the resource server stamps `capture` after its handler or `void` on cancel), and
425
+ `batch-settlement`'s `claim`, `settle` and `refund` (x402's channel manager, whose requirements are its own, at
426
+ amount `"0"`). The class checks each (the receiver authorizer's signature, or its own where `authCapture` delegates
427
+ that authorizer to it; the escrow's or the channel's state), and the escrow or the channel contract bounds what it
428
+ moves by what the opening funded. An escrow message is its own row, keyed by the message its receiver authorizer signs,
429
+ every member it signs and nothing else (the typed-data domain: its name and version, the chain id and the
430
+ `captureAuthorizer`; the payment's hash as the chain id, the escrow and the twelve members of `PaymentInfo` it
431
+ commits to; its type; for a capture its amount, fee receiver, fee and the escrow amounts it expects; for a refund its
432
+ amount, the deployment's refund collector and the amounts it expects), each number as `BigInt` reads it, as the
433
+ class and viem's encoder read it. The void of the payment's remainder a capture may carry is another message the
434
+ receiver authorizer signs, over the payment's hash alone, which the escrow's event of the capture does not show: a
435
+ capture with it and the same capture without it are one row and one body. That message is also
436
+ the row's body (`Instrumented.body`): one message, its numbers spelt in any way `BigInt` reads, or signed again by a
437
+ receiver authorizer whose signatures differ each time, is one row and one body, sent once, and another signature
438
+ over it goes to the class's check, which judges the signature; a message with any other signed member, its fee terms
439
+ among them, is another row. A channel's refund is keyed by the digest of its payload.
440
+ A channel's `refund` is admitted as a later message by its payload's type alone, whoever sends it, the buyer's own
441
+ refund request too (x402's client `refundChannel` sends it under the route's own option, and x402's resource server
442
+ has it verified before it adds the receiver authorizer's signatures and settles): lcp's option filter, lcp's channel
443
+ read and the zero-amount rule are not applied to it. The record (a repeat is answered from its row), what the kind
444
+ declares and the fee budget still hold it, and the class makes the payment's own checks, its `verify` at `/verify`
445
+ and its `settle` at `/settle`. The class settles a refund only with the receiver authorizer's signature, and the
446
+ settler holds no receiver authorizer key. Where `authCapture` delegates the receiver authorizer to the class
447
+ (`authorizerSigner`, `resolveCallerIdentity`), nothing the settler passes authenticates the caller: the context the
448
+ class gives `resolveCallerIdentity` holds the payment, its requirements and x402's facilitator context, in which the
449
+ settler registers no extension. A resolver that identifies the caller by an extension finds none, and the class
450
+ refuses each call it would sign (`invalid_auth_capture_evm_unauthenticated_authorizer_request`); one that derives an
451
+ identity from the payment or its requirements, which the caller writes, makes holding the settler's credential the
452
+ whole authority for a void or a refund the class signs as that authorizer.
453
+ A channel's `claim` and `settle` are not recorded: the manager sends the same settle in every round, and the
454
+ contract claims only above the channel's recorded total and settles only what is claimed and unpaid, to the
455
+ channel's receiver. At `/settle` of a `claim`, `settle` or `refund`, which the batch class's `verify` does not take
456
+ under the manager's requirements, the class's `settle` makes the check, simulating the call before it sends; at
457
+ `/verify` the class's `verify` answers them, as without the settler. An escrow refund for the default `delegated`
458
+ operator is funded by the operator's own address, the seller's gas key: the class refuses it unless `authCapture`
459
+ sets `refundFunding`. An escrow message is read from the escrow itself, by the hash its `getHash` gives the
460
+ message's `PaymentInfo`, since the escrow takes a second identical capture or refund while enough is capturable or
461
+ refundable (a second void reverts). The gas key signs each auth-capture call, the hold's among them, before it is sent
462
+ (`EvmSender`; the settler does not start where `auth-capture` is registered with a key without it): the signed bytes of a capture's, void's or refund's calls are kept in the settler's database until the class answers the message success or the read shows it final, and deleted then; and the transaction is named in the message's
463
+ row by one write that holds only while no later settle has taken the claim (each take of a claim gets the next
464
+ fencing number); where it does not hold, nothing is sent. A repeat's read and its `settlement_pending` answer start
465
+ from the transaction the row names once its sends and namings are done. A repeat reads the transaction the row names first (where
466
+ it replaced another at its nonce, whichever of them the node shows a receipt for):
467
+ reverted, the message is final, `invalid_transaction_state` naming it; executed with the escrow's event of the
468
+ message, settled; held by the node (shown by its hash with no block), `settlement_pending` naming it. One the node
469
+ shows in a block while it answers no receipt for it (a node that dropped old receipts) is not held. Where the node
470
+ shows it, or another signed for the message at its nonce, in a block, and one finalized block shows the gas key's
471
+ transaction at that nonce to be one of them, and the events of the block that holds it, read by that block's hash,
472
+ hold the escrow's event of the message by it, settled, naming it. Before that read, where the network's fee budget
473
+ is not spent, a repeat that passes the
474
+ class's checks (for the void of a capture's remainder, the class's check of that void) treats each transaction the row names, as the `erc7710` module treats a redemption: where the node
475
+ shows one of them by its hash unmined and underpriced, and shows none signed after it at their nonce, its fee cap
476
+ below the base fee of the node's latest block, or its tip (for one priced by `gasPrice` alone, that price less the
477
+ base fee) below the tip the node suggests (`eth_maxPriorityFeePerGas`) a whole settle wait after the last at that
478
+ nonce was signed, the repeat replaces it by the same call at the same nonce, the tip the larger of the tip it offers
479
+ (for one priced by `gasPrice` alone, that price) raised by an eighth and the node's suggestion, the fee cap the
480
+ larger of its own raised by an eighth and twice the base fee and the tip, naming the replacement in the row before
481
+ it is sent, and sending nothing where that naming fails. A replacement whose send fails and that the node does not
482
+ show by its hash is judged only once the node shows it: the row names again the one the node holds, which a later repeat replaces again (on the
483
+ tip alone, a whole settle wait after that replacement was signed). Where the node shows none of the transactions
484
+ signed at a nonce, its `pending` count shows no transaction of the key at that nonce (none held, none mined), and
485
+ the fee cap of the last one signed there is below the base fee of the node's latest block, so that the node would
486
+ refuse its same bytes for their price, the repeat signs the same call again at that nonce with a replacement's fees,
487
+ names it in the row, and sends it. No replacement is signed whose own bound (its gas limit times its fee cap) is
488
+ above the network's whole fee budget, where it has one: the transaction signed before stays the last at its nonce.
489
+ Repeats alone never raise the fees again. Either can land, and the nonce lets one. Nothing else is sent before the read. Then the `pending` transaction count of the gas key's addresses is read, then one block is fixed for the payment's
490
+ `paymentState` and the key's mined count. Where the amounts are still those the message expects (for a void, an
491
+ amount still capturable) and nothing of the key is unmined, a repeat of the identical message, the lifecycle
492
+ manager's own included, goes to the class again once its checks pass again. Before its call is sent, every
493
+ transaction signed for the message is judged. One the settler marked, when it signed it, as not yet named, and that
494
+ the row does not name, was never given to the node (another settle took the claim before its naming, or a stop came
495
+ between the two; the mark is deleted once the naming holds, before its only send that is not a repeat), so it can
496
+ never land and is passed over. One the node shows mined or holds stops the send (another call, a
497
+ capture's before the void that releases its remainder, does not). One the node does not show is no fact about the
498
+ chain: the block the node names `finalized` is read by its hash (EIP-1898) for the gas key's transaction count and
499
+ the escrow's `paymentState` there. Where the count has not passed its nonce, its same signed bytes are sent again,
500
+ and no other (nothing, where the node's `pending` count shows a transaction at that nonce). Where the count has
501
+ passed its nonce and the escrow's amounts there are still those the message expects, it can never execute: the
502
+ escrow's pair of amounts falls strictly with every call that executes, so a pair once left never returns, though the
503
+ escrow itself executes the same capture or refund call twice. Only where every other transaction signed for the
504
+ message is shown so is the call signed at a new nonce: a first send that never reached the node lands on the repeat once
505
+ another transaction of the key at its nonce is finalized. Where the amounts no longer stand, the escrow's events for the
506
+ payment after the block read just before the claim (asked for 2,000 blocks at a time) are replayed from the amounts at
507
+ that block, which are those at the fixed block with the events since undone: this message's event, settled; else the
508
+ event after which the message can never be taken as signed, `invalid_transaction_state` naming it. Where the amounts
509
+ at that block were already past the message, `invalid_transaction_state` naming nothing (`before-position`), once
510
+ that block is finalized. The escrow executes a call whatever amounts its message expects, so neither refusal is
511
+ given while a transaction the settler signed for the message's call may have executed it, or still may: each is
512
+ given only where one finalized block, read by its hash, shows of every such transaction that its nonce is not taken
513
+ there while the amounts there let no call of the message execute any more (nothing capturable for a void, less
514
+ capturable than a capture's amount, less capturable and refundable together than a refund's), or that its nonce is
515
+ taken and what took it is another transaction of the key, or one signed at that nonce that reverted. Where the
516
+ finalized chain shows one of them executed with the message's event, settled, naming it; otherwise
517
+ `settlement_pending` naming the row's transaction. A lookup that finds nothing decides neither. Where
518
+ no block was read before the claim, or the replay settles nothing, `settlement_pending` (`search-incomplete`), which
519
+ is not final. Each final answer is given at the `finalized` block, and one that rests on a transaction's receipt only where that
520
+ receipt's block, named by its hash, is shown on the finalized chain (an ancestor of the finalized block, from that
521
+ block's own hash: by EIP-2935's history contract, in at most 1,024 hops of 8,190 blocks, each read at the block the
522
+ last one showed, a proof's hops going on from the lowest block an earlier proof showed; then, below the lowest block it shows (where the node does not hold the state the next hop reads, or
523
+ the contract answers no hash, as for a block from before its activation), or on a node without it, by reading headers
524
+ by their parents' hashes, at most 1,024 per proof, each proof walking on from the lowest block an earlier one or the
525
+ contract showed, which the module's state keeps, one per 1,024 blocks of the chain; a block deeper than that becomes final over as many
526
+ repeats as the walk takes, and is `settlement_pending` until then; a kept block is used only where the node's own block at its number is that block: one the node does not hold is dropped, and where the node holds another block there, as after a network whose history was replaced, every kept block of the network is dropped; a proof that goes on from a kept block rests on the node's answer by number, so it assumes the node gives one view of the chain: an endpoint answering from backends on different chains can show a block of a replaced history as final); before it, `settlement_pending` naming the
527
+ transaction. So the first answer to a send the escrow reverted is `settlement_pending` naming it while its block is
528
+ above the finalized one, and `invalid_transaction_state` naming it once that block is finalized; only where the
529
+ block is already finalized when the send's answer is read is the first answer the class's own
530
+ (`invalid_auth_capture_evm_transaction_reverted`). The class's own store of a settlement it waited for in vain keeps
531
+ nothing here, in place of any `authCapture.pendingSettlementStore`, so a repeat is decided by the record and the
532
+ read. A capture that releases its remainder (a `voidAuthorizerSignature` that is not empty beside the capture's
533
+ signature, or, for a receiver authorizer the class signs for, `voidRemainder` true) is answered success only once
534
+ its void is mined, or the escrow reverted it, as the class sends that void once its capture settled: where the class
535
+ answers the capture a success and the node holds the void unmined, the answer is `settlement_pending` naming the
536
+ capture and the row stays open until the void is mined, so that a void the node drops is sent again on a repeat;
537
+ where the node does not show the void, it is judged as above at once (its same signed bytes sent again, or nothing),
538
+ and where that fails, or the node cannot say whether it holds it (nothing more is then sent), the answer is
539
+ `settlement_pending` naming the capture; where the class's capture fails
540
+ after a send the escrow took (its answer lost), the void is sent at once; where the capture is read landed and
541
+ finalized, the remainder still capturable at the finalized block, and nothing of the key unmined, a repeat sends only
542
+ the void, its check the class's check of that void, made only where a transaction the claim itself named holds the
543
+ capture's event, and answers success naming the capture. A success the module gives for such a capture carries the
544
+ capture's own amount, never the void's; one the core gives from its read of the chain (a repeat once a void held
545
+ unmined is mined) carries no amount, as for any payment it answers from the read. A void the escrow reverted is not sent again, and the
546
+ capture is answered as landed. The void a capture's claim carries is recorded before anything is sent for it, so
547
+ that while it is due, whichever body of the row is presented next (the same capture without it among them) sends it,
548
+ and the row is not final before it. A capture with the void presented after the same capture without it was answered
549
+ is answered from that row, and its void is not sent. A transaction the settler names for an escrow message and
550
+ sends is answered `settlement_pending` naming it, whatever failure the class answers, until the read shows the
551
+ message final.
552
+ Limits: a node that does not answer reads at a block named by its hash (EIP-1898) never lets a message be signed at
553
+ a new nonce, so a first send that never reached it stays `settlement_pending`; a message whose own transaction never
554
+ reached a node, and whose expected amounts another sender's call left while the escrow would still execute it, stays
555
+ `settlement_pending` until another transaction of the gas key at its nonce is finalized; a node that holds neither
556
+ the receipt of an old transaction nor the events and state of its block (a node that keeps recent history only)
557
+ leaves a message that landed by it `settlement_pending`; and where the block read just before the claim could not be
558
+ read, the node's head is read again before the message's first signing and kept in the module's state, nothing
559
+ being signed where it cannot be read. A channel refund (`batch-settlement`'s `refund`) is read by its
560
+ receipt: one the finalized chain shows mined and reverted (its receipt's block, by its hash, shown on the finalized
561
+ chain) is answered `settlement_pending` naming it while its block is above the
562
+ finalized one, and final once that block is finalized, `invalid_transaction_state` naming it, by every repeat. One
563
+ the finalized chain shows mined and executed, whose own receipt in that block holds the channel contract's
564
+ `Refunded` for the channel its `channelConfig` names, is answered the same way while its block is above the finalized
565
+ one, and once it is finalized is the success, naming it, the row final, so that a refund whose first answer was lost
566
+ is answered once it is shown; any other refund not answered a success stays `settlement_pending`. The refund is sent by x402's class, once, for its
567
+ row: a repeat of the same refund payload sends nothing, and x402's channel manager signing the refund of the same
568
+ channel again, with a receiver authorizer that signs deterministically, makes the same payload, so a refund the chain
569
+ reverted is never sent again by the settler, whether or not the reason it reverted has passed. A refund signed over
570
+ other members is another row, sent once the class's own simulation of it passes.
388
571
  - **`erc7710`**: `network`; `rpc`; `signer`, the seller's gas key, whose node must answer `eth_simulateV1`. The key
389
572
  sends from its first address, so that address is the delegate the leaf delegation must name (or the reference
390
573
  implementation's wildcard delegate), and the account the simulation runs from. It registers nothing of its own: on
391
574
  each of its networks it is offered to the `evm` module's `exact` registration, which hands it every payment whose
392
575
  option names `erc7710`. The settler does not start where the `evm` module does not register `exact` on such a
393
576
  network. It simulates the redemption the payment names, then calls `redeemDelegations` on the delegation manager the
394
- payload names, with one execution that transfers the option's amount to `payTo`.
577
+ payload names, with one execution that transfers the option's amount to `payTo`. The signer must also give
578
+ `signTransaction` (a transaction to `to` with `data`, signed and not sent, its nonce, gas and fees filled; with viem,
579
+ `signTransaction: async (r) => client.signTransaction(await client.prepareTransactionRequest(r))`) and
580
+ `sendRawTransaction` (viem's, `(r) => client.sendRawTransaction(r)`): the module signs the redemption first, keeps
581
+ the signed bytes in its state, and the record holds their hash before they are sent, since the level that signs no H
582
+ (`x402/exact/eip155/erc7710`) is found only by the transaction the record holds. A send that fails is read on by
583
+ that hash whatever the failure, a lost answer, a send that never reached the node or the node's JSON-RPC error alike,
584
+ since none shows that the node took nothing. A repeat that takes the claim sends the same bytes again where the
585
+ transaction count of the key that signed them, at the finalized block, has not passed their nonce, its pending count
586
+ is not above that nonce (the node holds no transaction of the key there), and no other sale's redemption under the same root delegator is in flight (the repeat then holds that mark, naming them),
587
+ so a send that never reached the node, or a stop before it, is made by the repeat; a nonce is taken once, so the
588
+ bytes land at most once. Where the node shows one of them by its hash unmined and underpriced, and shows none signed
589
+ after it at their nonce, its fee cap below the base fee of the node's latest block, or its tip (for one priced by
590
+ `gasPrice` alone, that price less the base fee) below the tip the node suggests (`eth_maxPriorityFeePerGas`) a whole
591
+ settle wait after the last at that nonce was signed, the repeat replaces it by the same call at the same nonce, the
592
+ tip the larger of the tip it offers (for one priced by `gasPrice` alone, that price) raised by an eighth and the
593
+ node's suggestion, the fee cap the larger of its own raised by an eighth and twice the base fee and the tip, naming
594
+ the replacement in the row before it is sent. A replacement whose send fails and that the node does not show by its
595
+ hash is judged only once the node shows it: the row names again the one the node holds, which a later repeat replaces again (on the
596
+ tip alone, a whole settle wait after that replacement was signed); where the node shows it later, the next repeat
597
+ of the sale names it in the row. A replacement the node refuses stays named, since it may have reached another node:
598
+ with a signer whose signatures differ each time (one that draws its own k), each refused repeat adds one name to the
599
+ row, for as long as the node refuses. Repeats alone never raise the fees again, only a base fee or a suggested tip that rises. The signer's
600
+ `signTransaction` must sign with the fee members the request names. Either can land, and the nonce lets one. The
601
+ same bytes are named in the row again before they are sent, and neither they nor a replacement is sent on a repeat
602
+ where the network's fee budget is spent ([the fee budget](#the-fee-budget)). A new
603
+ nonce is signed only where one finalized block shows that a different transaction took the nonce: the key's count,
604
+ read by the finalized block's hash (EIP-1898), has passed the nonce; the block in which it passed it, found by
605
+ halving the range from the block the node's head was when the redemption was signed, is read by its hash, the
606
+ count is above the nonce there and not at its parent, both read by hash; that block is an ancestor of the finalized
607
+ block, shown from the finalized block's hash through EIP-2935's history contract and, below the lowest block it
608
+ shows or on a node without it, by reading headers by their parents' hashes, at most 1,024 per proof, each proof
609
+ walking on from the lowest block an earlier one or the contract showed (a kept block used only where the node's
610
+ own block at its number is that block, as the `evm` module's passage states); and that block holds the key's transaction at the nonce,
611
+ whose hash is none of those signed at it. The row then stops naming the hash, nothing is sent on that
612
+ repeat, and the claim is answered `unexpected_settle_error`; the next repeat finds the row naming none and redeems
613
+ the sale by a new transaction. Where that block holds one of those signed at the nonce, it landed, and nothing is
614
+ sent again. The search for the block in which the count passed the nonce runs on the first repeat that finds the
615
+ count at the finalized block past it, and the module's state keeps what it found: the range it narrowed, and the
616
+ block itself once the counts by its hash show it, so that later repeats read no count there again and need only
617
+ the finalized block's state, headers and that block's transactions. A lookup by hash that finds nothing is no part
618
+ of the proof: where the node does not hold the finalized block, the block in which the count passed the nonce, or
619
+ the state the search reads, the ancestry is not yet shown, or a read fails, the row keeps naming the hash and
620
+ nothing is sent on that repeat. A block more than 1,024 blocks below the lowest block the history contract shows, or
621
+ below the finalized one on a node without it, is shown over as many repeats as the walk takes, once the block has
622
+ been found. The search reads the key's count at blocks from the one the node's head was when the redemption was
623
+ signed up to the finalized one, which a node that keeps the state of recent blocks only, as a pruning node does,
624
+ holds only for its last blocks. Where the node does not serve a count, the proof rests on what it does serve, never
625
+ on a lookup that found nothing: the search goes on above the blocks whose count it does not serve, and from the
626
+ node's latest block where it serves none at the finalized one, so that the block is found, and kept, while the node
627
+ holds its state, before it is final; a transaction signed at the nonce that the node shows mined names its block;
628
+ and the blocks above the one the node's head was at signing are read whole, at most 8 on a repeat and 256 in all,
629
+ for the key's transaction at the nonce. A block so found is read by its hash, holds the key's transaction at the
630
+ nonce, and is shown an ancestor of the finalized block as above, or through the history contract read at the node's
631
+ latest block, before anything rests on it; the counts by its hash and its parent's are read too and, where the node
632
+ serves them, never contradict it. Where none of these finds the block (no head was noted at signing, or the nonce
633
+ was taken more than 256 blocks above it, on a node that no longer holds that state), the redemption stays
634
+ `settlement_pending` and nothing more is sent for that sale, until a node that holds that state is the seller's
635
+ `rpc`; the proof's answer names the reads the node did not serve. The module's calls for these proofs are at most
636
+ four at once at an endpoint, and are spaced after it answers that it is asked too fast. On the
637
+ level that signs no H, a named redemption the node mined and reverted, its receipt's block, by
638
+ its hash, shown on the finalized chain below the finalized block's own hash, is final, `invalid_transaction_state` naming it: the module reads that receipt itself,
639
+ since lcp reads a reverted named transaction as pending (the profile, rule 8) and nothing else can show that sale
640
+ paid, and nothing named is sent again; above the finalized block it is `settlement_pending` naming it. On the salt
641
+ level such a redemption stays `settlement_pending` naming it, since lcp's search for H, never read whole, can still
642
+ meet another redemption carrying H. The seller can settle such a sale outside the settler by reading the chain for
643
+ a redemption that carries H, the reverted one the answer names or any other: the reference DelegationManager's
644
+ `RedeemedDelegation` logs with the payer as root delegator, a transaction that did not revert, whose delegation
645
+ carries H as its salt (the profile, rule 10). One transaction is one sale's payment, before its receipt and after
646
+ it: the module keeps, by the hash of each redemption it signs, the sale it was signed for, and where a signing gives
647
+ a sale the bytes of another sale's redemption (the level that signs no H gives two sales of one price the same call;
648
+ a signer answered by a node behind signs it at a nonce already taken, which is then the same transaction) nothing is
649
+ sent or named for that sale, and it is answered `unexpected_settle_error`; its repeat signs again, and is redeemed by
650
+ its own transaction once the signer is answered the key's next nonce. That record goes only once the key's
651
+ transaction count at the block the node names `finalized`, read by that block's hash, is above the redemption's
652
+ nonce; the module keeps that count as the key's floor, which never falls, and sends nothing signed below it. So the
653
+ records kept are one for each redemption signed at a nonce the finalized chain had not passed when the module last
654
+ sent a redemption, and one list of them for each key. Where several redemptions were signed at one nonce and the
655
+ node shows one of them mined, a repeat names that one in the row, so that the read is of the one that landed. A
656
+ redemption whose buyer never asks again does not hold back the other sales: where it never reached the node and the
657
+ next sale of the same price signs the same bytes, that sale's settle sends those bytes for the sale that owns them,
658
+ as that sale's own repeat would (their nonce still the key's next, the finalized chain not past it, the node holding
659
+ nothing there, under the mark, which passes to their sale), and is itself answered `unexpected_settle_error`, its
660
+ repeat redeemed by its own transaction; and where the node holds it unmined and underpriced, at the lowest unmined
661
+ nonce of the gas key or under the mark a later sale of the same root delegator waits on, that sale's settle or
662
+ repeat replaces it by the rule above, for the sale that owns it. Such a replacement is not in the other sale's row
663
+ when it is sent: it is kept, with the sale it is for, among those signed at its nonce, and that sale's next repeat
664
+ names it in its row before it judges any of them, and counts it against the fee budget then. Only a redemption the
665
+ key that signed it still signs for is replaced. One redemption
666
+ per sale: each sale through a delegation is its own row, keyed by the delegation and the H the payment echoes, and
667
+ the same sale presented again, in sequence or at once, is answered from its row. x402's ERC-7710 is one-time or
668
+ multi-use, its caveats the limit, so a second sale through a multi-use delegation is redeemed where its simulation
669
+ shows the transfer. On the level that signs no H the H is not signed, so whoever presents the payload chooses it:
670
+ what can be redeemed through one delegation, beyond what the delegator holds, is bounded by the caveats the
671
+ delegator signed, and by nothing else. One
672
+ redemption per root delegator (the payload's `delegator`, whose funds the transfer moves) is in flight at a time on
673
+ a network, whatever delegation it comes through: a second sale's settle waits, up to half the settle wait, until
674
+ the first's is mined or can never land, and only then simulates its own, so that two leaves under one root
675
+ delegation, or two delegations of one delegator, are simulated one after the other and a delegation with one use
676
+ left is sent once; where the wait ends first, nothing is sent and the answer is `unexpected_settle_error`. The
677
+ first's mark ends only on what the node shows, never on its age once it names a redemption: the redemption, or
678
+ another signed at its nonce (one it replaced, or its replacement), mined (a receipt, or the node's answer for its
679
+ hash naming a block), or, where the gas key signed it, the key's count at the node's latest block past that nonce;
680
+ one finalized block showing that it or another transaction took its nonce, or the signing key's count at the
681
+ finalized block, read by its hash, past its nonce; or, where the gas key signed it, the node's pending count showing
682
+ no transaction of the key at that nonce, which is still the key's next, and then the second sale's redemption is
683
+ signed at that same nonce, so that of the two one can land. Where the second sends nothing, the mark keeps naming
684
+ that nonce for the next sale, which is signed at it only where the node's pending count, read just before signing,
685
+ shows no transaction of the key held there, whichever scheme sent it. That mark ends once the nonce is taken: the
686
+ gas key's count at the node's latest block past it, or, for a key the settler no longer signs with, that key's count
687
+ at the finalized block past it; meanwhile a repeat of the sale whose redemption it names may still send, or replace,
688
+ those kept bytes at that nonce. So the module never signs at a nonce at which the node holds a transaction of the
689
+ gas key, other than its own replacement of the sale's own held redemption, and a pending count it could not read
690
+ signs nothing. A lookup by hash that finds nothing ends nothing: while the node's pending count shows a transaction
691
+ at that nonce, the second sale is sent nothing, however long the first waits unmined. A redemption signed by a key
692
+ the settler no longer signs with ends its mark only on a receipt, the node's answer naming its block, or a finalized
693
+ fact about that key's nonce. A mark whose settle named no redemption,
694
+ which therefore sent none, lapses after the settle wait; that settle then sends nothing, since it names its
695
+ redemption by swapping the mark it holds. A transaction is one
696
+ sale's: two sales of one price on the level that signs no H are one call, and signed at one nonce the same bytes,
697
+ so such a redemption is not sent for the second sale, answered `unexpected_settle_error`; its repeat, which is
698
+ submitted again since nothing of it was sent, redeems it by its own transaction once the key's nonce has moved on.
395
699
  - **`hedera`**: `network`; `signer`, the seller's fee-payer account and its key (`FacilitatorHederaSigner`): the class
396
700
  takes only a payment whose transaction id names an account it manages as `extra.feePayer`; `mirror`, the seller's
397
701
  Mirror Node REST base URL, which lcp's read and the fee count use; `archival`, optional, true where it holds every
@@ -425,7 +729,52 @@ Each member, one entry per network unless it says otherwise:
425
729
  database. `upto` is settled in the order x402's `upto` resource server sends it: `/verify` of the opening as the buyer
426
730
  sent it, then `/settle` of its deposit before the resource server's handler runs and of its claim after, each
427
731
  carrying the `type` (`deposit`, `claim`) that server adds. A claim needs the voucher of the option's
428
- `extra.receiverAuthorizer`, which the module does not sign: the resource server signs it with its own key.
732
+ `extra.receiverAuthorizer`, which the module does not sign: the resource server signs it with its own key. A claim
733
+ is read from its channel: it has landed where a finalized transaction on the channel succeeded with the
734
+ payment-channels program's `settle_and_seal` of it and, for a positive amount, the ed25519 check of the claim's own
735
+ voucher signature, and it has not landed while the channel account reads `Open`. A claim landed by another route, a
736
+ transaction the settler did not name, that carries the presented claim's voucher signature is read as the body
737
+ presented only for a row the settler gave to the class at a `confirmed` slot below the slot the transaction landed
738
+ in, which the module keeps when it first gives the row to the class, and of those, for the first row read against
739
+ the transaction: the voucher covers the channel, the amount and the expiry and no other member of the body. So the
740
+ identical claim, given to the class before it landed by another route, is answered success where it is the first
741
+ such row read against the transaction; any other body carrying the same voucher, and a body first given at a
742
+ `confirmed` slot at or past the one the transaction landed in, is answered `invalid_transaction_state`. A body given
743
+ after the transaction landed but while `node`'s `confirmed` slot was still below it counts as given before: how wide
744
+ that window is depends on how far `node` lags the cluster. A transaction the settler named is decided by the row
745
+ that named it. Each transaction the class sends for a claim is kept in the claim's row, with its blockhash in the
746
+ module's state, before it is sent; it is not sent where either cannot be kept or another settle has taken the claim.
747
+ A transaction sent for a claim can no longer land where the node shows it landed and failed at `finalized`, or where
748
+ the node holds no status for it and its blockhash has ended: `isBlockhashValid` answers `false` at `finalized` at a
749
+ `finalized` slot at least 150 past the context slot of the first answer of `true` at `confirmed`, the rule of lcp's
750
+ `x402-upto-solana` profile. The module asks `node` for that first `true` just before the send, and at each read
751
+ until one comes. A node answers `false` at `finalized` for a blockhash its `finalized` bank does not hold yet as
752
+ well (a signer that builds on a `confirmed` blockhash, or a `node` behind the signer's node), so until such a `true`
753
+ is seen, and until the bound is passed, the claim stays `settlement_pending` naming the transaction, and nothing is
754
+ sent again. x402's `upto` class (`@x402/svm` 2.31.0) keeps each channel's claim in a window of its own process for
755
+ 120 seconds from the settle that opened it, released only where that settle's simulation failed or it failed
756
+ outright: within the window, that process answers another settle of the channel `duplicate_settlement` and sends
757
+ nothing. So after a claim whose send never reached the node, the settler that sent it answers the repeats
758
+ `settlement_pending` naming that transaction until its blockhash has ended, then gives the claim to its class again,
759
+ which answers `duplicate_settlement`, sending nothing, until the window closes; another settler process on the same
760
+ database has a window of its own. A claim's voucher expires at the opening's time plus the route's
761
+ `maxTimeoutSeconds`, after which the class refuses it (`invalid_upto_svm_payload_expired`): where it expires inside
762
+ the window, that settler can no longer make the claim, and the channel stays open with nothing paid to the seller.
763
+ The settler enforces no floor on `maxTimeoutSeconds`. On a local validator (Agave 4.4.1), with one settler process
764
+ and a claim whose first send never reached the node, the claim was paid about 122 seconds after its first settle, at
765
+ blocks of about 125 ms and of about 420 ms alike, and the voucher counts from the opening: at blocks of about 420 ms,
766
+ a route of 150 seconds paid a claim made 16 seconds after the opening and did not pay one made 40 seconds after it,
767
+ and a route of 60 seconds was not paid. So, as guidance, give a Solana `upto` route at least about 125 seconds more
768
+ than the longest time from the opening to the claim: 150 seconds covers a claim made within about 25 seconds of the
769
+ opening, and the 300 that x402's resource server sets where the route names none (`@x402/core` 2.31.0,
770
+ `buildPaymentRequirements`) one made within about 175 seconds.
771
+ The read lists one page of the channel's signatures, the latest 1,000 at `finalized`: where more than 1,000
772
+ transactions name the channel's address after the claim's, which anyone can add, a landed claim reads not shown
773
+ (`search-incomplete`), and its repeats are never answered success. `batch-settlement`'s `claim`, `seal` and
774
+ `settle`, which x402's channel manager sends, go to the class's `settle`, which checks each before it sends anything
775
+ (the channel, its status, and the payer authorizer's voucher), each time they are sent: they are not recorded, and
776
+ the program moves nothing twice for them; the class's `verify`, which takes only what a buyer sends, answers them at
777
+ `/verify`.
429
778
  - **`starknet`**: an object `{ networks }`, one entry per network: `network`; `rpc`, a JSON-RPC node (specification 0.9
430
779
  or later) that serves `starknet_traceTransaction` and `starknet_simulateTransactions`; `executor`, an `address` and
431
780
  its `signer`, the account the payer's outside execution names as its caller, stated as `extra.feePayer`, which
@@ -441,14 +790,19 @@ Each member, one entry per network unless it says otherwise:
441
790
  - **`stellar`**: an object `{ networks }`: `network`; `rpc`, a Stellar RPC endpoint that holds the history the read
442
791
  searches; `source`, the seller's funded account as a signer (`address` and `signTransaction`, such as x402's
443
792
  `createEd25519Signer` of `@x402/stellar` or a SEP-43 wallet), the transaction's source, which pays its fee;
444
- `maxTransactionFeeStroops`, optional (default 50,000), and `inclusionFeeStroops`, optional (at least 100, default
445
- 100). It serves the agreement form, the option whose `extra.assetTransferMethod` is `lcp-precondition`: the module
793
+ `maxTransactionFeeStroops`, optional (default 50,000); `inclusionFeeStroops`, optional (at least 100, default
794
+ 100); and `eventsTimeoutMs`, optional, the most one `getEvents` call of the read may take (without it, each is bounded
795
+ by the read's deadline alone, since an RPC scans up to 10,000 ledgers per call). It serves the agreement form, the option whose `extra.assetTransferMethod` is `lcp-precondition`: the module
446
796
  builds the transaction around the buyer's operation and preconditions, unchanged, signs it as its source, and carries
447
797
  the buyer's payload signature with its own.
448
798
  - **`sui`**: an object `{ networks }`: `network` (`sui:mainnet`, `sui:testnet` or `sui:devnet`); `graphql`, the seller's
449
799
  GraphQL endpoint. It serves the path where the buyer pays gas and the gasless path (`extra.gasless`), and holds no
450
- key. A transaction the buyer already executed is judged at `/verify` by its effects, and not refused for having
451
- executed; its `/settle` answers a failure naming it. The kind's `extra.acceptsZero` names `x402/exact/sui`: a
800
+ key. A transaction already executed is refused at `/verify`, `invalid_transaction_state` (`sui/executed-by-payer`),
801
+ whoever presents it, since `isValid: true` tells the caller that a settle may follow; its `/settle` answers a failure
802
+ naming it. One not executed is refused `invalid_transaction`
803
+ (`sui/object-version-unavailable`) where the GraphQL endpoint shows an object it names at a version (its gas payment,
804
+ each owned or immutable input, each object it receives) at a later version, no longer live, or held under another
805
+ digest at that version: Sui's simulation answers success for it, and execution refuses it. The kind's `extra.acceptsZero` names `x402/exact/sui`: a
452
806
  transfer of 0 executes where the buyer pays gas (Sui testnet transaction
453
807
  `7EjfN1kqGng3phZjqgCzy8RRRXCP2Ybt7mikGgjBUwKA`, status `SUCCESS`, its only balance change the sender's gas), and at
454
808
  0 the signed transfer must name the option's payee. lcp's option filter refuses 0 on the gasless path.
@@ -460,11 +814,43 @@ Each member, one entry per network unless it says otherwise:
460
814
  pays every fee.
461
815
  - **`xrpl`**: `network`; `node`, the seller's rippled or Clio JSON-RPC endpoint, holding the ledgers from each payment's
462
816
  issue to the validated ledger; `waitMs`, optional, how long a settle waits for its transaction in a validated ledger
463
- (default 30 000); `maxFeeDrops`, optional, the most fee a payment may sign (the class's default, 10 000). Both paths
464
- refuse a payment that names a `Delegate` or carries `Memos`, as x402's scheme requires. For `upto`, the payer opens a
465
- payment channel to `payTo` and signs one claim off the ledger; at `/settle` the resource server adds
466
- `settlementTransaction`, a `PaymentChannelClaim` its `payTo` key signed for the actual charge with `tfClose`, which the
467
- module checks and submits unchanged; `/verify` refuses a payload that already carries one, as the scheme requires.
817
+ (default 30 000); `maxFeeDrops`, optional, the most fee a payment may sign (the class's default, 10 000). The node may
818
+ answer in API version 1's members or version 2's (`tx` answers `tx` and `meta`, or `tx_blob` and `meta_blob`). lcp's
819
+ read searches the payer's history to the validated ledger `server_info` names. A `tx` answer in no validated ledger
820
+ and with no metadata, as rippled answers for a submission it refused and keeps (`tefPAST_SEQ`, `tefMAX_LEDGER`) or for
821
+ one no closed ledger holds yet, reads as not found, never as a search read whole: lcp's read then decides by the
822
+ payer's account. Both paths refuse a payment that names a `Delegate` or carries `Memos`, as x402's scheme requires.
823
+ The multisigned path checks the `Payment`'s `Destination`, `DestinationTag` and `Amount` against the requirements, the
824
+ tag by the class's rule (where the requirements name one, a 32-bit unsigned integer the `Payment` carries; where they
825
+ name none, any); `SendMax` by the class's rule (none on XRP; on an issued currency, required, of the `Amount`'s
826
+ currency and issuer and no less than it); no `Paths`, no `DeliverMin` and no partial-payment flag; the fee against
827
+ `maxFeeDrops`; and `LastLedgerSequence` by the class's rule (`verifyLedgerExpiry`): above the validated ledger,
828
+ else `invalid_exact_xrpl_payload_expired`, and at most the class's `getMaxLastLedgerSequence`, the validated ledger
829
+ plus the requirements' `maxTimeoutSeconds` divided by 5 and rounded up, plus 2, else
830
+ `invalid_exact_xrpl_payload_lastledgersequence_too_large`. Each signer is held to rippled's rule for its key: its
831
+ regular key, or its master key where that is not disabled; a signer list's
832
+ entry need not be a funded account, and one that is not signs with the key its address derives from. For `upto`, the
833
+ payer opens a payment channel to `payTo` and signs one claim off the ledger; at `/settle` the resource server adds
834
+ `settlementTransaction`, a `PaymentChannelClaim` its `payTo` key signed for the actual charge with `tfClose`, which
835
+ the module checks and submits unchanged; `/verify` refuses a payload that already carries one, and `/settle` refuses
836
+ one that carries none with `invalid_upto_xrpl_missing_settlement_transaction` at any charge, as the scheme requires.
837
+ A settle-time `amount` that is not a string of canonical drops (zero, or a positive decimal with no sign, space or leading zero,
838
+ below 10^17) is refused `invalid_payment_requirements` (`x402/option-malformed`) before anything is submitted. A
839
+ claim in a validated ledger with `tesSUCCESS` is a success only where its metadata shows the channel's `Balance` at or
840
+ above the charge: a claim on a channel that expired by the ledger it lands in closes it delivering nothing and still
841
+ answers `tesSUCCESS`. Metadata that shows no node of the channel does not show what the claim did, and is unreadable,
842
+ never a failure: `/settle` answers `settlement_pending` naming the claim, and a repeat reads it again. Against such
843
+ metadata a bare close is judged by the presented `amount`; a repeat whose `amount` is not canonical drops is
844
+ unreadable as well, answered `settlement_pending` naming the claim, and the row stays open. Nothing bounds that
845
+ state: a validated transaction's metadata does not change, so on a node that leaves the channel's node out, every
846
+ repeat of a claim that carries a `Balance`, and every repeat of a bare close at a charge above zero or one that is
847
+ not canonical drops, is answered `settlement_pending`, until an answer that shows the node, from another server or a
848
+ corrected one; a bare close repeated at a charge of `"0"` asks nothing, and is answered by the read. `/settle`
849
+ answers a claim short of the charge `transaction_failed`; a repeat of the payment, after that answer or after a lost
850
+ one, is answered `invalid_transaction_state` naming the claim, and the row is final. A repeat after a lost answer is
851
+ judged by the charge of the claim the record holds, the `Balance` it carries, whoever presents the payment next; one
852
+ that presents another claim is answered `invalid_transaction_state` naming the record's, and the row is left as it
853
+ was.
468
854
 
469
855
  The `cardano`, `concordium` and `ton` modules take an lcp reader in `reader` rather than a node's URL, and lcp ships the
470
856
  interface but no implementation: `CardanoReader` of `@integraledger/lcp/cardano`, `CcdReader` of
@@ -495,6 +881,8 @@ message starts as shown:
495
881
  | Two fee budgets on one network | `<network> has two fee budgets` |
496
882
  | Postgres cannot be reached, or the tables cannot be created ([The database](#the-database)) | the driver's own error |
497
883
  | A module's member it refuses, the modules taken in the order of their names | `casper on <network>: not served` (`casper:casper`), `casper on <network>: the signer reads`, `casper on <network>: the signer's speculative execution goes to`, `casper on <network>: the signer names the chain`; `the Cardano reader serves`; `the Concordium signer and reader must serve`; `lnbtc: <network> is not an lnbtc network`; `not a Starknet network`, `the executor's address is not an account address`; `not a Stellar network`, `the source account's address is not an account strkey`, `the fee ceiling must be positive, and the inclusion fee at least 100 stroops`; `not a Sui network`; `the TON reader serves` |
884
+ | An `evm` network registering `auth-capture` whose signer does not give `signTransaction` and `sendRawTransaction` | `evm on <network>: auth-capture needs a signer` |
885
+ | An `erc7710` signer that does not give `signTransaction` and `sendRawTransaction` | `erc7710 on <network>: the signer must give` |
498
886
  | An `erc7710` network where the `evm` module does not register `exact` | `an own module is offered to exact on <network>, which no module registers` |
499
887
  | A module's class that states `pairings`, `key`, `acceptsZero` or `feeBudget` in its `extra` | `<network>: a module's facilitator states` |
500
888
  | Two registrations of one scheme on one network | `two registrations of <scheme> <network>` |
@@ -620,28 +1008,38 @@ await settler.close();
620
1008
  the `algorand`, `aptos`, `casper`, `hedera`, `solana`, `starknet` and `sui` modules, lcp's refusal code as
621
1009
  `invalidMessage` (on `starknet` and `sui`, the module's own code where its own check refused).
622
1010
  4. The record: a payment it holds, claimed or final, is refused `invalid_transaction_state`, since `isValid: true`
623
- tells the caller that a settle may follow.
1011
+ tells the caller that a settle may follow. A later message the record does not hold (a batch settlement's `claim`
1012
+ and `settle`, and `seal` on `solana`) is not looked up.
624
1013
  5. What the kind declares: an amount of zero whose pairing `extra.acceptsZero` does not name, and a form outside the
625
- pairings of the module the payment goes to, are refused `invalid_payment_requirements`.
1014
+ pairings of the module the payment goes to, are refused `invalid_payment_requirements`. A later message of a
1015
+ multi-step scheme (an escrow's capture, void or refund; a channel's claim, settle or refund) pays no option's
1016
+ amount, and the zero rule does not hold it.
626
1017
  6. The fee budget, where the module's key pays the fee: a spent budget is refused `fee_budget_spent`.
627
1018
  7. The class's verify, unchanged, with its own reasons.
628
1019
  8. lcp's read of the chain: a payment the chain shows final (landed, or consumed by another act) is refused
629
1020
  `invalid_transaction_state`. A read that fails goes to the operator log and leaves the class's answer.
630
1021
 
631
- On `sui`, whose `/verify` judges a transaction the buyer already executed by its effects, steps 4 and 8 are not made.
1022
+ Step 8 is not made for a later message the record does not hold, which the class's verify answers.
632
1023
  The answer is `{isValid: true, payer}` or `{isValid: false, invalidReason, invalidMessage?, payer?}`.
633
1024
 
634
1025
  ### `/settle`
635
1026
 
636
1027
  1. Steps 1 to 3 of `/verify`, with `errorMessage` for `invalidMessage`; `lnbtc` is served here.
637
1028
  2. The record: a final row is answered `invalid_transaction_state` naming the transaction it holds, never a second
638
- success.
1029
+ success. A batch settlement's `claim` and `settle` (and `seal` on `solana`), which carry no single-use value and
1030
+ which the channel contract or program makes inert on a repeat, are not recorded: what the kind declares, the fee
1031
+ budget, the class's check and its settle are made each time, and the answer is the class's; a refusal by its check
1032
+ is answered with its reason alone, with no `errorMessage`. Where the check leaves the request's wait no time, the
1033
+ settle is not made, and the answer is `unexpected_settle_error`.
639
1034
  3. What the kind declares, as `/verify` checks it.
640
1035
  4. A claim the record holds that is not final, which another settle holds or whose hold has ended: it is answered as
641
1036
  [the record](#the-record-and-what-a-repeat-answers) says, and no step below is made.
642
- 5. The class's verify. Where it refuses, lcp's read of the chain: a payment the chain shows landed, or whose value
643
- another act consumed, is stored final and answered `invalid_transaction_state` naming its transaction; otherwise the
644
- class's refusal is the answer, nothing is stored, and a repeat is checked again.
1037
+ 5. The class's verify. On `evm` and `solana`, batch settlement's `claim` and `settle` (`seal` too on `solana`, and
1038
+ `refund` on `evm`), which x402's channel manager sends and the class's verify does not take under the manager's
1039
+ requirements, are checked by the class's settle before it sends anything. Where it refuses, lcp's read of the chain:
1040
+ a payment the chain shows landed, or whose value another act consumed, is stored final and answered
1041
+ `invalid_transaction_state` naming its transaction; otherwise the class's refusal is the answer, its reason and,
1042
+ where it gave one, its message as `errorMessage`; nothing is stored, and a repeat is checked again.
645
1043
  6. Where the module's read searches from a position no x402 call carries (a ledger, a slot, a block), the chain's
646
1044
  position, read just before the claim, which the row keeps for every later read.
647
1045
  7. The claim: one conditional insert of the payment's row, held by this settle for `settleWaitMs`, so that of two
@@ -649,16 +1047,57 @@ The answer is `{isValid: true, payer}` or `{isValid: false, invalidReason, inval
649
1047
  8. The fee budget, where the module's key pays the fee: a spent budget answers `fee_budget_spent`, sends nothing, and
650
1048
  leaves the claim, not final.
651
1049
  9. The class's settle, which submits what the payer signed. A success that names a transaction is stored final, then
652
- answered `{success: true, transaction, network, payer}`. Anything else is classified by lcp's read: a payment the
1050
+ answered as the class gave it (on `evm` and `erc7710` it is stored open instead, as below), `{success: true, transaction, network, payer}` with any member the class adds (x402's
1051
+ Solana `upto` class adds `amount`). Anything else is classified by lcp's read: a payment the
653
1052
  chain shows final is stored final and answered (success only where the read shows a transaction this settler sent,
654
1053
  or the payment it presented, settled); one still live is answered `settlement_pending` naming the transaction sent,
655
- or the class's own failure where it named no transaction or its failure consumed nothing.
1054
+ or the class's own failure where it named no transaction or its failure consumed nothing. Where the module named a
1055
+ transaction before sending it (`beforeSend`: Solana's `upto` claim, an escrow's capture, void or refund) and the
1056
+ class's answer names none, the answer is `settlement_pending` naming that transaction, unless the read shows it
1057
+ unable to land. The read is given the
1058
+ transaction the settler sent; on `stellar` it is made by that transaction, so that a second payment of the buyer
1059
+ under one H which this settler sent answers success once it lands, where the first act under H would be another
1060
+ payment. The `stellar` module keeps the transaction's hash in the row before it sends it, so that a settler that
1061
+ stops before the send's answer leaves the row naming it, and takes it back out where the node refuses the send.
1062
+ On `ton` the read is made by the request the payment presents, which the payer's signature names by its body hash
1063
+ before anything is sent, so that a second payment of the buyer under one H, at its own sequence number, is
1064
+ answered by its own run, never by the first payment's.
1065
+ On `evm`'s `exact` EIP-3009 payment the read is made by the authorization the payment presents, its use on the
1066
+ asset, so that a second payment of the buyer under one H on another EIP-3009 token, whose nonce H is unused there,
1067
+ never answers the payment presented.
656
1068
 
657
1069
  A success is answered once, only by the settle whose write stored it: of two settles of one payment, only one answers
658
1070
  success, and the other answers `invalid_transaction_state` naming the transaction, or `settlement_pending` where its
659
1071
  wait ends first. A success that cannot be stored is answered `settlement_pending` naming its transaction, and a later
660
1072
  `/settle` reads the chain again.
661
1073
 
1074
+ On `evm` and `erc7710` the class's success rests on one receipt at the chain's head, whose block a node on another
1075
+ fork can show and the chain then drop. That success is still answered at once, but the row is stored open, naming the
1076
+ transaction and holding the success given, and is made final only once lcp's read shows the payment on the finalized
1077
+ chain (a read made at once, for at most a second, or a later `/settle`'s). What a repeat is answered:
1078
+
1079
+ - **Between the receipt and finality:** `settlement_pending` naming the same transaction. Nothing is sent again while
1080
+ the read shows that transaction in a block above the finalized one.
1081
+ - **Once the finalized chain holds it:** the row is final, and every repeat is answered `invalid_transaction_state`
1082
+ naming that transaction, as for any final row. No second success is given for it.
1083
+ - **Where the transaction left the chain** (its block was dropped, another transaction of the gas key took its nonce):
1084
+ repeats are answered `settlement_pending` while the existing rules decide, on facts read at a finalized block, and
1085
+ the same signed payment is sent again where they allow it (`erc7710`: the repeat that retires the redemption is
1086
+ answered `unexpected_settle_error` naming none, and the next redeems the sale by a transaction of its own). If it then lands, the repeat that finds it is answered
1087
+ `success` naming the new transaction, with `extra.supersedes` naming the transaction of the success given before,
1088
+ and the operator log has `success-superseded`. If the read instead shows the payment can never land (its value
1089
+ consumed by another act, its validity passed), the answer is that final read's: `invalid_transaction_state` naming
1090
+ what the read shows, and the operator log has `success-withdrawn`. A success naming another transaction than one
1091
+ given before is never answered without `extra.supersedes`.
1092
+ - A row left open, because no repeat came, is dropped by the sweep once past its keep, as a final row is.
1093
+
1094
+ This does not close a fork that outlasts the backend's own finality: an endpoint whose backends follow different
1095
+ chains past their `finalized` blocks can still show a dropped transaction as final. The settler's finality is its
1096
+ endpoint's: it holds final what the endpoint shows on the chain at or below the block it names `finalized`, and reads no
1097
+ second source. An operator puts behind one endpoint only backends that agree on every block at or below their
1098
+ `finalized` ones; and on a chain whose `finalized` block its consensus does not make irreversible, a reorganisation
1099
+ below that block can leave a dropped payment final in the record. That risk is the operator's.
1100
+
662
1101
  ## The record, and what a repeat answers
663
1102
 
664
1103
  The record is one row per payment, its **instrument**, within its network: the single-use value its signer signed (an
@@ -669,14 +1108,16 @@ that a copy signed again would change. An agreement and a payment of one payer u
669
1108
 
670
1109
  A row is **final** once its answer can never change: a success; a failed result that consumed the single-use value; a
671
1110
  value another act consumed; a validity that passed with the value unconsumed; or a payment that landed by another
672
- route. A refused submission, one that cannot have reached the node, and a failed result that consumed nothing leave the
673
- row a claim, which a repeat reads again. A claim is never removed.
1111
+ route. Another body under a claim never makes its row final where the read shows that body failed, nor where it
1112
+ shows it settled and a settle gave the claim's body to the class. A refused submission, one that cannot have reached
1113
+ the node, and a failed result that consumed nothing leave the row a claim, which a repeat reads again. A claim is never
1114
+ removed.
674
1115
 
675
1116
  | A repeated `/settle` finds | It answers |
676
1117
  |---|---|
677
1118
  | A final row | `invalid_transaction_state` naming the transaction the row holds. Never a second success, as x402's `exact` family requires: a consumed payment produces a settlement failure. |
678
- | A claim another settle holds | It reads the row every second and sends nothing, until that settle answers or its hold ends; then the row's answer, or lcp's read. It answers `settlement_pending` naming the transaction where one is known, and `unexpected_settle_error` where none is known when its wait ends. |
679
- | A claim whose hold has ended | It takes the claim and reads the chain. A payment the chain shows final is stored and answered. The identical signed payment is submitted again only where the pairing's `nonce` is `single-use` in lcp's registry, the row is not named by the digest of the signed payment, the read shows the value unconsumed and its validity open, the body is the one that claimed the row, and the class's verify passes again. Another body under the same instrument is answered `invalid_transaction_state`. Otherwise `settlement_pending` naming the transaction sent, or `unexpected_settle_error` where none is known. |
1119
+ | A claim another settle holds | It reads the row every second and sends nothing, until that settle answers or its hold ends; then the row's answer, or lcp's read, answered as for a claim whose hold has ended, except that it never takes the claim, sends nothing and ends no hold. It answers `settlement_pending` naming the transaction where one is known, and `unexpected_settle_error` where none is known when its wait ends. |
1120
+ | A claim whose hold has ended | It takes the claim, with the next fencing number, and reads the chain. A payment the chain shows final is stored and answered. It is a success where a settle holding the claim gave the body that claimed the row to the class's settle, this call presents that body, and the read shows it settled, whatever the class answered. A failure naming no transaction is the same answer whether or not the node took the send (its answer lost, a class that names nothing on any failure after its broadcast), and so is no answer (the settler stopped, or the class's settle outlasted the hold). So that body landing by another route after it was given to the class is answered success too. That success needs the read to show the presented body (`presented` `yes`) where it names none of the transactions the settler's submissions named: a read that answers `presented` `unshown`, as lcp's reads do where they cannot read every member of the landed act, never reaches it, and is answered `invalid_transaction_state` naming the transaction, the row made final. The identical signed payment is submitted again only where the body is the one that claimed the row, the class's verify passes again, and either the pairing's `nonce` is `single-use` in lcp's registry, the row is not named by the digest of the signed payment and the read shows the value unconsumed and its validity open (for the escrow's hold, also nothing of the gas key unmined: one that is may be the hold's own send); or the row is named by the digest of the signed payment, its module keeps each transaction in the row before sending it (Solana's `upto` claim), the read shows it not landed, and either no transaction was sent for it or the read shows the last one sent unable to land; or the module's read shows whether a message keyed by its digest landed (an escrow's capture, void or refund: the escrow's amounts still those it expects, and nothing of the gas key unmined); or its module names each transaction before sending it and keeps what it signed (`erc7710`), the row is named by the digest of the signed payment, and the row, as taken, names none. Before the read, unless the network's fee budget is spent, such a module sends again each transaction the row names where the chain could still take it, or replaces one the node holds unmined and underpriced at the same nonce, naming the replacement first, and takes out of the row one the chain shows can never land (a block read by its hash and shown an ancestor of the finalized block holds a different transaction at its nonce); that repeat sends nothing more, and the next finds the row naming none and submits it again. A lookup by hash that finds nothing takes nothing out of the row. A module that keeps each transaction in the row before sending it (these two, and `erc7710`) does so by one write that holds only while the row's fencing number is still the one its settle took the claim with; where it does not hold, nothing is sent, so a settle whose hold lapsed and was taken by another sends nothing after it. The settle's other writes to the claim hold on the same fencing number: it takes back a transaction it named and did not send, and ends its hold, only while the number is still its own, so it never removes the name another settle wrote for the same bytes or ends another settle's hold; a settle that watches a claim another holds ends no hold. A transaction sent for it that may still land is answered `settlement_pending` naming it, and nothing is sent again. Another body under the same instrument is answered `invalid_transaction_state`, naming the transaction the read found, and the row stays a claim: the settler never gave that body to the class, so it is not this settler's payment even where the read shows it settled, and a read that shows it failed (its own validity passed, or its value consumed) is of that body and never makes the row final. The body is the payload with its requirements, so the same payload under changed requirements is another body; where the payment's module states what makes two payments one body (`Instrumented.body`), that is the body, and another signature over it is given to the class, whose check judges the signature. Otherwise `settlement_pending` naming the transaction sent, or `unexpected_settle_error` where none is known. |
680
1121
  | No row, and the store cannot be read | `settlement_pending` where the payment's transaction id is known before it is sent, else `unexpected_settle_error`: the settler cannot know whether it was sent. |
681
1122
 
682
1123
  When the wait ends first, `/settle` answers `{success: false, errorReason: "settlement_pending", transaction}`; x402
@@ -695,6 +1136,13 @@ Where the count has reached the amount:
695
1136
 
696
1137
  - `/verify` and `/settle` refuse a payment whose fee the module's key would pay, `fee_budget_spent`, before anything is
697
1138
  sent. A payment whose payer pays the fee is never refused for it.
1139
+ - A repeat of a payment the record holds sends nothing before its read: no transaction its row names is sent again,
1140
+ and none is replaced at its nonce (`auth-capture`, `erc7710`). A repeat whose read shows the payment unsent (an
1141
+ `auth-capture` message whose amounts still stand, another form's unconsumed value, or a row that names none) is
1142
+ refused `fee_budget_spent`, naming nothing, as a first settle is, unless its row names a transaction an earlier
1143
+ settle gave to the class, which may still land: that repeat is `settlement_pending` naming it. Any other is answered
1144
+ from its read, which, as any repeat's, starts from the transaction the row names, `settlement_pending` while nothing
1145
+ final is shown.
698
1146
  - Each kind of the network states `extra.feeBudget: true`, so that a resource server learns that the settler may refuse
699
1147
  every payment on that network for a period.
700
1148
 
@@ -704,7 +1152,9 @@ data fee the network's GasPriceOracle (`getL1Fee`) gives. On Hedera it is the fe
704
1152
  to five seconds after the settle answers; where the mirror shows none by then, the `maxFee` the payer signed. The
705
1153
  `evm`, `solana`, `aptos` and `casper` modules count each transaction their key sends as it is sent, one their class
706
1154
  does not name in its answer included: a payer's ERC-6492 wallet deployment on EVM, or a Solana or Casper transaction
707
- whose send failed.
1155
+ whose send failed. A replacement at a nonce (`auth-capture`, `erc7710`) is counted as a transaction of its own, by its
1156
+ hash, at its whole bound and then at the fee it paid; the transaction it replaced keeps the count it had, its bound
1157
+ where the chain never shows it included. The same signed bytes sent again are the same transaction, counted once.
708
1158
 
709
1159
  At start the settler refuses a budget on a network no configured module serves, and one on a network where a module
710
1160
  whose key pays fees can neither show the fee of what it sent nor count it as it sends: the `ton` and `concordium`
@@ -713,7 +1163,8 @@ modules, whose classes and lcp's reads give no fee.
713
1163
  Its stated costs:
714
1164
 
715
1165
  - A transaction is counted once it is sent (`evm`, `solana`, `aptos`, `casper`) or once its settle answers (`algorand`,
716
- `erc7710`, `hedera`, `near`), so settles that run at once on a nearly spent budget can each pass the check before the
1166
+ `erc7710`, `hedera`, `near`), and one an `auth-capture` or `erc7710` repeat names before it sends it once that
1167
+ repeat's sends are done, so settles that run at once on a nearly spent budget can each pass the check before the
717
1168
  first is counted. The `starknet` and `stellar` modules count each send before it is made, one at a time per network.
718
1169
  The `evm` module's count at the send is what its node shows then: a transaction the node does not show yet (the
719
1170
  operator log's `fee-not-counted`, reason `not-shown`) is not counted until a later read shows it, when the class's
@@ -731,6 +1182,18 @@ Its stated costs:
731
1182
  executor, and x402's specification of the method admits none by default.
732
1183
  - **Solana's channel forms on mainnet.** `x402/upto/solana` and `x402/batch-settlement/solana` need the payment-channels
733
1184
  program, which is not deployed on Solana mainnet; there only `exact` is registered.
1185
+ - **Solana batch settlement with server-signed vouchers.** x402's Solana batch server signs each voucher itself
1186
+ (`extra.voucherSigner` `"server"`, naming its `operator`), and does so by default once an operator is configured.
1187
+ `x402/batch-settlement/solana` is client-signed: the payer signs each voucher. The settler refuses a server-signed
1188
+ option `invalid_payment_requirements` (`x402/option-not-this-pairing`) at `/verify` and `/settle` of a deposit that
1189
+ opens a channel, and sends nothing for it. lcp's checks read only that opening: under a server-signed option, a
1190
+ voucher, a deposit into a channel already open, and the claim, seal, settle and refund the resource server sends,
1191
+ reach x402's class, as every later message does: the class's settle checks a claim, seal or settle before it
1192
+ sends.
1193
+ `/supported` names no voucher mode, and `@x402/svm` 2.31.0's server reads none at start-up: it checks the
1194
+ facilitator's `feePayer` and `receiverAuthorizer` only, so a server with an operator starts against the settler and
1195
+ then refuses every buyer at the first deposit. A seller with an operator sets `extra.voucherSigner` `"client"` on the
1196
+ route, which the stock server keeps: its deposit then passes lcp's checks at the settler and reaches x402's class.
734
1197
  - **Casper mainnet.** x402's Casper scheme names `casper:casper`, but no token there has yet been shown to execute
735
1198
  `transfer_with_authorization`, so the `casper` module does not start on it; it serves `casper:casper-test`.
736
1199
  - **lcp's x402 pairings that another party settles.** `x402/exact/eip155/gateway-batched`, Circle's batched option,
@@ -743,7 +1206,7 @@ Its stated costs:
743
1206
  |---|---|
744
1207
  | `GET /supported` | `200` `{kinds, extensions, signers}`. |
745
1208
  | `POST /verify` | `200` `{isValid: true, payer}` or `{isValid: false, invalidReason, invalidMessage?, payer?}`; `400` `{isValid: false, invalidReason: "invalid_payload"}` when the body is not JSON. |
746
- | `POST /settle` | `200` `{success: true, transaction, network, payer}` or `{success: false, errorReason, errorMessage?, transaction, network}`; `400` with `errorReason` `invalid_payload` when the body is not JSON. |
1209
+ | `POST /settle` | `200` `{success: true, transaction, network, payer}` (with any member the class's success adds) or `{success: false, errorReason, errorMessage?, transaction, network}`; `400` with `errorReason` `invalid_payload` when the body is not JSON. |
747
1210
  | A call without the credential, where one is configured | `401` `{error: "unauthorized"}` with `WWW-Authenticate: Bearer`, before the body is read; the connection is closed. |
748
1211
  | A body over 132,096 bytes | `413`, and the connection is closed. |
749
1212
  | Another method on a served path | `405` `{error}`. |
@@ -764,11 +1227,11 @@ x402 codec reads, and 1,024 bytes for the envelope.
764
1227
  | `invalid_payload` | yes | yes | The payload does not match the profile or the requirements. |
765
1228
  | `unsupported_permission` | yes | yes | Tron: the owner's permission does not accept the transaction's signatures. |
766
1229
  | `invalid_transaction` | yes | yes | The node refuses the transaction in simulation or validation, in a module of the settler's own. |
767
- | `invalid_transaction_state` | yes | yes | `/verify`: the record or the chain already holds the payment. `/settle`: a repeat of a final row, or a payment the chain shows failed, consumed by another act, lapsed or landed by another route; each names the transaction where one is known. |
1230
+ | `invalid_transaction_state` | yes | yes | `/verify`: the record or the chain already holds the payment. `/settle`: a repeat of a final row, or a payment the chain shows failed, consumed by another act, lapsed or landed by another route; each names the transaction where one is known. The one exception: where a settle holding the claim gave the body that claimed the row to the class's settle and this call presents that body, a transaction the settler sent shown landed and not read as another body, or the presented body shown landed (`presented` `yes`), is a success, whatever route it landed by (see *A claim whose hold has ended*). |
768
1231
  | `fee_budget_spent` | yes | yes | The network's fee budget is spent, and the module's key would pay the fee. |
769
1232
  | `settlement_pending` | no | yes | Submitted, or possibly submitted, and not yet final or not yet stored when the wait ended; `transaction` names it. |
770
1233
  | `unexpected_verify_error` | yes | no | A node or the store could not be read. |
771
- | `unexpected_settle_error` | no | yes | A node or the store could not be read before submission, the settle's wait ended before it, or the submission failed with nothing sent. |
1234
+ | `unexpected_settle_error` | no | yes | A node or the store could not be read before submission, the settle's wait ended before it, or the submission failed with nothing sent. `erc7710`, with nothing sent: where its signer could not sign the redemption; where its own state could not be written before the send; where its send failed and the node then shows the bytes can never land; on the repeat that retires a named redemption as unable to land; where the wait for another sale's redemption in flight under the same root delegator ends; and for a sale whose redemption is the same bytes as another sale's, or was signed at a nonce the finalized chain has passed. A repeat settles it. |
772
1235
 
773
1236
  `unsupported_permission`, `invalid_transaction` and `fee_budget_spent` are the settler's own; the others are x402's. A
774
1237
  published class's own reasons, such as `invalid_exact_evm_payload_signature`, pass unchanged.
@@ -794,6 +1257,8 @@ CREATE TABLE IF NOT EXISTS instrument (
794
1257
  search jsonb,
795
1258
  since jsonb,
796
1259
  keep_until bigint,
1260
+ submitted boolean NOT NULL DEFAULT false,
1261
+ fence bigint NOT NULL DEFAULT 1,
797
1262
  PRIMARY KEY (network, key)
798
1263
  );
799
1264
  CREATE INDEX IF NOT EXISTS instrument_final_keep ON instrument (keep_until) WHERE final AND keep_until IS NOT NULL;
@@ -817,23 +1282,41 @@ CREATE TABLE IF NOT EXISTS module_state (
817
1282
  - `instrument` is the record: `key` is the instrument, its kind and parts as a JSON array. `held_until` is when the
818
1283
  settle holding the claim may no longer send (0 once it answered); `answer` is the answer as first given, once
819
1284
  `final`; `transaction` the transaction the row names; `sent` every transaction the settler's submissions for the
820
- claim named, any of which can be the one that lands; `body` the SHA-256 of the body that claimed the row, the only
821
- body sent again; `search` where the next read resumes; `since` the chain's position read just before the claim; times
822
- are Unix milliseconds.
1285
+ claim named, any of which can be the one that lands; `body` the SHA-256 of the body that claimed the row (what its
1286
+ module states makes two payments one body, else the payload with its requirements), the only body sent again and the
1287
+ only body a landed payment is this settler's for; `search` where the next read resumes;
1288
+ `since` the chain's position read just before the claim; `submitted` whether a settle holding the claim gave the
1289
+ claim's body to the class's settle, set before it sends; `fence` the claim's fencing number, 1 for the settle
1290
+ that claimed the row and one more each time a settle takes it again, the one number under which the holding settle
1291
+ names a transaction, takes one back or ends its hold; times are Unix milliseconds. A limit: the wait for the write
1292
+ that sets `submitted` ends at what is left before the call's deadline or at 5 seconds, counted from before the store
1293
+ hands the write a connection, while the statement's own bound starts once it is sent, so it can commit after the call
1294
+ answered
1295
+ `unexpected_settle_error` with nothing sent. The row is then marked though the class's settle was never
1296
+ called, and a later settle answers success where the claim's body is shown landed by another route.
823
1297
  - `fee` is the fee count: one row per transaction a keyed module submitted on a network with a budget.
824
1298
  - `module_state` is the modules' durable state, under each module's name: a class's pending settlements, Cardano's
825
- broadcast guard, Solana's channels.
1299
+ broadcast guard, Solana's channels, the `erc7710` module's signed redemptions (each removed once the finalized
1300
+ chain shows its receipt, by a later settle of the module that sends a redemption on that network, and kept
1301
+ otherwise, a settle that sends nothing included: one whose nonce another transaction took is kept after its
1302
+ retirement), the sale each was signed for (removed once the finalized chain has passed its nonce and shows what took
1303
+ it, or was read eight times without showing it), for each key on a network the list of those and the nonce below
1304
+ which it sends nothing, for each network the keys so listed (one the settler no longer signs with among them), and, for each root delegator on a network, the redemption in flight.
826
1305
  - A sweep every minute drops the final rows kept 24 hours past their keep, and the fees older than the longest budget
827
1306
  period. The pool holds at most 10 connections; acquiring one, each query and each statement are bounded by 5 seconds.
828
1307
 
829
1308
  ## Bounds and logs
830
1309
 
831
1310
  - Each node call the settler makes itself has a timeout of at most 5 seconds and an answer of at most 4 MiB, except
832
- Polkadot's block reads, bounded by the runtime's `System.BlockLength` (at most 4 of them at once in a process). A
1311
+ Polkadot's block reads, bounded by the runtime's `System.BlockLength` (at most 4 of them at once in a process), and
1312
+ Stellar's `getEvents`, bounded by the read's deadline (or `eventsTimeoutMs`). A
833
1313
  published class's calls are bounded by the class, and its settle takes no deadline: `settleWaitMs` bounds the
834
1314
  settler's own reads and store calls, and a class's settle runs on its own bounds. x402's EVM signer waits up to
835
1315
  180 s for a receipt unless `toFacilitatorEvmSigner`'s `confirmationTimeoutMs` is set: set it below `settleWaitMs`,
836
- as the service above does, or a `/settle` can outlast its wait.
1316
+ as the service above does, or a `/settle` can outlast its wait. Where it is not, a repeat made after the hold ends
1317
+ while the first settle still waits can submit the same signed `exact` payment again, at the key's next nonce:
1318
+ x402's class records a sent payment only once its wait ends. The second transaction reverts once the first lands, and
1319
+ its fee is spent.
837
1320
  - `/settle`'s reads and submission end a second before `settleWaitMs` (a quarter of a shorter wait), the time kept for
838
1321
  storing the answer. The server's request timeout is `settleWaitMs` plus 60 seconds.
839
1322
  - An error names a node by its origin alone, since a URL's path or query can hold an API key.
@@ -844,17 +1327,38 @@ CREATE TABLE IF NOT EXISTS module_state (
844
1327
  `operator-log-failed` entry. The core's entries are `verify-error`, `settle-error` and `request-error` (an error the
845
1328
  handling threw); `read-failed` and `position-unread` (lcp's read, or the position before a claim, could not be made);
846
1329
  `store-call-failed` (with the `call`), `store-connection-error` and `answer-not-stored`; `settle-deadline-passed`
847
- (with `before`, the step not started); `claim-unread` (a held claim whose read told nothing); `success-not-stored`;
1330
+ (with `before`, the step not started); `claim-unread` (a held claim whose read told nothing); `refusal-withheld`
1331
+ (with the `reason` a repeat was not answered, its row naming a transaction that may still land); `success-not-stored`;
848
1332
  and `fee-not-counted`. Each module adds its own, such as `node-call-failed` and `settlement-failed`. Every
849
1333
  `unexpected_verify_error` and `unexpected_settle_error` has an entry that names why, written when it is first given.
850
1334
 
851
1335
  ## Versions
852
1336
 
853
- 0.5.1 takes `@integraledger/lcp` `~0.6.3` as its peer dependency: install `@integraledger/lcp@~0.6.3` beside it. A
1337
+ 0.6.0 takes `@integraledger/lcp` `~0.7.0` as its peer dependency: install `@integraledger/lcp@~0.7.0` beside it. A
854
1338
  later lcp minor release needs a settler release that names it. While both packages are 0.x, a minor release may change
855
1339
  the configuration, the answers or the storage; [the CHANGELOG](./CHANGELOG.md) lists what each release changes. It
856
1340
  needs Node.js 24.22.1 or later.
857
1341
 
1342
+ ### Upgrading from 0.5.x
1343
+
1344
+ 0.6.0 needs `@integraledger/lcp` `~0.7.0` (0.5.1 took `~0.6.3`). Its configuration members are those of 0.5.1, with two
1345
+ signers that must give more:
1346
+
1347
+ - **`evm`, where a network registers `auth-capture`,** as the default scheme list does: the `signer` gives
1348
+ `signTransaction` and `sendRawTransaction` beside `FacilitatorEvmSigner`. The settler does not start without them. A
1349
+ network that names `schemes` without `auth-capture` needs neither.
1350
+ - **`erc7710`:** the `signer` gives `signTransaction` and `sendRawTransaction`. The settler does not start without them.
1351
+
1352
+ **The database.** 0.6.0 does not serve a database 0.5.x made: its `instrument` table has two columns more, `submitted`
1353
+ and `fence`, which it creates only with the table. Start it on a database or a schema of its own, or drop the three
1354
+ tables first; it then knows no payment 0.5.x answered, and a repeated `/settle` of one is judged afresh, by the
1355
+ module's checks and lcp's read of the chain.
1356
+
1357
+ **The answers.** On `evm` and `erc7710` a success is given on the first receipt, at the head, and its row is final
1358
+ only once the finalized chain holds the payment. Until then a repeat is answered `settlement_pending` naming the
1359
+ transaction, and a later success that names another transaction carries `extra.supersedes`
1360
+ ([The record, and what a repeat answers](#the-record-and-what-a-repeat-answers)). [The CHANGELOG](./CHANGELOG.md) lists every change.
1361
+
858
1362
  ### Upgrading from 0.4.0
859
1363
 
860
1364
  0.4.0 served the `tron` and `polkadot` modules alone. 0.5.0 takes `listen`, `store`, `settleWaitMs`, `operatorLog`,