@1sat/templates 0.0.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/dist/bitcom/aip.d.ts +88 -0
- package/dist/bitcom/aip.d.ts.map +1 -0
- package/dist/bitcom/aip.js +205 -0
- package/dist/bitcom/aip.js.map +1 -0
- package/dist/bitcom/b.d.ts +99 -0
- package/dist/bitcom/b.d.ts.map +1 -0
- package/dist/bitcom/b.js +206 -0
- package/dist/bitcom/b.js.map +1 -0
- package/dist/bitcom/bap.d.ts +126 -0
- package/dist/bitcom/bap.d.ts.map +1 -0
- package/dist/bitcom/bap.js +334 -0
- package/dist/bitcom/bap.js.map +1 -0
- package/dist/bitcom/bitcom.d.ts +75 -0
- package/dist/bitcom/bitcom.d.ts.map +1 -0
- package/dist/bitcom/bitcom.js +186 -0
- package/dist/bitcom/bitcom.js.map +1 -0
- package/dist/bitcom/map.d.ts +90 -0
- package/dist/bitcom/map.d.ts.map +1 -0
- package/dist/bitcom/map.js +215 -0
- package/dist/bitcom/map.js.map +1 -0
- package/dist/bitcom/sigma.d.ts +93 -0
- package/dist/bitcom/sigma.d.ts.map +1 -0
- package/dist/bitcom/sigma.js +175 -0
- package/dist/bitcom/sigma.js.map +1 -0
- package/dist/bsocial/bsocial.d.ts +152 -0
- package/dist/bsocial/bsocial.d.ts.map +1 -0
- package/dist/bsocial/bsocial.js +397 -0
- package/dist/bsocial/bsocial.js.map +1 -0
- package/dist/bsv20/bsv20.d.ts +277 -0
- package/dist/bsv20/bsv20.d.ts.map +1 -0
- package/dist/bsv20/bsv20.js +544 -0
- package/dist/bsv20/bsv20.js.map +1 -0
- package/dist/bsv21/bsv21.d.ts +231 -0
- package/dist/bsv21/bsv21.d.ts.map +1 -0
- package/dist/bsv21/bsv21.js +475 -0
- package/dist/bsv21/bsv21.js.map +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/inscription/inscription.d.ts +165 -0
- package/dist/inscription/inscription.d.ts.map +1 -0
- package/dist/inscription/inscription.js +401 -0
- package/dist/inscription/inscription.js.map +1 -0
- package/dist/lock/lock.d.ts +92 -0
- package/dist/lock/lock.d.ts.map +1 -0
- package/dist/lock/lock.js +283 -0
- package/dist/lock/lock.js.map +1 -0
- package/dist/ordlock/ordlock.d.ts +126 -0
- package/dist/ordlock/ordlock.d.ts.map +1 -0
- package/dist/ordlock/ordlock.js +316 -0
- package/dist/ordlock/ordlock.js.map +1 -0
- package/dist/signer.d.ts +39 -0
- package/dist/signer.d.ts.map +1 -0
- package/dist/signer.js +54 -0
- package/dist/signer.js.map +1 -0
- package/package.json +43 -0
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
import { Utils, } from '@bsv/sdk';
|
|
2
|
+
import Inscription from '../inscription/inscription.js';
|
|
3
|
+
/**
|
|
4
|
+
* BSV-21 class implementing ScriptTemplate for advanced token functionality.
|
|
5
|
+
*
|
|
6
|
+
* BSV-21 is an advanced token standard that builds on inscriptions to create
|
|
7
|
+
* sophisticated tokens with rich metadata, file attachments, and complex operations.
|
|
8
|
+
* Unlike BSV-20's simple JSON structure, BSV-21 leverages the full power of
|
|
9
|
+
* inscriptions for token data storage.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* // Create deploy+mint token (initial token creation)
|
|
14
|
+
* const token = BSV21.deployMint("MYTOKEN", 1000000n, 8, "https://example.com/icon.png");
|
|
15
|
+
* const lockingScript = token.lock();
|
|
16
|
+
*
|
|
17
|
+
* // Transfer tokens
|
|
18
|
+
* const transfer = BSV21.transfer("token_deployment_outpoint", 500n);
|
|
19
|
+
* const transferScript = transfer.lock();
|
|
20
|
+
*
|
|
21
|
+
* // Parse token from script
|
|
22
|
+
* const parsed = BSV21.decode(someScript);
|
|
23
|
+
* if (parsed) {
|
|
24
|
+
* console.log(`Symbol: ${parsed.getSymbol()}`);
|
|
25
|
+
* console.log(`Amount: ${parsed.getAmount()}`);
|
|
26
|
+
* console.log(`Operation: ${parsed.tokenData.op}`);
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export default class BSV21 {
|
|
31
|
+
/** BSV-21 token data */
|
|
32
|
+
tokenData;
|
|
33
|
+
/** Underlying inscription containing the token data */
|
|
34
|
+
inscription;
|
|
35
|
+
/**
|
|
36
|
+
* Creates a new BSV21 instance
|
|
37
|
+
*
|
|
38
|
+
* @param tokenData - The token data structure
|
|
39
|
+
* @param inscription - The inscription containing the token data
|
|
40
|
+
*/
|
|
41
|
+
constructor(tokenData, inscription) {
|
|
42
|
+
this.tokenData = tokenData;
|
|
43
|
+
this.inscription = inscription;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Creates a deploy+mint token (initial token creation with minting)
|
|
47
|
+
*
|
|
48
|
+
* @param symbol - Token symbol/ticker (e.g., "MYTOKEN")
|
|
49
|
+
* @param amount - Initial amount to mint
|
|
50
|
+
* @param decimals - Number of decimal places (0-18, default 0)
|
|
51
|
+
* @param icon - Optional icon URL or data URI
|
|
52
|
+
* @param options - Optional inscription parameters
|
|
53
|
+
* @returns A new BSV21 instance
|
|
54
|
+
*/
|
|
55
|
+
static deployMint(symbol, amount, decimals = 0, icon, options = {}) {
|
|
56
|
+
// Validate parameters
|
|
57
|
+
if (symbol == null || symbol === '' || symbol.length === 0) {
|
|
58
|
+
throw new Error('Symbol cannot be empty');
|
|
59
|
+
}
|
|
60
|
+
if (symbol.length > 32) {
|
|
61
|
+
throw new Error('Symbol cannot exceed 32 characters');
|
|
62
|
+
}
|
|
63
|
+
if (amount <= BigInt(0)) {
|
|
64
|
+
throw new Error('Amount must be positive');
|
|
65
|
+
}
|
|
66
|
+
if (decimals < 0 || decimals > 18) {
|
|
67
|
+
throw new Error('Decimals must be between 0 and 18');
|
|
68
|
+
}
|
|
69
|
+
// Create token data
|
|
70
|
+
const tokenData = {
|
|
71
|
+
p: 'bsv-20',
|
|
72
|
+
op: 'deploy+mint',
|
|
73
|
+
sym: symbol,
|
|
74
|
+
amt: amount.toString(),
|
|
75
|
+
};
|
|
76
|
+
// Add optional fields
|
|
77
|
+
if (decimals > 0) {
|
|
78
|
+
tokenData.dec = decimals;
|
|
79
|
+
}
|
|
80
|
+
if (icon != null && icon !== '') {
|
|
81
|
+
tokenData.icon = icon;
|
|
82
|
+
}
|
|
83
|
+
// Create inscription with token JSON
|
|
84
|
+
// Note: dec must be serialized as a string per BSV-20 protocol
|
|
85
|
+
const wireFormat = {
|
|
86
|
+
...tokenData,
|
|
87
|
+
dec: tokenData.dec !== undefined ? tokenData.dec.toString() : undefined,
|
|
88
|
+
};
|
|
89
|
+
// Remove undefined fields
|
|
90
|
+
for (const key of Object.keys(wireFormat)) {
|
|
91
|
+
if (wireFormat[key] === undefined) {
|
|
92
|
+
delete wireFormat[key];
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
const jsonContent = JSON.stringify(wireFormat);
|
|
96
|
+
const inscription = Inscription.fromText(jsonContent, 'application/bsv-20', options);
|
|
97
|
+
return new BSV21(tokenData, inscription);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Creates a transfer token for moving tokens between addresses
|
|
101
|
+
*
|
|
102
|
+
* @param tokenId - Token deployment transaction outpoint (txid_vout)
|
|
103
|
+
* @param amount - Amount to transfer
|
|
104
|
+
* @param options - Optional inscription parameters
|
|
105
|
+
* @returns A new BSV21 instance
|
|
106
|
+
*/
|
|
107
|
+
static transfer(tokenId, amount, options = {}) {
|
|
108
|
+
// Validate parameters
|
|
109
|
+
if (tokenId == null || tokenId === '' || tokenId.length === 0) {
|
|
110
|
+
throw new Error('Token ID cannot be empty');
|
|
111
|
+
}
|
|
112
|
+
if (amount <= BigInt(0)) {
|
|
113
|
+
throw new Error('Amount must be positive');
|
|
114
|
+
}
|
|
115
|
+
// Validate token ID format (txid_vout)
|
|
116
|
+
const parts = tokenId.split('_');
|
|
117
|
+
if (parts.length !== 2 ||
|
|
118
|
+
parts[0].length !== 64 ||
|
|
119
|
+
!/^\d+$/.test(parts[1])) {
|
|
120
|
+
throw new Error('Token ID must be in format: txid_vout');
|
|
121
|
+
}
|
|
122
|
+
// Create token data
|
|
123
|
+
const tokenData = {
|
|
124
|
+
p: 'bsv-20',
|
|
125
|
+
op: 'transfer',
|
|
126
|
+
id: tokenId,
|
|
127
|
+
amt: amount.toString(),
|
|
128
|
+
};
|
|
129
|
+
// Create inscription with token JSON
|
|
130
|
+
const jsonContent = JSON.stringify(tokenData);
|
|
131
|
+
const inscription = Inscription.fromText(jsonContent, 'application/bsv-20', options);
|
|
132
|
+
return new BSV21(tokenData, inscription);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Creates a burn token for permanently destroying tokens
|
|
136
|
+
*
|
|
137
|
+
* @param tokenId - Token deployment transaction outpoint (txid_vout)
|
|
138
|
+
* @param amount - Amount to burn
|
|
139
|
+
* @param options - Optional inscription parameters
|
|
140
|
+
* @returns A new BSV21 instance
|
|
141
|
+
*/
|
|
142
|
+
static burn(tokenId, amount, options = {}) {
|
|
143
|
+
// Validate parameters
|
|
144
|
+
if (tokenId == null || tokenId === '' || tokenId.length === 0) {
|
|
145
|
+
throw new Error('Token ID cannot be empty');
|
|
146
|
+
}
|
|
147
|
+
if (amount <= BigInt(0)) {
|
|
148
|
+
throw new Error('Amount must be positive');
|
|
149
|
+
}
|
|
150
|
+
// Validate token ID format (txid_vout)
|
|
151
|
+
const parts = tokenId.split('_');
|
|
152
|
+
if (parts.length !== 2 ||
|
|
153
|
+
parts[0].length !== 64 ||
|
|
154
|
+
!/^\d+$/.test(parts[1])) {
|
|
155
|
+
throw new Error('Token ID must be in format: txid_vout');
|
|
156
|
+
}
|
|
157
|
+
// Create token data
|
|
158
|
+
const tokenData = {
|
|
159
|
+
p: 'bsv-20',
|
|
160
|
+
op: 'burn',
|
|
161
|
+
id: tokenId,
|
|
162
|
+
amt: amount.toString(),
|
|
163
|
+
};
|
|
164
|
+
// Create inscription with token JSON
|
|
165
|
+
const jsonContent = JSON.stringify(tokenData);
|
|
166
|
+
const inscription = Inscription.fromText(jsonContent, 'application/bsv-20', options);
|
|
167
|
+
return new BSV21(tokenData, inscription);
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Decodes a BSV-21 token from a script
|
|
171
|
+
*
|
|
172
|
+
* @param script - The script containing BSV-21 token data
|
|
173
|
+
* @returns Decoded BSV-21 token or null if not found/invalid
|
|
174
|
+
*/
|
|
175
|
+
static decode(script) {
|
|
176
|
+
try {
|
|
177
|
+
// First decode as inscription
|
|
178
|
+
const inscription = Inscription.decode(script);
|
|
179
|
+
if (inscription == null)
|
|
180
|
+
return null;
|
|
181
|
+
// Check if it's BSV-21 token (application/bsv-20 MIME type)
|
|
182
|
+
if (inscription.file.type !== 'application/bsv-20')
|
|
183
|
+
return null;
|
|
184
|
+
// Parse JSON content - use raw content since application/bsv-20 is not recognized as text
|
|
185
|
+
let jsonText;
|
|
186
|
+
try {
|
|
187
|
+
jsonText = Utils.toUTF8(Array.from(inscription.file.content));
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
const data = JSON.parse(jsonText);
|
|
193
|
+
// Validate required protocol fields
|
|
194
|
+
if (data.p !== 'bsv-20')
|
|
195
|
+
return null;
|
|
196
|
+
if (data.op == null || typeof data.op !== 'string')
|
|
197
|
+
return null;
|
|
198
|
+
if (data.amt == null || typeof data.amt !== 'string')
|
|
199
|
+
return null;
|
|
200
|
+
// Parse amount
|
|
201
|
+
let amount;
|
|
202
|
+
try {
|
|
203
|
+
amount = BigInt(data.amt);
|
|
204
|
+
if (amount <= BigInt(0))
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
catch {
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
210
|
+
// Validate operation and required fields
|
|
211
|
+
const operation = data.op.toLowerCase();
|
|
212
|
+
switch (operation) {
|
|
213
|
+
case 'deploy+mint':
|
|
214
|
+
if (data.sym == null || typeof data.sym !== 'string')
|
|
215
|
+
return null;
|
|
216
|
+
if (data.sym.length === 0 || data.sym.length > 32)
|
|
217
|
+
return null;
|
|
218
|
+
if (data.dec !== undefined) {
|
|
219
|
+
// dec must be a string in the JSON - reject if it's a JS number
|
|
220
|
+
if (typeof data.dec !== 'string')
|
|
221
|
+
return null;
|
|
222
|
+
const dec = Number.parseInt(data.dec, 10);
|
|
223
|
+
if (Number.isNaN(dec))
|
|
224
|
+
return null;
|
|
225
|
+
if (dec < 0 || dec > 18)
|
|
226
|
+
return null;
|
|
227
|
+
// Normalize to number for tokenData
|
|
228
|
+
data.dec = dec;
|
|
229
|
+
}
|
|
230
|
+
break;
|
|
231
|
+
case 'transfer':
|
|
232
|
+
case 'burn': {
|
|
233
|
+
if (data.id == null || typeof data.id !== 'string')
|
|
234
|
+
return null;
|
|
235
|
+
// Validate token ID format
|
|
236
|
+
const parts = data.id.split('_');
|
|
237
|
+
if (parts.length !== 2 ||
|
|
238
|
+
parts[0].length !== 64 ||
|
|
239
|
+
!/^\d+$/.test(parts[1])) {
|
|
240
|
+
return null;
|
|
241
|
+
}
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
default:
|
|
245
|
+
return null;
|
|
246
|
+
}
|
|
247
|
+
// Create token data structure
|
|
248
|
+
const tokenData = {
|
|
249
|
+
p: 'bsv-20',
|
|
250
|
+
op: operation,
|
|
251
|
+
amt: data.amt,
|
|
252
|
+
};
|
|
253
|
+
// Add operation-specific fields
|
|
254
|
+
if (operation === 'deploy+mint') {
|
|
255
|
+
tokenData.sym = data.sym;
|
|
256
|
+
if (data.dec !== undefined) {
|
|
257
|
+
tokenData.dec = data.dec;
|
|
258
|
+
}
|
|
259
|
+
if (data.icon != null && data.icon !== '') {
|
|
260
|
+
tokenData.icon = data.icon;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
tokenData.id = data.id;
|
|
265
|
+
}
|
|
266
|
+
return new BSV21(tokenData, inscription);
|
|
267
|
+
}
|
|
268
|
+
catch {
|
|
269
|
+
return null;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Creates a locking script containing the BSV-21 token inscription
|
|
274
|
+
*
|
|
275
|
+
* @param lockingScript - Optional locking script to append as suffix
|
|
276
|
+
* @returns A locking script containing the token data
|
|
277
|
+
*/
|
|
278
|
+
lock(lockingScript) {
|
|
279
|
+
if (lockingScript != null) {
|
|
280
|
+
// Create new inscription with the locking script as suffix
|
|
281
|
+
const options = {
|
|
282
|
+
parent: this.inscription.parent,
|
|
283
|
+
scriptPrefix: this.inscription.scriptPrefix,
|
|
284
|
+
scriptSuffix: lockingScript,
|
|
285
|
+
};
|
|
286
|
+
// Create new inscription with suffix
|
|
287
|
+
const jsonContent = JSON.stringify(this.tokenData);
|
|
288
|
+
const newInscription = Inscription.fromText(jsonContent, 'application/bsv-20', options);
|
|
289
|
+
return newInscription.lock();
|
|
290
|
+
}
|
|
291
|
+
return this.inscription.lock();
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* BSV-21 tokens cannot be unlocked directly as they are data containers
|
|
295
|
+
*
|
|
296
|
+
* @throws Error indicating unlock is not supported
|
|
297
|
+
*/
|
|
298
|
+
unlock() {
|
|
299
|
+
throw new Error('BSV-21 tokens cannot be unlocked directly');
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Gets the token amount as BigInt
|
|
303
|
+
*
|
|
304
|
+
* @returns Token amount
|
|
305
|
+
*/
|
|
306
|
+
getAmount() {
|
|
307
|
+
return BigInt(this.tokenData.amt);
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Gets the token amount as BigInt (concise method)
|
|
311
|
+
*
|
|
312
|
+
* @returns Token amount
|
|
313
|
+
*/
|
|
314
|
+
amount() {
|
|
315
|
+
return this.getAmount();
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Gets the token symbol (for deploy+mint operations)
|
|
319
|
+
*
|
|
320
|
+
* @returns Token symbol or undefined for transfer/burn operations
|
|
321
|
+
*/
|
|
322
|
+
getSymbol() {
|
|
323
|
+
return this.tokenData.sym;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Gets the token symbol (concise method)
|
|
327
|
+
*
|
|
328
|
+
* @returns Token symbol or undefined for transfer/burn operations
|
|
329
|
+
*/
|
|
330
|
+
symbol() {
|
|
331
|
+
return this.getSymbol();
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Gets the number of decimal places (for deploy+mint operations)
|
|
335
|
+
*
|
|
336
|
+
* @returns Number of decimals, defaults to 0
|
|
337
|
+
*/
|
|
338
|
+
getDecimals() {
|
|
339
|
+
return this.tokenData.dec ?? 0;
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Gets the token ID (for transfer/burn operations)
|
|
343
|
+
*
|
|
344
|
+
* @returns Token deployment outpoint or undefined for deploy+mint operations
|
|
345
|
+
*/
|
|
346
|
+
getTokenId() {
|
|
347
|
+
return this.tokenData.id;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Gets the icon URL or data URI (for deploy+mint operations)
|
|
351
|
+
*
|
|
352
|
+
* @returns Icon string or undefined
|
|
353
|
+
*/
|
|
354
|
+
getIcon() {
|
|
355
|
+
return this.tokenData.icon;
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Checks if this token has an icon
|
|
359
|
+
*
|
|
360
|
+
* @returns true if icon is present
|
|
361
|
+
*/
|
|
362
|
+
hasIcon() {
|
|
363
|
+
return this.tokenData.icon != null && this.tokenData.icon !== '';
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Gets the token operation type
|
|
367
|
+
*
|
|
368
|
+
* @returns The operation (deploy+mint, transfer, or burn)
|
|
369
|
+
*/
|
|
370
|
+
getOperation() {
|
|
371
|
+
return this.tokenData.op;
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Gets the token operation type (concise method)
|
|
375
|
+
*
|
|
376
|
+
* @returns The operation (deploy+mint, transfer, or burn)
|
|
377
|
+
*/
|
|
378
|
+
operation() {
|
|
379
|
+
return this.getOperation();
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Checks if this is a deploy+mint operation
|
|
383
|
+
*
|
|
384
|
+
* @returns true for deploy+mint operations
|
|
385
|
+
*/
|
|
386
|
+
isDeployMint() {
|
|
387
|
+
return this.tokenData.op === 'deploy+mint';
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Checks if this is a transfer operation
|
|
391
|
+
*
|
|
392
|
+
* @returns true for transfer operations
|
|
393
|
+
*/
|
|
394
|
+
isTransfer() {
|
|
395
|
+
return this.tokenData.op === 'transfer';
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Checks if this is a burn operation
|
|
399
|
+
*
|
|
400
|
+
* @returns true for burn operations
|
|
401
|
+
*/
|
|
402
|
+
isBurn() {
|
|
403
|
+
return this.tokenData.op === 'burn';
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Gets the underlying inscription
|
|
407
|
+
*
|
|
408
|
+
* @returns The inscription containing the token data
|
|
409
|
+
*/
|
|
410
|
+
getInscription() {
|
|
411
|
+
return this.inscription;
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Gets the token data as formatted JSON string
|
|
415
|
+
*
|
|
416
|
+
* @returns JSON representation of token data
|
|
417
|
+
*/
|
|
418
|
+
toJSON() {
|
|
419
|
+
return JSON.stringify(this.tokenData, null, 2);
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Validates the token data structure
|
|
423
|
+
*
|
|
424
|
+
* @returns true if token data is valid
|
|
425
|
+
*/
|
|
426
|
+
validate() {
|
|
427
|
+
try {
|
|
428
|
+
// Validate basic structure
|
|
429
|
+
if (this.tokenData.p !== 'bsv-20')
|
|
430
|
+
return false;
|
|
431
|
+
if (this.tokenData.op == null ||
|
|
432
|
+
this.tokenData.amt == null ||
|
|
433
|
+
this.tokenData.amt === '')
|
|
434
|
+
return false;
|
|
435
|
+
// Validate amount
|
|
436
|
+
const amount = BigInt(this.tokenData.amt);
|
|
437
|
+
if (amount <= BigInt(0))
|
|
438
|
+
return false;
|
|
439
|
+
// Validate operation-specific fields
|
|
440
|
+
switch (this.tokenData.op) {
|
|
441
|
+
case 'deploy+mint':
|
|
442
|
+
if (this.tokenData.sym == null ||
|
|
443
|
+
this.tokenData.sym === '' ||
|
|
444
|
+
this.tokenData.sym.length === 0 ||
|
|
445
|
+
this.tokenData.sym.length > 32) {
|
|
446
|
+
return false;
|
|
447
|
+
}
|
|
448
|
+
if (this.tokenData.dec !== undefined &&
|
|
449
|
+
(this.tokenData.dec < 0 || this.tokenData.dec > 18)) {
|
|
450
|
+
return false;
|
|
451
|
+
}
|
|
452
|
+
break;
|
|
453
|
+
case 'transfer':
|
|
454
|
+
case 'burn': {
|
|
455
|
+
if (this.tokenData.id == null || this.tokenData.id === '')
|
|
456
|
+
return false;
|
|
457
|
+
const parts = this.tokenData.id.split('_');
|
|
458
|
+
if (parts.length !== 2 ||
|
|
459
|
+
parts[0].length !== 64 ||
|
|
460
|
+
!/^\d+$/.test(parts[1])) {
|
|
461
|
+
return false;
|
|
462
|
+
}
|
|
463
|
+
break;
|
|
464
|
+
}
|
|
465
|
+
default:
|
|
466
|
+
return false;
|
|
467
|
+
}
|
|
468
|
+
return true;
|
|
469
|
+
}
|
|
470
|
+
catch {
|
|
471
|
+
return false;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
//# sourceMappingURL=bsv21.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bsv21.js","sourceRoot":"","sources":["../../src/bsv21/bsv21.ts"],"names":[],"mappings":"AAAA,OAAO,EAKN,KAAK,GACL,MAAM,UAAU,C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C;wBAClB,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,EAAE;wBACtB,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EACtB,CAAC;wBACF,OAAO,KAAK,CAAA;oBACb,CAAC;oBACD,MAAK;gBACN,CAAC;gBAED;oBACC,OAAO,KAAK,CAAA;YACd,CAAC;YAED,OAAO,IAAI,CAAA;QACZ,CAAC;QAAC,MAAM,CAAC;YACR,OAAO,KAAK,CAAA;QACb,CAAC;IACF,CAAC;CACD"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export { PrivateKeySigner, WalletSigner } from './signer.js';
|
|
2
|
+
export type { Signer } from './signer.js';
|
|
3
|
+
export { default as Inscription } from './inscription/inscription.js';
|
|
4
|
+
export { default as BSV20 } from './bsv20/bsv20.js';
|
|
5
|
+
export { default as BSV21 } from './bsv21/bsv21.js';
|
|
6
|
+
export { default as OrdLock } from './ordlock/ordlock.js';
|
|
7
|
+
export { default as Lock } from './lock/lock.js';
|
|
8
|
+
export { default as BitCom } from './bitcom/bitcom.js';
|
|
9
|
+
export { default as AIP } from './bitcom/aip.js';
|
|
10
|
+
export { default as B } from './bitcom/b.js';
|
|
11
|
+
export { default as BAP } from './bitcom/bap.js';
|
|
12
|
+
export { default as MAP } from './bitcom/map.js';
|
|
13
|
+
export { default as BSocial } from './bsocial/bsocial.js';
|
|
14
|
+
export { default as Sigma } from './bitcom/sigma.js';
|
|
15
|
+
export type { InscriptionFile, InscriptionOptions, } from './inscription/inscription.js';
|
|
16
|
+
export type { BSV20Operation, TokenData, BSV20TokenData, TokenOptions, TokenInscription, BSV20Inscription, BSV20Options, } from './bsv20/bsv20.js';
|
|
17
|
+
export type { BSV21Operation, BSV21TokenData, BSV21Inscription, BSV21Options, } from './bsv21/bsv21.js';
|
|
18
|
+
export type { OrdLockData } from './ordlock/ordlock.js';
|
|
19
|
+
export { ORDLOCK_PREFIX, ORDLOCK_SUFFIX } from './ordlock/ordlock.js';
|
|
20
|
+
export type { LockData } from './lock/lock.js';
|
|
21
|
+
export { LOCK_PREFIX, LOCK_SUFFIX } from './lock/lock.js';
|
|
22
|
+
export type { Protocol, BitComProtocol, BitComDecoded, } from './bitcom/bitcom.js';
|
|
23
|
+
export type { AIPData, AIPOptions } from './bitcom/aip.js';
|
|
24
|
+
export { AIP_PREFIX } from './bitcom/aip.js';
|
|
25
|
+
export type { BData } from './bitcom/b.js';
|
|
26
|
+
export { B_PREFIX, MediaType, Encoding } from './bitcom/b.js';
|
|
27
|
+
export type { BAPData } from './bitcom/bap.js';
|
|
28
|
+
export { BAPAttestationType, BAP_PROTOCOL_PREFIX, } from './bitcom/bap.js';
|
|
29
|
+
export type { MAPData } from './bitcom/map.js';
|
|
30
|
+
export { MAP_PREFIX, MAPCommand } from './bitcom/map.js';
|
|
31
|
+
export type { SigmaData, SigmaOptions, } from './bitcom/sigma.js';
|
|
32
|
+
export { SIGMA_PREFIX, SigmaAlgorithm } from './bitcom/sigma.js';
|
|
33
|
+
export { BSocialActionType, BSocialContext, } from './bsocial/bsocial.js';
|
|
34
|
+
export type { BSocialAction, BSocialPost, BSocialLike, BSocialFollow, BSocialMessage, BSocialVideo, BSocialDecoded, } from './bsocial/bsocial.js';
|
|
35
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC5D,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGzC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,8BAA8B,CAAA;AACrE,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,kBAAkB,CAAA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,EAAE,MAAM,iBAAiB,CAAA;AAK5C,YAAY,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAK7D,YAAY,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EACN,kBAAkB,EAClB,mBAAmB,GACnB,MAAM,iBAAiB,CAAA;AAKxB,YAAY,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAKxD,YAAY,EACX,SAAS,EACT,YAAY,GACZ,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAKhE,OAAO,EACN,iBAAiB,EACjB,cAAc,GACd,MAAM,sBAAsB,CAAA;AAC7B,YAAY,EACX,aAAa,EACb,WAAW,EACX,WAAW,EACX,aAAa,EACb,cAAc,EACd,YAAY,EACZ,cAAc,GACd,MAAM,sBAAsB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Signing abstraction
|
|
2
|
+
export { PrivateKeySigner, WalletSigner } from './signer.js';
|
|
3
|
+
// Script Templates
|
|
4
|
+
export { default as Inscription } from './inscription/inscription.js';
|
|
5
|
+
export { default as BSV20 } from './bsv20/bsv20.js';
|
|
6
|
+
export { default as BSV21 } from './bsv21/bsv21.js';
|
|
7
|
+
export { default as OrdLock } from './ordlock/ordlock.js';
|
|
8
|
+
export { default as Lock } from './lock/lock.js';
|
|
9
|
+
// BitCom Protocols
|
|
10
|
+
export { default as BitCom } from './bitcom/bitcom.js';
|
|
11
|
+
export { default as AIP } from './bitcom/aip.js';
|
|
12
|
+
export { default as B } from './bitcom/b.js';
|
|
13
|
+
export { default as BAP } from './bitcom/bap.js';
|
|
14
|
+
export { default as MAP } from './bitcom/map.js';
|
|
15
|
+
// BSocial
|
|
16
|
+
export { default as BSocial } from './bsocial/bsocial.js';
|
|
17
|
+
// Sigma is exported from main but also available via ./sigma subpath
|
|
18
|
+
// for optional peer dep isolation
|
|
19
|
+
export { default as Sigma } from './bitcom/sigma.js';
|
|
20
|
+
export { ORDLOCK_PREFIX, ORDLOCK_SUFFIX } from './ordlock/ordlock.js';
|
|
21
|
+
export { LOCK_PREFIX, LOCK_SUFFIX } from './lock/lock.js';
|
|
22
|
+
export { AIP_PREFIX } from './bitcom/aip.js';
|
|
23
|
+
export { B_PREFIX, MediaType, Encoding } from './bitcom/b.js';
|
|
24
|
+
export { BAPAttestationType, BAP_PROTOCOL_PREFIX, } from './bitcom/bap.js';
|
|
25
|
+
export { MAP_PREFIX, MAPCommand } from './bitcom/map.js';
|
|
26
|
+
export { SIGMA_PREFIX, SigmaAlgorithm } from './bitcom/sigma.js';
|
|
27
|
+
// ============================================================================
|
|
28
|
+
// BSocial Types
|
|
29
|
+
// ============================================================================
|
|
30
|
+
export { BSocialActionType, BSocialContext, } from './bsocial/bsocial.js';
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG5D,mBAAmB;AACnB,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,8BAA8B,CAAA;AACrE,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAEhD,mBAAmB;AACnB,OAAO,E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