@bsv/sdk 1.6.11 → 1.6.14
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/README.md +4 -4
- package/dist/cjs/package.json +1 -1
- package/dist/cjs/src/transaction/broadcasters/DefaultBroadcaster.js +1 -1
- package/dist/cjs/src/transaction/broadcasters/DefaultBroadcaster.js.map +1 -1
- package/dist/cjs/src/wallet/WalletClient.js +1 -0
- package/dist/cjs/src/wallet/WalletClient.js.map +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/src/transaction/broadcasters/DefaultBroadcaster.js +1 -1
- package/dist/esm/src/transaction/broadcasters/DefaultBroadcaster.js.map +1 -1
- package/dist/esm/src/wallet/WalletClient.js +1 -0
- package/dist/esm/src/wallet/WalletClient.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/types/src/wallet/WalletClient.d.ts.map +1 -1
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/dist/umd/bundle.js +1 -1
- package/docs/MARKDOWN_VALIDATION_GUIDE.md +175 -0
- package/docs/concepts/beef.md +8 -0
- package/docs/concepts/chain-tracking.md +12 -0
- package/docs/concepts/decentralized-identity.md +37 -0
- package/docs/concepts/fees.md +32 -0
- package/docs/concepts/identity-certificates.md +53 -1
- package/docs/concepts/index.md +15 -0
- package/docs/concepts/key-management.md +9 -0
- package/docs/concepts/script-templates.md +13 -0
- package/docs/concepts/sdk-philosophy.md +8 -0
- package/docs/concepts/signatures.md +15 -0
- package/docs/concepts/spv-verification.md +12 -0
- package/docs/concepts/transaction-encoding.md +19 -0
- package/docs/concepts/transaction-structure.md +4 -0
- package/docs/concepts/trust-model.md +16 -0
- package/docs/concepts/verification.md +31 -0
- package/docs/concepts/wallet-integration.md +6 -0
- package/docs/guides/development-wallet-setup.md +374 -0
- package/docs/guides/direct-transaction-creation.md +12 -2
- package/docs/guides/http-client-configuration.md +122 -48
- package/docs/guides/index.md +117 -9
- package/docs/guides/large-transactions.md +448 -0
- package/docs/guides/multisig-transactions.md +792 -0
- package/docs/guides/security-best-practices.md +494 -0
- package/docs/guides/transaction-batching.md +132 -0
- package/docs/guides/transaction-signing-methods.md +230 -79
- package/docs/index.md +0 -2
- package/docs/reference/auth.md +212 -159
- package/docs/reference/compat.md +120 -96
- package/docs/reference/configuration.md +6 -0
- package/docs/reference/debugging.md +5 -0
- package/docs/reference/errors.md +50 -0
- package/docs/reference/identity.md +21 -12
- package/docs/reference/index.md +14 -1
- package/docs/reference/kvstore.md +21 -19
- package/docs/reference/messages.md +3 -0
- package/docs/reference/op-codes.md +20 -1
- package/docs/reference/overlay-tools.md +46 -18
- package/docs/reference/primitives.md +571 -390
- package/docs/reference/registry.md +43 -20
- package/docs/reference/script.md +140 -105
- package/docs/reference/storage.md +32 -12
- package/docs/reference/totp.md +16 -11
- package/docs/reference/transaction-signatures.md +2 -1
- package/docs/reference/transaction.md +201 -120
- package/docs/reference/wallet.md +241 -64
- package/docs/tutorials/advanced-transaction.md +1 -4
- package/docs/tutorials/aes-encryption.md +3 -1
- package/docs/tutorials/authfetch-tutorial.md +29 -0
- package/docs/tutorials/ecdh-key-exchange.md +2 -0
- package/docs/tutorials/elliptic-curve-fundamentals.md +3 -0
- package/docs/tutorials/error-handling.md +1 -0
- package/docs/tutorials/first-transaction-low-level.md +1 -0
- package/docs/tutorials/first-transaction.md +5 -8
- package/docs/tutorials/hashes-and-hmacs.md +5 -31
- package/docs/tutorials/identity-management.md +27 -0
- package/docs/tutorials/index.md +114 -77
- package/docs/tutorials/key-management.md +5 -3
- package/docs/tutorials/protowallet-development.md +27 -0
- package/docs/tutorials/spv-merkle-proofs.md +9 -6
- package/docs/tutorials/testnet-transactions-low-level.md +25 -18
- package/docs/tutorials/transaction-broadcasting.md +10 -7
- package/docs/tutorials/transaction-types.md +5 -4
- package/docs/tutorials/type-42.md +0 -14
- package/docs/tutorials/uhrp-storage.md +23 -3
- package/package.json +1 -1
- package/src/identity/README.md +0 -1
- package/src/primitives/__tests/SymmetricKey.test.ts +45 -0
- package/src/primitives/__tests/SymmetricKeyCompatibility.test.ts +150 -0
- package/src/transaction/__tests/Transaction.test.ts +1 -1
- package/src/transaction/broadcasters/DefaultBroadcaster.ts +1 -1
- package/src/transaction/broadcasters/__tests/ARC.test.ts +1 -1
- package/src/wallet/WalletClient.ts +1 -0
|
@@ -83,11 +83,13 @@ The HTTP client used to make requests to the ARC API.
|
|
|
83
83
|
```ts
|
|
84
84
|
httpClient?: HttpClient
|
|
85
85
|
```
|
|
86
|
+
|
|
86
87
|
See also: [HttpClient](./transaction.md#interface-httpclient)
|
|
87
88
|
|
|
88
89
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
89
90
|
|
|
90
91
|
---
|
|
92
|
+
|
|
91
93
|
### Interface: BroadcastFailure
|
|
92
94
|
|
|
93
95
|
Defines the structure of a failed broadcast response.
|
|
@@ -105,6 +107,7 @@ export interface BroadcastFailure {
|
|
|
105
107
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
106
108
|
|
|
107
109
|
---
|
|
110
|
+
|
|
108
111
|
### Interface: BroadcastResponse
|
|
109
112
|
|
|
110
113
|
Defines the structure of a successful broadcast response.
|
|
@@ -121,6 +124,7 @@ export interface BroadcastResponse {
|
|
|
121
124
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
122
125
|
|
|
123
126
|
---
|
|
127
|
+
|
|
124
128
|
### Interface: Broadcaster
|
|
125
129
|
|
|
126
130
|
Represents the interface for a transaction broadcaster.
|
|
@@ -138,6 +142,7 @@ See also: [BroadcastFailure](./transaction.md#interface-broadcastfailure), [Broa
|
|
|
138
142
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
139
143
|
|
|
140
144
|
---
|
|
145
|
+
|
|
141
146
|
### Interface: ChainTracker
|
|
142
147
|
|
|
143
148
|
The Chain Tracker is responsible for verifying the validity of a given Merkle root
|
|
@@ -170,6 +175,7 @@ export default interface ChainTracker {
|
|
|
170
175
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
171
176
|
|
|
172
177
|
---
|
|
178
|
+
|
|
173
179
|
### Interface: FeeModel
|
|
174
180
|
|
|
175
181
|
Represents the interface for a transaction fee model.
|
|
@@ -186,6 +192,7 @@ See also: [Transaction](./transaction.md#class-transaction)
|
|
|
186
192
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
187
193
|
|
|
188
194
|
---
|
|
195
|
+
|
|
189
196
|
### Interface: FetchOptions
|
|
190
197
|
|
|
191
198
|
An interface for configuration of the request to be passed to the fetch method
|
|
@@ -226,6 +233,7 @@ method?: string
|
|
|
226
233
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
227
234
|
|
|
228
235
|
---
|
|
236
|
+
|
|
229
237
|
### Interface: HttpClient
|
|
230
238
|
|
|
231
239
|
An interface for HTTP client used to make HTTP requests.
|
|
@@ -245,11 +253,13 @@ Makes a request to the server.
|
|
|
245
253
|
```ts
|
|
246
254
|
request: <T = any, D = any>(url: string, options: HttpClientRequestOptions<D>) => Promise<HttpClientResponse<T>>
|
|
247
255
|
```
|
|
256
|
+
|
|
248
257
|
See also: [HttpClientRequestOptions](./transaction.md#interface-httpclientrequestoptions), [HttpClientResponse](./transaction.md#type-httpclientresponse)
|
|
249
258
|
|
|
250
259
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
251
260
|
|
|
252
261
|
---
|
|
262
|
+
|
|
253
263
|
### Interface: HttpClientRequestOptions
|
|
254
264
|
|
|
255
265
|
An interface for configuration of the request to be passed to the request method.
|
|
@@ -289,6 +299,7 @@ method?: string
|
|
|
289
299
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
290
300
|
|
|
291
301
|
---
|
|
302
|
+
|
|
292
303
|
### Interface: HttpsNodejs
|
|
293
304
|
|
|
294
305
|
Node Https module interface limited to options needed by ts-sdk
|
|
@@ -304,6 +315,7 @@ See also: [HttpClientRequestOptions](./transaction.md#interface-httpclientreques
|
|
|
304
315
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
305
316
|
|
|
306
317
|
---
|
|
318
|
+
|
|
307
319
|
### Interface: MerklePathLeaf
|
|
308
320
|
|
|
309
321
|
```ts
|
|
@@ -318,6 +330,7 @@ export interface MerklePathLeaf {
|
|
|
318
330
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
319
331
|
|
|
320
332
|
---
|
|
333
|
+
|
|
321
334
|
### Interface: NodejsHttpClientRequest
|
|
322
335
|
|
|
323
336
|
Nodejs result of the Node https.request call limited to options needed by ts-sdk
|
|
@@ -333,6 +346,7 @@ export interface NodejsHttpClientRequest {
|
|
|
333
346
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
334
347
|
|
|
335
348
|
---
|
|
349
|
+
|
|
336
350
|
### Interface: TransactionInput
|
|
337
351
|
|
|
338
352
|
Represents an input to a Bitcoin transaction.
|
|
@@ -375,6 +389,7 @@ See also: [Transaction](./transaction.md#class-transaction), [UnlockingScript](.
|
|
|
375
389
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
376
390
|
|
|
377
391
|
---
|
|
392
|
+
|
|
378
393
|
### Interface: TransactionOutput
|
|
379
394
|
|
|
380
395
|
Represents an output in a Bitcoin transaction.
|
|
@@ -405,6 +420,7 @@ See also: [LockingScript](./script.md#class-lockingscript)
|
|
|
405
420
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
406
421
|
|
|
407
422
|
---
|
|
423
|
+
|
|
408
424
|
### Interface: WhatsOnChainConfig
|
|
409
425
|
|
|
410
426
|
Configuration options for the WhatsOnChain ChainTracker.
|
|
@@ -433,11 +449,13 @@ The HTTP client used to make requests to the API.
|
|
|
433
449
|
```ts
|
|
434
450
|
httpClient?: HttpClient
|
|
435
451
|
```
|
|
452
|
+
|
|
436
453
|
See also: [HttpClient](./transaction.md#interface-httpclient)
|
|
437
454
|
|
|
438
455
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
439
456
|
|
|
440
457
|
---
|
|
458
|
+
|
|
441
459
|
## Classes
|
|
442
460
|
|
|
443
461
|
| |
|
|
@@ -486,14 +504,15 @@ Constructs an instance of the ARC broadcaster.
|
|
|
486
504
|
```ts
|
|
487
505
|
constructor(URL: string, config?: ArcConfig)
|
|
488
506
|
```
|
|
507
|
+
|
|
489
508
|
See also: [ArcConfig](./transaction.md#interface-arcconfig)
|
|
490
509
|
|
|
491
510
|
Argument Details
|
|
492
511
|
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
512
|
+
- **URL**
|
|
513
|
+
- The URL endpoint for the ARC API.
|
|
514
|
+
- **config**
|
|
515
|
+
- Configuration options for the ARC broadcaster.
|
|
497
516
|
|
|
498
517
|
#### Constructor
|
|
499
518
|
|
|
@@ -505,10 +524,10 @@ constructor(URL: string, apiKey?: string)
|
|
|
505
524
|
|
|
506
525
|
Argument Details
|
|
507
526
|
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
527
|
+
- **URL**
|
|
528
|
+
- The URL endpoint for the ARC API.
|
|
529
|
+
- **apiKey**
|
|
530
|
+
- The API key used for authorization with the ARC API.
|
|
512
531
|
|
|
513
532
|
#### Method broadcast
|
|
514
533
|
|
|
@@ -517,6 +536,7 @@ Broadcasts a transaction via ARC.
|
|
|
517
536
|
```ts
|
|
518
537
|
async broadcast(tx: Transaction): Promise<BroadcastResponse | BroadcastFailure>
|
|
519
538
|
```
|
|
539
|
+
|
|
520
540
|
See also: [BroadcastFailure](./transaction.md#interface-broadcastfailure), [BroadcastResponse](./transaction.md#interface-broadcastresponse), [Transaction](./transaction.md#class-transaction)
|
|
521
541
|
|
|
522
542
|
Returns
|
|
@@ -525,8 +545,8 @@ A promise that resolves to either a success or failure response.
|
|
|
525
545
|
|
|
526
546
|
Argument Details
|
|
527
547
|
|
|
528
|
-
|
|
529
|
-
|
|
548
|
+
- **tx**
|
|
549
|
+
- The transaction to be broadcasted.
|
|
530
550
|
|
|
531
551
|
#### Method broadcastMany
|
|
532
552
|
|
|
@@ -536,6 +556,7 @@ Handles mixed responses where some transactions succeed and others fail.
|
|
|
536
556
|
```ts
|
|
537
557
|
async broadcastMany(txs: Transaction[]): Promise<object[]>
|
|
538
558
|
```
|
|
559
|
+
|
|
539
560
|
See also: [Transaction](./transaction.md#class-transaction)
|
|
540
561
|
|
|
541
562
|
Returns
|
|
@@ -544,12 +565,13 @@ A promise that resolves to an array of objects.
|
|
|
544
565
|
|
|
545
566
|
Argument Details
|
|
546
567
|
|
|
547
|
-
|
|
548
|
-
|
|
568
|
+
- **txs**
|
|
569
|
+
- Array of transactions to be broadcasted.
|
|
549
570
|
|
|
550
571
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
551
572
|
|
|
552
573
|
---
|
|
574
|
+
|
|
553
575
|
### Class: Beef
|
|
554
576
|
|
|
555
577
|
```ts
|
|
@@ -615,6 +637,7 @@ addComputedLeaves(): void
|
|
|
615
637
|
```ts
|
|
616
638
|
clone(): Beef
|
|
617
639
|
```
|
|
640
|
+
|
|
618
641
|
See also: [Beef](./transaction.md#class-beef)
|
|
619
642
|
|
|
620
643
|
Returns
|
|
@@ -630,6 +653,7 @@ To succeed, the Beef must contain all the required transaction and merkle path d
|
|
|
630
653
|
```ts
|
|
631
654
|
findAtomicTransaction(txid: string): Transaction | undefined
|
|
632
655
|
```
|
|
656
|
+
|
|
633
657
|
See also: [Transaction](./transaction.md#class-transaction)
|
|
634
658
|
|
|
635
659
|
Returns
|
|
@@ -638,14 +662,15 @@ Transaction with input `SourceTransaction` and `MerklePath` populated from this
|
|
|
638
662
|
|
|
639
663
|
Argument Details
|
|
640
664
|
|
|
641
|
-
|
|
642
|
-
|
|
665
|
+
- **txid**
|
|
666
|
+
- The id of the target transaction.
|
|
643
667
|
|
|
644
668
|
#### Method findBump
|
|
645
669
|
|
|
646
670
|
```ts
|
|
647
671
|
findBump(txid: string): MerklePath | undefined
|
|
648
672
|
```
|
|
673
|
+
|
|
649
674
|
See also: [MerklePath](./transaction.md#class-merklepath)
|
|
650
675
|
|
|
651
676
|
Returns
|
|
@@ -662,6 +687,7 @@ The result is suitable for signing.
|
|
|
662
687
|
```ts
|
|
663
688
|
findTransactionForSigning(txid: string): Transaction | undefined
|
|
664
689
|
```
|
|
690
|
+
|
|
665
691
|
See also: [Transaction](./transaction.md#class-transaction)
|
|
666
692
|
|
|
667
693
|
Returns
|
|
@@ -670,14 +696,15 @@ Transaction with all available input `SourceTransaction`s from this Beef.
|
|
|
670
696
|
|
|
671
697
|
Argument Details
|
|
672
698
|
|
|
673
|
-
|
|
674
|
-
|
|
699
|
+
- **txid**
|
|
700
|
+
- The id of the target transaction.
|
|
675
701
|
|
|
676
702
|
#### Method findTxid
|
|
677
703
|
|
|
678
704
|
```ts
|
|
679
705
|
findTxid(txid: string): BeefTx | undefined
|
|
680
706
|
```
|
|
707
|
+
|
|
681
708
|
See also: [BeefTx](./transaction.md#class-beeftx)
|
|
682
709
|
|
|
683
710
|
Returns
|
|
@@ -686,8 +713,8 @@ Returns
|
|
|
686
713
|
|
|
687
714
|
Argument Details
|
|
688
715
|
|
|
689
|
-
|
|
690
|
-
|
|
716
|
+
- **txid**
|
|
717
|
+
- of `beefTx` to find
|
|
691
718
|
|
|
692
719
|
#### Method fromBinary
|
|
693
720
|
|
|
@@ -696,6 +723,7 @@ Constructs an instance of the Beef class based on the provided binary array
|
|
|
696
723
|
```ts
|
|
697
724
|
static fromBinary(bin: number[]): Beef
|
|
698
725
|
```
|
|
726
|
+
|
|
699
727
|
See also: [Beef](./transaction.md#class-beef)
|
|
700
728
|
|
|
701
729
|
Returns
|
|
@@ -704,8 +732,8 @@ An instance of the Beef class constructed from the binary data
|
|
|
704
732
|
|
|
705
733
|
Argument Details
|
|
706
734
|
|
|
707
|
-
|
|
708
|
-
|
|
735
|
+
- **bin**
|
|
736
|
+
- The binary array from which to construct BEEF
|
|
709
737
|
|
|
710
738
|
#### Method fromString
|
|
711
739
|
|
|
@@ -714,6 +742,7 @@ Constructs an instance of the Beef class based on the provided string
|
|
|
714
742
|
```ts
|
|
715
743
|
static fromString(s: string, enc: "hex" | "utf8" | "base64" = "hex"): Beef
|
|
716
744
|
```
|
|
745
|
+
|
|
717
746
|
See also: [Beef](./transaction.md#class-beef)
|
|
718
747
|
|
|
719
748
|
Returns
|
|
@@ -722,10 +751,10 @@ An instance of the Beef class constructed from the string
|
|
|
722
751
|
|
|
723
752
|
Argument Details
|
|
724
753
|
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
754
|
+
- **s**
|
|
755
|
+
- The string value from which to construct BEEF
|
|
756
|
+
- **enc**
|
|
757
|
+
- The encoding of the string value from which BEEF should be constructed
|
|
729
758
|
|
|
730
759
|
#### Method getValidTxids
|
|
731
760
|
|
|
@@ -744,6 +773,7 @@ Sorts `txs` and checks structural validity of beef.
|
|
|
744
773
|
Does NOT verify merkle roots.
|
|
745
774
|
|
|
746
775
|
Validity requirements:
|
|
776
|
+
|
|
747
777
|
1. No 'known' txids, unless `allowTxidOnly` is true.
|
|
748
778
|
2. All transactions have bumps or their inputs chain back to bumps (or are known).
|
|
749
779
|
3. Order of transactions satisfies dependencies before dependents.
|
|
@@ -755,8 +785,8 @@ isValid(allowTxidOnly?: boolean): boolean
|
|
|
755
785
|
|
|
756
786
|
Argument Details
|
|
757
787
|
|
|
758
|
-
|
|
759
|
-
|
|
788
|
+
- **allowTxidOnly**
|
|
789
|
+
- optional. If true, transaction txid only is assumed valid
|
|
760
790
|
|
|
761
791
|
#### Method makeTxidOnly
|
|
762
792
|
|
|
@@ -769,6 +799,7 @@ original.
|
|
|
769
799
|
```ts
|
|
770
800
|
makeTxidOnly(txid: string): BeefTx | undefined
|
|
771
801
|
```
|
|
802
|
+
|
|
772
803
|
See also: [BeefTx](./transaction.md#class-beeftx)
|
|
773
804
|
|
|
774
805
|
Returns
|
|
@@ -782,6 +813,7 @@ Merge a MerklePath that is assumed to be fully valid.
|
|
|
782
813
|
```ts
|
|
783
814
|
mergeBump(bump: MerklePath): number
|
|
784
815
|
```
|
|
816
|
+
|
|
785
817
|
See also: [MerklePath](./transaction.md#class-merklepath)
|
|
786
818
|
|
|
787
819
|
Returns
|
|
@@ -799,6 +831,7 @@ Replaces existing transaction with same txid.
|
|
|
799
831
|
```ts
|
|
800
832
|
mergeRawTx(rawTx: number[], bumpIndex?: number): BeefTx
|
|
801
833
|
```
|
|
834
|
+
|
|
802
835
|
See also: [BeefTx](./transaction.md#class-beeftx)
|
|
803
836
|
|
|
804
837
|
Returns
|
|
@@ -807,8 +840,8 @@ txid of rawTx
|
|
|
807
840
|
|
|
808
841
|
Argument Details
|
|
809
842
|
|
|
810
|
-
|
|
811
|
-
|
|
843
|
+
- **bumpIndex**
|
|
844
|
+
- Optional. If a number, must be valid index into bumps array.
|
|
812
845
|
|
|
813
846
|
#### Method mergeTransaction
|
|
814
847
|
|
|
@@ -821,6 +854,7 @@ Attempts to match an existing bump to the new transaction.
|
|
|
821
854
|
```ts
|
|
822
855
|
mergeTransaction(tx: Transaction): BeefTx
|
|
823
856
|
```
|
|
857
|
+
|
|
824
858
|
See also: [BeefTx](./transaction.md#class-beeftx), [Transaction](./transaction.md#class-transaction)
|
|
825
859
|
|
|
826
860
|
Returns
|
|
@@ -837,12 +871,13 @@ removeExistingTxid(txid: string): void
|
|
|
837
871
|
|
|
838
872
|
Argument Details
|
|
839
873
|
|
|
840
|
-
|
|
841
|
-
|
|
874
|
+
- **txid**
|
|
875
|
+
- TXID of the transaction to remove
|
|
842
876
|
|
|
843
877
|
#### Method sortTxs
|
|
844
878
|
|
|
845
879
|
Sort the `txs` by input txid dependency order:
|
|
880
|
+
|
|
846
881
|
- Oldest Tx Anchored by Path or txid only
|
|
847
882
|
- Newer Txs depending on Older parents
|
|
848
883
|
- Newest Tx
|
|
@@ -920,6 +955,7 @@ Serializes this data to `writer`
|
|
|
920
955
|
```ts
|
|
921
956
|
toWriter(writer: Writer): void
|
|
922
957
|
```
|
|
958
|
+
|
|
923
959
|
See also: [Writer](./primitives.md#class-writer)
|
|
924
960
|
|
|
925
961
|
#### Method trimKnownTxids
|
|
@@ -937,6 +973,7 @@ by validating structure of this beef and confirming computed merkle roots
|
|
|
937
973
|
using `chainTracker`.
|
|
938
974
|
|
|
939
975
|
Validity requirements:
|
|
976
|
+
|
|
940
977
|
1. No 'known' txids, unless `allowTxidOnly` is true.
|
|
941
978
|
2. All transactions have bumps or their inputs chain back to bumps (or are known).
|
|
942
979
|
3. Order of transactions satisfies dependencies before dependents.
|
|
@@ -945,14 +982,15 @@ Validity requirements:
|
|
|
945
982
|
```ts
|
|
946
983
|
async verify(chainTracker: ChainTracker, allowTxidOnly?: boolean): Promise<boolean>
|
|
947
984
|
```
|
|
985
|
+
|
|
948
986
|
See also: [ChainTracker](./transaction.md#interface-chaintracker)
|
|
949
987
|
|
|
950
988
|
Argument Details
|
|
951
989
|
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
990
|
+
- **chainTracker**
|
|
991
|
+
- Used to verify computed merkle path roots for all bump txids.
|
|
992
|
+
- **allowTxidOnly**
|
|
993
|
+
- optional. If true, transaction txid is assumed valid
|
|
956
994
|
|
|
957
995
|
#### Method verifyValid
|
|
958
996
|
|
|
@@ -962,6 +1000,7 @@ by validating structure of this beef.
|
|
|
962
1000
|
Returns block heights and merkle root values to be confirmed by a chaintracker.
|
|
963
1001
|
|
|
964
1002
|
Validity requirements:
|
|
1003
|
+
|
|
965
1004
|
1. No 'known' txids, unless `allowTxidOnly` is true.
|
|
966
1005
|
2. All transactions have bumps or their inputs chain back to bumps (or are known).
|
|
967
1006
|
3. Order of transactions satisfies dependencies before dependents.
|
|
@@ -981,12 +1020,13 @@ Returns
|
|
|
981
1020
|
|
|
982
1021
|
Argument Details
|
|
983
1022
|
|
|
984
|
-
|
|
985
|
-
|
|
1023
|
+
- **allowTxidOnly**
|
|
1024
|
+
- optional. If true, transaction txid is assumed valid
|
|
986
1025
|
|
|
987
1026
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
988
1027
|
|
|
989
1028
|
---
|
|
1029
|
+
|
|
990
1030
|
### Class: BeefParty
|
|
991
1031
|
|
|
992
1032
|
Extends `Beef` that is used to exchange transaction validity data with more than one external party.
|
|
@@ -1031,8 +1071,8 @@ constructor(parties?: string[])
|
|
|
1031
1071
|
|
|
1032
1072
|
Argument Details
|
|
1033
1073
|
|
|
1034
|
-
|
|
1035
|
-
|
|
1074
|
+
- **parties**
|
|
1075
|
+
- Optional array of initial unique party identifiers.
|
|
1036
1076
|
|
|
1037
1077
|
#### Property knownTo
|
|
1038
1078
|
|
|
@@ -1053,8 +1093,8 @@ addKnownTxidsForParty(party: string, knownTxids: string[]): void
|
|
|
1053
1093
|
|
|
1054
1094
|
Argument Details
|
|
1055
1095
|
|
|
1056
|
-
|
|
1057
|
-
|
|
1096
|
+
- **party**
|
|
1097
|
+
- unique identifier, added if new.
|
|
1058
1098
|
|
|
1059
1099
|
#### Method addParty
|
|
1060
1100
|
|
|
@@ -1079,6 +1119,7 @@ Array of txids "known" to `party`.
|
|
|
1079
1119
|
```ts
|
|
1080
1120
|
getTrimmedBeefForParty(party: string): Beef
|
|
1081
1121
|
```
|
|
1122
|
+
|
|
1082
1123
|
See also: [Beef](./transaction.md#class-beef)
|
|
1083
1124
|
|
|
1084
1125
|
Returns
|
|
@@ -1106,11 +1147,13 @@ has raw transaction and validity proof data.
|
|
|
1106
1147
|
```ts
|
|
1107
1148
|
mergeBeefFromParty(party: string, beef: number[] | Beef): void
|
|
1108
1149
|
```
|
|
1150
|
+
|
|
1109
1151
|
See also: [Beef](./transaction.md#class-beef)
|
|
1110
1152
|
|
|
1111
1153
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
1112
1154
|
|
|
1113
1155
|
---
|
|
1156
|
+
|
|
1114
1157
|
### Class: BeefTx
|
|
1115
1158
|
|
|
1116
1159
|
A single bitcoin transaction associated with a `Beef` validity proof set.
|
|
@@ -1152,14 +1195,15 @@ See also: [Reader](./primitives.md#class-reader), [Transaction](./transaction.md
|
|
|
1152
1195
|
```ts
|
|
1153
1196
|
constructor(tx: Transaction | number[] | string, bumpIndex?: number)
|
|
1154
1197
|
```
|
|
1198
|
+
|
|
1155
1199
|
See also: [Transaction](./transaction.md#class-transaction)
|
|
1156
1200
|
|
|
1157
1201
|
Argument Details
|
|
1158
1202
|
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1203
|
+
- **tx**
|
|
1204
|
+
- If string, must be a valid txid. If `number[]` must be a valid serialized transaction.
|
|
1205
|
+
- **bumpIndex**
|
|
1206
|
+
- If transaction already has a proof in the beef to which it will be added.
|
|
1163
1207
|
|
|
1164
1208
|
#### Property isValid
|
|
1165
1209
|
|
|
@@ -1174,6 +1218,7 @@ isValid?: boolean = undefined
|
|
|
1174
1218
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
1175
1219
|
|
|
1176
1220
|
---
|
|
1221
|
+
|
|
1177
1222
|
### Class: FetchHttpClient
|
|
1178
1223
|
|
|
1179
1224
|
Adapter for Node Https module to be used as HttpClient
|
|
@@ -1190,6 +1235,7 @@ See also: [Fetch](./transaction.md#type-fetch), [HttpClient](./transaction.md#in
|
|
|
1190
1235
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
1191
1236
|
|
|
1192
1237
|
---
|
|
1238
|
+
|
|
1193
1239
|
### Class: MerklePath
|
|
1194
1240
|
|
|
1195
1241
|
Represents a Merkle Path, which is used to provide a compact proof of inclusion for a
|
|
@@ -1242,12 +1288,13 @@ Combines this MerklePath with another to create a compound proof.
|
|
|
1242
1288
|
```ts
|
|
1243
1289
|
combine(other: MerklePath): void
|
|
1244
1290
|
```
|
|
1291
|
+
|
|
1245
1292
|
See also: [MerklePath](./transaction.md#class-merklepath)
|
|
1246
1293
|
|
|
1247
1294
|
Argument Details
|
|
1248
1295
|
|
|
1249
|
-
|
|
1250
|
-
|
|
1296
|
+
- **other**
|
|
1297
|
+
- Another MerklePath to combine with this path.
|
|
1251
1298
|
|
|
1252
1299
|
Throws
|
|
1253
1300
|
|
|
@@ -1267,8 +1314,8 @@ Returns
|
|
|
1267
1314
|
|
|
1268
1315
|
Argument Details
|
|
1269
1316
|
|
|
1270
|
-
|
|
1271
|
-
|
|
1317
|
+
- **txid**
|
|
1318
|
+
- 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!
|
|
1272
1319
|
|
|
1273
1320
|
Throws
|
|
1274
1321
|
|
|
@@ -1283,6 +1330,7 @@ Does not add computed leaves to path.
|
|
|
1283
1330
|
```ts
|
|
1284
1331
|
findOrComputeLeaf(height: number, offset: number): MerklePathLeaf | undefined
|
|
1285
1332
|
```
|
|
1333
|
+
|
|
1286
1334
|
See also: [MerklePathLeaf](./transaction.md#interface-merklepathleaf)
|
|
1287
1335
|
|
|
1288
1336
|
#### Method fromBinary
|
|
@@ -1292,6 +1340,7 @@ Creates a MerklePath instance from a binary array.
|
|
|
1292
1340
|
```ts
|
|
1293
1341
|
static fromBinary(bump: number[]): MerklePath
|
|
1294
1342
|
```
|
|
1343
|
+
|
|
1295
1344
|
See also: [MerklePath](./transaction.md#class-merklepath)
|
|
1296
1345
|
|
|
1297
1346
|
Returns
|
|
@@ -1300,14 +1349,15 @@ Returns
|
|
|
1300
1349
|
|
|
1301
1350
|
Argument Details
|
|
1302
1351
|
|
|
1303
|
-
|
|
1304
|
-
|
|
1352
|
+
- **bump**
|
|
1353
|
+
- The binary array representation of the Merkle Path.
|
|
1305
1354
|
|
|
1306
1355
|
#### Method fromCoinbaseTxidAndHeight
|
|
1307
1356
|
|
|
1308
1357
|
```ts
|
|
1309
1358
|
static fromCoinbaseTxidAndHeight(txid: string, height: number): MerklePath
|
|
1310
1359
|
```
|
|
1360
|
+
|
|
1311
1361
|
See also: [MerklePath](./transaction.md#class-merklepath)
|
|
1312
1362
|
|
|
1313
1363
|
Returns
|
|
@@ -1316,10 +1366,10 @@ Returns
|
|
|
1316
1366
|
|
|
1317
1367
|
Argument Details
|
|
1318
1368
|
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1369
|
+
- **txid**
|
|
1370
|
+
- The coinbase txid.
|
|
1371
|
+
- **height**
|
|
1372
|
+
- The height of the block.
|
|
1323
1373
|
|
|
1324
1374
|
#### Method fromHex
|
|
1325
1375
|
|
|
@@ -1328,6 +1378,7 @@ Creates a MerklePath instance from a hexadecimal string.
|
|
|
1328
1378
|
```ts
|
|
1329
1379
|
static fromHex(hex: string): MerklePath
|
|
1330
1380
|
```
|
|
1381
|
+
|
|
1331
1382
|
See also: [MerklePath](./transaction.md#class-merklepath)
|
|
1332
1383
|
|
|
1333
1384
|
Returns
|
|
@@ -1336,8 +1387,8 @@ Returns
|
|
|
1336
1387
|
|
|
1337
1388
|
Argument Details
|
|
1338
1389
|
|
|
1339
|
-
|
|
1340
|
-
|
|
1390
|
+
- **hex**
|
|
1391
|
+
- The hexadecimal string representation of the Merkle Path.
|
|
1341
1392
|
|
|
1342
1393
|
#### Method toBinary
|
|
1343
1394
|
|
|
@@ -1380,6 +1431,7 @@ Verifies if the given transaction ID is part of the Merkle tree at the specified
|
|
|
1380
1431
|
```ts
|
|
1381
1432
|
async verify(txid: string, chainTracker: ChainTracker): Promise<boolean>
|
|
1382
1433
|
```
|
|
1434
|
+
|
|
1383
1435
|
See also: [ChainTracker](./transaction.md#interface-chaintracker)
|
|
1384
1436
|
|
|
1385
1437
|
Returns
|
|
@@ -1388,14 +1440,15 @@ Returns
|
|
|
1388
1440
|
|
|
1389
1441
|
Argument Details
|
|
1390
1442
|
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1443
|
+
- **txid**
|
|
1444
|
+
- The transaction ID to verify.
|
|
1445
|
+
- **chainTracker**
|
|
1446
|
+
- The ChainTracker instance used to verify the Merkle root.
|
|
1395
1447
|
|
|
1396
1448
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
1397
1449
|
|
|
1398
1450
|
---
|
|
1451
|
+
|
|
1399
1452
|
### Class: NodejsHttpClient
|
|
1400
1453
|
|
|
1401
1454
|
Adapter for Node Https module to be used as HttpClient
|
|
@@ -1412,6 +1465,7 @@ See also: [HttpClient](./transaction.md#interface-httpclient), [HttpClientReques
|
|
|
1412
1465
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
1413
1466
|
|
|
1414
1467
|
---
|
|
1468
|
+
|
|
1415
1469
|
### Class: SatoshisPerKilobyte
|
|
1416
1470
|
|
|
1417
1471
|
Represents the "satoshis per kilobyte" transaction fee model.
|
|
@@ -1436,8 +1490,8 @@ constructor(value: number)
|
|
|
1436
1490
|
|
|
1437
1491
|
Argument Details
|
|
1438
1492
|
|
|
1439
|
-
|
|
1440
|
-
|
|
1493
|
+
- **value**
|
|
1494
|
+
- The number of satoshis per kilobyte to charge as a fee.
|
|
1441
1495
|
|
|
1442
1496
|
#### Method computeFee
|
|
1443
1497
|
|
|
@@ -1446,6 +1500,7 @@ Computes the fee for a given transaction.
|
|
|
1446
1500
|
```ts
|
|
1447
1501
|
async computeFee(tx: Transaction): Promise<number>
|
|
1448
1502
|
```
|
|
1503
|
+
|
|
1449
1504
|
See also: [Transaction](./transaction.md#class-transaction)
|
|
1450
1505
|
|
|
1451
1506
|
Returns
|
|
@@ -1454,12 +1509,13 @@ The fee in satoshis for the transaction, as a BigNumber.
|
|
|
1454
1509
|
|
|
1455
1510
|
Argument Details
|
|
1456
1511
|
|
|
1457
|
-
|
|
1458
|
-
|
|
1512
|
+
- **tx**
|
|
1513
|
+
- The transaction for which a fee is to be computed.
|
|
1459
1514
|
|
|
1460
1515
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
1461
1516
|
|
|
1462
1517
|
---
|
|
1518
|
+
|
|
1463
1519
|
### Class: Transaction
|
|
1464
1520
|
|
|
1465
1521
|
Represents a complete Bitcoin transaction. This class encapsulates all the details
|
|
@@ -1540,12 +1596,13 @@ Adds a new input to the transaction.
|
|
|
1540
1596
|
```ts
|
|
1541
1597
|
addInput(input: TransactionInput): void
|
|
1542
1598
|
```
|
|
1599
|
+
|
|
1543
1600
|
See also: [TransactionInput](./transaction.md#interface-transactioninput)
|
|
1544
1601
|
|
|
1545
1602
|
Argument Details
|
|
1546
1603
|
|
|
1547
|
-
|
|
1548
|
-
|
|
1604
|
+
- **input**
|
|
1605
|
+
- The TransactionInput object to add to the transaction.
|
|
1549
1606
|
|
|
1550
1607
|
Throws
|
|
1551
1608
|
|
|
@@ -1558,12 +1615,13 @@ Adds a new output to the transaction.
|
|
|
1558
1615
|
```ts
|
|
1559
1616
|
addOutput(output: TransactionOutput): void
|
|
1560
1617
|
```
|
|
1618
|
+
|
|
1561
1619
|
See also: [TransactionOutput](./transaction.md#interface-transactionoutput)
|
|
1562
1620
|
|
|
1563
1621
|
Argument Details
|
|
1564
1622
|
|
|
1565
|
-
|
|
1566
|
-
|
|
1623
|
+
- **output**
|
|
1624
|
+
- The TransactionOutput object to add to the transaction.
|
|
1567
1625
|
|
|
1568
1626
|
#### Method addP2PKHOutput
|
|
1569
1627
|
|
|
@@ -1575,10 +1633,10 @@ addP2PKHOutput(address: number[] | string, satoshis?: number): void
|
|
|
1575
1633
|
|
|
1576
1634
|
Argument Details
|
|
1577
1635
|
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1636
|
+
- **address**
|
|
1637
|
+
- The P2PKH address of the output.
|
|
1638
|
+
- **satoshis**
|
|
1639
|
+
- The number of satoshis to send to the address - if not provided, the output is considered a change output.
|
|
1582
1640
|
|
|
1583
1641
|
#### Method broadcast
|
|
1584
1642
|
|
|
@@ -1587,6 +1645,7 @@ Broadcasts a transaction.
|
|
|
1587
1645
|
```ts
|
|
1588
1646
|
async broadcast(broadcaster: Broadcaster = defaultBroadcaster()): Promise<BroadcastResponse | BroadcastFailure>
|
|
1589
1647
|
```
|
|
1648
|
+
|
|
1590
1649
|
See also: [BroadcastFailure](./transaction.md#interface-broadcastfailure), [BroadcastResponse](./transaction.md#interface-broadcastresponse), [Broadcaster](./transaction.md#interface-broadcaster), [defaultBroadcaster](./transaction.md#function-defaultbroadcaster)
|
|
1591
1650
|
|
|
1592
1651
|
Returns
|
|
@@ -1595,8 +1654,8 @@ A BroadcastResponse or BroadcastFailure from the Broadcaster
|
|
|
1595
1654
|
|
|
1596
1655
|
Argument Details
|
|
1597
1656
|
|
|
1598
|
-
|
|
1599
|
-
|
|
1657
|
+
- **broadcaster**
|
|
1658
|
+
- The Broadcaster instance wwhere the transaction will be sent
|
|
1600
1659
|
|
|
1601
1660
|
#### Method fee
|
|
1602
1661
|
|
|
@@ -1607,14 +1666,15 @@ If fee is a number, the transaction uses that value as fee.
|
|
|
1607
1666
|
```ts
|
|
1608
1667
|
async fee(modelOrFee: FeeModel | number = new SatoshisPerKilobyte(1), changeDistribution: "equal" | "random" = "equal"): Promise<void>
|
|
1609
1668
|
```
|
|
1669
|
+
|
|
1610
1670
|
See also: [FeeModel](./transaction.md#interface-feemodel), [SatoshisPerKilobyte](./transaction.md#class-satoshisperkilobyte)
|
|
1611
1671
|
|
|
1612
1672
|
Argument Details
|
|
1613
1673
|
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1674
|
+
- **modelOrFee**
|
|
1675
|
+
- The initialized fee model to use or fixed fee for the transaction
|
|
1676
|
+
- **changeDistribution**
|
|
1677
|
+
- Specifies how the change should be distributed
|
|
1618
1678
|
amongst the change outputs
|
|
1619
1679
|
|
|
1620
1680
|
#### Method fromAtomicBEEF
|
|
@@ -1625,6 +1685,7 @@ Extracts the subject transaction and supporting merkle path and source transacti
|
|
|
1625
1685
|
```ts
|
|
1626
1686
|
static fromAtomicBEEF(beef: number[]): Transaction
|
|
1627
1687
|
```
|
|
1688
|
+
|
|
1628
1689
|
See also: [Transaction](./transaction.md#class-transaction)
|
|
1629
1690
|
|
|
1630
1691
|
Returns
|
|
@@ -1633,8 +1694,8 @@ The subject transaction, linked to its associated inputs populated with merkle p
|
|
|
1633
1694
|
|
|
1634
1695
|
Argument Details
|
|
1635
1696
|
|
|
1636
|
-
|
|
1637
|
-
|
|
1697
|
+
- **beef**
|
|
1698
|
+
- A binary representation of an Atomic BEEF structure.
|
|
1638
1699
|
|
|
1639
1700
|
#### Method fromBEEF
|
|
1640
1701
|
|
|
@@ -1646,6 +1707,7 @@ If no TXID is provided, the last transaction in the BEEF data is returned, or th
|
|
|
1646
1707
|
```ts
|
|
1647
1708
|
static fromBEEF(beef: number[], txid?: string): Transaction
|
|
1648
1709
|
```
|
|
1710
|
+
|
|
1649
1711
|
See also: [Transaction](./transaction.md#class-transaction)
|
|
1650
1712
|
|
|
1651
1713
|
Returns
|
|
@@ -1654,10 +1716,10 @@ An anchored transaction, linked to its associated inputs populated with merkle p
|
|
|
1654
1716
|
|
|
1655
1717
|
Argument Details
|
|
1656
1718
|
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1719
|
+
- **beef**
|
|
1720
|
+
- A binary representation of transactions in BEEF format.
|
|
1721
|
+
- **txid**
|
|
1722
|
+
- Optional TXID of the transaction to retrieve from the BEEF data.
|
|
1661
1723
|
|
|
1662
1724
|
#### Method fromBinary
|
|
1663
1725
|
|
|
@@ -1666,6 +1728,7 @@ Creates a Transaction instance from a binary array.
|
|
|
1666
1728
|
```ts
|
|
1667
1729
|
static fromBinary(bin: number[]): Transaction
|
|
1668
1730
|
```
|
|
1731
|
+
|
|
1669
1732
|
See also: [Transaction](./transaction.md#class-transaction)
|
|
1670
1733
|
|
|
1671
1734
|
Returns
|
|
@@ -1674,8 +1737,8 @@ Returns
|
|
|
1674
1737
|
|
|
1675
1738
|
Argument Details
|
|
1676
1739
|
|
|
1677
|
-
|
|
1678
|
-
|
|
1740
|
+
- **bin**
|
|
1741
|
+
- The binary array representation of the transaction.
|
|
1679
1742
|
|
|
1680
1743
|
#### Method fromEF
|
|
1681
1744
|
|
|
@@ -1684,6 +1747,7 @@ Creates a new transaction, linked to its inputs and their associated merkle path
|
|
|
1684
1747
|
```ts
|
|
1685
1748
|
static fromEF(ef: number[]): Transaction
|
|
1686
1749
|
```
|
|
1750
|
+
|
|
1687
1751
|
See also: [Transaction](./transaction.md#class-transaction)
|
|
1688
1752
|
|
|
1689
1753
|
Returns
|
|
@@ -1692,8 +1756,8 @@ An extended transaction, linked to its associated inputs by locking script and s
|
|
|
1692
1756
|
|
|
1693
1757
|
Argument Details
|
|
1694
1758
|
|
|
1695
|
-
|
|
1696
|
-
|
|
1759
|
+
- **ef**
|
|
1760
|
+
- A binary representation of a transaction in EF format.
|
|
1697
1761
|
|
|
1698
1762
|
#### Method fromHex
|
|
1699
1763
|
|
|
@@ -1702,6 +1766,7 @@ Creates a Transaction instance from a hexadecimal string.
|
|
|
1702
1766
|
```ts
|
|
1703
1767
|
static fromHex(hex: string): Transaction
|
|
1704
1768
|
```
|
|
1769
|
+
|
|
1705
1770
|
See also: [Transaction](./transaction.md#class-transaction)
|
|
1706
1771
|
|
|
1707
1772
|
Returns
|
|
@@ -1710,8 +1775,8 @@ Returns
|
|
|
1710
1775
|
|
|
1711
1776
|
Argument Details
|
|
1712
1777
|
|
|
1713
|
-
|
|
1714
|
-
|
|
1778
|
+
- **hex**
|
|
1779
|
+
- The hexadecimal string representation of the transaction.
|
|
1715
1780
|
|
|
1716
1781
|
#### Method fromHexBEEF
|
|
1717
1782
|
|
|
@@ -1723,6 +1788,7 @@ If no TXID is provided, the last transaction in the BEEF data is returned.
|
|
|
1723
1788
|
```ts
|
|
1724
1789
|
static fromHexBEEF(hex: string, txid?: string): Transaction
|
|
1725
1790
|
```
|
|
1791
|
+
|
|
1726
1792
|
See also: [Transaction](./transaction.md#class-transaction)
|
|
1727
1793
|
|
|
1728
1794
|
Returns
|
|
@@ -1731,10 +1797,10 @@ Returns
|
|
|
1731
1797
|
|
|
1732
1798
|
Argument Details
|
|
1733
1799
|
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1800
|
+
- **hex**
|
|
1801
|
+
- The hexadecimal string representation of the transaction BEEF.
|
|
1802
|
+
- **txid**
|
|
1803
|
+
- Optional TXID of the transaction to retrieve from the BEEF data.
|
|
1738
1804
|
|
|
1739
1805
|
#### Method fromHexEF
|
|
1740
1806
|
|
|
@@ -1743,6 +1809,7 @@ Creates a Transaction instance from a hexadecimal string encoded EF.
|
|
|
1743
1809
|
```ts
|
|
1744
1810
|
static fromHexEF(hex: string): Transaction
|
|
1745
1811
|
```
|
|
1812
|
+
|
|
1746
1813
|
See also: [Transaction](./transaction.md#class-transaction)
|
|
1747
1814
|
|
|
1748
1815
|
Returns
|
|
@@ -1751,8 +1818,8 @@ Returns
|
|
|
1751
1818
|
|
|
1752
1819
|
Argument Details
|
|
1753
1820
|
|
|
1754
|
-
|
|
1755
|
-
|
|
1821
|
+
- **hex**
|
|
1822
|
+
- The hexadecimal string representation of the transaction EF.
|
|
1756
1823
|
|
|
1757
1824
|
#### Method getFee
|
|
1758
1825
|
|
|
@@ -1780,8 +1847,8 @@ Returns
|
|
|
1780
1847
|
|
|
1781
1848
|
Argument Details
|
|
1782
1849
|
|
|
1783
|
-
|
|
1784
|
-
|
|
1850
|
+
- **enc**
|
|
1851
|
+
- The encoding to use for the hash. If 'hex', returns a hexadecimal string; otherwise returns a binary array.
|
|
1785
1852
|
|
|
1786
1853
|
#### Method id
|
|
1787
1854
|
|
|
@@ -1809,8 +1876,8 @@ Returns
|
|
|
1809
1876
|
|
|
1810
1877
|
Argument Details
|
|
1811
1878
|
|
|
1812
|
-
|
|
1813
|
-
|
|
1879
|
+
- **enc**
|
|
1880
|
+
- The encoding to use for the ID. If 'hex', returns a hexadecimal string.
|
|
1814
1881
|
|
|
1815
1882
|
#### Method id
|
|
1816
1883
|
|
|
@@ -1826,8 +1893,8 @@ Returns
|
|
|
1826
1893
|
|
|
1827
1894
|
Argument Details
|
|
1828
1895
|
|
|
1829
|
-
|
|
1830
|
-
|
|
1896
|
+
- **enc**
|
|
1897
|
+
- The encoding to use for the ID. If 'hex', returns a hexadecimal string; otherwise returns a binary array.
|
|
1831
1898
|
|
|
1832
1899
|
#### Method parseScriptOffsets
|
|
1833
1900
|
|
|
@@ -1862,8 +1929,8 @@ outputs: { vout: number, offset: number, length: number }[]
|
|
|
1862
1929
|
|
|
1863
1930
|
Argument Details
|
|
1864
1931
|
|
|
1865
|
-
|
|
1866
|
-
|
|
1932
|
+
- **bin**
|
|
1933
|
+
- binary transaction data
|
|
1867
1934
|
|
|
1868
1935
|
#### Method sign
|
|
1869
1936
|
|
|
@@ -1890,8 +1957,8 @@ Returns
|
|
|
1890
1957
|
|
|
1891
1958
|
Argument Details
|
|
1892
1959
|
|
|
1893
|
-
|
|
1894
|
-
|
|
1960
|
+
- **allowPartial**
|
|
1961
|
+
- If true, error will not be thrown if there are any missing sourceTransactions.
|
|
1895
1962
|
|
|
1896
1963
|
Throws
|
|
1897
1964
|
|
|
@@ -1911,8 +1978,8 @@ The serialized BEEF structure
|
|
|
1911
1978
|
|
|
1912
1979
|
Argument Details
|
|
1913
1980
|
|
|
1914
|
-
|
|
1915
|
-
|
|
1981
|
+
- **allowPartial**
|
|
1982
|
+
- If true, error will not be thrown if there are any missing sourceTransactions.
|
|
1916
1983
|
|
|
1917
1984
|
Throws
|
|
1918
1985
|
|
|
@@ -2000,8 +2067,8 @@ updateMetadata(metadata: Record<string, any>): void
|
|
|
2000
2067
|
|
|
2001
2068
|
Argument Details
|
|
2002
2069
|
|
|
2003
|
-
|
|
2004
|
-
|
|
2070
|
+
- **metadata**
|
|
2071
|
+
- The metadata object to merge into the existing metadata.
|
|
2005
2072
|
|
|
2006
2073
|
#### Method verify
|
|
2007
2074
|
|
|
@@ -2010,6 +2077,7 @@ Verifies the legitimacy of the Bitcoin transaction according to the rules of SPV
|
|
|
2010
2077
|
```ts
|
|
2011
2078
|
async verify(chainTracker: ChainTracker | "scripts only" = defaultChainTracker(), feeModel?: FeeModel, memoryLimit?: number): Promise<boolean>
|
|
2012
2079
|
```
|
|
2080
|
+
|
|
2013
2081
|
See also: [ChainTracker](./transaction.md#interface-chaintracker), [FeeModel](./transaction.md#interface-feemodel), [defaultChainTracker](./transaction.md#function-defaultchaintracker)
|
|
2014
2082
|
|
|
2015
2083
|
Returns
|
|
@@ -2018,12 +2086,12 @@ Whether the transaction is valid according to the rules of SPV.
|
|
|
2018
2086
|
|
|
2019
2087
|
Argument Details
|
|
2020
2088
|
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2089
|
+
- **chainTracker**
|
|
2090
|
+
- 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.
|
|
2091
|
+
- **feeModel**
|
|
2092
|
+
- An instance of FeeModel, a fee model to use for fee calculation. If not provided then the default fee model will be used.
|
|
2093
|
+
- **memoryLimit**
|
|
2094
|
+
- The maximum memory in bytes usage allowed for script evaluation. If not provided then the default memory limit will be used.
|
|
2027
2095
|
|
|
2028
2096
|
Example
|
|
2029
2097
|
|
|
@@ -2034,6 +2102,7 @@ tx.verify(new WhatsOnChain(), new SatoshisPerKilobyte(1))
|
|
|
2034
2102
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2035
2103
|
|
|
2036
2104
|
---
|
|
2105
|
+
|
|
2037
2106
|
### Class: WhatsOnChain
|
|
2038
2107
|
|
|
2039
2108
|
Represents a chain tracker based on What's On Chain .
|
|
@@ -2060,18 +2129,20 @@ Constructs an instance of the WhatsOnChain ChainTracker.
|
|
|
2060
2129
|
```ts
|
|
2061
2130
|
constructor(network: "main" | "test" | "stn" = "main", config: WhatsOnChainConfig = {})
|
|
2062
2131
|
```
|
|
2132
|
+
|
|
2063
2133
|
See also: [WhatsOnChainConfig](./transaction.md#interface-whatsonchainconfig)
|
|
2064
2134
|
|
|
2065
2135
|
Argument Details
|
|
2066
2136
|
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2137
|
+
- **network**
|
|
2138
|
+
- The BSV network to use when calling the WhatsOnChain API.
|
|
2139
|
+
- **config**
|
|
2140
|
+
- Configuration options for the WhatsOnChain ChainTracker.
|
|
2071
2141
|
|
|
2072
2142
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2073
2143
|
|
|
2074
2144
|
---
|
|
2145
|
+
|
|
2075
2146
|
## Functions
|
|
2076
2147
|
|
|
2077
2148
|
| |
|
|
@@ -2097,6 +2168,7 @@ See also: [ArcConfig](./transaction.md#interface-arcconfig), [Broadcaster](./tra
|
|
|
2097
2168
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2098
2169
|
|
|
2099
2170
|
---
|
|
2171
|
+
|
|
2100
2172
|
### Function: defaultChainTracker
|
|
2101
2173
|
|
|
2102
2174
|
```ts
|
|
@@ -2108,6 +2180,7 @@ See also: [ChainTracker](./transaction.md#interface-chaintracker)
|
|
|
2108
2180
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2109
2181
|
|
|
2110
2182
|
---
|
|
2183
|
+
|
|
2111
2184
|
### Function: defaultHttpClient
|
|
2112
2185
|
|
|
2113
2186
|
Returns a default HttpClient implementation based on the environment that it is run on.
|
|
@@ -2123,6 +2196,7 @@ See also: [HttpClient](./transaction.md#interface-httpclient)
|
|
|
2123
2196
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2124
2197
|
|
|
2125
2198
|
---
|
|
2199
|
+
|
|
2126
2200
|
### Function: isBroadcastFailure
|
|
2127
2201
|
|
|
2128
2202
|
Convenience type guard for response from `Broadcaster.broadcast`
|
|
@@ -2136,6 +2210,7 @@ See also: [BroadcastFailure](./transaction.md#interface-broadcastfailure), [Broa
|
|
|
2136
2210
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2137
2211
|
|
|
2138
2212
|
---
|
|
2213
|
+
|
|
2139
2214
|
### Function: isBroadcastResponse
|
|
2140
2215
|
|
|
2141
2216
|
Convenience type guard for response from `Broadcaster.broadcast`
|
|
@@ -2149,6 +2224,7 @@ See also: [BroadcastFailure](./transaction.md#interface-broadcastfailure), [Broa
|
|
|
2149
2224
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2150
2225
|
|
|
2151
2226
|
---
|
|
2227
|
+
|
|
2152
2228
|
## Types
|
|
2153
2229
|
|
|
2154
2230
|
| |
|
|
@@ -2175,6 +2251,7 @@ See also: [FetchOptions](./transaction.md#interface-fetchoptions)
|
|
|
2175
2251
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2176
2252
|
|
|
2177
2253
|
---
|
|
2254
|
+
|
|
2178
2255
|
### Type: HttpClientResponse
|
|
2179
2256
|
|
|
2180
2257
|
An interface for the response returned by the request method.
|
|
@@ -2196,6 +2273,7 @@ export type HttpClientResponse<T = any> = {
|
|
|
2196
2273
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2197
2274
|
|
|
2198
2275
|
---
|
|
2276
|
+
|
|
2199
2277
|
## Enums
|
|
2200
2278
|
|
|
2201
2279
|
### Enum: TX_DATA_FORMAT
|
|
@@ -2211,6 +2289,7 @@ export enum TX_DATA_FORMAT {
|
|
|
2211
2289
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2212
2290
|
|
|
2213
2291
|
---
|
|
2292
|
+
|
|
2214
2293
|
## Variables
|
|
2215
2294
|
|
|
2216
2295
|
| |
|
|
@@ -2232,6 +2311,7 @@ ATOMIC_BEEF = 16843009
|
|
|
2232
2311
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2233
2312
|
|
|
2234
2313
|
---
|
|
2314
|
+
|
|
2235
2315
|
### Variable: BEEF_V1
|
|
2236
2316
|
|
|
2237
2317
|
```ts
|
|
@@ -2241,6 +2321,7 @@ BEEF_V1 = 4022206465
|
|
|
2241
2321
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2242
2322
|
|
|
2243
2323
|
---
|
|
2324
|
+
|
|
2244
2325
|
### Variable: BEEF_V2
|
|
2245
2326
|
|
|
2246
2327
|
```ts
|