⚠️ 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.
Guides

Guide: Declare a Safe Action

Goal: add a button that signs a transaction — safely.

Declare the action structurally. The runtime constructs the calldata from your declaration; it can only be what you declared:

compose.button("Claim", {
  variant: "primary",
  action: { to: "0x<contract>", sig: "claim(uint256)", args: "$amount" },
});

$amount is filled from the input named amount in the same component. Give the input that name: compose.input({ inputType: "number", placeholder: "Amount", name: "amount" }). It renders as data-cr-name="amount", and the viewer reads it when the user signs. @chainrender/client 0.13.0 or later is needed: earlier versions dropped an input's name at compile time, so a $ argument could never be filled.

At sign time:

import { buildActionRequest, describeAction, splitArgs } from "@chainrender/client/runtime";
// value is the wei the action sends (0n here); readActions(container) returns these from a rendered component
const action = { to: "0x<contract>", sig: "claim(uint256)", value: 0n, args: splitArgs("$amount") };
const tx = buildActionRequest(action, { amount: "1000" });        // calldata = exactly claim(1000)
const human = describeAction(action, { amount: "1000" });         // plain-language for the user to review

A sign (EIP-712) is different: its message is signed exactly as written, and no $name is filled into it. Put literal values that fit their types there, or use the action itself when the user should approve what they typed.

The enforcer guarantees the declaration is honest (R3–R5): the button can't smuggle a different call, target, or hidden value. See Concepts → Actions & Signing.