Catalog npm
Back to packageRELEASE DETAILS

0.1.0

npm

@0x402/underwriter

The Agent A side, as a library: hire an x402 auditor, verify its seal, compose your own around it, publish it, list it — with a budget gate before any signature.

0gagentsealunderwritingx402
Published7 Sept 2026
Direct dependencies7
Transitive dependenciesNot calculated

README

Current package documentation

@0x402/underwriter

The Agent A side, as a library: hire an auditor over x402, verify what it signed, and sign your own seal around it.

npm i @0x402/underwriter
import { underwrite } from "@0x402/underwriter";

const result = await underwrite(
  { token, ltvBps: 7000, source: null, settle: true, publish: true },
  {
    account,                            // your key. Nothing else can sign.
    agentId: "1",
    auditor: { url, agentId: "2" },
    resolver,                           // AgentIdResolver: the directory
    budget,                             // gate, before any signature
    network: "eip155:84532",
    dryRun: false,
    registry,
    rpcUrl,
    onStep: (e) => console.log(e.stage, e.message),
  },
);

// ok:  { ok: true,  kind: "sealed", sealA, sealHash, hire, storage, listing, skipped }
// no:  { ok: false, stage, code, detail, sealA? }

Every stage is a named refusal rather than an exception, so a dead auditor is told apart from a dead RPC by reading the result. dryRun: true — the default path when there is no key — stops at the quote and spends nothing.

Two rules worth knowing

Nothing is signed before the seal B is verified. Agent A runs all eight checks itself; "nobody is watching" is the case this is built for.

A refusal after the seal exists still hands it back. Once the auditor is paid the seal is what the money bought, so a settlement that fails afterwards returns sealA and sealHash on the refusal instead of dropping them. Preconditions that cost nothing to check — a missing registry, say — are checked before anything is spent.

Also exported: makeBudgetGate (per-session and per-hour caps with an on-disk ledger, plus a payee allowlist), agentStatus / usdcBalance / fundingHint, and listWithSeal / mapListError for the registry hop.


Repository · Site · MIT

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 7

Native requirements
7 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
viem
Environment
{
  "local_name": "viem",
  "alias": false,
  "peer_metadata": null
}
^2.23.2runtime
@x402/evm
Environment
{
  "local_name": "@x402/evm",
  "alias": false,
  "peer_metadata": null
}
^2.24.0runtime
@x402/core
Environment
{
  "local_name": "@x402/core",
  "alias": false,
  "peer_metadata": null
}
^2.24.0runtime
@0x402/seal
Environment
{
  "local_name": "@0x402/seal",
  "alias": false,
  "peer_metadata": null
}
0.1.0runtime
@x402/fetch
Environment
{
  "local_name": "@x402/fetch",
  "alias": false,
  "peer_metadata": null
}
^2.24.0runtime
tsx
Environment
{
  "local_name": "tsx",
  "alias": false,
  "peer_metadata": null
}
^4.19.2development
vitest
Environment
{
  "local_name": "vitest",
  "alias": false,
  "peer_metadata": null
}
^3.0.5development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "09b00185378689220e2a98e167e23df91711174c",
  "tarball": "https://registry.npmjs.org/@0x402/underwriter/-/underwriter-0.1.0.tgz",
  "fileCount": 19,
  "integrity": "sha512-nKrXwjNk1TZfCUxi7Tc1JrQZlL9nl6jpL1ZUzAMUldlaVCeeD5I73EJBf9XuStnJTDFuRu4mPIxtlhYrMfT26g==",
  "signatures": [
    {
      "sig": "MEUCIE3RxhVt6Mvhu2OgQ/zW0f4JF6HxqCoPzRIGyhwBQLOOAiEAkOpxK5CX0z++VQm9QYPOipyoCRqIURjHJkqvSXjsf7E=",
      "keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"
    }
  ],
  "unpackedSize": 63522
}

Repository

PENDING
wayneal/0g

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 22:35 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:aedd212e4c3f369ede356b3d872dd0cc883b8d5ddeb09287e3640f96d64280be

Other collected versions

0.1.28 Sept0.1.18 SeptView all collected versions →