Skip to Content
API ReferenceAPI Reference

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

Package overview

PackageInstallPurpose
@txfence/coreRequiredPolicy engine, pipeline runner, interfaces
@txfence/evm+ 1 chain adapterEVM adapter (Ethereum, Arbitrum, Optimism, Base)
@txfence/solana+ 1 chain adapterSolana adapter with SPL token support
@txfence/cosmos+ 1 chain adapterCosmos SDK adapter (cosmoshub-4, osmosis-1)
@txfence/redisOptionalDistributed cap locking across processes
@txfence/storage-pgOptionalPostgreSQL receipt storage
@txfence/storage-sqliteOptionalSQLite receipt storage for local dev
@txfence/auditOptionalAppend-only compliance audit log
@txfence/monitorOptionalOn-chain reconciliation and alert monitor
@txfence/verifyOptionalFormal verification + adversarial stress testing
@txfence/provenanceOptionalCryptographic hash-chained provenance + Merkle proofs
@txfence/mcpOptionalMCP server for AI assistant integration
@txfence/cliOptionalCLI for simulation, policy checking, and diffs
@txfence/reactOptionalReact 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