Skip to main content

Code samples that run, and pages that say what is missing

CoRelayer
Cooperative Relayer Infrastructure for Autonomous Transactions

Every code sample in the SDK guides, the agent pages and the x402 page is now cut from a file that is type-checked and run by the test suite. A sample cannot drift from the code, because the build copies it in and a test fails when the two differ.

Samples cut from tested files​

There are thirteen files in docosaurus/examples/: a wallet wrapper, a gateway reader, relayer verification, send-and-relay, the re-sign path, preflight, tier choice, buying a plan (through the API and over x402), following an intent (by polling and over SSE), retries, the Relay Unit formula and a complete agent quickstart. A code fence on a page names its source, and the build syncs the fence from that file:

```ts snippet="examples/send-token.ts#relay"
```

The tests run each example against a local fixture of the API and the gateway. The fixture verifies presence proofs and accepts each one only once. It hands out re-sign assignments, walks the x402 flow and streams intent events. It refuses any host other than its own .invalid addresses. So no test contacts a network, and none depends on one being up.

One signature, checked​

Every example that signs goes through the same guard, which throws on a second call:

Error: relayOnce: the signer was called twice.

A test checks that the message the pages quote is the one the guard throws. When the API answers RESIGN_REQUIRED, the example signs the transaction for the relayer the API pinned in that answer. It does not sign a new variant for each candidate. See Handle a re-sign.

New pages​

What is not there yet, said plainly​

  • The MCP server: 4 of its 20 tools run end to end, and its resources and prompts cannot be read yet. The tool list marks which tools work.

  • The JavaScript SDK:

    • its one-call relay cannot yet take the relayer pinned by a re-sign answer;
    • it has no helper for relayer verification, x402, Relay Units or event streams.

    The guides show the plain code for each of these instead.

  • Operations: the usage-proof path, the quota slice allocator, inclusion tracking and settlement batches are listed as gaps on Status and SLOs.

Checked in a browser​

The built site now runs in Chromium with its production headers, including the generated Content-Security-Policy. Each kind of page is checked for accessibility (axe, WCAG 2.2 AA) in both themes, for console errors and for requests to another origin. The layout is checked at nine widths, from a folded phone's 344 px cover screen to a 2560 px ultrawide.