compact-core:compact-witness-ts
OfficialImplement Compact witnesses in TypeScript
System Documentation
What problem does it solve?
Helps developers implement the TypeScript half of Compact contracts by explaining compiler-generated types, the WitnessContext pattern, private state design, Compact-to-TypeScript type mappings, and how to bind witnesses to the Contract runtime so implementations type-check and interoperate with on-chain contracts.
Core Features & Use Cases
- Type mapping and runtime validation: clear mapping of Compact primitives and ADTs to TypeScript types and notes about runtime bounds and length checks.
- Witness implementation patterns: canonical WitnessContext usage, the [PrivateState, ReturnValue] tuple pattern, state-mutating and side-effect witnesses, ledger-reading witnesses, and contract-address keyed state scoping.
- Contract runtime & verification: guidance for using the generated Contract class, pureCircuits vs impureCircuits, ledger parsing, and mechanical verification to ensure witness implementations match compiled interfaces.
- Use Case: implement a local_secret_key witness that reads a 32-byte secret from private state, bind it to the compiled Contract, and run verification before deploying.
Quick Start
Implement a TypeScript witnesses file for mycontract that returns a 32-byte Uint8Array secret from private state, bind it to the generated Contract class, and verify the implementation against the compiled types.
Dependency Matrix
Required Modules
None requiredComponents
💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: compact-core:compact-witness-ts Download link: https://github.com/devrelaicom/midnight-expert/archive/main.zip#compact-core-compact-witness-ts Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.