Skip to content

Commit 4d1e65e

Browse files
author
azeth-sync[bot]
committed
sync: update from monorepo 2026-03-06
1 parent 186b5ef commit 4d1e65e

File tree

1 file changed

+66
-6
lines changed

1 file changed

+66
-6
lines changed

src/types/registry.ts

Lines changed: 66 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,79 @@
11
import type { EntityType } from './participant.js';
22
import type { WeightedReputation } from './reputation.js';
33

4+
/** Accepted payment method for a catalog entry.
5+
* Providers can accept payments on multiple chains and tokens. */
6+
export interface CatalogAccepts {
7+
/** CAIP-2 network identifier (e.g., "eip155:84532" for Base Sepolia) */
8+
network: string;
9+
/** ERC-20 token contract address on the specified network.
10+
* Use "0x0000000000000000000000000000000000000000" for native ETH. */
11+
asset: `0x${string}`;
12+
/** Human-readable token symbol for display (e.g., "USDC", "ETH") */
13+
symbol?: string;
14+
}
15+
16+
/** HTTP methods supported by catalog entries */
17+
export type CatalogMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
18+
419
/** A single offering in a service provider's catalog.
20+
*
521
* Multi-service providers list their offerings here, each with its own
6-
* path (relative to the base endpoint), pricing, and description. */
22+
* path, pricing, capabilities, and accepted payment methods.
23+
*
24+
* Catalogs are OFF-CHAIN — served from the provider's endpoint (e.g.,
25+
* `GET {endpoint}/.well-known/azeth-catalog.json`). They may be included
26+
* in the initial tokenURI as a snapshot/fallback, but are NOT updated
27+
* on-chain. Providers update their catalog by updating their endpoint.
28+
*
29+
* Design rationale:
30+
* - Catalogs are operational (change frequently) vs identity (change rarely).
31+
* - x402 V2 has no catalog/directory standard — its Discovery extension
32+
* is facilitator-facing, not agent-facing.
33+
* - Google A2A x402 targets single resources per task, no catalog concept.
34+
* - This schema fills the gap: structured enough for autonomous agent
35+
* routing, lightweight enough for off-chain provider responses. */
736
export interface CatalogEntry {
837
/** Display name for this offering */
938
name: string;
10-
/** URL path relative to the provider's base endpoint (e.g., "/v1/price/{coin}") */
39+
/** URL path relative to the provider's base endpoint.
40+
* Supports path parameters in curly braces (e.g., "/{coinId}").
41+
* The full URL is constructed as `${endpoint}${path}`. */
1142
path: string;
12-
/** Listed price (e.g., "$0.001/request", "Free") */
13-
pricing?: string;
43+
/** HTTP method. Defaults to "GET" when omitted. */
44+
method?: CatalogMethod;
1445
/** What this offering does */
1546
description?: string;
47+
/** Listed price (e.g., "$0.01/request", "Free", "$10/month").
48+
* Informational — actual settlement price comes from the x402 402 response. */
49+
pricing?: string;
50+
/** Response content type. Defaults to "application/json" when omitted. */
51+
mimeType?: string;
52+
/** Capabilities specific to this catalog entry for granular smart_pay matching.
53+
* If omitted, the entry inherits from the parent service's capabilities. */
54+
capabilities?: string[];
55+
/** Path parameter descriptions. Keys are parameter names (matching `{param}` in path),
56+
* values are human-readable descriptions with valid options.
57+
* Example: `{ "coinId": "bitcoin, ethereum, solana, usd-coin" }` */
58+
params?: Record<string, string>;
59+
/** Whether this endpoint requires x402 payment. Defaults to true when omitted.
60+
* Set to false for free endpoints (health checks, listings, metadata). */
61+
paid?: boolean;
62+
/** Accepted payment methods for this offering. Each entry specifies a
63+
* network + asset pair the provider will accept.
64+
* If omitted, inherits from the x402 402 response at call time. */
65+
accepts?: CatalogAccepts[];
1666
}
1767

68+
/** Maximum number of entries in a service catalog (practical limit for API responses) */
69+
export const CATALOG_MAX_ENTRIES = 20;
70+
71+
/** Maximum path length for a catalog entry */
72+
export const CATALOG_MAX_PATH_LENGTH = 512;
73+
74+
/** Valid HTTP methods for catalog entries */
75+
export const CATALOG_METHODS: readonly CatalogMethod[] = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'] as const;
76+
1877
export interface RegistryEntry {
1978
tokenId: bigint;
2079
owner: `0x${string}`;
@@ -27,8 +86,9 @@ export interface RegistryEntry {
2786
/** Listed service price (e.g., "$0.01/request"). Informational — actual
2887
* settlement price comes from the x402 402 response at transaction time. */
2988
pricing?: string;
30-
/** Service catalog for multi-service providers. Each entry describes one
31-
* offering with its own path, pricing, and description. Optional — single-service
89+
/** Off-chain service catalog for multi-service providers. Each entry describes
90+
* one offering with its own path, pricing, and description. Populated from the
91+
* provider's endpoint, not from on-chain storage. Optional — single-service
3292
* providers use the top-level endpoint and pricing instead. */
3393
catalog?: CatalogEntry[];
3494
active: boolean;

0 commit comments

Comments
 (0)