@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/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, or opcode count). Mutates
356
- * Interpreter-wide static state — call once at app startup.
357
- * Pass an explicit `max` (e.g. 64 KB) when verifying scripts
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
- /** Mint an amount of a v1 (ticker) token. */
1186
- function buildMint(params: Owner & { tick: string; amt: IntLike }): Script;
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 & { tick: string; amt: IntLike }): Transaction.Output;
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. */