"use strict";
/* 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.
 */
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __generator = (this && this.__generator) || function (thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (g && (g = 0, op[0] && (_ = 0)), _) try {
            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [op[0] & 2, t.value];
            switch (op[0]) {
                case 0: case 1: t = op; break;
                case 4: _.label++; return { value: op[1], done: false };
                case 5: _.label++; y = op[1]; op = [0]; continue;
                case 7: op = _.ops.pop(); _.trys.pop(); continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                    if (t[2]) _.ops.pop();
                    _.trys.pop(); continue;
            }
            op = body.call(thisArg, _);
        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
    }
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.GetEarnProvidersOrderEnum = exports.GetEarnPositionsOrderEnum = exports.GetEarnPositionsProviderIdEnum = exports.GetEarnOpportunitiesOrderEnum = exports.GetEarnActionsOrderEnum = exports.GetEarnActionsSortByEnum = exports.EarnBetaApi = exports.EarnBetaApiFactory = exports.EarnBetaApiFp = exports.EarnBetaApiAxiosParamCreator = void 0;
var axios_1 = __importDefault(require("axios"));
var fireblocksResponse_1 = require("../response/fireblocksResponse");
// URLSearchParams not necessarily used
// @ts-ignore
var url_1 = require("url");
// Some imports not used depending on template conditions
// @ts-ignore
var common_1 = require("../common");
var validation_utils_1 = require("../utils/validation_utils");
// @ts-ignore
var base_1 = require("../base");
/**
 * EarnBetaApi - axios parameter creator
 * @export
 */
var EarnBetaApiAxiosParamCreator = function (configuration) {
    var _this = this;
    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`.  **Note:** This endpoint is currently in beta and might be subject to changes.
         * @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: function (idempotencyKey, options) {
            if (options === void 0) { options = {}; }
            return __awaiter(_this, void 0, void 0, function () {
                var localVarPath, localVarUrlObj, baseOptions, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
                return __generator(this, function (_a) {
                    localVarPath = "/earn/providers/approve_terms_of_service";
                    localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
                    if (configuration) {
                        baseOptions = configuration.baseOptions;
                    }
                    localVarRequestOptions = __assign(__assign({ method: 'POST' }, baseOptions), options);
                    localVarHeaderParameter = {};
                    localVarQueryParameter = {};
                    if (idempotencyKey != null) {
                        localVarHeaderParameter['Idempotency-Key'] = String(idempotencyKey);
                    }
                    (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
                    headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
                    localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
                    return [2 /*return*/, {
                            url: (0, common_1.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`).  **Note:** This endpoint is currently in beta and might be subject to changes.
         * @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: function (createEarnActionRequest, idempotencyKey, options) {
            if (options === void 0) { options = {}; }
            return __awaiter(_this, void 0, void 0, function () {
                var localVarPath, localVarUrlObj, baseOptions, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
                return __generator(this, function (_a) {
                    (0, common_1.assertParamExists)('createEarnAction', 'createEarnActionRequest', createEarnActionRequest);
                    localVarPath = "/earn/actions";
                    localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
                    if (configuration) {
                        baseOptions = configuration.baseOptions;
                    }
                    localVarRequestOptions = __assign(__assign({ method: 'POST' }, baseOptions), options);
                    localVarHeaderParameter = {};
                    localVarQueryParameter = {};
                    if (idempotencyKey != null) {
                        localVarHeaderParameter['Idempotency-Key'] = String(idempotencyKey);
                    }
                    localVarHeaderParameter['Content-Type'] = 'application/json';
                    (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
                    headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
                    localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
                    localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(createEarnActionRequest, localVarRequestOptions, configuration);
                    return [2 /*return*/, {
                            url: (0, common_1.toPathString)(localVarUrlObj),
                            options: localVarRequestOptions,
                        }];
                });
            });
        },
        /**
         * Returns one lending action by its action sequence id (tenant-scoped).  **Note:** This endpoint is currently in beta and might be subject to changes.
         * @summary Get a single earn lending action
         * @param {string} id Action sequence id (UUID).
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getEarnAction: function (id, options) {
            if (options === void 0) { options = {}; }
            return __awaiter(_this, void 0, void 0, function () {
                var localVarPath, localVarUrlObj, baseOptions, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
                return __generator(this, function (_a) {
                    (0, validation_utils_1.assertParamExistsAndNotEmpty)('getEarnAction', 'id', id);
                    localVarPath = "/earn/actions/{id}"
                        .replace("{".concat("id", "}"), encodeURIComponent(String(id)));
                    localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
                    if (configuration) {
                        baseOptions = configuration.baseOptions;
                    }
                    localVarRequestOptions = __assign(__assign({ method: 'GET' }, baseOptions), options);
                    localVarHeaderParameter = {};
                    localVarQueryParameter = {};
                    (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
                    headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
                    localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
                    return [2 /*return*/, {
                            url: (0, common_1.toPathString)(localVarUrlObj),
                            options: localVarRequestOptions,
                        }];
                });
            });
        },
        /**
         * Returns a paginated list of lending actions (deposits and withdrawals) for the authenticated tenant.  **Note:** This endpoint is currently in beta and might be subject to changes.
         * @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: function (pageCursor, pageSize, sortBy, order, options) {
            if (options === void 0) { options = {}; }
            return __awaiter(_this, void 0, void 0, function () {
                var localVarPath, localVarUrlObj, baseOptions, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
                return __generator(this, function (_a) {
                    localVarPath = "/earn/actions";
                    localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
                    if (configuration) {
                        baseOptions = configuration.baseOptions;
                    }
                    localVarRequestOptions = __assign(__assign({ method: 'GET' }, baseOptions), options);
                    localVarHeaderParameter = {};
                    localVarQueryParameter = {};
                    if (pageCursor !== undefined) {
                        localVarQueryParameter['pageCursor'] = pageCursor;
                    }
                    if (pageSize !== undefined) {
                        localVarQueryParameter['pageSize'] = pageSize;
                    }
                    if (sortBy !== undefined) {
                        localVarQueryParameter['sortBy'] = sortBy;
                    }
                    if (order !== undefined) {
                        localVarQueryParameter['order'] = order;
                    }
                    (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
                    headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
                    localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
                    return [2 /*return*/, {
                            url: (0, common_1.toPathString)(localVarUrlObj),
                            options: localVarRequestOptions,
                        }];
                });
            });
        },
        /**
         * Get list of earn opportunities (vaults).  **Note:** This endpoint is currently in beta and might be subject to changes.
         * @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: function (pageCursor, pageSize, sortBy, order, options) {
            if (options === void 0) { options = {}; }
            return __awaiter(_this, void 0, void 0, function () {
                var localVarPath, localVarUrlObj, baseOptions, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
                return __generator(this, function (_a) {
                    localVarPath = "/earn/opportunities";
                    localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
                    if (configuration) {
                        baseOptions = configuration.baseOptions;
                    }
                    localVarRequestOptions = __assign(__assign({ method: 'GET' }, baseOptions), options);
                    localVarHeaderParameter = {};
                    localVarQueryParameter = {};
                    if (pageCursor !== undefined) {
                        localVarQueryParameter['pageCursor'] = pageCursor;
                    }
                    if (pageSize !== undefined) {
                        localVarQueryParameter['pageSize'] = pageSize;
                    }
                    if (sortBy !== undefined) {
                        localVarQueryParameter['sortBy'] = sortBy;
                    }
                    if (order !== undefined) {
                        localVarQueryParameter['order'] = order;
                    }
                    (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
                    headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
                    localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
                    return [2 /*return*/, {
                            url: (0, common_1.toPathString)(localVarUrlObj),
                            options: localVarRequestOptions,
                        }];
                });
            });
        },
        /**
         * Get list of earn positions for accounts tracked for this workspace.  Optional query parameters filter by chain, provider, and pagination.  **Note:** This endpoint is currently in beta and might be subject to changes.
         * @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: function (chainId, providerId, pageCursor, pageSize, sortBy, order, options) {
            if (options === void 0) { options = {}; }
            return __awaiter(_this, void 0, void 0, function () {
                var localVarPath, localVarUrlObj, baseOptions, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
                return __generator(this, function (_a) {
                    localVarPath = "/earn/positions";
                    localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
                    if (configuration) {
                        baseOptions = configuration.baseOptions;
                    }
                    localVarRequestOptions = __assign(__assign({ method: 'GET' }, baseOptions), options);
                    localVarHeaderParameter = {};
                    localVarQueryParameter = {};
                    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;
                    }
                    (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
                    headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
                    localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
                    return [2 /*return*/, {
                            url: (0, common_1.toPathString)(localVarUrlObj),
                            options: localVarRequestOptions,
                        }];
                });
            });
        },
        /**
         * Get list of earn providers.  **Note:** This endpoint is currently in beta and might be subject to changes.
         * @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: function (pageCursor, pageSize, sortBy, order, options) {
            if (options === void 0) { options = {}; }
            return __awaiter(_this, void 0, void 0, function () {
                var localVarPath, localVarUrlObj, baseOptions, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
                return __generator(this, function (_a) {
                    localVarPath = "/earn/providers";
                    localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
                    if (configuration) {
                        baseOptions = configuration.baseOptions;
                    }
                    localVarRequestOptions = __assign(__assign({ method: 'GET' }, baseOptions), options);
                    localVarHeaderParameter = {};
                    localVarQueryParameter = {};
                    if (pageCursor !== undefined) {
                        localVarQueryParameter['pageCursor'] = pageCursor;
                    }
                    if (pageSize !== undefined) {
                        localVarQueryParameter['pageSize'] = pageSize;
                    }
                    if (sortBy !== undefined) {
                        localVarQueryParameter['sortBy'] = sortBy;
                    }
                    if (order !== undefined) {
                        localVarQueryParameter['order'] = order;
                    }
                    (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
                    headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
                    localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
                    return [2 /*return*/, {
                            url: (0, common_1.toPathString)(localVarUrlObj),
                            options: localVarRequestOptions,
                        }];
                });
            });
        },
    };
};
exports.EarnBetaApiAxiosParamCreator = EarnBetaApiAxiosParamCreator;
/**
 * EarnBetaApi - functional programming interface
 * @export
 */
var EarnBetaApiFp = function (configuration) {
    var localVarAxiosParamCreator = (0, exports.EarnBetaApiAxiosParamCreator)(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`.  **Note:** This endpoint is currently in beta and might be subject to changes.
         * @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: function (idempotencyKey, options) {
            var _a, _b, _c;
            return __awaiter(this, void 0, void 0, function () {
                var localVarAxiosArgs, index, operationBasePath;
                return __generator(this, function (_d) {
                    switch (_d.label) {
                        case 0: return [4 /*yield*/, localVarAxiosParamCreator.approveTermsOfService(idempotencyKey, options)];
                        case 1:
                            localVarAxiosArgs = _d.sent();
                            index = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
                            operationBasePath = (_c = (_b = base_1.operationServerMap['EarnBetaApi.approveTermsOfService']) === null || _b === void 0 ? void 0 : _b[index]) === null || _c === void 0 ? void 0 : _c.url;
                            return [2 /*return*/, function (axios, basePath) { return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.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`).  **Note:** This endpoint is currently in beta and might be subject to changes.
         * @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: function (createEarnActionRequest, idempotencyKey, options) {
            var _a, _b, _c;
            return __awaiter(this, void 0, void 0, function () {
                var localVarAxiosArgs, index, operationBasePath;
                return __generator(this, function (_d) {
                    switch (_d.label) {
                        case 0: return [4 /*yield*/, localVarAxiosParamCreator.createEarnAction(createEarnActionRequest, idempotencyKey, options)];
                        case 1:
                            localVarAxiosArgs = _d.sent();
                            index = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
                            operationBasePath = (_c = (_b = base_1.operationServerMap['EarnBetaApi.createEarnAction']) === null || _b === void 0 ? void 0 : _b[index]) === null || _c === void 0 ? void 0 : _c.url;
                            return [2 /*return*/, function (axios, basePath) { return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, operationBasePath || basePath); }];
                    }
                });
            });
        },
        /**
         * Returns one lending action by its action sequence id (tenant-scoped).  **Note:** This endpoint is currently in beta and might be subject to changes.
         * @summary Get a single earn lending action
         * @param {string} id Action sequence id (UUID).
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getEarnAction: function (id, options) {
            var _a, _b, _c;
            return __awaiter(this, void 0, void 0, function () {
                var localVarAxiosArgs, index, operationBasePath;
                return __generator(this, function (_d) {
                    switch (_d.label) {
                        case 0: return [4 /*yield*/, localVarAxiosParamCreator.getEarnAction(id, options)];
                        case 1:
                            localVarAxiosArgs = _d.sent();
                            index = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
                            operationBasePath = (_c = (_b = base_1.operationServerMap['EarnBetaApi.getEarnAction']) === null || _b === void 0 ? void 0 : _b[index]) === null || _c === void 0 ? void 0 : _c.url;
                            return [2 /*return*/, function (axios, basePath) { return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, operationBasePath || basePath); }];
                    }
                });
            });
        },
        /**
         * Returns a paginated list of lending actions (deposits and withdrawals) for the authenticated tenant.  **Note:** This endpoint is currently in beta and might be subject to changes.
         * @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: function (pageCursor, pageSize, sortBy, order, options) {
            var _a, _b, _c;
            return __awaiter(this, void 0, void 0, function () {
                var localVarAxiosArgs, index, operationBasePath;
                return __generator(this, function (_d) {
                    switch (_d.label) {
                        case 0: return [4 /*yield*/, localVarAxiosParamCreator.getEarnActions(pageCursor, pageSize, sortBy, order, options)];
                        case 1:
                            localVarAxiosArgs = _d.sent();
                            index = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
                            operationBasePath = (_c = (_b = base_1.operationServerMap['EarnBetaApi.getEarnActions']) === null || _b === void 0 ? void 0 : _b[index]) === null || _c === void 0 ? void 0 : _c.url;
                            return [2 /*return*/, function (axios, basePath) { return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, operationBasePath || basePath); }];
                    }
                });
            });
        },
        /**
         * Get list of earn opportunities (vaults).  **Note:** This endpoint is currently in beta and might be subject to changes.
         * @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: function (pageCursor, pageSize, sortBy, order, options) {
            var _a, _b, _c;
            return __awaiter(this, void 0, void 0, function () {
                var localVarAxiosArgs, index, operationBasePath;
                return __generator(this, function (_d) {
                    switch (_d.label) {
                        case 0: return [4 /*yield*/, localVarAxiosParamCreator.getEarnOpportunities(pageCursor, pageSize, sortBy, order, options)];
                        case 1:
                            localVarAxiosArgs = _d.sent();
                            index = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
                            operationBasePath = (_c = (_b = base_1.operationServerMap['EarnBetaApi.getEarnOpportunities']) === null || _b === void 0 ? void 0 : _b[index]) === null || _c === void 0 ? void 0 : _c.url;
                            return [2 /*return*/, function (axios, basePath) { return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.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.  **Note:** This endpoint is currently in beta and might be subject to changes.
         * @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: function (chainId, providerId, pageCursor, pageSize, sortBy, order, options) {
            var _a, _b, _c;
            return __awaiter(this, void 0, void 0, function () {
                var localVarAxiosArgs, index, operationBasePath;
                return __generator(this, function (_d) {
                    switch (_d.label) {
                        case 0: return [4 /*yield*/, localVarAxiosParamCreator.getEarnPositions(chainId, providerId, pageCursor, pageSize, sortBy, order, options)];
                        case 1:
                            localVarAxiosArgs = _d.sent();
                            index = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
                            operationBasePath = (_c = (_b = base_1.operationServerMap['EarnBetaApi.getEarnPositions']) === null || _b === void 0 ? void 0 : _b[index]) === null || _c === void 0 ? void 0 : _c.url;
                            return [2 /*return*/, function (axios, basePath) { return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, operationBasePath || basePath); }];
                    }
                });
            });
        },
        /**
         * Get list of earn providers.  **Note:** This endpoint is currently in beta and might be subject to changes.
         * @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: function (pageCursor, pageSize, sortBy, order, options) {
            var _a, _b, _c;
            return __awaiter(this, void 0, void 0, function () {
                var localVarAxiosArgs, index, operationBasePath;
                return __generator(this, function (_d) {
                    switch (_d.label) {
                        case 0: return [4 /*yield*/, localVarAxiosParamCreator.getEarnProviders(pageCursor, pageSize, sortBy, order, options)];
                        case 1:
                            localVarAxiosArgs = _d.sent();
                            index = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
                            operationBasePath = (_c = (_b = base_1.operationServerMap['EarnBetaApi.getEarnProviders']) === null || _b === void 0 ? void 0 : _b[index]) === null || _c === void 0 ? void 0 : _c.url;
                            return [2 /*return*/, function (axios, basePath) { return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, operationBasePath || basePath); }];
                    }
                });
            });
        },
    };
};
exports.EarnBetaApiFp = EarnBetaApiFp;
/**
 * EarnBetaApi - factory interface
 * @export
 */
var EarnBetaApiFactory = function (configuration, basePath, axios) {
    var localVarFp = (0, exports.EarnBetaApiFp)(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`.  **Note:** This endpoint is currently in beta and might be subject to changes.
         * @summary Approve earn provider terms of service
         * @param {EarnBetaApiApproveTermsOfServiceRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        approveTermsOfService: function (requestParameters, options) {
            if (requestParameters === void 0) { requestParameters = {}; }
            return localVarFp.approveTermsOfService(requestParameters.idempotencyKey, options).then(function (request) { return 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`).  **Note:** This endpoint is currently in beta and might be subject to changes.
         * @summary Create and execute a lending action (deposit or withdraw)
         * @param {EarnBetaApiCreateEarnActionRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createEarnAction: function (requestParameters, options) {
            return localVarFp.createEarnAction(requestParameters.createEarnActionRequest, requestParameters.idempotencyKey, options).then(function (request) { return request(axios, basePath); });
        },
        /**
         * Returns one lending action by its action sequence id (tenant-scoped).  **Note:** This endpoint is currently in beta and might be subject to changes.
         * @summary Get a single earn lending action
         * @param {EarnBetaApiGetEarnActionRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getEarnAction: function (requestParameters, options) {
            return localVarFp.getEarnAction(requestParameters.id, options).then(function (request) { return request(axios, basePath); });
        },
        /**
         * Returns a paginated list of lending actions (deposits and withdrawals) for the authenticated tenant.  **Note:** This endpoint is currently in beta and might be subject to changes.
         * @summary List earn lending actions
         * @param {EarnBetaApiGetEarnActionsRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getEarnActions: function (requestParameters, options) {
            if (requestParameters === void 0) { requestParameters = {}; }
            return localVarFp.getEarnActions(requestParameters.pageCursor, requestParameters.pageSize, requestParameters.sortBy, requestParameters.order, options).then(function (request) { return request(axios, basePath); });
        },
        /**
         * Get list of earn opportunities (vaults).  **Note:** This endpoint is currently in beta and might be subject to changes.
         * @summary Get list of earn opportunities
         * @param {EarnBetaApiGetEarnOpportunitiesRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getEarnOpportunities: function (requestParameters, options) {
            if (requestParameters === void 0) { requestParameters = {}; }
            return localVarFp.getEarnOpportunities(requestParameters.pageCursor, requestParameters.pageSize, requestParameters.sortBy, requestParameters.order, options).then(function (request) { return request(axios, basePath); });
        },
        /**
         * Get list of earn positions for accounts tracked for this workspace.  Optional query parameters filter by chain, provider, and pagination.  **Note:** This endpoint is currently in beta and might be subject to changes.
         * @summary Get list of earn positions
         * @param {EarnBetaApiGetEarnPositionsRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getEarnPositions: function (requestParameters, options) {
            if (requestParameters === void 0) { requestParameters = {}; }
            return localVarFp.getEarnPositions(requestParameters.chainId, requestParameters.providerId, requestParameters.pageCursor, requestParameters.pageSize, requestParameters.sortBy, requestParameters.order, options).then(function (request) { return request(axios, basePath); });
        },
        /**
         * Get list of earn providers.  **Note:** This endpoint is currently in beta and might be subject to changes.
         * @summary Get list of earn providers
         * @param {EarnBetaApiGetEarnProvidersRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getEarnProviders: function (requestParameters, options) {
            if (requestParameters === void 0) { requestParameters = {}; }
            return localVarFp.getEarnProviders(requestParameters.pageCursor, requestParameters.pageSize, requestParameters.sortBy, requestParameters.order, options).then(function (request) { return request(axios, basePath); });
        },
    };
};
exports.EarnBetaApiFactory = EarnBetaApiFactory;
/**
 * EarnBetaApi - object-oriented interface
 * @export
 * @class EarnBetaApi
 * @extends {BaseAPI}
 */
var EarnBetaApi = /** @class */ (function (_super) {
    __extends(EarnBetaApi, _super);
    function EarnBetaApi() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     * 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`.  **Note:** This endpoint is currently in beta and might be subject to changes.
     * @summary Approve earn provider terms of service
     * @param {EarnBetaApiApproveTermsOfServiceRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof EarnBetaApi
     */
    EarnBetaApi.prototype.approveTermsOfService = function (requestParameters) {
        var _this = this;
        if (requestParameters === void 0) { requestParameters = {}; }
        return (0, exports.EarnBetaApiFp)(this.configuration).approveTermsOfService(requestParameters.idempotencyKey).then(function (request) { return request(_this.axios, _this.basePath); }).then(fireblocksResponse_1.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`).  **Note:** This endpoint is currently in beta and might be subject to changes.
     * @summary Create and execute a lending action (deposit or withdraw)
     * @param {EarnBetaApiCreateEarnActionRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof EarnBetaApi
     */
    EarnBetaApi.prototype.createEarnAction = function (requestParameters) {
        var _this = this;
        return (0, exports.EarnBetaApiFp)(this.configuration).createEarnAction(requestParameters.createEarnActionRequest, requestParameters.idempotencyKey).then(function (request) { return request(_this.axios, _this.basePath); }).then(fireblocksResponse_1.convertToFireblocksResponse);
    };
    /**
     * Returns one lending action by its action sequence id (tenant-scoped).  **Note:** This endpoint is currently in beta and might be subject to changes.
     * @summary Get a single earn lending action
     * @param {EarnBetaApiGetEarnActionRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof EarnBetaApi
     */
    EarnBetaApi.prototype.getEarnAction = function (requestParameters) {
        var _this = this;
        return (0, exports.EarnBetaApiFp)(this.configuration).getEarnAction(requestParameters.id).then(function (request) { return request(_this.axios, _this.basePath); }).then(fireblocksResponse_1.convertToFireblocksResponse);
    };
    /**
     * Returns a paginated list of lending actions (deposits and withdrawals) for the authenticated tenant.  **Note:** This endpoint is currently in beta and might be subject to changes.
     * @summary List earn lending actions
     * @param {EarnBetaApiGetEarnActionsRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof EarnBetaApi
     */
    EarnBetaApi.prototype.getEarnActions = function (requestParameters) {
        var _this = this;
        if (requestParameters === void 0) { requestParameters = {}; }
        return (0, exports.EarnBetaApiFp)(this.configuration).getEarnActions(requestParameters.pageCursor, requestParameters.pageSize, requestParameters.sortBy, requestParameters.order).then(function (request) { return request(_this.axios, _this.basePath); }).then(fireblocksResponse_1.convertToFireblocksResponse);
    };
    /**
     * Get list of earn opportunities (vaults).  **Note:** This endpoint is currently in beta and might be subject to changes.
     * @summary Get list of earn opportunities
     * @param {EarnBetaApiGetEarnOpportunitiesRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof EarnBetaApi
     */
    EarnBetaApi.prototype.getEarnOpportunities = function (requestParameters) {
        var _this = this;
        if (requestParameters === void 0) { requestParameters = {}; }
        return (0, exports.EarnBetaApiFp)(this.configuration).getEarnOpportunities(requestParameters.pageCursor, requestParameters.pageSize, requestParameters.sortBy, requestParameters.order).then(function (request) { return request(_this.axios, _this.basePath); }).then(fireblocksResponse_1.convertToFireblocksResponse);
    };
    /**
     * Get list of earn positions for accounts tracked for this workspace.  Optional query parameters filter by chain, provider, and pagination.  **Note:** This endpoint is currently in beta and might be subject to changes.
     * @summary Get list of earn positions
     * @param {EarnBetaApiGetEarnPositionsRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof EarnBetaApi
     */
    EarnBetaApi.prototype.getEarnPositions = function (requestParameters) {
        var _this = this;
        if (requestParameters === void 0) { requestParameters = {}; }
        return (0, exports.EarnBetaApiFp)(this.configuration).getEarnPositions(requestParameters.chainId, requestParameters.providerId, requestParameters.pageCursor, requestParameters.pageSize, requestParameters.sortBy, requestParameters.order).then(function (request) { return request(_this.axios, _this.basePath); }).then(fireblocksResponse_1.convertToFireblocksResponse);
    };
    /**
     * Get list of earn providers.  **Note:** This endpoint is currently in beta and might be subject to changes.
     * @summary Get list of earn providers
     * @param {EarnBetaApiGetEarnProvidersRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof EarnBetaApi
     */
    EarnBetaApi.prototype.getEarnProviders = function (requestParameters) {
        var _this = this;
        if (requestParameters === void 0) { requestParameters = {}; }
        return (0, exports.EarnBetaApiFp)(this.configuration).getEarnProviders(requestParameters.pageCursor, requestParameters.pageSize, requestParameters.sortBy, requestParameters.order).then(function (request) { return request(_this.axios, _this.basePath); }).then(fireblocksResponse_1.convertToFireblocksResponse);
    };
    return EarnBetaApi;
}(base_1.BaseAPI));
exports.EarnBetaApi = EarnBetaApi;
/**
 * @export
 */
exports.GetEarnActionsSortByEnum = {
    CreatedAt: 'createdAt',
    UpdatedAt: 'updatedAt'
};
/**
 * @export
 */
exports.GetEarnActionsOrderEnum = {
    Asc: 'ASC',
    Desc: 'DESC'
};
/**
 * @export
 */
exports.GetEarnOpportunitiesOrderEnum = {
    Asc: 'ASC',
    Desc: 'DESC'
};
/**
 * @export
 */
exports.GetEarnPositionsProviderIdEnum = {
    Morpho: 'MORPHO',
    Aave: 'AAVE'
};
/**
 * @export
 */
exports.GetEarnPositionsOrderEnum = {
    Asc: 'ASC',
    Desc: 'DESC'
};
/**
 * @export
 */
exports.GetEarnProvidersOrderEnum = {
    Asc: 'ASC',
    Desc: 'DESC'
};
//# sourceMappingURL=earn-beta-api.js.map