@smartledger/bsv 7.5.6 → 7.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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.5.6/bsv-shamir.min.js`
58
+ - **CDN**: `unpkg.com/@smartledger/bsv@7.5.8/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.5.6/bsv-gdaf.min.js`
64
+ - **CDN**: `unpkg.com/@smartledger/bsv@7.5.8/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.5.6/bsv-ltp.min.js`
70
+ - **CDN**: `unpkg.com/@smartledger/bsv@7.5.8/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.5.6/bsv.min.js` |
85
- | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.5.6/bsv.bundle.js` |
86
- | **bsv-smartcontract.min.js** | 937KB | Covenant development | `unpkg.com/@smartledger/bsv@7.5.6/bsv-smartcontract.min.js` |
87
- | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.5.6/bsv-covenant.min.js` |
88
- | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.5.6/bsv-script-helper.min.js` |
89
- | **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@7.5.6/bsv-security.min.js` |
90
- | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@7.5.6/bsv-ecies.min.js` |
91
- | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@7.5.6/bsv-message.min.js` |
92
- | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@7.5.6/bsv-mnemonic.min.js` |
93
- | **🆕 bsv-shamir.min.js** | 432KB | **Secret sharing** | `unpkg.com/@smartledger/bsv@7.5.6/bsv-shamir.min.js` |
94
- | **🆕 bsv-gdaf.min.js** | 1184KB | **Digital attestation** | `unpkg.com/@smartledger/bsv@7.5.6/bsv-gdaf.min.js` |
95
- | **🆕 bsv-ltp.min.js** | 1184KB | **Legal tokens** | `unpkg.com/@smartledger/bsv@7.5.6/bsv-ltp.min.js` |
84
+ | **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@7.5.8/bsv.min.js` |
85
+ | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.5.8/bsv.bundle.js` |
86
+ | **bsv-smartcontract.min.js** | 937KB | Covenant development | `unpkg.com/@smartledger/bsv@7.5.8/bsv-smartcontract.min.js` |
87
+ | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.5.8/bsv-covenant.min.js` |
88
+ | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.5.8/bsv-script-helper.min.js` |
89
+ | **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@7.5.8/bsv-security.min.js` |
90
+ | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@7.5.8/bsv-ecies.min.js` |
91
+ | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@7.5.8/bsv-message.min.js` |
92
+ | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@7.5.8/bsv-mnemonic.min.js` |
93
+ | **🆕 bsv-shamir.min.js** | 432KB | **Secret sharing** | `unpkg.com/@smartledger/bsv@7.5.8/bsv-shamir.min.js` |
94
+ | **🆕 bsv-gdaf.min.js** | 1184KB | **Digital attestation** | `unpkg.com/@smartledger/bsv@7.5.8/bsv-gdaf.min.js` |
95
+ | **🆕 bsv-ltp.min.js** | 1184KB | **Legal tokens** | `unpkg.com/@smartledger/bsv@7.5.8/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.5.6/bsv.min.js"></script>
104
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv-script-helper.min.js"></script>
103
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv.min.js"></script>
104
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/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.5.6/bsv.min.js"></script>
110
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv-covenant.min.js"></script>
111
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv-smartcontract.min.js"></script>
109
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv.min.js"></script>
110
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-covenant.min.js"></script>
111
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/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.5.6/bsv.min.js"></script>
117
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv-ltp.min.js"></script>
118
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv-gdaf.min.js"></script>
116
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv.min.js"></script>
117
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-ltp.min.js"></script>
118
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/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.5.6/bsv.min.js"></script>
136
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv-security.min.js"></script>
137
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv-shamir.min.js"></script>
135
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv.min.js"></script>
136
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-security.min.js"></script>
137
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/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.5.6/bsv.bundle.js"></script>
149
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/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.5.6/bsv.min.js"></script>
725
+ <script src="https://cdn.jsdelivr.net/npm/@smartledger/bsv@7.5.8/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.5.6/bsv.min.js"></script>
51
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/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.5.6/bsv.bundle.js"></script>
61
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/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.5.6/bsv.min.js"></script>
75
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv-covenant.min.js"></script>
76
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv-smartcontract.min.js"></script>
74
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv.min.js"></script>
75
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-covenant.min.js"></script>
76
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/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.5.6/bsv.min.js"></script>
86
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv-ltp.min.js"></script>
87
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv-gdaf.min.js"></script>
85
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv.min.js"></script>
86
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-ltp.min.js"></script>
87
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/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.5.6/bsv.min.js"></script>
102
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv-security.min.js"></script>
103
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv-shamir.min.js"></script>
101
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv.min.js"></script>
102
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-security.min.js"></script>
103
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/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.5.6/bsv.min.js` |
118
- | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.5.6/bsv.bundle.js` |
119
- | **bsv-smartcontract.min.js** | 937KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@7.5.6/bsv-smartcontract.min.js` |
120
- | **bsv-ltp.min.js** | 1184KB | **Legal Token Protocol** | `unpkg.com/@smartledger/bsv@7.5.6/bsv-ltp.min.js` |
121
- | **bsv-gdaf.min.js** | 1184KB | **Digital Identity & Attestation** | `unpkg.com/@smartledger/bsv@7.5.6/bsv-gdaf.min.js` |
122
- | **bsv-shamir.min.js** | 432KB | **Threshold Cryptography** | `unpkg.com/@smartledger/bsv@7.5.6/bsv-shamir.min.js` |
123
- | **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@7.5.6/bsv-security.min.js` |
124
- | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@7.5.6/bsv-mnemonic.min.js` |
125
- | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@7.5.6/bsv-ecies.min.js` |
126
- | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.5.6/bsv-covenant.min.js` |
127
- | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.5.6/bsv-script-helper.min.js` |
128
- | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@7.5.6/bsv-message.min.js` |
117
+ | **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@7.5.8/bsv.min.js` |
118
+ | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.5.8/bsv.bundle.js` |
119
+ | **bsv-smartcontract.min.js** | 937KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@7.5.8/bsv-smartcontract.min.js` |
120
+ | **bsv-ltp.min.js** | 1184KB | **Legal Token Protocol** | `unpkg.com/@smartledger/bsv@7.5.8/bsv-ltp.min.js` |
121
+ | **bsv-gdaf.min.js** | 1184KB | **Digital Identity & Attestation** | `unpkg.com/@smartledger/bsv@7.5.8/bsv-gdaf.min.js` |
122
+ | **bsv-shamir.min.js** | 432KB | **Threshold Cryptography** | `unpkg.com/@smartledger/bsv@7.5.8/bsv-shamir.min.js` |
123
+ | **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@7.5.8/bsv-security.min.js` |
124
+ | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@7.5.8/bsv-mnemonic.min.js` |
125
+ | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@7.5.8/bsv-ecies.min.js` |
126
+ | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.5.8/bsv-covenant.min.js` |
127
+ | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.5.8/bsv-script-helper.min.js` |
128
+ | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@7.5.8/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.5.6/bsv.min.js"></script>
17
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv.min.js"></script>
18
18
 
19
19
  <!-- Everything included (937KB) -->
20
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv.bundle.js"></script>
20
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/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.5.6/bsv.min.js"></script>
130
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv.min.js"></script>
131
131
 
132
132
  <!-- Smart contracts (937KB) -->
133
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv-smartcontract.min.js"></script>
133
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-smartcontract.min.js"></script>
134
134
 
135
135
  <!-- Legal tokens (1.16MB) -->
136
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv-ltp.min.js"></script>
136
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-ltp.min.js"></script>
137
137
 
138
138
  <!-- Digital identity (1.16MB) -->
139
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv-gdaf.min.js"></script>
139
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-gdaf.min.js"></script>
140
140
 
141
141
  <!-- Everything (937KB) -->
142
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv.bundle.js"></script>
142
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/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.5.6/bsv.min.js"></script>
162
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv.min.js"></script>
163
163
 
164
164
  <!-- Add smart contracts when ready -->
165
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv-smartcontract.min.js"></script>
165
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-smartcontract.min.js"></script>
166
166
 
167
167
  <!-- Add advanced features as needed -->
168
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv-ltp.min.js"></script>
169
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv-gdaf.min.js"></script>
168
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-ltp.min.js"></script>
169
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-gdaf.min.js"></script>
170
170
 
171
171
  <!-- Everything in one file -->
172
- <script src="https://unpkg.com/@smartledger/bsv@7.5.6/bsv.bundle.js"></script>
172
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv.bundle.js"></script>
173
173
  ```
174
174
 
175
175
  ## 🔍 **Testing Your Migration**
package/lib/address.js CHANGED
@@ -97,7 +97,7 @@ Address.prototype._classifyArguments = function (data, network, type) {
97
97
  return Address._transformBuffer(data, network, type)
98
98
  } else if (data instanceof PublicKey) {
99
99
  return Address._transformPublicKey(data)
100
- } else if (data instanceof Script) {
100
+ } else if (data instanceof scriptClass()) {
101
101
  return Address._transformScript(data, network)
102
102
  } else if (typeof (data) === 'string') {
103
103
  return Address._transformString(data, network, type)
@@ -237,7 +237,7 @@ Address._transformPublicKey = function (pubkey) {
237
237
  * @private
238
238
  */
239
239
  Address._transformScript = function (script, network) {
240
- $.checkArgument(script instanceof Script, 'script must be a Script instance')
240
+ $.checkArgument(script instanceof scriptClass(), 'script must be a Script instance')
241
241
  var info = script.getAddressInfo(network)
242
242
  if (!info) {
243
243
  throw new errors.Script.CantDeriveAddress(script)
@@ -259,7 +259,7 @@ Address._transformScript = function (script, network) {
259
259
  */
260
260
  Address.createMultisig = function (publicKeys, threshold, network) {
261
261
  network = network || publicKeys[0].network || Networks.defaultNetwork
262
- return Address.payingTo(Script.buildMultisigOut(publicKeys, threshold), network)
262
+ return Address.payingTo(scriptClass().buildMultisigOut(publicKeys, threshold), network)
263
263
  }
264
264
 
265
265
  /**
@@ -352,7 +352,7 @@ Address.fromScriptHash = function (hash, network) {
352
352
  */
353
353
  Address.payingTo = function (script, network) {
354
354
  $.checkArgument(script, 'script is required')
355
- $.checkArgument(script instanceof Script, 'script must be instance of Script')
355
+ $.checkArgument(script instanceof scriptClass(), 'script must be instance of Script')
356
356
 
357
357
  return Address.fromScriptHash(Hash.sha256ripemd160(script.toBuffer()), network)
358
358
  }
@@ -370,7 +370,7 @@ Address.payingTo = function (script, network) {
370
370
  * @returns {Address} A new valid and frozen instance of an Address
371
371
  */
372
372
  Address.fromScript = function (script, network) {
373
- $.checkArgument(script instanceof Script, 'script must be a Script instance')
373
+ $.checkArgument(script instanceof scriptClass(), 'script must be a Script instance')
374
374
  var info = Address._transformScript(script, network)
375
375
  return new Address(info.hashBuffer, network, info.type)
376
376
  }
@@ -523,4 +523,21 @@ Address.prototype.toString = function () {
523
523
 
524
524
  module.exports = Address
525
525
 
526
- var Script = require('./script')
526
+ /**
527
+ * Resolve the Script constructor at CALL time rather than capturing it here.
528
+ *
529
+ * `address` and `script` form a require cycle. The old idiom — export yourself, then
530
+ * `var Script = require('./script')` — only works when `address` is loaded first: if a
531
+ * consumer reaches `lib/script` first, that require returns script's PARTIALLY
532
+ * INITIALISED exports (`{}`), the captured `Script` stays `{}` forever, and every
533
+ * `instanceof` throws "Right-hand side of 'instanceof' is not callable". `var` hoisting hid it,
534
+ * because the name is in scope for the functions defined above.
535
+ *
536
+ * Deep imports are public API via the `exports` map ("./lib/*"), so that load order is
537
+ * supported and the failure was reachable. `require` is cached, so resolving on demand
538
+ * costs nothing, and by the time any of these functions run the module is complete —
539
+ * which keeps `instanceof` exact rather than loosening the check to a duck type.
540
+ */
541
+ function scriptClass () {
542
+ return require('./script')
543
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartledger/bsv",
3
- "version": "7.5.6",
3
+ "version": "7.5.8",
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",
@@ -29,6 +29,22 @@
29
29
  "./smartcontract": "./smartcontract-entry.js",
30
30
  "./statuslist": "./statuslist-entry.js",
31
31
  "./vcjwt": "./vcjwt-entry.js",
32
+ "./lib/anchor": "./lib/anchor/index.js",
33
+ "./lib/block": "./lib/block/index.js",
34
+ "./lib/didweb": "./lib/didweb/index.js",
35
+ "./lib/ecies": "./lib/ecies/index.js",
36
+ "./lib/errors": "./lib/errors/index.js",
37
+ "./lib/gdaf": "./lib/gdaf/index.js",
38
+ "./lib/ltp": "./lib/ltp/index.js",
39
+ "./lib/message": "./lib/message/index.js",
40
+ "./lib/mnemonic": "./lib/mnemonic/index.js",
41
+ "./lib/ordinals": "./lib/ordinals/index.js",
42
+ "./lib/script": "./lib/script/index.js",
43
+ "./lib/smart_contract": "./lib/smart_contract/index.js",
44
+ "./lib/spv": "./lib/spv/index.js",
45
+ "./lib/statuslist": "./lib/statuslist/index.js",
46
+ "./lib/transaction": "./lib/transaction/index.js",
47
+ "./lib/vcjwt": "./lib/vcjwt/index.js",
32
48
  "./lib/*.js": "./lib/*.js",
33
49
  "./lib/*": "./lib/*.js",
34
50
  "./*": "./*"
@@ -41,6 +57,7 @@
41
57
  },
42
58
  "scripts": {
43
59
  "lint": "standard",
60
+ "check:load-order": "node scripts/check-address-load-order.js",
44
61
  "lint:ratchet": "node scripts/lint-ratchet.js",
45
62
  "lint:ratchet:update": "node scripts/lint-ratchet.js --update",
46
63
  "test": "mocha",
@@ -10,6 +10,7 @@
10
10
  // condition in a child process so the dual-ready "." entry can't silently rot.
11
11
 
12
12
  require('chai').should()
13
+ var fs = require('fs')
13
14
  var path = require('path')
14
15
  var execFileSync = require('child_process').execFileSync
15
16
 
@@ -38,6 +39,31 @@ describe('7.0 exports map resolution', function () {
38
39
  noExt.should.equal(withExt) // same module, one cache entry
39
40
  })
40
41
 
42
+ // `./lib/*` maps to `./lib/*.js`, so a DIRECTORY module (lib/script, lib/ordinals,
43
+ // ...) did not resolve at all — `require('@smartledger/bsv/lib/script')` raised
44
+ // MODULE_NOT_FOUND, because there is no lib/script.js. Explicit entries now point each
45
+ // directory at its index.js. Every directory under lib/ that has one is listed, so a
46
+ // new module cannot be added without also being exported.
47
+ it('resolves every lib/ directory module by its bare directory name', function () {
48
+ var libDir = path.join(ROOT, 'lib')
49
+ var dirs = fs.readdirSync(libDir).filter(function (d) {
50
+ return fs.existsSync(path.join(libDir, d, 'index.js'))
51
+ })
52
+ dirs.length.should.be.above(0)
53
+ dirs.forEach(function (d) {
54
+ var bare = require(N + '/lib/' + d)
55
+ var explicit = require(N + '/lib/' + d + '/index.js')
56
+ ;(bare === explicit).should.equal(true) // same module, one cache entry
57
+ })
58
+ })
59
+
60
+ it('still resolves lib/ FILE modules, which share the same pattern', function () {
61
+ var noExt = require(N + '/lib/address')
62
+ var withExt = require(N + '/lib/address.js')
63
+ ;(noExt === withExt).should.equal(true)
64
+ noExt.should.be.a('function')
65
+ })
66
+
41
67
  it('serves the full browser bundle over a subpath (loaded in isolation)', function () {
42
68
  // The bundle is a self-contained bsv; loading it in-process collides with the
43
69
  // main require above ("multiple bsv instances"), so resolve+load it in a child.
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 = '7.5.6'
3
+ module.exports = '7.5.8'