@interlay/esplora-btc-api
Version:
Esplora Bitcoin OpenAPI Client
1,069 lines • 95.7 kB
JavaScript
"use strict";
/* 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.
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TxApi = exports.TxApiFactory = exports.TxApiFp = exports.TxApiAxiosParamCreator = exports.ScripthashApi = exports.ScripthashApiFactory = exports.ScripthashApiFp = exports.ScripthashApiAxiosParamCreator = exports.MempoolApi = exports.MempoolApiFactory = exports.MempoolApiFp = exports.MempoolApiAxiosParamCreator = exports.FeeEstimatesApi = exports.FeeEstimatesApiFactory = exports.FeeEstimatesApiFp = exports.FeeEstimatesApiAxiosParamCreator = exports.BlockApi = exports.BlockApiFactory = exports.BlockApiFp = exports.BlockApiAxiosParamCreator = exports.AddressApi = exports.AddressApiFactory = exports.AddressApiFp = exports.AddressApiAxiosParamCreator = void 0;
const axios_1 = require("axios");
// Some imports not used depending on template conditions
// @ts-ignore
const common_1 = require("./common");
// @ts-ignore
const base_1 = require("./base");
/**
* AddressApi - axios parameter creator
* @export
*/
exports.AddressApiAxiosParamCreator = function (configuration) {
return {
/**
*
* @summary Get information about an address.
* @param {string} address
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getAddress: (address, options = {}) => __awaiter(this, void 0, void 0, function* () {
// verify required parameter 'address' is not null or undefined
common_1.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, common_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
common_1.setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: common_1.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: (address, options = {}) => __awaiter(this, void 0, void 0, function* () {
// verify required parameter 'address' is not null or undefined
common_1.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, common_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
common_1.setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: common_1.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: (address, options = {}) => __awaiter(this, void 0, void 0, function* () {
// verify required parameter 'address' is not null or undefined
common_1.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, common_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
common_1.setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: common_1.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: (address, options = {}) => __awaiter(this, void 0, void 0, function* () {
// verify required parameter 'address' is not null or undefined
common_1.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, common_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
common_1.setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: common_1.toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
};
};
/**
* AddressApi - functional programming interface
* @export
*/
exports.AddressApiFp = function (configuration) {
const localVarAxiosParamCreator = exports.AddressApiAxiosParamCreator(configuration);
return {
/**
*
* @summary Get information about an address.
* @param {string} address
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getAddress(address, options) {
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield localVarAxiosParamCreator.getAddress(address, options);
return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.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}
*/
getAddressTxHistory(address, options) {
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield localVarAxiosParamCreator.getAddressTxHistory(address, options);
return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
});
},
/**
*
* @summary Get unconfirmed transaction history for the specified address.
* @param {string} address
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getAddressTxMempool(address, options) {
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield localVarAxiosParamCreator.getAddressTxMempool(address, options);
return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.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}
*/
getAddressUtxo(address, options) {
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield localVarAxiosParamCreator.getAddressUtxo(address, options);
return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
});
},
};
};
/**
* AddressApi - factory interface
* @export
*/
exports.AddressApiFactory = function (configuration, basePath, axios) {
const localVarFp = exports.AddressApiFp(configuration);
return {
/**
*
* @summary Get information about an address.
* @param {string} address
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getAddress(address, options) {
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, options) {
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, options) {
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, options) {
return localVarFp.getAddressUtxo(address, options).then((request) => request(axios, basePath));
},
};
};
/**
* AddressApi - object-oriented interface
* @export
* @class AddressApi
* @extends {BaseAPI}
*/
class AddressApi extends base_1.BaseAPI {
/**
*
* @summary Get information about an address.
* @param {string} address
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof AddressApi
*/
getAddress(address, options) {
return exports.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
*/
getAddressTxHistory(address, options) {
return exports.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
*/
getAddressTxMempool(address, options) {
return exports.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
*/
getAddressUtxo(address, options) {
return exports.AddressApiFp(this.configuration).getAddressUtxo(address, options).then((request) => request(this.axios, this.basePath));
}
}
exports.AddressApi = AddressApi;
/**
* BlockApi - axios parameter creator
* @export
*/
exports.BlockApiAxiosParamCreator = function (configuration) {
return {
/**
*
* @summary Returns information about a block.
* @param {string} hash
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getBlock: (hash, options = {}) => __awaiter(this, void 0, void 0, function* () {
// verify required parameter 'hash' is not null or undefined
common_1.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, common_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
common_1.setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: common_1.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: (height, options = {}) => __awaiter(this, void 0, void 0, function* () {
// verify required parameter 'height' is not null or undefined
common_1.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, common_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
common_1.setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: common_1.toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
*
* @summary Returns the hex-encoded block header.
* @param {string} hash
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getBlockHeader: (hash, options = {}) => __awaiter(this, void 0, void 0, function* () {
// verify required parameter 'hash' is not null or undefined
common_1.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, common_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
common_1.setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: common_1.toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
*
* @summary Returns the raw block representation in binary.
* @param {string} hash
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getBlockRaw: (hash, options = {}) => __awaiter(this, void 0, void 0, function* () {
// verify required parameter 'hash' is not null or undefined
common_1.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, common_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
common_1.setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: common_1.toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
*
* @summary Returns the block status.
* @param {string} hash
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getBlockStatus: (hash, options = {}) => __awaiter(this, void 0, void 0, function* () {
// verify required parameter 'hash' is not null or undefined
common_1.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, common_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
common_1.setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: common_1.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: (hash, index, options = {}) => __awaiter(this, void 0, void 0, function* () {
// verify required parameter 'hash' is not null or undefined
common_1.assertParamExists('getBlockTxByIndex', 'hash', hash);
// verify required parameter 'index' is not null or undefined
common_1.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, common_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
common_1.setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: common_1.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: (hash, options = {}) => __awaiter(this, void 0, void 0, function* () {
// verify required parameter 'hash' is not null or undefined
common_1.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, common_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
common_1.setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: common_1.toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
*
* @summary Returns the hash of the last block.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getLastBlockHash: (options = {}) => __awaiter(this, void 0, void 0, function* () {
const localVarPath = `/blocks/tip/hash`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
common_1.setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: common_1.toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
*
* @summary Returns the height of the last block.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getLastBlockHeight: (options = {}) => __awaiter(this, void 0, void 0, function* () {
const localVarPath = `/blocks/tip/height`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
common_1.setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: common_1.toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
};
};
/**
* BlockApi - functional programming interface
* @export
*/
exports.BlockApiFp = function (configuration) {
const localVarAxiosParamCreator = exports.BlockApiAxiosParamCreator(configuration);
return {
/**
*
* @summary Returns information about a block.
* @param {string} hash
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getBlock(hash, options) {
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield localVarAxiosParamCreator.getBlock(hash, options);
return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
});
},
/**
*
* @summary Returns the hash of the block currently at height.
* @param {number} height
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getBlockAtHeight(height, options) {
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield localVarAxiosParamCreator.getBlockAtHeight(height, options);
return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
});
},
/**
*
* @summary Returns the hex-encoded block header.
* @param {string} hash
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getBlockHeader(hash, options) {
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield localVarAxiosParamCreator.getBlockHeader(hash, options);
return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
});
},
/**
*
* @summary Returns the raw block representation in binary.
* @param {string} hash
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getBlockRaw(hash, options) {
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield localVarAxiosParamCreator.getBlockRaw(hash, options);
return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
});
},
/**
*
* @summary Returns the block status.
* @param {string} hash
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getBlockStatus(hash, options) {
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield localVarAxiosParamCreator.getBlockStatus(hash, options);
return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.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}
*/
getBlockTxByIndex(hash, index, options) {
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield localVarAxiosParamCreator.getBlockTxByIndex(hash, index, options);
return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
});
},
/**
*
* @summary Returns a list of all txids in the block.
* @param {string} hash
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getBlockTxids(hash, options) {
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield localVarAxiosParamCreator.getBlockTxids(hash, options);
return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
});
},
/**
*
* @summary Returns the hash of the last block.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getLastBlockHash(options) {
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield localVarAxiosParamCreator.getLastBlockHash(options);
return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
});
},
/**
*
* @summary Returns the height of the last block.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getLastBlockHeight(options) {
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield localVarAxiosParamCreator.getLastBlockHeight(options);
return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
});
},
};
};
/**
* BlockApi - factory interface
* @export
*/
exports.BlockApiFactory = function (configuration, basePath, axios) {
const localVarFp = exports.BlockApiFp(configuration);
return {
/**
*
* @summary Returns information about a block.
* @param {string} hash
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getBlock(hash, options) {
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, options) {
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, options) {
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, options) {
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, options) {
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, index, options) {
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, options) {
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) {
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) {
return localVarFp.getLastBlockHeight(options).then((request) => request(axios, basePath));
},
};
};
/**
* BlockApi - object-oriented interface
* @export
* @class BlockApi
* @extends {BaseAPI}
*/
class BlockApi extends base_1.BaseAPI {
/**
*
* @summary Returns information about a block.
* @param {string} hash
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof BlockApi
*/
getBlock(hash, options) {
return exports.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
*/
getBlockAtHeight(height, options) {
return exports.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
*/
getBlockHeader(hash, options) {
return exports.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
*/
getBlockRaw(hash, options) {
return exports.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
*/
getBlockStatus(hash, options) {
return exports.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
*/
getBlockTxByIndex(hash, index, options) {
return exports.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
*/
getBlockTxids(hash, options) {
return exports.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
*/
getLastBlockHash(options) {
return exports.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
*/
getLastBlockHeight(options) {
return exports.BlockApiFp(this.configuration).getLastBlockHeight(options).then((request) => request(this.axios, this.basePath));
}
}
exports.BlockApi = BlockApi;
/**
* FeeEstimatesApi - axios parameter creator
* @export
*/
exports.FeeEstimatesApiAxiosParamCreator = function (configuration) {
return {
/**
*
* @summary Get an object where the key is the confirmation target (in number of blocks) and the value is the estimated feerate (in sat/vB).
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getFeeEstimates: (options = {}) => __awaiter(this, void 0, void 0, function* () {
const localVarPath = `/fee-estimates`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
common_1.setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: common_1.toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
};
};
/**
* FeeEstimatesApi - functional programming interface
* @export
*/
exports.FeeEstimatesApiFp = function (configuration) {
const localVarAxiosParamCreator = exports.FeeEstimatesApiAxiosParamCreator(configuration);
return {
/**
*
* @summary Get an object where the key is the confirmation target (in number of blocks) and the value is the estimated feerate (in sat/vB).
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getFeeEstimates(options) {
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield localVarAxiosParamCreator.getFeeEstimates(options);
return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
});
},
};
};
/**
* FeeEstimatesApi - factory interface
* @export
*/
exports.FeeEstimatesApiFactory = function (configuration, basePath, axios) {
const localVarFp = exports.FeeEstimatesApiFp(configuration);
return {
/**
*
* @summary Get an object where the key is the confirmation target (in number of blocks) and the value is the estimated feerate (in sat/vB).
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getFeeEstimates(options) {
return localVarFp.getFeeEstimates(options).then((request) => request(axios, basePath));
},
};
};
/**
* FeeEstimatesApi - object-oriented interface
* @export
* @class FeeEstimatesApi
* @extends {BaseAPI}
*/
class FeeEstimatesApi extends base_1.BaseAPI {
/**
*
* @summary Get an object where the key is the confirmation target (in number of blocks) and the value is the estimated feerate (in sat/vB).
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof FeeEstimatesApi
*/
getFeeEstimates(options) {
return exports.FeeEstimatesApiFp(this.configuration).getFeeEstimates(options).then((request) => request(this.axios, this.basePath));
}
}
exports.FeeEstimatesApi = FeeEstimatesApi;
/**
* MempoolApi - axios parameter creator
* @export
*/
exports.MempoolApiAxiosParamCreator = function (configuration) {
return {
/**
*
* @summary Get mempool backlog statistics.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getMempool: (options = {}) => __awaiter(this, void 0, void 0, function* () {
const localVarPath = `/mempool`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
common_1.setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: common_1.toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
*
* @summary Get a list of the last 10 transactions to enter the mempool.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getMempoolRecent: (options = {}) => __awaiter(this, void 0, void 0, function* () {
const localVarPath = `/mempool/recent`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
common_1.setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: common_1.toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
*
* @summary Get the full list of txids in the mempool as an array.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getMempoolTxids: (options = {}) => __awaiter(this, void 0, void 0, function* () {
const localVarPath = `/mempool/txids`;
// use dummy base URL string because the URL constructor only accepts absolute