⚠️ Alpha · testnets only. ChainRender is in active alpha and deployed on testnets only — Ethereum Sepolia, the Robinhood Chain Testnet, and the Circle Arc Testnet — not on any mainnet. Contracts, addresses, and APIs may change. Do not use with real funds or production assets.
Reference

Reference: @chainrender/client

Every export, with its signature: SDK API — Every Export (generated from the package source). If a name is not on that page, the package does not export it. The SDK code samples in these docs are type-checked against the SDK in the repository's tests (scripts/check-docs-code.ts), so they compile as written.

The SDK is the headless, framework-agnostic core for authoring, grading, and rendering ChainRender apps. Install:

npm install @chainrender/client viem

Exports

Import Purpose
@chainrender/client Authoring core: compose, checkNode, compileComponent, grade, vocabulary, IR builders, reads, scene binding, presentation context
@chainrender/client/runtime Rendering + actions: renderComponent, renderComponentWithContext, bindSlots, buildActionRequest, describeAction, batchRead, events, themes, local
@chainrender/client/react React components + hooks (ChainRenderView, live-grade badge)
@chainrender/client/miniapp Farcaster Mini App manifest + embed builders

New in 0.21.1

  • The review checks claims (docs/204): grade-claim (a claimed grade, "trustless" or "fully on-chain" must match the computed grade, and be said of the floor in a ⚙ app) and unchecked-claim (words no check can back).
  • Review.notChecked: what the review did not decide, printed by reviewText() under "Not checked by this review". pass and verdict are unchanged.

New in 0.21.0

  • decompile(bytes | hex): CRO2 opcode bytes (VERSION_2 to 5) back to the Node tree, returning { tree, version, mode, nodeCount }. It is exact or it throws: the result is re-compiled and must reproduce the input byte for byte, else DecompileError; unknown tags or attributes, bad lengths and trailing bytes throw too. VERSION_5 decodes with mode: "enhanced", its style tokens as family fields where that reproduces the bytes (else as raw style). Bound slots and images come back with their resolver and encoded arg. This is what the builder's Fork uses (builder/?fork=<hash>&chain=<id>); read the bytes with read(hash) on the registry RenderRouter.registry() returns.

New in 0.20.1

  • Structure CSS only: an explicit size or weight token on a heading now wins over its level's default. No export, field or content hash changes; structureCss() output changes, so its on-chain copy has a new id.

New in 0.20.0 (Enhanced mode)

  • Classic / Enhanced. compile, compileComponent, checkNode, reviewTree and vocabulary take { mode: "classic" | "enhanced" }; Classic is the default. Enhanced adds the VERSION_5 presentation fields (the style registry's token families, hints, lang, dir, heading levels, 54 more WAI-ARIA roles) and the mode issue code, which Classic reports for a V5 field it drops. VERSION_5 renders on Sepolia, Robinhood and Arc (OpcodeInterpreterV5Html, 2026-11-02), and the viewer styles the tokens (docs/202 phase 3). In Enhanced mode reviewTree also runs the presentation rules (presentationFindings: style-token, label-as-style, heading-order, scroll-region, opt-in lang-missing, and v5-unavailable as an error when v5Available: false). See Style Tokens and docs/202.
  • In /runtime, bindSlots leaves cr: slots (viewer reads and transfer histories) alone, and the provider resolvers refuse an arg that is not an address, so such a slot keeps its fallback instead of showing cr:… text.

New in 0.19.0

  • The viewer's own wallet and transfer histories: "$viewer" as the account arg of seven kinds, and bind transfers; grade() lists them in aboveFloor.kinds; honestyFindings reports viewer-read and transfer-history. See Viewer Reads.

New in 0.14.0 – 0.18.3

  • Honesty and privacy findings (honestyFindings, 0.14.0) and their later rules: sketch rules (0.15.0), p5-v1-api (0.17.0), stage-safe-area (0.18.0), sign-message and a wider unbacked-claim (0.18.2), unknown-address worded from the code size (codeSizes, 0.18.3). The table is in MCP Server & Skill.
  • reviewTree / reviewText (0.16.0): the one review every surface reports.
  • Charts from plain values and vocabulary().authoringBinds (0.18.3).
  • The full list is the package's CHANGELOG.

New in 0.13.0

  • An input's name compiles. A button's args: "$amount" is filled from the input named amount (compose.input({ name: "amount" }), rendered as data-cr-name). Earlier versions dropped the name, so a $ argument could not be filled. See Declare a Safe Action.

New in 0.12.0

  • 44 more resolver kinds in RESOLVER_KINDS (110 in all): the generic reads (staticread, multiread, compute, progress), balances, prices, NFTs (nftImage, …), generative media (identicon, gidenticon, sdfscene, …), verifysig, the ENS profile kinds and more. Each descriptor names its implementing contracts. All Resolver Kinds gives every argument and where each contract is deployed.

New in 0.11.0

  • Rich media: encodeSceneBinding / decodeSceneBinding / sceneIdOf / SCENE_FLOOR_SELECTORS (the binding a p5/three app deploys with), checkNode(tree, { authoring: true }) validating image.scene, and grade()'s aboveFloor (⚙; since 0.19.0 also for viewer reads and transfer histories). See Rich Media: p5.js & three.js.
  • Render-time presentation: presentationContext() / emptyContext() and, in /runtime, renderComponentWithContext(dep, hash, ctx). See Theme Without Redeploying.
  • Reading your own contract: the reads namespace (reads.staticReadSlot, reads.callData, reads.FMT, …) — slots that call any view function through the deployed CallResolver.

Core functions

  • compose.* — build a component from the closed vocabulary (box, heading, text, button, image, chart, table, controls, …). Constrained by construction: you can't express outside the vocabulary.
  • compileComponent(node) → { hash, hex, … } — the content-addressed artifact. The hash is the app identity.
  • grade(node, opts?) → { letter, word, locks, envelope, deviations } — the trust grade, drift-locked with the chain. opts.pinnedDep (a raw-CIDv1 IPFS dependency, { protocol:"ipfs", cid }) grades B (Pinned), fail-closed to A if unverifiable; also read from a pinnedDep on the node. Helpers: isVerifiablePinnedDep, pinnedDependencyLevel, pinnedCid, RAW_CIDV1, type PinnedDep.
  • vocabulary() — the machine-readable schema (node types, a11y and behaviour fields, enums, capabilities, resolver kinds), derived from the real constants, so tooling never hardcodes them. See The Vocabulary.
  • checkNode(tree, opts?) → { ok, issues, nodeCount, depth } (0.10.0) — checks a tree against everything compile() reads and reports what it would silently drop (unknown fields, bad enum values, a11y on images, args on batch members) plus the node/depth/size limits. Each issue has a path, a code (unknown-field, ignored-field, authoring-field, required, type, enum, format, limit) and a message. { authoring: true } accepts the builder-only fields — argValues on slots and images, image.scene, a root pinnedDep, and _-prefixed design-time keys (0.10.1).
  • nodeJsonSchema(opts?) (0.10.0) — the same rules as a strict JSON Schema (draft 2020-12), to hand to an AI tool or validator. Also exported: fieldsOf, NODE_TYPES, NODE_ENUMS, TYPE_FIELDS, A11Y_FIELDS, BEHAVIOR_FIELDS, AUTHORING_FIELDS, IGNORED_BY_COMPILE, IGNORED_NESTED, NODE_LIMITS. Every field is listed on Node Fields.
  • kinds / RESOLVER_KINDS — every first-party resolver kind with its args, data edge and capability, plus the per-family encoders (for example kinds.ens.encodeNameArgs(address), kinds.ens.encodeV2Args(resolver, inner, isText)). A descriptor with argsEncoding: "packed" takes raw bytes, not abi.encode. The full list: All Resolver Kinds.

peerDependencies: viem (required); react + the Farcaster miniapp SDK (optional, for those subpaths).

App metadata

The app-metadata seam (see App Metadata) is exposed through the SDK so authoring tools can read and write an app's on-chain descriptive info:

They are under the appmeta namespace (import { appmeta } from "@chainrender/client"):

  • appmeta.encodeAppMeta(obj) → compact JSON string for the scene binding's meta field. Strips empties, size-capped (appmeta.MAX_META_BYTES).
  • appmeta.decodeAppMeta(str) → AppMeta object; never throws, returns { v: 1 } on any malformed input.
  • appmeta.getTitle / getAuthor / getDescription / getKind / getIcon / getCategory / getGrade / getGradeWord / getTags — safe accessors, each takes (meta, fallback?) and never throws.
  • appmeta.gradeLocks(letter) → the lock string for a grade letter ("A" → 🔒🔒🔒, "gear" → ⚙). appmeta.hasMeta(meta) → whether any field beyond the version marker is set.
  • appmeta.APP_META_VERSION — the current metadata schema version (readers are forward-compatible: a v1 reader still reads a future field's neighbours). appmeta.KNOWN_KEYS lists the fields.

All are re-exported from chainc/appmeta.ts, the single source of truth. Adding a field there makes it available everywhere in one edit.