UNPKG

cardano-wallet-js

Version:

javascript/typescript client for the official cardano-wallet api

509 lines (490 loc) 30.4 kB
/* tslint:disable */ /* eslint-disable */ /** * Cardano Wallet Backend API * <p align=\"right\"><img style=\"position: relative; top: -10em; margin-bottom: -12em;\" width=\"20%\" src=\"https://cardanodocs.com/img/cardano.png\"></img></p> * * OpenAPI spec version: 2021.3.4 * * * 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, { AxiosPromise, AxiosInstance } 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 { Body17 } from '../models'; import { Body18 } from '../models'; import { InlineResponse2004 } from '../models'; import { InlineResponse202 } from '../models'; import { InlineResponse2021 } from '../models'; import { InlineResponse400 } from '../models'; import { InlineResponse4001 } from '../models'; import { InlineResponse4031 } from '../models'; import { InlineResponse4032 } from '../models'; import { InlineResponse404 } from '../models'; import { NoSuchWallet } from '../models'; import { NotAcceptable } from '../models'; import { TransactionAlreadyInLedger } from '../models'; import { UnsupportedMediaType } from '../models'; /** * ByronTransactionsApi - axios parameter creator * @export */ export const ByronTransactionsApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * <p align=\"right\">status: <strong>stable</strong></p> Forget pending Byron transaction. Importantly, a transaction, when sent, cannot be cancelled. One can only request forgetting about it in order to try spending (concurrently) the same UTxO in another transaction. But, the transaction may still show up later in a block and therefore, appear in the wallet. * @summary Forget * @param {string} walletId * @param {string} transactionId * @param {*} [options] Override http request option. * @throws {RequiredError} */ deleteByronTransaction: async (walletId: string, transactionId: string, options: any = {}): Promise<RequestArgs> => { // verify required parameter 'walletId' is not null or undefined if (walletId === null || walletId === undefined) { throw new RequiredError('walletId','Required parameter walletId was null or undefined when calling deleteByronTransaction.'); } // verify required parameter 'transactionId' is not null or undefined if (transactionId === null || transactionId === undefined) { throw new RequiredError('transactionId','Required parameter transactionId was null or undefined when calling deleteByronTransaction.'); } const localVarPath = `/byron-wallets/{walletId}/transactions/{transactionId}` .replace(`{${"walletId"}}`, encodeURIComponent(String(walletId))) .replace(`{${"transactionId"}}`, encodeURIComponent(String(transactionId))); // 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 = { method: 'DELETE', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; const query = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { query.set(key, localVarQueryParameter[key]); } for (const key in options.query) { query.set(key, options.query[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, }; }, /** * <p align=\"right\">status: <strong>stable</strong></p> Get transaction by id. * @summary Get * @param {string} walletId * @param {string} transactionId * @param {*} [options] Override http request option. * @throws {RequiredError} */ getByronTransaction: async (walletId: string, transactionId: string, options: any = {}): Promise<RequestArgs> => { // verify required parameter 'walletId' is not null or undefined if (walletId === null || walletId === undefined) { throw new RequiredError('walletId','Required parameter walletId was null or undefined when calling getByronTransaction.'); } // verify required parameter 'transactionId' is not null or undefined if (transactionId === null || transactionId === undefined) { throw new RequiredError('transactionId','Required parameter transactionId was null or undefined when calling getByronTransaction.'); } const localVarPath = `/byron-wallets/{walletId}/transactions/{transactionId}` .replace(`{${"walletId"}}`, encodeURIComponent(String(walletId))) .replace(`{${"transactionId"}}`, encodeURIComponent(String(transactionId))); // 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 = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; const query = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { query.set(key, localVarQueryParameter[key]); } for (const key in options.query) { query.set(key, options.query[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, }; }, /** * <p align=\"right\">status: <strong>stable</strong></p> List all incoming and outgoing transactions for the given wallet. * @summary List * @param {string} walletId * @param {string} [start] An optional start time in ISO 8601 date-and-time format. Basic and extended formats are both accepted. Times can be local (with a timezone offset) or UTC. If both a start time and an end time are specified, then the start time must not be later than the end time. Example: &#x60;2008-08-08T08:08:08Z&#x60; * @param {string} [end] An optional end time in ISO 8601 date-and-time format. Basic and extended formats are both accepted. Times can be local (with a timezone offset) or UTC. If both a start time and an end time are specified, then the start time must not be later than the end time. Example: &#x60;2008-08-08T08:08:08Z&#x60; * @param {string} [order] An optional sort order. * @param {*} [options] Override http request option. * @throws {RequiredError} */ listByronTransactions: async (walletId: string, start?: string, end?: string, order?: string, options: any = {}): Promise<RequestArgs> => { // verify required parameter 'walletId' is not null or undefined if (walletId === null || walletId === undefined) { throw new RequiredError('walletId','Required parameter walletId was null or undefined when calling listByronTransactions.'); } const localVarPath = `/byron-wallets/{walletId}/transactions` .replace(`{${"walletId"}}`, encodeURIComponent(String(walletId))); // 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 = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; if (start !== undefined) { localVarQueryParameter['start'] = start; } if (end !== undefined) { localVarQueryParameter['end'] = end; } if (order !== undefined) { localVarQueryParameter['order'] = order; } const query = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { query.set(key, localVarQueryParameter[key]); } for (const key in options.query) { query.set(key, options.query[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, }; }, /** * <p align=\"right\">status: <strong>stable</strong></p> Create and send transaction from the wallet. * @summary Create * @param {Body18} body * @param {string} walletId * @param {*} [options] Override http request option. * @throws {RequiredError} */ postByronTransaction: async (body: Body18, walletId: string, options: any = {}): Promise<RequestArgs> => { // 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 postByronTransaction.'); } // verify required parameter 'walletId' is not null or undefined if (walletId === null || walletId === undefined) { throw new RequiredError('walletId','Required parameter walletId was null or undefined when calling postByronTransaction.'); } const localVarPath = `/byron-wallets/{walletId}/transactions` .replace(`{${"walletId"}}`, encodeURIComponent(String(walletId))); // 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 = { method: 'POST', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; 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.query) { query.set(key, options.query[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, }; }, /** * <p align=\"right\">status: <strong>stable</strong></p> Estimate fee for the transaction. * @summary Estimate Fee * @param {Body17} body * @param {string} walletId * @param {*} [options] Override http request option. * @throws {RequiredError} */ postByronTransactionFee: async (body: Body17, walletId: string, options: any = {}): Promise<RequestArgs> => { // 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 postByronTransactionFee.'); } // verify required parameter 'walletId' is not null or undefined if (walletId === null || walletId === undefined) { throw new RequiredError('walletId','Required parameter walletId was null or undefined when calling postByronTransactionFee.'); } const localVarPath = `/byron-wallets/{walletId}/payment-fees` .replace(`{${"walletId"}}`, encodeURIComponent(String(walletId))); // 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 = { method: 'POST', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; 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.query) { query.set(key, options.query[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, }; }, } }; /** * ByronTransactionsApi - functional programming interface * @export */ export const ByronTransactionsApiFp = function(configuration?: Configuration) { return { /** * <p align=\"right\">status: <strong>stable</strong></p> Forget pending Byron transaction. Importantly, a transaction, when sent, cannot be cancelled. One can only request forgetting about it in order to try spending (concurrently) the same UTxO in another transaction. But, the transaction may still show up later in a block and therefore, appear in the wallet. * @summary Forget * @param {string} walletId * @param {string} transactionId * @param {*} [options] Override http request option. * @throws {RequiredError} */ async deleteByronTransaction(walletId: string, transactionId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> { const localVarAxiosArgs = await ByronTransactionsApiAxiosParamCreator(configuration).deleteByronTransaction(walletId, transactionId, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * <p align=\"right\">status: <strong>stable</strong></p> Get transaction by id. * @summary Get * @param {string} walletId * @param {string} transactionId * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getByronTransaction(walletId: string, transactionId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<InlineResponse2021>> { const localVarAxiosArgs = await ByronTransactionsApiAxiosParamCreator(configuration).getByronTransaction(walletId, transactionId, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * <p align=\"right\">status: <strong>stable</strong></p> List all incoming and outgoing transactions for the given wallet. * @summary List * @param {string} walletId * @param {string} [start] An optional start time in ISO 8601 date-and-time format. Basic and extended formats are both accepted. Times can be local (with a timezone offset) or UTC. If both a start time and an end time are specified, then the start time must not be later than the end time. Example: &#x60;2008-08-08T08:08:08Z&#x60; * @param {string} [end] An optional end time in ISO 8601 date-and-time format. Basic and extended formats are both accepted. Times can be local (with a timezone offset) or UTC. If both a start time and an end time are specified, then the start time must not be later than the end time. Example: &#x60;2008-08-08T08:08:08Z&#x60; * @param {string} [order] An optional sort order. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async listByronTransactions(walletId: string, start?: string, end?: string, order?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<InlineResponse2004>>> { const localVarAxiosArgs = await ByronTransactionsApiAxiosParamCreator(configuration).listByronTransactions(walletId, start, end, order, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * <p align=\"right\">status: <strong>stable</strong></p> Create and send transaction from the wallet. * @summary Create * @param {Body18} body * @param {string} walletId * @param {*} [options] Override http request option. * @throws {RequiredError} */ async postByronTransaction(body: Body18, walletId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<InlineResponse2021>> { const localVarAxiosArgs = await ByronTransactionsApiAxiosParamCreator(configuration).postByronTransaction(body, walletId, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * <p align=\"right\">status: <strong>stable</strong></p> Estimate fee for the transaction. * @summary Estimate Fee * @param {Body17} body * @param {string} walletId * @param {*} [options] Override http request option. * @throws {RequiredError} */ async postByronTransactionFee(body: Body17, walletId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<InlineResponse202>> { const localVarAxiosArgs = await ByronTransactionsApiAxiosParamCreator(configuration).postByronTransactionFee(body, walletId, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, } }; /** * ByronTransactionsApi - factory interface * @export */ export const ByronTransactionsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * <p align=\"right\">status: <strong>stable</strong></p> Forget pending Byron transaction. Importantly, a transaction, when sent, cannot be cancelled. One can only request forgetting about it in order to try spending (concurrently) the same UTxO in another transaction. But, the transaction may still show up later in a block and therefore, appear in the wallet. * @summary Forget * @param {string} walletId * @param {string} transactionId * @param {*} [options] Override http request option. * @throws {RequiredError} */ deleteByronTransaction(walletId: string, transactionId: string, options?: any): AxiosPromise<void> { return ByronTransactionsApiFp(configuration).deleteByronTransaction(walletId, transactionId, options).then((request) => request(axios, basePath)); }, /** * <p align=\"right\">status: <strong>stable</strong></p> Get transaction by id. * @summary Get * @param {string} walletId * @param {string} transactionId * @param {*} [options] Override http request option. * @throws {RequiredError} */ getByronTransaction(walletId: string, transactionId: string, options?: any): AxiosPromise<InlineResponse2021> { return ByronTransactionsApiFp(configuration).getByronTransaction(walletId, transactionId, options).then((request) => request(axios, basePath)); }, /** * <p align=\"right\">status: <strong>stable</strong></p> List all incoming and outgoing transactions for the given wallet. * @summary List * @param {string} walletId * @param {string} [start] An optional start time in ISO 8601 date-and-time format. Basic and extended formats are both accepted. Times can be local (with a timezone offset) or UTC. If both a start time and an end time are specified, then the start time must not be later than the end time. Example: &#x60;2008-08-08T08:08:08Z&#x60; * @param {string} [end] An optional end time in ISO 8601 date-and-time format. Basic and extended formats are both accepted. Times can be local (with a timezone offset) or UTC. If both a start time and an end time are specified, then the start time must not be later than the end time. Example: &#x60;2008-08-08T08:08:08Z&#x60; * @param {string} [order] An optional sort order. * @param {*} [options] Override http request option. * @throws {RequiredError} */ listByronTransactions(walletId: string, start?: string, end?: string, order?: string, options?: any): AxiosPromise<Array<InlineResponse2004>> { return ByronTransactionsApiFp(configuration).listByronTransactions(walletId, start, end, order, options).then((request) => request(axios, basePath)); }, /** * <p align=\"right\">status: <strong>stable</strong></p> Create and send transaction from the wallet. * @summary Create * @param {Body18} body * @param {string} walletId * @param {*} [options] Override http request option. * @throws {RequiredError} */ postByronTransaction(body: Body18, walletId: string, options?: any): AxiosPromise<InlineResponse2021> { return ByronTransactionsApiFp(configuration).postByronTransaction(body, walletId, options).then((request) => request(axios, basePath)); }, /** * <p align=\"right\">status: <strong>stable</strong></p> Estimate fee for the transaction. * @summary Estimate Fee * @param {Body17} body * @param {string} walletId * @param {*} [options] Override http request option. * @throws {RequiredError} */ postByronTransactionFee(body: Body17, walletId: string, options?: any): AxiosPromise<InlineResponse202> { return ByronTransactionsApiFp(configuration).postByronTransactionFee(body, walletId, options).then((request) => request(axios, basePath)); }, }; }; /** * ByronTransactionsApi - object-oriented interface * @export * @class ByronTransactionsApi * @extends {BaseAPI} */ export class ByronTransactionsApi extends BaseAPI { /** * <p align=\"right\">status: <strong>stable</strong></p> Forget pending Byron transaction. Importantly, a transaction, when sent, cannot be cancelled. One can only request forgetting about it in order to try spending (concurrently) the same UTxO in another transaction. But, the transaction may still show up later in a block and therefore, appear in the wallet. * @summary Forget * @param {string} walletId * @param {string} transactionId * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ByronTransactionsApi */ public deleteByronTransaction(walletId: string, transactionId: string, options?: any) { return ByronTransactionsApiFp(this.configuration).deleteByronTransaction(walletId, transactionId, options).then((request) => request(this.axios, this.basePath)); } /** * <p align=\"right\">status: <strong>stable</strong></p> Get transaction by id. * @summary Get * @param {string} walletId * @param {string} transactionId * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ByronTransactionsApi */ public getByronTransaction(walletId: string, transactionId: string, options?: any) { return ByronTransactionsApiFp(this.configuration).getByronTransaction(walletId, transactionId, options).then((request) => request(this.axios, this.basePath)); } /** * <p align=\"right\">status: <strong>stable</strong></p> List all incoming and outgoing transactions for the given wallet. * @summary List * @param {string} walletId * @param {string} [start] An optional start time in ISO 8601 date-and-time format. Basic and extended formats are both accepted. Times can be local (with a timezone offset) or UTC. If both a start time and an end time are specified, then the start time must not be later than the end time. Example: &#x60;2008-08-08T08:08:08Z&#x60; * @param {string} [end] An optional end time in ISO 8601 date-and-time format. Basic and extended formats are both accepted. Times can be local (with a timezone offset) or UTC. If both a start time and an end time are specified, then the start time must not be later than the end time. Example: &#x60;2008-08-08T08:08:08Z&#x60; * @param {string} [order] An optional sort order. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ByronTransactionsApi */ public listByronTransactions(walletId: string, start?: string, end?: string, order?: string, options?: any) { return ByronTransactionsApiFp(this.configuration).listByronTransactions(walletId, start, end, order, options).then((request) => request(this.axios, this.basePath)); } /** * <p align=\"right\">status: <strong>stable</strong></p> Create and send transaction from the wallet. * @summary Create * @param {Body18} body * @param {string} walletId * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ByronTransactionsApi */ public postByronTransaction(body: Body18, walletId: string, options?: any) { return ByronTransactionsApiFp(this.configuration).postByronTransaction(body, walletId, options).then((request) => request(this.axios, this.basePath)); } /** * <p align=\"right\">status: <strong>stable</strong></p> Estimate fee for the transaction. * @summary Estimate Fee * @param {Body17} body * @param {string} walletId * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ByronTransactionsApi */ public postByronTransactionFee(body: Body17, walletId: string, options?: any) { return ByronTransactionsApiFp(this.configuration).postByronTransactionFee(body, walletId, options).then((request) => request(this.axios, this.basePath)); } }