smartledger-bsv 3.2.1 → 3.2.2
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/README.md +289 -55
- package/bsv-covenant.min.js +10 -0
- package/bsv-script-helper.min.js +10 -0
- package/bsv-security.min.js +31 -0
- package/bsv-smartcontract.min.js +37 -0
- package/bsv.bundle.js +8 -8
- package/bsv.min.js +3 -3
- package/build/bsv-covenant.min.js +10 -0
- package/build/bsv-script-helper.min.js +10 -0
- package/build/bsv-security.min.js +31 -0
- package/build/bsv-smartcontract.min.js +37 -0
- package/build/bsv.bundle.js +39 -0
- package/build/bsv.min.js +37 -0
- package/build/webpack.bundle.config.js +22 -0
- package/build/webpack.config.js +18 -0
- package/build/webpack.covenant.config.js +27 -0
- package/build/webpack.script-helper.config.js +27 -0
- package/build/webpack.security.config.js +23 -0
- package/build/webpack.smartcontract.config.js +25 -0
- package/build/webpack.subproject.config.js +6 -0
- package/bundle-entry.js +265 -0
- package/covenant-entry.js +44 -0
- package/docs/pushtx-key-insights.md +106 -0
- package/index.js +13 -5
- package/lib/smart_contract/index.js +4 -0
- package/package.json +50 -19
- package/script-helper-entry.js +49 -0
- package/security-entry.js +70 -0
- package/smartcontract-entry.js +133 -0
- package/tests/bundle-completeness-test.html +131 -0
- package/tests/bundle-demo.html +476 -0
- package/tests/smartcontract-test.html +239 -0
- package/tests/standalone-modules-test.html +260 -0
- package/tests/test.html +612 -0
- package/tests/unpkg-demo.html +194 -0
- package/docs/nchain.md +0 -958
|
@@ -0,0 +1,239 @@
|
|
|
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('<script src="bsv.min.js"></script>', 'modular-results');
|
|
185
|
+
log('<script src="bsv-smartcontract.min.js"></script>', '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>
|
|
@@ -0,0 +1,260 @@
|
|
|
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
|
+
<script src="bsv.min.js"></script><br>
|
|
46
|
+
<script><br>
|
|
47
|
+
const key = new bsv.PrivateKey();<br>
|
|
48
|
+
const tx = new bsv.Transaction();<br>
|
|
49
|
+
</script>
|
|
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
|
+
<script src="bsv.min.js"></script><br>
|
|
61
|
+
<script src="bsv-covenant.min.js"></script><br>
|
|
62
|
+
<script><br>
|
|
63
|
+
const covenant = new bsvCovenant.CovenantInterface();<br>
|
|
64
|
+
</script>
|
|
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
|
+
<script src="bsv.min.js"></script><br>
|
|
76
|
+
<script src="bsv-script-helper.min.js"></script><br>
|
|
77
|
+
<script><br>
|
|
78
|
+
const sig = bsvScriptHelper.createSignature(...);<br>
|
|
79
|
+
</script>
|
|
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
|
+
<script src="bsv-security.min.js"></script><br>
|
|
91
|
+
<script><br>
|
|
92
|
+
const verified = bsvSecurity.SmartVerify.verify(...);<br>
|
|
93
|
+
</script>
|
|
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
|
+
<script src="bsv.min.js"></script><br>
|
|
105
|
+
<script src="bsv-smartcontract.min.js"></script><br>
|
|
106
|
+
<script><br>
|
|
107
|
+
const metrics = SmartContract.getScriptMetrics(script);<br>
|
|
108
|
+
</script>
|
|
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
|
+
<script src="bsv.bundle.js"></script><br>
|
|
120
|
+
<script><br>
|
|
121
|
+
// Everything available immediately<br>
|
|
122
|
+
const covenant = new bsv.CovenantInterface();<br>
|
|
123
|
+
</script>
|
|
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>
|