@bsv/sdk 1.6.14 → 1.6.15

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.
@@ -28,7 +28,6 @@ export default interface ScriptChunk {
28
28
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
29
29
 
30
30
  ---
31
-
32
31
  ### Interface: ScriptTemplate
33
32
 
34
33
  ```ts
@@ -47,7 +46,6 @@ Creates a locking script with the given parameters.
47
46
  ```ts
48
47
  lock: (...params: any[]) => LockingScript | Promise<LockingScript>
49
48
  ```
50
-
51
49
  See also: [LockingScript](./script.md#class-lockingscript)
52
50
 
53
51
  #### Property unlock
@@ -55,20 +53,17 @@ See also: [LockingScript](./script.md#class-lockingscript)
55
53
  Creates a function that generates an unlocking script along with its signature and length estimation.
56
54
 
57
55
  This method returns an object containing two functions:
58
-
59
56
  1. `sign` - A function that, when called with a transaction and an input index, returns an UnlockingScript instance.
60
57
  2. `estimateLength` - A function that returns the estimated length of the unlocking script in bytes.
61
58
 
62
59
  ```ts
63
60
  unlock: (...params: any[]) => ScriptTemplateUnlock
64
61
  ```
65
-
66
62
  See also: [ScriptTemplateUnlock](./script.md#interface-scripttemplateunlock)
67
63
 
68
64
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
69
65
 
70
66
  ---
71
-
72
67
  ### Interface: ScriptTemplateUnlock
73
68
 
74
69
  ```ts
@@ -83,7 +78,6 @@ See also: [Transaction](./transaction.md#class-transaction), [UnlockingScript](.
83
78
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
84
79
 
85
80
  ---
86
-
87
81
  ## Classes
88
82
 
89
83
  | |
@@ -139,7 +133,6 @@ Always returns false for a LockingScript instance.
139
133
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
140
134
 
141
135
  ---
142
-
143
136
  ### Class: P2PKH
144
137
 
145
138
  P2PKH (Pay To Public Key Hash) class implementing ScriptTemplate.
@@ -165,7 +158,6 @@ Creates a P2PKH locking script for a given public key hash or address string
165
158
  ```ts
166
159
  lock(pubkeyhash: string | number[]): LockingScript
167
160
  ```
168
-
169
161
  See also: [LockingScript](./script.md#class-lockingscript)
170
162
 
171
163
  Returns
@@ -174,15 +166,14 @@ Returns
174
166
 
175
167
  Argument Details
176
168
 
177
- - **pubkeyhash**
178
- - or address - An array or address representing the public key hash.
169
+ + **pubkeyhash**
170
+ + or address - An array or address representing the public key hash.
179
171
 
180
172
  #### Method unlock
181
173
 
182
174
  Creates a function that generates a P2PKH unlocking script along with its signature and length estimation.
183
175
 
184
176
  The returned object contains:
185
-
186
177
  1. `sign` - A function that, when invoked with a transaction and an input index,
187
178
  produces an unlocking script suitable for a P2PKH locked output.
188
179
  2. `estimateLength` - A function that returns the estimated length of the unlocking script in bytes.
@@ -193,7 +184,6 @@ unlock(privateKey: PrivateKey, signOutputs: "all" | "none" | "single" = "all", a
193
184
  estimateLength: () => Promise<108>;
194
185
  }
195
186
  ```
196
-
197
187
  See also: [PrivateKey](./primitives.md#class-privatekey), [Script](./script.md#class-script), [Transaction](./transaction.md#class-transaction), [UnlockingScript](./script.md#class-unlockingscript), [sign](./compat.md#variable-sign)
198
188
 
199
189
  Returns
@@ -202,21 +192,20 @@ Returns
202
192
 
203
193
  Argument Details
204
194
 
205
- - **privateKey**
206
- - The private key used for signing the transaction.
207
- - **signOutputs**
208
- - The signature scope for outputs.
209
- - **anyoneCanPay**
210
- - Flag indicating if the signature allows for other inputs to be added later.
211
- - **sourceSatoshis**
212
- - Optional. The amount being unlocked. Otherwise the input.sourceTransaction is required.
213
- - **lockingScript**
214
- - Optional. The lockinScript. Otherwise the input.sourceTransaction is required.
195
+ + **privateKey**
196
+ + The private key used for signing the transaction.
197
+ + **signOutputs**
198
+ + The signature scope for outputs.
199
+ + **anyoneCanPay**
200
+ + Flag indicating if the signature allows for other inputs to be added later.
201
+ + **sourceSatoshis**
202
+ + Optional. The amount being unlocked. Otherwise the input.sourceTransaction is required.
203
+ + **lockingScript**
204
+ + Optional. The lockinScript. Otherwise the input.sourceTransaction is required.
215
205
 
216
206
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
217
207
 
218
208
  ---
219
-
220
209
  ### Class: PushDrop
221
210
 
222
211
  ```ts
@@ -251,15 +240,14 @@ Constructs a new instance of the PushDrop class.
251
240
  ```ts
252
241
  constructor(wallet: WalletInterface, originator?: string)
253
242
  ```
254
-
255
243
  See also: [WalletInterface](./wallet.md#interface-walletinterface)
256
244
 
257
245
  Argument Details
258
246
 
259
- - **wallet**
260
- - The wallet interface used for creating signatures and accessing public keys.
261
- - **originator**
262
- - — The originator to use with Wallet requests
247
+ + **wallet**
248
+ + The wallet interface used for creating signatures and accessing public keys.
249
+ + **originator**
250
+ + — The originator to use with Wallet requests
263
251
 
264
252
  #### Method decode
265
253
 
@@ -272,7 +260,6 @@ static decode(script: LockingScript): {
272
260
  fields: number[][];
273
261
  }
274
262
  ```
275
-
276
263
  See also: [LockingScript](./script.md#class-lockingscript), [PublicKey](./primitives.md#class-publickey)
277
264
 
278
265
  Returns
@@ -281,8 +268,8 @@ An object containing PushDrop token fields and the locking public key. If a sign
281
268
 
282
269
  Argument Details
283
270
 
284
- - **script**
285
- - PushDrop script to decode back into token fields
271
+ + **script**
272
+ + PushDrop script to decode back into token fields
286
273
 
287
274
  #### Method lock
288
275
 
@@ -294,7 +281,6 @@ async lock(fields: number[][], protocolID: [
294
281
  string
295
282
  ], keyID: string, counterparty: string, forSelf = false, includeSignature = true, lockPosition: "before" | "after" = "before"): Promise<LockingScript>
296
283
  ```
297
-
298
284
  See also: [LockingScript](./script.md#class-lockingscript), [SecurityLevel](./wallet.md#type-securitylevel)
299
285
 
300
286
  Returns
@@ -303,18 +289,18 @@ The generated PushDrop locking script.
303
289
 
304
290
  Argument Details
305
291
 
306
- - **fields**
307
- - The token fields to include in the locking script.
308
- - **protocolID**
309
- - The protocol ID to use.
310
- - **keyID**
311
- - The key ID to use.
312
- - **counterparty**
313
- - The counterparty involved in the transaction, "self" or "anyone".
314
- - **forSelf**
315
- - Flag indicating if the lock is for the creator (default no).
316
- - **includeSignature**
317
- - Flag indicating if a signature should be included in the script (default yes).
292
+ + **fields**
293
+ + The token fields to include in the locking script.
294
+ + **protocolID**
295
+ + The protocol ID to use.
296
+ + **keyID**
297
+ + The key ID to use.
298
+ + **counterparty**
299
+ + The counterparty involved in the transaction, "self" or "anyone".
300
+ + **forSelf**
301
+ + Flag indicating if the lock is for the creator (default no).
302
+ + **includeSignature**
303
+ + Flag indicating if a signature should be included in the script (default yes).
318
304
 
319
305
  #### Method unlock
320
306
 
@@ -329,7 +315,6 @@ unlock(protocolID: [
329
315
  estimateLength: () => Promise<73>;
330
316
  }
331
317
  ```
332
-
333
318
  See also: [LockingScript](./script.md#class-lockingscript), [SecurityLevel](./wallet.md#type-securitylevel), [Transaction](./transaction.md#class-transaction), [UnlockingScript](./script.md#class-unlockingscript), [sign](./compat.md#variable-sign)
334
319
 
335
320
  Returns
@@ -338,27 +323,26 @@ An object containing functions to sign the transaction and estimate the script l
338
323
 
339
324
  Argument Details
340
325
 
341
- - **protocolID**
342
- - The protocol ID to use.
343
- - **keyID**
344
- - The key ID to use.
345
- - **counterparty**
346
- - The counterparty involved in the transaction, "self" or "anyone".
347
- - **sourceTXID**
348
- - The TXID of the source transaction.
349
- - **sourceSatoshis**
350
- - The number of satoshis in the source output.
351
- - **lockingScript**
352
- - The locking script of the source output.
353
- - **signOutputs**
354
- - Specifies which outputs to sign.
355
- - **anyoneCanPay**
356
- - Specifies if the anyone-can-pay flag is set.
326
+ + **protocolID**
327
+ + The protocol ID to use.
328
+ + **keyID**
329
+ + The key ID to use.
330
+ + **counterparty**
331
+ + The counterparty involved in the transaction, "self" or "anyone".
332
+ + **sourceTXID**
333
+ + The TXID of the source transaction.
334
+ + **sourceSatoshis**
335
+ + The number of satoshis in the source output.
336
+ + **lockingScript**
337
+ + The locking script of the source output.
338
+ + **signOutputs**
339
+ + Specifies which outputs to sign.
340
+ + **anyoneCanPay**
341
+ + Specifies if the anyone-can-pay flag is set.
357
342
 
358
343
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
359
344
 
360
345
  ---
361
-
362
346
  ### Class: RPuzzle
363
347
 
364
348
  RPuzzle class implementing ScriptTemplate.
@@ -387,8 +371,8 @@ constructor(type: "raw" | "SHA1" | "SHA256" | "HASH256" | "RIPEMD160" | "HASH160
387
371
 
388
372
  Argument Details
389
373
 
390
- - **type**
391
- - Denotes the type of puzzle to create
374
+ + **type**
375
+ + Denotes the type of puzzle to create
392
376
 
393
377
  #### Method lock
394
378
 
@@ -397,7 +381,6 @@ Creates an R puzzle locking script for a given R value or R value hash.
397
381
  ```ts
398
382
  lock(value: number[]): LockingScript
399
383
  ```
400
-
401
384
  See also: [LockingScript](./script.md#class-lockingscript)
402
385
 
403
386
  Returns
@@ -406,15 +389,14 @@ Returns
406
389
 
407
390
  Argument Details
408
391
 
409
- - **value**
410
- - An array representing the R value or its hash.
392
+ + **value**
393
+ + An array representing the R value or its hash.
411
394
 
412
395
  #### Method unlock
413
396
 
414
397
  Creates a function that generates an R puzzle unlocking script along with its signature and length estimation.
415
398
 
416
399
  The returned object contains:
417
-
418
400
  1. `sign` - A function that, when invoked with a transaction and an input index,
419
401
  produces an unlocking script suitable for an R puzzle locked output.
420
402
  2. `estimateLength` - A function that returns the estimated length of the unlocking script in bytes.
@@ -425,7 +407,6 @@ unlock(k: BigNumber, privateKey: PrivateKey, signOutputs: "all" | "none" | "sing
425
407
  estimateLength: () => Promise<108>;
426
408
  }
427
409
  ```
428
-
429
410
  See also: [BigNumber](./primitives.md#class-bignumber), [PrivateKey](./primitives.md#class-privatekey), [Transaction](./transaction.md#class-transaction), [UnlockingScript](./script.md#class-unlockingscript), [sign](./compat.md#variable-sign)
430
411
 
431
412
  Returns
@@ -434,19 +415,18 @@ Returns
434
415
 
435
416
  Argument Details
436
417
 
437
- - **k**
438
- - — The K-value used to unlock the R-puzzle.
439
- - **privateKey**
440
- - The private key used for signing the transaction. If not provided, a random key will be generated.
441
- - **signOutputs**
442
- - The signature scope for outputs.
443
- - **anyoneCanPay**
444
- - Flag indicating if the signature allows for other inputs to be added later.
418
+ + **k**
419
+ + — The K-value used to unlock the R-puzzle.
420
+ + **privateKey**
421
+ + The private key used for signing the transaction. If not provided, a random key will be generated.
422
+ + **signOutputs**
423
+ + The signature scope for outputs.
424
+ + **anyoneCanPay**
425
+ + Flag indicating if the signature allows for other inputs to be added later.
445
426
 
446
427
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
447
428
 
448
429
  ---
449
-
450
430
  ### Class: Script
451
431
 
452
432
  The Script class represents a script in a Bitcoin SV transaction,
@@ -484,13 +464,12 @@ See also: [BigNumber](./primitives.md#class-bignumber), [ScriptChunk](./script.m
484
464
  ```ts
485
465
  constructor(chunks: ScriptChunk[] = [])
486
466
  ```
487
-
488
467
  See also: [ScriptChunk](./script.md#interface-scriptchunk)
489
468
 
490
469
  Argument Details
491
470
 
492
- - **chunks**
493
- - =[] - An array of script chunks to directly initialize the script.
471
+ + **chunks**
472
+ + =[] - An array of script chunks to directly initialize the script.
494
473
 
495
474
  #### Method findAndDelete
496
475
 
@@ -499,7 +478,6 @@ Deletes the given item wherever it appears in the current script.
499
478
  ```ts
500
479
  findAndDelete(script: Script): Script
501
480
  ```
502
-
503
481
  See also: [Script](./script.md#class-script)
504
482
 
505
483
  Returns
@@ -508,15 +486,14 @@ This script instance for chaining.
508
486
 
509
487
  Argument Details
510
488
 
511
- - **script**
512
- - The script containing the item to delete from the current script.
489
+ + **script**
490
+ + The script containing the item to delete from the current script.
513
491
 
514
492
  #### Method fromASM
515
493
 
516
494
  ```ts
517
495
  static fromASM(asm: string): Script
518
496
  ```
519
-
520
497
  See also: [Script](./script.md#class-script)
521
498
 
522
499
  Returns
@@ -525,8 +502,8 @@ A new Script instance.
525
502
 
526
503
  Argument Details
527
504
 
528
- - **asm**
529
- - The script in ASM string format.
505
+ + **asm**
506
+ + The script in ASM string format.
530
507
 
531
508
  Example
532
509
 
@@ -539,7 +516,6 @@ const script = Script.fromASM("OP_DUP OP_HASH160 abcd... OP_EQUALVERIFY OP_CHECK
539
516
  ```ts
540
517
  static fromBinary(bin: number[]): Script
541
518
  ```
542
-
543
519
  See also: [Script](./script.md#class-script)
544
520
 
545
521
  Returns
@@ -548,8 +524,8 @@ A new Script instance.
548
524
 
549
525
  Argument Details
550
526
 
551
- - **bin**
552
- - The script in binary array format.
527
+ + **bin**
528
+ + The script in binary array format.
553
529
 
554
530
  Example
555
531
 
@@ -562,7 +538,6 @@ const script = Script.fromBinary([0x76, 0xa9, ...])
562
538
  ```ts
563
539
  static fromHex(hex: string): Script
564
540
  ```
565
-
566
541
  See also: [Script](./script.md#class-script)
567
542
 
568
543
  Returns
@@ -571,8 +546,8 @@ A new Script instance.
571
546
 
572
547
  Argument Details
573
548
 
574
- - **hex**
575
- - The script in hexadecimal format.
549
+ + **hex**
550
+ + The script in hexadecimal format.
576
551
 
577
552
  Example
578
553
 
@@ -615,7 +590,6 @@ True if the script is an unlocking script, otherwise false.
615
590
  ```ts
616
591
  removeCodeseparators(): Script
617
592
  ```
618
-
619
593
  See also: [Script](./script.md#class-script)
620
594
 
621
595
  Returns
@@ -627,7 +601,6 @@ This script instance for chaining.
627
601
  ```ts
628
602
  setChunkOpCode(i: number, op: number): Script
629
603
  ```
630
-
631
604
  See also: [Script](./script.md#class-script)
632
605
 
633
606
  Returns
@@ -636,10 +609,10 @@ This script instance for chaining.
636
609
 
637
610
  Argument Details
638
611
 
639
- - **i**
640
- - The index of the chunk.
641
- - **op**
642
- - The opcode to set.
612
+ + **i**
613
+ + The index of the chunk.
614
+ + **op**
615
+ + The opcode to set.
643
616
 
644
617
  #### Method toASM
645
618
 
@@ -676,7 +649,6 @@ The script in hexadecimal format.
676
649
  ```ts
677
650
  writeBin(bin: number[]): Script
678
651
  ```
679
-
680
652
  See also: [Script](./script.md#class-script)
681
653
 
682
654
  Returns
@@ -685,8 +657,8 @@ This script instance for chaining.
685
657
 
686
658
  Argument Details
687
659
 
688
- - **bin**
689
- - The binary data to append.
660
+ + **bin**
661
+ + The binary data to append.
690
662
 
691
663
  Throws
692
664
 
@@ -697,7 +669,6 @@ Throws an error if the data is too large to be pushed.
697
669
  ```ts
698
670
  writeBn(bn: BigNumber): Script
699
671
  ```
700
-
701
672
  See also: [BigNumber](./primitives.md#class-bignumber), [Script](./script.md#class-script)
702
673
 
703
674
  Returns
@@ -706,15 +677,14 @@ This script instance for chaining.
706
677
 
707
678
  Argument Details
708
679
 
709
- - **bn**
710
- - The BigNumber to append.
680
+ + **bn**
681
+ + The BigNumber to append.
711
682
 
712
683
  #### Method writeNumber
713
684
 
714
685
  ```ts
715
686
  writeNumber(num: number): Script
716
687
  ```
717
-
718
688
  See also: [Script](./script.md#class-script)
719
689
 
720
690
  Returns
@@ -723,15 +693,14 @@ This script instance for chaining.
723
693
 
724
694
  Argument Details
725
695
 
726
- - **num**
727
- - The number to append.
696
+ + **num**
697
+ + The number to append.
728
698
 
729
699
  #### Method writeOpCode
730
700
 
731
701
  ```ts
732
702
  writeOpCode(op: number): Script
733
703
  ```
734
-
735
704
  See also: [Script](./script.md#class-script)
736
705
 
737
706
  Returns
@@ -740,15 +709,14 @@ This script instance for chaining.
740
709
 
741
710
  Argument Details
742
711
 
743
- - **op**
744
- - The opcode to append.
712
+ + **op**
713
+ + The opcode to append.
745
714
 
746
715
  #### Method writeScript
747
716
 
748
717
  ```ts
749
718
  writeScript(script: Script): Script
750
719
  ```
751
-
752
720
  See also: [Script](./script.md#class-script)
753
721
 
754
722
  Returns
@@ -757,13 +725,12 @@ This script instance for chaining.
757
725
 
758
726
  Argument Details
759
727
 
760
- - **script**
761
- - The script to append.
728
+ + **script**
729
+ + The script to append.
762
730
 
763
731
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
764
732
 
765
733
  ---
766
-
767
734
  ### Class: Spend
768
735
 
769
736
  The Spend class represents a spend action within a Bitcoin SV transaction.
@@ -832,35 +799,34 @@ constructor(params: {
832
799
  memoryLimit?: number;
833
800
  })
834
801
  ```
835
-
836
802
  See also: [LockingScript](./script.md#class-lockingscript), [TransactionInput](./transaction.md#interface-transactioninput), [TransactionOutput](./transaction.md#interface-transactionoutput), [UnlockingScript](./script.md#class-unlockingscript)
837
803
 
838
804
  Argument Details
839
805
 
840
- - **params.sourceTXID**
841
- - The transaction ID of the source UTXO.
842
- - **params.sourceOutputIndex**
843
- - The index of the output in the source transaction.
844
- - **params.sourceSatoshis**
845
- - The amount of satoshis in the source UTXO.
846
- - **params.lockingScript**
847
- - The locking script associated with the UTXO.
848
- - **params.transactionVersion**
849
- - The version of the current transaction.
850
- - **params.otherInputs**
851
- - -
806
+ + **params.sourceTXID**
807
+ + The transaction ID of the source UTXO.
808
+ + **params.sourceOutputIndex**
809
+ + The index of the output in the source transaction.
810
+ + **params.sourceSatoshis**
811
+ + The amount of satoshis in the source UTXO.
812
+ + **params.lockingScript**
813
+ + The locking script associated with the UTXO.
814
+ + **params.transactionVersion**
815
+ + The version of the current transaction.
816
+ + **params.otherInputs**
817
+ + -
852
818
  An array of other inputs in the transaction.
853
- - **params.outputs**
854
- - -
819
+ + **params.outputs**
820
+ + -
855
821
  The outputs of the current transaction.
856
- - **params.inputIndex**
857
- - The index of this input in the current transaction.
858
- - **params.unlockingScript**
859
- - The unlocking script for this spend.
860
- - **params.inputSequence**
861
- - The sequence number of this input.
862
- - **params.lockTime**
863
- - The lock time of the transaction.
822
+ + **params.inputIndex**
823
+ + The index of this input in the current transaction.
824
+ + **params.unlockingScript**
825
+ + The unlocking script for this spend.
826
+ + **params.inputSequence**
827
+ + The sequence number of this input.
828
+ + **params.lockTime**
829
+ + The lock time of the transaction.
864
830
 
865
831
  Example
866
832
 
@@ -903,7 +869,6 @@ if (spend.validate()) {
903
869
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
904
870
 
905
871
  ---
906
-
907
872
  ### Class: UnlockingScript
908
873
 
909
874
  The UnlockingScript class represents an unlocking script in a Bitcoin SV transaction.
@@ -943,7 +908,6 @@ Always returns true for an UnlockingScript instance.
943
908
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
944
909
 
945
910
  ---
946
-
947
911
  ## Functions
948
912
 
949
913
  ## Types
@@ -951,3 +915,4 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
951
915
  ## Enums
952
916
 
953
917
  ## Variables
918
+