@bsv/wallet-toolbox 1.2.32 → 1.2.35
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 +489 -1742
- package/docs/monitor.md +7 -7
- package/docs/services.md +236 -2
- package/docs/wallet.md +489 -1742
- package/out/src/Setup.d.ts +1 -2
- package/out/src/Setup.d.ts.map +1 -1
- package/out/src/Setup.js +17 -18
- package/out/src/Setup.js.map +1 -1
- package/out/src/Wallet.d.ts +4 -1
- package/out/src/Wallet.d.ts.map +1 -1
- package/out/src/Wallet.js +111 -51
- package/out/src/Wallet.js.map +1 -1
- package/out/src/WalletSettingsManager.d.ts +2 -9
- package/out/src/WalletSettingsManager.d.ts.map +1 -1
- package/out/src/WalletSettingsManager.js +7 -113
- package/out/src/WalletSettingsManager.js.map +1 -1
- package/out/src/index.client.d.ts +5 -6
- package/out/src/index.client.d.ts.map +1 -1
- package/out/src/index.client.js +5 -6
- package/out/src/index.client.js.map +1 -1
- package/out/src/monitor/Monitor.d.ts +4 -2
- package/out/src/monitor/Monitor.d.ts.map +1 -1
- package/out/src/monitor/Monitor.js +45 -13
- package/out/src/monitor/Monitor.js.map +1 -1
- package/out/src/monitor/MonitorDaemon.d.ts.map +1 -1
- package/out/src/monitor/MonitorDaemon.js +3 -0
- package/out/src/monitor/MonitorDaemon.js.map +1 -1
- package/out/src/monitor/tasks/TaskCheckForProofs.d.ts +1 -1
- package/out/src/monitor/tasks/TaskCheckForProofs.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskCheckForProofs.js +6 -4
- package/out/src/monitor/tasks/TaskCheckForProofs.js.map +1 -1
- package/out/src/monitor/tasks/TaskCheckNoSends.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskCheckNoSends.js.map +1 -1
- package/out/src/monitor/tasks/TaskNewHeader.d.ts +3 -3
- package/out/src/monitor/tasks/TaskNewHeader.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskNewHeader.js.map +1 -1
- package/out/src/monitor/tasks/TaskPurge.d.ts +2 -2
- package/out/src/monitor/tasks/TaskPurge.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskReviewStatus.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskReviewStatus.js.map +1 -1
- package/out/src/monitor/tasks/TaskUnFail.d.ts +2 -1
- package/out/src/monitor/tasks/TaskUnFail.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskUnFail.js +2 -2
- package/out/src/monitor/tasks/TaskUnFail.js.map +1 -1
- package/out/src/sdk/WalletServices.interfaces.d.ts +19 -18
- package/out/src/sdk/WalletServices.interfaces.d.ts.map +1 -1
- package/out/src/sdk/WalletSigner.interfaces.d.ts +2 -2
- package/out/src/sdk/WalletSigner.interfaces.d.ts.map +1 -1
- package/out/src/sdk/WalletStorage.interfaces.d.ts +57 -53
- package/out/src/sdk/WalletStorage.interfaces.d.ts.map +1 -1
- package/out/src/sdk/types.d.ts +12 -0
- package/out/src/sdk/types.d.ts.map +1 -1
- package/out/src/sdk/types.js +16 -1
- package/out/src/sdk/types.js.map +1 -1
- package/out/src/storage/StorageKnex.d.ts.map +1 -1
- package/out/src/storage/WalletStorageManager.d.ts +3 -1
- package/out/src/storage/WalletStorageManager.d.ts.map +1 -1
- package/out/src/storage/WalletStorageManager.js +58 -23
- package/out/src/storage/WalletStorageManager.js.map +1 -1
- package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts +1 -1
- package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts.map +1 -1
- package/out/src/storage/methods/attemptToPostReqsToNetwork.js +40 -6
- package/out/src/storage/methods/attemptToPostReqsToNetwork.js.map +1 -1
- package/out/test/Wallet/local/localWallet.man.test.js +1 -1
- package/out/test/Wallet/local/localWallet.man.test.js.map +1 -1
- package/out/test/Wallet/local/localWallet2.man.test.js +59 -1
- package/out/test/Wallet/local/localWallet2.man.test.js.map +1 -1
- package/out/test/Wallet/specOps/specOps.man.test.js +37 -5
- package/out/test/Wallet/specOps/specOps.man.test.js.map +1 -1
- package/out/test/WalletClient/LocalKVStore.man.test.d.ts +2 -0
- package/out/test/WalletClient/LocalKVStore.man.test.d.ts.map +1 -0
- package/out/test/WalletClient/LocalKVStore.man.test.js +99 -0
- package/out/test/WalletClient/LocalKVStore.man.test.js.map +1 -0
- package/out/test/WalletClient/WERR.man.test.d.ts +2 -0
- package/out/test/WalletClient/WERR.man.test.d.ts.map +1 -0
- package/out/test/WalletClient/WERR.man.test.js +21 -0
- package/out/test/WalletClient/WERR.man.test.js.map +1 -0
- package/out/test/services/Services.test.js +3 -1
- package/out/test/services/Services.test.js.map +1 -1
- package/out/test/{Wallet/local → utils}/localWalletMethods.d.ts +2 -2
- package/out/test/utils/localWalletMethods.d.ts.map +1 -0
- package/out/test/{Wallet/local → utils}/localWalletMethods.js +4 -4
- package/out/test/utils/localWalletMethods.js.map +1 -0
- package/out/tsconfig.all.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/Setup.ts +2 -2
- package/src/Wallet.ts +41 -9
- package/src/WalletSettingsManager.ts +12 -144
- package/src/index.client.ts +5 -6
- package/src/monitor/Monitor.ts +10 -9
- package/src/monitor/MonitorDaemon.ts +4 -0
- package/src/monitor/tasks/TaskCheckForProofs.ts +6 -2
- package/src/monitor/tasks/TaskCheckNoSends.ts +0 -1
- package/src/monitor/tasks/TaskNewHeader.ts +3 -4
- package/src/monitor/tasks/TaskPurge.ts +2 -2
- package/src/monitor/tasks/TaskReviewStatus.ts +0 -1
- package/src/monitor/tasks/TaskUnFail.ts +2 -1
- package/src/sdk/WalletServices.interfaces.ts +19 -18
- package/src/sdk/WalletSigner.interfaces.ts +3 -30
- package/src/sdk/WalletStorage.interfaces.ts +74 -66
- package/src/sdk/types.ts +16 -0
- package/src/storage/StorageKnex.ts +1 -1
- package/src/storage/WalletStorageManager.ts +6 -10
- package/src/storage/methods/attemptToPostReqsToNetwork.ts +2 -1
- package/test/Wallet/local/localWallet.man.test.ts +1 -3
- package/test/Wallet/local/localWallet2.man.test.ts +60 -4
- package/test/Wallet/specOps/specOps.man.test.ts +41 -1
- package/test/WalletClient/LocalKVStore.man.test.ts +114 -0
- package/test/WalletClient/WERR.man.test.ts +20 -0
- package/test/services/Services.test.ts +3 -1
- package/test/{Wallet/local → utils}/localWalletMethods.ts +4 -5
- package/out/test/Wallet/local/localWalletMethods.d.ts.map +0 -1
- package/out/test/Wallet/local/localWalletMethods.js.map +0 -1
package/docs/monitor.md
CHANGED
|
@@ -108,7 +108,7 @@ The following purge actions are available to support sustained operation:
|
|
|
108
108
|
+ proven_tx_reqs table delete records
|
|
109
109
|
|
|
110
110
|
```ts
|
|
111
|
-
export interface TaskPurgeParams extends
|
|
111
|
+
export interface TaskPurgeParams extends PurgeParams {
|
|
112
112
|
}
|
|
113
113
|
```
|
|
114
114
|
|
|
@@ -182,7 +182,7 @@ export class Monitor {
|
|
|
182
182
|
}
|
|
183
183
|
```
|
|
184
184
|
|
|
185
|
-
See also: [BlockHeader](./
|
|
185
|
+
See also: [BlockHeader](./services.md#interface-blockheader), [Chain](./client.md#type-chain), [MonitorOptions](./monitor.md#interface-monitoroptions), [MonitorStorage](./monitor.md#type-monitorstorage), [Services](./services.md#class-services), [TaskPurgeParams](./monitor.md#interface-taskpurgeparams), [WalletMonitorTask](./monitor.md#class-walletmonitortask)
|
|
186
186
|
|
|
187
187
|
###### Property _otherTasks
|
|
188
188
|
|
|
@@ -229,7 +229,7 @@ Kicks processing 'unconfirmed' and 'unmined' request processing.
|
|
|
229
229
|
```ts
|
|
230
230
|
processNewBlockHeader(header: BlockHeader): void
|
|
231
231
|
```
|
|
232
|
-
See also: [BlockHeader](./
|
|
232
|
+
See also: [BlockHeader](./services.md#interface-blockheader)
|
|
233
233
|
|
|
234
234
|
###### Method processReorg
|
|
235
235
|
|
|
@@ -245,7 +245,7 @@ Coinbase transactions always become invalid.
|
|
|
245
245
|
```ts
|
|
246
246
|
processReorg(depth: number, oldTip: BlockHeader, newTip: BlockHeader): void
|
|
247
247
|
```
|
|
248
|
-
See also: [BlockHeader](./
|
|
248
|
+
See also: [BlockHeader](./services.md#interface-blockheader)
|
|
249
249
|
|
|
250
250
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
251
251
|
|
|
@@ -421,9 +421,9 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
421
421
|
```ts
|
|
422
422
|
export class TaskNewHeader extends WalletMonitorTask {
|
|
423
423
|
static taskName = "NewHeader";
|
|
424
|
-
header?:
|
|
424
|
+
header?: BlockHeader;
|
|
425
425
|
constructor(monitor: Monitor, public triggerMsecs = 1 * monitor.oneMinute)
|
|
426
|
-
async getHeader(): Promise<
|
|
426
|
+
async getHeader(): Promise<BlockHeader>
|
|
427
427
|
trigger(nowMsecsSinceEpoch: number): {
|
|
428
428
|
run: boolean;
|
|
429
429
|
}
|
|
@@ -431,7 +431,7 @@ export class TaskNewHeader extends WalletMonitorTask {
|
|
|
431
431
|
}
|
|
432
432
|
```
|
|
433
433
|
|
|
434
|
-
See also: [BlockHeader](./
|
|
434
|
+
See also: [BlockHeader](./services.md#interface-blockheader), [Monitor](./monitor.md#class-monitor), [WalletMonitorTask](./monitor.md#class-walletmonitortask)
|
|
435
435
|
|
|
436
436
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
437
437
|
|
package/docs/services.md
CHANGED
|
@@ -25,9 +25,12 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
25
25
|
| --- |
|
|
26
26
|
| [ArcConfig](#interface-arcconfig) |
|
|
27
27
|
| [ArcMinerGetTxData](#interface-arcminergettxdata) |
|
|
28
|
+
| [BaseBlockHeader](#interface-baseblockheader) |
|
|
28
29
|
| [BitailsConfig](#interface-bitailsconfig) |
|
|
29
30
|
| [BitailsMerkleProof](#interface-bitailsmerkleproof) |
|
|
31
|
+
| [BlockHeader](#interface-blockheader) |
|
|
30
32
|
| [ExchangeRatesIoApi](#interface-exchangeratesioapi) |
|
|
33
|
+
| [LiveBlockHeader](#interface-liveblockheader) |
|
|
31
34
|
|
|
32
35
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
33
36
|
|
|
@@ -118,6 +121,75 @@ export interface ArcMinerGetTxData {
|
|
|
118
121
|
|
|
119
122
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
120
123
|
|
|
124
|
+
---
|
|
125
|
+
##### Interface: BaseBlockHeader
|
|
126
|
+
|
|
127
|
+
These are fields of 80 byte serialized header in order whose double sha256 hash is a block's hash value
|
|
128
|
+
and the next block's previousHash value.
|
|
129
|
+
|
|
130
|
+
All block hash values and merkleRoot values are 32 byte hex string values with the byte order reversed from the serialized byte order.
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
export interface BaseBlockHeader {
|
|
134
|
+
version: number;
|
|
135
|
+
previousHash: string;
|
|
136
|
+
merkleRoot: string;
|
|
137
|
+
time: number;
|
|
138
|
+
bits: number;
|
|
139
|
+
nonce: number;
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
###### Property bits
|
|
144
|
+
|
|
145
|
+
Block header bits value. Serialized length is 4 bytes.
|
|
146
|
+
|
|
147
|
+
```ts
|
|
148
|
+
bits: number
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
###### Property merkleRoot
|
|
152
|
+
|
|
153
|
+
Root hash of the merkle tree of all transactions in this block. Serialized length is 32 bytes.
|
|
154
|
+
|
|
155
|
+
```ts
|
|
156
|
+
merkleRoot: string
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
###### Property nonce
|
|
160
|
+
|
|
161
|
+
Block header nonce value. Serialized length is 4 bytes.
|
|
162
|
+
|
|
163
|
+
```ts
|
|
164
|
+
nonce: number
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
###### Property previousHash
|
|
168
|
+
|
|
169
|
+
Hash of previous block's block header. Serialized length is 32 bytes.
|
|
170
|
+
|
|
171
|
+
```ts
|
|
172
|
+
previousHash: string
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
###### Property time
|
|
176
|
+
|
|
177
|
+
Block header time value. Serialized length is 4 bytes.
|
|
178
|
+
|
|
179
|
+
```ts
|
|
180
|
+
time: number
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
###### Property version
|
|
184
|
+
|
|
185
|
+
Block header version value. Serialized length is 4 bytes.
|
|
186
|
+
|
|
187
|
+
```ts
|
|
188
|
+
version: number
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
192
|
+
|
|
121
193
|
---
|
|
122
194
|
##### Interface: BitailsConfig
|
|
123
195
|
|
|
@@ -160,6 +232,38 @@ export interface BitailsMerkleProof {
|
|
|
160
232
|
|
|
161
233
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
162
234
|
|
|
235
|
+
---
|
|
236
|
+
##### Interface: BlockHeader
|
|
237
|
+
|
|
238
|
+
A `BaseBlockHeader` extended with its computed hash and height in its chain.
|
|
239
|
+
|
|
240
|
+
```ts
|
|
241
|
+
export interface BlockHeader extends BaseBlockHeader {
|
|
242
|
+
height: number;
|
|
243
|
+
hash: string;
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
See also: [BaseBlockHeader](./services.md#interface-baseblockheader)
|
|
248
|
+
|
|
249
|
+
###### Property hash
|
|
250
|
+
|
|
251
|
+
The double sha256 hash of the serialized `BaseBlockHeader` fields.
|
|
252
|
+
|
|
253
|
+
```ts
|
|
254
|
+
hash: string
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
###### Property height
|
|
258
|
+
|
|
259
|
+
Height of the header, starting from zero.
|
|
260
|
+
|
|
261
|
+
```ts
|
|
262
|
+
height: number
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
266
|
+
|
|
163
267
|
---
|
|
164
268
|
##### Interface: ExchangeRatesIoApi
|
|
165
269
|
|
|
@@ -175,6 +279,72 @@ export interface ExchangeRatesIoApi {
|
|
|
175
279
|
|
|
176
280
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
177
281
|
|
|
282
|
+
---
|
|
283
|
+
##### Interface: LiveBlockHeader
|
|
284
|
+
|
|
285
|
+
The "live" portion of the block chain is recent history that can conceivably be subject to reorganizations.
|
|
286
|
+
The additional fields support tracking orphan blocks, chain forks, and chain reorgs.
|
|
287
|
+
|
|
288
|
+
```ts
|
|
289
|
+
export interface LiveBlockHeader extends BlockHeader {
|
|
290
|
+
chainWork: string;
|
|
291
|
+
isChainTip: boolean;
|
|
292
|
+
isActive: boolean;
|
|
293
|
+
headerId: number;
|
|
294
|
+
previousHeaderId: number | null;
|
|
295
|
+
}
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
See also: [BlockHeader](./services.md#interface-blockheader)
|
|
299
|
+
|
|
300
|
+
###### Property chainWork
|
|
301
|
+
|
|
302
|
+
The cummulative chainwork achieved by the addition of this block to the chain.
|
|
303
|
+
Chainwork only matters in selecting the active chain.
|
|
304
|
+
|
|
305
|
+
```ts
|
|
306
|
+
chainWork: string
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
###### Property headerId
|
|
310
|
+
|
|
311
|
+
As there may be more than one header with identical height values due to orphan tracking,
|
|
312
|
+
headers are assigned a unique headerId while part of the "live" portion of the block chain.
|
|
313
|
+
|
|
314
|
+
```ts
|
|
315
|
+
headerId: number
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
###### Property isActive
|
|
319
|
+
|
|
320
|
+
True only if this header is currently on the active chain.
|
|
321
|
+
|
|
322
|
+
```ts
|
|
323
|
+
isActive: boolean
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
###### Property isChainTip
|
|
327
|
+
|
|
328
|
+
True only if this header is currently a chain tip. e.g. There is no header that follows it by previousHash or previousHeaderId.
|
|
329
|
+
|
|
330
|
+
```ts
|
|
331
|
+
isChainTip: boolean
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
###### Property previousHeaderId
|
|
335
|
+
|
|
336
|
+
Every header in the "live" portion of the block chain is linked to an ancestor header through
|
|
337
|
+
both its previousHash and previousHeaderId properties.
|
|
338
|
+
|
|
339
|
+
Due to forks, there may be multiple headers with identical `previousHash` and `previousHeaderId` values.
|
|
340
|
+
Of these, only one (the header on the active chain) will have `isActive` === true.
|
|
341
|
+
|
|
342
|
+
```ts
|
|
343
|
+
previousHeaderId: number | null
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
347
|
+
|
|
178
348
|
---
|
|
179
349
|
#### Classes
|
|
180
350
|
|
|
@@ -440,7 +610,7 @@ export class Services implements sdk.WalletServices {
|
|
|
440
610
|
}
|
|
441
611
|
```
|
|
442
612
|
|
|
443
|
-
See also: [ARC](./services.md#class-arc), [Bitails](./services.md#class-bitails), [BlockHeader](./
|
|
613
|
+
See also: [ARC](./services.md#class-arc), [Bitails](./services.md#class-bitails), [BlockHeader](./services.md#interface-blockheader), [Chain](./client.md#type-chain), [FiatExchangeRates](./client.md#interface-fiatexchangerates), [GetMerklePathResult](./client.md#interface-getmerklepathresult), [GetMerklePathService](./client.md#type-getmerklepathservice), [GetRawTxResult](./client.md#interface-getrawtxresult), [GetRawTxService](./client.md#type-getrawtxservice), [GetScriptHashHistoryResult](./client.md#interface-getscripthashhistoryresult), [GetScriptHashHistoryService](./client.md#type-getscripthashhistoryservice), [GetStatusForTxidsResult](./client.md#interface-getstatusfortxidsresult), [GetStatusForTxidsService](./client.md#type-getstatusfortxidsservice), [GetUtxoStatusOutputFormat](./client.md#type-getutxostatusoutputformat), [GetUtxoStatusResult](./client.md#interface-getutxostatusresult), [GetUtxoStatusService](./client.md#type-getutxostatusservice), [PostBeefResult](./client.md#interface-postbeefresult), [PostBeefService](./client.md#type-postbeefservice), [ServiceCollection](./services.md#class-servicecollection), [UpdateFiatExchangeRateService](./client.md#type-updatefiatexchangerateservice), [WalletServices](./client.md#interface-walletservices), [WalletServicesOptions](./client.md#interface-walletservicesoptions), [WhatsOnChain](./services.md#class-whatsonchain)
|
|
444
614
|
|
|
445
615
|
###### Method hashOutputScript
|
|
446
616
|
|
|
@@ -567,6 +737,10 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
567
737
|
| [arcDefaultUrl](#function-arcdefaulturl) |
|
|
568
738
|
| [createDefaultWalletServicesOptions](#function-createdefaultwalletservicesoptions) |
|
|
569
739
|
| [getExchangeRatesIo](#function-getexchangeratesio) |
|
|
740
|
+
| [isBaseBlockHeader](#function-isbaseblockheader) |
|
|
741
|
+
| [isBlockHeader](#function-isblockheader) |
|
|
742
|
+
| [isLive](#function-islive) |
|
|
743
|
+
| [isLiveBlockHeader](#function-isliveblockheader) |
|
|
570
744
|
| [toBinaryBaseBlockHeader](#function-tobinarybaseblockheader) |
|
|
571
745
|
| [updateChaintracksFiatExchangeRates](#function-updatechaintracksfiatexchangerates) |
|
|
572
746
|
| [updateExchangeratesapi](#function-updateexchangeratesapi) |
|
|
@@ -608,6 +782,66 @@ See also: [ExchangeRatesIoApi](./services.md#interface-exchangeratesioapi)
|
|
|
608
782
|
|
|
609
783
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
610
784
|
|
|
785
|
+
---
|
|
786
|
+
##### Function: isBaseBlockHeader
|
|
787
|
+
|
|
788
|
+
Type guard function.
|
|
789
|
+
|
|
790
|
+
```ts
|
|
791
|
+
export function isBaseBlockHeader(header: BaseBlockHeader | BlockHeader | LiveBlockHeader): header is BaseBlockHeader {
|
|
792
|
+
return typeof header.previousHash === "string";
|
|
793
|
+
}
|
|
794
|
+
```
|
|
795
|
+
|
|
796
|
+
See also: [BaseBlockHeader](./services.md#interface-baseblockheader), [BlockHeader](./services.md#interface-blockheader), [LiveBlockHeader](./services.md#interface-liveblockheader)
|
|
797
|
+
|
|
798
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
799
|
+
|
|
800
|
+
---
|
|
801
|
+
##### Function: isBlockHeader
|
|
802
|
+
|
|
803
|
+
Type guard function.
|
|
804
|
+
|
|
805
|
+
```ts
|
|
806
|
+
export function isBlockHeader(header: BaseBlockHeader | BlockHeader | LiveBlockHeader): header is LiveBlockHeader {
|
|
807
|
+
return "height" in header && typeof header.previousHash === "string";
|
|
808
|
+
}
|
|
809
|
+
```
|
|
810
|
+
|
|
811
|
+
See also: [BaseBlockHeader](./services.md#interface-baseblockheader), [BlockHeader](./services.md#interface-blockheader), [LiveBlockHeader](./services.md#interface-liveblockheader)
|
|
812
|
+
|
|
813
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
814
|
+
|
|
815
|
+
---
|
|
816
|
+
##### Function: isLive
|
|
817
|
+
|
|
818
|
+
Type guard function.
|
|
819
|
+
|
|
820
|
+
```ts
|
|
821
|
+
export function isLive(header: BlockHeader | LiveBlockHeader): header is LiveBlockHeader {
|
|
822
|
+
return (header as LiveBlockHeader).headerId !== undefined;
|
|
823
|
+
}
|
|
824
|
+
```
|
|
825
|
+
|
|
826
|
+
See also: [BlockHeader](./services.md#interface-blockheader), [LiveBlockHeader](./services.md#interface-liveblockheader)
|
|
827
|
+
|
|
828
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
829
|
+
|
|
830
|
+
---
|
|
831
|
+
##### Function: isLiveBlockHeader
|
|
832
|
+
|
|
833
|
+
Type guard function.
|
|
834
|
+
|
|
835
|
+
```ts
|
|
836
|
+
export function isLiveBlockHeader(header: BaseBlockHeader | BlockHeader | LiveBlockHeader): header is LiveBlockHeader {
|
|
837
|
+
return "chainwork" in header && typeof header.previousHash === "string";
|
|
838
|
+
}
|
|
839
|
+
```
|
|
840
|
+
|
|
841
|
+
See also: [BaseBlockHeader](./services.md#interface-baseblockheader), [BlockHeader](./services.md#interface-blockheader), [LiveBlockHeader](./services.md#interface-liveblockheader)
|
|
842
|
+
|
|
843
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
844
|
+
|
|
611
845
|
---
|
|
612
846
|
##### Function: toBinaryBaseBlockHeader
|
|
613
847
|
|
|
@@ -630,7 +864,7 @@ export function toBinaryBaseBlockHeader(header: sdk.BaseBlockHeader): number[] {
|
|
|
630
864
|
}
|
|
631
865
|
```
|
|
632
866
|
|
|
633
|
-
See also: [BaseBlockHeader](./
|
|
867
|
+
See also: [BaseBlockHeader](./services.md#interface-baseblockheader), [asArray](./client.md#function-asarray)
|
|
634
868
|
|
|
635
869
|
Returns
|
|
636
870
|
|