@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,544 @@
|
|
|
1
|
+
import { Utils, } from '@bsv/sdk';
|
|
2
|
+
import Inscription from '../inscription/inscription.js';
|
|
3
|
+
/**
|
|
4
|
+
* BSV-20 class implementing ScriptTemplate for basic fungible tokens.
|
|
5
|
+
*
|
|
6
|
+
* BSV-20 is the foundational token standard for BSV blockchain, providing
|
|
7
|
+
* simple and efficient fungible tokens with ticker-based identification.
|
|
8
|
+
* It serves as the base layer for the token economy on BSV.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* // Deploy a new token
|
|
13
|
+
* const deploy = BSV20.deploy("MYTOKEN", BigInt("21000000"), 8, BigInt("1000000"));
|
|
14
|
+
* const deployScript = deploy.lock();
|
|
15
|
+
*
|
|
16
|
+
* // Mint tokens
|
|
17
|
+
* const mint = BSV20.mint("MYTOKEN", BigInt("1000000"));
|
|
18
|
+
* const mintScript = mint.lock();
|
|
19
|
+
*
|
|
20
|
+
* // Transfer tokens
|
|
21
|
+
* const transfer = BSV20.transfer("MYTOKEN", BigInt("500"));
|
|
22
|
+
* const transferScript = transfer.lock();
|
|
23
|
+
*
|
|
24
|
+
* // Parse token from script
|
|
25
|
+
* const parsed = BSV20.decode(someScript);
|
|
26
|
+
* if (parsed) {
|
|
27
|
+
* console.log(`Ticker: ${parsed.getTicker()}`);
|
|
28
|
+
* console.log(`Amount: ${parsed.getAmount()}`);
|
|
29
|
+
* console.log(`Operation: ${parsed.tokenData.op}`);
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export default class BSV20 {
|
|
34
|
+
/** BSV-20 token data */
|
|
35
|
+
tokenData;
|
|
36
|
+
/** Underlying inscription containing the token data */
|
|
37
|
+
inscription;
|
|
38
|
+
/**
|
|
39
|
+
* Creates a new BSV20 instance
|
|
40
|
+
*
|
|
41
|
+
* @param tokenData - The token data structure
|
|
42
|
+
* @param inscription - The inscription containing the token data
|
|
43
|
+
*/
|
|
44
|
+
constructor(tokenData, inscription) {
|
|
45
|
+
this.tokenData = tokenData;
|
|
46
|
+
this.inscription = inscription;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Creates a deploy operation for a new BSV-20 token
|
|
50
|
+
*
|
|
51
|
+
* @param ticker - Token ticker/symbol (1-32 characters)
|
|
52
|
+
* @param maxSupply - Maximum total supply
|
|
53
|
+
* @param decimals - Number of decimal places (0-18, default 0)
|
|
54
|
+
* @param limitPerMint - Optional limit per mint operation
|
|
55
|
+
* @param options - Optional inscription parameters
|
|
56
|
+
* @returns A new BSV20 instance
|
|
57
|
+
*/
|
|
58
|
+
static deploy(ticker, maxSupply, decimals = 0, limitPerMint, options = {}) {
|
|
59
|
+
// Validate parameters
|
|
60
|
+
if (ticker == null || ticker === '' || ticker.length === 0) {
|
|
61
|
+
throw new Error('Ticker cannot be empty');
|
|
62
|
+
}
|
|
63
|
+
if (ticker.length > 32) {
|
|
64
|
+
throw new Error('Ticker cannot exceed 32 characters');
|
|
65
|
+
}
|
|
66
|
+
if (maxSupply <= BigInt(0)) {
|
|
67
|
+
throw new Error('Max supply must be positive');
|
|
68
|
+
}
|
|
69
|
+
if (decimals < 0 || decimals > 18) {
|
|
70
|
+
throw new Error('Decimals must be between 0 and 18');
|
|
71
|
+
}
|
|
72
|
+
if (limitPerMint != null && limitPerMint <= BigInt(0)) {
|
|
73
|
+
throw new Error('Limit per mint must be positive');
|
|
74
|
+
}
|
|
75
|
+
// Create token data
|
|
76
|
+
const tokenData = {
|
|
77
|
+
p: 'bsv-20',
|
|
78
|
+
op: 'deploy',
|
|
79
|
+
tick: ticker,
|
|
80
|
+
amt: '0', // Deploy operation has no amount
|
|
81
|
+
max: maxSupply.toString(),
|
|
82
|
+
};
|
|
83
|
+
// Add optional fields
|
|
84
|
+
if (decimals > 0) {
|
|
85
|
+
tokenData.dec = decimals;
|
|
86
|
+
}
|
|
87
|
+
if (limitPerMint != null) {
|
|
88
|
+
tokenData.lim = limitPerMint.toString();
|
|
89
|
+
}
|
|
90
|
+
// Create inscription with token JSON
|
|
91
|
+
// Note: dec must be serialized as a string per BSV-20 protocol
|
|
92
|
+
const wireFormat = {
|
|
93
|
+
...tokenData,
|
|
94
|
+
dec: tokenData.dec !== undefined ? tokenData.dec.toString() : undefined,
|
|
95
|
+
};
|
|
96
|
+
// Remove undefined fields
|
|
97
|
+
for (const key of Object.keys(wireFormat)) {
|
|
98
|
+
if (wireFormat[key] === undefined) {
|
|
99
|
+
delete wireFormat[key];
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
const jsonContent = JSON.stringify(wireFormat);
|
|
103
|
+
const inscription = Inscription.fromText(jsonContent, 'application/bsv-20', options);
|
|
104
|
+
return new BSV20(tokenData, inscription);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Creates a mint operation for an existing BSV-20 token
|
|
108
|
+
*
|
|
109
|
+
* @param ticker - Token ticker to mint
|
|
110
|
+
* @param amount - Amount to mint
|
|
111
|
+
* @param options - Optional inscription parameters
|
|
112
|
+
* @returns A new BSV20 instance
|
|
113
|
+
*/
|
|
114
|
+
static mint(ticker, amount, options = {}) {
|
|
115
|
+
// Validate parameters
|
|
116
|
+
if (ticker == null || ticker === '' || ticker.length === 0) {
|
|
117
|
+
throw new Error('Ticker cannot be empty');
|
|
118
|
+
}
|
|
119
|
+
if (ticker.length > 32) {
|
|
120
|
+
throw new Error('Ticker cannot exceed 32 characters');
|
|
121
|
+
}
|
|
122
|
+
if (amount <= BigInt(0)) {
|
|
123
|
+
throw new Error('Amount must be positive');
|
|
124
|
+
}
|
|
125
|
+
// Create token data
|
|
126
|
+
const tokenData = {
|
|
127
|
+
p: 'bsv-20',
|
|
128
|
+
op: 'mint',
|
|
129
|
+
tick: ticker,
|
|
130
|
+
amt: amount.toString(),
|
|
131
|
+
};
|
|
132
|
+
// Create inscription with token JSON
|
|
133
|
+
const jsonContent = JSON.stringify(tokenData);
|
|
134
|
+
const inscription = Inscription.fromText(jsonContent, 'application/bsv-20', options);
|
|
135
|
+
return new BSV20(tokenData, inscription);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Creates a transfer operation for moving BSV-20 tokens
|
|
139
|
+
*
|
|
140
|
+
* @param ticker - Token ticker to transfer
|
|
141
|
+
* @param amount - Amount to transfer
|
|
142
|
+
* @param options - Optional inscription parameters
|
|
143
|
+
* @returns A new BSV20 instance
|
|
144
|
+
*/
|
|
145
|
+
static transfer(ticker, amount, options = {}) {
|
|
146
|
+
// Validate parameters
|
|
147
|
+
if (ticker == null || ticker === '' || ticker.length === 0) {
|
|
148
|
+
throw new Error('Ticker cannot be empty');
|
|
149
|
+
}
|
|
150
|
+
if (ticker.length > 32) {
|
|
151
|
+
throw new Error('Ticker cannot exceed 32 characters');
|
|
152
|
+
}
|
|
153
|
+
if (amount <= BigInt(0)) {
|
|
154
|
+
throw new Error('Amount must be positive');
|
|
155
|
+
}
|
|
156
|
+
// Create token data
|
|
157
|
+
const tokenData = {
|
|
158
|
+
p: 'bsv-20',
|
|
159
|
+
op: 'transfer',
|
|
160
|
+
tick: ticker,
|
|
161
|
+
amt: amount.toString(),
|
|
162
|
+
};
|
|
163
|
+
// Create inscription with token JSON
|
|
164
|
+
const jsonContent = JSON.stringify(tokenData);
|
|
165
|
+
const inscription = Inscription.fromText(jsonContent, 'application/bsv-20', options);
|
|
166
|
+
return new BSV20(tokenData, inscription);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Creates a burn operation for permanently destroying BSV-20 tokens
|
|
170
|
+
*
|
|
171
|
+
* @param ticker - Token ticker to burn
|
|
172
|
+
* @param amount - Amount to burn
|
|
173
|
+
* @param options - Optional inscription parameters
|
|
174
|
+
* @returns A new BSV20 instance
|
|
175
|
+
*/
|
|
176
|
+
static burn(ticker, amount, options = {}) {
|
|
177
|
+
// Validate parameters
|
|
178
|
+
if (ticker == null || ticker === '' || ticker.length === 0) {
|
|
179
|
+
throw new Error('Ticker cannot be empty');
|
|
180
|
+
}
|
|
181
|
+
if (ticker.length > 32) {
|
|
182
|
+
throw new Error('Ticker cannot exceed 32 characters');
|
|
183
|
+
}
|
|
184
|
+
if (amount <= BigInt(0)) {
|
|
185
|
+
throw new Error('Amount must be positive');
|
|
186
|
+
}
|
|
187
|
+
// Create token data
|
|
188
|
+
const tokenData = {
|
|
189
|
+
p: 'bsv-20',
|
|
190
|
+
op: 'burn',
|
|
191
|
+
tick: ticker,
|
|
192
|
+
amt: amount.toString(),
|
|
193
|
+
};
|
|
194
|
+
// Create inscription with token JSON
|
|
195
|
+
const jsonContent = JSON.stringify(tokenData);
|
|
196
|
+
const inscription = Inscription.fromText(jsonContent, 'application/bsv-20', options);
|
|
197
|
+
return new BSV20(tokenData, inscription);
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Decodes a BSV-20 token from a script
|
|
201
|
+
*
|
|
202
|
+
* @param script - The script containing BSV-20 token data
|
|
203
|
+
* @returns Decoded BSV-20 token or null if not found/invalid
|
|
204
|
+
*/
|
|
205
|
+
static decode(script) {
|
|
206
|
+
try {
|
|
207
|
+
// First decode as inscription
|
|
208
|
+
const inscription = Inscription.decode(script);
|
|
209
|
+
if (inscription == null)
|
|
210
|
+
return null;
|
|
211
|
+
// Check if it's BSV-20 token (application/bsv-20 MIME type)
|
|
212
|
+
if (inscription.file.type !== 'application/bsv-20')
|
|
213
|
+
return null;
|
|
214
|
+
// Parse JSON content - use raw content since application/bsv-20 is not recognized as text
|
|
215
|
+
let jsonText;
|
|
216
|
+
try {
|
|
217
|
+
jsonText = Utils.toUTF8(Array.from(inscription.file.content));
|
|
218
|
+
}
|
|
219
|
+
catch {
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
const data = JSON.parse(jsonText);
|
|
223
|
+
// Validate required protocol fields
|
|
224
|
+
if (data.p !== 'bsv-20')
|
|
225
|
+
return null;
|
|
226
|
+
if (data.op == null || typeof data.op !== 'string')
|
|
227
|
+
return null;
|
|
228
|
+
// Parse operation
|
|
229
|
+
const operation = data.op.toLowerCase();
|
|
230
|
+
if (!['deploy', 'mint', 'transfer', 'burn'].includes(operation))
|
|
231
|
+
return null;
|
|
232
|
+
// Validate operation-specific fields
|
|
233
|
+
switch (operation) {
|
|
234
|
+
case 'deploy':
|
|
235
|
+
if (data.tick == null || typeof data.tick !== 'string')
|
|
236
|
+
return null;
|
|
237
|
+
if (data.tick.length === 0 || data.tick.length > 32)
|
|
238
|
+
return null;
|
|
239
|
+
if (data.max == null || typeof data.max !== 'string')
|
|
240
|
+
return null;
|
|
241
|
+
try {
|
|
242
|
+
const maxSupply = BigInt(data.max);
|
|
243
|
+
if (maxSupply <= BigInt(0))
|
|
244
|
+
return null;
|
|
245
|
+
}
|
|
246
|
+
catch {
|
|
247
|
+
return null;
|
|
248
|
+
}
|
|
249
|
+
if (data.dec !== undefined) {
|
|
250
|
+
// dec must be a string in the JSON - reject if it's a JS number
|
|
251
|
+
if (typeof data.dec !== 'string')
|
|
252
|
+
return null;
|
|
253
|
+
const dec = Number.parseInt(data.dec, 10);
|
|
254
|
+
if (Number.isNaN(dec))
|
|
255
|
+
return null;
|
|
256
|
+
if (dec < 0 || dec > 18)
|
|
257
|
+
return null;
|
|
258
|
+
// Normalize to number for tokenData
|
|
259
|
+
data.dec = dec;
|
|
260
|
+
}
|
|
261
|
+
if (data.lim !== undefined) {
|
|
262
|
+
if (typeof data.lim !== 'string')
|
|
263
|
+
return null;
|
|
264
|
+
try {
|
|
265
|
+
const limit = BigInt(data.lim);
|
|
266
|
+
if (limit <= BigInt(0))
|
|
267
|
+
return null;
|
|
268
|
+
}
|
|
269
|
+
catch {
|
|
270
|
+
return null;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
break;
|
|
274
|
+
case 'mint':
|
|
275
|
+
case 'transfer':
|
|
276
|
+
case 'burn':
|
|
277
|
+
if (data.tick == null || typeof data.tick !== 'string')
|
|
278
|
+
return null;
|
|
279
|
+
if (data.tick.length === 0 || data.tick.length > 32)
|
|
280
|
+
return null;
|
|
281
|
+
if (data.amt == null || typeof data.amt !== 'string')
|
|
282
|
+
return null;
|
|
283
|
+
try {
|
|
284
|
+
const amount = BigInt(data.amt);
|
|
285
|
+
if (amount <= BigInt(0))
|
|
286
|
+
return null;
|
|
287
|
+
}
|
|
288
|
+
catch {
|
|
289
|
+
return null;
|
|
290
|
+
}
|
|
291
|
+
break;
|
|
292
|
+
}
|
|
293
|
+
// Create token data structure
|
|
294
|
+
const tokenData = {
|
|
295
|
+
p: 'bsv-20',
|
|
296
|
+
op: operation,
|
|
297
|
+
amt: data.amt ?? '0',
|
|
298
|
+
};
|
|
299
|
+
// Add operation-specific fields
|
|
300
|
+
if (operation === 'deploy') {
|
|
301
|
+
tokenData.tick = data.tick;
|
|
302
|
+
tokenData.max = data.max;
|
|
303
|
+
if (data.dec !== undefined) {
|
|
304
|
+
tokenData.dec = data.dec;
|
|
305
|
+
}
|
|
306
|
+
if (data.lim !== undefined) {
|
|
307
|
+
tokenData.lim = data.lim;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
tokenData.tick = data.tick;
|
|
312
|
+
}
|
|
313
|
+
return new BSV20(tokenData, inscription);
|
|
314
|
+
}
|
|
315
|
+
catch {
|
|
316
|
+
return null;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Creates a locking script containing the BSV-20 token inscription
|
|
321
|
+
*
|
|
322
|
+
* @param lockingScript - Optional locking script to append as suffix
|
|
323
|
+
* @returns A locking script containing the token data
|
|
324
|
+
*/
|
|
325
|
+
lock(lockingScript) {
|
|
326
|
+
if (lockingScript != null) {
|
|
327
|
+
// Create new inscription with the locking script as suffix
|
|
328
|
+
const options = {
|
|
329
|
+
parent: this.inscription.parent,
|
|
330
|
+
scriptPrefix: this.inscription.scriptPrefix,
|
|
331
|
+
scriptSuffix: lockingScript,
|
|
332
|
+
};
|
|
333
|
+
// Create new inscription with suffix
|
|
334
|
+
const jsonContent = JSON.stringify(this.tokenData);
|
|
335
|
+
const newInscription = Inscription.fromText(jsonContent, 'application/bsv-20', options);
|
|
336
|
+
return newInscription.lock();
|
|
337
|
+
}
|
|
338
|
+
return this.inscription.lock();
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* BSV-20 tokens cannot be unlocked directly as they are data containers
|
|
342
|
+
*
|
|
343
|
+
* @throws Error indicating unlock is not supported
|
|
344
|
+
*/
|
|
345
|
+
unlock() {
|
|
346
|
+
throw new Error('BSV-20 tokens cannot be unlocked directly');
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Gets the token amount as BigInt
|
|
350
|
+
*
|
|
351
|
+
* @returns Token amount
|
|
352
|
+
*/
|
|
353
|
+
getAmount() {
|
|
354
|
+
return BigInt(this.tokenData.amt);
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Gets the token amount as BigInt (concise method)
|
|
358
|
+
*
|
|
359
|
+
* @returns Token amount
|
|
360
|
+
*/
|
|
361
|
+
amount() {
|
|
362
|
+
return this.getAmount();
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Gets the token ticker/symbol
|
|
366
|
+
*
|
|
367
|
+
* @returns Token ticker
|
|
368
|
+
*/
|
|
369
|
+
getTicker() {
|
|
370
|
+
return this.tokenData.tick;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Gets the token ticker/symbol (concise method)
|
|
374
|
+
*
|
|
375
|
+
* @returns Token ticker
|
|
376
|
+
*/
|
|
377
|
+
ticker() {
|
|
378
|
+
return this.getTicker();
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Gets the number of decimal places (for deploy operations)
|
|
382
|
+
*
|
|
383
|
+
* @returns Number of decimals, defaults to 0
|
|
384
|
+
*/
|
|
385
|
+
getDecimals() {
|
|
386
|
+
return this.tokenData.dec ?? 0;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Gets the maximum supply (for deploy operations)
|
|
390
|
+
*
|
|
391
|
+
* @returns Maximum supply as BigInt or undefined
|
|
392
|
+
*/
|
|
393
|
+
getMaxSupply() {
|
|
394
|
+
return this.tokenData.max != null ? BigInt(this.tokenData.max) : undefined;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Gets the limit per mint operation (for deploy operations)
|
|
398
|
+
*
|
|
399
|
+
* @returns Limit per mint as BigInt or undefined
|
|
400
|
+
*/
|
|
401
|
+
getLimitPerMint() {
|
|
402
|
+
return this.tokenData.lim != null ? BigInt(this.tokenData.lim) : undefined;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Gets the token operation type
|
|
406
|
+
*
|
|
407
|
+
* @returns The operation (deploy, mint, transfer, or burn)
|
|
408
|
+
*/
|
|
409
|
+
getOperation() {
|
|
410
|
+
return this.tokenData.op;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Gets the token operation type (concise method)
|
|
414
|
+
*
|
|
415
|
+
* @returns The operation (deploy, mint, transfer, or burn)
|
|
416
|
+
*/
|
|
417
|
+
operation() {
|
|
418
|
+
return this.getOperation();
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Checks if this is a deploy operation
|
|
422
|
+
*
|
|
423
|
+
* @returns true for deploy operations
|
|
424
|
+
*/
|
|
425
|
+
isDeploy() {
|
|
426
|
+
return this.tokenData.op === 'deploy';
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Checks if this is a mint operation
|
|
430
|
+
*
|
|
431
|
+
* @returns true for mint operations
|
|
432
|
+
*/
|
|
433
|
+
isMint() {
|
|
434
|
+
return this.tokenData.op === 'mint';
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Checks if this is a transfer operation
|
|
438
|
+
*
|
|
439
|
+
* @returns true for transfer operations
|
|
440
|
+
*/
|
|
441
|
+
isTransfer() {
|
|
442
|
+
return this.tokenData.op === 'transfer';
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Checks if this is a burn operation
|
|
446
|
+
*
|
|
447
|
+
* @returns true for burn operations
|
|
448
|
+
*/
|
|
449
|
+
isBurn() {
|
|
450
|
+
return this.tokenData.op === 'burn';
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Gets the underlying inscription
|
|
454
|
+
*
|
|
455
|
+
* @returns The inscription containing the token data
|
|
456
|
+
*/
|
|
457
|
+
getInscription() {
|
|
458
|
+
return this.inscription;
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Gets the token data as formatted JSON string
|
|
462
|
+
*
|
|
463
|
+
* @returns JSON representation of token data
|
|
464
|
+
*/
|
|
465
|
+
toJSON() {
|
|
466
|
+
return JSON.stringify(this.tokenData, null, 2);
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* Validates the token data structure
|
|
470
|
+
*
|
|
471
|
+
* @returns true if token data is valid
|
|
472
|
+
*/
|
|
473
|
+
validate() {
|
|
474
|
+
try {
|
|
475
|
+
// Validate basic structure
|
|
476
|
+
if (this.tokenData.p !== 'bsv-20')
|
|
477
|
+
return false;
|
|
478
|
+
if (this.tokenData.op == null)
|
|
479
|
+
return false;
|
|
480
|
+
// Validate operation-specific fields
|
|
481
|
+
switch (this.tokenData.op) {
|
|
482
|
+
case 'deploy':
|
|
483
|
+
if (this.tokenData.tick == null ||
|
|
484
|
+
this.tokenData.tick === '' ||
|
|
485
|
+
this.tokenData.tick.length === 0 ||
|
|
486
|
+
this.tokenData.tick.length > 32) {
|
|
487
|
+
return false;
|
|
488
|
+
}
|
|
489
|
+
if (this.tokenData.max == null || this.tokenData.max === '')
|
|
490
|
+
return false;
|
|
491
|
+
try {
|
|
492
|
+
const maxSupply = BigInt(this.tokenData.max);
|
|
493
|
+
if (maxSupply <= BigInt(0))
|
|
494
|
+
return false;
|
|
495
|
+
}
|
|
496
|
+
catch {
|
|
497
|
+
return false;
|
|
498
|
+
}
|
|
499
|
+
if (this.tokenData.dec !== undefined &&
|
|
500
|
+
(this.tokenData.dec < 0 || this.tokenData.dec > 18)) {
|
|
501
|
+
return false;
|
|
502
|
+
}
|
|
503
|
+
if (this.tokenData.lim !== undefined) {
|
|
504
|
+
try {
|
|
505
|
+
const limit = BigInt(this.tokenData.lim);
|
|
506
|
+
if (limit <= BigInt(0))
|
|
507
|
+
return false;
|
|
508
|
+
}
|
|
509
|
+
catch {
|
|
510
|
+
return false;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
break;
|
|
514
|
+
case 'mint':
|
|
515
|
+
case 'transfer':
|
|
516
|
+
case 'burn':
|
|
517
|
+
if (this.tokenData.tick == null ||
|
|
518
|
+
this.tokenData.tick === '' ||
|
|
519
|
+
this.tokenData.tick.length === 0 ||
|
|
520
|
+
this.tokenData.tick.length > 32) {
|
|
521
|
+
return false;
|
|
522
|
+
}
|
|
523
|
+
if (this.tokenData.amt == null || this.tokenData.amt === '')
|
|
524
|
+
return false;
|
|
525
|
+
try {
|
|
526
|
+
const amount = BigInt(this.tokenData.amt);
|
|
527
|
+
if (amount <= BigInt(0))
|
|
528
|
+
return false;
|
|
529
|
+
}
|
|
530
|
+
catch {
|
|
531
|
+
return false;
|
|
532
|
+
}
|
|
533
|
+
break;
|
|
534
|
+
default:
|
|
535
|
+
return false;
|
|
536
|
+
}
|
|
537
|
+
return true;
|
|
538
|
+
}
|
|
539
|
+
catch {
|
|
540
|
+
return false;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
//# sourceMappingURL=bsv20.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bsv20.js","sourceRoot":"","sources":["../../src/bsv20/bsv20.ts"],"names":[],"mappings":"AAAA,OAAO,EAKN,KAAK,GACL,MAAM,UAAU,CAAA;AACjB,OAAO,WAAW,MAAM,+BAA+B,CAAA;AAkFvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,CAAC,OAAO,OAAO,KAAK;IACzB,wBAAwB;IACR,SAAS,CAAgB;IACzC,uDAAuD;IACvC,WAAW,CAAa;IAExC;;;;;OAKG;IACH,YAAY,SAAyB,EAAE,WAAwB;QAC9D,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;QAC1B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;IAC/B,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,MAAM,CACZ,MAAc,EACd,SAAiB,EACjB,QAAQ,GAAG,CAAC,EACZ,YAAqB,EACrB,UAAwB,EAAE;QAE1B,sBAAsB;QACtB,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,KAAK,EAAE,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC5D,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAA;QAC1C,CAAC;QACD,IAAI,MAAM,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAA;QACtD,CAAC;QACD,IAAI,SAAS,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;YAC5B,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAA;QAC/C,CAAC;QACD,IAAI,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