Getting Started
Install the Callcium TypeScript SDK and build your first policy.
The Callcium TypeScript SDK is an offchain library for building, validating, and simulating Callcium policies. It produces canonical policy bytes, reports semantic validation issues, and evaluates ABI-encoded calldata against a policy. Use it for tooling, tests, preflight checks before submitting a transaction, and policy inspection.
Install
bun add @callcium/sdkpnpm add @callcium/sdknpm install @callcium/sdkyarn add @callcium/sdkDefine a policy
A policy targets a function signature and applies constraints to its arguments.
import { PolicyBuilder, arg } from "@callcium/sdk";
const allowed = [TREASURY, OPS_MULTISIG];
// function withdraw(address to, uint256 amount)
const policy = PolicyBuilder
.create("withdraw(address,uint256)")
.add(arg(0).isIn(allowed)) // to
.add(arg(1).lte(1_000n * 10n ** 18n)) // amount
.build();build() returns a canonical binary policy as a 0x-prefixed Hex string. Pass that blob to the enforcer, store it, or encode it into a transaction.
Validate and enforce
PolicyBuilder.build() validates the policy at build time and throws CallciumError("VALIDATION_ERROR") on the first error-severity issue. PolicyEnforcer evaluates ABI-encoded calldata against a built policy. Use it for simulation, tests, and preflight checks.
import { PolicyEnforcer } from "@callcium/sdk";
const result = PolicyEnforcer.check(policy, calldata);
if (!result.ok) {
console.error(result.violations);
}Next steps
- Constraints: full operator reference for arguments and transaction context.
- Policy Validation: inspect validation issues without throwing.
- Policy Enforcement: pass calldata and execution context to the enforcer.
- Policy Inspection: decode and introspect a policy blob.