API Reference
txfence is TypeScript-first. Every function, type, and interface is fully typed. No any. The discriminated union return types from runPipeline force you to handle every outcome at compile time.
Packages
@txfence/core@txfence/evm@txfence/solana@txfence/cosmos@txfence/redis@txfence/storage-pg@txfence/storage-sqlite@txfence/audit@txfence/monitor@txfence/verify@txfence/provenance@txfence/mcp@txfence/cli@txfence/react
Package overview
| Package | Install | Purpose |
|---|---|---|
@txfence/core | Required | Policy engine, pipeline runner, interfaces |
@txfence/evm | + 1 chain adapter | EVM adapter (Ethereum, Arbitrum, Optimism, Base) |
@txfence/solana | + 1 chain adapter | Solana adapter with SPL token support |
@txfence/cosmos | + 1 chain adapter | Cosmos SDK adapter (cosmoshub-4, osmosis-1) |
@txfence/redis | Optional | Distributed cap locking across processes |
@txfence/storage-pg | Optional | PostgreSQL receipt storage |
@txfence/storage-sqlite | Optional | SQLite receipt storage for local dev |
@txfence/audit | Optional | Append-only compliance audit log |
@txfence/monitor | Optional | On-chain reconciliation and alert monitor |
@txfence/verify | Optional | Formal verification + adversarial stress testing |
@txfence/provenance | Optional | Cryptographic hash-chained provenance + Merkle proofs |
@txfence/mcp | Optional | MCP server for AI assistant integration |
@txfence/cli | Optional | CLI for simulation, policy checking, and diffs |
@txfence/react | Optional | React hooks for frontend integration |
TypeScript design
Every PipelineResult is a discriminated union on status. TypeScript enforces that you handle every case:
const result = await agent.submit({ action, policy })
switch (result.status) {
case 'success':
console.log(result.receipt.txHash)
break
case 'policy_rejected':
console.log(result.evaluation.rejectionReason)
break
case 'simulation_failed':
console.log(result.simulation.revertReason)
break
case 'approval_timeout':
console.log('Human approval timed out — transaction cancelled')
break
case 'execution_failed':
console.log(result.reason)
break
}No implicit any. No silent failures at runtime.
Last updated on