/* tslint:disable */ /* eslint-disable */ /** * Fireblocks API * Fireblocks provides a suite of applications to manage digital asset operations and a complete development platform to build your business on the blockchain. - Visit our website for more information: [Fireblocks Website](https://fireblocks.com) - Visit our developer docs: [Fireblocks DevPortal](https://developers.fireblocks.com) * * The version of the OpenAPI document: 1.6.2 * Contact: developers@fireblocks.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import type { Configuration } from '../configuration'; import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; import globalAxios from 'axios'; import { convertToFireblocksResponse } from "../response/fireblocksResponse"; // URLSearchParams not necessarily used // @ts-ignore import { URL, URLSearchParams } from 'url'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common'; import { assertParamExistsAndNotEmpty } from '../utils/validation_utils'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base'; // @ts-ignore import { CreateEarnActionRequest } from '../models'; // @ts-ignore import { CreateEarnActionResponse } from '../models'; // @ts-ignore import { ErrorSchema } from '../models'; // @ts-ignore import { GetActionResponse } from '../models'; // @ts-ignore import { GetActionsResponse } from '../models'; // @ts-ignore import { GetOpportunitiesResponse } from '../models'; // @ts-ignore import { GetPositionsResponse } from '../models'; // @ts-ignore import { GetProvidersResponse } from '../models'; /** * EarnApi - axios parameter creator * @export */ export const EarnApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Approves earn provider terms of service for this workspace (one-time per tenant). When `isTermsApprovalRequired` is true on a provider (see list providers), call this once before creating or executing earn actions with providers that require it. After success, `GET /earn/providers` reflects `isTermsOfServiceApproved`. * @summary Approve earn provider terms of service * @param {string} [idempotencyKey] A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. * @param {*} [options] Override http request option. * @throws {RequiredError} */ approveTermsOfService: async (idempotencyKey?: string, options: RawAxiosRequestConfig = {}): Promise => { const localVarPath = `/earn/providers/approve_terms_of_service`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; // Stamped onto the request config (not the headers, so it never goes on // the wire) so the response interceptor can name the operation in the // lifecycle warning. Key must match OPERATION_ID_CONFIG_KEY in utils/lifecycleWarning. (localVarRequestOptions as any).fireblocksOperationId = 'approveTermsOfService'; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; if (idempotencyKey != null) { localVarHeaderParameter['Idempotency-Key'] = String(idempotencyKey); } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Creates and runs a sequence of on-chain steps for either a deposit into or a withdrawal from an earn vault/market. Specify the operation with `action` in the request body (`DEPOSIT` or `WITHDRAW`). * @summary Create and execute a lending action (deposit or withdraw) * @param {CreateEarnActionRequest} createEarnActionRequest * @param {string} [idempotencyKey] A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. * @param {*} [options] Override http request option. * @throws {RequiredError} */ createEarnAction: async (createEarnActionRequest: CreateEarnActionRequest, idempotencyKey?: string, options: RawAxiosRequestConfig = {}): Promise => { assertParamExists('createEarnAction', 'createEarnActionRequest', createEarnActionRequest) const localVarPath = `/earn/actions`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; // Stamped onto the request config (not the headers, so it never goes on // the wire) so the response interceptor can name the operation in the // lifecycle warning. Key must match OPERATION_ID_CONFIG_KEY in utils/lifecycleWarning. (localVarRequestOptions as any).fireblocksOperationId = 'createEarnAction'; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; if (idempotencyKey != null) { localVarHeaderParameter['Idempotency-Key'] = String(idempotencyKey); } localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(createEarnActionRequest, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Returns one lending action by its action sequence id (tenant-scoped). * @summary Get a single earn lending action * @param {string} id Action sequence id (UUID). * @param {*} [options] Override http request option. * @throws {RequiredError} */ getEarnAction: async (id: string, options: RawAxiosRequestConfig = {}): Promise => { assertParamExistsAndNotEmpty('getEarnAction', 'id', id) const localVarPath = `/earn/actions/{id}` .replace(`{${"id"}}`, encodeURIComponent(String(id))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; // Stamped onto the request config (not the headers, so it never goes on // the wire) so the response interceptor can name the operation in the // lifecycle warning. Key must match OPERATION_ID_CONFIG_KEY in utils/lifecycleWarning. (localVarRequestOptions as any).fireblocksOperationId = 'getEarnAction'; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Returns a paginated list of lending actions (deposits and withdrawals) for the authenticated tenant. * @summary List earn lending actions * @param {string} [pageCursor] Cursor for the next or previous page of results. * @param {number} [pageSize] Number of items per page (default 100, max 100). * @param {GetEarnActionsSortByEnum} [sortBy] Field to sort results by. * @param {GetEarnActionsOrderEnum} [order] Sort order (ASC or DESC). * @param {*} [options] Override http request option. * @throws {RequiredError} */ getEarnActions: async (pageCursor?: string, pageSize?: number, sortBy?: GetEarnActionsSortByEnum, order?: GetEarnActionsOrderEnum, options: RawAxiosRequestConfig = {}): Promise => { const localVarPath = `/earn/actions`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; // Stamped onto the request config (not the headers, so it never goes on // the wire) so the response interceptor can name the operation in the // lifecycle warning. Key must match OPERATION_ID_CONFIG_KEY in utils/lifecycleWarning. (localVarRequestOptions as any).fireblocksOperationId = 'getEarnActions'; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; if (pageCursor !== undefined) { localVarQueryParameter['pageCursor'] = pageCursor; } if (pageSize !== undefined) { localVarQueryParameter['pageSize'] = pageSize; } if (sortBy !== undefined) { localVarQueryParameter['sortBy'] = sortBy; } if (order !== undefined) { localVarQueryParameter['order'] = order; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Get list of earn opportunities (vaults). * @summary Get list of earn opportunities * @param {string} [pageCursor] Cursor for the next or previous page of results. * @param {number} [pageSize] Number of items per page. * @param {string} [sortBy] Field to sort results by. * @param {GetEarnOpportunitiesOrderEnum} [order] Sort order (ASC or DESC). * @param {*} [options] Override http request option. * @throws {RequiredError} */ getEarnOpportunities: async (pageCursor?: string, pageSize?: number, sortBy?: string, order?: GetEarnOpportunitiesOrderEnum, options: RawAxiosRequestConfig = {}): Promise => { const localVarPath = `/earn/opportunities`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; // Stamped onto the request config (not the headers, so it never goes on // the wire) so the response interceptor can name the operation in the // lifecycle warning. Key must match OPERATION_ID_CONFIG_KEY in utils/lifecycleWarning. (localVarRequestOptions as any).fireblocksOperationId = 'getEarnOpportunities'; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; if (pageCursor !== undefined) { localVarQueryParameter['pageCursor'] = pageCursor; } if (pageSize !== undefined) { localVarQueryParameter['pageSize'] = pageSize; } if (sortBy !== undefined) { localVarQueryParameter['sortBy'] = sortBy; } if (order !== undefined) { localVarQueryParameter['order'] = order; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Get list of earn positions for accounts tracked for this workspace. Optional query parameters filter by chain, provider, and pagination. * @summary Get list of earn positions * @param {number} [chainId] * @param {GetEarnPositionsProviderIdEnum} [providerId] * @param {string} [pageCursor] Cursor for the next or previous page of results. * @param {number} [pageSize] Number of items per page. * @param {string} [sortBy] Field to sort results by. * @param {GetEarnPositionsOrderEnum} [order] Sort order (ASC or DESC). * @param {*} [options] Override http request option. * @throws {RequiredError} */ getEarnPositions: async (chainId?: number, providerId?: GetEarnPositionsProviderIdEnum, pageCursor?: string, pageSize?: number, sortBy?: string, order?: GetEarnPositionsOrderEnum, options: RawAxiosRequestConfig = {}): Promise => { const localVarPath = `/earn/positions`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; // Stamped onto the request config (not the headers, so it never goes on // the wire) so the response interceptor can name the operation in the // lifecycle warning. Key must match OPERATION_ID_CONFIG_KEY in utils/lifecycleWarning. (localVarRequestOptions as any).fireblocksOperationId = 'getEarnPositions'; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; if (chainId !== undefined) { localVarQueryParameter['chainId'] = chainId; } if (providerId !== undefined) { localVarQueryParameter['providerId'] = providerId; } if (pageCursor !== undefined) { localVarQueryParameter['pageCursor'] = pageCursor; } if (pageSize !== undefined) { localVarQueryParameter['pageSize'] = pageSize; } if (sortBy !== undefined) { localVarQueryParameter['sortBy'] = sortBy; } if (order !== undefined) { localVarQueryParameter['order'] = order; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Get list of earn providers. * @summary Get list of earn providers * @param {string} [pageCursor] Cursor for the next or previous page of results. * @param {number} [pageSize] Number of items per page. * @param {string} [sortBy] Field to sort results by. * @param {GetEarnProvidersOrderEnum} [order] Sort order (ASC or DESC). * @param {*} [options] Override http request option. * @throws {RequiredError} */ getEarnProviders: async (pageCursor?: string, pageSize?: number, sortBy?: string, order?: GetEarnProvidersOrderEnum, options: RawAxiosRequestConfig = {}): Promise => { const localVarPath = `/earn/providers`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; // Stamped onto the request config (not the headers, so it never goes on // the wire) so the response interceptor can name the operation in the // lifecycle warning. Key must match OPERATION_ID_CONFIG_KEY in utils/lifecycleWarning. (localVarRequestOptions as any).fireblocksOperationId = 'getEarnProviders'; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; if (pageCursor !== undefined) { localVarQueryParameter['pageCursor'] = pageCursor; } if (pageSize !== undefined) { localVarQueryParameter['pageSize'] = pageSize; } if (sortBy !== undefined) { localVarQueryParameter['sortBy'] = sortBy; } if (order !== undefined) { localVarQueryParameter['order'] = order; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, } }; /** * EarnApi - functional programming interface * @export */ export const EarnApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = EarnApiAxiosParamCreator(configuration) return { /** * Approves earn provider terms of service for this workspace (one-time per tenant). When `isTermsApprovalRequired` is true on a provider (see list providers), call this once before creating or executing earn actions with providers that require it. After success, `GET /earn/providers` reflects `isTermsOfServiceApproved`. * @summary Approve earn provider terms of service * @param {string} [idempotencyKey] A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async approveTermsOfService(idempotencyKey?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.approveTermsOfService(idempotencyKey, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['EarnApi.approveTermsOfService']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** * Creates and runs a sequence of on-chain steps for either a deposit into or a withdrawal from an earn vault/market. Specify the operation with `action` in the request body (`DEPOSIT` or `WITHDRAW`). * @summary Create and execute a lending action (deposit or withdraw) * @param {CreateEarnActionRequest} createEarnActionRequest * @param {string} [idempotencyKey] A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async createEarnAction(createEarnActionRequest: CreateEarnActionRequest, idempotencyKey?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.createEarnAction(createEarnActionRequest, idempotencyKey, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['EarnApi.createEarnAction']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** * Returns one lending action by its action sequence id (tenant-scoped). * @summary Get a single earn lending action * @param {string} id Action sequence id (UUID). * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getEarnAction(id: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getEarnAction(id, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['EarnApi.getEarnAction']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** * Returns a paginated list of lending actions (deposits and withdrawals) for the authenticated tenant. * @summary List earn lending actions * @param {string} [pageCursor] Cursor for the next or previous page of results. * @param {number} [pageSize] Number of items per page (default 100, max 100). * @param {GetEarnActionsSortByEnum} [sortBy] Field to sort results by. * @param {GetEarnActionsOrderEnum} [order] Sort order (ASC or DESC). * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getEarnActions(pageCursor?: string, pageSize?: number, sortBy?: GetEarnActionsSortByEnum, order?: GetEarnActionsOrderEnum, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getEarnActions(pageCursor, pageSize, sortBy, order, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['EarnApi.getEarnActions']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** * Get list of earn opportunities (vaults). * @summary Get list of earn opportunities * @param {string} [pageCursor] Cursor for the next or previous page of results. * @param {number} [pageSize] Number of items per page. * @param {string} [sortBy] Field to sort results by. * @param {GetEarnOpportunitiesOrderEnum} [order] Sort order (ASC or DESC). * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getEarnOpportunities(pageCursor?: string, pageSize?: number, sortBy?: string, order?: GetEarnOpportunitiesOrderEnum, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getEarnOpportunities(pageCursor, pageSize, sortBy, order, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['EarnApi.getEarnOpportunities']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** * Get list of earn positions for accounts tracked for this workspace. Optional query parameters filter by chain, provider, and pagination. * @summary Get list of earn positions * @param {number} [chainId] * @param {GetEarnPositionsProviderIdEnum} [providerId] * @param {string} [pageCursor] Cursor for the next or previous page of results. * @param {number} [pageSize] Number of items per page. * @param {string} [sortBy] Field to sort results by. * @param {GetEarnPositionsOrderEnum} [order] Sort order (ASC or DESC). * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getEarnPositions(chainId?: number, providerId?: GetEarnPositionsProviderIdEnum, pageCursor?: string, pageSize?: number, sortBy?: string, order?: GetEarnPositionsOrderEnum, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getEarnPositions(chainId, providerId, pageCursor, pageSize, sortBy, order, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['EarnApi.getEarnPositions']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** * Get list of earn providers. * @summary Get list of earn providers * @param {string} [pageCursor] Cursor for the next or previous page of results. * @param {number} [pageSize] Number of items per page. * @param {string} [sortBy] Field to sort results by. * @param {GetEarnProvidersOrderEnum} [order] Sort order (ASC or DESC). * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getEarnProviders(pageCursor?: string, pageSize?: number, sortBy?: string, order?: GetEarnProvidersOrderEnum, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getEarnProviders(pageCursor, pageSize, sortBy, order, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['EarnApi.getEarnProviders']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, } }; /** * EarnApi - factory interface * @export */ export const EarnApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = EarnApiFp(configuration) return { /** * Approves earn provider terms of service for this workspace (one-time per tenant). When `isTermsApprovalRequired` is true on a provider (see list providers), call this once before creating or executing earn actions with providers that require it. After success, `GET /earn/providers` reflects `isTermsOfServiceApproved`. * @summary Approve earn provider terms of service * @param {EarnApiApproveTermsOfServiceRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ approveTermsOfService(requestParameters: EarnApiApproveTermsOfServiceRequest = {}, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.approveTermsOfService(requestParameters.idempotencyKey, options).then((request) => request(axios, basePath)); }, /** * Creates and runs a sequence of on-chain steps for either a deposit into or a withdrawal from an earn vault/market. Specify the operation with `action` in the request body (`DEPOSIT` or `WITHDRAW`). * @summary Create and execute a lending action (deposit or withdraw) * @param {EarnApiCreateEarnActionRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ createEarnAction(requestParameters: EarnApiCreateEarnActionRequest, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.createEarnAction(requestParameters.createEarnActionRequest, requestParameters.idempotencyKey, options).then((request) => request(axios, basePath)); }, /** * Returns one lending action by its action sequence id (tenant-scoped). * @summary Get a single earn lending action * @param {EarnApiGetEarnActionRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getEarnAction(requestParameters: EarnApiGetEarnActionRequest, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.getEarnAction(requestParameters.id, options).then((request) => request(axios, basePath)); }, /** * Returns a paginated list of lending actions (deposits and withdrawals) for the authenticated tenant. * @summary List earn lending actions * @param {EarnApiGetEarnActionsRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getEarnActions(requestParameters: EarnApiGetEarnActionsRequest = {}, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.getEarnActions(requestParameters.pageCursor, requestParameters.pageSize, requestParameters.sortBy, requestParameters.order, options).then((request) => request(axios, basePath)); }, /** * Get list of earn opportunities (vaults). * @summary Get list of earn opportunities * @param {EarnApiGetEarnOpportunitiesRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getEarnOpportunities(requestParameters: EarnApiGetEarnOpportunitiesRequest = {}, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.getEarnOpportunities(requestParameters.pageCursor, requestParameters.pageSize, requestParameters.sortBy, requestParameters.order, options).then((request) => request(axios, basePath)); }, /** * Get list of earn positions for accounts tracked for this workspace. Optional query parameters filter by chain, provider, and pagination. * @summary Get list of earn positions * @param {EarnApiGetEarnPositionsRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getEarnPositions(requestParameters: EarnApiGetEarnPositionsRequest = {}, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.getEarnPositions(requestParameters.chainId, requestParameters.providerId, requestParameters.pageCursor, requestParameters.pageSize, requestParameters.sortBy, requestParameters.order, options).then((request) => request(axios, basePath)); }, /** * Get list of earn providers. * @summary Get list of earn providers * @param {EarnApiGetEarnProvidersRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getEarnProviders(requestParameters: EarnApiGetEarnProvidersRequest = {}, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.getEarnProviders(requestParameters.pageCursor, requestParameters.pageSize, requestParameters.sortBy, requestParameters.order, options).then((request) => request(axios, basePath)); }, }; }; /** * Request parameters for approveTermsOfService operation in EarnApi. * @export * @interface EarnApiApproveTermsOfServiceRequest */ export interface EarnApiApproveTermsOfServiceRequest { /** * A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. * @type {string} * @memberof EarnApiApproveTermsOfService */ readonly idempotencyKey?: string } /** * Request parameters for createEarnAction operation in EarnApi. * @export * @interface EarnApiCreateEarnActionRequest */ export interface EarnApiCreateEarnActionRequest { /** * * @type {CreateEarnActionRequest} * @memberof EarnApiCreateEarnAction */ readonly createEarnActionRequest: CreateEarnActionRequest /** * A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. * @type {string} * @memberof EarnApiCreateEarnAction */ readonly idempotencyKey?: string } /** * Request parameters for getEarnAction operation in EarnApi. * @export * @interface EarnApiGetEarnActionRequest */ export interface EarnApiGetEarnActionRequest { /** * Action sequence id (UUID). * @type {string} * @memberof EarnApiGetEarnAction */ readonly id: string } /** * Request parameters for getEarnActions operation in EarnApi. * @export * @interface EarnApiGetEarnActionsRequest */ export interface EarnApiGetEarnActionsRequest { /** * Cursor for the next or previous page of results. * @type {string} * @memberof EarnApiGetEarnActions */ readonly pageCursor?: string /** * Number of items per page (default 100, max 100). * @type {number} * @memberof EarnApiGetEarnActions */ readonly pageSize?: number /** * Field to sort results by. * @type {'createdAt' | 'updatedAt'} * @memberof EarnApiGetEarnActions */ readonly sortBy?: GetEarnActionsSortByEnum /** * Sort order (ASC or DESC). * @type {'ASC' | 'DESC'} * @memberof EarnApiGetEarnActions */ readonly order?: GetEarnActionsOrderEnum } /** * Request parameters for getEarnOpportunities operation in EarnApi. * @export * @interface EarnApiGetEarnOpportunitiesRequest */ export interface EarnApiGetEarnOpportunitiesRequest { /** * Cursor for the next or previous page of results. * @type {string} * @memberof EarnApiGetEarnOpportunities */ readonly pageCursor?: string /** * Number of items per page. * @type {number} * @memberof EarnApiGetEarnOpportunities */ readonly pageSize?: number /** * Field to sort results by. * @type {string} * @memberof EarnApiGetEarnOpportunities */ readonly sortBy?: string /** * Sort order (ASC or DESC). * @type {'ASC' | 'DESC'} * @memberof EarnApiGetEarnOpportunities */ readonly order?: GetEarnOpportunitiesOrderEnum } /** * Request parameters for getEarnPositions operation in EarnApi. * @export * @interface EarnApiGetEarnPositionsRequest */ export interface EarnApiGetEarnPositionsRequest { /** * * @type {number} * @memberof EarnApiGetEarnPositions */ readonly chainId?: number /** * * @type {'MORPHO' | 'AAVE'} * @memberof EarnApiGetEarnPositions */ readonly providerId?: GetEarnPositionsProviderIdEnum /** * Cursor for the next or previous page of results. * @type {string} * @memberof EarnApiGetEarnPositions */ readonly pageCursor?: string /** * Number of items per page. * @type {number} * @memberof EarnApiGetEarnPositions */ readonly pageSize?: number /** * Field to sort results by. * @type {string} * @memberof EarnApiGetEarnPositions */ readonly sortBy?: string /** * Sort order (ASC or DESC). * @type {'ASC' | 'DESC'} * @memberof EarnApiGetEarnPositions */ readonly order?: GetEarnPositionsOrderEnum } /** * Request parameters for getEarnProviders operation in EarnApi. * @export * @interface EarnApiGetEarnProvidersRequest */ export interface EarnApiGetEarnProvidersRequest { /** * Cursor for the next or previous page of results. * @type {string} * @memberof EarnApiGetEarnProviders */ readonly pageCursor?: string /** * Number of items per page. * @type {number} * @memberof EarnApiGetEarnProviders */ readonly pageSize?: number /** * Field to sort results by. * @type {string} * @memberof EarnApiGetEarnProviders */ readonly sortBy?: string /** * Sort order (ASC or DESC). * @type {'ASC' | 'DESC'} * @memberof EarnApiGetEarnProviders */ readonly order?: GetEarnProvidersOrderEnum } /** * EarnApi - object-oriented interface * @export * @class EarnApi * @extends {BaseAPI} */ export class EarnApi extends BaseAPI { /** * Approves earn provider terms of service for this workspace (one-time per tenant). When `isTermsApprovalRequired` is true on a provider (see list providers), call this once before creating or executing earn actions with providers that require it. After success, `GET /earn/providers` reflects `isTermsOfServiceApproved`. * @summary Approve earn provider terms of service * @param {EarnApiApproveTermsOfServiceRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EarnApi */ public approveTermsOfService(requestParameters: EarnApiApproveTermsOfServiceRequest = {}) { return EarnApiFp(this.configuration).approveTermsOfService(requestParameters.idempotencyKey).then((request) => request(this.axios, this.basePath)).then(convertToFireblocksResponse); } /** * Creates and runs a sequence of on-chain steps for either a deposit into or a withdrawal from an earn vault/market. Specify the operation with `action` in the request body (`DEPOSIT` or `WITHDRAW`). * @summary Create and execute a lending action (deposit or withdraw) * @param {EarnApiCreateEarnActionRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EarnApi */ public createEarnAction(requestParameters: EarnApiCreateEarnActionRequest) { return EarnApiFp(this.configuration).createEarnAction(requestParameters.createEarnActionRequest, requestParameters.idempotencyKey).then((request) => request(this.axios, this.basePath)).then(convertToFireblocksResponse); } /** * Returns one lending action by its action sequence id (tenant-scoped). * @summary Get a single earn lending action * @param {EarnApiGetEarnActionRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EarnApi */ public getEarnAction(requestParameters: EarnApiGetEarnActionRequest) { return EarnApiFp(this.configuration).getEarnAction(requestParameters.id).then((request) => request(this.axios, this.basePath)).then(convertToFireblocksResponse); } /** * Returns a paginated list of lending actions (deposits and withdrawals) for the authenticated tenant. * @summary List earn lending actions * @param {EarnApiGetEarnActionsRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EarnApi */ public getEarnActions(requestParameters: EarnApiGetEarnActionsRequest = {}) { return EarnApiFp(this.configuration).getEarnActions(requestParameters.pageCursor, requestParameters.pageSize, requestParameters.sortBy, requestParameters.order).then((request) => request(this.axios, this.basePath)).then(convertToFireblocksResponse); } /** * Get list of earn opportunities (vaults). * @summary Get list of earn opportunities * @param {EarnApiGetEarnOpportunitiesRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EarnApi */ public getEarnOpportunities(requestParameters: EarnApiGetEarnOpportunitiesRequest = {}) { return EarnApiFp(this.configuration).getEarnOpportunities(requestParameters.pageCursor, requestParameters.pageSize, requestParameters.sortBy, requestParameters.order).then((request) => request(this.axios, this.basePath)).then(convertToFireblocksResponse); } /** * Get list of earn positions for accounts tracked for this workspace. Optional query parameters filter by chain, provider, and pagination. * @summary Get list of earn positions * @param {EarnApiGetEarnPositionsRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EarnApi */ public getEarnPositions(requestParameters: EarnApiGetEarnPositionsRequest = {}) { return EarnApiFp(this.configuration).getEarnPositions(requestParameters.chainId, requestParameters.providerId, requestParameters.pageCursor, requestParameters.pageSize, requestParameters.sortBy, requestParameters.order).then((request) => request(this.axios, this.basePath)).then(convertToFireblocksResponse); } /** * Get list of earn providers. * @summary Get list of earn providers * @param {EarnApiGetEarnProvidersRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EarnApi */ public getEarnProviders(requestParameters: EarnApiGetEarnProvidersRequest = {}) { return EarnApiFp(this.configuration).getEarnProviders(requestParameters.pageCursor, requestParameters.pageSize, requestParameters.sortBy, requestParameters.order).then((request) => request(this.axios, this.basePath)).then(convertToFireblocksResponse); } } /** * @export */ export const GetEarnActionsSortByEnum = { CreatedAt: 'createdAt', UpdatedAt: 'updatedAt' } as const; export type GetEarnActionsSortByEnum = typeof GetEarnActionsSortByEnum[keyof typeof GetEarnActionsSortByEnum]; /** * @export */ export const GetEarnActionsOrderEnum = { Asc: 'ASC', Desc: 'DESC' } as const; export type GetEarnActionsOrderEnum = typeof GetEarnActionsOrderEnum[keyof typeof GetEarnActionsOrderEnum]; /** * @export */ export const GetEarnOpportunitiesOrderEnum = { Asc: 'ASC', Desc: 'DESC' } as const; export type GetEarnOpportunitiesOrderEnum = typeof GetEarnOpportunitiesOrderEnum[keyof typeof GetEarnOpportunitiesOrderEnum]; /** * @export */ export const GetEarnPositionsProviderIdEnum = { Morpho: 'MORPHO', Aave: 'AAVE' } as const; export type GetEarnPositionsProviderIdEnum = typeof GetEarnPositionsProviderIdEnum[keyof typeof GetEarnPositionsProviderIdEnum]; /** * @export */ export const GetEarnPositionsOrderEnum = { Asc: 'ASC', Desc: 'DESC' } as const; export type GetEarnPositionsOrderEnum = typeof GetEarnPositionsOrderEnum[keyof typeof GetEarnPositionsOrderEnum]; /** * @export */ export const GetEarnProvidersOrderEnum = { Asc: 'ASC', Desc: 'DESC' } as const; export type GetEarnProvidersOrderEnum = typeof GetEarnProvidersOrderEnum[keyof typeof GetEarnProvidersOrderEnum];