@piprail/sdk 1.22.0 → 1.23.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.
package/dist/index.d.cts CHANGED
@@ -5538,6 +5538,15 @@ declare function explainDecline(err: unknown): string;
5538
5538
  * convenience, not a durable ledger.
5539
5539
  */
5540
5540
  declare function formatSpendReport(summary: SpendSummary): string;
5541
+ /**
5542
+ * One line a human or model can act on for a 402 challenge: what it is, the first
5543
+ * rail's amount/token/chain + recipient, and how to pay it programmatically. Composes
5544
+ * only shipped challenge fields (same `amountFormatted ?? amount` / `symbol ?? asset`
5545
+ * convention as the renderers above) — pure, no I/O. Used as the human `instruction`
5546
+ * inside the self-describe block and as a landing page's headline. An empty `accepts`
5547
+ * (shouldn't happen for a valid v2 challenge) degrades to a generic pointer.
5548
+ */
5549
+ declare function describeChallenge(challenge: X402Challenge): string;
5541
5550
 
5542
5551
  /**
5543
5552
  * The PipRail agent contract, distilled into one string an LLM can read once and
@@ -5550,7 +5559,7 @@ declare function formatSpendReport(summary: SpendSummary): string;
5550
5559
  * literally, so a wrong name or order actively misleads. A test pins the load-
5551
5560
  * bearing phrases.
5552
5561
  */
5553
- declare const PIPRAIL_AGENT_GUIDE = "# Paying with PipRail \u2014 the agent contract\n\nYou can pay for x402 \"402 Payment Required\" resources autonomously. Money moves\nstraight from your wallet to the server; PipRail custodies nothing. Follow this.\n\n## The loop: quote \u2192 plan \u2192 pay\n1. piprail_quote_payment(url) \u2014 PRICE it. Returns the amount, token, chain, and\n whether it is within your spend policy. No funds move. Use it to decide if a\n resource is worth buying.\n2. piprail_plan_payment(url) \u2014 can I afford it NOW? Reads your balance, native gas,\n and recipient-readiness across every rail, and returns { payable, best,\n fundingHint, session? }. If payable is false, do NOT attempt the payment \u2014\n fundingHint says exactly what to fix.\n3. piprail_pay_request(url, method?, body?) \u2014 PAY (only if the plan was payable)\n and return the result.\nAlways plan before you pay so you never commit to a payment you cannot finish.\n\n## Gasless \u2014 the exact rail (zero gas for you)\nA 402 may offer up to two rails; you don't choose per payment \u2014 the client does, automatically:\n- onchain-proof (PipRail's default): you broadcast the payment yourself and pay the network gas\n (the native coin \u2014 ETH/SOL/\u2026). Works on every chain.\n- exact (the ratified x402 rail, opt-in): you only SIGN; the server \u2014 or a facilitator it chose\n (e.g. PayAI) \u2014 broadcasts it, so you pay ZERO gas (you need only the token, no native coin). It\n works on EVM + Solana, and the on-chain method (EIP-3009 / Permit2 / SVM) is picked automatically.\nWhen the exact scheme is enabled AND balance-aware routing is on, paying picks the cheapest\nsettleable rail \u2014 i.e. the gasless exact one. Nothing changes in your loop: quote \u2192 plan \u2192 pay is\nidentical. The exact scheme is OPT-IN by the operator (MCP: PIPRAIL_SCHEMES=onchain-proof,exact);\nyou can't enable it yourself, but you can report when a 402 needs it (see UNSUPPORTED_SCHEME below).\n\n## Reading a refusal \u2014 never crash, never double-spend\nA failed pay returns a STRUCTURED object, never a thrown error you must catch:\n { ok:false, code, reason, explain, ref?, reasonCode?, declined? }\nBranch on `code` (always reliable). Key cases:\n- declined:true with reasonCode:'SESSION_EXPIRED' \u2014 your time budget is over. This\n is TERMINAL: STOP. Do not retry ANY payment this process; it cannot be undone\n without a restart / a longer TTL.\n- declined:true with reasonCode:'APPROVAL' \u2014 a human (or hook) declined this\n payment. Terminal for this pay: do NOT auto-retry \u2014 they said no, or no one\n answered.\n- declined:true with reasonCode:'OUTSIDE_WINDOW' \u2014 your rolling rate-limit is\n exhausted. Wait for it to free, then retry; do not raise the amount.\n- declined:true with reasonCode:'POLICY' or 'BUDGET' \u2014 a spend cap or allowlist\n refused it. Don't retry the same payment; pick a cheaper/allowed one.\n- code:'INSUFFICIENT_FUNDS' \u2014 top up the wallet (token and/or native gas), retry.\n- code:'PAYMENT_TIMEOUT' / 'MAX_RETRIES_EXCEEDED' / 'CONFIRMATION_TIMEOUT' \u2014 the\n payment may ALREADY be on-chain. Recover using the proof on `.ref` (re-verify\n or re-submit it); never re-pay \u2014 a fresh payment would double-spend. On a gasless\n exact rail `.ref` is the authorization NONCE, not a tx hash: re-present the SAME\n signed authorization, never sign a fresh one (that would risk a double-spend).\n- code:'NO_COMPATIBLE_ACCEPT' / 'UNSUPPORTED_SCHEME' \u2014 the 402 isn't payable on\n your chain/scheme; `explain` says whether it's the wrong chain or a scheme to enable.\n If it's a standard x402 server offering an exact rail, that's a config fix the operator makes\n once (enable the exact scheme); report it, don't retry the same call blindly.\n\n## Knowing your leash \u2014 call piprail_budget\npiprail_budget tells you how much budget and time you have left, per\n(network, asset), plus your spend so far. Read-only; moves no funds. Use it in\nMode A to self-check before paying.\n\n## Two modes\n- Mode A (headless, default): you run FREE inside a pre-set budget + time\n envelope. The policy IS the consent \u2014 there is no per-payment prompt. Stay\n inside it; piprail_budget shows what's left.\n- Mode B (supervised): the host may ask a human to approve each payment. A\n decline/cancel/timeout comes back as declined:true (reasonCode:'APPROVAL') \u2014\n do NOT retry it as if it were a transient error.\n\n## Hard facts\n- Spend caps are PER (network, asset). There is no single cross-token dollar cap \u2014\n budgets aren't summed across tokens (no price oracle).\n- Spend totals and the time envelope live IN-MEMORY for THIS process; they reset on restart\n (a convenience, not a durable ledger).\n";
5562
+ declare const PIPRAIL_AGENT_GUIDE = "# Paying with PipRail \u2014 the agent contract\n\nYou can pay for x402 \"402 Payment Required\" resources autonomously. Money moves\nstraight from your wallet to the server; PipRail custodies nothing. Follow this.\n\n## Landing cold \u2014 read the self-description\nEvery PipRail 402 self-describes. Read challenge.extensions.piprail for { name, what, pay[]\n(each rail's how-to-pay), sdk.install, mcp, docs } \u2014 never guess what an endpoint is. If your\ntooling can't pay a rail (e.g. a stock x402 client can't pay the onchain-proof scheme), the\nblock says how: install @piprail/sdk (npm i @piprail/sdk) or run the MCP (npx -y @piprail/mcp)\nand pay with the tools below.\n\n## The loop: quote \u2192 plan \u2192 pay\n1. piprail_quote_payment(url) \u2014 PRICE it. Returns the amount, token, chain, and\n whether it is within your spend policy. No funds move. Use it to decide if a\n resource is worth buying.\n2. piprail_plan_payment(url) \u2014 can I afford it NOW? Reads your balance, native gas,\n and recipient-readiness across every rail, and returns { payable, best,\n fundingHint, session? }. If payable is false, do NOT attempt the payment \u2014\n fundingHint says exactly what to fix.\n3. piprail_pay_request(url, method?, body?) \u2014 PAY (only if the plan was payable)\n and return the result.\nAlways plan before you pay so you never commit to a payment you cannot finish.\n\n## Gasless \u2014 the exact rail (zero gas for you)\nA 402 may offer up to two rails; you don't choose per payment \u2014 the client does, automatically:\n- onchain-proof (PipRail's default): you broadcast the payment yourself and pay the network gas\n (the native coin \u2014 ETH/SOL/\u2026). Works on every chain.\n- exact (the ratified x402 rail, opt-in): you only SIGN; the server \u2014 or a facilitator it chose\n (e.g. PayAI) \u2014 broadcasts it, so you pay ZERO gas (you need only the token, no native coin). It\n works on EVM + Solana, and the on-chain method (EIP-3009 / Permit2 / SVM) is picked automatically.\nWhen the exact scheme is enabled AND balance-aware routing is on, paying picks the cheapest\nsettleable rail \u2014 i.e. the gasless exact one. Nothing changes in your loop: quote \u2192 plan \u2192 pay is\nidentical. The exact scheme is OPT-IN by the operator (MCP: PIPRAIL_SCHEMES=onchain-proof,exact);\nyou can't enable it yourself, but you can report when a 402 needs it (see UNSUPPORTED_SCHEME below).\n\n## Reading a refusal \u2014 never crash, never double-spend\nA failed pay returns a STRUCTURED object, never a thrown error you must catch:\n { ok:false, code, reason, explain, ref?, reasonCode?, declined? }\nBranch on `code` (always reliable). Key cases:\n- declined:true with reasonCode:'SESSION_EXPIRED' \u2014 your time budget is over. This\n is TERMINAL: STOP. Do not retry ANY payment this process; it cannot be undone\n without a restart / a longer TTL.\n- declined:true with reasonCode:'APPROVAL' \u2014 a human (or hook) declined this\n payment. Terminal for this pay: do NOT auto-retry \u2014 they said no, or no one\n answered.\n- declined:true with reasonCode:'OUTSIDE_WINDOW' \u2014 your rolling rate-limit is\n exhausted. Wait for it to free, then retry; do not raise the amount.\n- declined:true with reasonCode:'POLICY' or 'BUDGET' \u2014 a spend cap or allowlist\n refused it. Don't retry the same payment; pick a cheaper/allowed one.\n- code:'INSUFFICIENT_FUNDS' \u2014 top up the wallet (token and/or native gas), retry.\n- code:'PAYMENT_TIMEOUT' / 'MAX_RETRIES_EXCEEDED' / 'CONFIRMATION_TIMEOUT' \u2014 the\n payment may ALREADY be on-chain. Recover using the proof on `.ref` (re-verify\n or re-submit it); never re-pay \u2014 a fresh payment would double-spend. On a gasless\n exact rail `.ref` is the authorization NONCE, not a tx hash: re-present the SAME\n signed authorization, never sign a fresh one (that would risk a double-spend).\n- code:'NO_COMPATIBLE_ACCEPT' / 'UNSUPPORTED_SCHEME' \u2014 the 402 isn't payable on\n your chain/scheme; `explain` says whether it's the wrong chain or a scheme to enable.\n If it's a standard x402 server offering an exact rail, that's a config fix the operator makes\n once (enable the exact scheme); report it, don't retry the same call blindly.\n\n## Knowing your leash \u2014 call piprail_budget\npiprail_budget tells you how much budget and time you have left, per\n(network, asset), plus your spend so far. Read-only; moves no funds. Use it in\nMode A to self-check before paying.\n\n## Two modes\n- Mode A (headless, default): you run FREE inside a pre-set budget + time\n envelope. The policy IS the consent \u2014 there is no per-payment prompt. Stay\n inside it; piprail_budget shows what's left.\n- Mode B (supervised): the host may ask a human to approve each payment. A\n decline/cancel/timeout comes back as declined:true (reasonCode:'APPROVAL') \u2014\n do NOT retry it as if it were a transient error.\n\n## Hard facts\n- Spend caps are PER (network, asset). There is no single cross-token dollar cap \u2014\n budgets aren't summed across tokens (no price oracle).\n- Spend totals and the time envelope live IN-MEMORY for THIS process; they reset on restart\n (a convenience, not a durable ledger).\n";
5554
5563
  /** Returns {@link PIPRAIL_AGENT_GUIDE} (a parity accessor for callers that prefer a function). */
5555
5564
  declare function agentGuide(): string;
5556
5565
 
@@ -5588,6 +5597,104 @@ declare function classifyChallenge(challenge: X402Challenge, opts: {
5588
5597
  schemes: readonly PaymentScheme[];
5589
5598
  }): ChallengeTriage;
5590
5599
 
5600
+ /**
5601
+ * Self-description — make a PipRail 402 announce WHAT it is and HOW to pay it, to
5602
+ * humans, AI agents, and crawlers alike, on BOTH schemes. PURE: a builder that turns
5603
+ * the `accepts[]` a gate already resolved into an inert, additive metadata block; it
5604
+ * does NO I/O and imports NO chain library (protocol layer — STANDARDS §1, viem-free).
5605
+ *
5606
+ * The block rides at `challenge.extensions.piprail`, ALONGSIDE the rejection
5607
+ * `{ code, detail }` (the gate deep-merges so neither clobbers the other). x402 v2
5608
+ * treats `extensions` as an opaque bag a standard client ignores, so this is
5609
+ * purely-additive: the pay path, `accepts[]`, headers, and status stay byte-identical.
5610
+ *
5611
+ * Its whole point: even an `onchain-proof`-only endpoint that a stock x402 client
5612
+ * CANNOT pay is no longer invisible — a stranger reads `sdk.install`, runs
5613
+ * `npm i @piprail/sdk`, pastes the snippet, and pays. For the non-EVM families that
5614
+ * have NO standard `exact` rail, this block is the ENTIRE interop story, so the
5615
+ * `onchain-proof` instruction is deliberately chain-agnostic.
5616
+ *
5617
+ * NOT WIRED here — this is the pure builder (discoverability plan, Phase 1). The gate
5618
+ * wires it into every challenge in Phase 5 (default-on, with a `selfDescribe:false`
5619
+ * opt-out that restores the byte-identical default).
5620
+ */
5621
+
5622
+ /**
5623
+ * The canonical PipRail brand strings — the SINGLE source of truth for the install
5624
+ * command, the paste-ready snippet, and the docs links, read by the self-describe
5625
+ * block here, and (later phases) the landing page, the `llms.txt` entry, and the
5626
+ * agent guide. `<your-chain>` / `<this-url>` are deliberate placeholders — never guess
5627
+ * the reader's chain or URL.
5628
+ */
5629
+ declare const BRAND: {
5630
+ readonly name: "PipRail";
5631
+ readonly home: "https://piprail.com";
5632
+ readonly docs: "https://docs.piprail.com";
5633
+ readonly payDocs: "https://docs.piprail.com/paying";
5634
+ readonly sdkInstall: "npm i @piprail/sdk";
5635
+ readonly sdkSnippet: string;
5636
+ readonly mcpRun: "npx -y @piprail/mcp";
5637
+ };
5638
+ /**
5639
+ * One payable rail as the self-describe block presents it — the static, agent- and
5640
+ * human-readable view of an `accepts[]` entry (no nonce; this is long-lived metadata).
5641
+ */
5642
+ interface SelfDescribeRail {
5643
+ scheme: 'onchain-proof' | 'exact';
5644
+ network: string;
5645
+ asset: string;
5646
+ payTo: string;
5647
+ /** Amount in the token's base units (already scaled by decimals). */
5648
+ amount: string;
5649
+ /** Human-readable amount, e.g. "0.01", when the gate resolved one. */
5650
+ amountFormatted?: string;
5651
+ symbol?: string;
5652
+ /** A one-line instruction for paying THIS rail — chain-agnostic for `onchain-proof`. */
5653
+ how: string;
5654
+ }
5655
+ /** The `extensions.piprail` self-description block. Inert, purely-additive metadata. */
5656
+ interface SelfDescription {
5657
+ name: 'PipRail';
5658
+ protocol: 'x402';
5659
+ version: '2';
5660
+ /** One sentence: what this endpoint is. */
5661
+ what: string;
5662
+ /** Every rail the 402 offers, in the same order as `accepts[]`. */
5663
+ pay: SelfDescribeRail[];
5664
+ /** How to pay programmatically with the SDK. */
5665
+ sdk: {
5666
+ install: string;
5667
+ snippet: string;
5668
+ };
5669
+ /** How to pay via the MCP server (for AI agents). */
5670
+ mcp: {
5671
+ run: string;
5672
+ tool: string;
5673
+ };
5674
+ docs: {
5675
+ home: string;
5676
+ agents: string;
5677
+ pay: string;
5678
+ };
5679
+ /** Where the open discovery artifacts live on this origin. */
5680
+ discovery: {
5681
+ openapi: string;
5682
+ wellKnown: string;
5683
+ };
5684
+ /** A one-line human summary (the gate sets it from `describeChallenge`). */
5685
+ instruction?: string;
5686
+ }
5687
+ /**
5688
+ * Build the `extensions.piprail` self-describe block from a challenge's resolved
5689
+ * `accepts[]`. PURE — every rail is derived from data the gate already has (no new
5690
+ * data, no I/O). `instruction` is the optional one-line human summary the gate computes
5691
+ * via `describeChallenge` (in `render.ts`) and passes in.
5692
+ */
5693
+ declare function buildSelfDescription(input: {
5694
+ accepts: X402AnyAccept[];
5695
+ instruction?: string;
5696
+ }): SelfDescription;
5697
+
5591
5698
  /**
5592
5699
  * Discovery — make a gated resource FINDABLE, by emitting the open-standard
5593
5700
  * artifacts a crawler/index reads. PURE: this file turns the config a gate
@@ -5670,6 +5777,28 @@ interface ManifestInput {
5670
5777
  }
5671
5778
  /** What `x-generator` stamps when attribution is on — see {@link ManifestInput.attribution}. */
5672
5779
  declare const GENERATOR = "@piprail/sdk \u00B7 https://piprail.com";
5780
+ /**
5781
+ * The "powered by" marker for the `x-powered-by` HTTP header — the response-side twin of the
5782
+ * `/openapi.json` {@link GENERATOR} stamp. Inert metadata; opt out with `attribution:false`.
5783
+ * **ASCII-only on purpose:** this is an HTTP header value, and Node's `setHeader` writes header
5784
+ * values as latin1 — a non-ASCII separator (e.g. `·` U+00B7) would arrive mangled (`·`) and is
5785
+ * RFC-7230-discouraged. {@link GENERATOR} keeps its `·` because it only lands in UTF-8 JSON bodies.
5786
+ */
5787
+ declare const POWERED_BY = "PipRail x402 | https://piprail.com";
5788
+ /**
5789
+ * Machine-readable discovery pointers for a gated endpoint's HTTP responses — a `Link` header
5790
+ * (RFC 8288) pointing crawlers/agents at the discovery docs, plus a tasteful `x-powered-by`
5791
+ * marker. Spread the result into BOTH the 402 challenge response AND the 200 settlement
5792
+ * response, so a payer / agent / crawler learns what served them on every hit (this is also
5793
+ * how the 200 "receipt" self-advertises — no change to the `X402Receipt` body needed). PURE —
5794
+ * returns a header bag the merchant sets; the SDK serves nothing. `attribution:false` omits
5795
+ * `x-powered-by` (parity with the `x-generator` opt-out on the OpenAPI doc). If you already set
5796
+ * a `Link` header, comma-merge it with this one rather than blindly spreading (object spread
5797
+ * would replace it).
5798
+ */
5799
+ declare function discoveryHeaders(opts?: {
5800
+ attribution?: boolean;
5801
+ }): Record<string, string>;
5673
5802
  /** A minimal, valid OpenAPI 3.1 document carrying `x-payment-info` per paid op. */
5674
5803
  interface OpenApiDocument {
5675
5804
  openapi: '3.1.0';
@@ -5940,6 +6069,17 @@ interface RequirePaymentOptions {
5940
6069
  * challenge byte-identical to before.
5941
6070
  */
5942
6071
  discovery?: boolean | DiscoveryDescriptor;
6072
+ /**
6073
+ * Self-describe every 402 — stamp an `extensions.piprail` block (identity · per-rail
6074
+ * how-to-pay · `npm i @piprail/sdk` + snippet · MCP · docs + discovery pointers) so the
6075
+ * instant any human, AI agent, or crawler lands on this endpoint — even the default
6076
+ * `onchain-proof` scheme a stock x402 client can't pay — it knows what it is and how to
6077
+ * pay it. **Default `true`.** It is purely-additive metadata a standard client ignores
6078
+ * (the spec treats `extensions` as opaque), so the pay path, `accepts[]`, headers, and
6079
+ * status are byte-identical. Set `false` to omit the block entirely (the literal
6080
+ * byte-identical default of before this feature). See {@link buildSelfDescription}.
6081
+ */
6082
+ selfDescribe?: boolean;
5943
6083
  }
5944
6084
  type VerifyPaymentResult = {
5945
6085
  kind: 'paid';
@@ -6003,6 +6143,13 @@ interface PaymentGate {
6003
6143
  * discovery metadata is long-lived. Read-only — moves nothing on-chain.
6004
6144
  */
6005
6145
  describe(resourceUrl?: string): Promise<ResourceDescription>;
6146
+ /**
6147
+ * Render a self-describing HTML page for a challenge — for the HUMAN who opens the gated
6148
+ * URL in a browser. Pass the challenge you already built with {@link PaymentGate.challenge};
6149
+ * serve the result with `content-type: text/html` when the request's `Accept` is `text/html`.
6150
+ * The SDK never serves it itself (headless by charter). Agents/crawlers keep the JSON 402.
6151
+ */
6152
+ landingPage(challenge: X402Challenge): string;
6006
6153
  }
6007
6154
  /**
6008
6155
  * Framework-agnostic core. Build one gate per gated resource and reuse it
@@ -6062,6 +6209,28 @@ interface FacilitatorPaymentRequirements {
6062
6209
  maxTimeoutSeconds: number;
6063
6210
  extra: Record<string, unknown>;
6064
6211
  }
6212
+ /** One (scheme, network) pair a facilitator's `GET /supported` advertises. */
6213
+ interface FacilitatorSupportedKind {
6214
+ scheme: string;
6215
+ /** As the facilitator reports it — a CAIP-2 id or a slug. */
6216
+ network: string;
6217
+ /** The fee-payer pubkey when the kind carries one (SVM rails). */
6218
+ feePayer?: string;
6219
+ }
6220
+ /**
6221
+ * Parse a facilitator `/supported` body into its advertised (scheme, network) kinds.
6222
+ * PURE + tolerant: a malformed body yields `[]`. Mirrors the `{ kinds: [...] }` shape
6223
+ * {@link fetchFacilitatorFeePayer} reads. Useful for verifying coverage before wiring a gate,
6224
+ * and for generating the coverage doc from live reads.
6225
+ */
6226
+ declare function parseFacilitatorSupported(body: unknown): FacilitatorSupportedKind[];
6227
+ /**
6228
+ * Read a facilitator's LIVE coverage from `GET /supported`. Best-effort + bounded (an
6229
+ * `AbortController` timeout): NEVER throws — returns `[]` on any failure (same posture as
6230
+ * {@link fetchFacilitatorFeePayer}). Lets an operator/agent ask "does this facilitator
6231
+ * cover my network?" before wiring a gate. Pure `fetch`, no chain libraries (STANDARDS §1).
6232
+ */
6233
+ declare function facilitatorCoverage(url: string, timeoutMs?: number): Promise<FacilitatorSupportedKind[]>;
6065
6234
  /** A merchant-chosen facilitator: its base URL + optional per-request auth headers. */
6066
6235
  interface FacilitatorConfig {
6067
6236
  /** Base URL, e.g. 'https://x402.org/facilitator' (trailing slash stripped). */
@@ -6094,6 +6263,51 @@ interface SettleViaFacilitatorInput extends FacilitatorConfig {
6094
6263
  */
6095
6264
  declare function settleViaFacilitator(input: SettleViaFacilitatorInput): Promise<VerifyResult>;
6096
6265
 
6266
+ /**
6267
+ * Facilitator coverage — the honest, chain-agnostic DATA map of which third-party x402
6268
+ * facilitators settle the `exact` scheme on which networks. PURE DATA: imports only the
6269
+ * `Caip2` type from `x402.ts` — zero chain libraries (protocol layer, STANDARDS §1).
6270
+ *
6271
+ * Why it exists: the `exact: true` shorthand (discoverability plan, Phase 7) and an
6272
+ * operator picking a facilitator both need to know "is there a known KEYLESS facilitator
6273
+ * for my chain?" — WITHOUT a hosted registry (charter: no backend). This map is the SEED;
6274
+ * the live truth is `facilitatorCoverage(url)` in `facilitator.ts`, which reads a
6275
+ * facilitator's `GET /supported`. The map is grown ONLY from a verified `/supported`
6276
+ * read — every entry carries a dated verification comment, never a guess.
6277
+ */
6278
+
6279
+ /** One facilitator known to settle `exact` on a given network. */
6280
+ interface KnownFacilitator {
6281
+ /** Base URL (no trailing slash), e.g. `https://facilitator.payai.network`. */
6282
+ url: string;
6283
+ /** True when it needs NO API key — buyer AND merchant pay zero gas (the facilitator sponsors it). */
6284
+ keyless: boolean;
6285
+ /** The x402 schemes it settles (today only `exact`). */
6286
+ schemes: ReadonlyArray<'exact'>;
6287
+ /** The exact transfer methods it can settle on this network. */
6288
+ settles: ReadonlyArray<'eip3009' | 'permit2' | 'svm'>;
6289
+ /** A short human note (who it is / caveat). */
6290
+ note?: string;
6291
+ }
6292
+ /**
6293
+ * Seed map: CAIP-2 network → facilitators that settle `exact` there. Deliberately
6294
+ * CONSERVATIVE — only endpoint-verified entries. Extend it only after a live
6295
+ * `facilitatorCoverage()` read confirms a new (facilitator, network) pair. A merchant on
6296
+ * a network not listed here passes an explicit `exact: { settle: { facilitator } }`.
6297
+ *
6298
+ * NOTE: `x402.org/facilitator` is intentionally ABSENT — it is a Base **Sepolia** testnet
6299
+ * facilitator (verified), not a mainnet rail; seeding it would be a false coverage claim.
6300
+ */
6301
+ declare const KNOWN_FACILITATORS: Readonly<Record<Caip2, ReadonlyArray<KnownFacilitator>>>;
6302
+ /** Known facilitators for a network — an empty array when none is seeded. */
6303
+ declare function knownFacilitatorsFor(network: Caip2): ReadonlyArray<KnownFacilitator>;
6304
+ /**
6305
+ * The first KEYLESS facilitator that settles `exact` on `network` (optionally for a
6306
+ * specific transfer `method`). Returns `undefined` when none is known — the `exact: true`
6307
+ * shorthand branches on that to throw a coverage-specific guidance error.
6308
+ */
6309
+ declare function firstKeylessFacilitator(network: Caip2, method?: 'eip3009' | 'permit2' | 'svm'): KnownFacilitator | undefined;
6310
+
6097
6311
  /**
6098
6312
  * Reliable receipt delivery — the durable webhook a stateless gate can't be.
6099
6313
  *
@@ -6793,4 +7007,28 @@ declare const PERMIT2_WITNESS_TYPES: {
6793
7007
  }];
6794
7008
  };
6795
7009
 
6796
- export { type AcceptOption, type AddressId, type AgentTool, type AlgorandToken, type AptosToken, type AssetId, type BazaarExtension, type BuildExactParams, CHAINS, type Caip2, type ChainFamily, type ChainInput, type ChainName, type ChainPreset, type ChainSelector, type ChallengeTriage, type ChallengeVerdict, type ConfirmInfo, ConfirmationTimeoutError, type CostEstimate, DIRECTORY_INFO, type DeclineReasonCode, type DeliverAttempt, type DeliverReceiptOptions, type DeliverResult, type DirectoryInfo, type DiscoverOptions, type DiscoveredRail, type DiscoveredResource, type DiscoveryDescriptor, type DiscoverySigner, type DiscoverySource, type DomainClaim, type DomainVerification, EIP3009_TYPES, EXACT_NETWORK_SLUGS, type EvmToken, type ExactAccept, type ExactAuthorization, type ExactAuthorizationWire, type ExactPaymentPayload, type ExactPaymentPayloadAny, 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, PERMIT2_ADDRESS, PERMIT2_PROXY_CHAIN_IDS, PERMIT2_WITNESS_TYPES, PIPRAIL_AGENT_GUIDE, type PaidReceipt, type ParsedExactPayment, type PayBlocker, type PayOption, type PayWarning, PaymentDeclinedError, type PaymentDriver, type PaymentGate, type PaymentIntent, type PaymentPlan, type PaymentPolicy, type PaymentRail, type PaymentScheme, PaymentTimeoutError, type Permit2Authorization, type Permit2PaymentPayload, PipRailClient, type PipRailClientOptions, type PipRailCostQuote, PipRailError, type PipRailEvent, type PipRailQuote, type PolicyDecision, type PolicyDenyCode, REGISTER_ATTRIBUTION, RecipientNotReadyError, type RecipientReason, type RegisterInput, type RegisterOptions, type RegisterOutcome, type RequirePaymentOptions, type ResolveOptions, type ResolvedChain, type ResolvedNetwork, type ResolvedToken, type ResourceDescription, type SearchOpenIndexesOptions, type SessionBudget, type SettleOutcome, type SettleViaFacilitatorInput, SettlementError, type SolanaToken, type SpendAssetTotal, type SpendRecord, type SpendRemaining, type SpendSummary, type StellarToken, type SuiToken, type TokenInfo, type TokenInput, type TonToken, type ToolAnnotations, type TronToken, UnknownTokenError, UnsupportedNetworkError, UnsupportedSchemeError, type VerifyErrorCode, type VerifyPaymentResult, type VerifyResult, type WalletBalance, type WalletHandle, type WalletInput, WalletRequiredError, type WellKnownX402, WrongChainError, WrongFamilyError, type X402AcceptEntry, type X402AnyAccept, type X402Challenge, type X402DnsRecord, type X402ExactAcceptEntry, type X402InvalidBody, type X402PaymentSignature, type X402Receipt, type X402ResourceObject, X402_EXACT_PERMIT2_PROXY, type XrplToken, agentGuide, appendAttribution, buildBazaarExtension, buildChallengeHeader, buildExactAuthorization, buildExactSignatureHeader, buildOpenApi, buildReceiptHeader, buildSignatureHeader, buildWellKnownX402, buildX402DnsTxt, chainIdForExactNetwork, claim402IndexDomain, classifyChallenge, createPaymentGate, decorateOutcome, deliverReceipt, eip3009Abi, encodeXPaymentHeader, evaluatePolicy, explainDecline, formatSpendReport, getDirectoryInfo, isPermit2ProxyChain, normalizeNetwork, parseChallenge, parseExactPaymentHeader, parseExactRequirements, parseReceipt, parseSettleResponse, parseSignatureHeader, paymentTools, pickAccept, planAcross, readExactDomain, register402Index, registerDriver, registerX402Scan, requirePayment, resolveChain, searchOpenIndexes, settleViaFacilitator, summarizePlan, toInsufficientFundsError, toInvalidBody, verify402IndexDomain };
7010
+ /**
7011
+ * Landing page — a tiny, self-contained HTML representation of a 402, for the HUMAN
7012
+ * who opens a gated URL in a browser (agents/crawlers still get the unchanged JSON 402).
7013
+ * PURE string templating; imports only the `SelfDescription` type — zero I/O, zero chain
7014
+ * libraries (protocol layer, STANDARDS §1).
7015
+ *
7016
+ * The SDK NEVER serves this itself (it's headless by charter). The merchant opts in by
7017
+ * branching on the request's `Accept` header in their own handler and returning this
7018
+ * string with `content-type: text/html`. See `gate.landingPage(challenge)`.
7019
+ *
7020
+ * SECURITY: every interpolated field is HTML-escaped (a `payTo` / instruction can be
7021
+ * merchant- or rail-influenced) — global rule: escape all user-/data-influenced content.
7022
+ */
7023
+
7024
+ /**
7025
+ * Render a self-describing HTML 402 landing page from a {@link SelfDescription}. Leads with the
7026
+ * one-line instruction and a prominent CAUTION — payment must go through an x402 client; a manual
7027
+ * send to the address won't unlock the resource and isn't matched to the request (it lands in the
7028
+ * merchant's wallet uncredited). Then the primary "How to pay" (the `npm i @piprail/sdk` install +
7029
+ * paste-ready snippet + MCP command), and finally the per-rail "Payment details" table (scheme ·
7030
+ * chain · amount · settles-to) for transparency. Fully static — no script, no external asset.
7031
+ */
7032
+ declare function renderLandingPage(sd: SelfDescription): string;
7033
+
7034
+ export { type AcceptOption, type AddressId, type AgentTool, type AlgorandToken, type AptosToken, type AssetId, BRAND, type BazaarExtension, type BuildExactParams, CHAINS, type Caip2, type ChainFamily, type ChainInput, type ChainName, type ChainPreset, type ChainSelector, type ChallengeTriage, type ChallengeVerdict, type ConfirmInfo, ConfirmationTimeoutError, type CostEstimate, DIRECTORY_INFO, type DeclineReasonCode, type DeliverAttempt, type DeliverReceiptOptions, type DeliverResult, type DirectoryInfo, type DiscoverOptions, type DiscoveredRail, type DiscoveredResource, type DiscoveryDescriptor, type DiscoverySigner, type DiscoverySource, type DomainClaim, type DomainVerification, EIP3009_TYPES, EXACT_NETWORK_SLUGS, type EvmToken, type ExactAccept, type ExactAuthorization, type ExactAuthorizationWire, type ExactPaymentPayload, type ExactPaymentPayloadAny, type ExactRailOption, type ExpressLikeMiddleware, type ExpressLikeNext, type ExpressLikeRequest, type ExpressLikeResponse, type FacilitatorConfig, type FacilitatorPaymentRequirements, type FacilitatorSupportedKind, GENERATOR, HEADER_REQUIRED, HEADER_RESPONSE, HEADER_RESPONSE_V1, HEADER_SIGNATURE, HEADER_SIGNATURE_V1, InsufficientFundsError, InvalidEnvelopeError, KNOWN_FACILITATORS, type KnownFacilitator, type ListingVisibility, type ManifestInput, MaxRetriesExceededError, MissingDriverError, type NearToken, NoCompatibleAcceptError, NonReplayableBodyError, type OpenApiDocument, type OpenApiOperation, PERMIT2_ADDRESS, PERMIT2_PROXY_CHAIN_IDS, PERMIT2_WITNESS_TYPES, PIPRAIL_AGENT_GUIDE, POWERED_BY, type PaidReceipt, type ParsedExactPayment, type PayBlocker, type PayOption, type PayWarning, PaymentDeclinedError, type PaymentDriver, type PaymentGate, type PaymentIntent, type PaymentPlan, type PaymentPolicy, type PaymentRail, type PaymentScheme, PaymentTimeoutError, type Permit2Authorization, type Permit2PaymentPayload, PipRailClient, type PipRailClientOptions, type PipRailCostQuote, PipRailError, type PipRailEvent, type PipRailQuote, type PolicyDecision, type PolicyDenyCode, REGISTER_ATTRIBUTION, RecipientNotReadyError, type RecipientReason, type RegisterInput, type RegisterOptions, type RegisterOutcome, type RequirePaymentOptions, type ResolveOptions, type ResolvedChain, type ResolvedNetwork, type ResolvedToken, type ResourceDescription, type SearchOpenIndexesOptions, type SelfDescribeRail, type SelfDescription, type SessionBudget, type SettleOutcome, type SettleViaFacilitatorInput, SettlementError, type SolanaToken, type SpendAssetTotal, type SpendRecord, type SpendRemaining, type SpendSummary, type StellarToken, type SuiToken, type TokenInfo, type TokenInput, type TonToken, type ToolAnnotations, type TronToken, UnknownTokenError, UnsupportedNetworkError, UnsupportedSchemeError, type VerifyErrorCode, type VerifyPaymentResult, type VerifyResult, type WalletBalance, type WalletHandle, type WalletInput, WalletRequiredError, type WellKnownX402, WrongChainError, WrongFamilyError, type X402AcceptEntry, type X402AnyAccept, type X402Challenge, type X402DnsRecord, type X402ExactAcceptEntry, type X402InvalidBody, type X402PaymentSignature, type X402Receipt, type X402ResourceObject, X402_EXACT_PERMIT2_PROXY, type XrplToken, agentGuide, appendAttribution, buildBazaarExtension, buildChallengeHeader, buildExactAuthorization, buildExactSignatureHeader, buildOpenApi, buildReceiptHeader, buildSelfDescription, buildSignatureHeader, buildWellKnownX402, buildX402DnsTxt, chainIdForExactNetwork, claim402IndexDomain, classifyChallenge, createPaymentGate, decorateOutcome, deliverReceipt, describeChallenge, discoveryHeaders, eip3009Abi, encodeXPaymentHeader, evaluatePolicy, explainDecline, facilitatorCoverage, firstKeylessFacilitator, formatSpendReport, getDirectoryInfo, isPermit2ProxyChain, knownFacilitatorsFor, normalizeNetwork, parseChallenge, parseExactPaymentHeader, parseExactRequirements, parseFacilitatorSupported, parseReceipt, parseSettleResponse, parseSignatureHeader, paymentTools, pickAccept, planAcross, readExactDomain, register402Index, registerDriver, registerX402Scan, renderLandingPage, requirePayment, resolveChain, searchOpenIndexes, settleViaFacilitator, summarizePlan, toInsufficientFundsError, toInvalidBody, verify402IndexDomain };