@smartledger/bsv 7.10.0 → 7.10.1
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 +44 -0
- package/README.md +38 -38
- package/bsv-gdaf.min.js +1 -1
- package/bsv-smartcontract.min.js +1 -1
- package/bsv.bundle.js +1 -1
- package/bsv.min.js +1 -1
- package/build/esbuild.js +4 -3
- package/docs/MODULE_REFERENCE_COMPLETE.md +27 -27
- package/docs/advanced/UTXO_MANAGER_GUIDE.md +1 -1
- package/docs/getting-started/INSTALLATION.md +23 -23
- package/docs/getting-started/QUICK_START.md +7 -7
- package/docs/migration/FROM_BSV_1_5_6.md +5 -5
- package/lib/covenant-interface.js +16 -6
- package/package.json +1 -1
- package/test/build/bundle_externals.js +116 -0
- package/version.js +1 -1
|
@@ -55,19 +55,19 @@ Three advanced modules totaling **~2.7MB** of functionality:
|
|
|
55
55
|
- **Purpose**: Threshold cryptography for secure secret distribution
|
|
56
56
|
- **Use Cases**: Backup keys, multi-party security, key recovery
|
|
57
57
|
- **Features**: Split secrets into N shares, require M to reconstruct
|
|
58
|
-
- **CDN**: `unpkg.com/@smartledger/bsv@7.10.
|
|
58
|
+
- **CDN**: `unpkg.com/@smartledger/bsv@7.10.1/bsv-shamir.min.js`
|
|
59
59
|
|
|
60
60
|
#### **🌐 Global Digital Attestation Framework - GDAF (1184KB)**
|
|
61
61
|
- **Purpose**: W3C Verifiable Credentials and decentralized identity
|
|
62
62
|
- **Use Cases**: Identity verification, attestations, zero-knowledge proofs
|
|
63
63
|
- **Features**: DID creation, credential issuance, selective disclosure
|
|
64
|
-
- **CDN**: `unpkg.com/@smartledger/bsv@7.10.
|
|
64
|
+
- **CDN**: `unpkg.com/@smartledger/bsv@7.10.1/bsv-gdaf.min.js`
|
|
65
65
|
|
|
66
66
|
#### **⚖️ Legal Token Protocol - LTP (1184KB)**
|
|
67
67
|
- **Purpose**: Legal compliance framework for tokenized assets
|
|
68
68
|
- **Use Cases**: Property rights, obligations, compliant tokenization
|
|
69
69
|
- **Features**: Legal primitives, compliance checking, attestation anchoring
|
|
70
|
-
- **CDN**: `unpkg.com/@smartledger/bsv@7.10.
|
|
70
|
+
- **CDN**: `unpkg.com/@smartledger/bsv@7.10.1/bsv-ltp.min.js`
|
|
71
71
|
|
|
72
72
|
### **2. Incorrect File Sizes in Documentation**
|
|
73
73
|
|
|
@@ -81,18 +81,18 @@ Three advanced modules totaling **~2.7MB** of functionality:
|
|
|
81
81
|
|
|
82
82
|
| Module | Size | Use Case | CDN Link |
|
|
83
83
|
|--------|------|----------|----------|
|
|
84
|
-
| **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@7.10.
|
|
85
|
-
| **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.10.
|
|
86
|
-
| **bsv-smartcontract.min.js** | 937KB | Covenant development | `unpkg.com/@smartledger/bsv@7.10.
|
|
87
|
-
| **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.10.
|
|
88
|
-
| **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.10.
|
|
89
|
-
| **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@7.10.
|
|
90
|
-
| **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@7.10.
|
|
91
|
-
| **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@7.10.
|
|
92
|
-
| **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@7.10.
|
|
93
|
-
| **🆕 bsv-shamir.min.js** | 432KB | **Secret sharing** | `unpkg.com/@smartledger/bsv@7.10.
|
|
94
|
-
| **🆕 bsv-gdaf.min.js** | 1184KB | **Digital attestation** | `unpkg.com/@smartledger/bsv@7.10.
|
|
95
|
-
| **🆕 bsv-ltp.min.js** | 1184KB | **Legal tokens** | `unpkg.com/@smartledger/bsv@7.10.
|
|
84
|
+
| **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@7.10.1/bsv.min.js` |
|
|
85
|
+
| **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.10.1/bsv.bundle.js` |
|
|
86
|
+
| **bsv-smartcontract.min.js** | 937KB | Covenant development | `unpkg.com/@smartledger/bsv@7.10.1/bsv-smartcontract.min.js` |
|
|
87
|
+
| **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.10.1/bsv-covenant.min.js` |
|
|
88
|
+
| **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.10.1/bsv-script-helper.min.js` |
|
|
89
|
+
| **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@7.10.1/bsv-security.min.js` |
|
|
90
|
+
| **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@7.10.1/bsv-ecies.min.js` |
|
|
91
|
+
| **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@7.10.1/bsv-message.min.js` |
|
|
92
|
+
| **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@7.10.1/bsv-mnemonic.min.js` |
|
|
93
|
+
| **🆕 bsv-shamir.min.js** | 432KB | **Secret sharing** | `unpkg.com/@smartledger/bsv@7.10.1/bsv-shamir.min.js` |
|
|
94
|
+
| **🆕 bsv-gdaf.min.js** | 1184KB | **Digital attestation** | `unpkg.com/@smartledger/bsv@7.10.1/bsv-gdaf.min.js` |
|
|
95
|
+
| **🆕 bsv-ltp.min.js** | 1184KB | **Legal tokens** | `unpkg.com/@smartledger/bsv@7.10.1/bsv-ltp.min.js` |
|
|
96
96
|
|
|
97
97
|
## 🎯 **Updated Usage Examples**
|
|
98
98
|
|
|
@@ -100,22 +100,22 @@ Three advanced modules totaling **~2.7MB** of functionality:
|
|
|
100
100
|
|
|
101
101
|
#### **1. Basic Development (~963KB)**
|
|
102
102
|
```html
|
|
103
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
104
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
103
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv.min.js"></script>
|
|
104
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-script-helper.min.js"></script>
|
|
105
105
|
```
|
|
106
106
|
|
|
107
107
|
#### **2. Smart Contract Development (~2.7MB — each bundle re-embeds core BSV)**
|
|
108
108
|
```html
|
|
109
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
110
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
111
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
109
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv.min.js"></script>
|
|
110
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-covenant.min.js"></script>
|
|
111
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-smartcontract.min.js"></script>
|
|
112
112
|
```
|
|
113
113
|
|
|
114
114
|
#### **3. 🆕 Legal & Compliance Development (~3.2MB — each bundle re-embeds core BSV)**
|
|
115
115
|
```html
|
|
116
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
117
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
118
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
116
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv.min.js"></script>
|
|
117
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-ltp.min.js"></script>
|
|
118
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-gdaf.min.js"></script>
|
|
119
119
|
<script>
|
|
120
120
|
// Legal Token Protocol
|
|
121
121
|
const legalToken = bsv.createLegalToken({
|
|
@@ -132,9 +132,9 @@ Three advanced modules totaling **~2.7MB** of functionality:
|
|
|
132
132
|
|
|
133
133
|
#### **4. 🆕 Security & Cryptography (~1.4MB)**
|
|
134
134
|
```html
|
|
135
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
136
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
137
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
135
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv.min.js"></script>
|
|
136
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-security.min.js"></script>
|
|
137
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-shamir.min.js"></script>
|
|
138
138
|
<script>
|
|
139
139
|
// Shamir Secret Sharing
|
|
140
140
|
const shares = bsv.splitSecret('my_secret_key', 5, 3); // 5 shares, 3 needed
|
|
@@ -146,7 +146,7 @@ Three advanced modules totaling **~2.7MB** of functionality:
|
|
|
146
146
|
|
|
147
147
|
#### **5. Everything Bundle (937KB)**
|
|
148
148
|
```html
|
|
149
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
149
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv.bundle.js"></script>
|
|
150
150
|
<script>
|
|
151
151
|
// Everything available immediately
|
|
152
152
|
const shares = bsv.splitSecret('secret', 5, 3);
|
|
@@ -722,7 +722,7 @@ interface UTXO {
|
|
|
722
722
|
<html>
|
|
723
723
|
<head>
|
|
724
724
|
<title>UTXO Manager Demo</title>
|
|
725
|
-
<script src="https://cdn.jsdelivr.net/npm/@smartledger/bsv@7.10.
|
|
725
|
+
<script src="https://cdn.jsdelivr.net/npm/@smartledger/bsv@7.10.1/bsv.min.js"></script>
|
|
726
726
|
</head>
|
|
727
727
|
<body>
|
|
728
728
|
<script>
|
|
@@ -48,7 +48,7 @@ const tx: Transaction = new Transaction();
|
|
|
48
48
|
#### **Core Library Only (937KB)**
|
|
49
49
|
For basic Bitcoin SV operations:
|
|
50
50
|
```html
|
|
51
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
51
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv.min.js"></script>
|
|
52
52
|
<script>
|
|
53
53
|
const privateKey = new bsv.PrivateKey();
|
|
54
54
|
const address = privateKey.toAddress();
|
|
@@ -58,7 +58,7 @@ For basic Bitcoin SV operations:
|
|
|
58
58
|
#### **Complete Bundle (937KB)**
|
|
59
59
|
Everything in one file:
|
|
60
60
|
```html
|
|
61
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
61
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv.bundle.js"></script>
|
|
62
62
|
<script>
|
|
63
63
|
// All features available immediately
|
|
64
64
|
const shares = bsv.splitSecret('secret', 5, 3);
|
|
@@ -71,9 +71,9 @@ Everything in one file:
|
|
|
71
71
|
|
|
72
72
|
#### **Smart Contract Development (~2.7MB total — each bundle is self-contained and re-embeds core BSV)**
|
|
73
73
|
```html
|
|
74
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
75
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
76
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
74
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv.min.js"></script>
|
|
75
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-covenant.min.js"></script>
|
|
76
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-smartcontract.min.js"></script>
|
|
77
77
|
<script>
|
|
78
78
|
const covenant = bsv.SmartContract.createCovenantBuilder()
|
|
79
79
|
.extractField('amount').push(50000).greaterThanOrEqual().build();
|
|
@@ -82,9 +82,9 @@ Everything in one file:
|
|
|
82
82
|
|
|
83
83
|
#### **Legal & Identity Development (~3.2MB total — each bundle is self-contained and re-embeds core BSV)**
|
|
84
84
|
```html
|
|
85
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
86
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
87
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
85
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv.min.js"></script>
|
|
86
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-ltp.min.js"></script>
|
|
87
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-gdaf.min.js"></script>
|
|
88
88
|
<script>
|
|
89
89
|
// Legal Token Protocol
|
|
90
90
|
const propertyToken = bsv.createPropertyToken({
|
|
@@ -98,9 +98,9 @@ Everything in one file:
|
|
|
98
98
|
|
|
99
99
|
#### **Security & Cryptography (~1.4MB total — each bundle is self-contained and re-embeds core BSV)**
|
|
100
100
|
```html
|
|
101
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
102
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
103
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
101
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv.min.js"></script>
|
|
102
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-security.min.js"></script>
|
|
103
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-shamir.min.js"></script>
|
|
104
104
|
<script>
|
|
105
105
|
// Threshold Cryptography
|
|
106
106
|
const shares = bsv.splitSecret('my_secret_key', 5, 3);
|
|
@@ -114,18 +114,18 @@ Everything in one file:
|
|
|
114
114
|
|
|
115
115
|
| Module | Size | Purpose | CDN Link |
|
|
116
116
|
|--------|------|---------|----------|
|
|
117
|
-
| **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@7.10.
|
|
118
|
-
| **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.10.
|
|
119
|
-
| **bsv-smartcontract.min.js** | 937KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@7.10.
|
|
120
|
-
| **bsv-ltp.min.js** | 1184KB | **Legal Token Protocol** | `unpkg.com/@smartledger/bsv@7.10.
|
|
121
|
-
| **bsv-gdaf.min.js** | 1184KB | **Digital Identity & Attestation** | `unpkg.com/@smartledger/bsv@7.10.
|
|
122
|
-
| **bsv-shamir.min.js** | 432KB | **Threshold Cryptography** | `unpkg.com/@smartledger/bsv@7.10.
|
|
123
|
-
| **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@7.10.
|
|
124
|
-
| **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@7.10.
|
|
125
|
-
| **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@7.10.
|
|
126
|
-
| **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.10.
|
|
127
|
-
| **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.10.
|
|
128
|
-
| **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@7.10.
|
|
117
|
+
| **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@7.10.1/bsv.min.js` |
|
|
118
|
+
| **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.10.1/bsv.bundle.js` |
|
|
119
|
+
| **bsv-smartcontract.min.js** | 937KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@7.10.1/bsv-smartcontract.min.js` |
|
|
120
|
+
| **bsv-ltp.min.js** | 1184KB | **Legal Token Protocol** | `unpkg.com/@smartledger/bsv@7.10.1/bsv-ltp.min.js` |
|
|
121
|
+
| **bsv-gdaf.min.js** | 1184KB | **Digital Identity & Attestation** | `unpkg.com/@smartledger/bsv@7.10.1/bsv-gdaf.min.js` |
|
|
122
|
+
| **bsv-shamir.min.js** | 432KB | **Threshold Cryptography** | `unpkg.com/@smartledger/bsv@7.10.1/bsv-shamir.min.js` |
|
|
123
|
+
| **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@7.10.1/bsv-security.min.js` |
|
|
124
|
+
| **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@7.10.1/bsv-mnemonic.min.js` |
|
|
125
|
+
| **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@7.10.1/bsv-ecies.min.js` |
|
|
126
|
+
| **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.10.1/bsv-covenant.min.js` |
|
|
127
|
+
| **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.10.1/bsv-script-helper.min.js` |
|
|
128
|
+
| **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@7.10.1/bsv-message.min.js` |
|
|
129
129
|
|
|
130
130
|
## ⚙️ **Development Environment Setup**
|
|
131
131
|
|
|
@@ -14,10 +14,10 @@ npm install @smartledger/bsv
|
|
|
14
14
|
### Browser CDN (Instant)
|
|
15
15
|
```html
|
|
16
16
|
<!-- Core library (937KB) -->
|
|
17
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
17
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv.min.js"></script>
|
|
18
18
|
|
|
19
19
|
<!-- Everything included (937KB) -->
|
|
20
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
20
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv.bundle.js"></script>
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## 💰 **Your First Transaction (60 seconds)**
|
|
@@ -127,19 +127,19 @@ SmartLedger-BSV offers 12 different loading options - use only what you need:
|
|
|
127
127
|
|
|
128
128
|
```html
|
|
129
129
|
<!-- Core BSV only (937KB) -->
|
|
130
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
130
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv.min.js"></script>
|
|
131
131
|
|
|
132
132
|
<!-- Smart contracts (937KB) -->
|
|
133
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
133
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-smartcontract.min.js"></script>
|
|
134
134
|
|
|
135
135
|
<!-- Legal tokens (1.16MB) -->
|
|
136
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
136
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-ltp.min.js"></script>
|
|
137
137
|
|
|
138
138
|
<!-- Digital identity (1.16MB) -->
|
|
139
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
139
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-gdaf.min.js"></script>
|
|
140
140
|
|
|
141
141
|
<!-- Everything (937KB) -->
|
|
142
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
142
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv.bundle.js"></script>
|
|
143
143
|
```
|
|
144
144
|
|
|
145
145
|
## ⚡ **Key Advantages**
|
|
@@ -159,17 +159,17 @@ const recovered = bsv.reconstructSecret([shares[0], shares[2], shares[4]]);
|
|
|
159
159
|
### **New Modular Options**
|
|
160
160
|
```html
|
|
161
161
|
<!-- Core compatibility (same size as bsv@1.5.6) -->
|
|
162
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
162
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv.min.js"></script>
|
|
163
163
|
|
|
164
164
|
<!-- Add smart contracts when ready -->
|
|
165
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
165
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-smartcontract.min.js"></script>
|
|
166
166
|
|
|
167
167
|
<!-- Add advanced features as needed -->
|
|
168
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
169
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
168
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-ltp.min.js"></script>
|
|
169
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-gdaf.min.js"></script>
|
|
170
170
|
|
|
171
171
|
<!-- Everything in one file -->
|
|
172
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.10.
|
|
172
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv.bundle.js"></script>
|
|
173
173
|
```
|
|
174
174
|
|
|
175
175
|
## 🔍 **Testing Your Migration**
|
|
@@ -22,12 +22,22 @@ var Opcode = require('./opcode')
|
|
|
22
22
|
var Script = require('./script')
|
|
23
23
|
|
|
24
24
|
class CovenantInterface {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Convenience access to the assembled library, for consumers who have a
|
|
27
|
+
* CovenantInterface and want the rest of the namespace.
|
|
28
|
+
*
|
|
29
|
+
* A getter, not a constructor assignment. The previous comment justified the
|
|
30
|
+
* deferral with "this file is reached while index.js is still initializing" —
|
|
31
|
+
* which is not true: nothing in index.js or anywhere under lib/ requires this
|
|
32
|
+
* module, only two files in examples/. It was also never read internally, so an
|
|
33
|
+
* eager require bought nothing and left this as the last package-root require in
|
|
34
|
+
* lib/ after a refactor whose whole purpose was removing them.
|
|
35
|
+
*
|
|
36
|
+
* Resolving on access keeps the property working for anyone using it while making
|
|
37
|
+
* the root require cost nothing for everyone else. `require` is cached.
|
|
38
|
+
*/
|
|
39
|
+
get bsv () {
|
|
40
|
+
return require('../index.js')
|
|
31
41
|
}
|
|
32
42
|
|
|
33
43
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smartledger/bsv",
|
|
3
|
-
"version": "7.10.
|
|
3
|
+
"version": "7.10.1",
|
|
4
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.",
|
|
5
5
|
"author": "SmartLedger Technology <hello@smartledger.technology> (https://smartledger.technology)",
|
|
6
6
|
"homepage": "https://github.com/codenlighten/smartledger-bsv#readme",
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
/* global describe, it, before */
|
|
4
|
+
|
|
5
|
+
// Feature bundles must EXTERNALISE the shared primitives, not embed a second copy.
|
|
6
|
+
//
|
|
7
|
+
// Getting this wrong is not a size regression. If a feature bundle ships its own
|
|
8
|
+
// PrivateKey class, a key built by bsv.min.js fails `instanceof` inside that bundle
|
|
9
|
+
// and index.js's versionGuard reports two library instances — a failure that is
|
|
10
|
+
// invisible to every test that stays inside one bundle.
|
|
11
|
+
//
|
|
12
|
+
// build/esbuild.js has always had a `metafile` option whose comment said it was "used
|
|
13
|
+
// to assert" this property. Nothing consumed it: `grep -rn metafile` returned only the
|
|
14
|
+
// option itself. This file is that consumer.
|
|
15
|
+
|
|
16
|
+
require('chai').should()
|
|
17
|
+
var esbuild = require('../../build/esbuild.js')
|
|
18
|
+
|
|
19
|
+
// Bundles that resolve bsv from the global instead of embedding it.
|
|
20
|
+
var EXTERNALISED = esbuild.BUNDLES.filter(function (c) { return c.externalBsv })
|
|
21
|
+
|
|
22
|
+
describe('feature bundles externalise the shared primitives', function () {
|
|
23
|
+
this.timeout(120000)
|
|
24
|
+
|
|
25
|
+
var inputsByBundle = {}
|
|
26
|
+
|
|
27
|
+
before(function () {
|
|
28
|
+
// Build each one in memory (write:false) and keep its module graph.
|
|
29
|
+
return Promise.all(EXTERNALISED.map(function (cfg) {
|
|
30
|
+
return esbuild.buildOne(cfg, { metafile: true, write: false, logLevel: 'silent' })
|
|
31
|
+
.then(function (result) {
|
|
32
|
+
inputsByBundle[cfg.file] = Object.keys(result.metafile.inputs)
|
|
33
|
+
.filter(function (p) { return p.indexOf('lib/') === 0 })
|
|
34
|
+
.sort()
|
|
35
|
+
})
|
|
36
|
+
}))
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
it('has bundles to check', function () {
|
|
40
|
+
EXTERNALISED.length.should.be.above(0)
|
|
41
|
+
Object.keys(inputsByBundle).length.should.equal(EXTERNALISED.length)
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
// The primary assertion, derived from the config rather than hand-maintained: every
|
|
45
|
+
// path in LIB_GLOBALS is a module the build promises to take from the global bsv, so
|
|
46
|
+
// none of them may appear as a bundled input. Because it reads the same table the
|
|
47
|
+
// build uses, it cannot drift out of step with it.
|
|
48
|
+
it('never embeds a module that LIB_GLOBALS maps to the global bsv', function () {
|
|
49
|
+
var mapped = Object.keys(esbuild.LIB_GLOBALS)
|
|
50
|
+
var offences = []
|
|
51
|
+
Object.keys(inputsByBundle).forEach(function (file) {
|
|
52
|
+
inputsByBundle[file].forEach(function (input) {
|
|
53
|
+
// 'lib/privatekey.js' -> 'privatekey'; 'lib/script/index.js' -> 'script/index'
|
|
54
|
+
var key = input.replace(/^lib\//, '').replace(/\.js$/, '')
|
|
55
|
+
if (mapped.indexOf(key) !== -1) {
|
|
56
|
+
offences.push(file + ' embeds ' + input + ' (should come from global bsv.' +
|
|
57
|
+
esbuild.LIB_GLOBALS[key] + ')')
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
offences.should.deep.equal([])
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
// LIB_GLOBALS is deliberately not exhaustive — a feature bundle SHOULD contain its own
|
|
65
|
+
// feature code. So the catch-all is to pin what each bundle contains: anything new
|
|
66
|
+
// appearing here is either the feature growing or a primitive leaking in, and a human
|
|
67
|
+
// decides which. Without this, a `require('../mnemonic')` added to a module reachable
|
|
68
|
+
// from an externalised entry would bundle a second copy silently, with every existing
|
|
69
|
+
// test green.
|
|
70
|
+
it('contains only its own feature code, pinned per bundle', function () {
|
|
71
|
+
// Accepted in any bundle: a tiny lodash subset with no library state, deliberately
|
|
72
|
+
// duplicated rather than routed through the global.
|
|
73
|
+
var SHARED = ['lib/util/']
|
|
74
|
+
var EXPECTED = {
|
|
75
|
+
'bsv-ecies.min.js': ['lib/ecies/'],
|
|
76
|
+
'bsv-message.min.js': ['lib/message/'],
|
|
77
|
+
'bsv-mnemonic.min.js': ['lib/mnemonic/'],
|
|
78
|
+
'bsv-shamir.min.js': ['lib/crypto/'],
|
|
79
|
+
'bsv-smartcontract.min.js': ['lib/smart_contract/', 'lib/covenant/', 'lib/smartutxo.js'],
|
|
80
|
+
'bsv-covenant.min.js': ['lib/smart_contract/'],
|
|
81
|
+
'bsv-script-helper.min.js': ['lib/custom-script-helper.js']
|
|
82
|
+
}
|
|
83
|
+
var unexpected = []
|
|
84
|
+
Object.keys(inputsByBundle).forEach(function (file) {
|
|
85
|
+
var allowed = (EXPECTED[file] || []).concat(SHARED)
|
|
86
|
+
if (!EXPECTED[file]) {
|
|
87
|
+
unexpected.push(file + ' is externalised but has no expected-input list')
|
|
88
|
+
return
|
|
89
|
+
}
|
|
90
|
+
inputsByBundle[file].forEach(function (input) {
|
|
91
|
+
var ok = allowed.some(function (prefix) { return input.indexOf(prefix) === 0 })
|
|
92
|
+
if (!ok) unexpected.push(file + ' unexpectedly embeds ' + input)
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
unexpected.should.deep.equal([])
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
it('shares nothing but documented helpers across bundles', function () {
|
|
99
|
+
// A module appearing in two feature bundles is a duplicated copy in the shipped
|
|
100
|
+
// set. Only these are accepted, and each is a deliberate call rather than an
|
|
101
|
+
// accident: lib/util/_.js is a tiny lodash subset, and lib/smart_contract/covenant.js
|
|
102
|
+
// is genuinely the feature of both covenant-flavoured bundles.
|
|
103
|
+
var ACCEPTED_DUPLICATES = ['lib/util/_.js', 'lib/smart_contract/covenant.js']
|
|
104
|
+
var seen = {}
|
|
105
|
+
Object.keys(inputsByBundle).forEach(function (file) {
|
|
106
|
+
inputsByBundle[file].forEach(function (input) {
|
|
107
|
+
(seen[input] = seen[input] || []).push(file)
|
|
108
|
+
})
|
|
109
|
+
})
|
|
110
|
+
var duplicated = Object.keys(seen)
|
|
111
|
+
.filter(function (p) { return seen[p].length > 1 })
|
|
112
|
+
.filter(function (p) { return ACCEPTED_DUPLICATES.indexOf(p) === -1 })
|
|
113
|
+
.sort()
|
|
114
|
+
duplicated.should.deep.equal([])
|
|
115
|
+
})
|
|
116
|
+
})
|
package/version.js
CHANGED