@bsv/sdk 1.4.23 → 1.4.24
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/src/transaction/broadcasters/Teranode.js +64 -0
- package/dist/cjs/src/transaction/broadcasters/Teranode.js.map +1 -0
- package/dist/cjs/src/transaction/broadcasters/index.js +3 -1
- package/dist/cjs/src/transaction/broadcasters/index.js.map +1 -1
- package/dist/cjs/src/transaction/http/BinaryFetchClient.js +94 -0
- package/dist/cjs/src/transaction/http/BinaryFetchClient.js.map +1 -0
- package/dist/cjs/src/transaction/http/NodejsHttpClient.js.map +1 -1
- package/dist/cjs/src/transaction/http/index.js +3 -1
- package/dist/cjs/src/transaction/http/index.js.map +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/src/transaction/broadcasters/Teranode.js +62 -0
- package/dist/esm/src/transaction/broadcasters/Teranode.js.map +1 -0
- package/dist/esm/src/transaction/broadcasters/index.js +1 -0
- package/dist/esm/src/transaction/broadcasters/index.js.map +1 -1
- package/dist/esm/src/transaction/http/BinaryFetchClient.js +90 -0
- package/dist/esm/src/transaction/http/BinaryFetchClient.js.map +1 -0
- package/dist/esm/src/transaction/http/NodejsHttpClient.js.map +1 -1
- package/dist/esm/src/transaction/http/index.js +1 -0
- package/dist/esm/src/transaction/http/index.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/types/src/transaction/broadcasters/Teranode.d.ts +25 -0
- package/dist/types/src/transaction/broadcasters/Teranode.d.ts.map +1 -0
- package/dist/types/src/transaction/broadcasters/index.d.ts +1 -0
- package/dist/types/src/transaction/broadcasters/index.d.ts.map +1 -1
- package/dist/types/src/transaction/http/BinaryFetchClient.d.ts +50 -0
- package/dist/types/src/transaction/http/BinaryFetchClient.d.ts.map +1 -0
- package/dist/types/src/transaction/http/index.d.ts +1 -0
- package/dist/types/src/transaction/http/index.d.ts.map +1 -1
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/dist/umd/bundle.js +1 -1
- package/docs/auth.md +101 -47
- package/docs/compat.md +48 -24
- package/docs/identity.md +14 -8
- package/docs/kvstore.md +9 -3
- package/docs/messages.md +4 -4
- package/docs/overlay-tools.md +69 -21
- package/docs/primitives.md +379 -235
- package/docs/registry.md +20 -14
- package/docs/script.md +80 -32
- package/docs/storage.md +17 -11
- package/docs/totp.md +11 -5
- package/docs/transaction.md +144 -66
- package/docs/wallet.md +169 -133
- package/package.json +1 -1
- package/src/transaction/broadcasters/Teranode.ts +77 -0
- package/src/transaction/broadcasters/index.ts +1 -0
- package/src/transaction/http/BinaryFetchClient.ts +141 -0
- package/src/transaction/http/NodejsHttpClient.ts +1 -1
- package/src/transaction/http/index.ts +1 -0
package/docs/transaction.md
CHANGED
|
@@ -34,7 +34,11 @@ export interface ArcConfig {
|
|
|
34
34
|
}
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
See also: [HttpClient](
|
|
37
|
+
See also: [HttpClient](#interface-httpclient)
|
|
38
|
+
|
|
39
|
+
<details>
|
|
40
|
+
|
|
41
|
+
<summary>Interface ArcConfig Details</summary>
|
|
38
42
|
|
|
39
43
|
#### Property apiKey
|
|
40
44
|
|
|
@@ -83,7 +87,9 @@ The HTTP client used to make requests to the ARC API.
|
|
|
83
87
|
```ts
|
|
84
88
|
httpClient?: HttpClient
|
|
85
89
|
```
|
|
86
|
-
See also: [HttpClient](
|
|
90
|
+
See also: [HttpClient](#interface-httpclient)
|
|
91
|
+
|
|
92
|
+
</details>
|
|
87
93
|
|
|
88
94
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
89
95
|
|
|
@@ -133,7 +139,7 @@ export interface Broadcaster {
|
|
|
133
139
|
}
|
|
134
140
|
```
|
|
135
141
|
|
|
136
|
-
See also: [BroadcastFailure](
|
|
142
|
+
See also: [BroadcastFailure](#interface-broadcastfailure), [BroadcastResponse](#interface-broadcastresponse), [Transaction](#class-transaction)
|
|
137
143
|
|
|
138
144
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
139
145
|
|
|
@@ -181,7 +187,7 @@ export default interface FeeModel {
|
|
|
181
187
|
}
|
|
182
188
|
```
|
|
183
189
|
|
|
184
|
-
See also: [Transaction](
|
|
190
|
+
See also: [Transaction](#class-transaction)
|
|
185
191
|
|
|
186
192
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
187
193
|
|
|
@@ -199,6 +205,10 @@ export interface FetchOptions {
|
|
|
199
205
|
}
|
|
200
206
|
```
|
|
201
207
|
|
|
208
|
+
<details>
|
|
209
|
+
|
|
210
|
+
<summary>Interface FetchOptions Details</summary>
|
|
211
|
+
|
|
202
212
|
#### Property body
|
|
203
213
|
|
|
204
214
|
An object or null to set request's body.
|
|
@@ -223,6 +233,8 @@ A string to set request's method.
|
|
|
223
233
|
method?: string
|
|
224
234
|
```
|
|
225
235
|
|
|
236
|
+
</details>
|
|
237
|
+
|
|
226
238
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
227
239
|
|
|
228
240
|
---
|
|
@@ -236,7 +248,11 @@ export interface HttpClient {
|
|
|
236
248
|
}
|
|
237
249
|
```
|
|
238
250
|
|
|
239
|
-
See also: [HttpClientRequestOptions](
|
|
251
|
+
See also: [HttpClientRequestOptions](#interface-httpclientrequestoptions), [HttpClientResponse](#type-httpclientresponse)
|
|
252
|
+
|
|
253
|
+
<details>
|
|
254
|
+
|
|
255
|
+
<summary>Interface HttpClient Details</summary>
|
|
240
256
|
|
|
241
257
|
#### Property request
|
|
242
258
|
|
|
@@ -245,7 +261,9 @@ Makes a request to the server.
|
|
|
245
261
|
```ts
|
|
246
262
|
request: <T = any, D = any>(url: string, options: HttpClientRequestOptions<D>) => Promise<HttpClientResponse<T>>
|
|
247
263
|
```
|
|
248
|
-
See also: [HttpClientRequestOptions](
|
|
264
|
+
See also: [HttpClientRequestOptions](#interface-httpclientrequestoptions), [HttpClientResponse](#type-httpclientresponse)
|
|
265
|
+
|
|
266
|
+
</details>
|
|
249
267
|
|
|
250
268
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
251
269
|
|
|
@@ -262,6 +280,10 @@ export interface HttpClientRequestOptions<Data = any> {
|
|
|
262
280
|
}
|
|
263
281
|
```
|
|
264
282
|
|
|
283
|
+
<details>
|
|
284
|
+
|
|
285
|
+
<summary>Interface HttpClientRequestOptions Details</summary>
|
|
286
|
+
|
|
265
287
|
#### Property data
|
|
266
288
|
|
|
267
289
|
An object or null to set request's body.
|
|
@@ -286,6 +308,8 @@ A string to set request's method.
|
|
|
286
308
|
method?: string
|
|
287
309
|
```
|
|
288
310
|
|
|
311
|
+
</details>
|
|
312
|
+
|
|
289
313
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
290
314
|
|
|
291
315
|
---
|
|
@@ -299,7 +323,7 @@ export interface HttpsNodejs {
|
|
|
299
323
|
}
|
|
300
324
|
```
|
|
301
325
|
|
|
302
|
-
See also: [HttpClientRequestOptions](
|
|
326
|
+
See also: [HttpClientRequestOptions](#interface-httpclientrequestoptions), [NodejsHttpClientRequest](#interface-nodejshttpclientrequest)
|
|
303
327
|
|
|
304
328
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
305
329
|
|
|
@@ -370,7 +394,7 @@ export default interface TransactionInput {
|
|
|
370
394
|
}
|
|
371
395
|
```
|
|
372
396
|
|
|
373
|
-
See also: [Transaction](
|
|
397
|
+
See also: [Transaction](#class-transaction), [UnlockingScript](#class-unlockingscript), [sign](#variable-sign)
|
|
374
398
|
|
|
375
399
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
376
400
|
|
|
@@ -400,7 +424,7 @@ export default interface TransactionOutput {
|
|
|
400
424
|
}
|
|
401
425
|
```
|
|
402
426
|
|
|
403
|
-
See also: [LockingScript](
|
|
427
|
+
See also: [LockingScript](#class-lockingscript)
|
|
404
428
|
|
|
405
429
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
406
430
|
|
|
@@ -416,7 +440,11 @@ export interface WhatsOnChainConfig {
|
|
|
416
440
|
}
|
|
417
441
|
```
|
|
418
442
|
|
|
419
|
-
See also: [HttpClient](
|
|
443
|
+
See also: [HttpClient](#interface-httpclient)
|
|
444
|
+
|
|
445
|
+
<details>
|
|
446
|
+
|
|
447
|
+
<summary>Interface WhatsOnChainConfig Details</summary>
|
|
420
448
|
|
|
421
449
|
#### Property apiKey
|
|
422
450
|
|
|
@@ -433,7 +461,9 @@ The HTTP client used to make requests to the API.
|
|
|
433
461
|
```ts
|
|
434
462
|
httpClient?: HttpClient
|
|
435
463
|
```
|
|
436
|
-
See also: [HttpClient](
|
|
464
|
+
See also: [HttpClient](#interface-httpclient)
|
|
465
|
+
|
|
466
|
+
</details>
|
|
437
467
|
|
|
438
468
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
439
469
|
|
|
@@ -477,7 +507,11 @@ export default class ARC implements Broadcaster {
|
|
|
477
507
|
}
|
|
478
508
|
```
|
|
479
509
|
|
|
480
|
-
See also: [ArcConfig](
|
|
510
|
+
See also: [ArcConfig](#interface-arcconfig), [BroadcastFailure](#interface-broadcastfailure), [BroadcastResponse](#interface-broadcastresponse), [Broadcaster](#interface-broadcaster), [Transaction](#class-transaction)
|
|
511
|
+
|
|
512
|
+
<details>
|
|
513
|
+
|
|
514
|
+
<summary>Class ARC Details</summary>
|
|
481
515
|
|
|
482
516
|
#### Constructor
|
|
483
517
|
|
|
@@ -486,7 +520,7 @@ Constructs an instance of the ARC broadcaster.
|
|
|
486
520
|
```ts
|
|
487
521
|
constructor(URL: string, config?: ArcConfig)
|
|
488
522
|
```
|
|
489
|
-
See also: [ArcConfig](
|
|
523
|
+
See also: [ArcConfig](#interface-arcconfig)
|
|
490
524
|
|
|
491
525
|
Argument Details
|
|
492
526
|
|
|
@@ -517,7 +551,7 @@ Broadcasts a transaction via ARC.
|
|
|
517
551
|
```ts
|
|
518
552
|
async broadcast(tx: Transaction): Promise<BroadcastResponse | BroadcastFailure>
|
|
519
553
|
```
|
|
520
|
-
See also: [BroadcastFailure](
|
|
554
|
+
See also: [BroadcastFailure](#interface-broadcastfailure), [BroadcastResponse](#interface-broadcastresponse), [Transaction](#class-transaction)
|
|
521
555
|
|
|
522
556
|
Returns
|
|
523
557
|
|
|
@@ -536,7 +570,7 @@ Handles mixed responses where some transactions succeed and others fail.
|
|
|
536
570
|
```ts
|
|
537
571
|
async broadcastMany(txs: Transaction[]): Promise<object[]>
|
|
538
572
|
```
|
|
539
|
-
See also: [Transaction](
|
|
573
|
+
See also: [Transaction](#class-transaction)
|
|
540
574
|
|
|
541
575
|
Returns
|
|
542
576
|
|
|
@@ -547,6 +581,8 @@ Argument Details
|
|
|
547
581
|
+ **txs**
|
|
548
582
|
+ Array of transactions to be broadcasted.
|
|
549
583
|
|
|
584
|
+
</details>
|
|
585
|
+
|
|
550
586
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
551
587
|
|
|
552
588
|
---
|
|
@@ -595,7 +631,11 @@ export class Beef {
|
|
|
595
631
|
}
|
|
596
632
|
```
|
|
597
633
|
|
|
598
|
-
See also: [BEEF_V2](
|
|
634
|
+
See also: [BEEF_V2](#variable-beef_v2), [BeefTx](#class-beeftx), [ChainTracker](#interface-chaintracker), [MerklePath](#class-merklepath), [Reader](#class-reader), [Transaction](#class-transaction), [Writer](#class-writer), [toHex](#variable-tohex), [verify](#variable-verify)
|
|
635
|
+
|
|
636
|
+
<details>
|
|
637
|
+
|
|
638
|
+
<summary>Class Beef Details</summary>
|
|
599
639
|
|
|
600
640
|
#### Method addComputedLeaves
|
|
601
641
|
|
|
@@ -611,7 +651,7 @@ addComputedLeaves(): void
|
|
|
611
651
|
```ts
|
|
612
652
|
clone(): Beef
|
|
613
653
|
```
|
|
614
|
-
See also: [Beef](
|
|
654
|
+
See also: [Beef](#class-beef)
|
|
615
655
|
|
|
616
656
|
Returns
|
|
617
657
|
|
|
@@ -626,7 +666,7 @@ To succeed, the Beef must contain all the required transaction and merkle path d
|
|
|
626
666
|
```ts
|
|
627
667
|
findAtomicTransaction(txid: string): Transaction | undefined
|
|
628
668
|
```
|
|
629
|
-
See also: [Transaction](
|
|
669
|
+
See also: [Transaction](#class-transaction)
|
|
630
670
|
|
|
631
671
|
Returns
|
|
632
672
|
|
|
@@ -642,7 +682,7 @@ Argument Details
|
|
|
642
682
|
```ts
|
|
643
683
|
findBump(txid: string): MerklePath | undefined
|
|
644
684
|
```
|
|
645
|
-
See also: [MerklePath](
|
|
685
|
+
See also: [MerklePath](#class-merklepath)
|
|
646
686
|
|
|
647
687
|
Returns
|
|
648
688
|
|
|
@@ -658,7 +698,7 @@ The result is suitable for signing.
|
|
|
658
698
|
```ts
|
|
659
699
|
findTransactionForSigning(txid: string): Transaction | undefined
|
|
660
700
|
```
|
|
661
|
-
See also: [Transaction](
|
|
701
|
+
See also: [Transaction](#class-transaction)
|
|
662
702
|
|
|
663
703
|
Returns
|
|
664
704
|
|
|
@@ -674,7 +714,7 @@ Argument Details
|
|
|
674
714
|
```ts
|
|
675
715
|
findTxid(txid: string): BeefTx | undefined
|
|
676
716
|
```
|
|
677
|
-
See also: [BeefTx](
|
|
717
|
+
See also: [BeefTx](#class-beeftx)
|
|
678
718
|
|
|
679
719
|
Returns
|
|
680
720
|
|
|
@@ -692,7 +732,7 @@ Constructs an instance of the Beef class based on the provided binary array
|
|
|
692
732
|
```ts
|
|
693
733
|
static fromBinary(bin: number[]): Beef
|
|
694
734
|
```
|
|
695
|
-
See also: [Beef](
|
|
735
|
+
See also: [Beef](#class-beef)
|
|
696
736
|
|
|
697
737
|
Returns
|
|
698
738
|
|
|
@@ -710,7 +750,7 @@ Constructs an instance of the Beef class based on the provided string
|
|
|
710
750
|
```ts
|
|
711
751
|
static fromString(s: string, enc: "hex" | "utf8" | "base64" = "hex"): Beef
|
|
712
752
|
```
|
|
713
|
-
See also: [Beef](
|
|
753
|
+
See also: [Beef](#class-beef)
|
|
714
754
|
|
|
715
755
|
Returns
|
|
716
756
|
|
|
@@ -765,7 +805,7 @@ original.
|
|
|
765
805
|
```ts
|
|
766
806
|
makeTxidOnly(txid: string): BeefTx | undefined
|
|
767
807
|
```
|
|
768
|
-
See also: [BeefTx](
|
|
808
|
+
See also: [BeefTx](#class-beeftx)
|
|
769
809
|
|
|
770
810
|
Returns
|
|
771
811
|
|
|
@@ -778,7 +818,7 @@ Merge a MerklePath that is assumed to be fully valid.
|
|
|
778
818
|
```ts
|
|
779
819
|
mergeBump(bump: MerklePath): number
|
|
780
820
|
```
|
|
781
|
-
See also: [MerklePath](
|
|
821
|
+
See also: [MerklePath](#class-merklepath)
|
|
782
822
|
|
|
783
823
|
Returns
|
|
784
824
|
|
|
@@ -795,7 +835,7 @@ Replaces existing transaction with same txid.
|
|
|
795
835
|
```ts
|
|
796
836
|
mergeRawTx(rawTx: number[], bumpIndex?: number): BeefTx
|
|
797
837
|
```
|
|
798
|
-
See also: [BeefTx](
|
|
838
|
+
See also: [BeefTx](#class-beeftx)
|
|
799
839
|
|
|
800
840
|
Returns
|
|
801
841
|
|
|
@@ -817,7 +857,7 @@ Attempts to match an existing bump to the new transaction.
|
|
|
817
857
|
```ts
|
|
818
858
|
mergeTransaction(tx: Transaction): BeefTx
|
|
819
859
|
```
|
|
820
|
-
See also: [BeefTx](
|
|
860
|
+
See also: [BeefTx](#class-beeftx), [Transaction](#class-transaction)
|
|
821
861
|
|
|
822
862
|
Returns
|
|
823
863
|
|
|
@@ -916,7 +956,7 @@ Serializes this data to `writer`
|
|
|
916
956
|
```ts
|
|
917
957
|
toWriter(writer: Writer): void
|
|
918
958
|
```
|
|
919
|
-
See also: [Writer](
|
|
959
|
+
See also: [Writer](#class-writer)
|
|
920
960
|
|
|
921
961
|
#### Method trimKnownTxids
|
|
922
962
|
|
|
@@ -941,7 +981,7 @@ Validity requirements:
|
|
|
941
981
|
```ts
|
|
942
982
|
async verify(chainTracker: ChainTracker, allowTxidOnly?: boolean): Promise<boolean>
|
|
943
983
|
```
|
|
944
|
-
See also: [ChainTracker](
|
|
984
|
+
See also: [ChainTracker](#interface-chaintracker)
|
|
945
985
|
|
|
946
986
|
Argument Details
|
|
947
987
|
|
|
@@ -950,6 +990,8 @@ Argument Details
|
|
|
950
990
|
+ **allowTxidOnly**
|
|
951
991
|
+ optional. If true, transaction txid is assumed valid
|
|
952
992
|
|
|
993
|
+
</details>
|
|
994
|
+
|
|
953
995
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
954
996
|
|
|
955
997
|
---
|
|
@@ -987,7 +1029,11 @@ export class BeefParty extends Beef {
|
|
|
987
1029
|
}
|
|
988
1030
|
```
|
|
989
1031
|
|
|
990
|
-
See also: [Beef](
|
|
1032
|
+
See also: [Beef](#class-beef)
|
|
1033
|
+
|
|
1034
|
+
<details>
|
|
1035
|
+
|
|
1036
|
+
<summary>Class BeefParty Details</summary>
|
|
991
1037
|
|
|
992
1038
|
#### Constructor
|
|
993
1039
|
|
|
@@ -1045,7 +1091,7 @@ Array of txids "known" to `party`.
|
|
|
1045
1091
|
```ts
|
|
1046
1092
|
getTrimmedBeefForParty(party: string): Beef
|
|
1047
1093
|
```
|
|
1048
|
-
See also: [Beef](
|
|
1094
|
+
See also: [Beef](#class-beef)
|
|
1049
1095
|
|
|
1050
1096
|
Returns
|
|
1051
1097
|
|
|
@@ -1072,7 +1118,9 @@ has raw transaction and validity proof data.
|
|
|
1072
1118
|
```ts
|
|
1073
1119
|
mergeBeefFromParty(party: string, beef: number[] | Beef): void
|
|
1074
1120
|
```
|
|
1075
|
-
See also: [Beef](
|
|
1121
|
+
See also: [Beef](#class-beef)
|
|
1122
|
+
|
|
1123
|
+
</details>
|
|
1076
1124
|
|
|
1077
1125
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
1078
1126
|
|
|
@@ -1111,14 +1159,18 @@ export default class BeefTx {
|
|
|
1111
1159
|
}
|
|
1112
1160
|
```
|
|
1113
1161
|
|
|
1114
|
-
See also: [Reader](
|
|
1162
|
+
See also: [Reader](#class-reader), [Transaction](#class-transaction), [Writer](#class-writer)
|
|
1163
|
+
|
|
1164
|
+
<details>
|
|
1165
|
+
|
|
1166
|
+
<summary>Class BeefTx Details</summary>
|
|
1115
1167
|
|
|
1116
1168
|
#### Constructor
|
|
1117
1169
|
|
|
1118
1170
|
```ts
|
|
1119
1171
|
constructor(tx: Transaction | number[] | string, bumpIndex?: number)
|
|
1120
1172
|
```
|
|
1121
|
-
See also: [Transaction](
|
|
1173
|
+
See also: [Transaction](#class-transaction)
|
|
1122
1174
|
|
|
1123
1175
|
Argument Details
|
|
1124
1176
|
|
|
@@ -1137,6 +1189,8 @@ Typically set by sorting transactions by proven dependency chains.
|
|
|
1137
1189
|
isValid?: boolean = undefined
|
|
1138
1190
|
```
|
|
1139
1191
|
|
|
1192
|
+
</details>
|
|
1193
|
+
|
|
1140
1194
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
1141
1195
|
|
|
1142
1196
|
---
|
|
@@ -1151,7 +1205,7 @@ export class FetchHttpClient implements HttpClient {
|
|
|
1151
1205
|
}
|
|
1152
1206
|
```
|
|
1153
1207
|
|
|
1154
|
-
See also: [Fetch](
|
|
1208
|
+
See also: [Fetch](#type-fetch), [HttpClient](#interface-httpclient), [HttpClientRequestOptions](#interface-httpclientrequestoptions), [HttpClientResponse](#type-httpclientresponse)
|
|
1155
1209
|
|
|
1156
1210
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
1157
1211
|
|
|
@@ -1199,7 +1253,11 @@ export default class MerklePath {
|
|
|
1199
1253
|
}
|
|
1200
1254
|
```
|
|
1201
1255
|
|
|
1202
|
-
See also: [ChainTracker](
|
|
1256
|
+
See also: [ChainTracker](#interface-chaintracker), [MerklePathLeaf](#interface-merklepathleaf), [Reader](#class-reader), [toHex](#variable-tohex), [verify](#variable-verify)
|
|
1257
|
+
|
|
1258
|
+
<details>
|
|
1259
|
+
|
|
1260
|
+
<summary>Class MerklePath Details</summary>
|
|
1203
1261
|
|
|
1204
1262
|
#### Method combine
|
|
1205
1263
|
|
|
@@ -1208,7 +1266,7 @@ Combines this MerklePath with another to create a compound proof.
|
|
|
1208
1266
|
```ts
|
|
1209
1267
|
combine(other: MerklePath): void
|
|
1210
1268
|
```
|
|
1211
|
-
See also: [MerklePath](
|
|
1269
|
+
See also: [MerklePath](#class-merklepath)
|
|
1212
1270
|
|
|
1213
1271
|
Argument Details
|
|
1214
1272
|
|
|
@@ -1249,7 +1307,7 @@ Does not add computed leaves to path.
|
|
|
1249
1307
|
```ts
|
|
1250
1308
|
findOrComputeLeaf(height: number, offset: number): MerklePathLeaf | undefined
|
|
1251
1309
|
```
|
|
1252
|
-
See also: [MerklePathLeaf](
|
|
1310
|
+
See also: [MerklePathLeaf](#interface-merklepathleaf)
|
|
1253
1311
|
|
|
1254
1312
|
#### Method fromBinary
|
|
1255
1313
|
|
|
@@ -1258,7 +1316,7 @@ Creates a MerklePath instance from a binary array.
|
|
|
1258
1316
|
```ts
|
|
1259
1317
|
static fromBinary(bump: number[]): MerklePath
|
|
1260
1318
|
```
|
|
1261
|
-
See also: [MerklePath](
|
|
1319
|
+
See also: [MerklePath](#class-merklepath)
|
|
1262
1320
|
|
|
1263
1321
|
Returns
|
|
1264
1322
|
|
|
@@ -1274,7 +1332,7 @@ Argument Details
|
|
|
1274
1332
|
```ts
|
|
1275
1333
|
static fromCoinbaseTxidAndHeight(txid: string, height: number): MerklePath
|
|
1276
1334
|
```
|
|
1277
|
-
See also: [MerklePath](
|
|
1335
|
+
See also: [MerklePath](#class-merklepath)
|
|
1278
1336
|
|
|
1279
1337
|
Returns
|
|
1280
1338
|
|
|
@@ -1294,7 +1352,7 @@ Creates a MerklePath instance from a hexadecimal string.
|
|
|
1294
1352
|
```ts
|
|
1295
1353
|
static fromHex(hex: string): MerklePath
|
|
1296
1354
|
```
|
|
1297
|
-
See also: [MerklePath](
|
|
1355
|
+
See also: [MerklePath](#class-merklepath)
|
|
1298
1356
|
|
|
1299
1357
|
Returns
|
|
1300
1358
|
|
|
@@ -1346,7 +1404,7 @@ Verifies if the given transaction ID is part of the Merkle tree at the specified
|
|
|
1346
1404
|
```ts
|
|
1347
1405
|
async verify(txid: string, chainTracker: ChainTracker): Promise<boolean>
|
|
1348
1406
|
```
|
|
1349
|
-
See also: [ChainTracker](
|
|
1407
|
+
See also: [ChainTracker](#interface-chaintracker)
|
|
1350
1408
|
|
|
1351
1409
|
Returns
|
|
1352
1410
|
|
|
@@ -1359,6 +1417,8 @@ Argument Details
|
|
|
1359
1417
|
+ **chainTracker**
|
|
1360
1418
|
+ The ChainTracker instance used to verify the Merkle root.
|
|
1361
1419
|
|
|
1420
|
+
</details>
|
|
1421
|
+
|
|
1362
1422
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
1363
1423
|
|
|
1364
1424
|
---
|
|
@@ -1373,7 +1433,7 @@ export class NodejsHttpClient implements HttpClient {
|
|
|
1373
1433
|
}
|
|
1374
1434
|
```
|
|
1375
1435
|
|
|
1376
|
-
See also: [HttpClient](
|
|
1436
|
+
See also: [HttpClient](#interface-httpclient), [HttpClientRequestOptions](#interface-httpclientrequestoptions), [HttpClientResponse](#type-httpclientresponse), [HttpsNodejs](#interface-httpsnodejs)
|
|
1377
1437
|
|
|
1378
1438
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
1379
1439
|
|
|
@@ -1390,7 +1450,11 @@ export default class SatoshisPerKilobyte implements FeeModel {
|
|
|
1390
1450
|
}
|
|
1391
1451
|
```
|
|
1392
1452
|
|
|
1393
|
-
See also: [FeeModel](
|
|
1453
|
+
See also: [FeeModel](#interface-feemodel), [Transaction](#class-transaction)
|
|
1454
|
+
|
|
1455
|
+
<details>
|
|
1456
|
+
|
|
1457
|
+
<summary>Class SatoshisPerKilobyte Details</summary>
|
|
1394
1458
|
|
|
1395
1459
|
#### Constructor
|
|
1396
1460
|
|
|
@@ -1412,7 +1476,7 @@ Computes the fee for a given transaction.
|
|
|
1412
1476
|
```ts
|
|
1413
1477
|
async computeFee(tx: Transaction): Promise<number>
|
|
1414
1478
|
```
|
|
1415
|
-
See also: [Transaction](
|
|
1479
|
+
See also: [Transaction](#class-transaction)
|
|
1416
1480
|
|
|
1417
1481
|
Returns
|
|
1418
1482
|
|
|
@@ -1423,6 +1487,8 @@ Argument Details
|
|
|
1423
1487
|
+ **tx**
|
|
1424
1488
|
+ The transaction for which a fee is to be computed.
|
|
1425
1489
|
|
|
1490
|
+
</details>
|
|
1491
|
+
|
|
1426
1492
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
1427
1493
|
|
|
1428
1494
|
---
|
|
@@ -1497,7 +1563,11 @@ export default class Transaction {
|
|
|
1497
1563
|
}
|
|
1498
1564
|
```
|
|
1499
1565
|
|
|
1500
|
-
See also: [BroadcastFailure](
|
|
1566
|
+
See also: [BroadcastFailure](#interface-broadcastfailure), [BroadcastResponse](#interface-broadcastresponse), [Broadcaster](#interface-broadcaster), [ChainTracker](#interface-chaintracker), [FeeModel](#interface-feemodel), [MerklePath](#class-merklepath), [Reader](#class-reader), [SatoshisPerKilobyte](#class-satoshisperkilobyte), [TransactionInput](#interface-transactioninput), [TransactionOutput](#interface-transactionoutput), [defaultBroadcaster](#function-defaultbroadcaster), [defaultChainTracker](#function-defaultchaintracker), [sign](#variable-sign), [toHex](#variable-tohex), [verify](#variable-verify)
|
|
1567
|
+
|
|
1568
|
+
<details>
|
|
1569
|
+
|
|
1570
|
+
<summary>Class Transaction Details</summary>
|
|
1501
1571
|
|
|
1502
1572
|
#### Method addInput
|
|
1503
1573
|
|
|
@@ -1506,7 +1576,7 @@ Adds a new input to the transaction.
|
|
|
1506
1576
|
```ts
|
|
1507
1577
|
addInput(input: TransactionInput): void
|
|
1508
1578
|
```
|
|
1509
|
-
See also: [TransactionInput](
|
|
1579
|
+
See also: [TransactionInput](#interface-transactioninput)
|
|
1510
1580
|
|
|
1511
1581
|
Argument Details
|
|
1512
1582
|
|
|
@@ -1524,7 +1594,7 @@ Adds a new output to the transaction.
|
|
|
1524
1594
|
```ts
|
|
1525
1595
|
addOutput(output: TransactionOutput): void
|
|
1526
1596
|
```
|
|
1527
|
-
See also: [TransactionOutput](
|
|
1597
|
+
See also: [TransactionOutput](#interface-transactionoutput)
|
|
1528
1598
|
|
|
1529
1599
|
Argument Details
|
|
1530
1600
|
|
|
@@ -1553,7 +1623,7 @@ Broadcasts a transaction.
|
|
|
1553
1623
|
```ts
|
|
1554
1624
|
async broadcast(broadcaster: Broadcaster = defaultBroadcaster()): Promise<BroadcastResponse | BroadcastFailure>
|
|
1555
1625
|
```
|
|
1556
|
-
See also: [BroadcastFailure](
|
|
1626
|
+
See also: [BroadcastFailure](#interface-broadcastfailure), [BroadcastResponse](#interface-broadcastresponse), [Broadcaster](#interface-broadcaster), [defaultBroadcaster](#function-defaultbroadcaster)
|
|
1557
1627
|
|
|
1558
1628
|
Returns
|
|
1559
1629
|
|
|
@@ -1573,7 +1643,7 @@ If fee is a number, the transaction uses that value as fee.
|
|
|
1573
1643
|
```ts
|
|
1574
1644
|
async fee(modelOrFee: FeeModel | number = new SatoshisPerKilobyte(1), changeDistribution: "equal" | "random" = "equal"): Promise<void>
|
|
1575
1645
|
```
|
|
1576
|
-
See also: [FeeModel](
|
|
1646
|
+
See also: [FeeModel](#interface-feemodel), [SatoshisPerKilobyte](#class-satoshisperkilobyte)
|
|
1577
1647
|
|
|
1578
1648
|
Argument Details
|
|
1579
1649
|
|
|
@@ -1591,7 +1661,7 @@ Extracts the subject transaction and supporting merkle path and source transacti
|
|
|
1591
1661
|
```ts
|
|
1592
1662
|
static fromAtomicBEEF(beef: number[]): Transaction
|
|
1593
1663
|
```
|
|
1594
|
-
See also: [Transaction](
|
|
1664
|
+
See also: [Transaction](#class-transaction)
|
|
1595
1665
|
|
|
1596
1666
|
Returns
|
|
1597
1667
|
|
|
@@ -1612,7 +1682,7 @@ If no TXID is provided, the last transaction in the BEEF data is returned, or th
|
|
|
1612
1682
|
```ts
|
|
1613
1683
|
static fromBEEF(beef: number[], txid?: string): Transaction
|
|
1614
1684
|
```
|
|
1615
|
-
See also: [Transaction](
|
|
1685
|
+
See also: [Transaction](#class-transaction)
|
|
1616
1686
|
|
|
1617
1687
|
Returns
|
|
1618
1688
|
|
|
@@ -1632,7 +1702,7 @@ Creates a Transaction instance from a binary array.
|
|
|
1632
1702
|
```ts
|
|
1633
1703
|
static fromBinary(bin: number[]): Transaction
|
|
1634
1704
|
```
|
|
1635
|
-
See also: [Transaction](
|
|
1705
|
+
See also: [Transaction](#class-transaction)
|
|
1636
1706
|
|
|
1637
1707
|
Returns
|
|
1638
1708
|
|
|
@@ -1650,7 +1720,7 @@ Creates a new transaction, linked to its inputs and their associated merkle path
|
|
|
1650
1720
|
```ts
|
|
1651
1721
|
static fromEF(ef: number[]): Transaction
|
|
1652
1722
|
```
|
|
1653
|
-
See also: [Transaction](
|
|
1723
|
+
See also: [Transaction](#class-transaction)
|
|
1654
1724
|
|
|
1655
1725
|
Returns
|
|
1656
1726
|
|
|
@@ -1668,7 +1738,7 @@ Creates a Transaction instance from a hexadecimal string.
|
|
|
1668
1738
|
```ts
|
|
1669
1739
|
static fromHex(hex: string): Transaction
|
|
1670
1740
|
```
|
|
1671
|
-
See also: [Transaction](
|
|
1741
|
+
See also: [Transaction](#class-transaction)
|
|
1672
1742
|
|
|
1673
1743
|
Returns
|
|
1674
1744
|
|
|
@@ -1689,7 +1759,7 @@ If no TXID is provided, the last transaction in the BEEF data is returned.
|
|
|
1689
1759
|
```ts
|
|
1690
1760
|
static fromHexBEEF(hex: string, txid?: string): Transaction
|
|
1691
1761
|
```
|
|
1692
|
-
See also: [Transaction](
|
|
1762
|
+
See also: [Transaction](#class-transaction)
|
|
1693
1763
|
|
|
1694
1764
|
Returns
|
|
1695
1765
|
|
|
@@ -1709,7 +1779,7 @@ Creates a Transaction instance from a hexadecimal string encoded EF.
|
|
|
1709
1779
|
```ts
|
|
1710
1780
|
static fromHexEF(hex: string): Transaction
|
|
1711
1781
|
```
|
|
1712
|
-
See also: [Transaction](
|
|
1782
|
+
See also: [Transaction](#class-transaction)
|
|
1713
1783
|
|
|
1714
1784
|
Returns
|
|
1715
1785
|
|
|
@@ -1976,7 +2046,7 @@ Verifies the legitimacy of the Bitcoin transaction according to the rules of SPV
|
|
|
1976
2046
|
```ts
|
|
1977
2047
|
async verify(chainTracker: ChainTracker | "scripts only" = defaultChainTracker(), feeModel?: FeeModel, memoryLimit?: number): Promise<boolean>
|
|
1978
2048
|
```
|
|
1979
|
-
See also: [ChainTracker](
|
|
2049
|
+
See also: [ChainTracker](#interface-chaintracker), [FeeModel](#interface-feemodel), [defaultChainTracker](#function-defaultchaintracker)
|
|
1980
2050
|
|
|
1981
2051
|
Returns
|
|
1982
2052
|
|
|
@@ -1997,6 +2067,8 @@ Example
|
|
|
1997
2067
|
tx.verify(new WhatsOnChain(), new SatoshisPerKilobyte(1))
|
|
1998
2068
|
```
|
|
1999
2069
|
|
|
2070
|
+
</details>
|
|
2071
|
+
|
|
2000
2072
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2001
2073
|
|
|
2002
2074
|
---
|
|
@@ -2017,7 +2089,11 @@ export default class WhatsOnChain implements ChainTracker {
|
|
|
2017
2089
|
}
|
|
2018
2090
|
```
|
|
2019
2091
|
|
|
2020
|
-
See also: [ChainTracker](
|
|
2092
|
+
See also: [ChainTracker](#interface-chaintracker), [HttpClient](#interface-httpclient), [WhatsOnChainConfig](#interface-whatsonchainconfig)
|
|
2093
|
+
|
|
2094
|
+
<details>
|
|
2095
|
+
|
|
2096
|
+
<summary>Class WhatsOnChain Details</summary>
|
|
2021
2097
|
|
|
2022
2098
|
#### Constructor
|
|
2023
2099
|
|
|
@@ -2026,7 +2102,7 @@ Constructs an instance of the WhatsOnChain ChainTracker.
|
|
|
2026
2102
|
```ts
|
|
2027
2103
|
constructor(network: "main" | "test" | "stn" = "main", config: WhatsOnChainConfig = {})
|
|
2028
2104
|
```
|
|
2029
|
-
See also: [WhatsOnChainConfig](
|
|
2105
|
+
See also: [WhatsOnChainConfig](#interface-whatsonchainconfig)
|
|
2030
2106
|
|
|
2031
2107
|
Argument Details
|
|
2032
2108
|
|
|
@@ -2035,6 +2111,8 @@ Argument Details
|
|
|
2035
2111
|
+ **config**
|
|
2036
2112
|
+ Configuration options for the WhatsOnChain ChainTracker.
|
|
2037
2113
|
|
|
2114
|
+
</details>
|
|
2115
|
+
|
|
2038
2116
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2039
2117
|
|
|
2040
2118
|
---
|
|
@@ -2058,7 +2136,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
2058
2136
|
export function defaultBroadcaster(isTestnet: boolean = false, config: ArcConfig = {}): Broadcaster
|
|
2059
2137
|
```
|
|
2060
2138
|
|
|
2061
|
-
See also: [ArcConfig](
|
|
2139
|
+
See also: [ArcConfig](#interface-arcconfig), [Broadcaster](#interface-broadcaster)
|
|
2062
2140
|
|
|
2063
2141
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2064
2142
|
|
|
@@ -2069,7 +2147,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
2069
2147
|
export function defaultChainTracker(): ChainTracker
|
|
2070
2148
|
```
|
|
2071
2149
|
|
|
2072
|
-
See also: [ChainTracker](
|
|
2150
|
+
See also: [ChainTracker](#interface-chaintracker)
|
|
2073
2151
|
|
|
2074
2152
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2075
2153
|
|
|
@@ -2084,7 +2162,7 @@ If running in a Node environment, it falls back to using the Node `https` module
|
|
|
2084
2162
|
export function defaultHttpClient(): HttpClient
|
|
2085
2163
|
```
|
|
2086
2164
|
|
|
2087
|
-
See also: [HttpClient](
|
|
2165
|
+
See also: [HttpClient](#interface-httpclient)
|
|
2088
2166
|
|
|
2089
2167
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2090
2168
|
|
|
@@ -2097,7 +2175,7 @@ Convenience type guard for response from `Broadcaster.broadcast`
|
|
|
2097
2175
|
export function isBroadcastFailure(r: BroadcastResponse | BroadcastFailure): r is BroadcastFailure
|
|
2098
2176
|
```
|
|
2099
2177
|
|
|
2100
|
-
See also: [BroadcastFailure](
|
|
2178
|
+
See also: [BroadcastFailure](#interface-broadcastfailure), [BroadcastResponse](#interface-broadcastresponse)
|
|
2101
2179
|
|
|
2102
2180
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2103
2181
|
|
|
@@ -2110,7 +2188,7 @@ Convenience type guard for response from `Broadcaster.broadcast`
|
|
|
2110
2188
|
export function isBroadcastResponse(r: BroadcastResponse | BroadcastFailure): r is BroadcastResponse
|
|
2111
2189
|
```
|
|
2112
2190
|
|
|
2113
|
-
See also: [BroadcastFailure](
|
|
2191
|
+
See also: [BroadcastFailure](#interface-broadcastfailure), [BroadcastResponse](#interface-broadcastresponse)
|
|
2114
2192
|
|
|
2115
2193
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2116
2194
|
|
|
@@ -2136,7 +2214,7 @@ Makes a request to the server.
|
|
|
2136
2214
|
export type Fetch = (url: string, options: FetchOptions) => Promise<Response>
|
|
2137
2215
|
```
|
|
2138
2216
|
|
|
2139
|
-
See also: [FetchOptions](
|
|
2217
|
+
See also: [FetchOptions](#interface-fetchoptions)
|
|
2140
2218
|
|
|
2141
2219
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2142
2220
|
|