@bsv/wallet-toolbox 1.6.11 → 1.6.13
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/docs/client.md +76 -4
- package/docs/services.md +76 -4
- package/docs/wallet.md +76 -4
- package/mobile/out/src/services/chaintracker/chaintracks/Api/ChaintracksFetchApi.d.ts +10 -0
- package/mobile/out/src/services/chaintracker/chaintracks/Api/ChaintracksFetchApi.d.ts.map +1 -1
- package/mobile/out/src/services/chaintracker/chaintracks/util/BulkFileDataManager.d.ts.map +1 -1
- package/mobile/out/src/services/chaintracker/chaintracks/util/BulkFileDataManager.js +7 -6
- package/mobile/out/src/services/chaintracker/chaintracks/util/BulkFileDataManager.js.map +1 -1
- package/mobile/out/src/services/chaintracker/chaintracks/util/ChaintracksFetch.d.ts +4 -0
- package/mobile/out/src/services/chaintracker/chaintracks/util/ChaintracksFetch.d.ts.map +1 -1
- package/mobile/out/src/services/chaintracker/chaintracks/util/ChaintracksFetch.js +4 -0
- package/mobile/out/src/services/chaintracker/chaintracks/util/ChaintracksFetch.js.map +1 -1
- package/mobile/out/src/services/chaintracker/chaintracks/util/HeightRange.d.ts +20 -2
- package/mobile/out/src/services/chaintracker/chaintracks/util/HeightRange.d.ts.map +1 -1
- package/mobile/out/src/services/chaintracker/chaintracks/util/HeightRange.js +22 -4
- package/mobile/out/src/services/chaintracker/chaintracks/util/HeightRange.js.map +1 -1
- package/mobile/out/src/services/chaintracker/chaintracks/util/validBulkHeaderFilesByFileHash.d.ts +32 -0
- package/mobile/out/src/services/chaintracker/chaintracks/util/validBulkHeaderFilesByFileHash.d.ts.map +1 -1
- package/mobile/out/src/services/chaintracker/chaintracks/util/validBulkHeaderFilesByFileHash.js +32 -0
- package/mobile/out/src/services/chaintracker/chaintracks/util/validBulkHeaderFilesByFileHash.js.map +1 -1
- package/mobile/package-lock.json +2 -2
- package/mobile/package.json +1 -1
- package/out/src/services/chaintracker/chaintracks/Api/ChaintracksFetchApi.d.ts +10 -0
- package/out/src/services/chaintracker/chaintracks/Api/ChaintracksFetchApi.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/ChaintracksService.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/ChaintracksService.js +8 -0
- package/out/src/services/chaintracker/chaintracks/ChaintracksService.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/__tests/Chaintracks.test.js +11 -0
- package/out/src/services/chaintracker/chaintracks/__tests/Chaintracks.test.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/BulkFileDataManager.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/BulkFileDataManager.js +7 -6
- package/out/src/services/chaintracker/chaintracks/util/BulkFileDataManager.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/ChaintracksFetch.d.ts +4 -0
- package/out/src/services/chaintracker/chaintracks/util/ChaintracksFetch.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/ChaintracksFetch.js +4 -0
- package/out/src/services/chaintracker/chaintracks/util/ChaintracksFetch.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/ChaintracksFs.d.ts +4 -0
- package/out/src/services/chaintracker/chaintracks/util/ChaintracksFs.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/ChaintracksFs.js +4 -0
- package/out/src/services/chaintracker/chaintracks/util/ChaintracksFs.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/HeightRange.d.ts +20 -2
- package/out/src/services/chaintracker/chaintracks/util/HeightRange.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/HeightRange.js +22 -4
- package/out/src/services/chaintracker/chaintracks/util/HeightRange.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/validBulkHeaderFilesByFileHash.d.ts +32 -0
- package/out/src/services/chaintracker/chaintracks/util/validBulkHeaderFilesByFileHash.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/validBulkHeaderFilesByFileHash.js +32 -0
- package/out/src/services/chaintracker/chaintracks/util/validBulkHeaderFilesByFileHash.js.map +1 -1
- package/out/src/storage/remoting/StorageServer.js +1 -1
- package/out/src/storage/remoting/StorageServer.js.map +1 -1
- package/out/tsconfig.all.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/services/chaintracker/chaintracks/Api/ChaintracksFetchApi.ts +10 -0
- package/src/services/chaintracker/chaintracks/ChaintracksService.ts +11 -1
- package/src/services/chaintracker/chaintracks/__tests/Chaintracks.test.ts +12 -0
- package/src/services/chaintracker/chaintracks/util/BulkFileDataManager.ts +7 -6
- package/src/services/chaintracker/chaintracks/util/ChaintracksFetch.ts +4 -0
- package/src/services/chaintracker/chaintracks/util/ChaintracksFs.ts +4 -0
- package/src/services/chaintracker/chaintracks/util/HeightRange.ts +23 -5
- package/src/services/chaintracker/chaintracks/util/validBulkHeaderFilesByFileHash.ts +32 -0
- package/src/storage/remoting/StorageServer.ts +1 -1
package/docs/client.md
CHANGED
|
@@ -1379,6 +1379,8 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
1379
1379
|
---
|
|
1380
1380
|
##### Interface: ChaintracksFetchApi
|
|
1381
1381
|
|
|
1382
|
+
Provides a simplified interface based on the
|
|
1383
|
+
|
|
1382
1384
|
```ts
|
|
1383
1385
|
export interface ChaintracksFetchApi {
|
|
1384
1386
|
httpClient: HttpClient;
|
|
@@ -9601,6 +9603,9 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
9601
9603
|
---
|
|
9602
9604
|
##### Class: ChaintracksFetch
|
|
9603
9605
|
|
|
9606
|
+
This class implements the ChaintracksFetchApi
|
|
9607
|
+
using the
|
|
9608
|
+
|
|
9604
9609
|
```ts
|
|
9605
9610
|
export class ChaintracksFetch implements ChaintracksFetchApi {
|
|
9606
9611
|
httpClient: HttpClient = defaultHttpClient();
|
|
@@ -10851,13 +10856,17 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
10851
10856
|
---
|
|
10852
10857
|
##### Class: HeightRange
|
|
10853
10858
|
|
|
10859
|
+
Represents a range of block heights.
|
|
10860
|
+
|
|
10861
|
+
Operations support integrating contiguous batches of headers,
|
|
10862
|
+
|
|
10854
10863
|
```ts
|
|
10855
10864
|
export class HeightRange implements HeightRangeApi {
|
|
10856
10865
|
constructor(public minHeight: number, public maxHeight: number)
|
|
10857
10866
|
static readonly empty = new HeightRange(0, -1);
|
|
10867
|
+
get isEmpty()
|
|
10858
10868
|
static from(headers: BlockHeader[]): HeightRange
|
|
10859
10869
|
get length()
|
|
10860
|
-
get isEmpty()
|
|
10861
10870
|
toString(): string
|
|
10862
10871
|
contains(range: HeightRange | number)
|
|
10863
10872
|
intersect(range: HeightRange)
|
|
@@ -10870,6 +10879,16 @@ export class HeightRange implements HeightRangeApi {
|
|
|
10870
10879
|
|
|
10871
10880
|
See also: [BlockHeader](./client.md#interface-blockheader), [HeightRangeApi](./services.md#interface-heightrangeapi)
|
|
10872
10881
|
|
|
10882
|
+
###### Property empty
|
|
10883
|
+
|
|
10884
|
+
All ranges where maxHeight is less than minHeight are considered empty.
|
|
10885
|
+
The canonical empty range is (0, -1).
|
|
10886
|
+
|
|
10887
|
+
```ts
|
|
10888
|
+
static readonly empty = new HeightRange(0, -1)
|
|
10889
|
+
```
|
|
10890
|
+
See also: [HeightRange](./services.md#class-heightrange)
|
|
10891
|
+
|
|
10873
10892
|
###### Method above
|
|
10874
10893
|
|
|
10875
10894
|
If `range` is not empty and this is not empty, returns a new range minHeight
|
|
@@ -10920,6 +10939,11 @@ Returns
|
|
|
10920
10939
|
|
|
10921
10940
|
range of height values from the given headers, or the empty range if there are no headers.
|
|
10922
10941
|
|
|
10942
|
+
Argument Details
|
|
10943
|
+
|
|
10944
|
+
+ **headers**
|
|
10945
|
+
+ an array of objects with a non-negative integer `height` property.
|
|
10946
|
+
|
|
10923
10947
|
###### Method intersect
|
|
10924
10948
|
|
|
10925
10949
|
Return the intersection with another height range.
|
|
@@ -10952,6 +10976,10 @@ function toString() { [native code] }
|
|
|
10952
10976
|
toString(): string
|
|
10953
10977
|
```
|
|
10954
10978
|
|
|
10979
|
+
Returns
|
|
10980
|
+
|
|
10981
|
+
an easy to read string representation of the height range.
|
|
10982
|
+
|
|
10955
10983
|
###### Method union
|
|
10956
10984
|
|
|
10957
10985
|
Return the union with another height range.
|
|
@@ -16261,6 +16289,7 @@ export async function createIdbChaintracks(chain: Chain, whatsonchainApiKey: str
|
|
|
16261
16289
|
fetch: ChaintracksFetchApi;
|
|
16262
16290
|
storage: ChaintracksStorageIdb;
|
|
16263
16291
|
chaintracks: Chaintracks;
|
|
16292
|
+
available: Promise<void>;
|
|
16264
16293
|
}>
|
|
16265
16294
|
```
|
|
16266
16295
|
|
|
@@ -16744,11 +16773,48 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
16744
16773
|
---
|
|
16745
16774
|
##### Function: isKnownValidBulkHeaderFile
|
|
16746
16775
|
|
|
16747
|
-
|
|
16748
|
-
|
|
16776
|
+
Compares meta data received for a bulk header file `vbf` to known
|
|
16777
|
+
valid bulk header files based on their `fileHash`.
|
|
16778
|
+
|
|
16779
|
+
Short circuits both the retreival and validation of individual headers,
|
|
16780
|
+
only a single SHA256 hash of the aggregate data needs to be compared.
|
|
16781
|
+
|
|
16782
|
+
The standard file size for historic block headers is 100,000 per file
|
|
16783
|
+
which results in a many orders of magnitude initialization speedup.
|
|
16784
|
+
|
|
16785
|
+
The following properties must match:
|
|
16786
|
+
- `firstHeight`
|
|
16787
|
+
- `count`
|
|
16788
|
+
- `prevChainWork`
|
|
16789
|
+
- `prevHash`
|
|
16790
|
+
- `lastChainWork`
|
|
16791
|
+
- `lastHash`
|
|
16792
|
+
- `chain`
|
|
16793
|
+
|
|
16794
|
+
```ts
|
|
16795
|
+
export function isKnownValidBulkHeaderFile(vbf: BulkHeaderFileInfo): boolean {
|
|
16796
|
+
if (!vbf || !vbf.fileHash)
|
|
16797
|
+
return false;
|
|
16798
|
+
const bf = validBulkHeaderFilesByFileHash()[vbf.fileHash];
|
|
16799
|
+
if (!bf ||
|
|
16800
|
+
bf.firstHeight !== vbf.firstHeight ||
|
|
16801
|
+
bf.count !== vbf.count ||
|
|
16802
|
+
bf.prevChainWork !== vbf.prevChainWork ||
|
|
16803
|
+
bf.prevHash !== vbf.prevHash ||
|
|
16804
|
+
bf.lastChainWork !== vbf.lastChainWork ||
|
|
16805
|
+
bf.lastHash !== vbf.lastHash ||
|
|
16806
|
+
bf.chain !== vbf.chain) {
|
|
16807
|
+
return false;
|
|
16808
|
+
}
|
|
16809
|
+
return true;
|
|
16810
|
+
}
|
|
16749
16811
|
```
|
|
16750
16812
|
|
|
16751
|
-
See also: [BulkHeaderFileInfo](./services.md#interface-bulkheaderfileinfo)
|
|
16813
|
+
See also: [BulkHeaderFileInfo](./services.md#interface-bulkheaderfileinfo), [validBulkHeaderFilesByFileHash](./services.md#function-validbulkheaderfilesbyfilehash)
|
|
16814
|
+
|
|
16815
|
+
Returns
|
|
16816
|
+
|
|
16817
|
+
true iff bulk file meta data (excluding its source) matches a known file.
|
|
16752
16818
|
|
|
16753
16819
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
16754
16820
|
|
|
@@ -17425,12 +17491,18 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
17425
17491
|
---
|
|
17426
17492
|
##### Function: validBulkHeaderFilesByFileHash
|
|
17427
17493
|
|
|
17494
|
+
Hash map of known valid bulk header files by their `fileHash`.
|
|
17495
|
+
|
|
17428
17496
|
```ts
|
|
17429
17497
|
export function validBulkHeaderFilesByFileHash(): Record<string, BulkHeaderFileInfo>
|
|
17430
17498
|
```
|
|
17431
17499
|
|
|
17432
17500
|
See also: [BulkHeaderFileInfo](./services.md#interface-bulkheaderfileinfo)
|
|
17433
17501
|
|
|
17502
|
+
Returns
|
|
17503
|
+
|
|
17504
|
+
object where keys are file hashes of known bulk header files.
|
|
17505
|
+
|
|
17434
17506
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
17435
17507
|
|
|
17436
17508
|
---
|
package/docs/services.md
CHANGED
|
@@ -1140,6 +1140,8 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
1140
1140
|
---
|
|
1141
1141
|
##### Interface: ChaintracksFetchApi
|
|
1142
1142
|
|
|
1143
|
+
Provides a simplified interface based on the
|
|
1144
|
+
|
|
1143
1145
|
```ts
|
|
1144
1146
|
export interface ChaintracksFetchApi {
|
|
1145
1147
|
httpClient: HttpClient;
|
|
@@ -3694,6 +3696,9 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
3694
3696
|
---
|
|
3695
3697
|
##### Class: ChaintracksFetch
|
|
3696
3698
|
|
|
3699
|
+
This class implements the ChaintracksFetchApi
|
|
3700
|
+
using the
|
|
3701
|
+
|
|
3697
3702
|
```ts
|
|
3698
3703
|
export class ChaintracksFetch implements ChaintracksFetchApi {
|
|
3699
3704
|
httpClient: HttpClient = defaultHttpClient();
|
|
@@ -4127,13 +4132,17 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
4127
4132
|
---
|
|
4128
4133
|
##### Class: HeightRange
|
|
4129
4134
|
|
|
4135
|
+
Represents a range of block heights.
|
|
4136
|
+
|
|
4137
|
+
Operations support integrating contiguous batches of headers,
|
|
4138
|
+
|
|
4130
4139
|
```ts
|
|
4131
4140
|
export class HeightRange implements HeightRangeApi {
|
|
4132
4141
|
constructor(public minHeight: number, public maxHeight: number)
|
|
4133
4142
|
static readonly empty = new HeightRange(0, -1);
|
|
4143
|
+
get isEmpty()
|
|
4134
4144
|
static from(headers: BlockHeader[]): HeightRange
|
|
4135
4145
|
get length()
|
|
4136
|
-
get isEmpty()
|
|
4137
4146
|
toString(): string
|
|
4138
4147
|
contains(range: HeightRange | number)
|
|
4139
4148
|
intersect(range: HeightRange)
|
|
@@ -4146,6 +4155,16 @@ export class HeightRange implements HeightRangeApi {
|
|
|
4146
4155
|
|
|
4147
4156
|
See also: [BlockHeader](./client.md#interface-blockheader), [HeightRangeApi](./services.md#interface-heightrangeapi)
|
|
4148
4157
|
|
|
4158
|
+
###### Property empty
|
|
4159
|
+
|
|
4160
|
+
All ranges where maxHeight is less than minHeight are considered empty.
|
|
4161
|
+
The canonical empty range is (0, -1).
|
|
4162
|
+
|
|
4163
|
+
```ts
|
|
4164
|
+
static readonly empty = new HeightRange(0, -1)
|
|
4165
|
+
```
|
|
4166
|
+
See also: [HeightRange](./services.md#class-heightrange)
|
|
4167
|
+
|
|
4149
4168
|
###### Method above
|
|
4150
4169
|
|
|
4151
4170
|
If `range` is not empty and this is not empty, returns a new range minHeight
|
|
@@ -4196,6 +4215,11 @@ Returns
|
|
|
4196
4215
|
|
|
4197
4216
|
range of height values from the given headers, or the empty range if there are no headers.
|
|
4198
4217
|
|
|
4218
|
+
Argument Details
|
|
4219
|
+
|
|
4220
|
+
+ **headers**
|
|
4221
|
+
+ an array of objects with a non-negative integer `height` property.
|
|
4222
|
+
|
|
4199
4223
|
###### Method intersect
|
|
4200
4224
|
|
|
4201
4225
|
Return the intersection with another height range.
|
|
@@ -4228,6 +4252,10 @@ function toString() { [native code] }
|
|
|
4228
4252
|
toString(): string
|
|
4229
4253
|
```
|
|
4230
4254
|
|
|
4255
|
+
Returns
|
|
4256
|
+
|
|
4257
|
+
an easy to read string representation of the height range.
|
|
4258
|
+
|
|
4231
4259
|
###### Method union
|
|
4232
4260
|
|
|
4233
4261
|
Return the union with another height range.
|
|
@@ -5077,6 +5105,7 @@ export async function createIdbChaintracks(chain: Chain, whatsonchainApiKey: str
|
|
|
5077
5105
|
fetch: ChaintracksFetchApi;
|
|
5078
5106
|
storage: ChaintracksStorageIdb;
|
|
5079
5107
|
chaintracks: Chaintracks;
|
|
5108
|
+
available: Promise<void>;
|
|
5080
5109
|
}>
|
|
5081
5110
|
```
|
|
5082
5111
|
|
|
@@ -5268,11 +5297,48 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
5268
5297
|
---
|
|
5269
5298
|
##### Function: isKnownValidBulkHeaderFile
|
|
5270
5299
|
|
|
5271
|
-
|
|
5272
|
-
|
|
5300
|
+
Compares meta data received for a bulk header file `vbf` to known
|
|
5301
|
+
valid bulk header files based on their `fileHash`.
|
|
5302
|
+
|
|
5303
|
+
Short circuits both the retreival and validation of individual headers,
|
|
5304
|
+
only a single SHA256 hash of the aggregate data needs to be compared.
|
|
5305
|
+
|
|
5306
|
+
The standard file size for historic block headers is 100,000 per file
|
|
5307
|
+
which results in a many orders of magnitude initialization speedup.
|
|
5308
|
+
|
|
5309
|
+
The following properties must match:
|
|
5310
|
+
- `firstHeight`
|
|
5311
|
+
- `count`
|
|
5312
|
+
- `prevChainWork`
|
|
5313
|
+
- `prevHash`
|
|
5314
|
+
- `lastChainWork`
|
|
5315
|
+
- `lastHash`
|
|
5316
|
+
- `chain`
|
|
5317
|
+
|
|
5318
|
+
```ts
|
|
5319
|
+
export function isKnownValidBulkHeaderFile(vbf: BulkHeaderFileInfo): boolean {
|
|
5320
|
+
if (!vbf || !vbf.fileHash)
|
|
5321
|
+
return false;
|
|
5322
|
+
const bf = validBulkHeaderFilesByFileHash()[vbf.fileHash];
|
|
5323
|
+
if (!bf ||
|
|
5324
|
+
bf.firstHeight !== vbf.firstHeight ||
|
|
5325
|
+
bf.count !== vbf.count ||
|
|
5326
|
+
bf.prevChainWork !== vbf.prevChainWork ||
|
|
5327
|
+
bf.prevHash !== vbf.prevHash ||
|
|
5328
|
+
bf.lastChainWork !== vbf.lastChainWork ||
|
|
5329
|
+
bf.lastHash !== vbf.lastHash ||
|
|
5330
|
+
bf.chain !== vbf.chain) {
|
|
5331
|
+
return false;
|
|
5332
|
+
}
|
|
5333
|
+
return true;
|
|
5334
|
+
}
|
|
5273
5335
|
```
|
|
5274
5336
|
|
|
5275
|
-
See also: [BulkHeaderFileInfo](./services.md#interface-bulkheaderfileinfo)
|
|
5337
|
+
See also: [BulkHeaderFileInfo](./services.md#interface-bulkheaderfileinfo), [validBulkHeaderFilesByFileHash](./services.md#function-validbulkheaderfilesbyfilehash)
|
|
5338
|
+
|
|
5339
|
+
Returns
|
|
5340
|
+
|
|
5341
|
+
true iff bulk file meta data (excluding its source) matches a known file.
|
|
5276
5342
|
|
|
5277
5343
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
5278
5344
|
|
|
@@ -5510,12 +5576,18 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
5510
5576
|
---
|
|
5511
5577
|
##### Function: validBulkHeaderFilesByFileHash
|
|
5512
5578
|
|
|
5579
|
+
Hash map of known valid bulk header files by their `fileHash`.
|
|
5580
|
+
|
|
5513
5581
|
```ts
|
|
5514
5582
|
export function validBulkHeaderFilesByFileHash(): Record<string, BulkHeaderFileInfo>
|
|
5515
5583
|
```
|
|
5516
5584
|
|
|
5517
5585
|
See also: [BulkHeaderFileInfo](./services.md#interface-bulkheaderfileinfo)
|
|
5518
5586
|
|
|
5587
|
+
Returns
|
|
5588
|
+
|
|
5589
|
+
object where keys are file hashes of known bulk header files.
|
|
5590
|
+
|
|
5519
5591
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
5520
5592
|
|
|
5521
5593
|
---
|
package/docs/wallet.md
CHANGED
|
@@ -1378,6 +1378,8 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
1378
1378
|
---
|
|
1379
1379
|
##### Interface: ChaintracksFetchApi
|
|
1380
1380
|
|
|
1381
|
+
Provides a simplified interface based on the
|
|
1382
|
+
|
|
1381
1383
|
```ts
|
|
1382
1384
|
export interface ChaintracksFetchApi {
|
|
1383
1385
|
httpClient: HttpClient;
|
|
@@ -9600,6 +9602,9 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
9600
9602
|
---
|
|
9601
9603
|
##### Class: ChaintracksFetch
|
|
9602
9604
|
|
|
9605
|
+
This class implements the ChaintracksFetchApi
|
|
9606
|
+
using the
|
|
9607
|
+
|
|
9603
9608
|
```ts
|
|
9604
9609
|
export class ChaintracksFetch implements ChaintracksFetchApi {
|
|
9605
9610
|
httpClient: HttpClient = defaultHttpClient();
|
|
@@ -10850,13 +10855,17 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
10850
10855
|
---
|
|
10851
10856
|
##### Class: HeightRange
|
|
10852
10857
|
|
|
10858
|
+
Represents a range of block heights.
|
|
10859
|
+
|
|
10860
|
+
Operations support integrating contiguous batches of headers,
|
|
10861
|
+
|
|
10853
10862
|
```ts
|
|
10854
10863
|
export class HeightRange implements HeightRangeApi {
|
|
10855
10864
|
constructor(public minHeight: number, public maxHeight: number)
|
|
10856
10865
|
static readonly empty = new HeightRange(0, -1);
|
|
10866
|
+
get isEmpty()
|
|
10857
10867
|
static from(headers: BlockHeader[]): HeightRange
|
|
10858
10868
|
get length()
|
|
10859
|
-
get isEmpty()
|
|
10860
10869
|
toString(): string
|
|
10861
10870
|
contains(range: HeightRange | number)
|
|
10862
10871
|
intersect(range: HeightRange)
|
|
@@ -10869,6 +10878,16 @@ export class HeightRange implements HeightRangeApi {
|
|
|
10869
10878
|
|
|
10870
10879
|
See also: [BlockHeader](./client.md#interface-blockheader), [HeightRangeApi](./services.md#interface-heightrangeapi)
|
|
10871
10880
|
|
|
10881
|
+
###### Property empty
|
|
10882
|
+
|
|
10883
|
+
All ranges where maxHeight is less than minHeight are considered empty.
|
|
10884
|
+
The canonical empty range is (0, -1).
|
|
10885
|
+
|
|
10886
|
+
```ts
|
|
10887
|
+
static readonly empty = new HeightRange(0, -1)
|
|
10888
|
+
```
|
|
10889
|
+
See also: [HeightRange](./services.md#class-heightrange)
|
|
10890
|
+
|
|
10872
10891
|
###### Method above
|
|
10873
10892
|
|
|
10874
10893
|
If `range` is not empty and this is not empty, returns a new range minHeight
|
|
@@ -10919,6 +10938,11 @@ Returns
|
|
|
10919
10938
|
|
|
10920
10939
|
range of height values from the given headers, or the empty range if there are no headers.
|
|
10921
10940
|
|
|
10941
|
+
Argument Details
|
|
10942
|
+
|
|
10943
|
+
+ **headers**
|
|
10944
|
+
+ an array of objects with a non-negative integer `height` property.
|
|
10945
|
+
|
|
10922
10946
|
###### Method intersect
|
|
10923
10947
|
|
|
10924
10948
|
Return the intersection with another height range.
|
|
@@ -10951,6 +10975,10 @@ function toString() { [native code] }
|
|
|
10951
10975
|
toString(): string
|
|
10952
10976
|
```
|
|
10953
10977
|
|
|
10978
|
+
Returns
|
|
10979
|
+
|
|
10980
|
+
an easy to read string representation of the height range.
|
|
10981
|
+
|
|
10954
10982
|
###### Method union
|
|
10955
10983
|
|
|
10956
10984
|
Return the union with another height range.
|
|
@@ -16260,6 +16288,7 @@ export async function createIdbChaintracks(chain: Chain, whatsonchainApiKey: str
|
|
|
16260
16288
|
fetch: ChaintracksFetchApi;
|
|
16261
16289
|
storage: ChaintracksStorageIdb;
|
|
16262
16290
|
chaintracks: Chaintracks;
|
|
16291
|
+
available: Promise<void>;
|
|
16263
16292
|
}>
|
|
16264
16293
|
```
|
|
16265
16294
|
|
|
@@ -16743,11 +16772,48 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
16743
16772
|
---
|
|
16744
16773
|
##### Function: isKnownValidBulkHeaderFile
|
|
16745
16774
|
|
|
16746
|
-
|
|
16747
|
-
|
|
16775
|
+
Compares meta data received for a bulk header file `vbf` to known
|
|
16776
|
+
valid bulk header files based on their `fileHash`.
|
|
16777
|
+
|
|
16778
|
+
Short circuits both the retreival and validation of individual headers,
|
|
16779
|
+
only a single SHA256 hash of the aggregate data needs to be compared.
|
|
16780
|
+
|
|
16781
|
+
The standard file size for historic block headers is 100,000 per file
|
|
16782
|
+
which results in a many orders of magnitude initialization speedup.
|
|
16783
|
+
|
|
16784
|
+
The following properties must match:
|
|
16785
|
+
- `firstHeight`
|
|
16786
|
+
- `count`
|
|
16787
|
+
- `prevChainWork`
|
|
16788
|
+
- `prevHash`
|
|
16789
|
+
- `lastChainWork`
|
|
16790
|
+
- `lastHash`
|
|
16791
|
+
- `chain`
|
|
16792
|
+
|
|
16793
|
+
```ts
|
|
16794
|
+
export function isKnownValidBulkHeaderFile(vbf: BulkHeaderFileInfo): boolean {
|
|
16795
|
+
if (!vbf || !vbf.fileHash)
|
|
16796
|
+
return false;
|
|
16797
|
+
const bf = validBulkHeaderFilesByFileHash()[vbf.fileHash];
|
|
16798
|
+
if (!bf ||
|
|
16799
|
+
bf.firstHeight !== vbf.firstHeight ||
|
|
16800
|
+
bf.count !== vbf.count ||
|
|
16801
|
+
bf.prevChainWork !== vbf.prevChainWork ||
|
|
16802
|
+
bf.prevHash !== vbf.prevHash ||
|
|
16803
|
+
bf.lastChainWork !== vbf.lastChainWork ||
|
|
16804
|
+
bf.lastHash !== vbf.lastHash ||
|
|
16805
|
+
bf.chain !== vbf.chain) {
|
|
16806
|
+
return false;
|
|
16807
|
+
}
|
|
16808
|
+
return true;
|
|
16809
|
+
}
|
|
16748
16810
|
```
|
|
16749
16811
|
|
|
16750
|
-
See also: [BulkHeaderFileInfo](./services.md#interface-bulkheaderfileinfo)
|
|
16812
|
+
See also: [BulkHeaderFileInfo](./services.md#interface-bulkheaderfileinfo), [validBulkHeaderFilesByFileHash](./services.md#function-validbulkheaderfilesbyfilehash)
|
|
16813
|
+
|
|
16814
|
+
Returns
|
|
16815
|
+
|
|
16816
|
+
true iff bulk file meta data (excluding its source) matches a known file.
|
|
16751
16817
|
|
|
16752
16818
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
16753
16819
|
|
|
@@ -17424,12 +17490,18 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
17424
17490
|
---
|
|
17425
17491
|
##### Function: validBulkHeaderFilesByFileHash
|
|
17426
17492
|
|
|
17493
|
+
Hash map of known valid bulk header files by their `fileHash`.
|
|
17494
|
+
|
|
17427
17495
|
```ts
|
|
17428
17496
|
export function validBulkHeaderFilesByFileHash(): Record<string, BulkHeaderFileInfo>
|
|
17429
17497
|
```
|
|
17430
17498
|
|
|
17431
17499
|
See also: [BulkHeaderFileInfo](./services.md#interface-bulkheaderfileinfo)
|
|
17432
17500
|
|
|
17501
|
+
Returns
|
|
17502
|
+
|
|
17503
|
+
object where keys are file hashes of known bulk header files.
|
|
17504
|
+
|
|
17433
17505
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
17434
17506
|
|
|
17435
17507
|
---
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import { HttpClient } from '@bsv/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* Provides a simplified interface based on the @bsv/sdk `HttpClient` class
|
|
4
|
+
* with just the methods necesary for most Chaintracks operations.
|
|
5
|
+
*
|
|
6
|
+
* The primary purpose is to isolate and centralize external package dependency.
|
|
7
|
+
*
|
|
8
|
+
* Specific ingestors are free to use other means for access.
|
|
9
|
+
*
|
|
10
|
+
* The `ChaintracksFetch` class implements this interface.
|
|
11
|
+
*/
|
|
2
12
|
export interface ChaintracksFetchApi {
|
|
3
13
|
httpClient: HttpClient;
|
|
4
14
|
download(url: string): Promise<Uint8Array>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChaintracksFetchApi.d.ts","sourceRoot":"","sources":["../../../../../../../src/services/chaintracker/chaintracks/Api/ChaintracksFetchApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAErC,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,UAAU,CAAA;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;IAC1C,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAAA;CACnD"}
|
|
1
|
+
{"version":3,"file":"ChaintracksFetchApi.d.ts","sourceRoot":"","sources":["../../../../../../../src/services/chaintracker/chaintracks/Api/ChaintracksFetchApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAErC;;;;;;;;;GASG;AACH,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,UAAU,CAAA;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;IAC1C,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAAA;CACnD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BulkFileDataManager.d.ts","sourceRoot":"","sources":["../../../../../../../src/services/chaintracker/chaintracks/util/BulkFileDataManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAiE,MAAM,iBAAiB,CAAA;AAGnH,OAAO,EAAE,kBAAkB,EAAuB,MAAM,kBAAkB,CAAA;AAE1E,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAU3C,OAAO,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAA;AAE5E,OAAO,EAAE,gBAAgB,EAAE,MA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AAO,CAAC,8BAA8B,CAAC;YAInE,WAAW;
|
|
1
|
+
{"version":3,"file":"BulkFileDataManager.d.ts","sourceRoot":"","sources":["../../../../../../../src/services/chaintracker/chaintracks/util/BulkFileDataManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAiE,MAAM,iBAAiB,CAAA;AAGnH,OAAO,EAAE,kBAAkB,EAAuB,MAAM,kBAAkB,CAAA;AAE1E,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAU3C,OAAO,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAA;AAE5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAG1D,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,KAAK,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,mBAAmB,CAAA;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED;;;;;;;;GAQG;AACH,qBAAa,mBAAmB;IAC9B,MAAM,CAAC,oBAAoB,CAAC,KAAK,EAAE,KAAK,GAAG,0BAA0B;IAUrE,OAAO,CAAC,GAAG,CAAqC;IAEhD,OAAO,CAAC,IAAI,CAAqB;IACjC,OAAO,CAAC,eAAe,CAA6B;IACpD,OAAO,CAAC,IAAI,CAAiE;IAC7E,OAAO,CAAC,OAAO,CAAC,CAA+B;IAE/C,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;IACrB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,mBAAmB,CAAA;IACpC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAA;gBAExB,OAAO,EAAE,0B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MAAM,CAAA;gBAEN,OAAO,EAAE,mBAAmB,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM;IAOnF;;;;;;OAMG;YACW,kBAAkB;IAUhC;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;CAqB9C"}
|
|
@@ -151,11 +151,8 @@ class BulkFileDataManager {
|
|
|
151
151
|
await this.mergeIncremental(lbf, vbf, r);
|
|
152
152
|
}
|
|
153
153
|
else {
|
|
154
|
-
const added = this.add(vbf);
|
|
154
|
+
const added = await this.add(vbf);
|
|
155
155
|
r.inserted.push(added);
|
|
156
|
-
if (this.storage) {
|
|
157
|
-
vbf.fileId = await this.storage.insertBulkFile(added);
|
|
158
|
-
}
|
|
159
156
|
}
|
|
160
157
|
}
|
|
161
158
|
this.log(`BulkFileDataManager.merge:\n${this.toLogString(r)}\n`);
|
|
@@ -439,13 +436,17 @@ class BulkFileDataManager {
|
|
|
439
436
|
throw new sdk_1.WERR_INVALID_PARAMETER('prevHash/prevChainWork', `the last file's lastHash/lastChainWork`);
|
|
440
437
|
}
|
|
441
438
|
}
|
|
442
|
-
add(bfd) {
|
|
439
|
+
async add(bfd) {
|
|
443
440
|
this.validateBfdForAdd(bfd);
|
|
444
441
|
const index = this.bfds.length;
|
|
445
442
|
this.bfds.push(bfd);
|
|
446
443
|
this.fileHashToIndex[bfd.fileHash] = index;
|
|
447
444
|
this.ensureMaxRetained();
|
|
448
|
-
|
|
445
|
+
const info = bfdToInfo(bfd, true);
|
|
446
|
+
if (this.storage) {
|
|
447
|
+
info.fileId = bfd.fileId = await this.storage.insertBulkFile(info);
|
|
448
|
+
}
|
|
449
|
+
return info;
|
|
449
450
|
}
|
|
450
451
|
replaceBfdAtIndex(index, update) {
|
|
451
452
|
const oldBfd = this.bfds[index];
|