@piprail/sdk 1.9.0 → 1.11.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 (29) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/ERRORS.md +21 -8
  3. package/README.md +20 -0
  4. package/STANDARDS.md +5 -2
  5. package/dist/{algorand-IJJKE35X.cjs → algorand-MXUSKX46.cjs} +17 -17
  6. package/dist/{algorand-B67G4335.js → algorand-WGVF4KTU.js} +1 -1
  7. package/dist/{aptos-YQWTGFRZ.js → aptos-LPBLSEIQ.js} +1 -1
  8. package/dist/{aptos-X3G2UBYW.cjs → aptos-YT7SXWPF.cjs} +16 -16
  9. package/dist/{chunk-IQGT65WS.cjs → chunk-MDLZJGLY.cjs} +20 -16
  10. package/dist/{chunk-QDS6FBZP.js → chunk-SVMGHASK.js} +4 -0
  11. package/dist/index.cjs +897 -265
  12. package/dist/index.d.cts +504 -45
  13. package/dist/index.d.ts +504 -45
  14. package/dist/index.js +820 -188
  15. package/dist/{near-GGUHLXAF.cjs → near-7ZDNISUX.cjs} +19 -19
  16. package/dist/{near-7MBBCDUE.js → near-K6BDBABG.js} +1 -1
  17. package/dist/{solana-W24TCJV4.cjs → solana-PU7N2M64.cjs} +14 -14
  18. package/dist/{solana-7WJVZGDW.js → solana-S3UFI3FE.js} +1 -1
  19. package/dist/{stellar-HV6VGZX3.js → stellar-Q5PO23SC.js} +1 -1
  20. package/dist/{stellar-YMY3K2YB.cjs → stellar-VDQOFQEO.cjs} +21 -21
  21. package/dist/{sui-32KVESR5.cjs → sui-FKSMLKRF.cjs} +17 -17
  22. package/dist/{sui-2WFWVFJX.js → sui-WOXRKJXS.js} +1 -1
  23. package/dist/{ton-FIQGV2LC.cjs → ton-VK6KRJHP.cjs} +14 -14
  24. package/dist/{ton-DGZB7W4U.js → ton-WPTXGLVK.js} +1 -1
  25. package/dist/{tron-RLIL2FDI.js → tron-6GXBXTR4.js} +1 -1
  26. package/dist/{tron-ZSXAPZ2C.cjs → tron-WLOF5OUV.cjs} +24 -24
  27. package/dist/{xrpl-2PKP7HOI.cjs → xrpl-CMNI25BV.cjs} +21 -21
  28. package/dist/{xrpl-UEC2GYVV.js → xrpl-HEAPEXAM.js} +1 -1
  29. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import * as viem_zksync from 'viem/zksync';
2
2
  import * as abitype from 'abitype';
3
3
  import * as viem_chains from 'viem/chains';
4
4
  import * as viem from 'viem';
5
- import { Chain, Account, Hex } from 'viem';
5
+ import { Chain, Account, Hex, PublicClient } from 'viem';
6
6
 
7
7
  /**
8
8
  * The on-the-wire payment protocol. Self-contained — it runs entirely
@@ -40,6 +40,8 @@ type AddressId = string;
40
40
  interface X402ResourceObject {
41
41
  url: string;
42
42
  description?: string;
43
+ /** The resource's response content-type, e.g. 'application/json' (v2 ResourceInfo, optional). */
44
+ mimeType?: string;
43
45
  }
44
46
  interface X402AcceptEntry {
45
47
  scheme: 'onchain-proof';
@@ -63,11 +65,55 @@ interface X402AcceptEntry {
63
65
  symbol?: string;
64
66
  };
65
67
  }
68
+ /**
69
+ * A standard x402 `exact` rail (EVM / EIP-3009) — the interop rail a PipRail gate
70
+ * advertises ALONGSIDE its `onchain-proof` rail (dual-advertise) so any standard
71
+ * x402 client can pay it. Same v2 PaymentRequirements skeleton as
72
+ * {@link X402AcceptEntry}; only `scheme` and `extra` differ. The `extra` carries
73
+ * the EIP-712 domain a payer signs over — `name`/`version` are READ from the token
74
+ * contract by the gate (never assumed), since e.g. USDC's domain name is "USD Coin",
75
+ * not the "USDC" symbol.
76
+ */
77
+ interface X402ExactAcceptEntry {
78
+ scheme: 'exact';
79
+ network: Caip2;
80
+ amount: string;
81
+ asset: AssetId;
82
+ payTo: AddressId;
83
+ maxTimeoutSeconds: number;
84
+ extra: {
85
+ /** The exact-EVM transfer method. PipRail self-settles EIP-3009 today. */
86
+ assetTransferMethod: 'eip3009';
87
+ /** EIP-712 domain name of the token (USDC: "USD Coin"; EURC: "EURC"). Read on-chain. */
88
+ name: string;
89
+ /** EIP-712 domain version of the token (USDC/EURC: "2"). Read on-chain. */
90
+ version: string;
91
+ /** Confirmations the gate waits for before granting access — mirrors the gate's
92
+ * `minConfirmations`, so the exact rail honours the same reorg safety as onchain-proof.
93
+ * A PipRail convenience (standard clients ignore unknown keys). */
94
+ minConfirmations?: number;
95
+ /** Token decimals — a PipRail convenience (standard clients ignore unknown keys). */
96
+ decimals?: number;
97
+ /** Human-readable amount, e.g. "0.05" — a PipRail convenience. */
98
+ amountFormatted?: string;
99
+ symbol?: string;
100
+ };
101
+ }
102
+ /** A challenge `accepts[]` entry — either PipRail's `onchain-proof` rail or a standard `exact` rail. */
103
+ type X402AnyAccept = X402AcceptEntry | X402ExactAcceptEntry;
66
104
  interface X402Challenge {
67
105
  x402Version: 2;
68
- error: string | null;
106
+ /**
107
+ * Optional human-readable reason (v2 `error?: string`). PipRail EMITS it only on a
108
+ * rejected-proof re-challenge (omitted on a fresh challenge). Typed to also tolerate
109
+ * `null` when PARSING a foreign challenge — some deployed servers send `error: null`.
110
+ */
111
+ error?: string | null;
69
112
  resource: X402ResourceObject;
70
- accepts: X402AcceptEntry[];
113
+ accepts: X402AnyAccept[];
114
+ /** v2 optional extensions. PipRail stamps the machine-readable rejection reason here on a
115
+ * rejected-proof re-challenge: `{ piprail: { code, detail } }`. Omitted otherwise. */
116
+ extensions?: Record<string, unknown>;
71
117
  }
72
118
  interface X402PaymentSignature {
73
119
  x402Version: 2;
@@ -86,8 +132,43 @@ interface X402PaymentSignature {
86
132
  txHash: string;
87
133
  };
88
134
  }
135
+ /**
136
+ * The EIP-3009 authorization a payer signs for a standard `exact` rail. All
137
+ * numeric fields are DECIMAL strings on the wire (value, validAfter, validBefore);
138
+ * `nonce` is a 0x-prefixed 32-byte hex. Identical shape across x402 v1 and v2.
139
+ */
140
+ interface ExactAuthorizationWire {
141
+ from: string;
142
+ to: string;
143
+ value: string;
144
+ validAfter: string;
145
+ validBefore: string;
146
+ nonce: string;
147
+ }
148
+ /** The `payload` a client sends for an `exact` rail: an EIP-3009 signature + its authorization. */
149
+ interface ExactPaymentPayload {
150
+ signature: string;
151
+ authorization: ExactAuthorizationWire;
152
+ }
153
+ /**
154
+ * What {@link parseExactPaymentHeader} extracts from an inbound `exact` payment,
155
+ * normalised across the v1 (`X-PAYMENT`, flat `{scheme,network,payload}`, network
156
+ * slug) and v2 (`PAYMENT-SIGNATURE`, `{accepted,payload}`, CAIP-2 network) wire
157
+ * shapes. `network`/`asset` are the CLIENT's claim — used only to MATCH an offered
158
+ * rail; the gate re-derives every verified field from its own trusted rail.
159
+ */
160
+ interface ParsedExactPayment {
161
+ x402Version: number;
162
+ /** The client's claimed network (slug or CAIP-2) — for matching, not trust. */
163
+ network: string;
164
+ /** The client's claimed asset, if present (v2 `accepted.asset`). */
165
+ asset?: string;
166
+ payload: ExactPaymentPayload;
167
+ /** The full decoded PaymentPayload, for verbatim forwarding to a facilitator (Mode B). */
168
+ raw: Record<string, unknown>;
169
+ }
89
170
  interface X402Receipt {
90
- scheme: 'onchain-proof';
171
+ scheme: 'onchain-proof' | 'exact';
91
172
  /**
92
173
  * x402 v2 SettlementResponse: settlement succeeded. Always `true` here — a
93
174
  * failed verification returns a 402, never a receipt.
@@ -122,7 +203,7 @@ interface X402Receipt {
122
203
  * `maxPaymentRetries` (a short backoff absorbs RPC lag); it does not branch on
123
204
  * the code.
124
205
  */
125
- type VerifyErrorCode = 'tx_not_found' | 'insufficient_confirmations' | 'tx_reverted' | 'no_meta' | 'wrong_recipient' | 'amount_too_low' | 'transfer_not_found' | 'payment_expired' | 'tx_already_used';
206
+ type VerifyErrorCode = 'tx_not_found' | 'insufficient_confirmations' | 'tx_reverted' | 'no_meta' | 'wrong_recipient' | 'amount_too_low' | 'transfer_not_found' | 'payment_expired' | 'tx_already_used' | 'signature_invalid';
126
207
  /** The shape every driver's `verify()` returns. Shared by drivers + protocol. */
127
208
  type VerifyResult = {
128
209
  ok: true;
@@ -132,6 +213,11 @@ type VerifyResult = {
132
213
  error: VerifyErrorCode;
133
214
  detail: string;
134
215
  };
216
+ declare const HEADER_REQUIRED = "payment-required";
217
+ declare const HEADER_SIGNATURE = "payment-signature";
218
+ declare const HEADER_RESPONSE = "payment-response";
219
+ declare const HEADER_SIGNATURE_V1 = "x-payment";
220
+ declare const HEADER_RESPONSE_V1 = "x-payment-response";
135
221
  declare function buildChallengeHeader(challenge: X402Challenge): string;
136
222
  declare function buildReceiptHeader(receipt: X402Receipt): string;
137
223
  declare function buildSignatureHeader(signature: X402PaymentSignature): string;
@@ -144,6 +230,15 @@ declare function parseChallenge(response: Response): Promise<X402Challenge | nul
144
230
  declare function parseReceipt(response: Response): X402Receipt | null;
145
231
  /** Parse a PAYMENT-SIGNATURE header value (server side). */
146
232
  declare function parseSignatureHeader(value: string): X402PaymentSignature | null;
233
+ /**
234
+ * Parse an inbound `exact` payment from a base64 header value (`PAYMENT-SIGNATURE`
235
+ * v2 or `X-PAYMENT` v1). Tolerant of BOTH wire shapes — the inner
236
+ * `{ signature, authorization }` payload is identical across versions, so we read
237
+ * `scheme`/`network` from either the v2 `accepted` object or the v1 flat fields.
238
+ * Returns null when the value isn't a recognisable `exact` payment (e.g. it's an
239
+ * `onchain-proof` proof, or malformed).
240
+ */
241
+ declare function parseExactPaymentHeader(value: string): ParsedExactPayment | null;
147
242
  /**
148
243
  * Pick the first accepts[] entry on the `onchain-proof` scheme whose network
149
244
  * satisfies `matches` (any chain family). Returns null if none match.
@@ -4068,6 +4163,38 @@ interface ResolvedNetwork {
4068
4163
  discoverySigner?(wallet: WalletHandle): DiscoverySigner | null;
4069
4164
  /** Verify `ref` satisfies `accept`, RPC-only, in-process. */
4070
4165
  verify(ref: string, accept: X402AcceptEntry): Promise<VerifyResult>;
4166
+ /**
4167
+ * OPTIONAL (EVM-only today) — the on-chain EIP-712 domain `{ name, version }` of an
4168
+ * EIP-3009 token `asset`, read from the contract (`name()`/`version()`). Returns
4169
+ * `null` when the asset is NOT an EIP-3009 token (no `transferWithAuthorization` —
4170
+ * e.g. USDT, native coin, or a plain ERC-20), so the gate can refuse to advertise a
4171
+ * standard `exact` rail for it. Never derived from the symbol (USDC's domain name is
4172
+ * "USD Coin", not "USDC"; EURC's is "EURC"). Called once at exact-rail resolution
4173
+ * (cached by the gate). RPC-read; may throw on a transient read (the gate surfaces a
4174
+ * clear config error). The first of two optional server methods for the `exact` rail.
4175
+ */
4176
+ exactDomain?(asset: string): Promise<{
4177
+ name: string;
4178
+ version: string;
4179
+ } | null>;
4180
+ /**
4181
+ * OPTIONAL (EVM-only today) — verify a standard x402 `exact` (EIP-3009) payment
4182
+ * locally, then SELF-SETTLE it by broadcasting `transferWithAuthorization` from the
4183
+ * merchant's own `relayer` wallet (the merchant pays gas to receive; the signature
4184
+ * binds `to`, so no redirect risk). RETURNS a `VerifyResult`:
4185
+ * - `{ ok:false, error }` for a CLIENT-fixable fault (bad signature, expired,
4186
+ * wrong recipient/amount, used nonce, simulation revert) → gate replies 402;
4187
+ * - `{ ok:true, receipt }` once the settle tx is mined.
4188
+ * THROWS {@link SettlementError} when a VALID + simulated payment fails to BROADCAST
4189
+ * (relayer out of gas / RPC down) → gate replies 5xx (the payer's authorization is
4190
+ * still good and its nonce unused). Re-derives every checked field from the trusted
4191
+ * `accept`, never the client echo.
4192
+ */
4193
+ settleExactSelf?(input: {
4194
+ relayer: WalletHandle;
4195
+ payload: ExactPaymentPayload;
4196
+ accept: X402ExactAcceptEntry;
4197
+ }): Promise<VerifyResult>;
4071
4198
  }
4072
4199
  interface ResolveOptions {
4073
4200
  /** The developer-supplied `chain` selector. */
@@ -4107,6 +4234,14 @@ interface DiscoveredResource {
4107
4234
  /** The payment options the index advertises (best-effort, cross-scheme). */
4108
4235
  rails: DiscoveredRail[];
4109
4236
  }
4237
+ /** Where a listing stands after a register attempt — a branchable lifecycle
4238
+ * state so an agent doesn't have to re-derive each index's behaviour:
4239
+ * - `'live'` — findable now (search it immediately).
4240
+ * - `'pending-review'` — accepted, but the index reviews/propagates before it's
4241
+ * publicly findable; allow a short delay before `discover()`.
4242
+ * - `'not-listable'` — it didn't list (a failure, or this index structurally
4243
+ * can't list a PipRail resource). See `detail` + `note`. */
4244
+ type ListingVisibility = 'live' | 'pending-review' | 'not-listable';
4110
4245
  /** The result of trying to list a resource on one open index. */
4111
4246
  interface RegisterOutcome {
4112
4247
  source: DiscoverySource;
@@ -4117,6 +4252,14 @@ interface RegisterOutcome {
4117
4252
  detail?: string;
4118
4253
  /** A link to the listing, when the index returns one. */
4119
4254
  listingUrl?: string;
4255
+ /** The lifecycle state of this listing — `'live'`, `'pending-review'`, or
4256
+ * `'not-listable'`. Projected from {@link DIRECTORY_INFO}; branch on this
4257
+ * instead of guessing how soon `discover()` will find the resource. */
4258
+ visibility?: ListingVisibility;
4259
+ /** A one-line, agent-readable caveat for this source (from {@link DIRECTORY_INFO})
4260
+ * — e.g. "402 Index reviews before publishing" or "discover() doesn't read
4261
+ * x402scan, so a live listing there won't appear in discover() results". */
4262
+ note?: string;
4120
4263
  }
4121
4264
  interface SearchOpenIndexesOptions {
4122
4265
  /** Free-text query (filtered client-side against name/description/resource). */
@@ -4148,6 +4291,48 @@ interface RegisterInput {
4148
4291
  */
4149
4292
  attribution?: boolean;
4150
4293
  }
4294
+ /**
4295
+ * Static, agent-readable lifecycle facts about one open index — the SINGLE source
4296
+ * of truth that {@link RegisterOutcome.visibility}/`note` are projected from, and
4297
+ * that an agent can also query directly (via {@link getDirectoryInfo}) to reason
4298
+ * about an index BEFORE calling. Best-effort: an index can change its behaviour,
4299
+ * so treat the timing as guidance, not an SLA.
4300
+ */
4301
+ interface DirectoryInfo {
4302
+ source: DiscoverySource;
4303
+ /** How a new listing is gated: a synchronous URL probe (`402index`, `x402scan`),
4304
+ * or coupled to a facilitator settling a payment (`bazaar`). */
4305
+ review: 'probe-sync' | 'settle-coupled';
4306
+ /** Auth needed to WRITE a listing. */
4307
+ auth: 'none' | 'siwx' | 'facilitator-only';
4308
+ /** Chains (CAIP-2) this index will list. `null` = any chain the resource advertises. */
4309
+ chains: readonly string[] | null;
4310
+ /** Visibility a SUCCESSFUL listing reaches here (the steady state a non-failed
4311
+ * outcome maps to). */
4312
+ onSuccess: ListingVisibility;
4313
+ /** Whether THIS SDK's {@link PipRailClient.discover} reads this index. It reads
4314
+ * `bazaar` + `402index`; it does NOT read `x402scan` — so a live x402scan listing
4315
+ * won't appear in `discover()` results. Don't read that absence as failure. */
4316
+ readByDiscover: boolean;
4317
+ /** One-line caveat: why a register might fail, or what to expect afterwards. */
4318
+ caveat: string;
4319
+ }
4320
+ /**
4321
+ * The open directories' lifecycle, as one queryable map. An agent can branch on
4322
+ * this without embedding directory knowledge: `DIRECTORY_INFO[source].readByDiscover`,
4323
+ * `.chains`, `.onSuccess`, etc. {@link PipRailClient.register} projects the relevant
4324
+ * entry onto every {@link RegisterOutcome} (`visibility` + `note`).
4325
+ */
4326
+ declare const DIRECTORY_INFO: Readonly<Record<DiscoverySource, DirectoryInfo>>;
4327
+ /** Lifecycle facts for one open index (auth, chains, how soon a listing is
4328
+ * findable, whether `discover()` reads it). See {@link DIRECTORY_INFO}. The param
4329
+ * is the closed {@link DiscoverySource} union (TS callers are safe); a string
4330
+ * outside it returns `undefined` at runtime. */
4331
+ declare function getDirectoryInfo(source: DiscoverySource): DirectoryInfo;
4332
+ /** Project the static {@link DIRECTORY_INFO} lifecycle facts onto a register
4333
+ * outcome, so an agent gets `visibility` + `note` in the result it already holds —
4334
+ * no second lookup. A failed outcome is always `'not-listable'`. Idempotent. */
4335
+ declare function decorateOutcome(o: RegisterOutcome): RegisterOutcome;
4151
4336
  /** Normalize an index's network field to CAIP-2 when we recognise the slug;
4152
4337
  * pass a value that's already CAIP-2 (`namespace:reference`) through unchanged.
4153
4338
  * An unknown slug returns unchanged (no `:`), which the client treats as
@@ -4161,8 +4346,11 @@ declare function normalizeNetwork(network: string): string;
4161
4346
  declare function searchOpenIndexes(opts?: SearchOpenIndexesOptions): Promise<DiscoveredResource[]>;
4162
4347
  /**
4163
4348
  * Register a resource on **402 Index** — the primary, friction-free path: a
4164
- * single POST, no auth, no signature, no payment. Searchable within seconds.
4165
- * Returns a structured outcome; never throws for an HTTP/transport problem.
4349
+ * single POST, no auth, no signature, no payment. A self-registered listing is
4350
+ * **pending review** (not searchable until approved verify your domain on
4351
+ * 402index.io for instant approval). Returns a structured outcome; never throws
4352
+ * for an HTTP/transport problem. NOTE: the outcome is BARE — `visibility`/`note`
4353
+ * are added by {@link PipRailClient.register} (or call {@link decorateOutcome}).
4166
4354
  */
4167
4355
  declare function register402Index(input: RegisterInput): Promise<RegisterOutcome>;
4168
4356
  /**
@@ -4170,7 +4358,9 @@ declare function register402Index(input: RegisterInput): Promise<RegisterOutcome
4170
4358
  * EIP-4361 challenge with the merchant's own key, resend with the
4171
4359
  * `SIGN-IN-WITH-X` header. Facilitator-free, but **Base/Solana-only** and EVM
4172
4360
  * signing today. EXPERIMENTAL — the open SIWX handshake is a moving convention;
4173
- * validate against x402scan before relying on it. Never throws.
4361
+ * validate against x402scan before relying on it. Never throws. NOTE: returns a
4362
+ * BARE outcome — `visibility`/`note` are added by {@link PipRailClient.register}
4363
+ * (or call {@link decorateOutcome}).
4174
4364
  */
4175
4365
  declare function registerX402Scan(input: {
4176
4366
  url: string;
@@ -4623,19 +4813,40 @@ declare class PipRailClient {
4623
4813
  *
4624
4814
  * Nothing PipRail-hosted: these are third-party open directories. Never throws
4625
4815
  * for a read problem — an index that's down or changed simply contributes
4626
- * nothing. Honest caveat: index results are cross-scheme (mostly the
4627
- * mainstream `exact` scheme); `fetch()` pays only `onchain-proof` rails
4628
- * directly (pay `exact` resources with the experimental `drivers/evm/exact.ts`).
4816
+ * nothing. Honest caveats (see {@link DIRECTORY_INFO}):
4817
+ * - Reads **`bazaar` + `402index`** only — **NOT `x402scan`** (its reads are paid). A
4818
+ * resource you registered on x402scan is live there but will NOT appear here; don't
4819
+ * read that absence as failure. (Passing `sources:['x402scan']` explicitly yields `[]`.)
4820
+ * - A resource just listed via {@link register} may not appear yet — 402 Index reviews
4821
+ * before publishing, so retry with a brief backoff if a fresh listing is missing.
4822
+ * - Results are cross-scheme (mostly the mainstream `exact` scheme); `fetch()` pays
4823
+ * only `onchain-proof` rails directly (pay `exact` resources with the experimental
4824
+ * `drivers/evm/exact.ts`).
4629
4825
  */
4630
4826
  discover(opts?: DiscoverOptions): Promise<DiscoveredResource[]>;
4631
4827
  /**
4632
4828
  * List a resource you run on the OPEN x402 registries, so agents can find it.
4633
- * Default target is **402 Index** — one POST, no auth, no signature, no payment
4634
- * (searchable within seconds). Add `'x402scan'` to also register via SIWX (one
4635
- * wallet signature; EVM + a Base/Solana rail). Returns one {@link RegisterOutcome}
4636
- * per target — a target the chain can't satisfy comes back `{ ok:false, detail }`,
4637
- * never a throw. An explicit, developer-invoked action; it moves no funds, and
4638
- * nothing is PipRail-hosted — you're listing on third-party open directories.
4829
+ * Default target is **402 Index** — one POST, no auth, no signature, no payment.
4830
+ * Add `'x402scan'` to also register via SIWX (one wallet signature; EVM + a
4831
+ * Base/Solana rail). Returns one {@link RegisterOutcome} per target — a target the
4832
+ * chain can't satisfy comes back `{ ok:false, detail }`, never a throw. An explicit,
4833
+ * developer-invoked action; it moves no funds, and nothing is PipRail-hosted —
4834
+ * you're listing on third-party open directories.
4835
+ *
4836
+ * **Listing is asynchronous — each outcome carries a `visibility` + `note` so an
4837
+ * agent knows when/where the resource is findable (don't assume `ok:true` means
4838
+ * "searchable now"):**
4839
+ * - **402 Index** → `visibility:'pending-review'`. It probes your URL on submit, then lists it
4840
+ * PENDING REVIEW — not searchable until approved (verify your domain on 402index.io for instant
4841
+ * approval), so `discover()` returns nothing for a fresh listing until then. Retry later.
4842
+ * - **x402scan** → `visibility:'live'`, but **`discover()` does NOT read x402scan** — the
4843
+ * listing is real on x402scan.com yet won't show up in `discover()`. Base/Solana only;
4844
+ * needs a resolvable input schema (`/openapi.json` or the `extensions.bazaar` block).
4845
+ * - **Bazaar** → `visibility:'not-listable'` for PipRail (it lists only what its facilitator
4846
+ * settles; PipRail uses none). You can still READ Bazaar via {@link discover} to find others.
4847
+ *
4848
+ * The per-source facts live in {@link DIRECTORY_INFO} (importable) if you'd rather branch
4849
+ * on them before calling.
4639
4850
  */
4640
4851
  register(url: string, opts?: RegisterOptions): Promise<RegisterOutcome[]>;
4641
4852
  /**
@@ -4660,7 +4871,10 @@ declare class PipRailClient {
4660
4871
  * `quote()` (read-only) and `fetch()` (which then authorises + pays).
4661
4872
  */
4662
4873
  private resolveChallenge;
4663
- /** The candidate accepts this client could pay: our scheme, on the bound network. */
4874
+ /** The candidate accepts this client could pay: our scheme, on the bound network.
4875
+ * A dual-advertised challenge may also carry standard `exact` rails — the PipRail
4876
+ * client ignores those (it pays the backendless `onchain-proof` rail); the type
4877
+ * predicate narrows the `X402AnyAccept` union to the rails we settle. */
4664
4878
  private gatherCandidates;
4665
4879
  /** Build the full {@link PaymentPlan} from an already-parsed challenge + bound
4666
4880
  * net/wallet. Shared by `planPayment` (read-only) and `fetch`'s autoRoute. */
@@ -4768,7 +4982,8 @@ declare function paymentTools(client: PipRailClient): AgentTool[];
4768
4982
  * consumed by every emitter below.
4769
4983
  */
4770
4984
  interface PaymentRail {
4771
- scheme: 'onchain-proof';
4985
+ /** `onchain-proof` (PipRail's default) or the standard `exact` rail (dual-advertise). */
4986
+ scheme: 'onchain-proof' | 'exact';
4772
4987
  network: Caip2;
4773
4988
  asset: AssetId;
4774
4989
  payTo: AddressId;
@@ -4931,6 +5146,30 @@ interface AcceptOption {
4931
5146
  /** RPC override for this chain (defaults to the top-level `rpcUrl`). */
4932
5147
  rpcUrl?: string;
4933
5148
  }
5149
+ /**
5150
+ * Opt into ALSO advertising a standard x402 `exact` rail (EIP-3009) beside the
5151
+ * default `onchain-proof` rail, so ANY standard x402 client can pay this gate
5152
+ * (dual-advertise). EVM + EIP-3009 tokens only (USDC, EURC — NOT USDT, NOT native).
5153
+ * Omitting `exact` leaves the gate byte-identical to today (onchain-proof only).
5154
+ *
5155
+ * Two settlement modes, both backendless (PipRail hosts nothing):
5156
+ * - `settle: 'self'` — your own `relayer` key broadcasts `transferWithAuthorization`.
5157
+ * You pay gas to RECEIVE (the inverse of onchain-proof, where the payer pays gas)
5158
+ * and must keep the relayer funded. The signature binds `to`, so there's no
5159
+ * redirect risk. This is the on-brand default for the rail.
5160
+ * - `settle: { facilitator }` — delegate verify+settle to a third-party x402
5161
+ * facilitator YOU choose (Coinbase CDP, x402.org, …). No relayer key needed; the
5162
+ * facilitator pays gas. Also the only path onto Coinbase's Bazaar directory.
5163
+ */
5164
+ interface ExactRailOption {
5165
+ settle: 'self' | {
5166
+ facilitator: string;
5167
+ authHeaders?: () => Promise<Record<string, string>>;
5168
+ };
5169
+ /** Required for `settle: 'self'` — the gas-paying relayer wallet: EVM `{ privateKey }`
5170
+ * or a bring-your-own `{ walletClient }`. (Distinct from `payTo`, the receive address.) */
5171
+ relayer?: unknown;
5172
+ }
4934
5173
  interface RequirePaymentOptions {
4935
5174
  /**
4936
5175
  * Single-chain form: which chain to accept payment on. EVM ('bnb'|'base'|…),
@@ -4979,6 +5218,12 @@ interface RequirePaymentOptions {
4979
5218
  markUsed?: (ref: string) => void | Promise<void>;
4980
5219
  /** Fired when a payment verifies successfully. */
4981
5220
  onPaid?: (receipt: X402Receipt) => void;
5221
+ /**
5222
+ * ALSO advertise a standard x402 `exact` rail (EIP-3009) so any standard x402
5223
+ * client can pay this gate — opt-in, EVM/EIP-3009 only. See {@link ExactRailOption}.
5224
+ * Omit to keep the gate exactly as today (`onchain-proof` only).
5225
+ */
5226
+ exact?: ExactRailOption;
4982
5227
  }
4983
5228
  type VerifyPaymentResult = {
4984
5229
  kind: 'paid';
@@ -4990,12 +5235,21 @@ type VerifyPaymentResult = {
4990
5235
  requiredHeader: string;
4991
5236
  statusCode: 402;
4992
5237
  } | {
5238
+ /**
5239
+ * A submitted proof was rejected. Conformant: this carries a FRESH
5240
+ * re-`challenge` (full v2 PaymentRequired with `accepts[]` + the reason in
5241
+ * `error` + the machine code in `extensions.piprail`) so a standard x402
5242
+ * client can immediately retry. Adapters emit `challenge` + the
5243
+ * `PAYMENT-REQUIRED` header — NOT the legacy {@link toInvalidBody}.
5244
+ */
4993
5245
  kind: 'invalid';
4994
5246
  error: string;
4995
5247
  detail: string;
5248
+ challenge: X402Challenge;
5249
+ requiredHeader: string;
4996
5250
  statusCode: 402;
4997
5251
  };
4998
- /** The canonical x402 v2 JSON body for a rejected proof (a 402 'invalid'). */
5252
+ /** A minimal 402 'invalid' JSON body. @deprecated see {@link toInvalidBody}. */
4999
5253
  interface X402InvalidBody {
5000
5254
  x402Version: 2;
5001
5255
  status: 'invalid';
@@ -5003,9 +5257,14 @@ interface X402InvalidBody {
5003
5257
  detail: string;
5004
5258
  }
5005
5259
  /**
5006
- * Build the canonical 402 'invalid' body. Use this in EVERY framework adapter
5007
- * (Express, Hono, Fastify, Workers, …) so a rejected proof returns the IDENTICAL
5008
- * envelope everywhere `verify()` produces the reason, this shapes the body.
5260
+ * @deprecated LEGACY minimal rejection body. The gate now returns a fully
5261
+ * **conformant** rejection: `gate.verify()`'s `kind:'invalid'` result carries a full
5262
+ * v2 PaymentRequired re-`challenge` (with `accepts[]` so a standard x402 client can
5263
+ * retry, the reason in `error`, and the machine code in `extensions.piprail`). The
5264
+ * built-in `requirePayment` adapter emits `result.challenge` + the `PAYMENT-REQUIRED`
5265
+ * header. PREFER that. This helper (a bare `{ status:'invalid', error, detail }` with
5266
+ * NO `accepts[]`) remains only for back-compat with hand-rolled adapters; a standard
5267
+ * client that receives it can't retry. Migrate to `result.challenge`.
5009
5268
  */
5010
5269
  declare function toInvalidBody(result: {
5011
5270
  error: string;
@@ -5058,6 +5317,68 @@ type ExpressLikeMiddleware = (req: ExpressLikeRequest, res: ExpressLikeResponse,
5058
5317
  */
5059
5318
  declare function requirePayment(options: RequirePaymentOptions): ExpressLikeMiddleware;
5060
5319
 
5320
+ /**
5321
+ * Mode-B settlement: delegate a standard `exact` payment to a THIRD-PARTY x402
5322
+ * facilitator the MERCHANT chooses (Coinbase CDP, x402.org, or any). PipRail hosts
5323
+ * nothing — this is two HTTP POSTs to the merchant's configured facilitator URL.
5324
+ *
5325
+ * PROTOCOL LAYER — pure `fetch`, ZERO chain libraries (STANDARDS §1). The other
5326
+ * settlement mode (self-settle with the merchant's own relayer key) lives in the
5327
+ * EVM driver; this one is chain-agnostic because the facilitator does the chain work.
5328
+ *
5329
+ * The wire contract (x402 v2, verified against coinbase/x402 core):
5330
+ * POST {url}/verify body { x402Version, paymentPayload, paymentRequirements } → { isValid, invalidReason?, payer? }
5331
+ * POST {url}/settle SAME body → { success, transaction, network, payer?, errorReason? }
5332
+ * Both protocol outcomes are HTTP 200 (the boolean flips); a non-200 is a
5333
+ * transport/auth failure. There is no registration and no idempotency key — so a
5334
+ * SELF-settling merchant must guard replay itself (the gate's used-proof set does).
5335
+ */
5336
+
5337
+ /** Standard x402 `exact` PaymentRequirements, built from the gate's TRUSTED rail. */
5338
+ interface FacilitatorPaymentRequirements {
5339
+ scheme: 'exact';
5340
+ network: string;
5341
+ asset: string;
5342
+ amount: string;
5343
+ payTo: string;
5344
+ maxTimeoutSeconds: number;
5345
+ extra: {
5346
+ name: string;
5347
+ version: string;
5348
+ };
5349
+ }
5350
+ /** A merchant-chosen facilitator: its base URL + optional per-request auth headers. */
5351
+ interface FacilitatorConfig {
5352
+ /** Base URL, e.g. 'https://x402.org/facilitator' (trailing slash stripped). */
5353
+ url: string;
5354
+ /** Optional async auth-header provider (e.g. CDP JWT). Omit for the free, no-auth facilitators. */
5355
+ authHeaders?: () => Promise<Record<string, string>>;
5356
+ }
5357
+ interface SettleViaFacilitatorInput extends FacilitatorConfig {
5358
+ x402Version: number;
5359
+ /** The decoded PaymentPayload the client sent — forwarded verbatim. */
5360
+ paymentPayload: Record<string, unknown>;
5361
+ /** PaymentRequirements built from the gate's trusted rail (never the client echo). */
5362
+ paymentRequirements: FacilitatorPaymentRequirements;
5363
+ /** The receipt's network (CAIP-2) + asset/amount/payTo, for building the X402Receipt on success. */
5364
+ receipt: {
5365
+ network: Caip2;
5366
+ asset: AssetId;
5367
+ payTo: AddressId;
5368
+ amount: string;
5369
+ };
5370
+ /** authorization.from, for the receipt's `payer`. */
5371
+ payerHint?: string;
5372
+ }
5373
+ /**
5374
+ * Verify-then-settle a standard `exact` payment through a third-party facilitator.
5375
+ * Returns a {@link VerifyResult}: `{ ok:false, error }` for a client-fixable
5376
+ * facilitator rejection (verify isValid:false, or settle success:false) → 402;
5377
+ * `{ ok:true, receipt }` on a settled payment. THROWS {@link SettlementError} on a
5378
+ * transport/auth failure (non-200) — the gate replies 5xx, never a misleading 402.
5379
+ */
5380
+ declare function settleViaFacilitator(input: SettleViaFacilitatorInput): Promise<VerifyResult>;
5381
+
5061
5382
  /**
5062
5383
  * The driver registry — the ONLY place the families meet. Routing decides a
5063
5384
  * family from the `chain` value (synchronously), then asks that family's
@@ -5202,6 +5523,22 @@ declare class PaymentDeclinedError extends PipRailError {
5202
5523
  declare class ConfirmationTimeoutError extends PipRailError {
5203
5524
  readonly code = "CONFIRMATION_TIMEOUT";
5204
5525
  }
5526
+ /**
5527
+ * A standard `exact` payment was VALID (signature recovered, params checked,
5528
+ * simulation passed) but SETTLEMENT failed for a SERVER-side reason — the
5529
+ * merchant's own relayer couldn't broadcast `transferWithAuthorization` (out of
5530
+ * gas, RPC down, dropped tx), or a Mode-B facilitator returned a transport/auth
5531
+ * error. This is NOT the payer's fault: their signed EIP-3009 authorization is
5532
+ * still valid and its nonce UNUSED, so it can be re-presented once the merchant
5533
+ * fixes their relayer/facilitator. The gate THROWS this (it's an operational
5534
+ * problem to fix, not a proof to reject), so a framework adapter returns 5xx —
5535
+ * never a 402, which would wrongly tell the payer to re-pay. `.cause` carries the
5536
+ * raw chain/HTTP error. (Server-side; the `onchain-proof` rail can't raise it —
5537
+ * there the payer broadcasts, so there's nothing for the merchant to settle.)
5538
+ */
5539
+ declare class SettlementError extends PipRailError {
5540
+ readonly code = "SETTLEMENT_FAILED";
5541
+ }
5205
5542
  /** Server returned 402 but the PAYMENT-REQUIRED envelope was missing or malformed. */
5206
5543
  declare class InvalidEnvelopeError extends PipRailError {
5207
5544
  readonly code = "INVALID_ENVELOPE";
@@ -5256,28 +5593,29 @@ declare class UnsupportedNetworkError extends PipRailError {
5256
5593
  }
5257
5594
 
5258
5595
  /**
5259
- * ── EVM SECTION: x402 `exact` scheme (interop building block) ──────────────
5596
+ * ── EVM SECTION: x402 `exact` scheme (EIP-3009) BUYER + SELLER ───────────
5260
5597
  *
5261
- * EXPERIMENTAL / ADVANCED. PipRail's own gates use the `onchain-proof` scheme
5262
- * (client pays first, proves with a tx ref, server verifies locally no
5263
- * facilitator). This module is the opposite end: the building blocks to PAY a
5264
- * server that speaks the mainstream x402 `exact` scheme (Coinbase-style), where
5265
- * the client signs an EIP-3009 `transferWithAuthorization` and a third-party
5266
- * facilitator broadcasts it. It lets a PipRail agent buy from `exact` servers
5267
- * too — making PipRail a *universal* x402 client — while our servers stay
5268
- * backendless.
5598
+ * PipRail's own gates default to the `onchain-proof` scheme (client pays first,
5599
+ * proves with a tx ref, server verifies locally). This module is the standard
5600
+ * x402 `exact` interop, in BOTH directions, EVM + EIP-3009 only, on the existing
5601
+ * `viem` peer (no new dep):
5269
5602
  *
5270
- * What's here is the deterministic, unit-testable core: parse an `exact`
5271
- * requirement, build + EIP-712-sign the authorization, and encode the
5272
- * `X-PAYMENT` header. It is intentionally NOT wired into `PipRailClient.fetch`'s
5273
- * default flow: `exact` is a cross-vendor wire protocol whose live acceptance
5274
- * can only be confirmed against a real facilitator, and bolting a second
5275
- * payment protocol into the core would cut against PipRail's keep-it-simple
5276
- * design. Use these helpers to hand-roll an `exact` payment, and validate
5277
- * against your target facilitator before production. See
5278
- * `.claude/plans/agent-readiness/04-universal-exact.md`.
5603
+ * BUYER side (client) parse an `exact` requirement, build + EIP-712-sign the
5604
+ * EIP-3009 authorization, encode the `X-PAYMENT` header. Deterministic,
5605
+ * unit-testable; NOT wired into `PipRailClient.fetch`'s default (see
5606
+ * `.claude/plans/agent-readiness/04-universal-exact.md`).
5279
5607
  *
5280
- * EVM + EIP-3009 only (USDC and kin). Uses the existing `viem` peer no new dep.
5608
+ * SELLER side (gate) {@link readExactDomain} (read the token's true EIP-712
5609
+ * domain so the gate can advertise + verify it) and {@link verifyAndSettleExactEvm}
5610
+ * (verify an inbound EIP-3009 authorization locally, then SELF-SETTLE it by
5611
+ * broadcasting `transferWithAuthorization` from the merchant's own relayer key —
5612
+ * no third-party facilitator). This is what lets a PipRail gate get PAID by ANY
5613
+ * standard x402 client. See `.claude/plans/compliance/`.
5614
+ *
5615
+ * Self-settle uses `transferWithAuthorization` (NOT `receiveWithAuthorization`,
5616
+ * which requires `msg.sender == payTo` and so can't be broadcast by a separate
5617
+ * relayer key). The signature binds `to`=payTo, so a front-runner can only push
5618
+ * the same funds to the same payTo and waste their own gas — no redirect risk.
5281
5619
  */
5282
5620
 
5283
5621
  /** x402 network slug → EVM chain id, for the chains PipRail ships with EIP-3009
@@ -5362,13 +5700,134 @@ declare function buildExactAuthorization(params: BuildExactParams): Promise<{
5362
5700
  authorization: ExactAuthorization;
5363
5701
  signature: Hex;
5364
5702
  }>;
5365
- /** Encode an x402 `exact` PaymentPayload into an `X-PAYMENT` header value. */
5703
+ /**
5704
+ * Encode an x402 `exact` PaymentPayload into an `X-PAYMENT` header value — the
5705
+ * **v1 flat shape** (`{ x402Version, scheme, network, payload }`). This is a
5706
+ * client-side UTILITY (PipRail's own client pays only `onchain-proof`, never this);
5707
+ * the v1 flat shape is what Coinbase's original reference emits and is still accepted
5708
+ * by every x402 gate + facilitator, so `x402Version` defaults to `1` to stay
5709
+ * INTERNALLY CONSISTENT with that shape (emitting `2` here would mislabel a v1 body —
5710
+ * a proper v2 `exact` payload is the nested `accepted`-envelope shape instead). See
5711
+ * the version-posture note in `x402.ts`.
5712
+ */
5366
5713
  declare function encodeXPaymentHeader(input: {
5367
5714
  network: string;
5368
5715
  authorization: ExactAuthorization;
5369
5716
  signature: Hex;
5370
- /** x402 envelope version (Coinbase's reference uses 1). */
5717
+ /** x402 envelope version. Defaults to `1` — consistent with this flat shape. */
5371
5718
  x402Version?: number;
5372
5719
  }): string;
5720
+ /**
5721
+ * The minimal EIP-3009 ABI the seller needs: both `transferWithAuthorization`
5722
+ * overloads (the 65-byte `(v,r,s)` form and the `(bytes signature)` ERC-1271 form),
5723
+ * the `authorizationState` replay check, and `name()`/`version()` for the EIP-712
5724
+ * domain. Mirrors Circle's deployed FiatToken.
5725
+ */
5726
+ declare const eip3009Abi: readonly [{
5727
+ readonly type: "function";
5728
+ readonly name: "transferWithAuthorization";
5729
+ readonly stateMutability: "nonpayable";
5730
+ readonly outputs: readonly [];
5731
+ readonly inputs: readonly [{
5732
+ readonly name: "from";
5733
+ readonly type: "address";
5734
+ }, {
5735
+ readonly name: "to";
5736
+ readonly type: "address";
5737
+ }, {
5738
+ readonly name: "value";
5739
+ readonly type: "uint256";
5740
+ }, {
5741
+ readonly name: "validAfter";
5742
+ readonly type: "uint256";
5743
+ }, {
5744
+ readonly name: "validBefore";
5745
+ readonly type: "uint256";
5746
+ }, {
5747
+ readonly name: "nonce";
5748
+ readonly type: "bytes32";
5749
+ }, {
5750
+ readonly name: "v";
5751
+ readonly type: "uint8";
5752
+ }, {
5753
+ readonly name: "r";
5754
+ readonly type: "bytes32";
5755
+ }, {
5756
+ readonly name: "s";
5757
+ readonly type: "bytes32";
5758
+ }];
5759
+ }, {
5760
+ readonly type: "function";
5761
+ readonly name: "transferWithAuthorization";
5762
+ readonly stateMutability: "nonpayable";
5763
+ readonly outputs: readonly [];
5764
+ readonly inputs: readonly [{
5765
+ readonly name: "from";
5766
+ readonly type: "address";
5767
+ }, {
5768
+ readonly name: "to";
5769
+ readonly type: "address";
5770
+ }, {
5771
+ readonly name: "value";
5772
+ readonly type: "uint256";
5773
+ }, {
5774
+ readonly name: "validAfter";
5775
+ readonly type: "uint256";
5776
+ }, {
5777
+ readonly name: "validBefore";
5778
+ readonly type: "uint256";
5779
+ }, {
5780
+ readonly name: "nonce";
5781
+ readonly type: "bytes32";
5782
+ }, {
5783
+ readonly name: "signature";
5784
+ readonly type: "bytes";
5785
+ }];
5786
+ }, {
5787
+ readonly type: "function";
5788
+ readonly name: "authorizationState";
5789
+ readonly stateMutability: "view";
5790
+ readonly inputs: readonly [{
5791
+ readonly name: "authorizer";
5792
+ readonly type: "address";
5793
+ }, {
5794
+ readonly name: "nonce";
5795
+ readonly type: "bytes32";
5796
+ }];
5797
+ readonly outputs: readonly [{
5798
+ readonly type: "bool";
5799
+ }];
5800
+ }, {
5801
+ readonly type: "function";
5802
+ readonly name: "name";
5803
+ readonly stateMutability: "view";
5804
+ readonly inputs: readonly [];
5805
+ readonly outputs: readonly [{
5806
+ readonly type: "string";
5807
+ }];
5808
+ }, {
5809
+ readonly type: "function";
5810
+ readonly name: "version";
5811
+ readonly stateMutability: "view";
5812
+ readonly inputs: readonly [];
5813
+ readonly outputs: readonly [{
5814
+ readonly type: "string";
5815
+ }];
5816
+ }];
5817
+ /**
5818
+ * Read an EIP-3009 token's true EIP-712 domain `{ name, version }` from the
5819
+ * contract — what a payer must sign over. Returns `null` if the asset is NOT an
5820
+ * EIP-3009 token (no `authorizationState`/`version` — e.g. USDT, native coin, a
5821
+ * plain ERC-20), so the gate refuses to advertise a standard `exact` rail for it.
5822
+ *
5823
+ * The name is NEVER assumed from the symbol: canonical USDC's domain name is
5824
+ * "USD Coin" (not "USDC"), EURC's is "EURC". `eip712Domain()` (EIP-5267) reverts
5825
+ * on these proxies, so we read `name()`+`version()` and probe `authorizationState`
5826
+ * to confirm EIP-3009 support.
5827
+ */
5828
+ declare function readExactDomain(publicClient: PublicClient, asset: string): Promise<{
5829
+ name: string;
5830
+ version: string;
5831
+ } | null>;
5373
5832
 
5374
- export { type AcceptOption, type AddressId, type AgentTool, type AlgorandToken, type AptosToken, type AssetId, type BuildExactParams, CHAINS, type Caip2, type ChainFamily, type ChainInput, type ChainName, type ChainPreset, type ChainSelector, type ConfirmInfo, ConfirmationTimeoutError, type CostEstimate, type DiscoverOptions, type DiscoveredRail, type DiscoveredResource, type DiscoverySigner, type DiscoverySource, EIP3009_TYPES, EXACT_NETWORK_SLUGS, type EvmToken, type ExactAccept, type ExactAuthorization, type ExpressLikeMiddleware, type ExpressLikeNext, type ExpressLikeRequest, type ExpressLikeResponse, GENERATOR, InsufficientFundsError, InvalidEnvelopeError, type ManifestInput, MaxRetriesExceededError, MissingDriverError, type NearToken, NoCompatibleAcceptError, NonReplayableBodyError, type OpenApiDocument, type OpenApiOperation, type PayBlocker, type PayOption, type PayWarning, PaymentDeclinedError, type PaymentDriver, type PaymentGate, type PaymentIntent, type PaymentPlan, type PaymentPolicy, type PaymentRail, PaymentTimeoutError, PipRailClient, type PipRailClientOptions, type PipRailCostQuote, PipRailError, type PipRailEvent, type PipRailQuote, type PolicyDecision, RecipientNotReadyError, type RecipientReason, type RegisterInput, type RegisterOptions, type RegisterOutcome, type RequirePaymentOptions, type ResolveOptions, type ResolvedChain, type ResolvedNetwork, type ResolvedToken, type ResourceDescription, type SearchOpenIndexesOptions, type SolanaToken, type SpendAssetTotal, type SpendRecord, type SpendSummary, type StellarToken, type SuiToken, type TokenInfo, type TokenInput, type TonToken, type ToolAnnotations, type TronToken, UnknownTokenError, UnsupportedNetworkError, type VerifyErrorCode, type VerifyPaymentResult, type VerifyResult, type WalletBalance, type WalletHandle, type WalletInput, type WellKnownX402, WrongChainError, WrongFamilyError, type X402AcceptEntry, type X402Challenge, type X402DnsRecord, type X402InvalidBody, type X402PaymentSignature, type X402Receipt, type X402ResourceObject, type XrplToken, buildChallengeHeader, buildExactAuthorization, buildOpenApi, buildReceiptHeader, buildSignatureHeader, buildWellKnownX402, buildX402DnsTxt, chainIdForExactNetwork, createPaymentGate, encodeXPaymentHeader, evaluatePolicy, normalizeNetwork, parseChallenge, parseExactRequirements, parseReceipt, parseSignatureHeader, paymentTools, pickAccept, planAcross, register402Index, registerDriver, registerX402Scan, requirePayment, resolveChain, searchOpenIndexes, toInsufficientFundsError, toInvalidBody };
5833
+ export { type AcceptOption, type AddressId, type AgentTool, type AlgorandToken, type AptosToken, type AssetId, type BuildExactParams, CHAINS, type Caip2, type ChainFamily, type ChainInput, type ChainName, type ChainPreset, type ChainSelector, type ConfirmInfo, ConfirmationTimeoutError, type CostEstimate, DIRECTORY_INFO, type DirectoryInfo, type DiscoverOptions, type DiscoveredRail, type DiscoveredResource, type DiscoverySigner, type DiscoverySource, EIP3009_TYPES, EXACT_NETWORK_SLUGS, type EvmToken, type ExactAccept, type ExactAuthorization, type ExactAuthorizationWire, type ExactPaymentPayload, type ExactRailOption, type ExpressLikeMiddleware, type ExpressLikeNext, type ExpressLikeRequest, type ExpressLikeResponse, type FacilitatorConfig, type FacilitatorPaymentRequirements, GENERATOR, HEADER_REQUIRED, HEADER_RESPONSE, HEADER_RESPONSE_V1, HEADER_SIGNATURE, HEADER_SIGNATURE_V1, InsufficientFundsError, InvalidEnvelopeError, type ListingVisibility, type ManifestInput, MaxRetriesExceededError, MissingDriverError, type NearToken, NoCompatibleAcceptError, NonReplayableBodyError, type OpenApiDocument, type OpenApiOperation, type ParsedExactPayment, type PayBlocker, type PayOption, type PayWarning, PaymentDeclinedError, type PaymentDriver, type PaymentGate, type PaymentIntent, type PaymentPlan, type PaymentPolicy, type PaymentRail, PaymentTimeoutError, PipRailClient, type PipRailClientOptions, type PipRailCostQuote, PipRailError, type PipRailEvent, type PipRailQuote, type PolicyDecision, RecipientNotReadyError, type RecipientReason, type RegisterInput, type RegisterOptions, type RegisterOutcome, type RequirePaymentOptions, type ResolveOptions, type ResolvedChain, type ResolvedNetwork, type ResolvedToken, type ResourceDescription, type SearchOpenIndexesOptions, type SettleViaFacilitatorInput, SettlementError, type SolanaToken, type SpendAssetTotal, type SpendRecord, type SpendSummary, type StellarToken, type SuiToken, type TokenInfo, type TokenInput, type TonToken, type ToolAnnotations, type TronToken, UnknownTokenError, UnsupportedNetworkError, type VerifyErrorCode, type VerifyPaymentResult, type VerifyResult, type WalletBalance, type WalletHandle, type WalletInput, type WellKnownX402, WrongChainError, WrongFamilyError, type X402AcceptEntry, type X402AnyAccept, type X402Challenge, type X402DnsRecord, type X402ExactAcceptEntry, type X402InvalidBody, type X402PaymentSignature, type X402Receipt, type X402ResourceObject, type XrplToken, buildChallengeHeader, buildExactAuthorization, buildOpenApi, buildReceiptHeader, buildSignatureHeader, buildWellKnownX402, buildX402DnsTxt, chainIdForExactNetwork, createPaymentGate, decorateOutcome, eip3009Abi, encodeXPaymentHeader, evaluatePolicy, getDirectoryInfo, normalizeNetwork, parseChallenge, parseExactPaymentHeader, parseExactRequirements, parseReceipt, parseSignatureHeader, paymentTools, pickAccept, planAcross, readExactDomain, register402Index, registerDriver, registerX402Scan, requirePayment, resolveChain, searchOpenIndexes, settleViaFacilitator, toInsufficientFundsError, toInvalidBody };