Pre-release — The API surface may change. Unaudited.
Callcium LogoCallcium

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/sdk
pnpm add @callcium/sdk
npm install @callcium/sdk
yarn add @callcium/sdk

Define 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

On this page