@smartledger/bsv 7.3.0 → 7.5.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 +100 -0
- package/README.md +38 -38
- package/bsv-gdaf.min.js +43 -43
- package/bsv-ltp.min.js +43 -43
- package/bsv-smartcontract.min.js +1 -1
- package/bsv.bundle.js +43 -43
- package/bsv.d.ts +37 -9
- package/bsv.min.js +43 -43
- 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 +15 -5
- package/lib/ordinals/bsv20.js +96 -3
- package/lib/script/interpreter.js +47 -6
- package/package.json +1 -1
- package/test/ordinals/bsv20.js +115 -0
- package/test/ordinals/inscription.js +94 -0
- package/test/ordinals/ordlock.js +10 -20
- package/test/script/genesis_limits.js +44 -8
- package/test/smart_contract/covenants.js +2 -4
- package/test/smart_contract/dsl_debugger.js +2 -4
- package/test/smart_contract/ordinal_transfer.js +2 -4
- package/test/smart_contract/sighash_marketplace.js +2 -4
- package/test/smart_contract/token_generalized.js +2 -4
- package/version.js +1 -1
package/bsv.d.ts
CHANGED
|
@@ -344,20 +344,33 @@ declare module '@smartledger/bsv' {
|
|
|
344
344
|
namespace Interpreter {
|
|
345
345
|
const SCRIPT_ENABLE_SIGHASH_FORKID: any;
|
|
346
346
|
|
|
347
|
-
// Pre-Genesis consensus caps (defaults: 520 / 4 / 201).
|
|
347
|
+
// Pre-Genesis consensus caps (defaults: 520 / 4 / 201 / 10,000).
|
|
348
348
|
// Mutable: see useGenesisLimits() for a one-call opt-in.
|
|
349
349
|
let MAX_SCRIPT_ELEMENT_SIZE: number;
|
|
350
350
|
let MAXIMUM_ELEMENT_SIZE: number;
|
|
351
351
|
let MAX_OPS_PER_SCRIPT: number;
|
|
352
|
+
/** Total serialized script size. Anything larger fails SCRIPT_ERR_SCRIPT_SIZE. */
|
|
353
|
+
let MAX_SCRIPT_SIZE: number;
|
|
354
|
+
|
|
355
|
+
interface Limits {
|
|
356
|
+
maxScriptElementSize: number;
|
|
357
|
+
maximumElementSize: number;
|
|
358
|
+
maxOpsPerScript: number;
|
|
359
|
+
maxScriptSize: number;
|
|
360
|
+
}
|
|
352
361
|
|
|
353
362
|
/**
|
|
354
363
|
* Opt into post-Genesis BSV consensus limits (no caps on stack
|
|
355
|
-
* element size, script-number width,
|
|
356
|
-
* Interpreter-wide static state — call once at app
|
|
357
|
-
* Pass an explicit `max` (e.g. 64 KB) when verifying
|
|
358
|
-
* from untrusted sources.
|
|
364
|
+
* element size, script-number width, opcode count, or total script
|
|
365
|
+
* size). Mutates Interpreter-wide static state — call once at app
|
|
366
|
+
* startup. Pass an explicit `max` (e.g. 64 KB) when verifying
|
|
367
|
+
* scripts from untrusted sources.
|
|
359
368
|
*/
|
|
360
369
|
function useGenesisLimits(max?: number): typeof Interpreter;
|
|
370
|
+
/** Capture the four caps, for restoring with setLimits(). */
|
|
371
|
+
function getLimits(): Limits;
|
|
372
|
+
/** Restore caps captured by getLimits(). */
|
|
373
|
+
function setLimits(limits: Partial<Limits>): typeof Interpreter;
|
|
361
374
|
}
|
|
362
375
|
|
|
363
376
|
function Interpreter(): {
|
|
@@ -1169,7 +1182,7 @@ declare module '@smartledger/bsv' {
|
|
|
1169
1182
|
/** A parsed BSV-20 payload. Amounts are integer strings (may exceed 2^53). */
|
|
1170
1183
|
interface Payload {
|
|
1171
1184
|
p: 'bsv-20';
|
|
1172
|
-
op: 'deploy' | 'mint' | 'transfer' | 'deploy+mint' | string;
|
|
1185
|
+
op: 'deploy' | 'mint' | 'transfer' | 'deploy+mint' | 'deploy+auth' | 'auth' | 'burn' | string;
|
|
1173
1186
|
tick?: string;
|
|
1174
1187
|
id?: string;
|
|
1175
1188
|
amt?: string;
|
|
@@ -1182,16 +1195,31 @@ declare module '@smartledger/bsv' {
|
|
|
1182
1195
|
const CONTENT_TYPE: string;
|
|
1183
1196
|
/** Deploy a v1 (ticker) token. */
|
|
1184
1197
|
function buildDeploy(params: Owner & { tick: string; max: IntLike; lim?: IntLike; dec?: IntLike }): Script;
|
|
1185
|
-
/**
|
|
1186
|
-
|
|
1198
|
+
/**
|
|
1199
|
+
* Mint an amount of a token — `tick` (v1) or `id` (BSV-21, which additionally
|
|
1200
|
+
* requires an auth input to be spent). Exactly one of the two.
|
|
1201
|
+
*/
|
|
1202
|
+
function buildMint(params: Owner & { amt: IntLike; tick?: string; id?: string }): Script;
|
|
1187
1203
|
/** Transfer an amount of a token — provide `tick` (v1) or `id` (v2 / BSV-21). */
|
|
1188
1204
|
function buildTransfer(params: Owner & { amt: IntLike; tick?: string; id?: string }): Script;
|
|
1189
1205
|
/** Deploy + mint a BSV-21 (id-based) supply in one operation. */
|
|
1190
1206
|
function buildDeployMint(params: Owner & { amt: IntLike; dec?: IntLike; sym?: string; icon?: string }): Script;
|
|
1207
|
+
/** Burn an amount of a BSV-21 token. Id-based only — the spec defines no ticker form. */
|
|
1208
|
+
function buildBurn(params: Owner & { id: string; amt: IntLike }): Script;
|
|
1209
|
+
/**
|
|
1210
|
+
* Deploy a BSV-21 token under a mint AUTHORITY rather than a fixed supply.
|
|
1211
|
+
* No supply is created here and `amt` must not be present.
|
|
1212
|
+
*/
|
|
1213
|
+
function buildDeployAuth(params: Owner & { sym?: string; dec?: IntLike; icon?: string }): Script;
|
|
1214
|
+
/** Mint authority for a BSV-21 token; carries no amount. */
|
|
1215
|
+
function buildAuth(params: Owner & { id: string }): Script;
|
|
1191
1216
|
function createDeployOutput(params: Owner & { tick: string; max: IntLike; lim?: IntLike; dec?: IntLike }): Transaction.Output;
|
|
1192
|
-
function createMintOutput(params: Owner & {
|
|
1217
|
+
function createMintOutput(params: Owner & { amt: IntLike; tick?: string; id?: string }): Transaction.Output;
|
|
1193
1218
|
function createTransferOutput(params: Owner & { amt: IntLike; tick?: string; id?: string }): Transaction.Output;
|
|
1194
1219
|
function createDeployMintOutput(params: Owner & { amt: IntLike; dec?: IntLike; sym?: string; icon?: string }): Transaction.Output;
|
|
1220
|
+
function createBurnOutput(params: Owner & { id: string; amt: IntLike }): Transaction.Output;
|
|
1221
|
+
function createDeployAuthOutput(params: Owner & { sym?: string; dec?: IntLike; icon?: string }): Transaction.Output;
|
|
1222
|
+
function createAuthOutput(params: Owner & { id: string }): Transaction.Output;
|
|
1195
1223
|
/** Parse a BSV-20 payload from a script, JSON string, or object; null if none. */
|
|
1196
1224
|
function parseBsv20(input: Script | Buffer | string | object): Payload | null;
|
|
1197
1225
|
/** True if the input carries a valid BSV-20 inscription. */
|