@smartledger/bsv 7.5.6 → 7.5.8

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 CHANGED
@@ -7,6 +7,72 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [7.5.8] - 2026-08-07
11
+
12
+ ### Fixed
13
+
14
+ - **Directory deep imports under `lib/` did not resolve.** The `exports` map carried
15
+ `"./lib/*": "./lib/*.js"`, which maps `lib/script` to `lib/script.js` — a file that
16
+ does not exist, since `script` is a directory. So
17
+ `require('@smartledger/bsv/lib/script')` raised `MODULE_NOT_FOUND`, and the same
18
+ applied to all 16 directory modules (`ordinals`, `smart_contract`, `transaction`,
19
+ `gdaf`, `ltp`, `spv`, `mnemonic`, `vcjwt`, …). Only the explicit
20
+ `lib/script/index.js` form worked.
21
+
22
+ Each directory that has an `index.js` now has an explicit entry pointing at it.
23
+ Non-pattern keys take priority over patterns in Node's resolution, so directories
24
+ resolve through these while files continue to use `"./lib/*"`. Both CommonJS
25
+ `require` and ESM `import` are covered, since the map governs both.
26
+
27
+ Node's fallback-array form (`["./lib/*.js", "./lib/*/index.js"]`) was tried first and
28
+ does **not** work: Node falls through on an *invalid* target, not on a missing file.
29
+
30
+ The regression test enumerates `lib/` at runtime rather than hard-coding names, so a
31
+ new directory module cannot be added without also being exported, and asserts the
32
+ bare and explicit forms return the *same* module object (one cache entry, not two).
33
+
34
+ This is the resolution gap behind the reproduction in the 7.5.7 report: the literal
35
+ line `require('@smartledger/bsv/lib/script')` failed here before it could reach the
36
+ require-cycle defect that release fixed.
37
+
38
+ Suite 4601 → 4603.
39
+
40
+ ## [7.5.7] - 2026-08-07
41
+
42
+ ### Fixed
43
+
44
+ - **`Address` threw whenever `lib/script` was required before `lib/address`.**
45
+ The two modules form a require cycle, and `address.js` ended with the usual idiom
46
+ — export yourself, then `var Script = require('./script')`. That only holds when
47
+ `address` loads first. Reaching `lib/script` first meant the require returned
48
+ script's **partially initialised** exports (`{}`), the captured binding stayed `{}`
49
+ forever, and every `instanceof Script` raised
50
+ `TypeError: Right-hand side of 'instanceof' is not callable`. `var` hoisting hid it,
51
+ since the name is in scope for the functions defined above the assignment.
52
+
53
+ This was reachable, not theoretical: deep imports are public API through the
54
+ `exports` map (`"./lib/*"`), so requiring `lib/script` first is a supported way to
55
+ use the package. Both `Address.fromScript(script)` and `new Address(script)` threw,
56
+ reaching the check through `_transformScript` and `_classifyArguments` respectively.
57
+
58
+ `Script` is now resolved at call time through a small accessor rather than captured
59
+ at module scope. `require` is cached, so it costs nothing, and by the time any of
60
+ these functions run the module is complete — which keeps `instanceof` **exact**
61
+ rather than loosening the check to a structural duck-type that a non-Script object
62
+ could satisfy.
63
+
64
+ - **`scripts/check-address-load-order.js`** guards it, wired into CI and available as
65
+ `npm run check:load-order`. It deliberately lives outside mocha: the check must clear
66
+ `require.cache`, which would invalidate every module reference an in-process suite is
67
+ holding. It exercises `fromScript`, the constructor **and** `payingTo` — the first
68
+ two reach the check by different paths, and `payingTo` reaches the `Script`
69
+ constructor itself. Confirmed to fail against the unpatched module rather than
70
+ passing vacuously.
71
+
72
+ Reported with an accurate reproduction and diagnosis in
73
+ `BUG-address-load-order-instanceof.md`. Suite 4601 (unchanged — the guard is a
74
+ standalone script, by necessity).
75
+
10
76
  ## [7.5.6] - 2026-08-07
11
77
 
12
78
  ### Fixed
package/README.md CHANGED
@@ -186,42 +186,42 @@ console.log('Status:', status) // 'revoked'
186
186
  ### **Core Modules**
187
187
  | Module | Size | Use Case | CDN |
188
188
  |--------|------|----------|-----|
189
- | **bsv.min.js** | 1149KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@7.5.6/bsv.min.js` |
190
- | **bsv.bundle.js** | 1149KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.5.6/bsv.bundle.js` |
189
+ | **bsv.min.js** | 1149KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@7.5.8/bsv.min.js` |
190
+ | **bsv.bundle.js** | 1149KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.5.8/bsv.bundle.js` |
191
191
 
192
192
  ### **W3C Verifiable Credentials**
193
193
  | Module | Size | Use Case | CDN |
194
194
  |--------|------|----------|-----|
195
- | **🟢 bsv-didweb.min.js** | 315KB | **DID:web generation** | `unpkg.com/@smartledger/bsv@7.5.6/bsv-didweb.min.js` |
196
- | **🟢 bsv-vcjwt.min.js** | 315KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@7.5.6/bsv-vcjwt.min.js` |
197
- | **🟢 bsv-statuslist.min.js** | 415KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@7.5.6/bsv-statuslist.min.js` |
198
- | **🟢 bsv-anchor.min.js** | 314KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@7.5.6/bsv-anchor.min.js` |
195
+ | **🟢 bsv-didweb.min.js** | 315KB | **DID:web generation** | `unpkg.com/@smartledger/bsv@7.5.8/bsv-didweb.min.js` |
196
+ | **🟢 bsv-vcjwt.min.js** | 315KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@7.5.8/bsv-vcjwt.min.js` |
197
+ | **🟢 bsv-statuslist.min.js** | 415KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@7.5.8/bsv-statuslist.min.js` |
198
+ | **🟢 bsv-anchor.min.js** | 314KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@7.5.8/bsv-anchor.min.js` |
199
199
 
200
200
  ### **Smart Contract & Development**
201
201
  | Module | Size | Use Case | CDN |
202
202
  |--------|------|----------|-----|
203
- | **bsv-smartcontract.min.js** | 873KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@7.5.6/bsv-smartcontract.min.js` |
204
- | **bsv-covenant.min.js** | 873KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.5.6/bsv-covenant.min.js` |
205
- | **bsv-script-helper.min.js** | 30KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.5.6/bsv-script-helper.min.js` |
206
- | **bsv-security.min.js** | 30KB | Security enhancements | `unpkg.com/@smartledger/bsv@7.5.6/bsv-security.min.js` |
203
+ | **bsv-smartcontract.min.js** | 873KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@7.5.8/bsv-smartcontract.min.js` |
204
+ | **bsv-covenant.min.js** | 873KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.5.8/bsv-covenant.min.js` |
205
+ | **bsv-script-helper.min.js** | 30KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.5.8/bsv-script-helper.min.js` |
206
+ | **bsv-security.min.js** | 30KB | Security enhancements | `unpkg.com/@smartledger/bsv@7.5.8/bsv-security.min.js` |
207
207
 
208
208
  ### **Legal & Compliance**
209
209
  | Module | Size | Use Case | CDN |
210
210
  |--------|------|----------|-----|
211
- | **bsv-ltp.min.js** | 1149KB | Legal Token Protocol | `unpkg.com/@smartledger/bsv@7.5.6/bsv-ltp.min.js` |
212
- | **bsv-gdaf.min.js** | 1149KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@7.5.6/bsv-gdaf.min.js` |
211
+ | **bsv-ltp.min.js** | 1149KB | Legal Token Protocol | `unpkg.com/@smartledger/bsv@7.5.8/bsv-ltp.min.js` |
212
+ | **bsv-gdaf.min.js** | 1149KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@7.5.8/bsv-gdaf.min.js` |
213
213
 
214
214
  ### **Advanced Cryptography**
215
215
  | Module | Size | Use Case | CDN |
216
216
  |--------|------|----------|-----|
217
- | **bsv-shamir.min.js** | 353KB | Threshold Cryptography | `unpkg.com/@smartledger/bsv@7.5.6/bsv-shamir.min.js` |
217
+ | **bsv-shamir.min.js** | 353KB | Threshold Cryptography | `unpkg.com/@smartledger/bsv@7.5.8/bsv-shamir.min.js` |
218
218
 
219
219
  ### **Utilities**
220
220
  | Module | Size | Use Case | CDN |
221
221
  |--------|------|----------|-----|
222
- | **bsv-ecies.min.js** | 79KB | Encryption | `unpkg.com/@smartledger/bsv@7.5.6/bsv-ecies.min.js` |
223
- | **bsv-message.min.js** | 30KB | Message signing | `unpkg.com/@smartledger/bsv@7.5.6/bsv-message.min.js` |
224
- | **bsv-mnemonic.min.js** | 592KB | HD wallets | `unpkg.com/@smartledger/bsv@7.5.6/bsv-mnemonic.min.js` |
222
+ | **bsv-ecies.min.js** | 79KB | Encryption | `unpkg.com/@smartledger/bsv@7.5.8/bsv-ecies.min.js` |
223
+ | **bsv-message.min.js** | 30KB | Message signing | `unpkg.com/@smartledger/bsv@7.5.8/bsv-message.min.js` |
224
+ | **bsv-mnemonic.min.js** | 592KB | HD wallets | `unpkg.com/@smartledger/bsv@7.5.8/bsv-mnemonic.min.js` |
225
225
 
226
226
  ## ⚡ **2-Minute Quick Start**
227
227
 
@@ -232,7 +232,7 @@ Get started with Bitcoin SV development in under 2 minutes:
232
232
  npm install @smartledger/bsv
233
233
 
234
234
  # Or include in HTML
235
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv.min.js"></script>
235
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv.min.js"></script>
236
236
  ```
237
237
 
238
238
  > **🔒 v5.0.0 (production hardening — has breaking changes):** Shamir secret
@@ -332,8 +332,8 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
332
332
 
333
333
  ### 🔧 **Basic Development** (~1.2MB total)
334
334
  ```html
335
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv.min.js"></script>
336
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv-script-helper.min.js"></script>
335
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv.min.js"></script>
336
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-script-helper.min.js"></script>
337
337
  <script>
338
338
  const privateKey = new bsv.PrivateKey();
339
339
  const utxos = new bsv.SmartContract.UTXOGenerator().createRealUTXOs(2, 100000);
@@ -342,9 +342,9 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
342
342
 
343
343
  ### 🔒 **Smart Contract Development** (~2.8MB total — each bundle re-embeds core BSV)
344
344
  ```html
345
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv.min.js"></script>
346
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv-covenant.min.js"></script>
347
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv-smartcontract.min.js"></script>
345
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv.min.js"></script>
346
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-covenant.min.js"></script>
347
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-smartcontract.min.js"></script>
348
348
  <script>
349
349
  const covenant = bsv.SmartContract.createCovenantBuilder()
350
350
  .extractField('amount').push(50000).greaterThanOrEqual().verify().build();
@@ -354,9 +354,9 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
354
354
 
355
355
  ### 🆕 **Legal & Identity Development** (~3.4MB total — each bundle re-embeds core BSV)
356
356
  ```html
357
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv.min.js"></script>
358
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv-ltp.min.js"></script>
359
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv-gdaf.min.js"></script>
357
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv.min.js"></script>
358
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-ltp.min.js"></script>
359
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-gdaf.min.js"></script>
360
360
  <script>
361
361
  // Legal Token Protocol
362
362
  const propertyToken = bsv.createPropertyToken({
@@ -370,9 +370,9 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
370
370
 
371
371
  ### 🆕 **Security & Cryptography** (~1.5MB total)
372
372
  ```html
373
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv.min.js"></script>
374
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv-security.min.js"></script>
375
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv-shamir.min.js"></script>
373
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv.min.js"></script>
374
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-security.min.js"></script>
375
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-shamir.min.js"></script>
376
376
  <script>
377
377
  // Threshold Cryptography
378
378
  const shares = bsv.splitSecret('my_secret_key', 5, 3); // 5 shares, 3 needed
@@ -384,7 +384,7 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
384
384
 
385
385
  ### 🎯 **Everything Bundle** (~1.1MB)
386
386
  ```html
387
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv.bundle.js"></script>
387
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv.bundle.js"></script>
388
388
  <script>
389
389
  // Everything available immediately
390
390
  const shares = bsv.splitSecret('secret', 5, 3); // Shamir Secret Sharing
@@ -494,8 +494,8 @@ const contractTx = covenant.createCovenantTransaction({
494
494
 
495
495
  #### 1. **Minimal Setup** - Core + Script Helper (~1.2MB)
496
496
  ```html
497
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv.min.js"></script>
498
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv-script-helper.min.js"></script>
497
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv.min.js"></script>
498
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-script-helper.min.js"></script>
499
499
  <script>
500
500
  const tx = new bsv.Transaction();
501
501
  const sig = bsvScriptHelper.createSignature(tx, privateKey, 0, script, satoshis);
@@ -504,9 +504,9 @@ const contractTx = covenant.createCovenantTransaction({
504
504
 
505
505
  #### 2. **DeFi Development** - Core + Covenants + Debug (~2.8MB — each bundle re-embeds core BSV)
506
506
  ```html
507
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv.min.js"></script>
508
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv-covenant.min.js"></script>
509
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv-smartcontract.min.js"></script>
507
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv.min.js"></script>
508
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-covenant.min.js"></script>
509
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-smartcontract.min.js"></script>
510
510
  <script>
511
511
  const covenant = new bsvCovenant.CovenantInterface();
512
512
  const debugInfo = SmartContract.interpretScript(script);
@@ -516,8 +516,8 @@ const contractTx = covenant.createCovenantTransaction({
516
516
 
517
517
  #### 3. **Security First** - Core + Enhanced Security (~1.2MB)
518
518
  ```html
519
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv.min.js"></script>
520
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv-security.min.js"></script>
519
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv.min.js"></script>
520
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-security.min.js"></script>
521
521
  <script>
522
522
  const verified = bsvSecurity.SmartVerify.verify(signature, hash, publicKey);
523
523
  const enhanced = bsvSecurity.EllipticFixed.createSignature(privateKey, hash);
@@ -526,7 +526,7 @@ const contractTx = covenant.createCovenantTransaction({
526
526
 
527
527
  #### 4. **Everything Bundle** - One File Solution (~1.1MB)
528
528
  ```html
529
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv.bundle.js"></script>
529
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv.bundle.js"></script>
530
530
  <script>
531
531
  // Everything available under bsv namespace
532
532
  const keys = bsv.SmartLedgerBundle.generateKeys();
@@ -834,7 +834,7 @@ const timelockScript = helper.createTimelockScript(
834
834
 
835
835
  See the **[16 Loading Options](#-16-loading-options---choose-your-approach)**
836
836
  table near the top for the full list of bundles with current sizes and
837
- canonical `unpkg.com/@smartledger/bsv@7.5.6/...` URLs.
837
+ canonical `unpkg.com/@smartledger/bsv@7.5.8/...` URLs.
838
838
 
839
839
  ## 🔐 Security
840
840