Skip to content

Commit 89165b2

Browse files
committed
feat: expose target block time #192
1 parent a3fdfe0 commit 89165b2

20 files changed

+504
-6
lines changed

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"lint": "eslint . --ext .ts -f codeframe",
2626
"lint:prettier": "prettier --check ./src/**/*.{ts}",
2727
"open": "http-server -o 9222 -o index.html",
28-
"prep-openapi": "rimraf ./.tmp && swagger-cli bundle --dereference -o ./.tmp/openapi.json ../docs/openapi.yaml && shx sed -i '^.*\\$schema.*$' '' ./.tmp/openapi.json",
28+
"prep-openapi": "rimraf ./.tmp && rimraf ./src/generated && swagger-cli bundle --dereference -o ./.tmp/openapi.json ../docs/openapi.yaml && shx sed -i '^.*\\$schema.*$' '' ./.tmp/openapi.json",
2929
"generate-openapi": "npm run prep-openapi && openapi-generator generate --skip-validate-spec -g typescript-fetch --additional-properties=typescriptThreePlus=true,supportsES6=true,legacyDiscriminatorBehavior=false,enumPropertyNaming=original,modelPropertyNaming=original -i ./.tmp/openapi.json -o ./src/generated"
3030
},
3131
"prettier": "@blockstack/prettier-config",
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
/* tslint:disable */
2+
/* eslint-disable */
3+
/**
4+
* Stacks 2.0 Blockchain API
5+
* This is the documentation for the Stacks 2.0 Blockchain API. It is comprised of two parts; the Stacks Blockchain API and the Stacks Core API. [![Run in Postman](https://run.pstmn.io/button.svg)](https://app.getpostman.com/run-collection/614feab5c108d292bffa#?env%5BStacks%20Blockchain%20API%5D=W3sia2V5Ijoic3R4X2FkZHJlc3MiLCJ2YWx1ZSI6IlNUMlRKUkhESE1ZQlE0MTdIRkIwQkRYNDMwVFFBNVBYUlg2NDk1RzFWIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJibG9ja19pZCIsInZhbHVlIjoiMHgiLCJlbmFibGVkIjp0cnVlfSx7ImtleSI6Im9mZnNldCIsInZhbHVlIjoiMCIsImVuYWJsZWQiOnRydWV9LHsia2V5IjoibGltaXRfdHgiLCJ2YWx1ZSI6IjIwMCIsImVuYWJsZWQiOnRydWV9LHsia2V5IjoibGltaXRfYmxvY2siLCJ2YWx1ZSI6IjMwIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJ0eF9pZCIsInZhbHVlIjoiMHg1NDA5MGMxNmE3MDJiNzUzYjQzMTE0ZTg4NGJjMTlhODBhNzk2MzhmZDQ0OWE0MGY4MDY4Y2RmMDAzY2RlNmUwIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJjb250cmFjdF9pZCIsInZhbHVlIjoiU1RKVFhFSlBKUFBWRE5BOUIwNTJOU1JSQkdRQ0ZOS1ZTMTc4VkdIMS5oZWxsb193b3JsZFxuIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJidGNfYWRkcmVzcyIsInZhbHVlIjoiYWJjIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJjb250cmFjdF9hZGRyZXNzIiwidmFsdWUiOiJTVEpUWEVKUEpQUFZETkE5QjA1Mk5TUlJCR1FDRk5LVlMxNzhWR0gxIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJjb250cmFjdF9uYW1lIiwidmFsdWUiOiJoZWxsb193b3JsZCIsImVuYWJsZWQiOnRydWV9LHsia2V5IjoiY29udHJhY3RfbWFwIiwidmFsdWUiOiJzdG9yZSIsImVuYWJsZWQiOnRydWV9LHsia2V5IjoiY29udHJhY3RfbWV0aG9kIiwidmFsdWUiOiJnZXQtdmFsdWUiLCJlbmFibGVkIjp0cnVlfV0=) ## Design ### Stacks Core API vs Stacks Blockchain API The blockchain\'s Rust implementation exposes a JSON RPC endpoint (\"Stacks Core API\"), which can be used to interface with the blockchain. It can be used directly. [See the documentation for the `stacks-blockchain` in its Github repository](https://github.com/blockstack/stacks-blockchain/) All `/v2/` routes a proxied to a Blockstack PBC-hosted Stacks Node. For a trustless architecture, you should make these requests to a self-hosted node. All `/extended/` routes are provided by the Stacks 2.0 Blockchain API directly. They extend the Stacks Core API capabilities to make it easier to integrate with. ### Pagination To make API responses more compact, lists returned by the API are paginated. For lists, the response body includes: - `limit`: the number of list items return per response - `offset`: the number of elements to skip (starting from `0`) - `total`: the number of all available list items - `results`: the array of list items (length of array equals the set limit) Using the `limit` and `offset` properties, you can paginate through the entire list by increasing the offset by the limit until you reach the total.
6+
*
7+
* The version of the OpenAPI document: 1.0.0
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+
16+
import * as runtime from '../runtime';
17+
import {
18+
NetworkBlockTimeResponse,
19+
NetworkBlockTimeResponseFromJSON,
20+
NetworkBlockTimeResponseToJSON,
21+
NetworkBlockTimesResponse,
22+
NetworkBlockTimesResponseFromJSON,
23+
NetworkBlockTimesResponseToJSON,
24+
} from '../models';
25+
26+
export interface GetNetworkBlockTimeByNetworkRequest {
27+
network: GetNetworkBlockTimeByNetworkNetworkEnum;
28+
}
29+
30+
/**
31+
*
32+
*/
33+
export class NetworkInfoApi extends runtime.BaseAPI {
34+
35+
/**
36+
* Get a given network\'s target block time
37+
*/
38+
async getNetworkBlockTimeByNetworkRaw(requestParameters: GetNetworkBlockTimeByNetworkRequest): Promise<runtime.ApiResponse<NetworkBlockTimeResponse>> {
39+
if (requestParameters.network === null || requestParameters.network === undefined) {
40+
throw new runtime.RequiredError('network','Required parameter requestParameters.network was null or undefined when calling getNetworkBlockTimeByNetwork.');
41+
}
42+
43+
const queryParameters: runtime.HTTPQuery = {};
44+
45+
const headerParameters: runtime.HTTPHeaders = {};
46+
47+
const response = await this.request({
48+
path: `/extended/v1/info/network_block_time/{network}`.replace(`{${"network"}}`, encodeURIComponent(String(requestParameters.network))),
49+
method: 'GET',
50+
headers: headerParameters,
51+
query: queryParameters,
52+
});
53+
54+
return new runtime.JSONApiResponse(response, (jsonValue) => NetworkBlockTimeResponseFromJSON(jsonValue));
55+
}
56+
57+
/**
58+
* Get a given network\'s target block time
59+
*/
60+
async getNetworkBlockTimeByNetwork(requestParameters: GetNetworkBlockTimeByNetworkRequest): Promise<NetworkBlockTimeResponse> {
61+
const response = await this.getNetworkBlockTimeByNetworkRaw(requestParameters);
62+
return await response.value();
63+
}
64+
65+
/**
66+
* Get the network target block time
67+
*/
68+
async getNetworkBlockTimesRaw(): Promise<runtime.ApiResponse<NetworkBlockTimesResponse>> {
69+
const queryParameters: runtime.HTTPQuery = {};
70+
71+
const headerParameters: runtime.HTTPHeaders = {};
72+
73+
const response = await this.request({
74+
path: `/extended/v1/info/network_block_times`,
75+
method: 'GET',
76+
headers: headerParameters,
77+
query: queryParameters,
78+
});
79+
80+
return new runtime.JSONApiResponse(response, (jsonValue) => NetworkBlockTimesResponseFromJSON(jsonValue));
81+
}
82+
83+
/**
84+
* Get the network target block time
85+
*/
86+
async getNetworkBlockTimes(): Promise<NetworkBlockTimesResponse> {
87+
const response = await this.getNetworkBlockTimesRaw();
88+
return await response.value();
89+
}
90+
91+
}
92+
93+
/**
94+
* @export
95+
* @enum {string}
96+
*/
97+
export enum GetNetworkBlockTimeByNetworkNetworkEnum {
98+
testnet = 'testnet',
99+
mainnet = 'mainnet'
100+
}

client/src/generated/apis/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export * from './BlocksApi';
33
export * from './FaucetsApi';
44
export * from './FeesApi';
55
export * from './InfoApi';
6+
export * from './NetworkInfoApi';
67
export * from './SearchApi';
78
export * from './SmartContractsApi';
89
export * from './TransactionsApi';
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/* tslint:disable */
2+
/* eslint-disable */
3+
/**
4+
* Stacks 2.0 Blockchain API
5+
* This is the documentation for the Stacks 2.0 Blockchain API. It is comprised of two parts; the Stacks Blockchain API and the Stacks Core API. [![Run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sImVuYWJsZWQiOnRydWV9LHsia2V5IjoiY29udHJhY3RfbWV0aG9kIiwidmFsdWUiOiJnZXQtdmFsdWUiLCJlbmFibGVkIjp0cnVlfV0=) ## Design ### Stacks Core API vs Stacks Blockchain API The blockchain\'s Rust implementation exposes a JSON RPC endpoint (\"Stacks Core API\"), which can be used to interface with the blockchain. It can be used directly. [See the documentation for the `stacks-blockchain` in its Github repository](https://github.com/blockstack/stacks-blockchain/) All `/v2/` routes a proxied to a Blockstack PBC-hosted Stacks Node. For a trustless architecture, you should make these requests to a self-hosted node. All `/extended/` routes are provided by the Stacks 2.0 Blockchain API directly. They extend the Stacks Core API capabilities to make it easier to integrate with. ### Pagination To make API responses more compact, lists returned by the API are paginated. For lists, the response body includes: - `limit`: the number of list items return per response - `offset`: the number of elements to skip (starting from `0`) - `total`: the number of all available list items - `results`: the array of list items (length of array equals the set limit) Using the `limit` and `offset` properties, you can paginate through the entire list by increasing the offset by the limit until you reach the total.
6+
*
7+
* The version of the OpenAPI document: 1.0.0
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+
* GET request that target block time for a given network
18+
* @export
19+
* @interface NetworkBlockTimeResponse
20+
*/
21+
export interface NetworkBlockTimeResponse {
22+
/**
23+
*
24+
* @type {number}
25+
* @memberof NetworkBlockTimeResponse
26+
*/
27+
target_block_time: number;
28+
}
29+
30+
export function NetworkBlockTimeResponseFromJSON(json: any): NetworkBlockTimeResponse {
31+
return NetworkBlockTimeResponseFromJSONTyped(json, false);
32+
}
33+
34+
export function NetworkBlockTimeResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): NetworkBlockTimeResponse {
35+
if ((json === undefined) || (json === null)) {
36+
return json;
37+
}
38+
return {
39+
40+
'target_block_time': json['target_block_time'],
41+
};
42+
}
43+
44+
export function NetworkBlockTimeResponseToJSON(value?: NetworkBlockTimeResponse | null): any {
45+
if (value === undefined) {
46+
return undefined;
47+
}
48+
if (value === null) {
49+
return null;
50+
}
51+
return {
52+
53+
'target_block_time': value.target_block_time,
54+
};
55+
}
56+
57+
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/* tslint:disable */
2+
/* eslint-disable */
3+
/**
4+
* Stacks 2.0 Blockchain API
5+
* This is the documentation for the Stacks 2.0 Blockchain API. It is comprised of two parts; the Stacks Blockchain API and the Stacks Core API. [![Run in Postman](https://run.pstmn.io/button.svg)](https://app.getpostman.com/run-collection/614feab5c108d292bffa#?env%5BStacks%20Blockchain%20API%5D=W3sia2V5Ijoic3R4X2FkZHJlc3MiLCJ2YWx1ZSI6IlNUMlRKUkhESE1ZQlE0MTdIRkIwQkRYNDMwVFFBNVBYUlg2NDk1RzFWIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJibG9ja19pZCIsInZhbHVlIjoiMHgiLCJlbmFibGVkIjp0cnVlfSx7ImtleSI6Im9mZnNldCIsInZhbHVlIjoiMCIsImVuYWJsZWQiOnRydWV9LHsia2V5IjoibGltaXRfdHgiLCJ2YWx1ZSI6IjIwMCIsImVuYWJsZWQiOnRydWV9LHsia2V5IjoibGltaXRfYmxvY2siLCJ2YWx1ZSI6IjMwIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJ0eF9pZCIsInZhbHVlIjoiMHg1NDA5MGMxNmE3MDJiNzUzYjQzMTE0ZTg4NGJjMTlhODBhNzk2MzhmZDQ0OWE0MGY4MDY4Y2RmMDAzY2RlNmUwIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJjb250cmFjdF9pZCIsInZhbHVlIjoiU1RKVFhFSlBKUFBWRE5BOUIwNTJOU1JSQkdRQ0ZOS1ZTMTc4VkdIMS5oZWxsb193b3JsZFxuIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJidGNfYWRkcmVzcyIsInZhbHVlIjoiYWJjIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJjb250cmFjdF9hZGRyZXNzIiwidmFsdWUiOiJTVEpUWEVKUEpQUFZETkE5QjA1Mk5TUlJCR1FDRk5LVlMxNzhWR0gxIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJjb250cmFjdF9uYW1lIiwidmFsdWUiOiJoZWxsb193b3JsZCIsImVuYWJsZWQiOnRydWV9LHsia2V5IjoiY29udHJhY3RfbWFwIiwidmFsdWUiOiJzdG9yZSIsImVuYWJsZWQiOnRydWV9LHsia2V5IjoiY29udHJhY3RfbWV0aG9kIiwidmFsdWUiOiJnZXQtdmFsdWUiLCJlbmFibGVkIjp0cnVlfV0=) ## Design ### Stacks Core API vs Stacks Blockchain API The blockchain\'s Rust implementation exposes a JSON RPC endpoint (\"Stacks Core API\"), which can be used to interface with the blockchain. It can be used directly. [See the documentation for the `stacks-blockchain` in its Github repository](https://github.com/blockstack/stacks-blockchain/) All `/v2/` routes a proxied to a Blockstack PBC-hosted Stacks Node. For a trustless architecture, you should make these requests to a self-hosted node. All `/extended/` routes are provided by the Stacks 2.0 Blockchain API directly. They extend the Stacks Core API capabilities to make it easier to integrate with. ### Pagination To make API responses more compact, lists returned by the API are paginated. For lists, the response body includes: - `limit`: the number of list items return per response - `offset`: the number of elements to skip (starting from `0`) - `total`: the number of all available list items - `results`: the array of list items (length of array equals the set limit) Using the `limit` and `offset` properties, you can paginate through the entire list by increasing the offset by the limit until you reach the total.
6+
*
7+
* The version of the OpenAPI document: 1.0.0
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+
import {
17+
NetworkBlockTimesResponseMainnet,
18+
NetworkBlockTimesResponseMainnetFromJSON,
19+
NetworkBlockTimesResponseMainnetFromJSONTyped,
20+
NetworkBlockTimesResponseMainnetToJSON,
21+
} from './';
22+
23+
/**
24+
* GET request that returns network target block times
25+
* @export
26+
* @interface NetworkBlockTimesResponse
27+
*/
28+
export interface NetworkBlockTimesResponse {
29+
/**
30+
*
31+
* @type {NetworkBlockTimesResponseMainnet}
32+
* @memberof NetworkBlockTimesResponse
33+
*/
34+
mainnet: NetworkBlockTimesResponseMainnet;
35+
/**
36+
*
37+
* @type {NetworkBlockTimesResponseMainnet}
38+
* @memberof NetworkBlockTimesResponse
39+
*/
40+
testnet: NetworkBlockTimesResponseMainnet;
41+
}
42+
43+
export function NetworkBlockTimesResponseFromJSON(json: any): NetworkBlockTimesResponse {
44+
return NetworkBlockTimesResponseFromJSONTyped(json, false);
45+
}
46+
47+
export function NetworkBlockTimesResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): NetworkBlockTimesResponse {
48+
if ((json === undefined) || (json === null)) {
49+
return json;
50+
}
51+
return {
52+
53+
'mainnet': NetworkBlockTimesResponseMainnetFromJSON(json['mainnet']),
54+
'testnet': NetworkBlockTimesResponseMainnetFromJSON(json['testnet']),
55+
};
56+
}
57+
58+
export function NetworkBlockTimesResponseToJSON(value?: NetworkBlockTimesResponse | null): any {
59+
if (value === undefined) {
60+
return undefined;
61+
}
62+
if (value === null) {
63+
return null;
64+
}
65+
return {
66+
67+
'mainnet': NetworkBlockTimesResponseMainnetToJSON(value.mainnet),
68+
'testnet': NetworkBlockTimesResponseMainnetToJSON(value.testnet),
69+
};
70+
}
71+
72+
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/* tslint:disable */
2+
/* eslint-disable */
3+
/**
4+
* Stacks 2.0 Blockchain API
5+
* This is the documentation for the Stacks 2.0 Blockchain API. It is comprised of two parts; the Stacks Blockchain API and the Stacks Core API. [![Run in Postman](https://run.pstmn.io/button.svg)](https://app.getpostman.com/run-collection/614feab5c108d292bffa#?env%5BStacks%20Blockchain%20API%5D=W3sia2V5Ijoic3R4X2FkZHJlc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0=) ## Design ### Stacks Core API vs Stacks Blockchain API The blockchain\'s Rust implementation exposes a JSON RPC endpoint (\"Stacks Core API\"), which can be used to interface with the blockchain. It can be used directly. [See the documentation for the `stacks-blockchain` in its Github repository](https://github.com/blockstack/stacks-blockchain/) All `/v2/` routes a proxied to a Blockstack PBC-hosted Stacks Node. For a trustless architecture, you should make these requests to a self-hosted node. All `/extended/` routes are provided by the Stacks 2.0 Blockchain API directly. They extend the Stacks Core API capabilities to make it easier to integrate with. ### Pagination To make API responses more compact, lists returned by the API are paginated. For lists, the response body includes: - `limit`: the number of list items return per response - `offset`: the number of elements to skip (starting from `0`) - `total`: the number of all available list items - `results`: the array of list items (length of array equals the set limit) Using the `limit` and `offset` properties, you can paginate through the entire list by increasing the offset by the limit until you reach the total.
6+
*
7+
* The version of the OpenAPI document: 1.0.0
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+
* TargetBlockTime
18+
* @export
19+
* @interface NetworkBlockTimesResponseMainnet
20+
*/
21+
export interface NetworkBlockTimesResponseMainnet {
22+
/**
23+
*
24+
* @type {number}
25+
* @memberof NetworkBlockTimesResponseMainnet
26+
*/
27+
target_block_time: number;
28+
}
29+
30+
export function NetworkBlockTimesResponseMainnetFromJSON(json: any): NetworkBlockTimesResponseMainnet {
31+
return NetworkBlockTimesResponseMainnetFromJSONTyped(json, false);
32+
}
33+
34+
export function NetworkBlockTimesResponseMainnetFromJSONTyped(json: any, ignoreDiscriminator: boolean): NetworkBlockTimesResponseMainnet {
35+
if ((json === undefined) || (json === null)) {
36+
return json;
37+
}
38+
return {
39+
40+
'target_block_time': json['target_block_time'],
41+
};
42+
}
43+
44+
export function NetworkBlockTimesResponseMainnetToJSON(value?: NetworkBlockTimesResponseMainnet | null): any {
45+
if (value === undefined) {
46+
return undefined;
47+
}
48+
if (value === null) {
49+
return null;
50+
}
51+
return {
52+
53+
'target_block_time': value.target_block_time,
54+
};
55+
}
56+
57+

client/src/generated/models/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,8 @@ export * from './BlockListResponse';
99
export * from './ContractInterfaceResponse';
1010
export * from './ContractSourceResponse';
1111
export * from './CoreNodeInfoResponse';
12+
export * from './NetworkBlockTimeResponse';
13+
export * from './NetworkBlockTimesResponse';
14+
export * from './NetworkBlockTimesResponseMainnet';
1215
export * from './RunFaucetResponse';
1316
export * from './TransactionResults';
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"target_block_time": 600
3+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"description": "GET request that target block time for a given network",
4+
"title": "NetworkBlockTimeResponse",
5+
"$ref": "../../entities/info/block-time.schema.json"
6+
}

0 commit comments

Comments
 (0)