@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/dist/http.d.ts CHANGED
@@ -27,7 +27,22 @@ export declare function site(url: string): string;
27
27
  export declare class NodeError extends Error {
28
28
  readonly code: "timeout" | "transport" | "http-status" | "too-large" | "malformed" | "spent";
29
29
  readonly sent: boolean;
30
- constructor(code: "timeout" | "transport" | "http-status" | "too-large" | "malformed" | "spent", sent: boolean, detail: string, options?: ErrorOptions);
30
+ /**
31
+ * For `http-status`, where the caller that threw it gives them: the status, the body the node answered with it, and
32
+ * its `Retry-After` header.
33
+ */
34
+ readonly answered?: {
35
+ readonly status: number;
36
+ readonly body: Uint8Array;
37
+ readonly retryAfter?: string;
38
+ };
39
+ constructor(code: "timeout" | "transport" | "http-status" | "too-large" | "malformed" | "spent", sent: boolean, detail: string, options?: ErrorOptions & {
40
+ answered?: {
41
+ readonly status: number;
42
+ readonly body: Uint8Array;
43
+ readonly retryAfter?: string;
44
+ };
45
+ });
31
46
  }
32
47
  /** A node call, by the name its caller gives it, that was not sent because its deadline left it no time. */
33
48
  export interface Spent {
@@ -36,10 +51,10 @@ export interface Spent {
36
51
  /** True for a node call that was not sent because its deadline left it no time. */
37
52
  export declare function isSpent(e: unknown): boolean;
38
53
  /**
39
- * POSTs a JSON body and reads a JSON answer within the timeout (at most 5 s) and `maxBytes` (4 MiB unless given). A
40
- * timeout that leaves no time sends nothing: the call fails as `spent`.
54
+ * POSTs a JSON body and reads a JSON answer within the timeout (at most `capMs`, 5 s unless given) and `maxBytes`
55
+ * (4 MiB unless given). A timeout that leaves no time sends nothing: the call fails as `spent`.
41
56
  */
42
- export declare function postJson(url: string, body: unknown, timeoutMs?: number, maxBytes?: number): Promise<unknown>;
57
+ export declare function postJson(url: string, body: unknown, timeoutMs?: number, maxBytes?: number, capMs?: number): Promise<unknown>;
43
58
  /**
44
59
  * Reads a request body of at most `maxBytes` as JSON: `tooLarge` when it is larger, `left` when the request ends before
45
60
  * its body does (the client left), and undefined when it is not JSON.
package/dist/http.js CHANGED
@@ -38,10 +38,17 @@ function isObject(v) {
38
38
  export class NodeError extends Error {
39
39
  code;
40
40
  sent;
41
+ /**
42
+ * For `http-status`, where the caller that threw it gives them: the status, the body the node answered with it, and
43
+ * its `Retry-After` header.
44
+ */
45
+ answered;
41
46
  constructor(code, sent, detail, options) {
42
47
  super(`${code}: ${detail}`, options);
43
48
  this.code = code;
44
49
  this.sent = sent;
50
+ if (options?.answered !== undefined)
51
+ this.answered = options.answered;
45
52
  }
46
53
  }
47
54
  /** True for a node call that was not sent because its deadline left it no time. */
@@ -49,13 +56,14 @@ export function isSpent(e) {
49
56
  return e instanceof NodeError && e.code === "spent";
50
57
  }
51
58
  /**
52
- * POSTs a JSON body and reads a JSON answer within the timeout (at most 5 s) and `maxBytes` (4 MiB unless given). A
53
- * timeout that leaves no time sends nothing: the call fails as `spent`.
59
+ * POSTs a JSON body and reads a JSON answer within the timeout (at most `capMs`, 5 s unless given) and `maxBytes`
60
+ * (4 MiB unless given). A timeout that leaves no time sends nothing: the call fails as `spent`.
54
61
  */
55
- export async function postJson(url, body, timeoutMs = NODE_TIMEOUT_MS, maxBytes = NODE_MAX_BYTES) {
62
+ export async function postJson(url, body, timeoutMs = NODE_TIMEOUT_MS, maxBytes = NODE_MAX_BYTES, capMs = NODE_TIMEOUT_MS) {
56
63
  if (timeoutMs <= 0)
57
64
  throw new NodeError("spent", false, site(url));
58
- const ms = Number.isFinite(timeoutMs) ? Math.ceil(Math.min(timeoutMs, NODE_TIMEOUT_MS)) : NODE_TIMEOUT_MS;
65
+ const cap = Number.isFinite(capMs) ? capMs : Number.isFinite(timeoutMs) ? timeoutMs : NODE_TIMEOUT_MS;
66
+ const ms = Number.isFinite(timeoutMs) ? Math.ceil(Math.min(timeoutMs, cap)) : Math.ceil(cap);
59
67
  const signal = AbortSignal.timeout(ms);
60
68
  let res;
61
69
  try {
@@ -74,8 +82,10 @@ export async function postJson(url, body, timeoutMs = NODE_TIMEOUT_MS, maxBytes
74
82
  throw new NodeError("transport", !unsent, e instanceof Error ? e.message : String(e), { cause: e });
75
83
  }
76
84
  const bytes = await readBounded(res, signal, maxBytes);
77
- if (res.status < 200 || res.status > 299)
78
- throw new NodeError("http-status", true, `status ${res.status}`);
85
+ if (res.status < 200 || res.status > 299) {
86
+ const retryAfter = res.headers.get("retry-after");
87
+ throw new NodeError("http-status", true, `status ${res.status}`, { answered: { status: res.status, body: bytes, ...(retryAfter === null ? {} : { retryAfter }) } });
88
+ }
79
89
  try {
80
90
  return JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes));
81
91
  }
package/dist/module.d.ts CHANGED
@@ -1,15 +1,3 @@
1
- /**
2
- * What a module gives the settler's core, for one scheme on one network. A module is an x402 facilitator for that
3
- * scheme and network (`SchemeNetworkFacilitator` of `@x402/core`), either a class x402 publishes or the settler's own,
4
- * with three things alongside it: a descriptor, which the kind's `extra` in `/supported` states; what the record needs to
5
- * key a payment, keep its row and tell a final answer from a live one; and what a fee budget needs to count the fees
6
- * the module's key pays.
7
- *
8
- * x402's facilitator class dispatches a payment to the first registration whose scheme matches and whose networks hold
9
- * the payment's network, and gives a registration of several networks of one namespace the pattern `<namespace>:*`, so
10
- * a registration names exactly one network, and an own module that settles a payer variant a published class refuses is
11
- * reached through that class's registration, by a claim, never by a second registration.
12
- */
13
1
  import type { PairingData, PairingId, StatusAnswer } from "@integraledger/lcp";
14
2
  import type { PendingSettlementStore } from "@x402/core/facilitator";
15
3
  import type { FacilitatorContext, Network, PaymentPayload, PaymentRequirements, SchemeNetworkFacilitator } from "@x402/core/types";
@@ -42,13 +30,6 @@ export interface Descriptor {
42
30
  * agreement needs to know; empty where none does.
43
31
  */
44
32
  readonly acceptsZero: readonly PairingId[];
45
- /**
46
- * Set where the module's `/verify` judges a payment that has already landed, by what the chain shows of it, and does
47
- * not refuse it for having landed: the core then asks neither its record nor the chain whether the instrument is
48
- * held before that `/verify`. Every other module's `/verify` refuses an instrument the record or the chain already
49
- * holds, since `isValid: true` tells the caller that a settle may follow.
50
- */
51
- readonly verifiesLanded?: true;
52
33
  /**
53
34
  * Set where the module's scheme forbids `/verify`, as x402's `exact` scheme on Lightning does: the core answers
54
35
  * `/verify` `unsupported_scheme` before anything else, and `/settle` still runs the module's own checks before it
@@ -130,12 +111,84 @@ export interface Instrumented {
130
111
  readonly pairing: PairingId;
131
112
  readonly instrument: Instrument;
132
113
  /**
133
- * The pairing's `nonce`, as lcp's registry states it: only under `single-use` may a held claim send the identical
134
- * signed payment again, and only where the read shows the value unconsumed and its validity open.
114
+ * The pairing's `nonce`, as lcp's registry states it: under `single-use` a held claim may send the identical signed
115
+ * payment again where the read shows the value unconsumed and its validity open; otherwise only as `landsOnce` says, or
116
+ * as `RecordNeeds.resend` lets.
135
117
  */
136
118
  readonly nonce: PairingData["nonce"];
137
119
  readonly keep: Keep;
120
+ /**
121
+ * Set where the payment is a later message of a multi-step scheme, on an instrument an earlier payment opened (an
122
+ * auth-capture escrow's capture, void or refund; a batch-settlement channel's claim, settle or refund): its
123
+ * requirements' amount is not an amount it pays, so the kind's zero-amount rule does not hold it. What it moves is
124
+ * bounded on chain by what the opening funded.
125
+ */
126
+ readonly later?: true;
127
+ /**
128
+ * Set where the payment is a later message that carries no single-use value and whose effect the class and the chain
129
+ * make inert on a repeat (a batch-settlement channel's claim, seal or settle: a claim moves only above the total the
130
+ * channel records, a settle only what is claimed and not yet paid out, to the channel's own receiver). It is not
131
+ * recorded: it goes to the class's check and settle each time it is sent, and the answer is the class's, since x402's
132
+ * channel manager sends the same settle message in every round. Its settle is made outside the core's submission,
133
+ * where `Core.naming` rejects, so a module whose settle names its transaction marks none of its messages unrecorded.
134
+ */
135
+ readonly unrecorded?: true;
136
+ /**
137
+ * For an instrument named by its digest: the module names, through `beforeSend`, every transaction the class sends
138
+ * for it before that transaction leaves the settler, and its read shows the instrument's own landed act (`settled`),
139
+ * another act that ended it (`failed`), or the instrument still open (`instrument-live`), naming the last transaction
140
+ * sent where the chain shows that it can no longer land. A held claim is then given to the class again only where no
141
+ * transaction was sent for it (never given to the class, or the class refused or stopped before sending), or where
142
+ * the read shows the instrument open and the last transaction sent for it unable to land; otherwise the read's answer
143
+ * stands, and a transaction that may still land is answered pending. Solana's `upto` claim is one.
144
+ */
145
+ readonly landsOnce?: true;
146
+ /**
147
+ * Set where the instrument is keyed by a digest, the module names, through `beforeSend`, every transaction the class
148
+ * sends for it before that transaction leaves the settler, and its `read` still shows whether the message landed: it
149
+ * answers `instrument-live` only where the chain would take the identical message as signed and nothing the module's
150
+ * key sent for it is unmined. A claim the record holds is then sent again on that answer, as a single-use value is
151
+ * (an auth-capture escrow's capture, void or refund, whose expected amounts the escrow's state shows standing).
152
+ */
153
+ readonly resendable?: true;
154
+ /**
155
+ * What the module states makes two payments under the instrument one body: a JSON value (a `bigint` within it kept as
156
+ * one), equal for two payments only where they are one body. The core keeps its digest in the claim's row and
157
+ * compares a payment presented under a held claim with it: only that body is given to the class's settle again, and
158
+ * only it is answered a success by what the chain shows of the claim. Where it is left out, the body is the payload
159
+ * with its requirements as presented, every member of both, the signature among them.
160
+ */
161
+ readonly body?: unknown;
162
+ }
163
+ /**
164
+ * What the core gives a class's settle for a claim it holds, where the claim's module names its transactions through
165
+ * `beforeSend` (`Instrumented.landsOnce`, `Instrumented.resendable`): the step before each send, and what was named
166
+ * before.
167
+ */
168
+ interface ClaimSends {
169
+ /**
170
+ * Keeps `transaction` in the claim's row, in the one write that holds only while the row's fencing number is still the
171
+ * one this settle took it with (`InstrumentRecord.naming`); throws, so that nothing is sent, otherwise.
172
+ */
173
+ readonly name: (transaction: string) => Promise<void>;
174
+ /** Every transaction earlier settles named for the claim, first to last. */
175
+ readonly named: readonly string[];
138
176
  }
177
+ /**
178
+ * Runs `settle`, a class's settle for a claim this settle holds under its fencing number, with `s` as what every
179
+ * transaction a module names through `beforeSend` passes before it is sent.
180
+ */
181
+ export declare function namingSends<T>(s: ClaimSends, settle: () => Promise<T>): Promise<T>;
182
+ /**
183
+ * Called by a module with the id of a transaction its class is about to send, before it is sent: the core keeps it in
184
+ * the claim's row in one write that holds only while no other settle has taken the claim since, and throws, so that
185
+ * nothing is sent, where the write does not hold or fails. Outside a settle that holds a claim it does nothing.
186
+ */
187
+ export declare function beforeSend(transaction: string): Promise<void>;
188
+ /** Whether the class's settle now running holds a claim whose transactions are named before they are sent. */
189
+ export declare function sendsNamed(): boolean;
190
+ /** The transactions earlier settles of the claim the running settle holds named, first to last; none outside one. */
191
+ export declare function namedBefore(): readonly string[];
139
192
  /**
140
193
  * A payment the form's pure checks refuse, with x402's reason; nothing is read and nothing is recorded. `message` is
141
194
  * lcp's refusal code where lcp gave one, which the answer carries as x402's `invalidMessage` or `errorMessage`.
@@ -206,6 +259,23 @@ export interface RecordNeeds<P = X402Payment> {
206
259
  position?(payment: P, at: {
207
260
  readonly deadline: number;
208
261
  }): Promise<unknown>;
262
+ /**
263
+ * For a module that names its transaction before it sends it (`Core.naming`) and keeps what it signed: called for each
264
+ * transaction the row holds, before a repeat that holds the claim reads the chain. It sends the signed bytes again
265
+ * where the chain could still take them, and answers `gone` where the chain shows they can never land (the core then
266
+ * takes the transaction out of the row), else `kept`, as for a transaction it keeps nothing of. Its node calls end by
267
+ * `deadline`, a `performance.now()` time; a failure rejects, and the row is left as it is.
268
+ */
269
+ resend?(payment: P, transaction: string, at: {
270
+ readonly deadline: number;
271
+ }): Promise<"gone" | "kept">;
272
+ /**
273
+ * Set where the facilitator answers a success on one receipt at the chain's head, whose block a node on another fork
274
+ * can show and the chain then drop (an EVM class's wait for its receipt): the core gives that success at once, keeps
275
+ * the row live naming its transaction, and makes it final only once `read` shows the instrument final. Until then a
276
+ * repeat reads the chain and answers what it shows.
277
+ */
278
+ readonly successAtHead?: true;
209
279
  }
210
280
  /** What a fee budget needs of a module, for every payment it claims. */
211
281
  export interface FeeNeeds<P = X402Payment> {
@@ -263,6 +333,8 @@ export interface Included {
263
333
  * the transaction included. Until then the count holds the transaction's bound.
264
334
  */
265
335
  export interface FeeMeter {
336
+ /** The network's fee budget over one period, in the smallest unit of its fee asset; undefined where it has none. */
337
+ readonly budget?: bigint;
266
338
  sending(sending: Sending): Promise<boolean>;
267
339
  included(included: Included): void;
268
340
  /**
@@ -344,6 +416,20 @@ export interface Core {
344
416
  * refuses a fee budget on a network where a module with a key neither took it nor gives `FeeNeeds.charged`.
345
417
  */
346
418
  meter(network: Network): FeeMeter;
419
+ /**
420
+ * Keeps `transaction` in the record of the claim whose submission is calling, as a transaction this settler sent, for
421
+ * an own module that knows its transaction's id before it sends it: called after it is signed and before it is sent,
422
+ * so that a send whose answer is lost, or a stop before the answer, still leaves the record holding it, and lcp's read
423
+ * and a repeat find it. The store takes it in the one write that holds only while the claim's fencing number is still
424
+ * the one this settle took it with, as for `beforeSend`, so that a settle whose hold another settle took names and
425
+ * sends nothing. It resolves once the store has taken it, to `withdraw`, which the module calls where it knows the
426
+ * transaction can never land, so that nothing names it; where it rejects, the module sends nothing. A module that
427
+ * names its transactions keeps what it signed and gives `RecordNeeds.resend`, so that a named transaction the node
428
+ * never took is sent again or retired, never named for good; or its instrument is a single-use value, which a repeat
429
+ * submits again where the read shows it unconsumed and open, naming the new transaction after it (`stellar`).
430
+ * Called outside a facilitator's `settle` that the core's submission made, it rejects.
431
+ */
432
+ naming(transaction: string): Promise<() => Promise<void>>;
347
433
  }
348
434
  /** An own module offered to the registration another module makes of a scheme on a network. */
349
435
  export interface OfferedHandoff {
@@ -370,3 +456,4 @@ export interface ModuleStarter<C> {
370
456
  readonly name: ModuleName;
371
457
  start(config: C, core: Core): Promise<Started>;
372
458
  }
459
+ export {};
package/dist/module.js CHANGED
@@ -1,3 +1,16 @@
1
+ /**
2
+ * What a module gives the settler's core, for one scheme on one network. A module is an x402 facilitator for that
3
+ * scheme and network (`SchemeNetworkFacilitator` of `@x402/core`), either a class x402 publishes or the settler's own,
4
+ * with three things alongside it: a descriptor, which the kind's `extra` in `/supported` states; what the record needs to
5
+ * key a payment, keep its row and tell a final answer from a live one; and what a fee budget needs to count the fees
6
+ * the module's key pays.
7
+ *
8
+ * x402's facilitator class dispatches a payment to the first registration whose scheme matches and whose networks hold
9
+ * the payment's network, and gives a registration of several networks of one namespace the pattern `<namespace>:*`, so
10
+ * a registration names exactly one network, and an own module that settles a payer variant a published class refuses is
11
+ * reached through that class's registration, by a claim, never by a second registration.
12
+ */
13
+ import { AsyncLocalStorage } from "node:async_hooks";
1
14
  /** The key of the extension of x402's `FacilitatorContext` by which the core names the phase of a `verify`. */
2
15
  export const PHASE = "settler-phase";
3
16
  /** The phase a facilitator's `verify` is called in, from the context the core gives it: `verify` where it names none. */
@@ -5,6 +18,32 @@ export function phaseOf(context) {
5
18
  const named = context?.getExtension(PHASE);
6
19
  return named?.phase === "settle" ? "settle" : "verify";
7
20
  }
21
+ const sending = new AsyncLocalStorage();
22
+ /**
23
+ * Runs `settle`, a class's settle for a claim this settle holds under its fencing number, with `s` as what every
24
+ * transaction a module names through `beforeSend` passes before it is sent.
25
+ */
26
+ export function namingSends(s, settle) {
27
+ return sending.run(s, settle);
28
+ }
29
+ /**
30
+ * Called by a module with the id of a transaction its class is about to send, before it is sent: the core keeps it in
31
+ * the claim's row in one write that holds only while no other settle has taken the claim since, and throws, so that
32
+ * nothing is sent, where the write does not hold or fails. Outside a settle that holds a claim it does nothing.
33
+ */
34
+ export async function beforeSend(transaction) {
35
+ const s = sending.getStore();
36
+ if (s !== undefined)
37
+ await s.name(transaction);
38
+ }
39
+ /** Whether the class's settle now running holds a claim whose transactions are named before they are sent. */
40
+ export function sendsNamed() {
41
+ return sending.getStore() !== undefined;
42
+ }
43
+ /** The transactions earlier settles of the claim the running settle holds named, first to last; none outside one. */
44
+ export function namedBefore() {
45
+ return sending.getStore()?.named ?? [];
46
+ }
8
47
  /** Whether lcp's answer is final for the instrument or leaves it live. */
9
48
  export function outcomeOf(answer) {
10
49
  return answer.state === "settled" || answer.state === "failed"
@@ -13,6 +13,7 @@
13
13
  * The module serves `casper:casper-test` and does not start on `casper:casper`, where no token has yet been shown to
14
14
  * execute `transfer_with_authorization`.
15
15
  */
16
+ import { blake2b } from "@noble/hashes/blake2.js";
16
17
  import { fromLegalContext, isRefusal } from "@integraledger/lcp";
17
18
  import { exactCasper, } from "@integraledger/lcp/casper";
18
19
  import { isObject } from "../../answers.js";
@@ -33,6 +34,18 @@ async function published() {
33
34
  const CASPER_MAINNET = "casper:casper";
34
35
  /** The dictionary in which the token package keeps a used nonce, by the profile `x402/exact/casper`, rule 10. */
35
36
  const USED_NONCES = "used_nonces";
37
+ /**
38
+ * The item key under which a CEP-3009 token holds a used `(from, nonce)` in `used_nonces`: the lowercase hex of
39
+ * blake2b-256 over the pair as the token serializes it, `from` as its tagged key (the tag byte and 32 bytes) and the
40
+ * nonce as `Bytes` (a u32 little-endian length, then the bytes). The Odra reference token keys a `Mapping` this way,
41
+ * and Casper testnet's csprUSD, x402's default token, holds its used nonces there; the base64 of the raw pair it does
42
+ * not hold.
43
+ */
44
+ function usedNonceItem(from, nonce) {
45
+ const length = Buffer.alloc(4);
46
+ length.writeUInt32LE(nonce.length);
47
+ return Buffer.from(blake2b(Buffer.concat([Buffer.from(from, "hex"), length, Buffer.from(nonce)]), { dkLen: 32 })).toString("hex");
48
+ }
36
49
  /** The transactions of a block one page of `blockCalls` reads. */
37
50
  const PAGE = 64;
38
51
  /** The node's error codes the reader tells apart (casper-node's JSON-RPC codes, as casper-js-sdk names them). */
@@ -257,8 +270,7 @@ export function casperReader(network, url, deadline, parse) {
257
270
  if (block === null)
258
271
  return null;
259
272
  const contract = await activeContract(asset, block.stateRoot);
260
- // The item's key: the payer's key as the token serializes it, its tag and 32 bytes, then the nonce's 32 bytes.
261
- const item = Buffer.concat([Buffer.from(from, "hex"), Buffer.from(nonce)]).toString("base64");
273
+ const item = usedNonceItem(from, nonce);
262
274
  const a = await rpc("state_get_dictionary_item", {
263
275
  state_root_hash: block.stateRoot,
264
276
  dictionary_identifier: { ContractNamedKey: { key: contract, dictionary_name: USED_NONCES, dictionary_item_key: item } },
@@ -1,6 +1,6 @@
1
1
  import type { FacilitatorEvmSigner } from "@x402/evm";
2
- import type { Handoff, ModuleStarter } from "../../module.js";
3
- import type { EvmModule } from "../evm/index.js";
2
+ import { type Core, type Handoff, type ModuleStarter } from "../../module.js";
3
+ import { type EvmModule, type EvmSender } from "../evm/index.js";
4
4
  /** One `eip155` network the `erc7710` module serves. */
5
5
  export interface Erc7710Config {
6
6
  readonly network: `eip155:${number}`;
@@ -8,15 +8,18 @@ export interface Erc7710Config {
8
8
  readonly rpc: string;
9
9
  /**
10
10
  * The seller's gas key, the delegate the leaf delegations it redeems name, as x402's EVM classes take a signer; it must
11
- * simulate calls (`eth_simulateV1`), since the simulation's logs show the transfer the redemption would make.
11
+ * simulate calls (`eth_simulateV1`), since the simulation's logs show the transfer the redemption would make; and it
12
+ * must sign without sending (`EvmSender`), since the module signs each redemption first and the record holds its
13
+ * hash before it is sent; and its `signTransaction` must sign with the fee members a request names
14
+ * (`maxFeePerGas`, `maxPriorityFeePerGas`), since a replacement at the same nonce names a higher fee.
12
15
  */
13
- readonly signer: FacilitatorEvmSigner;
16
+ readonly signer: FacilitatorEvmSigner & EvmSender;
14
17
  }
15
18
  /**
16
19
  * The `erc7710` module on one network, as the hand-off the `exact` registration there takes: every payment whose option
17
20
  * names the `erc7710` method, by the option's own member, before x402's `exact` class sees it.
18
21
  */
19
- export declare function erc7710Handoff(c: Erc7710Config): Handoff & {
22
+ export declare function erc7710Handoff(c: Erc7710Config, core: Pick<Core, "naming" | "state" | "log" | "settleWaitMs">): Handoff & {
20
23
  readonly module: EvmModule;
21
24
  };
22
25
  /**