@smartledger/bsv 9.0.0 → 9.1.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.
Files changed (155) hide show
  1. package/CHANGELOG.md +137 -0
  2. package/README.md +152 -1041
  3. package/STABILITY.md +134 -0
  4. package/bsv-gdaf.min.js +53 -48
  5. package/bsv-ltp.min.js +23 -18
  6. package/bsv-smartcontract.min.js +18 -18
  7. package/bsv.bundle.js +53 -48
  8. package/bsv.min.js +53 -48
  9. package/docs/MODULE_REFERENCE_COMPLETE.md +27 -27
  10. package/docs/advanced/UTXO_MANAGER_GUIDE.md +1 -1
  11. package/docs/getting-started/INSTALLATION.md +23 -23
  12. package/docs/getting-started/QUICK_START.md +7 -7
  13. package/docs/migration/FROM_BSV_1_5_6.md +5 -5
  14. package/docs/proposals/10.0.0-package-split.md +131 -0
  15. package/index.js +5 -0
  16. package/lib/block/merkleblock.js +19 -5
  17. package/lib/hdprivatekey.js +15 -0
  18. package/lib/script/interpreter.js +109 -1
  19. package/lib/smart_contract/builder.js +14 -0
  20. package/lib/util/deprecate.js +159 -0
  21. package/package.json +19 -82
  22. package/version.js +1 -1
  23. package/.mocharc.json +0 -5
  24. package/test/address.js +0 -629
  25. package/test/block/block.js +0 -239
  26. package/test/block/blockheader.js +0 -270
  27. package/test/block/merkleblock.js +0 -207
  28. package/test/build/bundle_crypto_shim.js +0 -104
  29. package/test/build/bundle_externals.js +0 -125
  30. package/test/build/bundle_smoke.js +0 -55
  31. package/test/build/esbuild_main.js +0 -65
  32. package/test/build/esm_wrapper.js +0 -97
  33. package/test/build/exports_resolution.js +0 -84
  34. package/test/build/version_sync.js +0 -14
  35. package/test/cli/smoke.js +0 -261
  36. package/test/consensus/base58-vectors.js +0 -120
  37. package/test/consensus/sv-script-vectors.js +0 -81
  38. package/test/consensus/sv-sighash-vectors.js +0 -51
  39. package/test/consensus/sv-tx-vectors.js +0 -48
  40. package/test/credentials-test.js +0 -332
  41. package/test/crypto/backend_selection.js +0 -126
  42. package/test/crypto/bn.js +0 -168
  43. package/test/crypto/ecdsa.js +0 -426
  44. package/test/crypto/elliptic-fixed.js +0 -61
  45. package/test/crypto/hash.browser.js +0 -121
  46. package/test/crypto/hash.js +0 -122
  47. package/test/crypto/point.js +0 -193
  48. package/test/crypto/random.js +0 -105
  49. package/test/crypto/security.js +0 -176
  50. package/test/crypto/shamir.js +0 -177
  51. package/test/crypto/shamir_rngcap.js +0 -29
  52. package/test/crypto/signature.js +0 -399
  53. package/test/data/bip69.json +0 -215
  54. package/test/data/bitcoin-sv/README.md +0 -170
  55. package/test/data/bitcoin-sv/base58_encode_decode.json +0 -14
  56. package/test/data/bitcoin-sv/base58_keys_invalid.json +0 -152
  57. package/test/data/bitcoin-sv/base58_keys_valid.json +0 -452
  58. package/test/data/bitcoin-sv/script_tests.json +0 -2591
  59. package/test/data/bitcoin-sv/sighash.json +0 -1003
  60. package/test/data/bitcoin-sv/tx_invalid.json +0 -285
  61. package/test/data/bitcoin-sv/tx_valid.json +0 -367
  62. package/test/data/bitcoind/base58_keys_invalid.json +0 -152
  63. package/test/data/bitcoind/base58_keys_valid.json +0 -452
  64. package/test/data/bitcoind/blocks.json +0 -27
  65. package/test/data/bitcoind/script_tests.json +0 -2244
  66. package/test/data/bitcoind/sig_canonical.json +0 -7
  67. package/test/data/bitcoind/sig_noncanonical.json +0 -22
  68. package/test/data/bitcoind/tx_invalid.json +0 -177
  69. package/test/data/bitcoind/tx_valid.json +0 -224
  70. package/test/data/blk86756-testnet.dat +0 -0
  71. package/test/data/blk86756-testnet.js +0 -12
  72. package/test/data/blk86756-testnet.json +0 -684
  73. package/test/data/brc220-batch-vector.json +0 -129
  74. package/test/data/ecdsa.json +0 -230
  75. package/test/data/merkleblocks.js +0 -486
  76. package/test/data/messages.json +0 -22
  77. package/test/data/sighash.json +0 -1004
  78. package/test/data/tx_creation.json +0 -85
  79. package/test/didweb/relationships.js +0 -144
  80. package/test/ecies/bitcore-ecies.js +0 -178
  81. package/test/ecies/electrum-ecies.js +0 -206
  82. package/test/encoding/base58.js +0 -131
  83. package/test/encoding/base58check.js +0 -145
  84. package/test/encoding/bufferreader.js +0 -328
  85. package/test/encoding/bufferwriter.js +0 -160
  86. package/test/encoding/varint.js +0 -104
  87. package/test/gdaf/anchor_no_key_leak.js +0 -146
  88. package/test/gdaf/anchor_spv.js +0 -163
  89. package/test/gdaf/canonicalization.js +0 -106
  90. package/test/gdaf/canonicalize.js +0 -140
  91. package/test/gdaf/zk_prover.js +0 -204
  92. package/test/hdkeys.js +0 -365
  93. package/test/hdprivatekey.js +0 -339
  94. package/test/hdpublickey.js +0 -293
  95. package/test/index.js +0 -16
  96. package/test/ltp/ids.js +0 -74
  97. package/test/ltp/right.js +0 -198
  98. package/test/ltp/verify_failclosed.js +0 -134
  99. package/test/message/message.js +0 -190
  100. package/test/mnemonic/data/fixtures.json +0 -300
  101. package/test/mnemonic/mnemonic.js +0 -277
  102. package/test/mnemonic/mocha.opts +0 -1
  103. package/test/mnemonic/pbkdf2.test.js +0 -43
  104. package/test/networks.js +0 -207
  105. package/test/notaryhash/batch_leaf.js +0 -140
  106. package/test/notaryhash/batch_vector.js +0 -282
  107. package/test/notaryhash/certificate.js +0 -249
  108. package/test/notaryhash/encoding.js +0 -186
  109. package/test/notaryhash/interop.js +0 -112
  110. package/test/notaryhash/merkle.js +0 -181
  111. package/test/notaryhash/script.js +0 -270
  112. package/test/notaryhash/verify.js +0 -342
  113. package/test/opcode.js +0 -186
  114. package/test/ordinals/bsv20.js +0 -337
  115. package/test/ordinals/inscription.js +0 -329
  116. package/test/ordinals/ordlock.js +0 -567
  117. package/test/privatekey.js +0 -540
  118. package/test/publickey.js +0 -411
  119. package/test/regressions.js +0 -215
  120. package/test/script/chronicle.js +0 -543
  121. package/test/script/defaults.js +0 -160
  122. package/test/script/genesis_limits.js +0 -203
  123. package/test/script/interpreter.js +0 -776
  124. package/test/script/script.js +0 -1259
  125. package/test/script/string_ops.js +0 -88
  126. package/test/security/fail_closed_contracts.js +0 -104
  127. package/test/security/threat_model_coverage.js +0 -31
  128. package/test/smart_contract/covenants.js +0 -207
  129. package/test/smart_contract/dsl_debugger.js +0 -92
  130. package/test/smart_contract/extract_field.js +0 -61
  131. package/test/smart_contract/nonenforcing_guard.js +0 -44
  132. package/test/smart_contract/ordinal_transfer.js +0 -71
  133. package/test/smart_contract/preimage.js +0 -98
  134. package/test/smart_contract/sighash_marketplace.js +0 -98
  135. package/test/smart_contract/token_generalized.js +0 -175
  136. package/test/spv/headerchain.js +0 -86
  137. package/test/spv/merkleproof.js +0 -133
  138. package/test/statuslist/failclosed.js +0 -78
  139. package/test/transaction/deserialize.js +0 -33
  140. package/test/transaction/input/input.js +0 -92
  141. package/test/transaction/input/multisig.js +0 -174
  142. package/test/transaction/input/multisigscripthash.js +0 -111
  143. package/test/transaction/input/publickey.js +0 -68
  144. package/test/transaction/input/publickeyhash.js +0 -59
  145. package/test/transaction/output.js +0 -185
  146. package/test/transaction/sighash.js +0 -91
  147. package/test/transaction/signature.js +0 -127
  148. package/test/transaction/transaction.js +0 -1299
  149. package/test/transaction/unspentoutput.js +0 -97
  150. package/test/types/dts_drift.js +0 -124
  151. package/test/types/surface_honesty.js +0 -102
  152. package/test/util/id.js +0 -72
  153. package/test/util/js.js +0 -76
  154. package/test/util/preconditions.js +0 -79
  155. package/test/vcjwt/interop.js +0 -126
@@ -0,0 +1,159 @@
1
+ 'use strict'
2
+
3
+ /**
4
+ * Runtime deprecation notices.
5
+ *
6
+ * A semver major is a promise that the consumer's code breaks. Between 4.0.0
7
+ * (2026-05-31) and 9.0.0 (2026-08-21) this library made that promise six times,
8
+ * and the mechanism was almost always the same: an API that had become wrong was
9
+ * changed to `throw`, in the same release that decided it was wrong. Correct
10
+ * diagnosis, no warning period.
11
+ *
12
+ * `MerkleBlock#filterdTxsHash` was one of those and now delegates with a notice.
13
+ * `HDPrivateKey#derive` still throws deliberately: its replacements return
14
+ * different keys, so guessing on the caller's behalf risks funds. That is the
15
+ * narrow exception in STABILITY.md, not a gap in this module.
16
+ *
17
+ * The fix is not to keep bad APIs. It is to separate the moment we say "this is
18
+ * wrong" from the moment we break callers:
19
+ *
20
+ * minor mark it. Callers see a warning naming the replacement, and keep
21
+ * working. `removeIn` states the version that will break them.
22
+ * major remove it, on a schedule announced at least one minor in advance.
23
+ *
24
+ * Deprecating is therefore a NON-breaking act and belongs in a minor. That is
25
+ * what makes a long-lived 9.x possible: correctness fixes ship continuously,
26
+ * breakage batches into one planned major with a migration path already in the
27
+ * consumer's logs.
28
+ *
29
+ * Nothing here ever throws. A deprecation that throws is just a breaking change
30
+ * wearing a warning's name.
31
+ */
32
+
33
+ var seen = Object.create(null)
34
+
35
+ /** Every notice fired this process, for tests and for `--audit`-style tooling. */
36
+ var fired = []
37
+
38
+ /**
39
+ * Warnings are on unless explicitly silenced. Consumers who have logged the
40
+ * migration and do not want the noise set BSV_NO_DEPRECATION_WARNINGS=1; the
41
+ * record in `fired` is kept either way so tooling still sees it.
42
+ */
43
+ // Guarded like every other process.env read in lib/ (see lib/smartutxo.js,
44
+ // lib/browser-utxo-manager.js). This module is inlined into every feature bundle,
45
+ // and `exports` publishes lib/ subpaths directly, so an unguarded read here is a
46
+ // ReferenceError in any browser bundler that does not shim `process`.
47
+ var enabled = !(typeof process !== 'undefined' && process.env &&
48
+ process.env.BSV_NO_DEPRECATION_WARNINGS === '1')
49
+
50
+ /**
51
+ * `what` is the one field with no sensible default: it is the string the notice is
52
+ * keyed and deduplicated on. Everything else degrades gracefully.
53
+ */
54
+ function assertOpts (opts, caller) {
55
+ if (!opts || typeof opts.what !== 'string' || opts.what === '') {
56
+ throw new TypeError(caller + '() requires { what: string }')
57
+ }
58
+ }
59
+
60
+ function format (opts) {
61
+ var msg = '[@smartledger/bsv] ' + opts.what + ' is deprecated'
62
+ if (opts.since) msg += ' since ' + opts.since
63
+ msg += '.'
64
+ if (opts.why) msg += ' ' + opts.why.charAt(0).toUpperCase() + opts.why.slice(1) + '.'
65
+ if (opts.use) msg += ' Use ' + opts.use + ' instead.'
66
+ msg += opts.removeIn
67
+ ? ' It will be removed in ' + opts.removeIn + '.'
68
+ : ' A removal version has not been set; it will not be removed in a 9.x release.'
69
+ return msg
70
+ }
71
+
72
+ /**
73
+ * Emit a deprecation notice at most once per `what` per process.
74
+ *
75
+ * @param {object} opts
76
+ * @param {string} opts.what the API being deprecated, as a caller writes it
77
+ * @param {string} [opts.since] version that deprecated it
78
+ * @param {string} [opts.removeIn] version that will remove it (a major)
79
+ * @param {string} [opts.use] the replacement, as a caller would write it
80
+ * @param {string} [opts.why] one clause; why it is wrong, not what to do
81
+ * @returns {boolean} true if this call emitted (false if already seen)
82
+ */
83
+ function deprecate (opts) {
84
+ if (!opts || !opts.what) throw new TypeError('deprecate() requires { what }')
85
+ if (seen[opts.what]) return false
86
+ seen[opts.what] = true
87
+
88
+ var message = format(opts)
89
+ fired.push({
90
+ what: opts.what,
91
+ since: opts.since || null,
92
+ removeIn: opts.removeIn || null,
93
+ use: opts.use || null,
94
+ message: message
95
+ })
96
+ if (enabled) console.warn(message)
97
+ return true
98
+ }
99
+
100
+ /**
101
+ * Wrap a function so calling it warns once, then behaves exactly as before.
102
+ * Preserves name, arity and `this`, so it is safe on prototype methods.
103
+ *
104
+ * Klass.prototype.old = deprecate.fn(Klass.prototype.old, {
105
+ * what: 'Klass#old', since: '9.1.0', removeIn: '10.0.0', use: 'Klass#new'
106
+ * })
107
+ */
108
+ deprecate.fn = function (fn, opts) {
109
+ if (typeof fn !== 'function') throw new TypeError('deprecate.fn() requires a function')
110
+ // Validate HERE, not inside the wrapper. Deferring it meant `deprecate.fn(f)` wrapped
111
+ // cleanly and then threw on every subsequent call — turning a deprecation into the
112
+ // breaking change this module exists to avoid, at a call site far from the mistake.
113
+ // Wrapping is a one-time author action; failing there is loud, immediate and cheap.
114
+ assertOpts(opts, 'deprecate.fn')
115
+ var wrapper = function () {
116
+ deprecate(opts)
117
+ return fn.apply(this, arguments)
118
+ }
119
+ Object.defineProperty(wrapper, 'name', { value: fn.name, configurable: true })
120
+ Object.defineProperty(wrapper, 'length', { value: fn.length, configurable: true })
121
+ wrapper.__wrapped = fn
122
+ wrapper.__deprecation = opts
123
+ return wrapper
124
+ }
125
+
126
+ /**
127
+ * Deprecate a property access (an alias namespace, a renamed field).
128
+ * Warns on first read; the value is computed once and cached.
129
+ */
130
+ deprecate.property = function (target, name, get, opts) {
131
+ assertOpts(opts, 'deprecate.property')
132
+ var cached
133
+ var loaded = false
134
+ Object.defineProperty(target, name, {
135
+ configurable: true,
136
+ enumerable: true,
137
+ get: function () {
138
+ deprecate(opts)
139
+ if (!loaded) { cached = get(); loaded = true }
140
+ return cached
141
+ }
142
+ })
143
+ return target
144
+ }
145
+
146
+ /** Notices fired this process, in order. */
147
+ deprecate.fired = function () { return fired.slice() }
148
+
149
+ /** Silence output. The `fired` record is still kept. */
150
+ deprecate.setEnabled = function (v) { enabled = !!v }
151
+ deprecate.isEnabled = function () { return enabled }
152
+
153
+ /** Test hook: forget what has been warned about. */
154
+ deprecate.reset = function () {
155
+ seen = Object.create(null)
156
+ fired.length = 0
157
+ }
158
+
159
+ module.exports = deprecate
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@smartledger/bsv",
3
- "version": "9.0.0",
4
- "description": "🚀 Complete Bitcoin SV development framework with legally-recognizable DID:web + W3C VC-JWT toolkit, Legal Token Protocol (LTP), Global Digital Attestation Framework (GDAF), StatusList2021 revocation, and 16 flexible loading options. Standards-based credentials with ES256/ES256K support, on-chain BSV anchoring, and comprehensive Bitcoin SV API. Perfect for legal tokens, verifiable credentials, DeFi, smart contracts, and secure Bitcoin applications.",
3
+ "version": "9.1.0",
4
+ "description": "Bitcoin SV library with an interpreter-verified script engine: OP_PUSH_TX covenants, BIP-143 preimage tooling, and consensus flags that match what miners actually enforce. Also ships DID:web / W3C VC-JWT credentials and the Legal Token Protocol.",
5
5
  "author": "SmartLedger Technology <hello@smartledger.technology> (https://smartledger.technology)",
6
6
  "homepage": "https://github.com/codenlighten/smartledger-bsv#readme",
7
7
  "bugs": {
@@ -98,10 +98,12 @@
98
98
  "test:browser": "echo 'Open tests/standalone-modules-test.html in browser for comprehensive testing'",
99
99
  "test:bundle": "echo 'Open tests/bundle-completeness-test.html in browser to verify bundle completeness'",
100
100
  "preimage:extract": "node examples/preimage/extract_preimage_bidirectional.js",
101
- "prepublishOnly": "npm run build-all && npm run check:readme",
101
+ "prepublishOnly": "npm run build-all && npm run check:readme && npm run check:api",
102
102
  "sync-cdn": "node scripts/sync-cdn-urls.js",
103
103
  "version": "node scripts/sync-cdn-urls.js && node scripts/sync-version.js && node scripts/gen-esm-wrapper.js && git add README.md docs version.js index.mjs",
104
- "test:browser:ci": "node tests/browser-smoke-runner.js"
104
+ "test:browser:ci": "node tests/browser-smoke-runner.js",
105
+ "api:snapshot": "node scripts/api-surface.js",
106
+ "check:api": "mocha test/api_surface.js --no-config"
105
107
  },
106
108
  "unpkg": "bsv.min.js",
107
109
  "jsdelivr": "bsv.min.js",
@@ -110,8 +112,6 @@
110
112
  "index.js",
111
113
  "index.mjs",
112
114
  "version.js",
113
- "test/",
114
- ".mocharc.json",
115
115
  "lib/",
116
116
  "utilities/*.js",
117
117
  "utilities/README.md",
@@ -142,88 +142,25 @@
142
142
  "LICENSE",
143
143
  "README.md",
144
144
  "SECURITY.md",
145
- "CHANGELOG.md"
145
+ "CHANGELOG.md",
146
+ "STABILITY.md"
146
147
  ],
147
148
  "keywords": [
148
- "bitcoin",
149
149
  "bitcoin-sv",
150
150
  "bsv",
151
- "legal-token-protocol",
152
- "ltp",
153
- "legal-tokens",
154
- "primitives-only",
155
- "legal-compliance",
156
- "property-rights",
157
- "obligations",
158
- "attestations",
159
- "gdaf",
160
- "global-digital-attestation",
161
- "w3c-credentials",
162
- "verifiable-credentials",
163
- "decentralized-identity",
164
- "shamir-secret-sharing",
165
- "threshold-cryptography",
166
- "cryptocurrency",
167
- "blockchain",
168
- "smart-contracts",
169
- "defi",
151
+ "bitcoin-script",
152
+ "opcode",
170
153
  "covenant",
171
- "covenants",
172
- "script-debugger",
173
- "debug-tools",
174
- "modular-loading",
175
- "standalone-modules",
176
- "elliptic-curve-fix",
177
- "smartledger",
178
- "transaction",
179
- "address",
180
- "signature",
181
- "wallet",
182
- "hd-wallet",
183
- "mnemonic",
184
- "ecies",
185
- "encryption",
186
- "message-signing",
187
- "pushtx",
188
- "pels",
154
+ "op-push-tx",
189
155
  "bip143",
190
156
  "preimage",
191
- "secret-splitting",
192
- "did-resolution",
193
- "selective-disclosure",
194
- "blockchain-anchoring",
195
- "attestation-framework",
196
- "nchain",
197
- "custom-scripts",
198
- "multisig",
199
- "timelock",
200
- "conditional-scripts",
201
- "utxo-management",
202
- "ultra-low-fees",
203
- "javascript-to-script",
204
- "opcode-mapping",
205
- "covenant-builder",
206
- "script-simulation",
207
- "bitcoin-script",
208
- "asm-generation",
209
- "advanced-features",
210
- "script-development",
211
- "blockchain-simulator",
212
- "miner-simulator",
213
- "testing-tools",
214
- "development-framework",
215
- "browser-compatible",
216
- "nodejs-compatible",
217
- "webpack-ready",
218
- "cdn-ready",
219
- "typescript-definitions",
220
- "drop-in-replacement",
221
- "performance-optimized",
222
- "bip21",
223
- "bip32",
224
- "bip37",
225
- "bip69",
226
- "bip70"
157
+ "smart-contracts",
158
+ "script-interpreter",
159
+ "transaction",
160
+ "utxo",
161
+ "verifiable-credentials",
162
+ "did-web",
163
+ "legal-token-protocol"
227
164
  ],
228
165
  "repository": {
229
166
  "type": "git",
@@ -246,7 +183,7 @@
246
183
  "chai": "6.2.2",
247
184
  "create-hash": "^1.2.0",
248
185
  "create-hmac": "^1.1.7",
249
- "esbuild": "^0.28.1",
186
+ "esbuild": "^0.28.2",
250
187
  "events": "^3.3.0",
251
188
  "jose": "^5.10.0",
252
189
  "mocha": "^11.8.0",
package/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  'use strict'
2
2
  // GENERATED by scripts/sync-version.js on `npm version` — do not edit.
3
- module.exports = '9.0.0'
3
+ module.exports = '9.1.0'
package/.mocharc.json DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "recursive": true,
3
- "timeout": 8000,
4
- "spec": "test/**/*.js"
5
- }