@callcium/sdk 0.11.1 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/index.d.ts +683 -622
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2297 -2051
- package/dist/index.js.map +1 -1
- package/package.json +13 -10
- package/src/bytes.ts +9 -25
- package/src/calldata-reader.ts +3 -3
- package/src/constants.ts +156 -82
- package/src/constraint.ts +61 -33
- package/src/descriptor-coder.ts +139 -125
- package/src/descriptor.ts +82 -292
- package/src/errors.ts +38 -30
- package/src/hint.ts +237 -0
- package/src/index.ts +30 -12
- package/src/operators.ts +173 -242
- package/src/path.ts +7 -32
- package/src/policy-builder.ts +205 -190
- package/src/policy-coder.ts +1160 -536
- package/src/policy-enforcer.ts +499 -488
- package/src/policy-validator.ts +563 -1045
- package/src/signature.ts +7 -11
- package/src/type-desc.ts +12 -12
- package/src/types.ts +232 -136
- package/src/validation-issue.ts +78 -465
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
TypeScript SDK for the [Callcium](https://callcium.dev) policy engine.
|
|
4
4
|
|
|
5
|
-
Callcium defines type-safe constraints on ABI-encoded data, such as function arguments or a raw payload with no selector, using value ranges, set membership, array quantifiers, and transaction context. This SDK builds policies into canonical policy bytes and
|
|
5
|
+
Callcium defines type-safe constraints on ABI-encoded data, such as function arguments or a raw payload with no selector, using value ranges, set membership, array quantifiers, and transaction context. This SDK builds policies into canonical policy bytes, validates them, and enforces them offchain against ABI-encoded data such as transaction calldata.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -53,7 +53,7 @@ const policy = PolicyBuilder.create("swap((address,address,uint256))")
|
|
|
53
53
|
// struct Transfer { address to; uint256 value; }
|
|
54
54
|
// function batch(Transfer[] transfers)
|
|
55
55
|
const policy = PolicyBuilder.create("batch((address,uint256)[])")
|
|
56
|
-
.add(arg(0).lengthBetween(
|
|
56
|
+
.add(arg(0).lengthBetween(1n, 50n)) // transfers.length
|
|
57
57
|
.add(arg(0, Quantifier.ALL, 0).notIn(denied)) // transfers[*].to
|
|
58
58
|
.add(arg(0, Quantifier.ALL, 1).lte(1n * 10n ** 18n)) // transfers[*].value
|
|
59
59
|
.build();
|