@bsv/sdk 1.8.0 → 1.8.2
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/kvstore/GlobalKVStore.js +420 -0
- package/dist/cjs/src/kvstore/GlobalKVStore.js.map +1 -0
- package/dist/cjs/src/kvstore/LocalKVStore.js +6 -6
- package/dist/cjs/src/kvstore/LocalKVStore.js.map +1 -1
- package/dist/cjs/src/kvstore/index.js +3 -1
- package/dist/cjs/src/kvstore/index.js.map +1 -1
- package/dist/cjs/src/kvstore/kvStoreInterpreter.js +74 -0
- package/dist/cjs/src/kvstore/kvStoreInterpreter.js.map +1 -0
- package/dist/cjs/src/kvstore/types.js +11 -0
- package/dist/cjs/src/kvstore/types.js.map +1 -0
- package/dist/cjs/src/overlay-tools/Historian.js +153 -0
- package/dist/cjs/src/overlay-tools/Historian.js.map +1 -0
- package/dist/cjs/src/script/templates/PushDrop.js +2 -2
- package/dist/cjs/src/script/templates/PushDrop.js.map +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/src/kvstore/GlobalKVStore.js +416 -0
- package/dist/esm/src/kvstore/GlobalKVStore.js.map +1 -0
- package/dist/esm/src/kvstore/LocalKVStore.js +6 -6
- package/dist/esm/src/kvstore/LocalKVStore.js.map +1 -1
- package/dist/esm/src/kvstore/index.js +1 -0
- package/dist/esm/src/kvstore/index.js.map +1 -1
- package/dist/esm/src/kvstore/kvStoreInterpreter.js +47 -0
- package/dist/esm/src/kvstore/kvStoreInterpreter.js.map +1 -0
- package/dist/esm/src/kvstore/types.js +8 -0
- package/dist/esm/src/kvstore/types.js.map +1 -0
- package/dist/esm/src/overlay-tools/Historian.js +155 -0
- package/dist/esm/src/overlay-tools/Historian.js.map +1 -0
- package/dist/esm/src/script/templates/PushDrop.js +2 -2
- package/dist/esm/src/script/templates/PushDrop.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/types/src/kvstore/GlobalKVStore.d.ts +129 -0
- package/dist/types/src/kvstore/GlobalKVStore.d.ts.map +1 -0
- package/dist/types/src/kvstore/index.d.ts +1 -0
- package/dist/types/src/kvstore/index.d.ts.map +1 -1
- package/dist/types/src/kvstore/kvStoreInterpreter.d.ts +22 -0
- package/dist/types/src/kvstore/kvStoreInterpreter.d.ts.map +1 -0
- package/dist/types/src/kvstore/types.d.ts +106 -0
- package/dist/types/src/kvstore/types.d.ts.map +1 -0
- package/dist/types/src/overlay-tools/Historian.d.ts +92 -0
- package/dist/types/src/overlay-tools/Historian.d.ts.map +1 -0
- package/dist/types/src/script/templates/PushDrop.d.ts +6 -5
- package/dist/types/src/script/templates/PushDrop.d.ts.map +1 -1
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/dist/umd/bundle.js +3 -3
- package/dist/umd/bundle.js.map +1 -1
- package/docs/reference/compat.md +15 -27
- package/docs/reference/identity.md +12 -16
- package/docs/reference/kvstore.md +471 -4
- package/docs/reference/messages.md +0 -8
- package/docs/reference/overlay-tools.md +15 -22
- package/docs/reference/primitives.md +168 -168
- package/docs/reference/registry.md +9 -19
- package/docs/reference/script.md +35 -48
- package/docs/reference/storage.md +10 -14
- package/docs/reference/totp.md +5 -5
- package/docs/reference/transaction.md +117 -69
- package/docs/reference/wallet.md +131 -135
- package/package.json +1 -1
- package/src/kvstore/GlobalKVStore.ts +478 -0
- package/src/kvstore/LocalKVStore.ts +7 -7
- package/src/kvstore/__tests/GlobalKVStore.test.ts +965 -0
- package/src/kvstore/__tests/LocalKVStore.test.ts +72 -0
- package/src/kvstore/index.ts +1 -0
- package/src/kvstore/kvStoreInterpreter.ts +49 -0
- package/src/kvstore/types.ts +114 -0
- package/src/overlay-tools/Historian.ts +195 -0
- package/src/overlay-tools/__tests/Historian.test.ts +690 -0
- package/src/script/templates/PushDrop.ts +6 -5
|
@@ -34,7 +34,7 @@ export interface ArcConfig {
|
|
|
34
34
|
}
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
See also: [HttpClient](
|
|
37
|
+
See also: [HttpClient](#interface-httpclient)
|
|
38
38
|
|
|
39
39
|
#### Property apiKey
|
|
40
40
|
|
|
@@ -83,7 +83,7 @@ The HTTP client used to make requests to the ARC API.
|
|
|
83
83
|
```ts
|
|
84
84
|
httpClient?: HttpClient
|
|
85
85
|
```
|
|
86
|
-
See also: [HttpClient](
|
|
86
|
+
See also: [HttpClient](#interface-httpclient)
|
|
87
87
|
|
|
88
88
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
89
89
|
|
|
@@ -133,7 +133,7 @@ export interface Broadcaster {
|
|
|
133
133
|
}
|
|
134
134
|
```
|
|
135
135
|
|
|
136
|
-
See also: [BroadcastFailure](
|
|
136
|
+
See also: [BroadcastFailure](#interface-broadcastfailure), [BroadcastResponse](#interface-broadcastresponse), [Transaction](#class-transaction)
|
|
137
137
|
|
|
138
138
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
139
139
|
|
|
@@ -181,7 +181,7 @@ export default interface FeeModel {
|
|
|
181
181
|
}
|
|
182
182
|
```
|
|
183
183
|
|
|
184
|
-
See also: [Transaction](
|
|
184
|
+
See also: [Transaction](#class-transaction)
|
|
185
185
|
|
|
186
186
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
187
187
|
|
|
@@ -236,7 +236,7 @@ export interface HttpClient {
|
|
|
236
236
|
}
|
|
237
237
|
```
|
|
238
238
|
|
|
239
|
-
See also: [HttpClientRequestOptions](
|
|
239
|
+
See also: [HttpClientRequestOptions](#interface-httpclientrequestoptions), [HttpClientResponse](#type-httpclientresponse)
|
|
240
240
|
|
|
241
241
|
#### Property request
|
|
242
242
|
|
|
@@ -245,7 +245,7 @@ Makes a request to the server.
|
|
|
245
245
|
```ts
|
|
246
246
|
request: <T = any, D = any>(url: string, options: HttpClientRequestOptions<D>) => Promise<HttpClientResponse<T>>
|
|
247
247
|
```
|
|
248
|
-
See also: [HttpClientRequestOptions](
|
|
248
|
+
See also: [HttpClientRequestOptions](#interface-httpclientrequestoptions), [HttpClientResponse](#type-httpclientresponse)
|
|
249
249
|
|
|
250
250
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
251
251
|
|
|
@@ -308,7 +308,7 @@ export interface HttpsNodejs {
|
|
|
308
308
|
}
|
|
309
309
|
```
|
|
310
310
|
|
|
311
|
-
See also: [HttpClientRequestOptions](
|
|
311
|
+
See also: [HttpClientRequestOptions](#interface-httpclientrequestoptions), [NodejsHttpClientRequest](#interface-nodejshttpclientrequest)
|
|
312
312
|
|
|
313
313
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
314
314
|
|
|
@@ -379,7 +379,7 @@ export default interface TransactionInput {
|
|
|
379
379
|
}
|
|
380
380
|
```
|
|
381
381
|
|
|
382
|
-
See also: [Transaction](
|
|
382
|
+
See also: [Transaction](#class-transaction)
|
|
383
383
|
|
|
384
384
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
385
385
|
|
|
@@ -409,8 +409,6 @@ export default interface TransactionOutput {
|
|
|
409
409
|
}
|
|
410
410
|
```
|
|
411
411
|
|
|
412
|
-
See also: [LockingScript](./script.md#class-lockingscript)
|
|
413
|
-
|
|
414
412
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
415
413
|
|
|
416
414
|
---
|
|
@@ -425,7 +423,7 @@ export interface WhatsOnChainConfig {
|
|
|
425
423
|
}
|
|
426
424
|
```
|
|
427
425
|
|
|
428
|
-
See also: [HttpClient](
|
|
426
|
+
See also: [HttpClient](#interface-httpclient)
|
|
429
427
|
|
|
430
428
|
#### Property apiKey
|
|
431
429
|
|
|
@@ -442,7 +440,7 @@ The HTTP client used to make requests to the API.
|
|
|
442
440
|
```ts
|
|
443
441
|
httpClient?: HttpClient
|
|
444
442
|
```
|
|
445
|
-
See also: [HttpClient](
|
|
443
|
+
See also: [HttpClient](#interface-httpclient)
|
|
446
444
|
|
|
447
445
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
448
446
|
|
|
@@ -459,6 +457,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
459
457
|
| [LivePolicy](#class-livepolicy) |
|
|
460
458
|
| [MerklePath](#class-merklepath) |
|
|
461
459
|
| [NodejsHttpClient](#class-nodejshttpclient) |
|
|
460
|
+
| [SatoshisPerKilobyte](#class-satoshisperkilobyte) |
|
|
462
461
|
| [Transaction](#class-transaction) |
|
|
463
462
|
| [WhatsOnChain](#class-whatsonchain) |
|
|
464
463
|
|
|
@@ -486,7 +485,7 @@ export default class ARC implements Broadcaster {
|
|
|
486
485
|
}
|
|
487
486
|
```
|
|
488
487
|
|
|
489
|
-
See also: [ArcConfig](
|
|
488
|
+
See also: [ArcConfig](#interface-arcconfig), [BroadcastFailure](#interface-broadcastfailure), [BroadcastResponse](#interface-broadcastresponse), [Broadcaster](#interface-broadcaster), [Transaction](#class-transaction)
|
|
490
489
|
|
|
491
490
|
#### Constructor
|
|
492
491
|
|
|
@@ -495,7 +494,7 @@ Constructs an instance of the ARC broadcaster.
|
|
|
495
494
|
```ts
|
|
496
495
|
constructor(URL: string, config?: ArcConfig)
|
|
497
496
|
```
|
|
498
|
-
See also: [ArcConfig](
|
|
497
|
+
See also: [ArcConfig](#interface-arcconfig)
|
|
499
498
|
|
|
500
499
|
Argument Details
|
|
501
500
|
|
|
@@ -526,7 +525,7 @@ Broadcasts a transaction via ARC.
|
|
|
526
525
|
```ts
|
|
527
526
|
async broadcast(tx: Transaction): Promise<BroadcastResponse | BroadcastFailure>
|
|
528
527
|
```
|
|
529
|
-
See also: [BroadcastFailure](
|
|
528
|
+
See also: [BroadcastFailure](#interface-broadcastfailure), [BroadcastResponse](#interface-broadcastresponse), [Transaction](#class-transaction)
|
|
530
529
|
|
|
531
530
|
Returns
|
|
532
531
|
|
|
@@ -545,7 +544,7 @@ Handles mixed responses where some transactions succeed and others fail.
|
|
|
545
544
|
```ts
|
|
546
545
|
async broadcastMany(txs: Transaction[]): Promise<object[]>
|
|
547
546
|
```
|
|
548
|
-
See also: [Transaction](
|
|
547
|
+
See also: [Transaction](#class-transaction)
|
|
549
548
|
|
|
550
549
|
Returns
|
|
551
550
|
|
|
@@ -608,7 +607,7 @@ export class Beef {
|
|
|
608
607
|
}
|
|
609
608
|
```
|
|
610
609
|
|
|
611
|
-
See also: [BEEF_V2](
|
|
610
|
+
See also: [BEEF_V2](#variable-beef_v2), [BeefTx](#class-beeftx), [ChainTracker](#interface-chaintracker), [MerklePath](#class-merklepath), [Transaction](#class-transaction)
|
|
612
611
|
|
|
613
612
|
#### Method addComputedLeaves
|
|
614
613
|
|
|
@@ -624,7 +623,7 @@ addComputedLeaves(): void
|
|
|
624
623
|
```ts
|
|
625
624
|
clone(): Beef
|
|
626
625
|
```
|
|
627
|
-
See also: [Beef](
|
|
626
|
+
See also: [Beef](#class-beef)
|
|
628
627
|
|
|
629
628
|
Returns
|
|
630
629
|
|
|
@@ -639,7 +638,7 @@ To succeed, the Beef must contain all the required transaction and merkle path d
|
|
|
639
638
|
```ts
|
|
640
639
|
findAtomicTransaction(txid: string): Transaction | undefined
|
|
641
640
|
```
|
|
642
|
-
See also: [Transaction](
|
|
641
|
+
See also: [Transaction](#class-transaction)
|
|
643
642
|
|
|
644
643
|
Returns
|
|
645
644
|
|
|
@@ -655,7 +654,7 @@ Argument Details
|
|
|
655
654
|
```ts
|
|
656
655
|
findBump(txid: string): MerklePath | undefined
|
|
657
656
|
```
|
|
658
|
-
See also: [MerklePath](
|
|
657
|
+
See also: [MerklePath](#class-merklepath)
|
|
659
658
|
|
|
660
659
|
Returns
|
|
661
660
|
|
|
@@ -671,7 +670,7 @@ The result is suitable for signing.
|
|
|
671
670
|
```ts
|
|
672
671
|
findTransactionForSigning(txid: string): Transaction | undefined
|
|
673
672
|
```
|
|
674
|
-
See also: [Transaction](
|
|
673
|
+
See also: [Transaction](#class-transaction)
|
|
675
674
|
|
|
676
675
|
Returns
|
|
677
676
|
|
|
@@ -687,7 +686,7 @@ Argument Details
|
|
|
687
686
|
```ts
|
|
688
687
|
findTxid(txid: string): BeefTx | undefined
|
|
689
688
|
```
|
|
690
|
-
See also: [BeefTx](
|
|
689
|
+
See also: [BeefTx](#class-beeftx)
|
|
691
690
|
|
|
692
691
|
Returns
|
|
693
692
|
|
|
@@ -705,7 +704,7 @@ Constructs an instance of the Beef class based on the provided binary array
|
|
|
705
704
|
```ts
|
|
706
705
|
static fromBinary(bin: number[]): Beef
|
|
707
706
|
```
|
|
708
|
-
See also: [Beef](
|
|
707
|
+
See also: [Beef](#class-beef)
|
|
709
708
|
|
|
710
709
|
Returns
|
|
711
710
|
|
|
@@ -723,7 +722,7 @@ Constructs an instance of the Beef class based on the provided string
|
|
|
723
722
|
```ts
|
|
724
723
|
static fromString(s: string, enc: "hex" | "utf8" | "base64" = "hex"): Beef
|
|
725
724
|
```
|
|
726
|
-
See also: [Beef](
|
|
725
|
+
See also: [Beef](#class-beef)
|
|
727
726
|
|
|
728
727
|
Returns
|
|
729
728
|
|
|
@@ -778,7 +777,7 @@ original.
|
|
|
778
777
|
```ts
|
|
779
778
|
makeTxidOnly(txid: string): BeefTx | undefined
|
|
780
779
|
```
|
|
781
|
-
See also: [BeefTx](
|
|
780
|
+
See also: [BeefTx](#class-beeftx)
|
|
782
781
|
|
|
783
782
|
Returns
|
|
784
783
|
|
|
@@ -791,7 +790,7 @@ Merge a MerklePath that is assumed to be fully valid.
|
|
|
791
790
|
```ts
|
|
792
791
|
mergeBump(bump: MerklePath): number
|
|
793
792
|
```
|
|
794
|
-
See also: [MerklePath](
|
|
793
|
+
See also: [MerklePath](#class-merklepath)
|
|
795
794
|
|
|
796
795
|
Returns
|
|
797
796
|
|
|
@@ -808,7 +807,7 @@ Replaces existing transaction with same txid.
|
|
|
808
807
|
```ts
|
|
809
808
|
mergeRawTx(rawTx: number[], bumpIndex?: number): BeefTx
|
|
810
809
|
```
|
|
811
|
-
See also: [BeefTx](
|
|
810
|
+
See also: [BeefTx](#class-beeftx)
|
|
812
811
|
|
|
813
812
|
Returns
|
|
814
813
|
|
|
@@ -830,7 +829,7 @@ Attempts to match an existing bump to the new transaction.
|
|
|
830
829
|
```ts
|
|
831
830
|
mergeTransaction(tx: Transaction): BeefTx
|
|
832
831
|
```
|
|
833
|
-
See also: [BeefTx](
|
|
832
|
+
See also: [BeefTx](#class-beeftx), [Transaction](#class-transaction)
|
|
834
833
|
|
|
835
834
|
Returns
|
|
836
835
|
|
|
@@ -929,7 +928,6 @@ Serializes this data to `writer`
|
|
|
929
928
|
```ts
|
|
930
929
|
toWriter(writer: Writer): void
|
|
931
930
|
```
|
|
932
|
-
See also: [Writer](./primitives.md#class-writer)
|
|
933
931
|
|
|
934
932
|
#### Method trimKnownTxids
|
|
935
933
|
|
|
@@ -954,7 +952,7 @@ Validity requirements:
|
|
|
954
952
|
```ts
|
|
955
953
|
async verify(chainTracker: ChainTracker, allowTxidOnly?: boolean): Promise<boolean>
|
|
956
954
|
```
|
|
957
|
-
See also: [ChainTracker](
|
|
955
|
+
See also: [ChainTracker](#interface-chaintracker)
|
|
958
956
|
|
|
959
957
|
Argument Details
|
|
960
958
|
|
|
@@ -1030,7 +1028,7 @@ export class BeefParty extends Beef {
|
|
|
1030
1028
|
}
|
|
1031
1029
|
```
|
|
1032
1030
|
|
|
1033
|
-
See also: [Beef](
|
|
1031
|
+
See also: [Beef](#class-beef)
|
|
1034
1032
|
|
|
1035
1033
|
#### Constructor
|
|
1036
1034
|
|
|
@@ -1088,7 +1086,7 @@ Array of txids "known" to `party`.
|
|
|
1088
1086
|
```ts
|
|
1089
1087
|
getTrimmedBeefForParty(party: string): Beef
|
|
1090
1088
|
```
|
|
1091
|
-
See also: [Beef](
|
|
1089
|
+
See also: [Beef](#class-beef)
|
|
1092
1090
|
|
|
1093
1091
|
Returns
|
|
1094
1092
|
|
|
@@ -1115,7 +1113,7 @@ has raw transaction and validity proof data.
|
|
|
1115
1113
|
```ts
|
|
1116
1114
|
mergeBeefFromParty(party: string, beef: number[] | Beef): void
|
|
1117
1115
|
```
|
|
1118
|
-
See also: [Beef](
|
|
1116
|
+
See also: [Beef](#class-beef)
|
|
1119
1117
|
|
|
1120
1118
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
1121
1119
|
|
|
@@ -1154,14 +1152,14 @@ export default class BeefTx {
|
|
|
1154
1152
|
}
|
|
1155
1153
|
```
|
|
1156
1154
|
|
|
1157
|
-
See also: [
|
|
1155
|
+
See also: [Transaction](#class-transaction)
|
|
1158
1156
|
|
|
1159
1157
|
#### Constructor
|
|
1160
1158
|
|
|
1161
1159
|
```ts
|
|
1162
1160
|
constructor(tx: Transaction | number[] | string, bumpIndex?: number)
|
|
1163
1161
|
```
|
|
1164
|
-
See also: [Transaction](
|
|
1162
|
+
See also: [Transaction](#class-transaction)
|
|
1165
1163
|
|
|
1166
1164
|
Argument Details
|
|
1167
1165
|
|
|
@@ -1194,7 +1192,7 @@ export class FetchHttpClient implements HttpClient {
|
|
|
1194
1192
|
}
|
|
1195
1193
|
```
|
|
1196
1194
|
|
|
1197
|
-
See also: [Fetch](
|
|
1195
|
+
See also: [Fetch](#type-fetch), [HttpClient](#interface-httpclient), [HttpClientRequestOptions](#interface-httpclientrequestoptions), [HttpClientResponse](#type-httpclientresponse)
|
|
1198
1196
|
|
|
1199
1197
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
1200
1198
|
|
|
@@ -1202,16 +1200,17 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
1202
1200
|
### Class: LivePolicy
|
|
1203
1201
|
|
|
1204
1202
|
Represents a live fee policy that fetches current rates from ARC GorillaPool.
|
|
1203
|
+
Extends SatoshisPerKilobyte to reuse transaction size calculation logic.
|
|
1205
1204
|
|
|
1206
1205
|
```ts
|
|
1207
|
-
export default class LivePolicy
|
|
1206
|
+
export default class LivePolicy extends SatoshisPerKilobyte {
|
|
1208
1207
|
constructor(cacheValidityMs: number = 5 * 60 * 1000)
|
|
1209
1208
|
static getInstance(cacheValidityMs: number = 5 * 60 * 1000): LivePolicy
|
|
1210
1209
|
async computeFee(tx: Transaction): Promise<number>
|
|
1211
1210
|
}
|
|
1212
1211
|
```
|
|
1213
1212
|
|
|
1214
|
-
See also: [
|
|
1213
|
+
See also: [SatoshisPerKilobyte](#class-satoshisperkilobyte), [Transaction](#class-transaction)
|
|
1215
1214
|
|
|
1216
1215
|
#### Constructor
|
|
1217
1216
|
|
|
@@ -1229,11 +1228,12 @@ Argument Details
|
|
|
1229
1228
|
#### Method computeFee
|
|
1230
1229
|
|
|
1231
1230
|
Computes the fee for a given transaction using the current live rate.
|
|
1231
|
+
Overrides the parent method to use dynamic rate fetching.
|
|
1232
1232
|
|
|
1233
1233
|
```ts
|
|
1234
1234
|
async computeFee(tx: Transaction): Promise<number>
|
|
1235
1235
|
```
|
|
1236
|
-
See also: [Transaction](
|
|
1236
|
+
See also: [Transaction](#class-transaction)
|
|
1237
1237
|
|
|
1238
1238
|
Returns
|
|
1239
1239
|
|
|
@@ -1251,7 +1251,7 @@ Gets the singleton instance of LivePolicy to ensure cache sharing across the app
|
|
|
1251
1251
|
```ts
|
|
1252
1252
|
static getInstance(cacheValidityMs: number = 5 * 60 * 1000): LivePolicy
|
|
1253
1253
|
```
|
|
1254
|
-
See also: [LivePolicy](
|
|
1254
|
+
See also: [LivePolicy](#class-livepolicy)
|
|
1255
1255
|
|
|
1256
1256
|
Returns
|
|
1257
1257
|
|
|
@@ -1308,7 +1308,7 @@ export default class MerklePath {
|
|
|
1308
1308
|
}
|
|
1309
1309
|
```
|
|
1310
1310
|
|
|
1311
|
-
See also: [ChainTracker](
|
|
1311
|
+
See also: [ChainTracker](#interface-chaintracker), [MerklePathLeaf](#interface-merklepathleaf)
|
|
1312
1312
|
|
|
1313
1313
|
#### Method combine
|
|
1314
1314
|
|
|
@@ -1317,7 +1317,7 @@ Combines this MerklePath with another to create a compound proof.
|
|
|
1317
1317
|
```ts
|
|
1318
1318
|
combine(other: MerklePath): void
|
|
1319
1319
|
```
|
|
1320
|
-
See also: [MerklePath](
|
|
1320
|
+
See also: [MerklePath](#class-merklepath)
|
|
1321
1321
|
|
|
1322
1322
|
Argument Details
|
|
1323
1323
|
|
|
@@ -1358,7 +1358,7 @@ Does not add computed leaves to path.
|
|
|
1358
1358
|
```ts
|
|
1359
1359
|
findOrComputeLeaf(height: number, offset: number): MerklePathLeaf | undefined
|
|
1360
1360
|
```
|
|
1361
|
-
See also: [MerklePathLeaf](
|
|
1361
|
+
See also: [MerklePathLeaf](#interface-merklepathleaf)
|
|
1362
1362
|
|
|
1363
1363
|
#### Method fromBinary
|
|
1364
1364
|
|
|
@@ -1367,7 +1367,7 @@ Creates a MerklePath instance from a binary array.
|
|
|
1367
1367
|
```ts
|
|
1368
1368
|
static fromBinary(bump: number[]): MerklePath
|
|
1369
1369
|
```
|
|
1370
|
-
See also: [MerklePath](
|
|
1370
|
+
See also: [MerklePath](#class-merklepath)
|
|
1371
1371
|
|
|
1372
1372
|
Returns
|
|
1373
1373
|
|
|
@@ -1383,7 +1383,7 @@ Argument Details
|
|
|
1383
1383
|
```ts
|
|
1384
1384
|
static fromCoinbaseTxidAndHeight(txid: string, height: number): MerklePath
|
|
1385
1385
|
```
|
|
1386
|
-
See also: [MerklePath](
|
|
1386
|
+
See also: [MerklePath](#class-merklepath)
|
|
1387
1387
|
|
|
1388
1388
|
Returns
|
|
1389
1389
|
|
|
@@ -1403,7 +1403,7 @@ Creates a MerklePath instance from a hexadecimal string.
|
|
|
1403
1403
|
```ts
|
|
1404
1404
|
static fromHex(hex: string): MerklePath
|
|
1405
1405
|
```
|
|
1406
|
-
See also: [MerklePath](
|
|
1406
|
+
See also: [MerklePath](#class-merklepath)
|
|
1407
1407
|
|
|
1408
1408
|
Returns
|
|
1409
1409
|
|
|
@@ -1455,7 +1455,7 @@ Verifies if the given transaction ID is part of the Merkle tree at the specified
|
|
|
1455
1455
|
```ts
|
|
1456
1456
|
async verify(txid: string, chainTracker: ChainTracker): Promise<boolean>
|
|
1457
1457
|
```
|
|
1458
|
-
See also: [ChainTracker](
|
|
1458
|
+
See also: [ChainTracker](#interface-chaintracker)
|
|
1459
1459
|
|
|
1460
1460
|
Returns
|
|
1461
1461
|
|
|
@@ -1482,7 +1482,55 @@ export class NodejsHttpClient implements HttpClient {
|
|
|
1482
1482
|
}
|
|
1483
1483
|
```
|
|
1484
1484
|
|
|
1485
|
-
See also: [HttpClient](
|
|
1485
|
+
See also: [HttpClient](#interface-httpclient), [HttpClientRequestOptions](#interface-httpclientrequestoptions), [HttpClientResponse](#type-httpclientresponse), [HttpsNodejs](#interface-httpsnodejs)
|
|
1486
|
+
|
|
1487
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
1488
|
+
|
|
1489
|
+
---
|
|
1490
|
+
### Class: SatoshisPerKilobyte
|
|
1491
|
+
|
|
1492
|
+
Represents the "satoshis per kilobyte" transaction fee model.
|
|
1493
|
+
|
|
1494
|
+
```ts
|
|
1495
|
+
export default class SatoshisPerKilobyte implements FeeModel {
|
|
1496
|
+
value: number;
|
|
1497
|
+
constructor(value: number)
|
|
1498
|
+
async computeFee(tx: Transaction): Promise<number>
|
|
1499
|
+
}
|
|
1500
|
+
```
|
|
1501
|
+
|
|
1502
|
+
See also: [FeeModel](#interface-feemodel), [Transaction](#class-transaction)
|
|
1503
|
+
|
|
1504
|
+
#### Constructor
|
|
1505
|
+
|
|
1506
|
+
Constructs an instance of the sat/kb fee model.
|
|
1507
|
+
|
|
1508
|
+
```ts
|
|
1509
|
+
constructor(value: number)
|
|
1510
|
+
```
|
|
1511
|
+
|
|
1512
|
+
Argument Details
|
|
1513
|
+
|
|
1514
|
+
+ **value**
|
|
1515
|
+
+ The number of satoshis per kilobyte to charge as a fee.
|
|
1516
|
+
|
|
1517
|
+
#### Method computeFee
|
|
1518
|
+
|
|
1519
|
+
Computes the fee for a given transaction.
|
|
1520
|
+
|
|
1521
|
+
```ts
|
|
1522
|
+
async computeFee(tx: Transaction): Promise<number>
|
|
1523
|
+
```
|
|
1524
|
+
See also: [Transaction](#class-transaction)
|
|
1525
|
+
|
|
1526
|
+
Returns
|
|
1527
|
+
|
|
1528
|
+
The fee in satoshis for the transaction, as a BigNumber.
|
|
1529
|
+
|
|
1530
|
+
Argument Details
|
|
1531
|
+
|
|
1532
|
+
+ **tx**
|
|
1533
|
+
+ The transaction for which a fee is to be computed.
|
|
1486
1534
|
|
|
1487
1535
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
1488
1536
|
|
|
@@ -1558,7 +1606,7 @@ export default class Transaction {
|
|
|
1558
1606
|
}
|
|
1559
1607
|
```
|
|
1560
1608
|
|
|
1561
|
-
See also: [BroadcastFailure](
|
|
1609
|
+
See also: [BroadcastFailure](#interface-broadcastfailure), [BroadcastResponse](#interface-broadcastresponse), [Broadcaster](#interface-broadcaster), [ChainTracker](#interface-chaintracker), [FeeModel](#interface-feemodel), [LivePolicy](#class-livepolicy), [MerklePath](#class-merklepath), [TransactionInput](#interface-transactioninput), [TransactionOutput](#interface-transactionoutput), [defaultBroadcaster](#function-defaultbroadcaster), [defaultChainTracker](#function-defaultchaintracker)
|
|
1562
1610
|
|
|
1563
1611
|
#### Method addInput
|
|
1564
1612
|
|
|
@@ -1567,7 +1615,7 @@ Adds a new input to the transaction.
|
|
|
1567
1615
|
```ts
|
|
1568
1616
|
addInput(input: TransactionInput): void
|
|
1569
1617
|
```
|
|
1570
|
-
See also: [TransactionInput](
|
|
1618
|
+
See also: [TransactionInput](#interface-transactioninput)
|
|
1571
1619
|
|
|
1572
1620
|
Argument Details
|
|
1573
1621
|
|
|
@@ -1585,7 +1633,7 @@ Adds a new output to the transaction.
|
|
|
1585
1633
|
```ts
|
|
1586
1634
|
addOutput(output: TransactionOutput): void
|
|
1587
1635
|
```
|
|
1588
|
-
See also: [TransactionOutput](
|
|
1636
|
+
See also: [TransactionOutput](#interface-transactionoutput)
|
|
1589
1637
|
|
|
1590
1638
|
Argument Details
|
|
1591
1639
|
|
|
@@ -1614,7 +1662,7 @@ Broadcasts a transaction.
|
|
|
1614
1662
|
```ts
|
|
1615
1663
|
async broadcast(broadcaster: Broadcaster = defaultBroadcaster()): Promise<BroadcastResponse | BroadcastFailure>
|
|
1616
1664
|
```
|
|
1617
|
-
See also: [BroadcastFailure](
|
|
1665
|
+
See also: [BroadcastFailure](#interface-broadcastfailure), [BroadcastResponse](#interface-broadcastresponse), [Broadcaster](#interface-broadcaster), [defaultBroadcaster](#function-defaultbroadcaster)
|
|
1618
1666
|
|
|
1619
1667
|
Returns
|
|
1620
1668
|
|
|
@@ -1634,7 +1682,7 @@ If fee is a number, the transaction uses that value as fee.
|
|
|
1634
1682
|
```ts
|
|
1635
1683
|
async fee(modelOrFee: FeeModel | number = LivePolicy.getInstance(), changeDistribution: "equal" | "random" = "equal"): Promise<void>
|
|
1636
1684
|
```
|
|
1637
|
-
See also: [FeeModel](
|
|
1685
|
+
See also: [FeeModel](#interface-feemodel), [LivePolicy](#class-livepolicy)
|
|
1638
1686
|
|
|
1639
1687
|
Argument Details
|
|
1640
1688
|
|
|
@@ -1652,7 +1700,7 @@ Extracts the subject transaction and supporting merkle path and source transacti
|
|
|
1652
1700
|
```ts
|
|
1653
1701
|
static fromAtomicBEEF(beef: number[]): Transaction
|
|
1654
1702
|
```
|
|
1655
|
-
See also: [Transaction](
|
|
1703
|
+
See also: [Transaction](#class-transaction)
|
|
1656
1704
|
|
|
1657
1705
|
Returns
|
|
1658
1706
|
|
|
@@ -1673,7 +1721,7 @@ If no TXID is provided, the last transaction in the BEEF data is returned, or th
|
|
|
1673
1721
|
```ts
|
|
1674
1722
|
static fromBEEF(beef: number[], txid?: string): Transaction
|
|
1675
1723
|
```
|
|
1676
|
-
See also: [Transaction](
|
|
1724
|
+
See also: [Transaction](#class-transaction)
|
|
1677
1725
|
|
|
1678
1726
|
Returns
|
|
1679
1727
|
|
|
@@ -1693,7 +1741,7 @@ Creates a Transaction instance from a binary array.
|
|
|
1693
1741
|
```ts
|
|
1694
1742
|
static fromBinary(bin: number[]): Transaction
|
|
1695
1743
|
```
|
|
1696
|
-
See also: [Transaction](
|
|
1744
|
+
See also: [Transaction](#class-transaction)
|
|
1697
1745
|
|
|
1698
1746
|
Returns
|
|
1699
1747
|
|
|
@@ -1711,7 +1759,7 @@ Creates a new transaction, linked to its inputs and their associated merkle path
|
|
|
1711
1759
|
```ts
|
|
1712
1760
|
static fromEF(ef: number[]): Transaction
|
|
1713
1761
|
```
|
|
1714
|
-
See also: [Transaction](
|
|
1762
|
+
See also: [Transaction](#class-transaction)
|
|
1715
1763
|
|
|
1716
1764
|
Returns
|
|
1717
1765
|
|
|
@@ -1729,7 +1777,7 @@ Creates a Transaction instance from a hexadecimal string.
|
|
|
1729
1777
|
```ts
|
|
1730
1778
|
static fromHex(hex: string): Transaction
|
|
1731
1779
|
```
|
|
1732
|
-
See also: [Transaction](
|
|
1780
|
+
See also: [Transaction](#class-transaction)
|
|
1733
1781
|
|
|
1734
1782
|
Returns
|
|
1735
1783
|
|
|
@@ -1750,7 +1798,7 @@ If no TXID is provided, the last transaction in the BEEF data is returned.
|
|
|
1750
1798
|
```ts
|
|
1751
1799
|
static fromHexBEEF(hex: string, txid?: string): Transaction
|
|
1752
1800
|
```
|
|
1753
|
-
See also: [Transaction](
|
|
1801
|
+
See also: [Transaction](#class-transaction)
|
|
1754
1802
|
|
|
1755
1803
|
Returns
|
|
1756
1804
|
|
|
@@ -1770,7 +1818,7 @@ Creates a Transaction instance from a hexadecimal string encoded EF.
|
|
|
1770
1818
|
```ts
|
|
1771
1819
|
static fromHexEF(hex: string): Transaction
|
|
1772
1820
|
```
|
|
1773
|
-
See also: [Transaction](
|
|
1821
|
+
See also: [Transaction](#class-transaction)
|
|
1774
1822
|
|
|
1775
1823
|
Returns
|
|
1776
1824
|
|
|
@@ -2037,7 +2085,7 @@ Verifies the legitimacy of the Bitcoin transaction according to the rules of SPV
|
|
|
2037
2085
|
```ts
|
|
2038
2086
|
async verify(chainTracker: ChainTracker | "scripts only" = defaultChainTracker(), feeModel?: FeeModel, memoryLimit?: number): Promise<boolean>
|
|
2039
2087
|
```
|
|
2040
|
-
See also: [ChainTracker](
|
|
2088
|
+
See also: [ChainTracker](#interface-chaintracker), [FeeModel](#interface-feemodel), [defaultChainTracker](#function-defaultchaintracker)
|
|
2041
2089
|
|
|
2042
2090
|
Returns
|
|
2043
2091
|
|
|
@@ -2078,7 +2126,7 @@ export default class WhatsOnChain implements ChainTracker {
|
|
|
2078
2126
|
}
|
|
2079
2127
|
```
|
|
2080
2128
|
|
|
2081
|
-
See also: [ChainTracker](
|
|
2129
|
+
See also: [ChainTracker](#interface-chaintracker), [HttpClient](#interface-httpclient), [WhatsOnChainConfig](#interface-whatsonchainconfig)
|
|
2082
2130
|
|
|
2083
2131
|
#### Constructor
|
|
2084
2132
|
|
|
@@ -2087,7 +2135,7 @@ Constructs an instance of the WhatsOnChain ChainTracker.
|
|
|
2087
2135
|
```ts
|
|
2088
2136
|
constructor(network: "main" | "test" | "stn" = "main", config: WhatsOnChainConfig = {})
|
|
2089
2137
|
```
|
|
2090
|
-
See also: [WhatsOnChainConfig](
|
|
2138
|
+
See also: [WhatsOnChainConfig](#interface-whatsonchainconfig)
|
|
2091
2139
|
|
|
2092
2140
|
Argument Details
|
|
2093
2141
|
|
|
@@ -2119,7 +2167,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
2119
2167
|
export function defaultBroadcaster(isTestnet: boolean = false, config: ArcConfig = {}): Broadcaster
|
|
2120
2168
|
```
|
|
2121
2169
|
|
|
2122
|
-
See also: [ArcConfig](
|
|
2170
|
+
See also: [ArcConfig](#interface-arcconfig), [Broadcaster](#interface-broadcaster)
|
|
2123
2171
|
|
|
2124
2172
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2125
2173
|
|
|
@@ -2130,7 +2178,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
2130
2178
|
export function defaultChainTracker(): ChainTracker
|
|
2131
2179
|
```
|
|
2132
2180
|
|
|
2133
|
-
See also: [ChainTracker](
|
|
2181
|
+
See also: [ChainTracker](#interface-chaintracker)
|
|
2134
2182
|
|
|
2135
2183
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2136
2184
|
|
|
@@ -2145,7 +2193,7 @@ If running in a Node environment, it falls back to using the Node `https` module
|
|
|
2145
2193
|
export function defaultHttpClient(): HttpClient
|
|
2146
2194
|
```
|
|
2147
2195
|
|
|
2148
|
-
See also: [HttpClient](
|
|
2196
|
+
See also: [HttpClient](#interface-httpclient)
|
|
2149
2197
|
|
|
2150
2198
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2151
2199
|
|
|
@@ -2158,7 +2206,7 @@ Convenience type guard for response from `Broadcaster.broadcast`
|
|
|
2158
2206
|
export function isBroadcastFailure(r: BroadcastResponse | BroadcastFailure): r is BroadcastFailure
|
|
2159
2207
|
```
|
|
2160
2208
|
|
|
2161
|
-
See also: [BroadcastFailure](
|
|
2209
|
+
See also: [BroadcastFailure](#interface-broadcastfailure), [BroadcastResponse](#interface-broadcastresponse)
|
|
2162
2210
|
|
|
2163
2211
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2164
2212
|
|
|
@@ -2171,7 +2219,7 @@ Convenience type guard for response from `Broadcaster.broadcast`
|
|
|
2171
2219
|
export function isBroadcastResponse(r: BroadcastResponse | BroadcastFailure): r is BroadcastResponse
|
|
2172
2220
|
```
|
|
2173
2221
|
|
|
2174
|
-
See also: [BroadcastFailure](
|
|
2222
|
+
See also: [BroadcastFailure](#interface-broadcastfailure), [BroadcastResponse](#interface-broadcastresponse)
|
|
2175
2223
|
|
|
2176
2224
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2177
2225
|
|
|
@@ -2197,7 +2245,7 @@ Makes a request to the server.
|
|
|
2197
2245
|
export type Fetch = (url: string, options: FetchOptions) => Promise<Response>
|
|
2198
2246
|
```
|
|
2199
2247
|
|
|
2200
|
-
See also: [FetchOptions](
|
|
2248
|
+
See also: [FetchOptions](#interface-fetchoptions)
|
|
2201
2249
|
|
|
2202
2250
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2203
2251
|
|