smartledger-bsv 3.4.0 → 3.4.5

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 (119) hide show
  1. package/CHANGELOG.md +446 -0
  2. package/README.md +112 -84
  3. package/SECURITY.md +88 -0
  4. package/bin/cli.js +13 -8
  5. package/bsv-anchor.min.js +12 -0
  6. package/bsv-covenant.min.js +8 -8
  7. package/bsv-didweb.min.js +12 -0
  8. package/bsv-gdaf.min.js +9 -9
  9. package/bsv-ltp.min.js +9 -9
  10. package/bsv-mnemonic.min.js +2 -2
  11. package/bsv-shamir.min.js +3 -3
  12. package/bsv-smartcontract.min.js +5 -5
  13. package/bsv-statuslist.min.js +18 -0
  14. package/bsv-vcjwt.min.js +12 -0
  15. package/bsv.bundle.js +9 -9
  16. package/bsv.d.ts +486 -9
  17. package/bsv.min.js +5 -5
  18. package/build/webpack.anchor.config.js +9 -13
  19. package/build/webpack.didweb.config.js +10 -14
  20. package/build/webpack.statuslist.config.js +9 -14
  21. package/build/webpack.vcjwt.config.js +9 -13
  22. package/docs/COVENANT_DEVELOPMENT_RESOLVED.md +2 -2
  23. package/docs/MODULE_REFERENCE_COMPLETE.md +61 -58
  24. package/docs/advanced/LEGAL_TOKEN_PROTOCOL.md +3 -3
  25. package/docs/advanced/UTXO_MANAGER_GUIDE.md +1 -1
  26. package/docs/getting-started/INSTALLATION.md +30 -30
  27. package/docs/getting-started/QUICK_START.md +18 -18
  28. package/docs/migration/FROM_BSV_1_5_6.md +16 -10
  29. package/gdaf-entry.js +1 -2
  30. package/index.js +44 -13
  31. package/lib/browser-utxo-manager-es5.js +11 -4
  32. package/lib/browser-utxo-manager.js +15 -8
  33. package/lib/ltp/claim.js +1 -0
  34. package/lib/ltp/obligation.js +1 -0
  35. package/lib/ltp/registry.js +2 -0
  36. package/lib/ltp/right.js +1 -0
  37. package/lib/script/script.js +19 -0
  38. package/lib/smart_contract/covenant.js +10 -1
  39. package/lib/smartutxo.js +20 -12
  40. package/lib/transaction/input/publickeyhash.js +6 -1
  41. package/lib/transaction/transaction.js +13 -2
  42. package/lib/util/_.js +7 -1
  43. package/ltp-entry.js +1 -2
  44. package/package.json +11 -13
  45. package/utilities/blockchain-state.js +32 -23
  46. package/demos/README.md +0 -188
  47. package/demos/architecture_demo.js +0 -247
  48. package/demos/browser-test.html +0 -1208
  49. package/demos/bsv_wallet_demo.js +0 -242
  50. package/demos/complete_ltp_demo.js +0 -511
  51. package/demos/debug_tools_demo.js +0 -87
  52. package/demos/demo_features.js +0 -123
  53. package/demos/easy_interface_demo.js +0 -109
  54. package/demos/ecies_demo.js +0 -182
  55. package/demos/gdaf_core_test.js +0 -131
  56. package/demos/gdaf_demo.js +0 -237
  57. package/demos/ltp_demo.js +0 -361
  58. package/demos/ltp_primitives_demo.js +0 -403
  59. package/demos/message_demo.js +0 -209
  60. package/demos/preimage_separation_demo.js +0 -383
  61. package/demos/script_helper_demo.js +0 -289
  62. package/demos/security_demo.js +0 -287
  63. package/demos/shamir_demo.js +0 -121
  64. package/demos/simple_demo.js +0 -204
  65. package/demos/simple_p2pkh_demo.js +0 -169
  66. package/demos/simple_utxo_preimage_demo.js +0 -196
  67. package/demos/smart_contract_demo.html +0 -1347
  68. package/demos/smart_contract_demo.js +0 -910
  69. package/demos/utxo_generator_demo.js +0 -244
  70. package/demos/validation_pipeline_demo.js +0 -155
  71. package/demos/web3keys.html +0 -740
  72. package/examples/README.md +0 -200
  73. package/examples/basic/transaction-creation.js +0 -534
  74. package/examples/basic/transaction_signature_api_gap.js +0 -178
  75. package/examples/complete_workflow_demo.js +0 -783
  76. package/examples/covenants/advanced_covenant_demo.js +0 -219
  77. package/examples/covenants/covenant_interface_demo.js +0 -270
  78. package/examples/covenants/covenant_manual_signature_resolved.js +0 -212
  79. package/examples/covenants/covenant_signature_template.js +0 -117
  80. package/examples/covenants2/covenant_bidirectional_example.js +0 -262
  81. package/examples/covenants2/covenant_utils_demo.js +0 -120
  82. package/examples/covenants2/preimage_covenant_utils.js +0 -287
  83. package/examples/covenants2/production_integration.js +0 -256
  84. package/examples/data/covenant_utxos.json +0 -28
  85. package/examples/data/utxos.json +0 -26
  86. package/examples/definitive_working_demo.js +0 -261
  87. package/examples/final_working_contracts.js +0 -338
  88. package/examples/preimage/README.md +0 -178
  89. package/examples/preimage/extract_preimage_bidirectional.js +0 -421
  90. package/examples/preimage/generate_sample_preimage.js +0 -208
  91. package/examples/preimage/generate_sighash_examples.js +0 -152
  92. package/examples/preimage/parse_preimage.js +0 -117
  93. package/examples/preimage/test_preimage_extractor.js +0 -53
  94. package/examples/preimage/test_varint_extraction.js +0 -95
  95. package/examples/scripts/custom_script_helper_example.js +0 -273
  96. package/examples/scripts/custom_script_signature_test.js +0 -344
  97. package/examples/scripts/script_interpreter.js +0 -193
  98. package/examples/smart_contract/complete_workflow_demo.js +0 -343
  99. package/examples/smart_contract/covenant_builder_demo.js +0 -176
  100. package/examples/smart_contract/script_testing_integration.js +0 -198
  101. package/examples/smart_contract_templates.js +0 -718
  102. package/examples/working_smart_contracts.js +0 -348
  103. package/lib/smart_contract/test_integration.js +0 -269
  104. package/tests/browser-compatibility/README.md +0 -35
  105. package/tests/browser-compatibility/test-cdn-vs-local.html +0 -186
  106. package/tests/browser-compatibility/test-pbkdf2.html +0 -51
  107. package/tests/bundle-completeness-test.html +0 -131
  108. package/tests/bundle-demo.html +0 -476
  109. package/tests/smartcontract-test.html +0 -239
  110. package/tests/standalone-modules-test.html +0 -260
  111. package/tests/test.html +0 -612
  112. package/tests/test_builtin_verify.js +0 -117
  113. package/tests/test_debug_integration.js +0 -71
  114. package/tests/test_ecdsa_little.js +0 -70
  115. package/tests/test_shamir.js +0 -221
  116. package/tests/test_smartverify_der.js +0 -110
  117. package/tests/test_standalone_shamir.html +0 -83
  118. package/tests/unpkg-demo.html +0 -194
  119. package/utilities/blockchain-state.json +0 -118565
@@ -1,239 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>SmartContract Module Test - Two Approaches</title>
7
- <style>
8
- body {
9
- font-family: Arial, sans-serif;
10
- max-width: 1200px;
11
- margin: 0 auto;
12
- padding: 20px;
13
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
14
- color: white;
15
- }
16
- .test-section {
17
- background: rgba(255,255,255,0.1);
18
- backdrop-filter: blur(10px);
19
- padding: 20px;
20
- margin: 20px 0;
21
- border-radius: 12px;
22
- border: 1px solid rgba(255,255,255,0.2);
23
- }
24
- h1 {
25
- color: #fff;
26
- text-align: center;
27
- font-size: 2.5em;
28
- margin-bottom: 10px;
29
- }
30
- .approach {
31
- background: rgba(255,255,255,0.1);
32
- padding: 15px;
33
- margin: 15px 0;
34
- border-radius: 8px;
35
- border-left: 4px solid #4CAF50;
36
- }
37
- .result {
38
- background: rgba(0,0,0,0.3);
39
- padding: 15px;
40
- border-radius: 5px;
41
- font-family: 'Courier New', monospace;
42
- margin: 10px 0;
43
- font-size: 0.9em;
44
- line-height: 1.4;
45
- }
46
- .button {
47
- background: linear-gradient(45deg, #4CAF50, #45a049);
48
- color: white;
49
- border: none;
50
- padding: 12px 24px;
51
- border-radius: 25px;
52
- cursor: pointer;
53
- margin: 8px;
54
- font-weight: bold;
55
- transition: all 0.3s;
56
- box-shadow: 0 4px 8px rgba(0,0,0,0.2);
57
- }
58
- .button:hover {
59
- transform: translateY(-2px);
60
- box-shadow: 0 6px 12px rgba(0,0,0,0.3);
61
- }
62
- .comparison {
63
- display: grid;
64
- grid-template-columns: 1fr 1fr;
65
- gap: 20px;
66
- margin: 20px 0;
67
- }
68
- @media (max-width: 768px) {
69
- .comparison {
70
- grid-template-columns: 1fr;
71
- }
72
- }
73
- </style>
74
- </head>
75
- <body>
76
- <h1>🔧 SmartContract Module Integration Test</h1>
77
-
78
- <div class="test-section">
79
- <h2>📋 Two Loading Approaches</h2>
80
- <p>Testing both methods to load SmartContract functionality:</p>
81
-
82
- <div class="comparison">
83
- <div class="approach">
84
- <h3>📦 Approach 1: All-in-One</h3>
85
- <p><strong>File:</strong> bsv.min.js (459KB)</p>
86
- <p><strong>Includes:</strong> Core BSV + SmartContract</p>
87
- <button class="button" onclick="testMainFile()">Test Main File</button>
88
- <div id="main-results" class="result">Click to test main file approach...</div>
89
- </div>
90
-
91
- <div class="approach">
92
- <h3>🔌 Approach 2: Modular</h3>
93
- <p><strong>Files:</strong> bsv.min.js + bsv-smartcontract.min.js</p>
94
- <p><strong>Total:</strong> ~920KB (459KB + 461KB)</p>
95
- <button class="button" onclick="testModularApproach()">Test Modular</button>
96
- <div id="modular-results" class="result">Click to test modular approach...</div>
97
- </div>
98
- </div>
99
- </div>
100
-
101
- <div class="test-section">
102
- <h2>🐛 Debug Tools Functionality Test</h2>
103
- <button class="button" onclick="testDebugTools()">Test Debug Tools</button>
104
- <div id="debug-results" class="result">Click to test debug tools functionality...</div>
105
- </div>
106
-
107
- <div class="test-section">
108
- <h2>📊 Performance Comparison</h2>
109
- <div id="performance-results" class="result">
110
- <strong>File Size Comparison:</strong><br>
111
- • Main only (bsv.min.js): 459KB - includes SmartContract ✅<br>
112
- • Standalone (bsv-smartcontract.min.js): 461KB - SmartContract only<br>
113
- • Bundle (bsv.bundle.js): 771KB - everything included ✅<br>
114
- • Modular total: ~920KB - maximum flexibility<br><br>
115
- <strong>Recommendation:</strong> Use main file (bsv.min.js) for most use cases
116
- </div>
117
- </div>
118
-
119
- <!-- Load the main BSV library with SmartContract included -->
120
- <script src="bsv.min.js"></script>
121
-
122
- <script>
123
- function log(message, targetId) {
124
- const output = document.getElementById(targetId);
125
- const timestamp = new Date().toLocaleTimeString();
126
- output.innerHTML += `[${timestamp}] ${message}<br>`;
127
- }
128
-
129
- function testMainFile() {
130
- const output = document.getElementById('main-results');
131
- output.innerHTML = '';
132
-
133
- try {
134
- log('Testing main file (bsv.min.js)...', 'main-results');
135
-
136
- // Check if BSV is available
137
- if (typeof bsv === 'undefined') {
138
- log('❌ BSV library not loaded', 'main-results');
139
- return;
140
- }
141
-
142
- log('✅ BSV library loaded', 'main-results');
143
-
144
- // Check SmartContract
145
- if (bsv.SmartContract) {
146
- const methodCount = Object.keys(bsv.SmartContract).length;
147
- log(`✅ SmartContract available with ${methodCount} methods`, 'main-results');
148
-
149
- // Test debug tools
150
- const hasDebugTools = !!(bsv.SmartContract.examineStack && bsv.SmartContract.interpretScript);
151
- log(`🐛 Debug tools: ${hasDebugTools ? 'Available ✅' : 'Not available ❌'}`, 'main-results');
152
-
153
- // Test functionality
154
- if (hasDebugTools) {
155
- try {
156
- const script = bsv.Script.fromASM('OP_1 OP_2 OP_ADD');
157
- const result = bsv.SmartContract.examineStack(script);
158
- log('✅ Debug tools working - script examination successful', 'main-results');
159
- } catch (e) {
160
- log(`⚠️ Debug tools available but test failed: ${e.message}`, 'main-results');
161
- }
162
- }
163
-
164
- log('🎉 Main file approach: WORKING', 'main-results');
165
- } else {
166
- log('❌ SmartContract not available in main file', 'main-results');
167
- }
168
- } catch (error) {
169
- log(`❌ Error: ${error.message}`, 'main-results');
170
- }
171
- }
172
-
173
- function testModularApproach() {
174
- const output = document.getElementById('modular-results');
175
- output.innerHTML = '';
176
-
177
- log('Testing modular approach...', 'modular-results');
178
- log('ℹ️ This would require loading bsv-smartcontract.min.js separately', 'modular-results');
179
- log('ℹ️ Main file already includes SmartContract, so modular not needed', 'modular-results');
180
- log('✅ Modular approach: Available as backup option', 'modular-results');
181
-
182
- // Show how it would work
183
- log('Usage example:', 'modular-results');
184
- log('&lt;script src="bsv.min.js"&gt;&lt;/script&gt;', 'modular-results');
185
- log('&lt;script src="bsv-smartcontract.min.js"&gt;&lt;/script&gt;', 'modular-results');
186
- }
187
-
188
- function testDebugTools() {
189
- const output = document.getElementById('debug-results');
190
- output.innerHTML = '';
191
-
192
- try {
193
- log('Testing debug tools functionality...', 'debug-results');
194
-
195
- if (!bsv.SmartContract) {
196
- log('❌ SmartContract not available', 'debug-results');
197
- return;
198
- }
199
-
200
- // Test each debug tool
201
- const debugTools = [
202
- { name: 'examineStack', method: bsv.SmartContract.examineStack },
203
- { name: 'interpretScript', method: bsv.SmartContract.interpretScript },
204
- { name: 'getScriptMetrics', method: bsv.SmartContract.getScriptMetrics },
205
- { name: 'optimizeScript', method: bsv.SmartContract.optimizeScript }
206
- ];
207
-
208
- const testScript = bsv.Script.fromASM('OP_1 OP_2 OP_ADD OP_3 OP_EQUAL');
209
- log(`Test script: ${testScript.toASM()}`, 'debug-results');
210
-
211
- debugTools.forEach(tool => {
212
- if (tool.method) {
213
- try {
214
- const result = tool.method(testScript);
215
- log(`✅ ${tool.name}: Working`, 'debug-results');
216
- } catch (e) {
217
- log(`⚠️ ${tool.name}: Available but failed - ${e.message}`, 'debug-results');
218
- }
219
- } else {
220
- log(`❌ ${tool.name}: Not available`, 'debug-results');
221
- }
222
- });
223
-
224
- log('🚀 Debug tools test completed!', 'debug-results');
225
-
226
- } catch (error) {
227
- log(`❌ Debug tools test failed: ${error.message}`, 'debug-results');
228
- }
229
- }
230
-
231
- // Auto-run tests on page load
232
- window.addEventListener('load', () => {
233
- setTimeout(() => {
234
- testMainFile();
235
- }, 1000);
236
- });
237
- </script>
238
- </body>
239
- </html>
@@ -1,260 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>BSV Standalone Modules Test</title>
5
- <style>
6
- body { font-family: Arial; margin: 20px; background: #f5f5f5; }
7
- .container { max-width: 1200px; margin: 0 auto; }
8
- .modules { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 20px; }
9
- .module { background: white; padding: 20px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
10
- .success { color: #27ae60; }
11
- .error { color: #e74c3c; }
12
- .warning { color: #f39c12; }
13
- .size { font-size: 12px; color: #666; }
14
- .description { font-size: 14px; color: #555; margin: 10px 0; }
15
- h1 { text-align: center; color: #2c3e50; }
16
- h3 { color: #34495e; border-bottom: 2px solid #3498db; padding-bottom: 5px; }
17
- .loading-approach { background: #ecf0f1; padding: 15px; margin: 10px 0; border-radius: 5px; }
18
- .code { background: #2c3e50; color: #ecf0f1; padding: 10px; border-radius: 4px; font-family: monospace; font-size: 12px; }
19
- </style>
20
- </head>
21
- <body>
22
- <div class="container">
23
- <h1>🧩 BSV Standalone Modules Test Suite</h1>
24
- <p style="text-align: center; color: #666;">Testing all specialized standalone modules for modular loading</p>
25
-
26
- <div id="loading-status">
27
- <h2>📦 Loading Strategy</h2>
28
- <div class="loading-approach">
29
- <strong>Modular Loading Approach:</strong><br>
30
- 1. Load core BSV library first<br>
31
- 2. Load only the specialized modules you need<br>
32
- 3. Avoid large bundle for targeted functionality
33
- </div>
34
- </div>
35
-
36
- <div class="modules">
37
-
38
- <!-- Core BSV -->
39
- <div class="module">
40
- <h3>🔧 Core BSV Library</h3>
41
- <div class="size">449KB - bsv.min.js</div>
42
- <div class="description">Essential Bitcoin SV functionality with SmartContract included</div>
43
- <div id="core-status">Loading...</div>
44
- <div class="code">
45
- &lt;script src="bsv.min.js"&gt;&lt;/script&gt;<br>
46
- &lt;script&gt;<br>
47
- &nbsp;&nbsp;const key = new bsv.PrivateKey();<br>
48
- &nbsp;&nbsp;const tx = new bsv.Transaction();<br>
49
- &lt;/script&gt;
50
- </div>
51
- </div>
52
-
53
- <!-- Covenant Interface -->
54
- <div class="module">
55
- <h3>⚡ Covenant Interface</h3>
56
- <div class="size">32KB - bsv-covenant.min.js</div>
57
- <div class="description">Advanced covenant development framework for complex Bitcoin contracts</div>
58
- <div id="covenant-status">Waiting for core...</div>
59
- <div class="code">
60
- &lt;script src="bsv.min.js"&gt;&lt;/script&gt;<br>
61
- &lt;script src="bsv-covenant.min.js"&gt;&lt;/script&gt;<br>
62
- &lt;script&gt;<br>
63
- &nbsp;&nbsp;const covenant = new bsvCovenant.CovenantInterface();<br>
64
- &lt;/script&gt;
65
- </div>
66
- </div>
67
-
68
- <!-- Script Helper -->
69
- <div class="module">
70
- <h3>📝 Custom Script Helper</h3>
71
- <div class="size">27KB - bsv-script-helper.min.js</div>
72
- <div class="description">Simplified API for custom script development and signature creation</div>
73
- <div id="script-helper-status">Waiting for core...</div>
74
- <div class="code">
75
- &lt;script src="bsv.min.js"&gt;&lt;/script&gt;<br>
76
- &lt;script src="bsv-script-helper.min.js"&gt;&lt;/script&gt;<br>
77
- &lt;script&gt;<br>
78
- &nbsp;&nbsp;const sig = bsvScriptHelper.createSignature(...);<br>
79
- &lt;/script&gt;
80
- </div>
81
- </div>
82
-
83
- <!-- Security Module -->
84
- <div class="module">
85
- <h3>🛡️ Security Module</h3>
86
- <div class="size">290KB - bsv-security.min.js</div>
87
- <div class="description">SmartLedger security enhancements and elliptic curve fixes (standalone)</div>
88
- <div id="security-status">Loading...</div>
89
- <div class="code">
90
- &lt;script src="bsv-security.min.js"&gt;&lt;/script&gt;<br>
91
- &lt;script&gt;<br>
92
- &nbsp;&nbsp;const verified = bsvSecurity.SmartVerify.verify(...);<br>
93
- &lt;/script&gt;
94
- </div>
95
- </div>
96
-
97
- <!-- SmartContract -->
98
- <div class="module">
99
- <h3>🔬 SmartContract Debug</h3>
100
- <div class="size">451KB - bsv-smartcontract.min.js</div>
101
- <div class="description">Complete SmartContract interface with all debug tools</div>
102
- <div id="smartcontract-status">Waiting for core...</div>
103
- <div class="code">
104
- &lt;script src="bsv.min.js"&gt;&lt;/script&gt;<br>
105
- &lt;script src="bsv-smartcontract.min.js"&gt;&lt;/script&gt;<br>
106
- &lt;script&gt;<br>
107
- &nbsp;&nbsp;const metrics = SmartContract.getScriptMetrics(script);<br>
108
- &lt;/script&gt;
109
- </div>
110
- </div>
111
-
112
- <!-- Complete Bundle Alternative -->
113
- <div class="module">
114
- <h3>📦 Complete Bundle</h3>
115
- <div class="size">764KB - bsv.bundle.js</div>
116
- <div class="description">Everything in one file (alternative to modular approach)</div>
117
- <div id="bundle-status">Not loaded (modular test)</div>
118
- <div class="code">
119
- &lt;script src="bsv.bundle.js"&gt;&lt;/script&gt;<br>
120
- &lt;script&gt;<br>
121
- &nbsp;&nbsp;// Everything available immediately<br>
122
- &nbsp;&nbsp;const covenant = new bsv.CovenantInterface();<br>
123
- &lt;/script&gt;
124
- </div>
125
- </div>
126
-
127
- </div>
128
-
129
- <div id="summary" style="margin-top: 30px;">
130
- <h2>📊 Loading Summary</h2>
131
- <div id="summary-content">Testing in progress...</div>
132
- </div>
133
- </div>
134
-
135
- <!-- Load core BSV first -->
136
- <script src="bsv.min.js"></script>
137
- <script>
138
- document.getElementById('core-status').innerHTML = '<span class="success">✅ Core BSV loaded (' + (bsv.version || 'unknown') + ')</span>';
139
-
140
- // Track what's loaded
141
- const loadedModules = ['core'];
142
- const moduleTests = {};
143
-
144
- function updateStatus(moduleId, status, className = 'success') {
145
- document.getElementById(moduleId + '-status').innerHTML = '<span class="' + className + '">' + status + '</span>';
146
- }
147
-
148
- function updateSummary() {
149
- const content = document.getElementById('summary-content');
150
- content.innerHTML = `
151
- <div><strong>Loaded Modules:</strong> ${loadedModules.length}/6</div>
152
- <div><strong>Total Size:</strong> ${calculateTotalSize()}KB (modular) vs 764KB (bundle)</div>
153
- <div><strong>Modules:</strong> ${loadedModules.join(', ')}</div>
154
- `;
155
- }
156
-
157
- function calculateTotalSize() {
158
- const sizes = {
159
- core: 449,
160
- covenant: 32,
161
- 'script-helper': 27,
162
- security: 290,
163
- smartcontract: 451
164
- };
165
- return loadedModules.reduce((total, module) => total + (sizes[module] || 0), 0);
166
- }
167
-
168
- // Test core functionality
169
- try {
170
- const testKey = new bsv.PrivateKey();
171
- const testTx = new bsv.Transaction();
172
- moduleTests.core = 'Core BSV functionality working';
173
- } catch (e) {
174
- updateStatus('core', '❌ Core BSV error: ' + e.message, 'error');
175
- }
176
- </script>
177
-
178
- <!-- Load security module (standalone) -->
179
- <script src="bsv-security.min.js"></script>
180
- <script>
181
- try {
182
- if (typeof bsvSecurity !== 'undefined' && bsvSecurity.SmartVerify) {
183
- updateStatus('security', '✅ Security module loaded independently');
184
- loadedModules.push('security');
185
- moduleTests.security = 'SmartLedger security enhancements available';
186
- }
187
- } catch (e) {
188
- updateStatus('security', '❌ Security module error: ' + e.message, 'error');
189
- }
190
- updateSummary();
191
- </script>
192
-
193
- <!-- Load covenant interface -->
194
- <script src="bsv-covenant.min.js"></script>
195
- <script>
196
- try {
197
- if (typeof bsvCovenant !== 'undefined' && bsvCovenant.CovenantInterface) {
198
- const covenantInterface = new bsvCovenant.CovenantInterface();
199
- updateStatus('covenant', '✅ CovenantInterface loaded and instantiated');
200
- loadedModules.push('covenant');
201
- moduleTests.covenant = 'Advanced covenant development ready';
202
- }
203
- } catch (e) {
204
- updateStatus('covenant', '❌ Covenant error: ' + e.message, 'error');
205
- }
206
- updateSummary();
207
- </script>
208
-
209
- <!-- Load script helper -->
210
- <script src="bsv-script-helper.min.js"></script>
211
- <script>
212
- try {
213
- if (typeof bsvScriptHelper !== 'undefined' && bsvScriptHelper.CustomScriptHelper) {
214
- updateStatus('script-helper', '✅ CustomScriptHelper loaded');
215
- loadedModules.push('script-helper');
216
- moduleTests.scriptHelper = 'Custom script development tools ready';
217
- }
218
- } catch (e) {
219
- updateStatus('script-helper', '❌ Script helper error: ' + e.message, 'error');
220
- }
221
- updateSummary();
222
- </script>
223
-
224
- <!-- Load SmartContract debug tools -->
225
- <script src="bsv-smartcontract.min.js"></script>
226
- <script>
227
- try {
228
- if (typeof SmartContract !== 'undefined' && SmartContract.interpretScript) {
229
- // Test the debug methods
230
- const testScript = bsv.Script.fromASM('OP_1 OP_2 OP_ADD');
231
- const canDebug = typeof SmartContract.examineStack === 'function';
232
- updateStatus('smartcontract', '✅ SmartContract debug tools loaded (' + Object.keys(SmartContract).length + ' methods)');
233
- loadedModules.push('smartcontract');
234
- moduleTests.smartcontract = 'Debug tools and script analysis ready';
235
- }
236
- } catch (e) {
237
- updateStatus('smartcontract', '❌ SmartContract error: ' + e.message, 'error');
238
- }
239
- updateSummary();
240
-
241
- // Final summary
242
- setTimeout(() => {
243
- const summary = document.getElementById('summary-content');
244
- summary.innerHTML += `
245
- <h3>🎯 Modular Loading Benefits:</h3>
246
- <div>✅ <strong>Targeted Loading:</strong> Only load what you need</div>
247
- <div>✅ <strong>Reduced Bandwidth:</strong> Smaller initial downloads</div>
248
- <div>✅ <strong>Flexible Architecture:</strong> Mix and match modules</div>
249
- <div>✅ <strong>Independent Updates:</strong> Update modules separately</div>
250
- <div>✅ <strong>Better Caching:</strong> Browser caches modules individually</div>
251
-
252
- <h3>📈 Size Comparison:</h3>
253
- <div><strong>Modular (loaded):</strong> ${calculateTotalSize()}KB across ${loadedModules.length} modules</div>
254
- <div><strong>Complete Bundle:</strong> 764KB in 1 file</div>
255
- <div><strong>Savings:</strong> ${loadedModules.length < 6 ? (764 - calculateTotalSize()) + 'KB saved by not loading unused modules' : 'All modules loaded'}</div>
256
- `;
257
- }, 1000);
258
- </script>
259
- </body>
260
- </html>