@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.
- package/dist/cjs/package.json +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/types/src/transaction/http/HttpClient.d.ts +2 -0
- package/dist/types/src/transaction/http/HttpClient.d.ts.map +1 -1
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/docs/reference/auth.md +159 -212
- package/docs/reference/compat.md +96 -120
- package/docs/reference/identity.md +12 -21
- package/docs/reference/kvstore.md +19 -21
- package/docs/reference/messages.md +0 -3
- package/docs/reference/overlay-tools.md +18 -46
- package/docs/reference/primitives.md +390 -571
- package/docs/reference/registry.md +20 -43
- package/docs/reference/script.md +105 -140
- package/docs/reference/storage.md +12 -32
- package/docs/reference/totp.md +11 -16
- package/docs/reference/transaction.md +129 -201
- package/docs/reference/wallet.md +64 -241
- package/package.json +1 -1
- package/src/transaction/http/HttpClient.ts +2 -0
|
@@ -83,13 +83,11 @@ The HTTP client used to make requests to the ARC API.
|
|
|
83
83
|
```ts
|
|
84
84
|
httpClient?: HttpClient
|
|
85
85
|
```
|
|
86
|
-
|
|
87
86
|
See also: [HttpClient](./transaction.md#interface-httpclient)
|
|
88
87
|
|
|
89
88
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
90
89
|
|
|
91
90
|
---
|
|
92
|
-
|
|
93
91
|
### Interface: BroadcastFailure
|
|
94
92
|
|
|
95
93
|
Defines the structure of a failed broadcast response.
|
|
@@ -107,7 +105,6 @@ export interface BroadcastFailure {
|
|
|
107
105
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
108
106
|
|
|
109
107
|
---
|
|
110
|
-
|
|
111
108
|
### Interface: BroadcastResponse
|
|
112
109
|
|
|
113
110
|
Defines the structure of a successful broadcast response.
|
|
@@ -124,7 +121,6 @@ export interface BroadcastResponse {
|
|
|
124
121
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
125
122
|
|
|
126
123
|
---
|
|
127
|
-
|
|
128
124
|
### Interface: Broadcaster
|
|
129
125
|
|
|
130
126
|
Represents the interface for a transaction broadcaster.
|
|
@@ -142,7 +138,6 @@ See also: [BroadcastFailure](./transaction.md#interface-broadcastfailure), [Broa
|
|
|
142
138
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
143
139
|
|
|
144
140
|
---
|
|
145
|
-
|
|
146
141
|
### Interface: ChainTracker
|
|
147
142
|
|
|
148
143
|
The Chain Tracker is responsible for verifying the validity of a given Merkle root
|
|
@@ -175,7 +170,6 @@ export default interface ChainTracker {
|
|
|
175
170
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
176
171
|
|
|
177
172
|
---
|
|
178
|
-
|
|
179
173
|
### Interface: FeeModel
|
|
180
174
|
|
|
181
175
|
Represents the interface for a transaction fee model.
|
|
@@ -192,7 +186,6 @@ See also: [Transaction](./transaction.md#class-transaction)
|
|
|
192
186
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
193
187
|
|
|
194
188
|
---
|
|
195
|
-
|
|
196
189
|
### Interface: FetchOptions
|
|
197
190
|
|
|
198
191
|
An interface for configuration of the request to be passed to the fetch method
|
|
@@ -233,7 +226,6 @@ method?: string
|
|
|
233
226
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
234
227
|
|
|
235
228
|
---
|
|
236
|
-
|
|
237
229
|
### Interface: HttpClient
|
|
238
230
|
|
|
239
231
|
An interface for HTTP client used to make HTTP requests.
|
|
@@ -253,13 +245,11 @@ Makes a request to the server.
|
|
|
253
245
|
```ts
|
|
254
246
|
request: <T = any, D = any>(url: string, options: HttpClientRequestOptions<D>) => Promise<HttpClientResponse<T>>
|
|
255
247
|
```
|
|
256
|
-
|
|
257
248
|
See also: [HttpClientRequestOptions](./transaction.md#interface-httpclientrequestoptions), [HttpClientResponse](./transaction.md#type-httpclientresponse)
|
|
258
249
|
|
|
259
250
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
260
251
|
|
|
261
252
|
---
|
|
262
|
-
|
|
263
253
|
### Interface: HttpClientRequestOptions
|
|
264
254
|
|
|
265
255
|
An interface for configuration of the request to be passed to the request method.
|
|
@@ -269,6 +259,7 @@ export interface HttpClientRequestOptions<Data = any> {
|
|
|
269
259
|
method?: string;
|
|
270
260
|
headers?: Record<string, string>;
|
|
271
261
|
data?: Data;
|
|
262
|
+
signal?: AbortSignal;
|
|
272
263
|
}
|
|
273
264
|
```
|
|
274
265
|
|
|
@@ -296,10 +287,17 @@ A string to set request's method.
|
|
|
296
287
|
method?: string
|
|
297
288
|
```
|
|
298
289
|
|
|
290
|
+
#### Property signal
|
|
291
|
+
|
|
292
|
+
An optional AbortSignal to cancel the request, including by explicit timeout.
|
|
293
|
+
|
|
294
|
+
```ts
|
|
295
|
+
signal?: AbortSignal
|
|
296
|
+
```
|
|
297
|
+
|
|
299
298
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
300
299
|
|
|
301
300
|
---
|
|
302
|
-
|
|
303
301
|
### Interface: HttpsNodejs
|
|
304
302
|
|
|
305
303
|
Node Https module interface limited to options needed by ts-sdk
|
|
@@ -315,7 +313,6 @@ See also: [HttpClientRequestOptions](./transaction.md#interface-httpclientreques
|
|
|
315
313
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
316
314
|
|
|
317
315
|
---
|
|
318
|
-
|
|
319
316
|
### Interface: MerklePathLeaf
|
|
320
317
|
|
|
321
318
|
```ts
|
|
@@ -330,7 +327,6 @@ export interface MerklePathLeaf {
|
|
|
330
327
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
331
328
|
|
|
332
329
|
---
|
|
333
|
-
|
|
334
330
|
### Interface: NodejsHttpClientRequest
|
|
335
331
|
|
|
336
332
|
Nodejs result of the Node https.request call limited to options needed by ts-sdk
|
|
@@ -346,7 +342,6 @@ export interface NodejsHttpClientRequest {
|
|
|
346
342
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
347
343
|
|
|
348
344
|
---
|
|
349
|
-
|
|
350
345
|
### Interface: TransactionInput
|
|
351
346
|
|
|
352
347
|
Represents an input to a Bitcoin transaction.
|
|
@@ -389,7 +384,6 @@ See also: [Transaction](./transaction.md#class-transaction), [UnlockingScript](.
|
|
|
389
384
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
390
385
|
|
|
391
386
|
---
|
|
392
|
-
|
|
393
387
|
### Interface: TransactionOutput
|
|
394
388
|
|
|
395
389
|
Represents an output in a Bitcoin transaction.
|
|
@@ -420,7 +414,6 @@ See also: [LockingScript](./script.md#class-lockingscript)
|
|
|
420
414
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
421
415
|
|
|
422
416
|
---
|
|
423
|
-
|
|
424
417
|
### Interface: WhatsOnChainConfig
|
|
425
418
|
|
|
426
419
|
Configuration options for the WhatsOnChain ChainTracker.
|
|
@@ -449,13 +442,11 @@ The HTTP client used to make requests to the API.
|
|
|
449
442
|
```ts
|
|
450
443
|
httpClient?: HttpClient
|
|
451
444
|
```
|
|
452
|
-
|
|
453
445
|
See also: [HttpClient](./transaction.md#interface-httpclient)
|
|
454
446
|
|
|
455
447
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
456
448
|
|
|
457
449
|
---
|
|
458
|
-
|
|
459
450
|
## Classes
|
|
460
451
|
|
|
461
452
|
| |
|
|
@@ -504,15 +495,14 @@ Constructs an instance of the ARC broadcaster.
|
|
|
504
495
|
```ts
|
|
505
496
|
constructor(URL: string, config?: ArcConfig)
|
|
506
497
|
```
|
|
507
|
-
|
|
508
498
|
See also: [ArcConfig](./transaction.md#interface-arcconfig)
|
|
509
499
|
|
|
510
500
|
Argument Details
|
|
511
501
|
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
502
|
+
+ **URL**
|
|
503
|
+
+ The URL endpoint for the ARC API.
|
|
504
|
+
+ **config**
|
|
505
|
+
+ Configuration options for the ARC broadcaster.
|
|
516
506
|
|
|
517
507
|
#### Constructor
|
|
518
508
|
|
|
@@ -524,10 +514,10 @@ constructor(URL: string, apiKey?: string)
|
|
|
524
514
|
|
|
525
515
|
Argument Details
|
|
526
516
|
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
517
|
+
+ **URL**
|
|
518
|
+
+ The URL endpoint for the ARC API.
|
|
519
|
+
+ **apiKey**
|
|
520
|
+
+ The API key used for authorization with the ARC API.
|
|
531
521
|
|
|
532
522
|
#### Method broadcast
|
|
533
523
|
|
|
@@ -536,7 +526,6 @@ Broadcasts a transaction via ARC.
|
|
|
536
526
|
```ts
|
|
537
527
|
async broadcast(tx: Transaction): Promise<BroadcastResponse | BroadcastFailure>
|
|
538
528
|
```
|
|
539
|
-
|
|
540
529
|
See also: [BroadcastFailure](./transaction.md#interface-broadcastfailure), [BroadcastResponse](./transaction.md#interface-broadcastresponse), [Transaction](./transaction.md#class-transaction)
|
|
541
530
|
|
|
542
531
|
Returns
|
|
@@ -545,8 +534,8 @@ A promise that resolves to either a success or failure response.
|
|
|
545
534
|
|
|
546
535
|
Argument Details
|
|
547
536
|
|
|
548
|
-
|
|
549
|
-
|
|
537
|
+
+ **tx**
|
|
538
|
+
+ The transaction to be broadcasted.
|
|
550
539
|
|
|
551
540
|
#### Method broadcastMany
|
|
552
541
|
|
|
@@ -556,7 +545,6 @@ Handles mixed responses where some transactions succeed and others fail.
|
|
|
556
545
|
```ts
|
|
557
546
|
async broadcastMany(txs: Transaction[]): Promise<object[]>
|
|
558
547
|
```
|
|
559
|
-
|
|
560
548
|
See also: [Transaction](./transaction.md#class-transaction)
|
|
561
549
|
|
|
562
550
|
Returns
|
|
@@ -565,13 +553,12 @@ A promise that resolves to an array of objects.
|
|
|
565
553
|
|
|
566
554
|
Argument Details
|
|
567
555
|
|
|
568
|
-
|
|
569
|
-
|
|
556
|
+
+ **txs**
|
|
557
|
+
+ Array of transactions to be broadcasted.
|
|
570
558
|
|
|
571
559
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
572
560
|
|
|
573
561
|
---
|
|
574
|
-
|
|
575
562
|
### Class: Beef
|
|
576
563
|
|
|
577
564
|
```ts
|
|
@@ -637,7 +624,6 @@ addComputedLeaves(): void
|
|
|
637
624
|
```ts
|
|
638
625
|
clone(): Beef
|
|
639
626
|
```
|
|
640
|
-
|
|
641
627
|
See also: [Beef](./transaction.md#class-beef)
|
|
642
628
|
|
|
643
629
|
Returns
|
|
@@ -653,7 +639,6 @@ To succeed, the Beef must contain all the required transaction and merkle path d
|
|
|
653
639
|
```ts
|
|
654
640
|
findAtomicTransaction(txid: string): Transaction | undefined
|
|
655
641
|
```
|
|
656
|
-
|
|
657
642
|
See also: [Transaction](./transaction.md#class-transaction)
|
|
658
643
|
|
|
659
644
|
Returns
|
|
@@ -662,15 +647,14 @@ Transaction with input `SourceTransaction` and `MerklePath` populated from this
|
|
|
662
647
|
|
|
663
648
|
Argument Details
|
|
664
649
|
|
|
665
|
-
|
|
666
|
-
|
|
650
|
+
+ **txid**
|
|
651
|
+
+ The id of the target transaction.
|
|
667
652
|
|
|
668
653
|
#### Method findBump
|
|
669
654
|
|
|
670
655
|
```ts
|
|
671
656
|
findBump(txid: string): MerklePath | undefined
|
|
672
657
|
```
|
|
673
|
-
|
|
674
658
|
See also: [MerklePath](./transaction.md#class-merklepath)
|
|
675
659
|
|
|
676
660
|
Returns
|
|
@@ -687,7 +671,6 @@ The result is suitable for signing.
|
|
|
687
671
|
```ts
|
|
688
672
|
findTransactionForSigning(txid: string): Transaction | undefined
|
|
689
673
|
```
|
|
690
|
-
|
|
691
674
|
See also: [Transaction](./transaction.md#class-transaction)
|
|
692
675
|
|
|
693
676
|
Returns
|
|
@@ -696,15 +679,14 @@ Transaction with all available input `SourceTransaction`s from this Beef.
|
|
|
696
679
|
|
|
697
680
|
Argument Details
|
|
698
681
|
|
|
699
|
-
|
|
700
|
-
|
|
682
|
+
+ **txid**
|
|
683
|
+
+ The id of the target transaction.
|
|
701
684
|
|
|
702
685
|
#### Method findTxid
|
|
703
686
|
|
|
704
687
|
```ts
|
|
705
688
|
findTxid(txid: string): BeefTx | undefined
|
|
706
689
|
```
|
|
707
|
-
|
|
708
690
|
See also: [BeefTx](./transaction.md#class-beeftx)
|
|
709
691
|
|
|
710
692
|
Returns
|
|
@@ -713,8 +695,8 @@ Returns
|
|
|
713
695
|
|
|
714
696
|
Argument Details
|
|
715
697
|
|
|
716
|
-
|
|
717
|
-
|
|
698
|
+
+ **txid**
|
|
699
|
+
+ of `beefTx` to find
|
|
718
700
|
|
|
719
701
|
#### Method fromBinary
|
|
720
702
|
|
|
@@ -723,7 +705,6 @@ Constructs an instance of the Beef class based on the provided binary array
|
|
|
723
705
|
```ts
|
|
724
706
|
static fromBinary(bin: number[]): Beef
|
|
725
707
|
```
|
|
726
|
-
|
|
727
708
|
See also: [Beef](./transaction.md#class-beef)
|
|
728
709
|
|
|
729
710
|
Returns
|
|
@@ -732,8 +713,8 @@ An instance of the Beef class constructed from the binary data
|
|
|
732
713
|
|
|
733
714
|
Argument Details
|
|
734
715
|
|
|
735
|
-
|
|
736
|
-
|
|
716
|
+
+ **bin**
|
|
717
|
+
+ The binary array from which to construct BEEF
|
|
737
718
|
|
|
738
719
|
#### Method fromString
|
|
739
720
|
|
|
@@ -742,7 +723,6 @@ Constructs an instance of the Beef class based on the provided string
|
|
|
742
723
|
```ts
|
|
743
724
|
static fromString(s: string, enc: "hex" | "utf8" | "base64" = "hex"): Beef
|
|
744
725
|
```
|
|
745
|
-
|
|
746
726
|
See also: [Beef](./transaction.md#class-beef)
|
|
747
727
|
|
|
748
728
|
Returns
|
|
@@ -751,10 +731,10 @@ An instance of the Beef class constructed from the string
|
|
|
751
731
|
|
|
752
732
|
Argument Details
|
|
753
733
|
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
734
|
+
+ **s**
|
|
735
|
+
+ The string value from which to construct BEEF
|
|
736
|
+
+ **enc**
|
|
737
|
+
+ The encoding of the string value from which BEEF should be constructed
|
|
758
738
|
|
|
759
739
|
#### Method getValidTxids
|
|
760
740
|
|
|
@@ -773,7 +753,6 @@ Sorts `txs` and checks structural validity of beef.
|
|
|
773
753
|
Does NOT verify merkle roots.
|
|
774
754
|
|
|
775
755
|
Validity requirements:
|
|
776
|
-
|
|
777
756
|
1. No 'known' txids, unless `allowTxidOnly` is true.
|
|
778
757
|
2. All transactions have bumps or their inputs chain back to bumps (or are known).
|
|
779
758
|
3. Order of transactions satisfies dependencies before dependents.
|
|
@@ -785,8 +764,8 @@ isValid(allowTxidOnly?: boolean): boolean
|
|
|
785
764
|
|
|
786
765
|
Argument Details
|
|
787
766
|
|
|
788
|
-
|
|
789
|
-
|
|
767
|
+
+ **allowTxidOnly**
|
|
768
|
+
+ optional. If true, transaction txid only is assumed valid
|
|
790
769
|
|
|
791
770
|
#### Method makeTxidOnly
|
|
792
771
|
|
|
@@ -799,7 +778,6 @@ original.
|
|
|
799
778
|
```ts
|
|
800
779
|
makeTxidOnly(txid: string): BeefTx | undefined
|
|
801
780
|
```
|
|
802
|
-
|
|
803
781
|
See also: [BeefTx](./transaction.md#class-beeftx)
|
|
804
782
|
|
|
805
783
|
Returns
|
|
@@ -813,7 +791,6 @@ Merge a MerklePath that is assumed to be fully valid.
|
|
|
813
791
|
```ts
|
|
814
792
|
mergeBump(bump: MerklePath): number
|
|
815
793
|
```
|
|
816
|
-
|
|
817
794
|
See also: [MerklePath](./transaction.md#class-merklepath)
|
|
818
795
|
|
|
819
796
|
Returns
|
|
@@ -831,7 +808,6 @@ Replaces existing transaction with same txid.
|
|
|
831
808
|
```ts
|
|
832
809
|
mergeRawTx(rawTx: number[], bumpIndex?: number): BeefTx
|
|
833
810
|
```
|
|
834
|
-
|
|
835
811
|
See also: [BeefTx](./transaction.md#class-beeftx)
|
|
836
812
|
|
|
837
813
|
Returns
|
|
@@ -840,8 +816,8 @@ txid of rawTx
|
|
|
840
816
|
|
|
841
817
|
Argument Details
|
|
842
818
|
|
|
843
|
-
|
|
844
|
-
|
|
819
|
+
+ **bumpIndex**
|
|
820
|
+
+ Optional. If a number, must be valid index into bumps array.
|
|
845
821
|
|
|
846
822
|
#### Method mergeTransaction
|
|
847
823
|
|
|
@@ -854,7 +830,6 @@ Attempts to match an existing bump to the new transaction.
|
|
|
854
830
|
```ts
|
|
855
831
|
mergeTransaction(tx: Transaction): BeefTx
|
|
856
832
|
```
|
|
857
|
-
|
|
858
833
|
See also: [BeefTx](./transaction.md#class-beeftx), [Transaction](./transaction.md#class-transaction)
|
|
859
834
|
|
|
860
835
|
Returns
|
|
@@ -871,13 +846,12 @@ removeExistingTxid(txid: string): void
|
|
|
871
846
|
|
|
872
847
|
Argument Details
|
|
873
848
|
|
|
874
|
-
|
|
875
|
-
|
|
849
|
+
+ **txid**
|
|
850
|
+
+ TXID of the transaction to remove
|
|
876
851
|
|
|
877
852
|
#### Method sortTxs
|
|
878
853
|
|
|
879
854
|
Sort the `txs` by input txid dependency order:
|
|
880
|
-
|
|
881
855
|
- Oldest Tx Anchored by Path or txid only
|
|
882
856
|
- Newer Txs depending on Older parents
|
|
883
857
|
- Newest Tx
|
|
@@ -955,7 +929,6 @@ Serializes this data to `writer`
|
|
|
955
929
|
```ts
|
|
956
930
|
toWriter(writer: Writer): void
|
|
957
931
|
```
|
|
958
|
-
|
|
959
932
|
See also: [Writer](./primitives.md#class-writer)
|
|
960
933
|
|
|
961
934
|
#### Method trimKnownTxids
|
|
@@ -973,7 +946,6 @@ by validating structure of this beef and confirming computed merkle roots
|
|
|
973
946
|
using `chainTracker`.
|
|
974
947
|
|
|
975
948
|
Validity requirements:
|
|
976
|
-
|
|
977
949
|
1. No 'known' txids, unless `allowTxidOnly` is true.
|
|
978
950
|
2. All transactions have bumps or their inputs chain back to bumps (or are known).
|
|
979
951
|
3. Order of transactions satisfies dependencies before dependents.
|
|
@@ -982,15 +954,14 @@ Validity requirements:
|
|
|
982
954
|
```ts
|
|
983
955
|
async verify(chainTracker: ChainTracker, allowTxidOnly?: boolean): Promise<boolean>
|
|
984
956
|
```
|
|
985
|
-
|
|
986
957
|
See also: [ChainTracker](./transaction.md#interface-chaintracker)
|
|
987
958
|
|
|
988
959
|
Argument Details
|
|
989
960
|
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
961
|
+
+ **chainTracker**
|
|
962
|
+
+ Used to verify computed merkle path roots for all bump txids.
|
|
963
|
+
+ **allowTxidOnly**
|
|
964
|
+
+ optional. If true, transaction txid is assumed valid
|
|
994
965
|
|
|
995
966
|
#### Method verifyValid
|
|
996
967
|
|
|
@@ -1000,7 +971,6 @@ by validating structure of this beef.
|
|
|
1000
971
|
Returns block heights and merkle root values to be confirmed by a chaintracker.
|
|
1001
972
|
|
|
1002
973
|
Validity requirements:
|
|
1003
|
-
|
|
1004
974
|
1. No 'known' txids, unless `allowTxidOnly` is true.
|
|
1005
975
|
2. All transactions have bumps or their inputs chain back to bumps (or are known).
|
|
1006
976
|
3. Order of transactions satisfies dependencies before dependents.
|
|
@@ -1020,13 +990,12 @@ Returns
|
|
|
1020
990
|
|
|
1021
991
|
Argument Details
|
|
1022
992
|
|
|
1023
|
-
|
|
1024
|
-
|
|
993
|
+
+ **allowTxidOnly**
|
|
994
|
+
+ optional. If true, transaction txid is assumed valid
|
|
1025
995
|
|
|
1026
996
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
1027
997
|
|
|
1028
998
|
---
|
|
1029
|
-
|
|
1030
999
|
### Class: BeefParty
|
|
1031
1000
|
|
|
1032
1001
|
Extends `Beef` that is used to exchange transaction validity data with more than one external party.
|
|
@@ -1071,8 +1040,8 @@ constructor(parties?: string[])
|
|
|
1071
1040
|
|
|
1072
1041
|
Argument Details
|
|
1073
1042
|
|
|
1074
|
-
|
|
1075
|
-
|
|
1043
|
+
+ **parties**
|
|
1044
|
+
+ Optional array of initial unique party identifiers.
|
|
1076
1045
|
|
|
1077
1046
|
#### Property knownTo
|
|
1078
1047
|
|
|
@@ -1093,8 +1062,8 @@ addKnownTxidsForParty(party: string, knownTxids: string[]): void
|
|
|
1093
1062
|
|
|
1094
1063
|
Argument Details
|
|
1095
1064
|
|
|
1096
|
-
|
|
1097
|
-
|
|
1065
|
+
+ **party**
|
|
1066
|
+
+ unique identifier, added if new.
|
|
1098
1067
|
|
|
1099
1068
|
#### Method addParty
|
|
1100
1069
|
|
|
@@ -1119,7 +1088,6 @@ Array of txids "known" to `party`.
|
|
|
1119
1088
|
```ts
|
|
1120
1089
|
getTrimmedBeefForParty(party: string): Beef
|
|
1121
1090
|
```
|
|
1122
|
-
|
|
1123
1091
|
See also: [Beef](./transaction.md#class-beef)
|
|
1124
1092
|
|
|
1125
1093
|
Returns
|
|
@@ -1147,13 +1115,11 @@ has raw transaction and validity proof data.
|
|
|
1147
1115
|
```ts
|
|
1148
1116
|
mergeBeefFromParty(party: string, beef: number[] | Beef): void
|
|
1149
1117
|
```
|
|
1150
|
-
|
|
1151
1118
|
See also: [Beef](./transaction.md#class-beef)
|
|
1152
1119
|
|
|
1153
1120
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
1154
1121
|
|
|
1155
1122
|
---
|
|
1156
|
-
|
|
1157
1123
|
### Class: BeefTx
|
|
1158
1124
|
|
|
1159
1125
|
A single bitcoin transaction associated with a `Beef` validity proof set.
|
|
@@ -1195,15 +1161,14 @@ See also: [Reader](./primitives.md#class-reader), [Transaction](./transaction.md
|
|
|
1195
1161
|
```ts
|
|
1196
1162
|
constructor(tx: Transaction | number[] | string, bumpIndex?: number)
|
|
1197
1163
|
```
|
|
1198
|
-
|
|
1199
1164
|
See also: [Transaction](./transaction.md#class-transaction)
|
|
1200
1165
|
|
|
1201
1166
|
Argument Details
|
|
1202
1167
|
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1168
|
+
+ **tx**
|
|
1169
|
+
+ If string, must be a valid txid. If `number[]` must be a valid serialized transaction.
|
|
1170
|
+
+ **bumpIndex**
|
|
1171
|
+
+ If transaction already has a proof in the beef to which it will be added.
|
|
1207
1172
|
|
|
1208
1173
|
#### Property isValid
|
|
1209
1174
|
|
|
@@ -1218,7 +1183,6 @@ isValid?: boolean = undefined
|
|
|
1218
1183
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
1219
1184
|
|
|
1220
1185
|
---
|
|
1221
|
-
|
|
1222
1186
|
### Class: FetchHttpClient
|
|
1223
1187
|
|
|
1224
1188
|
Adapter for Node Https module to be used as HttpClient
|
|
@@ -1235,7 +1199,6 @@ See also: [Fetch](./transaction.md#type-fetch), [HttpClient](./transaction.md#in
|
|
|
1235
1199
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
1236
1200
|
|
|
1237
1201
|
---
|
|
1238
|
-
|
|
1239
1202
|
### Class: MerklePath
|
|
1240
1203
|
|
|
1241
1204
|
Represents a Merkle Path, which is used to provide a compact proof of inclusion for a
|
|
@@ -1288,13 +1251,12 @@ Combines this MerklePath with another to create a compound proof.
|
|
|
1288
1251
|
```ts
|
|
1289
1252
|
combine(other: MerklePath): void
|
|
1290
1253
|
```
|
|
1291
|
-
|
|
1292
1254
|
See also: [MerklePath](./transaction.md#class-merklepath)
|
|
1293
1255
|
|
|
1294
1256
|
Argument Details
|
|
1295
1257
|
|
|
1296
|
-
|
|
1297
|
-
|
|
1258
|
+
+ **other**
|
|
1259
|
+
+ Another MerklePath to combine with this path.
|
|
1298
1260
|
|
|
1299
1261
|
Throws
|
|
1300
1262
|
|
|
@@ -1314,8 +1276,8 @@ Returns
|
|
|
1314
1276
|
|
|
1315
1277
|
Argument Details
|
|
1316
1278
|
|
|
1317
|
-
|
|
1318
|
-
|
|
1279
|
+
+ **txid**
|
|
1280
|
+
+ The transaction ID to compute the Merkle root for. If not provided, the root will be computed from an unspecified branch, and not all branches will be validated!
|
|
1319
1281
|
|
|
1320
1282
|
Throws
|
|
1321
1283
|
|
|
@@ -1330,7 +1292,6 @@ Does not add computed leaves to path.
|
|
|
1330
1292
|
```ts
|
|
1331
1293
|
findOrComputeLeaf(height: number, offset: number): MerklePathLeaf | undefined
|
|
1332
1294
|
```
|
|
1333
|
-
|
|
1334
1295
|
See also: [MerklePathLeaf](./transaction.md#interface-merklepathleaf)
|
|
1335
1296
|
|
|
1336
1297
|
#### Method fromBinary
|
|
@@ -1340,7 +1301,6 @@ Creates a MerklePath instance from a binary array.
|
|
|
1340
1301
|
```ts
|
|
1341
1302
|
static fromBinary(bump: number[]): MerklePath
|
|
1342
1303
|
```
|
|
1343
|
-
|
|
1344
1304
|
See also: [MerklePath](./transaction.md#class-merklepath)
|
|
1345
1305
|
|
|
1346
1306
|
Returns
|
|
@@ -1349,15 +1309,14 @@ Returns
|
|
|
1349
1309
|
|
|
1350
1310
|
Argument Details
|
|
1351
1311
|
|
|
1352
|
-
|
|
1353
|
-
|
|
1312
|
+
+ **bump**
|
|
1313
|
+
+ The binary array representation of the Merkle Path.
|
|
1354
1314
|
|
|
1355
1315
|
#### Method fromCoinbaseTxidAndHeight
|
|
1356
1316
|
|
|
1357
1317
|
```ts
|
|
1358
1318
|
static fromCoinbaseTxidAndHeight(txid: string, height: number): MerklePath
|
|
1359
1319
|
```
|
|
1360
|
-
|
|
1361
1320
|
See also: [MerklePath](./transaction.md#class-merklepath)
|
|
1362
1321
|
|
|
1363
1322
|
Returns
|
|
@@ -1366,10 +1325,10 @@ Returns
|
|
|
1366
1325
|
|
|
1367
1326
|
Argument Details
|
|
1368
1327
|
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1328
|
+
+ **txid**
|
|
1329
|
+
+ The coinbase txid.
|
|
1330
|
+
+ **height**
|
|
1331
|
+
+ The height of the block.
|
|
1373
1332
|
|
|
1374
1333
|
#### Method fromHex
|
|
1375
1334
|
|
|
@@ -1378,7 +1337,6 @@ Creates a MerklePath instance from a hexadecimal string.
|
|
|
1378
1337
|
```ts
|
|
1379
1338
|
static fromHex(hex: string): MerklePath
|
|
1380
1339
|
```
|
|
1381
|
-
|
|
1382
1340
|
See also: [MerklePath](./transaction.md#class-merklepath)
|
|
1383
1341
|
|
|
1384
1342
|
Returns
|
|
@@ -1387,8 +1345,8 @@ Returns
|
|
|
1387
1345
|
|
|
1388
1346
|
Argument Details
|
|
1389
1347
|
|
|
1390
|
-
|
|
1391
|
-
|
|
1348
|
+
+ **hex**
|
|
1349
|
+
+ The hexadecimal string representation of the Merkle Path.
|
|
1392
1350
|
|
|
1393
1351
|
#### Method toBinary
|
|
1394
1352
|
|
|
@@ -1431,7 +1389,6 @@ Verifies if the given transaction ID is part of the Merkle tree at the specified
|
|
|
1431
1389
|
```ts
|
|
1432
1390
|
async verify(txid: string, chainTracker: ChainTracker): Promise<boolean>
|
|
1433
1391
|
```
|
|
1434
|
-
|
|
1435
1392
|
See also: [ChainTracker](./transaction.md#interface-chaintracker)
|
|
1436
1393
|
|
|
1437
1394
|
Returns
|
|
@@ -1440,15 +1397,14 @@ Returns
|
|
|
1440
1397
|
|
|
1441
1398
|
Argument Details
|
|
1442
1399
|
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1400
|
+
+ **txid**
|
|
1401
|
+
+ The transaction ID to verify.
|
|
1402
|
+
+ **chainTracker**
|
|
1403
|
+
+ The ChainTracker instance used to verify the Merkle root.
|
|
1447
1404
|
|
|
1448
1405
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
1449
1406
|
|
|
1450
1407
|
---
|
|
1451
|
-
|
|
1452
1408
|
### Class: NodejsHttpClient
|
|
1453
1409
|
|
|
1454
1410
|
Adapter for Node Https module to be used as HttpClient
|
|
@@ -1465,7 +1421,6 @@ See also: [HttpClient](./transaction.md#interface-httpclient), [HttpClientReques
|
|
|
1465
1421
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
1466
1422
|
|
|
1467
1423
|
---
|
|
1468
|
-
|
|
1469
1424
|
### Class: SatoshisPerKilobyte
|
|
1470
1425
|
|
|
1471
1426
|
Represents the "satoshis per kilobyte" transaction fee model.
|
|
@@ -1490,8 +1445,8 @@ constructor(value: number)
|
|
|
1490
1445
|
|
|
1491
1446
|
Argument Details
|
|
1492
1447
|
|
|
1493
|
-
|
|
1494
|
-
|
|
1448
|
+
+ **value**
|
|
1449
|
+
+ The number of satoshis per kilobyte to charge as a fee.
|
|
1495
1450
|
|
|
1496
1451
|
#### Method computeFee
|
|
1497
1452
|
|
|
@@ -1500,7 +1455,6 @@ Computes the fee for a given transaction.
|
|
|
1500
1455
|
```ts
|
|
1501
1456
|
async computeFee(tx: Transaction): Promise<number>
|
|
1502
1457
|
```
|
|
1503
|
-
|
|
1504
1458
|
See also: [Transaction](./transaction.md#class-transaction)
|
|
1505
1459
|
|
|
1506
1460
|
Returns
|
|
@@ -1509,13 +1463,12 @@ The fee in satoshis for the transaction, as a BigNumber.
|
|
|
1509
1463
|
|
|
1510
1464
|
Argument Details
|
|
1511
1465
|
|
|
1512
|
-
|
|
1513
|
-
|
|
1466
|
+
+ **tx**
|
|
1467
|
+
+ The transaction for which a fee is to be computed.
|
|
1514
1468
|
|
|
1515
1469
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
1516
1470
|
|
|
1517
1471
|
---
|
|
1518
|
-
|
|
1519
1472
|
### Class: Transaction
|
|
1520
1473
|
|
|
1521
1474
|
Represents a complete Bitcoin transaction. This class encapsulates all the details
|
|
@@ -1596,13 +1549,12 @@ Adds a new input to the transaction.
|
|
|
1596
1549
|
```ts
|
|
1597
1550
|
addInput(input: TransactionInput): void
|
|
1598
1551
|
```
|
|
1599
|
-
|
|
1600
1552
|
See also: [TransactionInput](./transaction.md#interface-transactioninput)
|
|
1601
1553
|
|
|
1602
1554
|
Argument Details
|
|
1603
1555
|
|
|
1604
|
-
|
|
1605
|
-
|
|
1556
|
+
+ **input**
|
|
1557
|
+
+ The TransactionInput object to add to the transaction.
|
|
1606
1558
|
|
|
1607
1559
|
Throws
|
|
1608
1560
|
|
|
@@ -1615,13 +1567,12 @@ Adds a new output to the transaction.
|
|
|
1615
1567
|
```ts
|
|
1616
1568
|
addOutput(output: TransactionOutput): void
|
|
1617
1569
|
```
|
|
1618
|
-
|
|
1619
1570
|
See also: [TransactionOutput](./transaction.md#interface-transactionoutput)
|
|
1620
1571
|
|
|
1621
1572
|
Argument Details
|
|
1622
1573
|
|
|
1623
|
-
|
|
1624
|
-
|
|
1574
|
+
+ **output**
|
|
1575
|
+
+ The TransactionOutput object to add to the transaction.
|
|
1625
1576
|
|
|
1626
1577
|
#### Method addP2PKHOutput
|
|
1627
1578
|
|
|
@@ -1633,10 +1584,10 @@ addP2PKHOutput(address: number[] | string, satoshis?: number): void
|
|
|
1633
1584
|
|
|
1634
1585
|
Argument Details
|
|
1635
1586
|
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1587
|
+
+ **address**
|
|
1588
|
+
+ The P2PKH address of the output.
|
|
1589
|
+
+ **satoshis**
|
|
1590
|
+
+ The number of satoshis to send to the address - if not provided, the output is considered a change output.
|
|
1640
1591
|
|
|
1641
1592
|
#### Method broadcast
|
|
1642
1593
|
|
|
@@ -1645,7 +1596,6 @@ Broadcasts a transaction.
|
|
|
1645
1596
|
```ts
|
|
1646
1597
|
async broadcast(broadcaster: Broadcaster = defaultBroadcaster()): Promise<BroadcastResponse | BroadcastFailure>
|
|
1647
1598
|
```
|
|
1648
|
-
|
|
1649
1599
|
See also: [BroadcastFailure](./transaction.md#interface-broadcastfailure), [BroadcastResponse](./transaction.md#interface-broadcastresponse), [Broadcaster](./transaction.md#interface-broadcaster), [defaultBroadcaster](./transaction.md#function-defaultbroadcaster)
|
|
1650
1600
|
|
|
1651
1601
|
Returns
|
|
@@ -1654,8 +1604,8 @@ A BroadcastResponse or BroadcastFailure from the Broadcaster
|
|
|
1654
1604
|
|
|
1655
1605
|
Argument Details
|
|
1656
1606
|
|
|
1657
|
-
|
|
1658
|
-
|
|
1607
|
+
+ **broadcaster**
|
|
1608
|
+
+ The Broadcaster instance wwhere the transaction will be sent
|
|
1659
1609
|
|
|
1660
1610
|
#### Method fee
|
|
1661
1611
|
|
|
@@ -1666,15 +1616,14 @@ If fee is a number, the transaction uses that value as fee.
|
|
|
1666
1616
|
```ts
|
|
1667
1617
|
async fee(modelOrFee: FeeModel | number = new SatoshisPerKilobyte(1), changeDistribution: "equal" | "random" = "equal"): Promise<void>
|
|
1668
1618
|
```
|
|
1669
|
-
|
|
1670
1619
|
See also: [FeeModel](./transaction.md#interface-feemodel), [SatoshisPerKilobyte](./transaction.md#class-satoshisperkilobyte)
|
|
1671
1620
|
|
|
1672
1621
|
Argument Details
|
|
1673
1622
|
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1623
|
+
+ **modelOrFee**
|
|
1624
|
+
+ The initialized fee model to use or fixed fee for the transaction
|
|
1625
|
+
+ **changeDistribution**
|
|
1626
|
+
+ Specifies how the change should be distributed
|
|
1678
1627
|
amongst the change outputs
|
|
1679
1628
|
|
|
1680
1629
|
#### Method fromAtomicBEEF
|
|
@@ -1685,7 +1634,6 @@ Extracts the subject transaction and supporting merkle path and source transacti
|
|
|
1685
1634
|
```ts
|
|
1686
1635
|
static fromAtomicBEEF(beef: number[]): Transaction
|
|
1687
1636
|
```
|
|
1688
|
-
|
|
1689
1637
|
See also: [Transaction](./transaction.md#class-transaction)
|
|
1690
1638
|
|
|
1691
1639
|
Returns
|
|
@@ -1694,8 +1642,8 @@ The subject transaction, linked to its associated inputs populated with merkle p
|
|
|
1694
1642
|
|
|
1695
1643
|
Argument Details
|
|
1696
1644
|
|
|
1697
|
-
|
|
1698
|
-
|
|
1645
|
+
+ **beef**
|
|
1646
|
+
+ A binary representation of an Atomic BEEF structure.
|
|
1699
1647
|
|
|
1700
1648
|
#### Method fromBEEF
|
|
1701
1649
|
|
|
@@ -1707,7 +1655,6 @@ If no TXID is provided, the last transaction in the BEEF data is returned, or th
|
|
|
1707
1655
|
```ts
|
|
1708
1656
|
static fromBEEF(beef: number[], txid?: string): Transaction
|
|
1709
1657
|
```
|
|
1710
|
-
|
|
1711
1658
|
See also: [Transaction](./transaction.md#class-transaction)
|
|
1712
1659
|
|
|
1713
1660
|
Returns
|
|
@@ -1716,10 +1663,10 @@ An anchored transaction, linked to its associated inputs populated with merkle p
|
|
|
1716
1663
|
|
|
1717
1664
|
Argument Details
|
|
1718
1665
|
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1666
|
+
+ **beef**
|
|
1667
|
+
+ A binary representation of transactions in BEEF format.
|
|
1668
|
+
+ **txid**
|
|
1669
|
+
+ Optional TXID of the transaction to retrieve from the BEEF data.
|
|
1723
1670
|
|
|
1724
1671
|
#### Method fromBinary
|
|
1725
1672
|
|
|
@@ -1728,7 +1675,6 @@ Creates a Transaction instance from a binary array.
|
|
|
1728
1675
|
```ts
|
|
1729
1676
|
static fromBinary(bin: number[]): Transaction
|
|
1730
1677
|
```
|
|
1731
|
-
|
|
1732
1678
|
See also: [Transaction](./transaction.md#class-transaction)
|
|
1733
1679
|
|
|
1734
1680
|
Returns
|
|
@@ -1737,8 +1683,8 @@ Returns
|
|
|
1737
1683
|
|
|
1738
1684
|
Argument Details
|
|
1739
1685
|
|
|
1740
|
-
|
|
1741
|
-
|
|
1686
|
+
+ **bin**
|
|
1687
|
+
+ The binary array representation of the transaction.
|
|
1742
1688
|
|
|
1743
1689
|
#### Method fromEF
|
|
1744
1690
|
|
|
@@ -1747,7 +1693,6 @@ Creates a new transaction, linked to its inputs and their associated merkle path
|
|
|
1747
1693
|
```ts
|
|
1748
1694
|
static fromEF(ef: number[]): Transaction
|
|
1749
1695
|
```
|
|
1750
|
-
|
|
1751
1696
|
See also: [Transaction](./transaction.md#class-transaction)
|
|
1752
1697
|
|
|
1753
1698
|
Returns
|
|
@@ -1756,8 +1701,8 @@ An extended transaction, linked to its associated inputs by locking script and s
|
|
|
1756
1701
|
|
|
1757
1702
|
Argument Details
|
|
1758
1703
|
|
|
1759
|
-
|
|
1760
|
-
|
|
1704
|
+
+ **ef**
|
|
1705
|
+
+ A binary representation of a transaction in EF format.
|
|
1761
1706
|
|
|
1762
1707
|
#### Method fromHex
|
|
1763
1708
|
|
|
@@ -1766,7 +1711,6 @@ Creates a Transaction instance from a hexadecimal string.
|
|
|
1766
1711
|
```ts
|
|
1767
1712
|
static fromHex(hex: string): Transaction
|
|
1768
1713
|
```
|
|
1769
|
-
|
|
1770
1714
|
See also: [Transaction](./transaction.md#class-transaction)
|
|
1771
1715
|
|
|
1772
1716
|
Returns
|
|
@@ -1775,8 +1719,8 @@ Returns
|
|
|
1775
1719
|
|
|
1776
1720
|
Argument Details
|
|
1777
1721
|
|
|
1778
|
-
|
|
1779
|
-
|
|
1722
|
+
+ **hex**
|
|
1723
|
+
+ The hexadecimal string representation of the transaction.
|
|
1780
1724
|
|
|
1781
1725
|
#### Method fromHexBEEF
|
|
1782
1726
|
|
|
@@ -1788,7 +1732,6 @@ If no TXID is provided, the last transaction in the BEEF data is returned.
|
|
|
1788
1732
|
```ts
|
|
1789
1733
|
static fromHexBEEF(hex: string, txid?: string): Transaction
|
|
1790
1734
|
```
|
|
1791
|
-
|
|
1792
1735
|
See also: [Transaction](./transaction.md#class-transaction)
|
|
1793
1736
|
|
|
1794
1737
|
Returns
|
|
@@ -1797,10 +1740,10 @@ Returns
|
|
|
1797
1740
|
|
|
1798
1741
|
Argument Details
|
|
1799
1742
|
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1743
|
+
+ **hex**
|
|
1744
|
+
+ The hexadecimal string representation of the transaction BEEF.
|
|
1745
|
+
+ **txid**
|
|
1746
|
+
+ Optional TXID of the transaction to retrieve from the BEEF data.
|
|
1804
1747
|
|
|
1805
1748
|
#### Method fromHexEF
|
|
1806
1749
|
|
|
@@ -1809,7 +1752,6 @@ Creates a Transaction instance from a hexadecimal string encoded EF.
|
|
|
1809
1752
|
```ts
|
|
1810
1753
|
static fromHexEF(hex: string): Transaction
|
|
1811
1754
|
```
|
|
1812
|
-
|
|
1813
1755
|
See also: [Transaction](./transaction.md#class-transaction)
|
|
1814
1756
|
|
|
1815
1757
|
Returns
|
|
@@ -1818,8 +1760,8 @@ Returns
|
|
|
1818
1760
|
|
|
1819
1761
|
Argument Details
|
|
1820
1762
|
|
|
1821
|
-
|
|
1822
|
-
|
|
1763
|
+
+ **hex**
|
|
1764
|
+
+ The hexadecimal string representation of the transaction EF.
|
|
1823
1765
|
|
|
1824
1766
|
#### Method getFee
|
|
1825
1767
|
|
|
@@ -1847,8 +1789,8 @@ Returns
|
|
|
1847
1789
|
|
|
1848
1790
|
Argument Details
|
|
1849
1791
|
|
|
1850
|
-
|
|
1851
|
-
|
|
1792
|
+
+ **enc**
|
|
1793
|
+
+ The encoding to use for the hash. If 'hex', returns a hexadecimal string; otherwise returns a binary array.
|
|
1852
1794
|
|
|
1853
1795
|
#### Method id
|
|
1854
1796
|
|
|
@@ -1876,8 +1818,8 @@ Returns
|
|
|
1876
1818
|
|
|
1877
1819
|
Argument Details
|
|
1878
1820
|
|
|
1879
|
-
|
|
1880
|
-
|
|
1821
|
+
+ **enc**
|
|
1822
|
+
+ The encoding to use for the ID. If 'hex', returns a hexadecimal string.
|
|
1881
1823
|
|
|
1882
1824
|
#### Method id
|
|
1883
1825
|
|
|
@@ -1893,8 +1835,8 @@ Returns
|
|
|
1893
1835
|
|
|
1894
1836
|
Argument Details
|
|
1895
1837
|
|
|
1896
|
-
|
|
1897
|
-
|
|
1838
|
+
+ **enc**
|
|
1839
|
+
+ The encoding to use for the ID. If 'hex', returns a hexadecimal string; otherwise returns a binary array.
|
|
1898
1840
|
|
|
1899
1841
|
#### Method parseScriptOffsets
|
|
1900
1842
|
|
|
@@ -1929,8 +1871,8 @@ outputs: { vout: number, offset: number, length: number }[]
|
|
|
1929
1871
|
|
|
1930
1872
|
Argument Details
|
|
1931
1873
|
|
|
1932
|
-
|
|
1933
|
-
|
|
1874
|
+
+ **bin**
|
|
1875
|
+
+ binary transaction data
|
|
1934
1876
|
|
|
1935
1877
|
#### Method sign
|
|
1936
1878
|
|
|
@@ -1957,8 +1899,8 @@ Returns
|
|
|
1957
1899
|
|
|
1958
1900
|
Argument Details
|
|
1959
1901
|
|
|
1960
|
-
|
|
1961
|
-
|
|
1902
|
+
+ **allowPartial**
|
|
1903
|
+
+ If true, error will not be thrown if there are any missing sourceTransactions.
|
|
1962
1904
|
|
|
1963
1905
|
Throws
|
|
1964
1906
|
|
|
@@ -1978,8 +1920,8 @@ The serialized BEEF structure
|
|
|
1978
1920
|
|
|
1979
1921
|
Argument Details
|
|
1980
1922
|
|
|
1981
|
-
|
|
1982
|
-
|
|
1923
|
+
+ **allowPartial**
|
|
1924
|
+
+ If true, error will not be thrown if there are any missing sourceTransactions.
|
|
1983
1925
|
|
|
1984
1926
|
Throws
|
|
1985
1927
|
|
|
@@ -2067,8 +2009,8 @@ updateMetadata(metadata: Record<string, any>): void
|
|
|
2067
2009
|
|
|
2068
2010
|
Argument Details
|
|
2069
2011
|
|
|
2070
|
-
|
|
2071
|
-
|
|
2012
|
+
+ **metadata**
|
|
2013
|
+
+ The metadata object to merge into the existing metadata.
|
|
2072
2014
|
|
|
2073
2015
|
#### Method verify
|
|
2074
2016
|
|
|
@@ -2077,7 +2019,6 @@ Verifies the legitimacy of the Bitcoin transaction according to the rules of SPV
|
|
|
2077
2019
|
```ts
|
|
2078
2020
|
async verify(chainTracker: ChainTracker | "scripts only" = defaultChainTracker(), feeModel?: FeeModel, memoryLimit?: number): Promise<boolean>
|
|
2079
2021
|
```
|
|
2080
|
-
|
|
2081
2022
|
See also: [ChainTracker](./transaction.md#interface-chaintracker), [FeeModel](./transaction.md#interface-feemodel), [defaultChainTracker](./transaction.md#function-defaultchaintracker)
|
|
2082
2023
|
|
|
2083
2024
|
Returns
|
|
@@ -2086,12 +2027,12 @@ Whether the transaction is valid according to the rules of SPV.
|
|
|
2086
2027
|
|
|
2087
2028
|
Argument Details
|
|
2088
2029
|
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2030
|
+
+ **chainTracker**
|
|
2031
|
+
+ An instance of ChainTracker, a Bitcoin block header tracker. If the value is set to 'scripts only', headers will not be verified. If not provided then the default chain tracker will be used.
|
|
2032
|
+
+ **feeModel**
|
|
2033
|
+
+ An instance of FeeModel, a fee model to use for fee calculation. If not provided then the default fee model will be used.
|
|
2034
|
+
+ **memoryLimit**
|
|
2035
|
+
+ The maximum memory in bytes usage allowed for script evaluation. If not provided then the default memory limit will be used.
|
|
2095
2036
|
|
|
2096
2037
|
Example
|
|
2097
2038
|
|
|
@@ -2102,7 +2043,6 @@ tx.verify(new WhatsOnChain(), new SatoshisPerKilobyte(1))
|
|
|
2102
2043
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2103
2044
|
|
|
2104
2045
|
---
|
|
2105
|
-
|
|
2106
2046
|
### Class: WhatsOnChain
|
|
2107
2047
|
|
|
2108
2048
|
Represents a chain tracker based on What's On Chain .
|
|
@@ -2129,20 +2069,18 @@ Constructs an instance of the WhatsOnChain ChainTracker.
|
|
|
2129
2069
|
```ts
|
|
2130
2070
|
constructor(network: "main" | "test" | "stn" = "main", config: WhatsOnChainConfig = {})
|
|
2131
2071
|
```
|
|
2132
|
-
|
|
2133
2072
|
See also: [WhatsOnChainConfig](./transaction.md#interface-whatsonchainconfig)
|
|
2134
2073
|
|
|
2135
2074
|
Argument Details
|
|
2136
2075
|
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2076
|
+
+ **network**
|
|
2077
|
+
+ The BSV network to use when calling the WhatsOnChain API.
|
|
2078
|
+
+ **config**
|
|
2079
|
+
+ Configuration options for the WhatsOnChain ChainTracker.
|
|
2141
2080
|
|
|
2142
2081
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2143
2082
|
|
|
2144
2083
|
---
|
|
2145
|
-
|
|
2146
2084
|
## Functions
|
|
2147
2085
|
|
|
2148
2086
|
| |
|
|
@@ -2168,7 +2106,6 @@ See also: [ArcConfig](./transaction.md#interface-arcconfig), [Broadcaster](./tra
|
|
|
2168
2106
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2169
2107
|
|
|
2170
2108
|
---
|
|
2171
|
-
|
|
2172
2109
|
### Function: defaultChainTracker
|
|
2173
2110
|
|
|
2174
2111
|
```ts
|
|
@@ -2180,7 +2117,6 @@ See also: [ChainTracker](./transaction.md#interface-chaintracker)
|
|
|
2180
2117
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2181
2118
|
|
|
2182
2119
|
---
|
|
2183
|
-
|
|
2184
2120
|
### Function: defaultHttpClient
|
|
2185
2121
|
|
|
2186
2122
|
Returns a default HttpClient implementation based on the environment that it is run on.
|
|
@@ -2196,7 +2132,6 @@ See also: [HttpClient](./transaction.md#interface-httpclient)
|
|
|
2196
2132
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2197
2133
|
|
|
2198
2134
|
---
|
|
2199
|
-
|
|
2200
2135
|
### Function: isBroadcastFailure
|
|
2201
2136
|
|
|
2202
2137
|
Convenience type guard for response from `Broadcaster.broadcast`
|
|
@@ -2210,7 +2145,6 @@ See also: [BroadcastFailure](./transaction.md#interface-broadcastfailure), [Broa
|
|
|
2210
2145
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2211
2146
|
|
|
2212
2147
|
---
|
|
2213
|
-
|
|
2214
2148
|
### Function: isBroadcastResponse
|
|
2215
2149
|
|
|
2216
2150
|
Convenience type guard for response from `Broadcaster.broadcast`
|
|
@@ -2224,7 +2158,6 @@ See also: [BroadcastFailure](./transaction.md#interface-broadcastfailure), [Broa
|
|
|
2224
2158
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2225
2159
|
|
|
2226
2160
|
---
|
|
2227
|
-
|
|
2228
2161
|
## Types
|
|
2229
2162
|
|
|
2230
2163
|
| |
|
|
@@ -2251,7 +2184,6 @@ See also: [FetchOptions](./transaction.md#interface-fetchoptions)
|
|
|
2251
2184
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2252
2185
|
|
|
2253
2186
|
---
|
|
2254
|
-
|
|
2255
2187
|
### Type: HttpClientResponse
|
|
2256
2188
|
|
|
2257
2189
|
An interface for the response returned by the request method.
|
|
@@ -2273,7 +2205,6 @@ export type HttpClientResponse<T = any> = {
|
|
|
2273
2205
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2274
2206
|
|
|
2275
2207
|
---
|
|
2276
|
-
|
|
2277
2208
|
## Enums
|
|
2278
2209
|
|
|
2279
2210
|
### Enum: TX_DATA_FORMAT
|
|
@@ -2289,7 +2220,6 @@ export enum TX_DATA_FORMAT {
|
|
|
2289
2220
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2290
2221
|
|
|
2291
2222
|
---
|
|
2292
|
-
|
|
2293
2223
|
## Variables
|
|
2294
2224
|
|
|
2295
2225
|
| |
|
|
@@ -2311,7 +2241,6 @@ ATOMIC_BEEF = 16843009
|
|
|
2311
2241
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2312
2242
|
|
|
2313
2243
|
---
|
|
2314
|
-
|
|
2315
2244
|
### Variable: BEEF_V1
|
|
2316
2245
|
|
|
2317
2246
|
```ts
|
|
@@ -2321,7 +2250,6 @@ BEEF_V1 = 4022206465
|
|
|
2321
2250
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2322
2251
|
|
|
2323
2252
|
---
|
|
2324
|
-
|
|
2325
2253
|
### Variable: BEEF_V2
|
|
2326
2254
|
|
|
2327
2255
|
```ts
|