/* tslint:disable */ /* eslint-disable */ /** * Satstream API * Satstream API * * OpenAPI spec version: 1.0 * Contact: team@satstream.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ import globalAxios, { AxiosResponse, AxiosInstance, AxiosRequestConfig } from 'axios'; import { Configuration } from '../configuration'; // Some imports not used depending on template conditions // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; import { GetAddressBalanceResponse } from '../models'; import { GetAddressDeltasResponse } from '../models'; import { GetAddressResponse } from '../models'; import { GetAddressRuneDeltasResponse } from '../models'; import { GetAddressUTXOsResponse } from '../models'; import { UtilsResponseEnvelope } from '../models'; import { ValidateAddressResponse } from '../models'; /** * AddressesApi - axios parameter creator * @export */ export const AddressesApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Get detailed information about a specific address * @summary Get address info * @param {string} address Address * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAddress: async (address: string, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'address' is not null or undefined if (address === null || address === undefined) { throw new RequiredError('address','Required parameter address was null or undefined when calling getAddress.'); } 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, 'https://example.com'); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication ApiKeyAuth required if (configuration && configuration.apiKey) { const localVarApiKeyValue = typeof configuration.apiKey === 'function' ? await configuration.apiKey("X-API-KEY") : await configuration.apiKey; localVarHeaderParameter["X-API-KEY"] = localVarApiKeyValue; } const query = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { query.set(key, localVarQueryParameter[key]); } for (const key in options.params) { query.set(key, options.params[key]); } localVarUrlObj.search = (new URLSearchParams(query)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * Get the total BTC balance in satoshis of an address by summing all its deltas * @summary Get address balance * @param {string} address Address * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAddressBalance: async (address: string, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'address' is not null or undefined if (address === null || address === undefined) { throw new RequiredError('address','Required parameter address was null or undefined when calling getAddressBalance.'); } const localVarPath = `/address/{address}/balance` .replace(`{${"address"}}`, encodeURIComponent(String(address))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, 'https://example.com'); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication ApiKeyAuth required if (configuration && configuration.apiKey) { const localVarApiKeyValue = typeof configuration.apiKey === 'function' ? await configuration.apiKey("X-API-KEY") : await configuration.apiKey; localVarHeaderParameter["X-API-KEY"] = localVarApiKeyValue; } const query = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { query.set(key, localVarQueryParameter[key]); } for (const key in options.params) { query.set(key, options.params[key]); } localVarUrlObj.search = (new URLSearchParams(query)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * Get deltas for a specific address with pagination * @summary Get address deltas * @param {string} address Address * @param {number} [pageSize] Number of results per page (default: 100, max: 1000) * @param {number} [startHeight] Start block height * @param {number} [endHeight] End block height * @param {string} [cursor] Base64 encoded cursor for pagination * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAddressDeltas: async (address: string, pageSize?: number, startHeight?: number, endHeight?: number, cursor?: string, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'address' is not null or undefined if (address === null || address === undefined) { throw new RequiredError('address','Required parameter address was null or undefined when calling getAddressDeltas.'); } const localVarPath = `/address/{address}/deltas` .replace(`{${"address"}}`, encodeURIComponent(String(address))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, 'https://example.com'); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication ApiKeyAuth required if (configuration && configuration.apiKey) { const localVarApiKeyValue = typeof configuration.apiKey === 'function' ? await configuration.apiKey("X-API-KEY") : await configuration.apiKey; localVarHeaderParameter["X-API-KEY"] = localVarApiKeyValue; } if (pageSize !== undefined) { localVarQueryParameter['page_size'] = pageSize; } if (startHeight !== undefined) { localVarQueryParameter['start_height'] = startHeight; } if (endHeight !== undefined) { localVarQueryParameter['end_height'] = endHeight; } if (cursor !== undefined) { localVarQueryParameter['cursor'] = cursor; } const query = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { query.set(key, localVarQueryParameter[key]); } for (const key in options.params) { query.set(key, options.params[key]); } localVarUrlObj.search = (new URLSearchParams(query)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * Get rune deltas for a specific address with pagination * @summary Get address rune deltas * @param {string} address Address * @param {number} [pageSize] Number of results per page (default: 100, max: 1000) * @param {number} [startHeight] Start block height * @param {number} [endHeight] End block height * @param {string} [cursor] Cursor for pagination * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAddressRuneDeltas: async (address: string, pageSize?: number, startHeight?: number, endHeight?: number, cursor?: string, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'address' is not null or undefined if (address === null || address === undefined) { throw new RequiredError('address','Required parameter address was null or undefined when calling getAddressRuneDeltas.'); } const localVarPath = `/address/{address}/deltas/runes` .replace(`{${"address"}}`, encodeURIComponent(String(address))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, 'https://example.com'); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication ApiKeyAuth required if (configuration && configuration.apiKey) { const localVarApiKeyValue = typeof configuration.apiKey === 'function' ? await configuration.apiKey("X-API-KEY") : await configuration.apiKey; localVarHeaderParameter["X-API-KEY"] = localVarApiKeyValue; } if (pageSize !== undefined) { localVarQueryParameter['page_size'] = pageSize; } if (startHeight !== undefined) { localVarQueryParameter['start_height'] = startHeight; } if (endHeight !== undefined) { localVarQueryParameter['end_height'] = endHeight; } if (cursor !== undefined) { localVarQueryParameter['cursor'] = cursor; } const query = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { query.set(key, localVarQueryParameter[key]); } for (const key in options.params) { query.set(key, options.params[key]); } localVarUrlObj.search = (new URLSearchParams(query)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * Retrieve UTXOs held by a specific address with optional type filtering * @summary Get UTXOs for an address * @param {string} address Address * @param {string} [type] UTXO Type * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAddressUtxos: async (address: string, type?: string, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'address' is not null or undefined if (address === null || address === undefined) { throw new RequiredError('address','Required parameter address was null or undefined when calling getAddressUtxos.'); } const localVarPath = `/address/{address}/outputs` .replace(`{${"address"}}`, encodeURIComponent(String(address))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, 'https://example.com'); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication ApiKeyAuth required if (configuration && configuration.apiKey) { const localVarApiKeyValue = typeof configuration.apiKey === 'function' ? await configuration.apiKey("X-API-KEY") : await configuration.apiKey; localVarHeaderParameter["X-API-KEY"] = localVarApiKeyValue; } if (type !== undefined) { localVarQueryParameter['type'] = type; } const query = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { query.set(key, localVarQueryParameter[key]); } for (const key in options.params) { query.set(key, options.params[key]); } localVarUrlObj.search = (new URLSearchParams(query)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * Returns information about the given Bitcoin address * @summary Validate address * @param {string} address Bitcoin address to validate * @param {*} [options] Override http request option. * @throws {RequiredError} */ validateAddress: async (address: string, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'address' is not null or undefined if (address === null || address === undefined) { throw new RequiredError('address','Required parameter address was null or undefined when calling validateAddress.'); } const localVarPath = `/address/{address}/validate` .replace(`{${"address"}}`, encodeURIComponent(String(address))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, 'https://example.com'); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication ApiKeyAuth required if (configuration && configuration.apiKey) { const localVarApiKeyValue = typeof configuration.apiKey === 'function' ? await configuration.apiKey("X-API-KEY") : await configuration.apiKey; localVarHeaderParameter["X-API-KEY"] = localVarApiKeyValue; } const query = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { query.set(key, localVarQueryParameter[key]); } for (const key in options.params) { query.set(key, options.params[key]); } localVarUrlObj.search = (new URLSearchParams(query)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, } }; /** * AddressesApi - functional programming interface * @export */ export const AddressesApiFp = function(configuration?: Configuration) { return { /** * Get detailed information about a specific address * @summary Get address info * @param {string} address Address * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getAddress(address: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).getAddress(address, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * Get the total BTC balance in satoshis of an address by summing all its deltas * @summary Get address balance * @param {string} address Address * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getAddressBalance(address: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).getAddressBalance(address, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * Get deltas for a specific address with pagination * @summary Get address deltas * @param {string} address Address * @param {number} [pageSize] Number of results per page (default: 100, max: 1000) * @param {number} [startHeight] Start block height * @param {number} [endHeight] End block height * @param {string} [cursor] Base64 encoded cursor for pagination * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getAddressDeltas(address: string, pageSize?: number, startHeight?: number, endHeight?: number, cursor?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).getAddressDeltas(address, pageSize, startHeight, endHeight, cursor, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * Get rune deltas for a specific address with pagination * @summary Get address rune deltas * @param {string} address Address * @param {number} [pageSize] Number of results per page (default: 100, max: 1000) * @param {number} [startHeight] Start block height * @param {number} [endHeight] End block height * @param {string} [cursor] Cursor for pagination * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getAddressRuneDeltas(address: string, pageSize?: number, startHeight?: number, endHeight?: number, cursor?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).getAddressRuneDeltas(address, pageSize, startHeight, endHeight, cursor, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * Retrieve UTXOs held by a specific address with optional type filtering * @summary Get UTXOs for an address * @param {string} address Address * @param {string} [type] UTXO Type * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getAddressUtxos(address: string, type?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).getAddressUtxos(address, type, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * Returns information about the given Bitcoin address * @summary Validate address * @param {string} address Bitcoin address to validate * @param {*} [options] Override http request option. * @throws {RequiredError} */ async validateAddress(address: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).validateAddress(address, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, } }; /** * AddressesApi - factory interface * @export */ export const AddressesApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * Get detailed information about a specific address * @summary Get address info * @param {string} address Address * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getAddress(address: string, options?: AxiosRequestConfig): Promise> { return AddressesApiFp(configuration).getAddress(address, options).then((request) => request(axios, basePath)); }, /** * Get the total BTC balance in satoshis of an address by summing all its deltas * @summary Get address balance * @param {string} address Address * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getAddressBalance(address: string, options?: AxiosRequestConfig): Promise> { return AddressesApiFp(configuration).getAddressBalance(address, options).then((request) => request(axios, basePath)); }, /** * Get deltas for a specific address with pagination * @summary Get address deltas * @param {string} address Address * @param {number} [pageSize] Number of results per page (default: 100, max: 1000) * @param {number} [startHeight] Start block height * @param {number} [endHeight] End block height * @param {string} [cursor] Base64 encoded cursor for pagination * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getAddressDeltas(address: string, pageSize?: number, startHeight?: number, endHeight?: number, cursor?: string, options?: AxiosRequestConfig): Promise> { return AddressesApiFp(configuration).getAddressDeltas(address, pageSize, startHeight, endHeight, cursor, options).then((request) => request(axios, basePath)); }, /** * Get rune deltas for a specific address with pagination * @summary Get address rune deltas * @param {string} address Address * @param {number} [pageSize] Number of results per page (default: 100, max: 1000) * @param {number} [startHeight] Start block height * @param {number} [endHeight] End block height * @param {string} [cursor] Cursor for pagination * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getAddressRuneDeltas(address: string, pageSize?: number, startHeight?: number, endHeight?: number, cursor?: string, options?: AxiosRequestConfig): Promise> { return AddressesApiFp(configuration).getAddressRuneDeltas(address, pageSize, startHeight, endHeight, cursor, options).then((request) => request(axios, basePath)); }, /** * Retrieve UTXOs held by a specific address with optional type filtering * @summary Get UTXOs for an address * @param {string} address Address * @param {string} [type] UTXO Type * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getAddressUtxos(address: string, type?: string, options?: AxiosRequestConfig): Promise> { return AddressesApiFp(configuration).getAddressUtxos(address, type, options).then((request) => request(axios, basePath)); }, /** * Returns information about the given Bitcoin address * @summary Validate address * @param {string} address Bitcoin address to validate * @param {*} [options] Override http request option. * @throws {RequiredError} */ async validateAddress(address: string, options?: AxiosRequestConfig): Promise> { return AddressesApiFp(configuration).validateAddress(address, options).then((request) => request(axios, basePath)); }, }; }; /** * AddressesApi - object-oriented interface * @export * @class AddressesApi * @extends {BaseAPI} */ export class AddressesApi extends BaseAPI { /** * Get detailed information about a specific address * @summary Get address info * @param {string} address Address * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AddressesApi */ public async getAddress(address: string, options?: AxiosRequestConfig) : Promise> { return AddressesApiFp(this.configuration).getAddress(address, options).then((request) => request(this.axios, this.basePath)); } /** * Get the total BTC balance in satoshis of an address by summing all its deltas * @summary Get address balance * @param {string} address Address * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AddressesApi */ public async getAddressBalance(address: string, options?: AxiosRequestConfig) : Promise> { return AddressesApiFp(this.configuration).getAddressBalance(address, options).then((request) => request(this.axios, this.basePath)); } /** * Get deltas for a specific address with pagination * @summary Get address deltas * @param {string} address Address * @param {number} [pageSize] Number of results per page (default: 100, max: 1000) * @param {number} [startHeight] Start block height * @param {number} [endHeight] End block height * @param {string} [cursor] Base64 encoded cursor for pagination * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AddressesApi */ public async getAddressDeltas(address: string, pageSize?: number, startHeight?: number, endHeight?: number, cursor?: string, options?: AxiosRequestConfig) : Promise> { return AddressesApiFp(this.configuration).getAddressDeltas(address, pageSize, startHeight, endHeight, cursor, options).then((request) => request(this.axios, this.basePath)); } /** * Get rune deltas for a specific address with pagination * @summary Get address rune deltas * @param {string} address Address * @param {number} [pageSize] Number of results per page (default: 100, max: 1000) * @param {number} [startHeight] Start block height * @param {number} [endHeight] End block height * @param {string} [cursor] Cursor for pagination * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AddressesApi */ public async getAddressRuneDeltas(address: string, pageSize?: number, startHeight?: number, endHeight?: number, cursor?: string, options?: AxiosRequestConfig) : Promise> { return AddressesApiFp(this.configuration).getAddressRuneDeltas(address, pageSize, startHeight, endHeight, cursor, options).then((request) => request(this.axios, this.basePath)); } /** * Retrieve UTXOs held by a specific address with optional type filtering * @summary Get UTXOs for an address * @param {string} address Address * @param {string} [type] UTXO Type * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AddressesApi */ public async getAddressUtxos(address: string, type?: string, options?: AxiosRequestConfig) : Promise> { return AddressesApiFp(this.configuration).getAddressUtxos(address, type, options).then((request) => request(this.axios, this.basePath)); } /** * Returns information about the given Bitcoin address * @summary Validate address * @param {string} address Bitcoin address to validate * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AddressesApi */ public async validateAddress(address: string, options?: AxiosRequestConfig) : Promise> { return AddressesApiFp(this.configuration).validateAddress(address, options).then((request) => request(this.axios, this.basePath)); } }