@kashscript/trade-core
v0.1.0
Published
Deterministic Kash-Trade kernel — universal FSM, dust-free BPS splitter, manifest compile, Trust-Score, and the off-chain↔on-chain state projection. Pure logic; no I/O.
Downloads
43
Readme
@kashscript/trade-core
The deterministic kernel of the Kash-Trade Suite. Universal trade state machine, dust-free BPS splitter, manifest compiler, deterministic Trust-Score, and the off-chain↔on-chain state projection — pure TypeScript, no I/O, no chain calls.
⚠ Commercial package (SSLA Schedule B). Production use requires an active paid Plan on the Kash-Registry. See LICENSE.
bun add @kashscript/trade-core @kashscript/identity-coreWhere it sits
trade-core is the pure-logic foundation; @kashscript/trade-sdk builds on it with chains, EIP-712 signals, ERC-4337, the CLI, and the Solidity contracts. The relationship mirrors identity-core → identity-sdk: a zero-I/O core that anything can embed, plus an SDK that brings in the outside world.
| Package | Responsibility |
|---|---|
| @kashscript/trade-core | Deterministic kernel: FSM, splitter, manifest compile, Trust-Score, on-chain projection. No network, no storage, no chain calls. |
| @kashscript/trade-sdk | Everything that touches the outside world: hydration, EIP-712 quorum, CREATE2 deploys, gasless (ERC-4337), CLI, Solidity contracts. Depends on trade-core. |
Because the kernel is pure and deterministic, an off-chain preview projects onto the exact on-chain TradeState the contracts report — that's what projectToOnChainState guarantees.
What's in the box
| Subpath | Purpose |
|---|---|
| @kashscript/trade-core | Re-exports the kernel + Trust-Score + contracts envelope |
| @kashscript/trade-core/trust-score | Deterministic 0..1 counterparty Trust-Score from settled-trade history |
| @kashscript/trade-core/contracts | Chain-agnostic trade envelope + adapter interface |
| @kashscript/trade-core/kernel | Kernel barrel — FSM, splitter, manifest, types, errors, on-chain bridge |
| @kashscript/trade-core/kernel/fsm | Universal state machine across all five paradigms |
| @kashscript/trade-core/kernel/splitter | Dust-free BPS payout math |
| @kashscript/trade-core/kernel/manifest | Deterministic manifest compile + invariant validation |
| @kashscript/trade-core/kernel/types | TypeScript types for every paradigm |
| @kashscript/trade-core/kernel/errors | Typed KashTradeError codes |
The five paradigms — OTDC, Subscription, Escrow, Auction, Milestone — are the canonical set (CANONICAL_PARADIGMS), matching the on-chain TradeType enum. projectToOnChainState and the paradigm maps are satisfies-total, so the kernel and the contracts can never silently drift.
Licensing
This is a Schedule B Commercial Package under the KashScript Sovereign Software License Agreement v1.0.
| Use | Plan required |
|-----------------------------|-------------------------|
| Local development / eval | free (no Plan needed) |
| 14-day production trial | trial |
| Production (any user-facing)| paid / team / enterprise |
Run kash login from @kashscript/kash once installed to obtain an
Access Token. The package will function on free for development but
will refuse to operate in Production Use mode without a covering Plan.
See LICENSE for the full terms.
