@smartledger/bsv 4.4.0 → 4.5.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/CHANGELOG.md +29 -0
- package/bsv-covenant.min.js +7 -7
- package/bsv-gdaf.min.js +8 -8
- package/bsv-ltp.min.js +8 -8
- package/bsv-smartcontract.min.js +8 -8
- package/bsv.bundle.js +8 -8
- package/bsv.d.ts +94 -0
- package/bsv.min.js +7 -7
- package/lib/smart_contract/debugger.js +71 -0
- package/lib/smart_contract/dsl.js +129 -0
- package/lib/smart_contract/index.js +68 -55
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,35 @@ All notable changes to SmartLedger-BSV will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [4.5.0] - 2026-06-09
|
|
9
|
+
|
|
10
|
+
### Added — declarative covenant DSL + stack debugger
|
|
11
|
+
|
|
12
|
+
- **`SmartContract.policy()` — a declarative covenant DSL.** Describe a spending
|
|
13
|
+
policy and compile it to a verified OP_PUSH_TX locking script, no opcodes:
|
|
14
|
+
```js
|
|
15
|
+
const c = bsv.SmartContract.policy()
|
|
16
|
+
.payTo(aliceAddr, 9500) // the spend MUST create this output...
|
|
17
|
+
.lockUntil(800000) // ...with nLockTime >= 800000
|
|
18
|
+
.compile()
|
|
19
|
+
// c.lock, c.outputs, c.unlock(spendTx, satoshis)
|
|
20
|
+
```
|
|
21
|
+
Clauses AND together (each compiles to one preimage-field check on a single
|
|
22
|
+
OP_PUSH_TX authentication). `payTo` pins outputs via `hashOutputs`; `lockUntil`
|
|
23
|
+
checks the `nLockTime` field. The compiled `unlock()` grinds the OP_PUSH_TX
|
|
24
|
+
nonce *from the locktime floor upward* so it never collides with a `lockUntil`
|
|
25
|
+
constraint. Shortcuts: `policy.perpetual(fee)`, `policy.token(fee, ownerHash)`.
|
|
26
|
+
- **`SmartContract.trace()` — a covenant stack debugger.** Step-traces a
|
|
27
|
+
locking/unlocking pair and records the stack + alt-stack after every opcode, so
|
|
28
|
+
you can watch an OP_PUSH_TX covenant build its signature and enforce its
|
|
29
|
+
constraints. `SmartContract.Debugger.format(result)` pretty-prints it.
|
|
30
|
+
- **TypeScript types** for the full covenant suite in `bsv.d.ts`
|
|
31
|
+
(`SmartContract.{PushTx,PELS,Token,Locks,CovenantHelpers,policy,Policy,trace,
|
|
32
|
+
Debugger}` + `enableGenesis`/`verifyScript`/`perpetualCovenant`/…).
|
|
33
|
+
|
|
34
|
+
New mocha suite `test/smart_contract/dsl_debugger.js` (7 specs). Full suite
|
|
35
|
+
4199 → 4206 passing. Lint clean; `bsv.d.ts` type-checks.
|
|
36
|
+
|
|
8
37
|
## [4.4.0] - 2026-06-07
|
|
9
38
|
|
|
10
39
|
### Added — BSV string opcodes OP_SUBSTR / OP_LEFT / OP_RIGHT
|