|
| 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. [](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 | +} |
0 commit comments