Callcium

Getting Started

Install the Callcium TypeScript SDK and build your first policy.

The Callcium TypeScript SDK is an offchain library for building, validating, and enforcing Callcium policies. It produces canonical policy bytes, reports semantic validation issues, and evaluates ABI-encoded calldata against a policy.

Install

bun 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 a ValidationError carrying every issue it finds, of any severity. PolicyEnforcer evaluates ABI-encoded calldata against a built policy. Use it for offchain enforcement and tests.

import { PolicyEnforcer } from "@callcium/sdk";

const result = PolicyEnforcer.check(policy, calldata);
if (!result.ok) {
  console.error(result.violations);
}

Next steps

On this page