@stacks/blockchain-api-client 7.4.0-nakamoto.4 → 7.4.0-nakamoto.6
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacks/blockchain-api-client",
|
|
3
|
-
"version": "7.4.0-nakamoto.
|
|
3
|
+
"version": "7.4.0-nakamoto.6",
|
|
4
4
|
"access": "public",
|
|
5
5
|
"description": "Client for the Stacks Blockchain API",
|
|
6
6
|
"homepage": "https://github.com/hirosystems/stacks-blockchain-api/tree/master/client#readme",
|
|
@@ -21,14 +21,24 @@ import {
|
|
|
21
21
|
BlockListResponse,
|
|
22
22
|
BlockListResponseFromJSON,
|
|
23
23
|
BlockListResponseToJSON,
|
|
24
|
+
BurnBlock,
|
|
25
|
+
BurnBlockFromJSON,
|
|
26
|
+
BurnBlockToJSON,
|
|
24
27
|
BurnBlockListResponse,
|
|
25
28
|
BurnBlockListResponseFromJSON,
|
|
26
29
|
BurnBlockListResponseToJSON,
|
|
30
|
+
NakamotoBlock,
|
|
31
|
+
NakamotoBlockFromJSON,
|
|
32
|
+
NakamotoBlockToJSON,
|
|
27
33
|
NakamotoBlockListResponse,
|
|
28
34
|
NakamotoBlockListResponseFromJSON,
|
|
29
35
|
NakamotoBlockListResponseToJSON,
|
|
30
36
|
} from '../models';
|
|
31
37
|
|
|
38
|
+
export interface GetBlockRequest {
|
|
39
|
+
heightOrHash: number | string;
|
|
40
|
+
}
|
|
41
|
+
|
|
32
42
|
export interface GetBlockByBurnBlockHashRequest {
|
|
33
43
|
burnBlockHash: string;
|
|
34
44
|
}
|
|
@@ -57,11 +67,13 @@ export interface GetBlocksRequest {
|
|
|
57
67
|
burnBlockHeight?: number;
|
|
58
68
|
}
|
|
59
69
|
|
|
60
|
-
export interface
|
|
70
|
+
export interface GetBurnBlockRequest {
|
|
71
|
+
heightOrHash: number | string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface GetBurnBlocksRequest {
|
|
61
75
|
limit?: number;
|
|
62
76
|
offset?: number;
|
|
63
|
-
height?: number;
|
|
64
|
-
hash?: string;
|
|
65
77
|
}
|
|
66
78
|
|
|
67
79
|
/**
|
|
@@ -71,6 +83,22 @@ export interface GetBurnBlockListRequest {
|
|
|
71
83
|
* @interface BlocksApiInterface
|
|
72
84
|
*/
|
|
73
85
|
export interface BlocksApiInterface {
|
|
86
|
+
/**
|
|
87
|
+
* Retrieves a single block
|
|
88
|
+
* @summary Get block
|
|
89
|
+
* @param {number | string} heightOrHash filter by block height, hash, index block hash or the constant `latest` to filter for the most recent block
|
|
90
|
+
* @param {*} [options] Override http request option.
|
|
91
|
+
* @throws {RequiredError}
|
|
92
|
+
* @memberof BlocksApiInterface
|
|
93
|
+
*/
|
|
94
|
+
getBlockRaw(requestParameters: GetBlockRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<NakamotoBlock>>;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Retrieves a single block
|
|
98
|
+
* Get block
|
|
99
|
+
*/
|
|
100
|
+
getBlock(requestParameters: GetBlockRequest, initOverrides?: RequestInit): Promise<NakamotoBlock>;
|
|
101
|
+
|
|
74
102
|
/**
|
|
75
103
|
* **NOTE:** This endpoint is deprecated in favor of [Get blocks](#operation/get_blocks). Retrieves block details of a specific block for a given burnchain block hash
|
|
76
104
|
* @summary Get block by burnchain block hash
|
|
@@ -104,7 +132,7 @@ export interface BlocksApiInterface {
|
|
|
104
132
|
getBlockByBurnBlockHeight(requestParameters: GetBlockByBurnBlockHeightRequest, initOverrides?: RequestInit): Promise<Block>;
|
|
105
133
|
|
|
106
134
|
/**
|
|
107
|
-
* Retrieves block details of a specific block for a given chain height. You can use the hash from your latest block (\'get_block_list\' API) to get your block details.
|
|
135
|
+
* **NOTE:** This endpoint is deprecated in favor of [Get block](#operation/get_block). Retrieves block details of a specific block for a given chain height. You can use the hash from your latest block (\'get_block_list\' API) to get your block details.
|
|
108
136
|
* @summary Get block by hash
|
|
109
137
|
* @param {string} hash Hash of the block
|
|
110
138
|
* @param {*} [options] Override http request option.
|
|
@@ -114,13 +142,13 @@ export interface BlocksApiInterface {
|
|
|
114
142
|
getBlockByHashRaw(requestParameters: GetBlockByHashRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<Block>>;
|
|
115
143
|
|
|
116
144
|
/**
|
|
117
|
-
* Retrieves block details of a specific block for a given chain height. You can use the hash from your latest block (\'get_block_list\' API) to get your block details.
|
|
145
|
+
* **NOTE:** This endpoint is deprecated in favor of [Get block](#operation/get_block). Retrieves block details of a specific block for a given chain height. You can use the hash from your latest block (\'get_block_list\' API) to get your block details.
|
|
118
146
|
* Get block by hash
|
|
119
147
|
*/
|
|
120
148
|
getBlockByHash(requestParameters: GetBlockByHashRequest, initOverrides?: RequestInit): Promise<Block>;
|
|
121
149
|
|
|
122
150
|
/**
|
|
123
|
-
* Retrieves block details of a specific block at a given block height
|
|
151
|
+
* **NOTE:** This endpoint is deprecated in favor of [Get block](#operation/get_block). Retrieves block details of a specific block at a given block height
|
|
124
152
|
* @summary Get block by height
|
|
125
153
|
* @param {number} height Height of the block
|
|
126
154
|
* @param {*} [options] Override http request option.
|
|
@@ -130,7 +158,7 @@ export interface BlocksApiInterface {
|
|
|
130
158
|
getBlockByHeightRaw(requestParameters: GetBlockByHeightRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<Block>>;
|
|
131
159
|
|
|
132
160
|
/**
|
|
133
|
-
* Retrieves block details of a specific block at a given block height
|
|
161
|
+
* **NOTE:** This endpoint is deprecated in favor of [Get block](#operation/get_block). Retrieves block details of a specific block at a given block height
|
|
134
162
|
* Get block by height
|
|
135
163
|
*/
|
|
136
164
|
getBlockByHeight(requestParameters: GetBlockByHeightRequest, initOverrides?: RequestInit): Promise<Block>;
|
|
@@ -171,24 +199,38 @@ export interface BlocksApiInterface {
|
|
|
171
199
|
*/
|
|
172
200
|
getBlocks(requestParameters: GetBlocksRequest, initOverrides?: RequestInit): Promise<NakamotoBlockListResponse>;
|
|
173
201
|
|
|
202
|
+
/**
|
|
203
|
+
* Retrieves a single burn block
|
|
204
|
+
* @summary Get burn block
|
|
205
|
+
* @param {number | string} heightOrHash filter by burn block height, hash, or the constant `latest` to filter for the most recent burn block
|
|
206
|
+
* @param {*} [options] Override http request option.
|
|
207
|
+
* @throws {RequiredError}
|
|
208
|
+
* @memberof BlocksApiInterface
|
|
209
|
+
*/
|
|
210
|
+
getBurnBlockRaw(requestParameters: GetBurnBlockRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<BurnBlock>>;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Retrieves a single burn block
|
|
214
|
+
* Get burn block
|
|
215
|
+
*/
|
|
216
|
+
getBurnBlock(requestParameters: GetBurnBlockRequest, initOverrides?: RequestInit): Promise<BurnBlock>;
|
|
217
|
+
|
|
174
218
|
/**
|
|
175
219
|
* Retrieves a list of recent burn blocks
|
|
176
|
-
* @summary Get
|
|
220
|
+
* @summary Get burn blocks
|
|
177
221
|
* @param {number} [limit] max number of burn blocks to fetch
|
|
178
222
|
* @param {number} [offset] index of first burn block to fetch
|
|
179
|
-
* @param {number} [height] filter by burn block height
|
|
180
|
-
* @param {string} [hash] filter by burn block hash or the constant \'latest\' to filter for the most recent burn block
|
|
181
223
|
* @param {*} [options] Override http request option.
|
|
182
224
|
* @throws {RequiredError}
|
|
183
225
|
* @memberof BlocksApiInterface
|
|
184
226
|
*/
|
|
185
|
-
|
|
227
|
+
getBurnBlocksRaw(requestParameters: GetBurnBlocksRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<BurnBlockListResponse>>;
|
|
186
228
|
|
|
187
229
|
/**
|
|
188
230
|
* Retrieves a list of recent burn blocks
|
|
189
|
-
* Get
|
|
231
|
+
* Get burn blocks
|
|
190
232
|
*/
|
|
191
|
-
|
|
233
|
+
getBurnBlocks(requestParameters: GetBurnBlocksRequest, initOverrides?: RequestInit): Promise<BurnBlockListResponse>;
|
|
192
234
|
|
|
193
235
|
}
|
|
194
236
|
|
|
@@ -197,6 +239,38 @@ export interface BlocksApiInterface {
|
|
|
197
239
|
*/
|
|
198
240
|
export class BlocksApi extends runtime.BaseAPI implements BlocksApiInterface {
|
|
199
241
|
|
|
242
|
+
/**
|
|
243
|
+
* Retrieves a single block
|
|
244
|
+
* Get block
|
|
245
|
+
*/
|
|
246
|
+
async getBlockRaw(requestParameters: GetBlockRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<NakamotoBlock>> {
|
|
247
|
+
if (requestParameters.heightOrHash === null || requestParameters.heightOrHash === undefined) {
|
|
248
|
+
throw new runtime.RequiredError('heightOrHash','Required parameter requestParameters.heightOrHash was null or undefined when calling getBlock.');
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
const queryParameters: any = {};
|
|
252
|
+
|
|
253
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
254
|
+
|
|
255
|
+
const response = await this.request({
|
|
256
|
+
path: `/extended/v2/blocks/{height_or_hash}`.replace(`{${"height_or_hash"}}`, encodeURIComponent(String(requestParameters.heightOrHash))),
|
|
257
|
+
method: 'GET',
|
|
258
|
+
headers: headerParameters,
|
|
259
|
+
query: queryParameters,
|
|
260
|
+
}, initOverrides);
|
|
261
|
+
|
|
262
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => NakamotoBlockFromJSON(jsonValue));
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Retrieves a single block
|
|
267
|
+
* Get block
|
|
268
|
+
*/
|
|
269
|
+
async getBlock(requestParameters: GetBlockRequest, initOverrides?: RequestInit): Promise<NakamotoBlock> {
|
|
270
|
+
const response = await this.getBlockRaw(requestParameters, initOverrides);
|
|
271
|
+
return await response.value();
|
|
272
|
+
}
|
|
273
|
+
|
|
200
274
|
/**
|
|
201
275
|
* **NOTE:** This endpoint is deprecated in favor of [Get blocks](#operation/get_blocks). Retrieves block details of a specific block for a given burnchain block hash
|
|
202
276
|
* Get block by burnchain block hash
|
|
@@ -262,7 +336,7 @@ export class BlocksApi extends runtime.BaseAPI implements BlocksApiInterface {
|
|
|
262
336
|
}
|
|
263
337
|
|
|
264
338
|
/**
|
|
265
|
-
* Retrieves block details of a specific block for a given chain height. You can use the hash from your latest block (\'get_block_list\' API) to get your block details.
|
|
339
|
+
* **NOTE:** This endpoint is deprecated in favor of [Get block](#operation/get_block). Retrieves block details of a specific block for a given chain height. You can use the hash from your latest block (\'get_block_list\' API) to get your block details.
|
|
266
340
|
* Get block by hash
|
|
267
341
|
*/
|
|
268
342
|
async getBlockByHashRaw(requestParameters: GetBlockByHashRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<Block>> {
|
|
@@ -285,7 +359,7 @@ export class BlocksApi extends runtime.BaseAPI implements BlocksApiInterface {
|
|
|
285
359
|
}
|
|
286
360
|
|
|
287
361
|
/**
|
|
288
|
-
* Retrieves block details of a specific block for a given chain height. You can use the hash from your latest block (\'get_block_list\' API) to get your block details.
|
|
362
|
+
* **NOTE:** This endpoint is deprecated in favor of [Get block](#operation/get_block). Retrieves block details of a specific block for a given chain height. You can use the hash from your latest block (\'get_block_list\' API) to get your block details.
|
|
289
363
|
* Get block by hash
|
|
290
364
|
*/
|
|
291
365
|
async getBlockByHash(requestParameters: GetBlockByHashRequest, initOverrides?: RequestInit): Promise<Block> {
|
|
@@ -294,7 +368,7 @@ export class BlocksApi extends runtime.BaseAPI implements BlocksApiInterface {
|
|
|
294
368
|
}
|
|
295
369
|
|
|
296
370
|
/**
|
|
297
|
-
* Retrieves block details of a specific block at a given block height
|
|
371
|
+
* **NOTE:** This endpoint is deprecated in favor of [Get block](#operation/get_block). Retrieves block details of a specific block at a given block height
|
|
298
372
|
* Get block by height
|
|
299
373
|
*/
|
|
300
374
|
async getBlockByHeightRaw(requestParameters: GetBlockByHeightRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<Block>> {
|
|
@@ -317,7 +391,7 @@ export class BlocksApi extends runtime.BaseAPI implements BlocksApiInterface {
|
|
|
317
391
|
}
|
|
318
392
|
|
|
319
393
|
/**
|
|
320
|
-
* Retrieves block details of a specific block at a given block height
|
|
394
|
+
* **NOTE:** This endpoint is deprecated in favor of [Get block](#operation/get_block). Retrieves block details of a specific block at a given block height
|
|
321
395
|
* Get block by height
|
|
322
396
|
*/
|
|
323
397
|
async getBlockByHeight(requestParameters: GetBlockByHeightRequest, initOverrides?: RequestInit): Promise<Block> {
|
|
@@ -405,11 +479,43 @@ export class BlocksApi extends runtime.BaseAPI implements BlocksApiInterface {
|
|
|
405
479
|
return await response.value();
|
|
406
480
|
}
|
|
407
481
|
|
|
482
|
+
/**
|
|
483
|
+
* Retrieves a single burn block
|
|
484
|
+
* Get burn block
|
|
485
|
+
*/
|
|
486
|
+
async getBurnBlockRaw(requestParameters: GetBurnBlockRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<BurnBlock>> {
|
|
487
|
+
if (requestParameters.heightOrHash === null || requestParameters.heightOrHash === undefined) {
|
|
488
|
+
throw new runtime.RequiredError('heightOrHash','Required parameter requestParameters.heightOrHash was null or undefined when calling getBurnBlock.');
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
const queryParameters: any = {};
|
|
492
|
+
|
|
493
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
494
|
+
|
|
495
|
+
const response = await this.request({
|
|
496
|
+
path: `/extended/v2/burn-blocks/{height_or_hash}`.replace(`{${"height_or_hash"}}`, encodeURIComponent(String(requestParameters.heightOrHash))),
|
|
497
|
+
method: 'GET',
|
|
498
|
+
headers: headerParameters,
|
|
499
|
+
query: queryParameters,
|
|
500
|
+
}, initOverrides);
|
|
501
|
+
|
|
502
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => BurnBlockFromJSON(jsonValue));
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* Retrieves a single burn block
|
|
507
|
+
* Get burn block
|
|
508
|
+
*/
|
|
509
|
+
async getBurnBlock(requestParameters: GetBurnBlockRequest, initOverrides?: RequestInit): Promise<BurnBlock> {
|
|
510
|
+
const response = await this.getBurnBlockRaw(requestParameters, initOverrides);
|
|
511
|
+
return await response.value();
|
|
512
|
+
}
|
|
513
|
+
|
|
408
514
|
/**
|
|
409
515
|
* Retrieves a list of recent burn blocks
|
|
410
|
-
* Get
|
|
516
|
+
* Get burn blocks
|
|
411
517
|
*/
|
|
412
|
-
async
|
|
518
|
+
async getBurnBlocksRaw(requestParameters: GetBurnBlocksRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<BurnBlockListResponse>> {
|
|
413
519
|
const queryParameters: any = {};
|
|
414
520
|
|
|
415
521
|
if (requestParameters.limit !== undefined) {
|
|
@@ -420,18 +526,10 @@ export class BlocksApi extends runtime.BaseAPI implements BlocksApiInterface {
|
|
|
420
526
|
queryParameters['offset'] = requestParameters.offset;
|
|
421
527
|
}
|
|
422
528
|
|
|
423
|
-
if (requestParameters.height !== undefined) {
|
|
424
|
-
queryParameters['height'] = requestParameters.height;
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
if (requestParameters.hash !== undefined) {
|
|
428
|
-
queryParameters['hash'] = requestParameters.hash;
|
|
429
|
-
}
|
|
430
|
-
|
|
431
529
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
432
530
|
|
|
433
531
|
const response = await this.request({
|
|
434
|
-
path: `/extended/
|
|
532
|
+
path: `/extended/v2/burn-blocks`,
|
|
435
533
|
method: 'GET',
|
|
436
534
|
headers: headerParameters,
|
|
437
535
|
query: queryParameters,
|
|
@@ -442,10 +540,10 @@ export class BlocksApi extends runtime.BaseAPI implements BlocksApiInterface {
|
|
|
442
540
|
|
|
443
541
|
/**
|
|
444
542
|
* Retrieves a list of recent burn blocks
|
|
445
|
-
* Get
|
|
543
|
+
* Get burn blocks
|
|
446
544
|
*/
|
|
447
|
-
async
|
|
448
|
-
const response = await this.
|
|
545
|
+
async getBurnBlocks(requestParameters: GetBurnBlocksRequest, initOverrides?: RequestInit): Promise<BurnBlockListResponse> {
|
|
546
|
+
const response = await this.getBurnBlocksRaw(requestParameters, initOverrides);
|
|
449
547
|
return await response.value();
|
|
450
548
|
}
|
|
451
549
|
|