@stacks/blockchain-api-client 7.11.0-beta.3 → 7.11.0-beta.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.11.0-beta.3",
3
+ "version": "7.11.0-beta.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",
@@ -37,6 +37,7 @@ models/AddressTransactionsV2ListResponseEvents.ts
37
37
  models/AddressTransactionsV2ListResponseEventsStx.ts
38
38
  models/AddressTransactionsWithTransfersListResponse.ts
39
39
  models/AddressUnlockSchedule.ts
40
+ models/AverageBlockTimesResponse.ts
40
41
  models/Block.ts
41
42
  models/BlockListResponse.ts
42
43
  models/BnsError.ts
@@ -15,6 +15,9 @@
15
15
 
16
16
  import * as runtime from '../runtime';
17
17
  import {
18
+ AverageBlockTimesResponse,
19
+ AverageBlockTimesResponseFromJSON,
20
+ AverageBlockTimesResponseToJSON,
18
21
  Block,
19
22
  BlockFromJSON,
20
23
  BlockToJSON,
@@ -72,6 +75,21 @@ export interface GetBlocksByBurnBlockRequest {
72
75
  * @interface BlocksApiInterface
73
76
  */
74
77
  export interface BlocksApiInterface {
78
+ /**
79
+ * Retrieves average block times (in seconds)
80
+ * @summary Get average block times
81
+ * @param {*} [options] Override http request option.
82
+ * @throws {RequiredError}
83
+ * @memberof BlocksApiInterface
84
+ */
85
+ getAverageBlockTimesRaw(initOverrides?: RequestInit): Promise<runtime.ApiResponse<AverageBlockTimesResponse>>;
86
+
87
+ /**
88
+ * Retrieves average block times (in seconds)
89
+ * Get average block times
90
+ */
91
+ getAverageBlockTimes(initOverrides?: RequestInit): Promise<AverageBlockTimesResponse>;
92
+
75
93
  /**
76
94
  * Retrieves a single block
77
95
  * @summary Get block
@@ -211,6 +229,34 @@ export interface BlocksApiInterface {
211
229
  */
212
230
  export class BlocksApi extends runtime.BaseAPI implements BlocksApiInterface {
213
231
 
232
+ /**
233
+ * Retrieves average block times (in seconds)
234
+ * Get average block times
235
+ */
236
+ async getAverageBlockTimesRaw(initOverrides?: RequestInit): Promise<runtime.ApiResponse<AverageBlockTimesResponse>> {
237
+ const queryParameters: any = {};
238
+
239
+ const headerParameters: runtime.HTTPHeaders = {};
240
+
241
+ const response = await this.request({
242
+ path: `/extended/v2/blocks/average-times`,
243
+ method: 'GET',
244
+ headers: headerParameters,
245
+ query: queryParameters,
246
+ }, initOverrides);
247
+
248
+ return new runtime.JSONApiResponse(response, (jsonValue) => AverageBlockTimesResponseFromJSON(jsonValue));
249
+ }
250
+
251
+ /**
252
+ * Retrieves average block times (in seconds)
253
+ * Get average block times
254
+ */
255
+ async getAverageBlockTimes(initOverrides?: RequestInit): Promise<AverageBlockTimesResponse> {
256
+ const response = await this.getAverageBlockTimesRaw(initOverrides);
257
+ return await response.value();
258
+ }
259
+
214
260
  /**
215
261
  * Retrieves a single block
216
262
  * Get block
@@ -0,0 +1,80 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Stacks Blockchain API
5
+ * Welcome to the API reference overview for the [Stacks Blockchain API](https://docs.hiro.so/stacks-blockchain-api). [Download Postman collection](https://hirosystems.github.io/stacks-blockchain-api/collection.json)
6
+ *
7
+ * The version of the OpenAPI document: STACKS_API_VERSION
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import { exists, mapValues } from '../runtime';
16
+ /**
17
+ * Request to fetch average block times (in seconds)
18
+ * @export
19
+ * @interface AverageBlockTimesResponse
20
+ */
21
+ export interface AverageBlockTimesResponse {
22
+ /**
23
+ * Average block times over the last hour (in seconds)
24
+ * @type {number}
25
+ * @memberof AverageBlockTimesResponse
26
+ */
27
+ last_1h: number;
28
+ /**
29
+ * Average block times over the last 24 hours (in seconds)
30
+ * @type {number}
31
+ * @memberof AverageBlockTimesResponse
32
+ */
33
+ last_24h: number;
34
+ /**
35
+ * Average block times over the last 7 days (in seconds)
36
+ * @type {number}
37
+ * @memberof AverageBlockTimesResponse
38
+ */
39
+ last_7d: number;
40
+ /**
41
+ * Average block times over the last 30 days (in seconds)
42
+ * @type {number}
43
+ * @memberof AverageBlockTimesResponse
44
+ */
45
+ last_30d: number;
46
+ }
47
+
48
+ export function AverageBlockTimesResponseFromJSON(json: any): AverageBlockTimesResponse {
49
+ return AverageBlockTimesResponseFromJSONTyped(json, false);
50
+ }
51
+
52
+ export function AverageBlockTimesResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): AverageBlockTimesResponse {
53
+ if ((json === undefined) || (json === null)) {
54
+ return json;
55
+ }
56
+ return {
57
+
58
+ 'last_1h': json['last_1h'],
59
+ 'last_24h': json['last_24h'],
60
+ 'last_7d': json['last_7d'],
61
+ 'last_30d': json['last_30d'],
62
+ };
63
+ }
64
+
65
+ export function AverageBlockTimesResponseToJSON(value?: AverageBlockTimesResponse | null): any {
66
+ if (value === undefined) {
67
+ return undefined;
68
+ }
69
+ if (value === null) {
70
+ return null;
71
+ }
72
+ return {
73
+
74
+ 'last_1h': value.last_1h,
75
+ 'last_24h': value.last_24h,
76
+ 'last_7d': value.last_7d,
77
+ 'last_30d': value.last_30d,
78
+ };
79
+ }
80
+
@@ -49,6 +49,18 @@ export interface BurnBlock {
49
49
  * @memberof BurnBlock
50
50
  */
51
51
  stacks_blocks: Array<string>;
52
+ /**
53
+ * Average time between blocks in seconds. Returns 0 if there is only one block in the burn block.
54
+ * @type {number}
55
+ * @memberof BurnBlock
56
+ */
57
+ avg_block_time: number;
58
+ /**
59
+ * Total number of transactions in the Stacks blocks associated with this burn block
60
+ * @type {number}
61
+ * @memberof BurnBlock
62
+ */
63
+ total_tx_count: number;
52
64
  }
53
65
 
54
66
  export function BurnBlockFromJSON(json: any): BurnBlock {
@@ -66,6 +78,8 @@ export function BurnBlockFromJSONTyped(json: any, ignoreDiscriminator: boolean):
66
78
  'burn_block_hash': json['burn_block_hash'],
67
79
  'burn_block_height': json['burn_block_height'],
68
80
  'stacks_blocks': json['stacks_blocks'],
81
+ 'avg_block_time': json['avg_block_time'],
82
+ 'total_tx_count': json['total_tx_count'],
69
83
  };
70
84
  }
71
85
 
@@ -83,6 +97,8 @@ export function BurnBlockToJSON(value?: BurnBlock | null): any {
83
97
  'burn_block_hash': value.burn_block_hash,
84
98
  'burn_block_height': value.burn_block_height,
85
99
  'stacks_blocks': value.stacks_blocks,
100
+ 'avg_block_time': value.avg_block_time,
101
+ 'total_tx_count': value.total_tx_count,
86
102
  };
87
103
  }
88
104
 
@@ -19,6 +19,7 @@ export * from './AddressTransactionsV2ListResponseEvents';
19
19
  export * from './AddressTransactionsV2ListResponseEventsStx';
20
20
  export * from './AddressTransactionsWithTransfersListResponse';
21
21
  export * from './AddressUnlockSchedule';
22
+ export * from './AverageBlockTimesResponse';
22
23
  export * from './Block';
23
24
  export * from './BlockListResponse';
24
25
  export * from './BnsError';