@stacks/blockchain-api-client 7.4.0-nakamoto.4 → 7.4.0-nakamoto.5
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.5",
|
|
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,6 +21,9 @@ 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,
|
|
@@ -57,11 +60,13 @@ export interface GetBlocksRequest {
|
|
|
57
60
|
burnBlockHeight?: number;
|
|
58
61
|
}
|
|
59
62
|
|
|
60
|
-
export interface
|
|
63
|
+
export interface GetBurnBlockRequest {
|
|
64
|
+
heightOrHash: number | string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface GetBurnBlocksRequest {
|
|
61
68
|
limit?: number;
|
|
62
69
|
offset?: number;
|
|
63
|
-
height?: number;
|
|
64
|
-
hash?: string;
|
|
65
70
|
}
|
|
66
71
|
|
|
67
72
|
/**
|
|
@@ -171,24 +176,38 @@ export interface BlocksApiInterface {
|
|
|
171
176
|
*/
|
|
172
177
|
getBlocks(requestParameters: GetBlocksRequest, initOverrides?: RequestInit): Promise<NakamotoBlockListResponse>;
|
|
173
178
|
|
|
179
|
+
/**
|
|
180
|
+
* Retrieves a single burn block
|
|
181
|
+
* @summary Get burn block
|
|
182
|
+
* @param {number | string} heightOrHash filter by burn block height, hash, or the constant `latest` to filter for the most recent burn block
|
|
183
|
+
* @param {*} [options] Override http request option.
|
|
184
|
+
* @throws {RequiredError}
|
|
185
|
+
* @memberof BlocksApiInterface
|
|
186
|
+
*/
|
|
187
|
+
getBurnBlockRaw(requestParameters: GetBurnBlockRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<BurnBlock>>;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Retrieves a single burn block
|
|
191
|
+
* Get burn block
|
|
192
|
+
*/
|
|
193
|
+
getBurnBlock(requestParameters: GetBurnBlockRequest, initOverrides?: RequestInit): Promise<BurnBlock>;
|
|
194
|
+
|
|
174
195
|
/**
|
|
175
196
|
* Retrieves a list of recent burn blocks
|
|
176
|
-
* @summary Get
|
|
197
|
+
* @summary Get burn blocks
|
|
177
198
|
* @param {number} [limit] max number of burn blocks to fetch
|
|
178
199
|
* @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
200
|
* @param {*} [options] Override http request option.
|
|
182
201
|
* @throws {RequiredError}
|
|
183
202
|
* @memberof BlocksApiInterface
|
|
184
203
|
*/
|
|
185
|
-
|
|
204
|
+
getBurnBlocksRaw(requestParameters: GetBurnBlocksRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<BurnBlockListResponse>>;
|
|
186
205
|
|
|
187
206
|
/**
|
|
188
207
|
* Retrieves a list of recent burn blocks
|
|
189
|
-
* Get
|
|
208
|
+
* Get burn blocks
|
|
190
209
|
*/
|
|
191
|
-
|
|
210
|
+
getBurnBlocks(requestParameters: GetBurnBlocksRequest, initOverrides?: RequestInit): Promise<BurnBlockListResponse>;
|
|
192
211
|
|
|
193
212
|
}
|
|
194
213
|
|
|
@@ -405,11 +424,43 @@ export class BlocksApi extends runtime.BaseAPI implements BlocksApiInterface {
|
|
|
405
424
|
return await response.value();
|
|
406
425
|
}
|
|
407
426
|
|
|
427
|
+
/**
|
|
428
|
+
* Retrieves a single burn block
|
|
429
|
+
* Get burn block
|
|
430
|
+
*/
|
|
431
|
+
async getBurnBlockRaw(requestParameters: GetBurnBlockRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<BurnBlock>> {
|
|
432
|
+
if (requestParameters.heightOrHash === null || requestParameters.heightOrHash === undefined) {
|
|
433
|
+
throw new runtime.RequiredError('heightOrHash','Required parameter requestParameters.heightOrHash was null or undefined when calling getBurnBlock.');
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
const queryParameters: any = {};
|
|
437
|
+
|
|
438
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
439
|
+
|
|
440
|
+
const response = await this.request({
|
|
441
|
+
path: `/extended/v2/burn-blocks/{height_or_hash}`.replace(`{${"height_or_hash"}}`, encodeURIComponent(String(requestParameters.heightOrHash))),
|
|
442
|
+
method: 'GET',
|
|
443
|
+
headers: headerParameters,
|
|
444
|
+
query: queryParameters,
|
|
445
|
+
}, initOverrides);
|
|
446
|
+
|
|
447
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => BurnBlockFromJSON(jsonValue));
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* Retrieves a single burn block
|
|
452
|
+
* Get burn block
|
|
453
|
+
*/
|
|
454
|
+
async getBurnBlock(requestParameters: GetBurnBlockRequest, initOverrides?: RequestInit): Promise<BurnBlock> {
|
|
455
|
+
const response = await this.getBurnBlockRaw(requestParameters, initOverrides);
|
|
456
|
+
return await response.value();
|
|
457
|
+
}
|
|
458
|
+
|
|
408
459
|
/**
|
|
409
460
|
* Retrieves a list of recent burn blocks
|
|
410
|
-
* Get
|
|
461
|
+
* Get burn blocks
|
|
411
462
|
*/
|
|
412
|
-
async
|
|
463
|
+
async getBurnBlocksRaw(requestParameters: GetBurnBlocksRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<BurnBlockListResponse>> {
|
|
413
464
|
const queryParameters: any = {};
|
|
414
465
|
|
|
415
466
|
if (requestParameters.limit !== undefined) {
|
|
@@ -420,18 +471,10 @@ export class BlocksApi extends runtime.BaseAPI implements BlocksApiInterface {
|
|
|
420
471
|
queryParameters['offset'] = requestParameters.offset;
|
|
421
472
|
}
|
|
422
473
|
|
|
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
474
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
432
475
|
|
|
433
476
|
const response = await this.request({
|
|
434
|
-
path: `/extended/
|
|
477
|
+
path: `/extended/v2/burn-blocks`,
|
|
435
478
|
method: 'GET',
|
|
436
479
|
headers: headerParameters,
|
|
437
480
|
query: queryParameters,
|
|
@@ -442,10 +485,10 @@ export class BlocksApi extends runtime.BaseAPI implements BlocksApiInterface {
|
|
|
442
485
|
|
|
443
486
|
/**
|
|
444
487
|
* Retrieves a list of recent burn blocks
|
|
445
|
-
* Get
|
|
488
|
+
* Get burn blocks
|
|
446
489
|
*/
|
|
447
|
-
async
|
|
448
|
-
const response = await this.
|
|
490
|
+
async getBurnBlocks(requestParameters: GetBurnBlocksRequest, initOverrides?: RequestInit): Promise<BurnBlockListResponse> {
|
|
491
|
+
const response = await this.getBurnBlocksRaw(requestParameters, initOverrides);
|
|
449
492
|
return await response.value();
|
|
450
493
|
}
|
|
451
494
|
|