/* 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 { AnalyzePSBTRequest } from '../models'; import { AnalyzePSBTResponse } from '../models'; import { CombinePSBTRequest } from '../models'; import { CombinePSBTResponse } from '../models'; import { CreatePSBTRequest } from '../models'; import { CreatePSBTResponse } from '../models'; import { DecodePSBTRequest } from '../models'; import { DecodePSBTResponse } from '../models'; import { JoinPSBTsRequest } from '../models'; import { JoinPSBTsResponse } from '../models'; import { UtilsResponseEnvelope } from '../models'; /** * PSBTsApi - axios parameter creator * @export */ export const PSBTsApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Analyzes and provides information about the current status of a PSBT and its inputs * @summary Analyze PSBT * @param {AnalyzePSBTRequest} body PSBT to analyze * @param {*} [options] Override http request option. * @throws {RequiredError} */ analyzePsbt: async (body: AnalyzePSBTRequest, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new RequiredError('body','Required parameter body was null or undefined when calling analyzePsbt.'); } const localVarPath = `/psbt/analyze`; // 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: 'POST', ...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; } localVarHeaderParameter['Content-Type'] = 'application/json'; 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}; const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * Combines multiple partially signed Bitcoin transactions into one transaction * @summary Combine PSBTs * @param {CombinePSBTRequest} body Array of PSBTs to combine * @param {*} [options] Override http request option. * @throws {RequiredError} */ combinePsbt: async (body: CombinePSBTRequest, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new RequiredError('body','Required parameter body was null or undefined when calling combinePsbt.'); } const localVarPath = `/psbt/combine`; // 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: 'POST', ...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; } localVarHeaderParameter['Content-Type'] = 'application/json'; 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}; const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * Creates a transaction in the Partially Signed Transaction format. Implements the Creator role. * @summary Create PSBT * @param {CreatePSBTRequest} body Transaction parameters * @param {*} [options] Override http request option. * @throws {RequiredError} */ createPsbt: async (body: CreatePSBTRequest, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new RequiredError('body','Required parameter body was null or undefined when calling createPsbt.'); } const localVarPath = `/psbt/create`; // 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: 'POST', ...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; } localVarHeaderParameter['Content-Type'] = 'application/json'; 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}; const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * Return a JSON object representing the serialized, base64-encoded partially signed Bitcoin transaction. * @summary Decode PSBT * @param {DecodePSBTRequest} body PSBT to decode * @param {*} [options] Override http request option. * @throws {RequiredError} */ decodePsbt: async (body: DecodePSBTRequest, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new RequiredError('body','Required parameter body was null or undefined when calling decodePsbt.'); } const localVarPath = `/psbt/decode`; // 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: 'POST', ...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; } localVarHeaderParameter['Content-Type'] = 'application/json'; 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}; const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * Joins multiple distinct PSBTs with different inputs and outputs into one PSBT * @summary Join PSBTs * @param {JoinPSBTsRequest} body PSBTs to join * @param {*} [options] Override http request option. * @throws {RequiredError} */ joinPsbts: async (body: JoinPSBTsRequest, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new RequiredError('body','Required parameter body was null or undefined when calling joinPsbts.'); } const localVarPath = `/psbt/join`; // 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: 'POST', ...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; } localVarHeaderParameter['Content-Type'] = 'application/json'; 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}; const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, } }; /** * PSBTsApi - functional programming interface * @export */ export const PSBTsApiFp = function(configuration?: Configuration) { return { /** * Analyzes and provides information about the current status of a PSBT and its inputs * @summary Analyze PSBT * @param {AnalyzePSBTRequest} body PSBT to analyze * @param {*} [options] Override http request option. * @throws {RequiredError} */ async analyzePsbt(body: AnalyzePSBTRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { const localVarAxiosArgs = await PSBTsApiAxiosParamCreator(configuration).analyzePsbt(body, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * Combines multiple partially signed Bitcoin transactions into one transaction * @summary Combine PSBTs * @param {CombinePSBTRequest} body Array of PSBTs to combine * @param {*} [options] Override http request option. * @throws {RequiredError} */ async combinePsbt(body: CombinePSBTRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { const localVarAxiosArgs = await PSBTsApiAxiosParamCreator(configuration).combinePsbt(body, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * Creates a transaction in the Partially Signed Transaction format. Implements the Creator role. * @summary Create PSBT * @param {CreatePSBTRequest} body Transaction parameters * @param {*} [options] Override http request option. * @throws {RequiredError} */ async createPsbt(body: CreatePSBTRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { const localVarAxiosArgs = await PSBTsApiAxiosParamCreator(configuration).createPsbt(body, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * Return a JSON object representing the serialized, base64-encoded partially signed Bitcoin transaction. * @summary Decode PSBT * @param {DecodePSBTRequest} body PSBT to decode * @param {*} [options] Override http request option. * @throws {RequiredError} */ async decodePsbt(body: DecodePSBTRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { const localVarAxiosArgs = await PSBTsApiAxiosParamCreator(configuration).decodePsbt(body, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * Joins multiple distinct PSBTs with different inputs and outputs into one PSBT * @summary Join PSBTs * @param {JoinPSBTsRequest} body PSBTs to join * @param {*} [options] Override http request option. * @throws {RequiredError} */ async joinPsbts(body: JoinPSBTsRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { const localVarAxiosArgs = await PSBTsApiAxiosParamCreator(configuration).joinPsbts(body, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, } }; /** * PSBTsApi - factory interface * @export */ export const PSBTsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * Analyzes and provides information about the current status of a PSBT and its inputs * @summary Analyze PSBT * @param {AnalyzePSBTRequest} body PSBT to analyze * @param {*} [options] Override http request option. * @throws {RequiredError} */ async analyzePsbt(body: AnalyzePSBTRequest, options?: AxiosRequestConfig): Promise> { return PSBTsApiFp(configuration).analyzePsbt(body, options).then((request) => request(axios, basePath)); }, /** * Combines multiple partially signed Bitcoin transactions into one transaction * @summary Combine PSBTs * @param {CombinePSBTRequest} body Array of PSBTs to combine * @param {*} [options] Override http request option. * @throws {RequiredError} */ async combinePsbt(body: CombinePSBTRequest, options?: AxiosRequestConfig): Promise> { return PSBTsApiFp(configuration).combinePsbt(body, options).then((request) => request(axios, basePath)); }, /** * Creates a transaction in the Partially Signed Transaction format. Implements the Creator role. * @summary Create PSBT * @param {CreatePSBTRequest} body Transaction parameters * @param {*} [options] Override http request option. * @throws {RequiredError} */ async createPsbt(body: CreatePSBTRequest, options?: AxiosRequestConfig): Promise> { return PSBTsApiFp(configuration).createPsbt(body, options).then((request) => request(axios, basePath)); }, /** * Return a JSON object representing the serialized, base64-encoded partially signed Bitcoin transaction. * @summary Decode PSBT * @param {DecodePSBTRequest} body PSBT to decode * @param {*} [options] Override http request option. * @throws {RequiredError} */ async decodePsbt(body: DecodePSBTRequest, options?: AxiosRequestConfig): Promise> { return PSBTsApiFp(configuration).decodePsbt(body, options).then((request) => request(axios, basePath)); }, /** * Joins multiple distinct PSBTs with different inputs and outputs into one PSBT * @summary Join PSBTs * @param {JoinPSBTsRequest} body PSBTs to join * @param {*} [options] Override http request option. * @throws {RequiredError} */ async joinPsbts(body: JoinPSBTsRequest, options?: AxiosRequestConfig): Promise> { return PSBTsApiFp(configuration).joinPsbts(body, options).then((request) => request(axios, basePath)); }, }; }; /** * PSBTsApi - object-oriented interface * @export * @class PSBTsApi * @extends {BaseAPI} */ export class PSBTsApi extends BaseAPI { /** * Analyzes and provides information about the current status of a PSBT and its inputs * @summary Analyze PSBT * @param {AnalyzePSBTRequest} body PSBT to analyze * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PSBTsApi */ public async analyzePsbt(body: AnalyzePSBTRequest, options?: AxiosRequestConfig) : Promise> { return PSBTsApiFp(this.configuration).analyzePsbt(body, options).then((request) => request(this.axios, this.basePath)); } /** * Combines multiple partially signed Bitcoin transactions into one transaction * @summary Combine PSBTs * @param {CombinePSBTRequest} body Array of PSBTs to combine * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PSBTsApi */ public async combinePsbt(body: CombinePSBTRequest, options?: AxiosRequestConfig) : Promise> { return PSBTsApiFp(this.configuration).combinePsbt(body, options).then((request) => request(this.axios, this.basePath)); } /** * Creates a transaction in the Partially Signed Transaction format. Implements the Creator role. * @summary Create PSBT * @param {CreatePSBTRequest} body Transaction parameters * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PSBTsApi */ public async createPsbt(body: CreatePSBTRequest, options?: AxiosRequestConfig) : Promise> { return PSBTsApiFp(this.configuration).createPsbt(body, options).then((request) => request(this.axios, this.basePath)); } /** * Return a JSON object representing the serialized, base64-encoded partially signed Bitcoin transaction. * @summary Decode PSBT * @param {DecodePSBTRequest} body PSBT to decode * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PSBTsApi */ public async decodePsbt(body: DecodePSBTRequest, options?: AxiosRequestConfig) : Promise> { return PSBTsApiFp(this.configuration).decodePsbt(body, options).then((request) => request(this.axios, this.basePath)); } /** * Joins multiple distinct PSBTs with different inputs and outputs into one PSBT * @summary Join PSBTs * @param {JoinPSBTsRequest} body PSBTs to join * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PSBTsApi */ public async joinPsbts(body: JoinPSBTsRequest, options?: AxiosRequestConfig) : Promise> { return PSBTsApiFp(this.configuration).joinPsbts(body, options).then((request) => request(this.axios, this.basePath)); } }