x402-safe-fetch 0.3.0 → 0.3.1

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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  A `fetch` for AI agents that checks an unknown x402 endpoint before paying it.
4
4
 
5
- A free endpoint is answered as is. For a paid one (HTTP 402), your agent first pays **$0.001** for an [x402 Doctor](https://x402-doctor.onrender.com) preflight and acts on it:
5
+ A free endpoint is answered as is. For a paid one (HTTP 402), your agent first pays **$0.001** for an [x402 Doctor](https://x402-doctor.fizzl.eu) preflight and acts on it:
6
6
 
7
7
  | Preflight | What `safeFetch` does |
8
8
  |---|---|
@@ -35,7 +35,7 @@ const safeFetch = createSafeFetch({
35
35
  });
36
36
 
37
37
  try {
38
- const res = await safeFetch("https://ichimoku-signal.onrender.com/signal/BTC-USDT");
38
+ const res = await safeFetch("https://ichimoku-signal.fizzl.eu/signal/BTC-USDT");
39
39
  console.log(await res.json());
40
40
  } catch (err) {
41
41
  if (err instanceof SafePayError) console.log(err.code, err.message, err.preflight?.reasons);
package/index.d.ts CHANGED
@@ -5,7 +5,7 @@ export declare const PREFLIGHT_CAP: string;
5
5
  export declare const BASE: "eip155:8453";
6
6
  export declare const SOLANA: "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
7
7
 
8
- /** The x402 Doctor preflight: see https://x402-doctor.onrender.com/openapi.json */
8
+ /** The x402 Doctor preflight: see https://x402-doctor.fizzl.eu/openapi.json */
9
9
  export interface Preflight {
10
10
  verdict: "go" | "caution" | "no_go";
11
11
  summary?: string;
package/index.js CHANGED
@@ -21,7 +21,7 @@ import { verifyReceipt, DOCTOR_SIGNERS, AUTHORITY } from "./receipt.js";
21
21
 
22
22
  export { verifyReceipt, recoverSigner, canonicalJson, inputHash, certMessage, DOCTOR_SIGNERS, AUTHORITY } from "./receipt.js";
23
23
 
24
- export const DOCTOR_URL = "https://x402-doctor.onrender.com";
24
+ export const DOCTOR_URL = "https://x402-doctor.fizzl.eu";
25
25
  export const PREFLIGHT_CAP = "$0.002"; // the preflight costs $0.001; never more than twice that
26
26
  export const BASE = "eip155:8453";
27
27
  export const SOLANA = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x402-safe-fetch",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "A fetch for AI agents that checks an unknown x402 endpoint ($0.001 x402 Doctor preflight) before paying it, and never pays above your budget.",
5
5
  "type": "module",
6
6
  "exports": {
package/receipt.js CHANGED
@@ -4,15 +4,17 @@
4
4
  // README). safe-fetch checks that receipt before acting on a preflight, so a
5
5
  // tampered or forged "go" never leads to a payment.
6
6
  //
7
- // Canonical JSON: keys sorted at every level, no whitespace, non-ASCII as
8
- // \uXXXX (the same bytes as Python's json.dumps(sort_keys=True,
9
- // separators=(",", ":"), ensure_ascii=True)).
7
+ // Canonical JSON (profile js-json-stringify-sorted-utf16-ascii-v1): keys
8
+ // sorted by UTF-16 code units at every level, no whitespace, every code unit
9
+ // from U+007F up as lowercase \uXXXX, numbers as JSON.stringify writes them,
10
+ // UTF-8 bytes. Python's json.dumps matches only for ASCII keys and integers; a
11
+ // Python equivalent: github.com/Fizzl13/presign-guard/blob/main/examples/canonical.py
10
12
 
11
13
  import { createHash } from "node:crypto";
12
14
  import { secp256k1 } from "@noble/curves/secp256k1";
13
15
  import { keccak_256 } from "@noble/hashes/sha3";
14
16
 
15
- // Doctor's published signers (https://x402-doctor.onrender.com/.well-known/x402-doctor-signer.json).
17
+ // Doctor's published signers (https://x402-doctor.fizzl.eu/.well-known/x402-doctor-signer.json).
16
18
  // Pinned here on purpose: a signer list fetched from the same server would not
17
19
  // protect against that server being compromised.
18
20
  export const DOCTOR_SIGNERS = ["0xAaE66eF9Ee234397df33901568c8FBc36d43277d"];