UNPKG

@interlay/esplora-btc-api

Version:

Esplora Bitcoin OpenAPI Client

1,471 lines (1,381 loc) 102 kB
/* tslint:disable */ /* eslint-disable */ /** * Blockstream Esplora HTTP API * JSON over RESTful HTTP. Amounts are always represented in satoshis. * * The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { Configuration } from './configuration'; import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; /** * * @export * @interface InlineResponseDefault */ export interface InlineResponseDefault { /** * A list of transaction hashes the current hash is paired with, deepest pairing first. * @type {Array<string>} * @memberof InlineResponseDefault */ merkle: Array<string>; /** * The height of the block the transaction was confirmed in. * @type {number} * @memberof InlineResponseDefault */ block_height: number; /** * The 0-based index of the position of the transaction in the ordered list of transactions in the block. * @type {number} * @memberof InlineResponseDefault */ pos: number; } /** * * @export * @interface InlineResponseDefault1 */ export interface InlineResponseDefault1 { /** * * @type {string} * @memberof InlineResponseDefault1 */ address: string; /** * * @type {InlineResponseDefault1ChainStats} * @memberof InlineResponseDefault1 */ chain_stats: InlineResponseDefault1ChainStats; /** * * @type {InlineResponseDefault1ChainStats} * @memberof InlineResponseDefault1 */ mempool_stats: InlineResponseDefault1ChainStats; } /** * * @export * @interface InlineResponseDefault1ChainStats */ export interface InlineResponseDefault1ChainStats { /** * * @type {number} * @memberof InlineResponseDefault1ChainStats */ funded_txo_count?: number; /** * * @type {number} * @memberof InlineResponseDefault1ChainStats */ funded_txo_sum?: number; /** * * @type {number} * @memberof InlineResponseDefault1ChainStats */ spent_txo_count?: number; /** * * @type {number} * @memberof InlineResponseDefault1ChainStats */ spent_txo_sum?: number; /** * * @type {number} * @memberof InlineResponseDefault1ChainStats */ tx_count?: number; } /** * * @export * @interface InlineResponseDefault2 */ export interface InlineResponseDefault2 { /** * * @type {string} * @memberof InlineResponseDefault2 */ id: string; /** * * @type {number} * @memberof InlineResponseDefault2 */ height: number; /** * * @type {number} * @memberof InlineResponseDefault2 */ version: number; /** * * @type {number} * @memberof InlineResponseDefault2 */ timestamp: number; /** * * @type {number} * @memberof InlineResponseDefault2 */ bits: number; /** * * @type {number} * @memberof InlineResponseDefault2 */ nonce: number; /** * * @type {string} * @memberof InlineResponseDefault2 */ merkle_root: string; /** * * @type {number} * @memberof InlineResponseDefault2 */ tx_count: number; /** * * @type {number} * @memberof InlineResponseDefault2 */ size: number; /** * * @type {number} * @memberof InlineResponseDefault2 */ weight: number; /** * * @type {string} * @memberof InlineResponseDefault2 */ previousblockhash: string; } /** * * @export * @interface InlineResponseDefault3 */ export interface InlineResponseDefault3 { /** * * @type {boolean} * @memberof InlineResponseDefault3 */ in_best_chain: boolean; /** * * @type {number} * @memberof InlineResponseDefault3 */ height?: number; /** * * @type {string} * @memberof InlineResponseDefault3 */ next_best?: string; } /** * * @export * @interface InlineResponseDefault4 */ export interface InlineResponseDefault4 { /** * * @type {string} * @memberof InlineResponseDefault4 */ txid: string; /** * * @type {number} * @memberof InlineResponseDefault4 */ fee: number; /** * * @type {number} * @memberof InlineResponseDefault4 */ vsize: number; /** * * @type {number} * @memberof InlineResponseDefault4 */ value: number; } /** * * @export * @interface Mempool */ export interface Mempool { /** * * @type {number} * @memberof Mempool */ count: number; /** * * @type {number} * @memberof Mempool */ vsize: number; /** * * @type {number} * @memberof Mempool */ total_fee: number; /** * * @type {Array<Array<number>>} * @memberof Mempool */ fee_histogram: Array<Array<number>>; } /** * * @export * @interface Spend */ export interface Spend { /** * * @type {boolean} * @memberof Spend */ spent: boolean; /** * * @type {string} * @memberof Spend */ txid?: string; /** * * @type {string} * @memberof Spend */ vin?: string; /** * * @type {Status} * @memberof Spend */ status?: Status; } /** * * @export * @interface Status */ export interface Status { /** * * @type {boolean} * @memberof Status */ confirmed: boolean; /** * * @type {number} * @memberof Status */ block_height?: number; /** * * @type {string} * @memberof Status */ block_hash?: string; /** * * @type {number} * @memberof Status */ block_time?: number; } /** * * @export * @interface Transaction */ export interface Transaction { /** * * @type {string} * @memberof Transaction */ txid: string; /** * * @type {number} * @memberof Transaction */ version: number; /** * * @type {number} * @memberof Transaction */ locktime?: number; /** * * @type {Array<VIn>} * @memberof Transaction */ vin?: Array<VIn>; /** * * @type {Array<VOut>} * @memberof Transaction */ vout?: Array<VOut>; /** * * @type {number} * @memberof Transaction */ size?: number; /** * * @type {number} * @memberof Transaction */ weight?: number; /** * * @type {number} * @memberof Transaction */ fee?: number; /** * * @type {Status} * @memberof Transaction */ status?: Status; } /** * * @export * @interface UTXO */ export interface UTXO { /** * * @type {string} * @memberof UTXO */ txid: string; /** * * @type {number} * @memberof UTXO */ vout: number; /** * * @type {number} * @memberof UTXO */ value: number; /** * * @type {Status} * @memberof UTXO */ status?: Status; } /** * * @export * @interface VIn */ export interface VIn { /** * * @type {string} * @memberof VIn */ txid?: string; /** * * @type {number} * @memberof VIn */ vout?: number; /** * * @type {boolean} * @memberof VIn */ is_coinbase?: boolean; /** * * @type {string} * @memberof VIn */ scriptsig?: string; /** * * @type {string} * @memberof VIn */ scriptsig_asm?: string; /** * * @type {string} * @memberof VIn */ inner_redeemscript_asm?: string; /** * * @type {string} * @memberof VIn */ inner_witnessscript_asm?: string; /** * * @type {number} * @memberof VIn */ sequence?: number; /** * * @type {Array<string>} * @memberof VIn */ witness?: Array<string>; /** * * @type {VOut} * @memberof VIn */ prevout?: VOut; } /** * * @export * @interface VOut */ export interface VOut { /** * * @type {string} * @memberof VOut */ scriptpubkey?: string; /** * * @type {string} * @memberof VOut */ scriptpubkey_asm?: string; /** * * @type {string} * @memberof VOut */ scriptpubkey_type?: string; /** * * @type {string} * @memberof VOut */ scriptpubkey_address?: string; /** * * @type {number} * @memberof VOut */ value?: number; } /** * AddressApi - axios parameter creator * @export */ export const AddressApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * * @summary Get information about an address. * @param {string} address * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAddress: async (address: string, options: any = {}): Promise<RequestArgs> => { // verify required parameter 'address' is not null or undefined assertParamExists('getAddress', 'address', address) const localVarPath = `/address/{address}` .replace(`{${"address"}}`, encodeURIComponent(String(address))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * * @summary Get transaction history for the specified address, sorted with newest first. * @param {string} address * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAddressTxHistory: async (address: string, options: any = {}): Promise<RequestArgs> => { // verify required parameter 'address' is not null or undefined assertParamExists('getAddressTxHistory', 'address', address) const localVarPath = `/address/{address}/txs` .replace(`{${"address"}}`, encodeURIComponent(String(address))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * * @summary Get unconfirmed transaction history for the specified address. * @param {string} address * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAddressTxMempool: async (address: string, options: any = {}): Promise<RequestArgs> => { // verify required parameter 'address' is not null or undefined assertParamExists('getAddressTxMempool', 'address', address) const localVarPath = `/address/{address}/txs/mempool` .replace(`{${"address"}}`, encodeURIComponent(String(address))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * * @summary Get the list of unspent transaction outputs associated with the address. * @param {string} address * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAddressUtxo: async (address: string, options: any = {}): Promise<RequestArgs> => { // verify required parameter 'address' is not null or undefined assertParamExists('getAddressUtxo', 'address', address) const localVarPath = `/address/{address}/utxo` .replace(`{${"address"}}`, encodeURIComponent(String(address))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, } }; /** * AddressApi - functional programming interface * @export */ export const AddressApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = AddressApiAxiosParamCreator(configuration) return { /** * * @summary Get information about an address. * @param {string} address * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getAddress(address: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<InlineResponseDefault1>> { const localVarAxiosArgs = await localVarAxiosParamCreator.getAddress(address, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * * @summary Get transaction history for the specified address, sorted with newest first. * @param {string} address * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getAddressTxHistory(address: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<Transaction>>> { const localVarAxiosArgs = await localVarAxiosParamCreator.getAddressTxHistory(address, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * * @summary Get unconfirmed transaction history for the specified address. * @param {string} address * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getAddressTxMempool(address: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<Transaction>>> { const localVarAxiosArgs = await localVarAxiosParamCreator.getAddressTxMempool(address, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * * @summary Get the list of unspent transaction outputs associated with the address. * @param {string} address * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getAddressUtxo(address: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<UTXO>>> { const localVarAxiosArgs = await localVarAxiosParamCreator.getAddressUtxo(address, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; /** * AddressApi - factory interface * @export */ export const AddressApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = AddressApiFp(configuration) return { /** * * @summary Get information about an address. * @param {string} address * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAddress(address: string, options?: any): AxiosPromise<InlineResponseDefault1> { return localVarFp.getAddress(address, options).then((request) => request(axios, basePath)); }, /** * * @summary Get transaction history for the specified address, sorted with newest first. * @param {string} address * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAddressTxHistory(address: string, options?: any): AxiosPromise<Array<Transaction>> { return localVarFp.getAddressTxHistory(address, options).then((request) => request(axios, basePath)); }, /** * * @summary Get unconfirmed transaction history for the specified address. * @param {string} address * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAddressTxMempool(address: string, options?: any): AxiosPromise<Array<Transaction>> { return localVarFp.getAddressTxMempool(address, options).then((request) => request(axios, basePath)); }, /** * * @summary Get the list of unspent transaction outputs associated with the address. * @param {string} address * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAddressUtxo(address: string, options?: any): AxiosPromise<Array<UTXO>> { return localVarFp.getAddressUtxo(address, options).then((request) => request(axios, basePath)); }, }; }; /** * AddressApi - object-oriented interface * @export * @class AddressApi * @extends {BaseAPI} */ export class AddressApi extends BaseAPI { /** * * @summary Get information about an address. * @param {string} address * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AddressApi */ public getAddress(address: string, options?: any) { return AddressApiFp(this.configuration).getAddress(address, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Get transaction history for the specified address, sorted with newest first. * @param {string} address * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AddressApi */ public getAddressTxHistory(address: string, options?: any) { return AddressApiFp(this.configuration).getAddressTxHistory(address, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Get unconfirmed transaction history for the specified address. * @param {string} address * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AddressApi */ public getAddressTxMempool(address: string, options?: any) { return AddressApiFp(this.configuration).getAddressTxMempool(address, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Get the list of unspent transaction outputs associated with the address. * @param {string} address * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AddressApi */ public getAddressUtxo(address: string, options?: any) { return AddressApiFp(this.configuration).getAddressUtxo(address, options).then((request) => request(this.axios, this.basePath)); } } /** * BlockApi - axios parameter creator * @export */ export const BlockApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * * @summary Returns information about a block. * @param {string} hash * @param {*} [options] Override http request option. * @throws {RequiredError} */ getBlock: async (hash: string, options: any = {}): Promise<RequestArgs> => { // verify required parameter 'hash' is not null or undefined assertParamExists('getBlock', 'hash', hash) const localVarPath = `/block/{hash}` .replace(`{${"hash"}}`, encodeURIComponent(String(hash))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * * @summary Returns the hash of the block currently at height. * @param {number} height * @param {*} [options] Override http request option. * @throws {RequiredError} */ getBlockAtHeight: async (height: number, options: any = {}): Promise<RequestArgs> => { // verify required parameter 'height' is not null or undefined assertParamExists('getBlockAtHeight', 'height', height) const localVarPath = `/block-height/{height}` .replace(`{${"height"}}`, encodeURIComponent(String(height))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * * @summary Returns the hex-encoded block header. * @param {string} hash * @param {*} [options] Override http request option. * @throws {RequiredError} */ getBlockHeader: async (hash: string, options: any = {}): Promise<RequestArgs> => { // verify required parameter 'hash' is not null or undefined assertParamExists('getBlockHeader', 'hash', hash) const localVarPath = `/block/{hash}/header` .replace(`{${"hash"}}`, encodeURIComponent(String(hash))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * * @summary Returns the raw block representation in binary. * @param {string} hash * @param {*} [options] Override http request option. * @throws {RequiredError} */ getBlockRaw: async (hash: string, options: any = {}): Promise<RequestArgs> => { // verify required parameter 'hash' is not null or undefined assertParamExists('getBlockRaw', 'hash', hash) const localVarPath = `/block/{hash}/raw` .replace(`{${"hash"}}`, encodeURIComponent(String(hash))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * * @summary Returns the block status. * @param {string} hash * @param {*} [options] Override http request option. * @throws {RequiredError} */ getBlockStatus: async (hash: string, options: any = {}): Promise<RequestArgs> => { // verify required parameter 'hash' is not null or undefined assertParamExists('getBlockStatus', 'hash', hash) const localVarPath = `/block/{hash}/status` .replace(`{${"hash"}}`, encodeURIComponent(String(hash))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * * @summary Returns the transaction at index :index within the specified block. * @param {string} hash * @param {number} index * @param {*} [options] Override http request option. * @throws {RequiredError} */ getBlockTxByIndex: async (hash: string, index: number, options: any = {}): Promise<RequestArgs> => { // verify required parameter 'hash' is not null or undefined assertParamExists('getBlockTxByIndex', 'hash', hash) // verify required parameter 'index' is not null or undefined assertParamExists('getBlockTxByIndex', 'index', index) const localVarPath = `/block/{hash}/txid/{index}` .replace(`{${"hash"}}`, encodeURIComponent(String(hash))) .replace(`{${"index"}}`, encodeURIComponent(String(index))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * * @summary Returns a list of all txids in the block. * @param {string} hash * @param {*} [options] Override http request option. * @throws {RequiredError} */ getBlockTxids: async (hash: string, options: any = {}): Promise<RequestArgs> => { // verify required parameter 'hash' is not null or undefined assertParamExists('getBlockTxids', 'hash', hash) const localVarPath = `/block/{hash}/txids` .replace(`{${"hash"}}`, encodeURIComponent(String(hash))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * * @summary Returns the hash of the last block. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getLastBlockHash: async (options: any = {}): Promise<RequestArgs> => { const localVarPath = `/blocks/tip/hash`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * * @summary Returns the height of the last block. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getLastBlockHeight: async (options: any = {}): Promise<RequestArgs> => { const localVarPath = `/blocks/tip/height`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, } }; /** * BlockApi - functional programming interface * @export */ export const BlockApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = BlockApiAxiosParamCreator(configuration) return { /** * * @summary Returns information about a block. * @param {string} hash * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getBlock(hash: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<InlineResponseDefault2>> { const localVarAxiosArgs = await localVarAxiosParamCreator.getBlock(hash, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * * @summary Returns the hash of the block currently at height. * @param {number} height * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getBlockAtHeight(height: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<string>> { const localVarAxiosArgs = await localVarAxiosParamCreator.getBlockAtHeight(height, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * * @summary Returns the hex-encoded block header. * @param {string} hash * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getBlockHeader(hash: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<string>> { const localVarAxiosArgs = await localVarAxiosParamCreator.getBlockHeader(hash, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * * @summary Returns the raw block representation in binary. * @param {string} hash * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getBlockRaw(hash: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<any>> { const localVarAxiosArgs = await localVarAxiosParamCreator.getBlockRaw(hash, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * * @summary Returns the block status. * @param {string} hash * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getBlockStatus(hash: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<InlineResponseDefault3>> { const localVarAxiosArgs = await localVarAxiosParamCreator.getBlockStatus(hash, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * * @summary Returns the transaction at index :index within the specified block. * @param {string} hash * @param {number} index * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getBlockTxByIndex(hash: string, index: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<string>> { const localVarAxiosArgs = await localVarAxiosParamCreator.getBlockTxByIndex(hash, index, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * * @summary Returns a list of all txids in the block. * @param {string} hash * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getBlockTxids(hash: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<string>>> { const localVarAxiosArgs = await localVarAxiosParamCreator.getBlockTxids(hash, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * * @summary Returns the hash of the last block. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getLastBlockHash(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<string>> { const localVarAxiosArgs = await localVarAxiosParamCreator.getLastBlockHash(options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * * @summary Returns the height of the last block. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getLastBlockHeight(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<number>> { const localVarAxiosArgs = await localVarAxiosParamCreator.getLastBlockHeight(options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; /** * BlockApi - factory interface * @export */ export const BlockApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = BlockApiFp(configuration) return { /** * * @summary Returns information about a block. * @param {string} hash * @param {*} [options] Override http request option. * @throws {RequiredError} */ getBlock(hash: string, options?: any): AxiosPromise<InlineResponseDefault2> { return localVarFp.getBlock(hash, options).then((request) => request(axios, basePath)); }, /** * * @summary Returns the hash of the block currently at height. * @param {number} height * @param {*} [options] Override http request option. * @throws {RequiredError} */ getBlockAtHeight(height: number, options?: any): AxiosPromise<string> { return localVarFp.getBlockAtHeight(height, options).then((request) => request(axios, basePath)); }, /** * * @summary Returns the hex-encoded block header. * @param {string} hash * @param {*} [options] Override http request option. * @throws {RequiredError} */ getBlockHeader(hash: string, options?: any): AxiosPromise<string> { return localVarFp.getBlockHeader(hash, options).then((request) => request(axios, basePath)); }, /** * * @summary Returns the raw block representation in binary. * @param {string} hash * @param {*} [options] Override http request option. * @throws {RequiredError} */ getBlockRaw(hash: string, options?: any): AxiosPromise<any> { return localVarFp.getBlockRaw(hash, options).then((request) => request(axios, basePath)); }, /** * * @summary Returns the block status. * @param {string} hash * @param {*} [options] Override http request option. * @throws {RequiredError} */ getBlockStatus(hash: string, options?: any): AxiosPromise<InlineResponseDefault3> { return localVarFp.getBlockStatus(hash, options).then((request) => request(axios, basePath)); }, /** * * @summary Returns the transaction at index :index within the specified block. * @param {string} hash * @param {number} index * @param {*} [options] Override http request option. * @throws {RequiredError} */ getBlockTxByIndex(hash: string, index: number, options?: any): AxiosPromise<string> { return localVarFp.getBlockTxByIndex(hash, index, options).then((request) => request(axios, basePath)); }, /** * * @summary Returns a list of all txids in the block. * @param {string} hash * @param {*} [options] Override http request option. * @throws {RequiredError} */ getBlockTxids(hash: string, options?: any): AxiosPromise<Array<string>> { return localVarFp.getBlockTxids(hash, options).then((request) => request(axios, basePath)); }, /** * * @summary Returns the hash of the last block. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getLastBlockHash(options?: any): AxiosPromise<string> { return localVarFp.getLastBlockHash(options).then((request) => request(axios, basePath)); }, /** * * @summary Returns the height of the last block. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getLastBlockHeight(options?: any): AxiosPromise<number> { return localVarFp.getLastBlockHeight(options).then((request) => request(axios, basePath)); }, }; }; /** * BlockApi - object-oriented interface * @export * @class BlockApi * @extends {BaseAPI} */ export class BlockApi extends BaseAPI { /** * * @summary Returns information about a block. * @param {string} hash * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof BlockApi */ public getBlock(hash: string, options?: any) { return BlockApiFp(this.configuration).getBlock(hash, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Returns the hash of the block currently at height. * @param {number} height * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof BlockApi */ public getBlockAtHeight(height: number, options?: any) { return BlockApiFp(this.configuration).getBlockAtHeight(height, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Returns the hex-encoded block header. * @param {string} hash * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof BlockApi */ public getBlockHeader(hash: string, options?: any) { return BlockApiFp(this.configuration).getBlockHeader(hash, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Returns the raw block representation in binary. * @param {string} hash * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof BlockApi */ public getBlockRaw(hash: string, options?: any) { return BlockApiFp(this.configuration).getBlockRaw(hash, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Returns the block status. * @param {string} hash * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof BlockApi */ public getBlockStatus(hash: string, options?: any) { return BlockApiFp(this.configuration).getBlockStatus(hash, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Returns the transaction at index :index within the specified block. * @param {string} hash * @param {number} index * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof BlockApi */ public getBlockTxByIndex(hash: string, index: number, options?: any) { return BlockApiFp(this.configuration).getBlockTxByIndex(hash, index, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Returns a list of all txids in the block. * @param {string} hash * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof BlockApi */ public getBlockTxids(hash: string, options?: any) { return BlockApiFp(this.configuration).getBlockTxids(hash, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Returns the hash of the last block. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof BlockApi */ public getLastBlockHash(options?: any) { return BlockApiFp(this.configuration).getLastBlockHash(options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Returns the height of the last block. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof BlockApi */ public getLastBlockHeight(options?: any) { return BlockApiFp(this.configuration).getLastBlockHeight(options).then((request) => request(this.axios, this.basePath)); } } /** * FeeEstimatesAp