PolicyBuilder
Fluent builder for Callcium policies.
PolicyBuilder
Fluent API for drafting policies from constraints.
Methods
create
Create a builder from a function signature.
function create(signature: string): PolicyBuilder;Parameters
| Name | Type | Description |
|---|---|---|
signature | string | The function signature (for example "transfer(address,uint256)"). |
Returns
PolicyBuilder — A new builder.
createRaw
Create a selectorless builder from a comma-separated type list.
function createRaw(typesCsv: string): PolicyBuilder;Parameters
| Name | Type | Description |
|---|---|---|
typesCsv | string | The comma-separated ABI types (for example "uint256,address"). |
Returns
PolicyBuilder — A new builder.
add
Add a constraint to the active group. A path through Quantifier.ALL or Quantifier.ANY adds its operators to the
body of the group's loop over that array with that quantifier.
function add(constraint: Constraint): this;Parameters
| Name | Type | Description |
|---|---|---|
constraint | Constraint | The constraint to add. |
Returns
this — This builder.
or
Start a new constraint group (OR semantics between groups).
function or(): this;Returns
this — This builder.
build
Build the policy blob and validate it.
function build(): `0x${string}`;Returns
`0x${string}` — The encoded policy.
validate
Validate the policy the builder contains.
function validate(): Issue[];Returns
Issue[] — Every issue validation reports on the encoded policy.
buildUnsafe
Build the policy blob without validation. The resulting policy can be invalid.
function buildUnsafe(): `0x${string}`;Returns
`0x${string}` — The encoded policy.