@smartledger/bsv 7.2.0 → 7.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +136 -0
- package/README.md +38 -38
- package/bsv-gdaf.min.js +44 -44
- package/bsv-ltp.min.js +44 -44
- package/bsv-smartcontract.min.js +1 -1
- package/bsv.bundle.js +44 -44
- package/bsv.d.ts +19 -4
- package/bsv.min.js +44 -44
- 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/ordinals/README.md +48 -5
- package/lib/ordinals/bsv20.js +215 -15
- package/lib/ordinals/ordlock.js +27 -1
- package/package.json +1 -1
- package/test/ordinals/bsv20.js +213 -2
- package/test/ordinals/ordlock.js +71 -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.
|
|
58
|
+
- **CDN**: `unpkg.com/@smartledger/bsv@7.4.0/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.
|
|
64
|
+
- **CDN**: `unpkg.com/@smartledger/bsv@7.4.0/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.
|
|
70
|
+
- **CDN**: `unpkg.com/@smartledger/bsv@7.4.0/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.
|
|
85
|
-
| **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.
|
|
86
|
-
| **bsv-smartcontract.min.js** | 937KB | Covenant development | `unpkg.com/@smartledger/bsv@7.
|
|
87
|
-
| **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.
|
|
88
|
-
| **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.
|
|
89
|
-
| **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@7.
|
|
90
|
-
| **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@7.
|
|
91
|
-
| **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@7.
|
|
92
|
-
| **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@7.
|
|
93
|
-
| **🆕 bsv-shamir.min.js** | 432KB | **Secret sharing** | `unpkg.com/@smartledger/bsv@7.
|
|
94
|
-
| **🆕 bsv-gdaf.min.js** | 1184KB | **Digital attestation** | `unpkg.com/@smartledger/bsv@7.
|
|
95
|
-
| **🆕 bsv-ltp.min.js** | 1184KB | **Legal tokens** | `unpkg.com/@smartledger/bsv@7.
|
|
84
|
+
| **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@7.4.0/bsv.min.js` |
|
|
85
|
+
| **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.4.0/bsv.bundle.js` |
|
|
86
|
+
| **bsv-smartcontract.min.js** | 937KB | Covenant development | `unpkg.com/@smartledger/bsv@7.4.0/bsv-smartcontract.min.js` |
|
|
87
|
+
| **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.4.0/bsv-covenant.min.js` |
|
|
88
|
+
| **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.4.0/bsv-script-helper.min.js` |
|
|
89
|
+
| **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@7.4.0/bsv-security.min.js` |
|
|
90
|
+
| **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@7.4.0/bsv-ecies.min.js` |
|
|
91
|
+
| **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@7.4.0/bsv-message.min.js` |
|
|
92
|
+
| **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@7.4.0/bsv-mnemonic.min.js` |
|
|
93
|
+
| **🆕 bsv-shamir.min.js** | 432KB | **Secret sharing** | `unpkg.com/@smartledger/bsv@7.4.0/bsv-shamir.min.js` |
|
|
94
|
+
| **🆕 bsv-gdaf.min.js** | 1184KB | **Digital attestation** | `unpkg.com/@smartledger/bsv@7.4.0/bsv-gdaf.min.js` |
|
|
95
|
+
| **🆕 bsv-ltp.min.js** | 1184KB | **Legal tokens** | `unpkg.com/@smartledger/bsv@7.4.0/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.
|
|
104
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
103
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/bsv.min.js"></script>
|
|
104
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/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.
|
|
110
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
111
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
109
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/bsv.min.js"></script>
|
|
110
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/bsv-covenant.min.js"></script>
|
|
111
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/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.
|
|
117
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
118
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
116
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/bsv.min.js"></script>
|
|
117
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/bsv-ltp.min.js"></script>
|
|
118
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/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.
|
|
136
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
137
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
135
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/bsv.min.js"></script>
|
|
136
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/bsv-security.min.js"></script>
|
|
137
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/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.
|
|
149
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/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.
|
|
725
|
+
<script src="https://cdn.jsdelivr.net/npm/@smartledger/bsv@7.4.0/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.
|
|
51
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/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.
|
|
61
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/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.
|
|
75
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
76
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
74
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/bsv.min.js"></script>
|
|
75
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/bsv-covenant.min.js"></script>
|
|
76
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/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.
|
|
86
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
87
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
85
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/bsv.min.js"></script>
|
|
86
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/bsv-ltp.min.js"></script>
|
|
87
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/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.
|
|
102
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
103
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
101
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/bsv.min.js"></script>
|
|
102
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/bsv-security.min.js"></script>
|
|
103
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/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.
|
|
118
|
-
| **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.
|
|
119
|
-
| **bsv-smartcontract.min.js** | 937KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@7.
|
|
120
|
-
| **bsv-ltp.min.js** | 1184KB | **Legal Token Protocol** | `unpkg.com/@smartledger/bsv@7.
|
|
121
|
-
| **bsv-gdaf.min.js** | 1184KB | **Digital Identity & Attestation** | `unpkg.com/@smartledger/bsv@7.
|
|
122
|
-
| **bsv-shamir.min.js** | 432KB | **Threshold Cryptography** | `unpkg.com/@smartledger/bsv@7.
|
|
123
|
-
| **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@7.
|
|
124
|
-
| **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@7.
|
|
125
|
-
| **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@7.
|
|
126
|
-
| **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.
|
|
127
|
-
| **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.
|
|
128
|
-
| **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@7.
|
|
117
|
+
| **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@7.4.0/bsv.min.js` |
|
|
118
|
+
| **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.4.0/bsv.bundle.js` |
|
|
119
|
+
| **bsv-smartcontract.min.js** | 937KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@7.4.0/bsv-smartcontract.min.js` |
|
|
120
|
+
| **bsv-ltp.min.js** | 1184KB | **Legal Token Protocol** | `unpkg.com/@smartledger/bsv@7.4.0/bsv-ltp.min.js` |
|
|
121
|
+
| **bsv-gdaf.min.js** | 1184KB | **Digital Identity & Attestation** | `unpkg.com/@smartledger/bsv@7.4.0/bsv-gdaf.min.js` |
|
|
122
|
+
| **bsv-shamir.min.js** | 432KB | **Threshold Cryptography** | `unpkg.com/@smartledger/bsv@7.4.0/bsv-shamir.min.js` |
|
|
123
|
+
| **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@7.4.0/bsv-security.min.js` |
|
|
124
|
+
| **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@7.4.0/bsv-mnemonic.min.js` |
|
|
125
|
+
| **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@7.4.0/bsv-ecies.min.js` |
|
|
126
|
+
| **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.4.0/bsv-covenant.min.js` |
|
|
127
|
+
| **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.4.0/bsv-script-helper.min.js` |
|
|
128
|
+
| **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@7.4.0/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.
|
|
17
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/bsv.min.js"></script>
|
|
18
18
|
|
|
19
19
|
<!-- Everything included (937KB) -->
|
|
20
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
20
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/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.
|
|
130
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/bsv.min.js"></script>
|
|
131
131
|
|
|
132
132
|
<!-- Smart contracts (937KB) -->
|
|
133
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
133
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/bsv-smartcontract.min.js"></script>
|
|
134
134
|
|
|
135
135
|
<!-- Legal tokens (1.16MB) -->
|
|
136
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
136
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/bsv-ltp.min.js"></script>
|
|
137
137
|
|
|
138
138
|
<!-- Digital identity (1.16MB) -->
|
|
139
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
139
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/bsv-gdaf.min.js"></script>
|
|
140
140
|
|
|
141
141
|
<!-- Everything (937KB) -->
|
|
142
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
142
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/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.
|
|
162
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/bsv.min.js"></script>
|
|
163
163
|
|
|
164
164
|
<!-- Add smart contracts when ready -->
|
|
165
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
165
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/bsv-smartcontract.min.js"></script>
|
|
166
166
|
|
|
167
167
|
<!-- Add advanced features as needed -->
|
|
168
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
169
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
168
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/bsv-ltp.min.js"></script>
|
|
169
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/bsv-gdaf.min.js"></script>
|
|
170
170
|
|
|
171
171
|
<!-- Everything in one file -->
|
|
172
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
172
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.4.0/bsv.bundle.js"></script>
|
|
173
173
|
```
|
|
174
174
|
|
|
175
175
|
## 🔍 **Testing Your Migration**
|
package/lib/ordinals/README.md
CHANGED
|
@@ -113,6 +113,22 @@ var terms = Ord.parseOrdLock(script)
|
|
|
113
113
|
// }
|
|
114
114
|
```
|
|
115
115
|
|
|
116
|
+
**`parseOrdLock` verifies, it does not pattern-match.** The terms are recovered from the
|
|
117
|
+
script's shape and then checked by reconstruction: the listing is rebuilt from the recovered
|
|
118
|
+
seller / payments / inscription and must match the input byte-for-byte. A script that merely
|
|
119
|
+
wears the same arrangement of opcodes — without the `OP_PUSH_TX` covenant that actually binds
|
|
120
|
+
the payment into `hashOutputs` — is rejected. So a non-null result means the purchase branch
|
|
121
|
+
really does enforce payment, and a UI can display the price without inventing a listing that
|
|
122
|
+
does not exist.
|
|
123
|
+
|
|
124
|
+
> **Interoperability.** This is *this library's* OrdLock. Semantically it is the widely
|
|
125
|
+
> deployed ordinal-lock pattern — `hash256(destOutput ‖ payOutput ‖ trailingOutputs) ==
|
|
126
|
+
> hashOutputs` under `SIGHASH_ALL|ANYONECANPAY` — generalized to multiple payment outputs.
|
|
127
|
+
> But it is built on our audited `OP_PUSH_TX` core rather than compiled from the sCrypt
|
|
128
|
+
> `OrdinalLock` contract, so **the script bytes differ and listings are not interchangeable
|
|
129
|
+
> with that template**: `parseOrdLock` reads listings this library built, not arbitrary
|
|
130
|
+
> marketplace listings.
|
|
131
|
+
|
|
116
132
|
### Buy (purchase side)
|
|
117
133
|
|
|
118
134
|
```js
|
|
@@ -160,10 +176,17 @@ B.buildDeploy({ address: owner, tick: 'ORDI', max: '21000000', lim: '1000', dec:
|
|
|
160
176
|
B.buildMint({ address: owner, tick: 'ORDI', amt: '1000' })
|
|
161
177
|
B.buildTransfer({ address: newOwner, tick: 'ORDI', amt: '250' })
|
|
162
178
|
|
|
163
|
-
// v2 / BSV-21: deploy+mint
|
|
179
|
+
// v2 / BSV-21, fixed supply: deploy+mint, then transfer by id.
|
|
164
180
|
B.buildDeployMint({ address: owner, amt: '1000000', dec: 8, sym: 'XYZ' })
|
|
165
181
|
B.buildTransfer({ address: newOwner, id: deployTxid + '_0', amt: '5' })
|
|
166
182
|
|
|
183
|
+
// v2 / BSV-21, authority model: no supply at deploy; an auth output carries the right
|
|
184
|
+
// to mint, and minting names the token by id (and needs an auth input on chain).
|
|
185
|
+
B.buildDeployAuth({ address: owner, sym: 'STABLE', dec: 6 })
|
|
186
|
+
B.buildAuth({ address: minter, id: deployTxid + '_0' }) // delegate mint authority
|
|
187
|
+
B.buildMint({ address: holder, id: deployTxid + '_0', amt: '1000000' })
|
|
188
|
+
B.buildBurn({ address: holder, id: deployTxid + '_0', amt: '400' })
|
|
189
|
+
|
|
167
190
|
// 1-sat outputs and parsing.
|
|
168
191
|
var out = B.createMintOutput({ address: owner, tick: 'ORDI', amt: '1' })
|
|
169
192
|
B.isBsv20(out.script) // true
|
|
@@ -171,9 +194,28 @@ B.parseBsv20(script) // { p:'bsv-20', op:'mint', tick:'ORDI', a
|
|
|
171
194
|
B.parseBsv20('{"p":"bsv-20","op":"mint","tick":"ORDI","amt":"1"}') // also accepts JSON / objects
|
|
172
195
|
```
|
|
173
196
|
|
|
174
|
-
Builders validate their inputs
|
|
175
|
-
well-formed BSV-21 `id
|
|
176
|
-
|
|
197
|
+
Builders validate their inputs against the specification and throw on bad data: ticker ≤ 4
|
|
198
|
+
bytes, `dec` 0–18, well-formed BSV-21 `id`, and amounts that are non-negative integers
|
|
199
|
+
**within uint64** (`amt`/`max`/`lim` are "strings representing uint64" — a larger value is
|
|
200
|
+
valid JSON that indexers discard, burning the tokens). A numeric amount past
|
|
201
|
+
`Number.MAX_SAFE_INTEGER` is rejected rather than silently rounded; pass a string. `sym` and
|
|
202
|
+
`icon` must be strings — `icon` an outpoint reference (`<txid>_<vout>`), as the spec defines
|
|
203
|
+
it — so a stray object can no longer be written as the literal text `[object Object]`.
|
|
204
|
+
|
|
205
|
+
`lim: 0` is accepted and means *unlimited*, per the spec ("0 or omitted = unlimited"); only
|
|
206
|
+
`max`/`amt` must be greater than zero.
|
|
207
|
+
|
|
208
|
+
**`parseBsv20` / `isBsv20` enforce validity rather than assuming it.** The operation must be
|
|
209
|
+
one the spec defines and must carry the fields that operation requires — a `transfer` with no
|
|
210
|
+
amount and no token, an `auth` carrying `amt` (which the spec forbids), an over-uint64 amount,
|
|
211
|
+
or an unknown `op` all return `null`. Every operation the spec defines is both built and
|
|
212
|
+
read. Non-canonical amounts (leading zeros) are tolerated when reading other people's
|
|
213
|
+
payloads, though our builders always emit canonical ones.
|
|
214
|
+
|
|
215
|
+
An operation names its token by `tick` (v1) **or** `id` (BSV-21), never both — passing both
|
|
216
|
+
throws rather than silently picking one, since they are different tokens.
|
|
217
|
+
|
|
218
|
+
Balance tracking is an indexer concern — this module builds and reads the on-chain payloads.
|
|
177
219
|
|
|
178
220
|
## API
|
|
179
221
|
|
|
@@ -182,12 +224,13 @@ this module builds and reads the on-chain payloads.
|
|
|
182
224
|
| `buildInscription`, `createInscriptionOutput`, `batchInscriptionOutputs` | build inscription scripts / outputs |
|
|
183
225
|
| `parseInscription`, `isInscription` | read an inscription back |
|
|
184
226
|
| `buildOrdLock`, `listInscriptionOutput` | build an OrdLock listing script / 1-sat output |
|
|
185
|
-
| `parseOrdLock`, `isOrdLock` | recover a listing's seller, payments, price, inscription |
|
|
227
|
+
| `parseOrdLock`, `isOrdLock` | recover a listing's seller, payments, price, inscription — **verified**, see below |
|
|
186
228
|
| `buildListingTx` | assemble a signed listing tx (P2PKH ordinal → OrdLock) |
|
|
187
229
|
| `buildPurchaseTx` | assemble a signed purchase tx from a listing UTXO + buyer coins |
|
|
188
230
|
| `purchaseOrdLock`, `cancelOrdLock` | build unlock scripts for a spend you assemble |
|
|
189
231
|
| `payOutputFor` | build a P2PKH payment output |
|
|
190
232
|
| `ORDLOCK_SIGHASH` | `SIGHASH_ALL\|ANYONECANPAY\|FORKID` (0xc1) |
|
|
191
233
|
| `BSV20.buildDeploy` / `buildMint` / `buildTransfer` / `buildDeployMint` | build BSV-20/21 token inscriptions |
|
|
234
|
+
| `BSV20.buildDeployAuth` / `buildAuth` / `buildBurn` | BSV-21 authority model: deploy without supply, delegate mint rights, burn |
|
|
192
235
|
| `BSV20.create*Output` | 1-sat token outputs |
|
|
193
236
|
| `BSV20.parseBsv20`, `BSV20.isBsv20` | read a token payload back |
|