"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.GetContractTemplatesInitializationPhaseEnum = exports.GetContractTemplatesTypeEnum = exports.ContractTemplatesApi = exports.ContractTemplatesApiFactory = exports.ContractTemplatesApiFp = exports.ContractTemplatesApiAxiosParamCreator = 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");
/**
 * ContractTemplatesApi - axios parameter creator
 * @export
 */
var ContractTemplatesApiAxiosParamCreator = function (configuration) {
    var _this = this;
    return {
        /**
         * Delete a contract by id. allowed only for private contract templates. Notice: it is irreversible!
         * @summary Delete a contract template by id
         * @param {string} contractTemplateId The Contract Template identifier
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteContractTemplateById: function (contractTemplateId, 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)('deleteContractTemplateById', 'contractTemplateId', contractTemplateId);
                    localVarPath = "/tokenization/templates/{contractTemplateId}"
                        .replace("{".concat("contractTemplateId", "}"), encodeURIComponent(String(contractTemplateId)));
                    localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
                    if (configuration) {
                        baseOptions = configuration.baseOptions;
                    }
                    localVarRequestOptions = __assign(__assign({ method: 'DELETE' }, 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,
                        }];
                });
            });
        },
        /**
         * Deploy a new contract by contract template id. If you wish to deploy a token (ERC20, ERC721 etc), and create asset please use POST /tokenization
         * @summary Deploy contract
         * @param {ContractDeployRequest} contractDeployRequest
         * @param {string} contractTemplateId The Contract Template identifier
         * @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}
         */
        deployContract: function (contractDeployRequest, contractTemplateId, 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)('deployContract', 'contractDeployRequest', contractDeployRequest);
                    (0, validation_utils_1.assertParamExistsAndNotEmpty)('deployContract', 'contractTemplateId', contractTemplateId);
                    localVarPath = "/tokenization/templates/{contractTemplateId}/deploy"
                        .replace("{".concat("contractTemplateId", "}"), encodeURIComponent(String(contractTemplateId)));
                    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)(contractDeployRequest, localVarRequestOptions, configuration);
                    return [2 /*return*/, {
                            url: (0, common_1.toPathString)(localVarUrlObj),
                            options: localVarRequestOptions,
                        }];
                });
            });
        },
        /**
         * Return contract template\'s constructor ABI
         * @summary Return contract template\'s constructor
         * @param {string} contractTemplateId The Contract Template identifier
         * @param {boolean} [withDocs] true if you want to get the abi with its docs
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getConstructorByContractTemplateId: function (contractTemplateId, withDocs, 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)('getConstructorByContractTemplateId', 'contractTemplateId', contractTemplateId);
                    localVarPath = "/tokenization/templates/{contractTemplateId}/constructor"
                        .replace("{".concat("contractTemplateId", "}"), encodeURIComponent(String(contractTemplateId)));
                    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 (withDocs !== undefined) {
                        localVarQueryParameter['withDocs'] = withDocs;
                    }
                    (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,
                        }];
                });
            });
        },
        /**
         * Return detailed information about the contract template
         * @summary Return contract template by id
         * @param {string} contractTemplateId The Contract Template identifier
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getContractTemplateById: function (contractTemplateId, 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)('getContractTemplateById', 'contractTemplateId', contractTemplateId);
                    localVarPath = "/tokenization/templates/{contractTemplateId}"
                        .replace("{".concat("contractTemplateId", "}"), encodeURIComponent(String(contractTemplateId)));
                    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,
                        }];
                });
            });
        },
        /**
         * Return minimal representation of all the contract templates available for the workspace. Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor, Viewer.
         * @summary List all contract templates
         * @param {number} [limit] Items per page (max 100)
         * @param {number} [offset] Paging offset
         * @param {string} [pageCursor] Page cursor to get the next page
         * @param {number} [pageSize] Number of items per page, requesting more then max will return max items
         * @param {GetContractTemplatesTypeEnum} [type] The type of the contract templates you wish to retrieve. Can accept one type, more or none
         * @param {GetContractTemplatesInitializationPhaseEnum} [initializationPhase] For standalone contracts use ON_DEPLOYMENT and for contracts that are behind proxies use POST_DEPLOYMENT
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getContractTemplates: function (limit, offset, pageCursor, pageSize, type, initializationPhase, 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 = "/tokenization/templates";
                    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 (limit !== undefined) {
                        localVarQueryParameter['limit'] = limit;
                    }
                    if (offset !== undefined) {
                        localVarQueryParameter['offset'] = offset;
                    }
                    if (pageCursor !== undefined) {
                        localVarQueryParameter['pageCursor'] = pageCursor;
                    }
                    if (pageSize !== undefined) {
                        localVarQueryParameter['pageSize'] = pageSize;
                    }
                    if (type !== undefined) {
                        localVarQueryParameter['type'] = type;
                    }
                    if (initializationPhase !== undefined) {
                        localVarQueryParameter['initializationPhase'] = initializationPhase;
                    }
                    (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,
                        }];
                });
            });
        },
        /**
         * Return contract template`s function ABI by signature
         * @summary Return contract template\'s function
         * @param {string} contractTemplateId The Contract Template identifier
         * @param {string} functionSignature
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getFunctionAbiByContractTemplateId: function (contractTemplateId, functionSignature, 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)('getFunctionAbiByContractTemplateId', 'contractTemplateId', contractTemplateId);
                    (0, validation_utils_1.assertParamExistsAndNotEmpty)('getFunctionAbiByContractTemplateId', 'functionSignature', functionSignature);
                    localVarPath = "/tokenization/templates/{contractTemplateId}/function"
                        .replace("{".concat("contractTemplateId", "}"), encodeURIComponent(String(contractTemplateId)));
                    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 (functionSignature !== undefined) {
                        localVarQueryParameter['functionSignature'] = functionSignature;
                    }
                    (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 supported blockchains for the template
         * @summary Get supported blockchains for the template
         * @param {string} contractTemplateId The Contract Template identifier
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getSupportedBlockchainsByTemplateId: function (contractTemplateId, 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)('getSupportedBlockchainsByTemplateId', 'contractTemplateId', contractTemplateId);
                    localVarPath = "/tokenization/templates/{contractTemplateId}/supported_blockchains"
                        .replace("{".concat("contractTemplateId", "}"), encodeURIComponent(String(contractTemplateId)));
                    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,
                        }];
                });
            });
        },
        /**
         * Upload a new contract template. This contract template will be available for the workspace
         * @summary Upload contract template
         * @param {ContractUploadRequest} contractUploadRequest
         * @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}
         */
        uploadContractTemplate: function (contractUploadRequest, 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)('uploadContractTemplate', 'contractUploadRequest', contractUploadRequest);
                    localVarPath = "/tokenization/templates";
                    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)(contractUploadRequest, localVarRequestOptions, configuration);
                    return [2 /*return*/, {
                            url: (0, common_1.toPathString)(localVarUrlObj),
                            options: localVarRequestOptions,
                        }];
                });
            });
        },
    };
};
exports.ContractTemplatesApiAxiosParamCreator = ContractTemplatesApiAxiosParamCreator;
/**
 * ContractTemplatesApi - functional programming interface
 * @export
 */
var ContractTemplatesApiFp = function (configuration) {
    var localVarAxiosParamCreator = (0, exports.ContractTemplatesApiAxiosParamCreator)(configuration);
    return {
        /**
         * Delete a contract by id. allowed only for private contract templates. Notice: it is irreversible!
         * @summary Delete a contract template by id
         * @param {string} contractTemplateId The Contract Template identifier
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteContractTemplateById: function (contractTemplateId, 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.deleteContractTemplateById(contractTemplateId, 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['ContractTemplatesApi.deleteContractTemplateById']) === 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); }];
                    }
                });
            });
        },
        /**
         * Deploy a new contract by contract template id. If you wish to deploy a token (ERC20, ERC721 etc), and create asset please use POST /tokenization
         * @summary Deploy contract
         * @param {ContractDeployRequest} contractDeployRequest
         * @param {string} contractTemplateId The Contract Template identifier
         * @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}
         */
        deployContract: function (contractDeployRequest, contractTemplateId, 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.deployContract(contractDeployRequest, contractTemplateId, 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['ContractTemplatesApi.deployContract']) === 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); }];
                    }
                });
            });
        },
        /**
         * Return contract template\'s constructor ABI
         * @summary Return contract template\'s constructor
         * @param {string} contractTemplateId The Contract Template identifier
         * @param {boolean} [withDocs] true if you want to get the abi with its docs
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getConstructorByContractTemplateId: function (contractTemplateId, withDocs, 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.getConstructorByContractTemplateId(contractTemplateId, withDocs, 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['ContractTemplatesApi.getConstructorByContractTemplateId']) === 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); }];
                    }
                });
            });
        },
        /**
         * Return detailed information about the contract template
         * @summary Return contract template by id
         * @param {string} contractTemplateId The Contract Template identifier
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getContractTemplateById: function (contractTemplateId, 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.getContractTemplateById(contractTemplateId, 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['ContractTemplatesApi.getContractTemplateById']) === 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); }];
                    }
                });
            });
        },
        /**
         * Return minimal representation of all the contract templates available for the workspace. Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor, Viewer.
         * @summary List all contract templates
         * @param {number} [limit] Items per page (max 100)
         * @param {number} [offset] Paging offset
         * @param {string} [pageCursor] Page cursor to get the next page
         * @param {number} [pageSize] Number of items per page, requesting more then max will return max items
         * @param {GetContractTemplatesTypeEnum} [type] The type of the contract templates you wish to retrieve. Can accept one type, more or none
         * @param {GetContractTemplatesInitializationPhaseEnum} [initializationPhase] For standalone contracts use ON_DEPLOYMENT and for contracts that are behind proxies use POST_DEPLOYMENT
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getContractTemplates: function (limit, offset, pageCursor, pageSize, type, initializationPhase, 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.getContractTemplates(limit, offset, pageCursor, pageSize, type, initializationPhase, 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['ContractTemplatesApi.getContractTemplates']) === 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); }];
                    }
                });
            });
        },
        /**
         * Return contract template`s function ABI by signature
         * @summary Return contract template\'s function
         * @param {string} contractTemplateId The Contract Template identifier
         * @param {string} functionSignature
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getFunctionAbiByContractTemplateId: function (contractTemplateId, functionSignature, 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.getFunctionAbiByContractTemplateId(contractTemplateId, functionSignature, 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['ContractTemplatesApi.getFunctionAbiByContractTemplateId']) === 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 supported blockchains for the template
         * @summary Get supported blockchains for the template
         * @param {string} contractTemplateId The Contract Template identifier
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getSupportedBlockchainsByTemplateId: function (contractTemplateId, 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.getSupportedBlockchainsByTemplateId(contractTemplateId, 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['ContractTemplatesApi.getSupportedBlockchainsByTemplateId']) === 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); }];
                    }
                });
            });
        },
        /**
         * Upload a new contract template. This contract template will be available for the workspace
         * @summary Upload contract template
         * @param {ContractUploadRequest} contractUploadRequest
         * @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}
         */
        uploadContractTemplate: function (contractUploadRequest, 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.uploadContractTemplate(contractUploadRequest, 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['ContractTemplatesApi.uploadContractTemplate']) === 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.ContractTemplatesApiFp = ContractTemplatesApiFp;
/**
 * ContractTemplatesApi - factory interface
 * @export
 */
var ContractTemplatesApiFactory = function (configuration, basePath, axios) {
    var localVarFp = (0, exports.ContractTemplatesApiFp)(configuration);
    return {
        /**
         * Delete a contract by id. allowed only for private contract templates. Notice: it is irreversible!
         * @summary Delete a contract template by id
         * @param {ContractTemplatesApiDeleteContractTemplateByIdRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteContractTemplateById: function (requestParameters, options) {
            return localVarFp.deleteContractTemplateById(requestParameters.contractTemplateId, options).then(function (request) { return request(axios, basePath); });
        },
        /**
         * Deploy a new contract by contract template id. If you wish to deploy a token (ERC20, ERC721 etc), and create asset please use POST /tokenization
         * @summary Deploy contract
         * @param {ContractTemplatesApiDeployContractRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deployContract: function (requestParameters, options) {
            return localVarFp.deployContract(requestParameters.contractDeployRequest, requestParameters.contractTemplateId, requestParameters.idempotencyKey, options).then(function (request) { return request(axios, basePath); });
        },
        /**
         * Return contract template\'s constructor ABI
         * @summary Return contract template\'s constructor
         * @param {ContractTemplatesApiGetConstructorByContractTemplateIdRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getConstructorByContractTemplateId: function (requestParameters, options) {
            return localVarFp.getConstructorByContractTemplateId(requestParameters.contractTemplateId, requestParameters.withDocs, options).then(function (request) { return request(axios, basePath); });
        },
        /**
         * Return detailed information about the contract template
         * @summary Return contract template by id
         * @param {ContractTemplatesApiGetContractTemplateByIdRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getContractTemplateById: function (requestParameters, options) {
            return localVarFp.getContractTemplateById(requestParameters.contractTemplateId, options).then(function (request) { return request(axios, basePath); });
        },
        /**
         * Return minimal representation of all the contract templates available for the workspace. Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor, Viewer.
         * @summary List all contract templates
         * @param {ContractTemplatesApiGetContractTemplatesRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getContractTemplates: function (requestParameters, options) {
            if (requestParameters === void 0) { requestParameters = {}; }
            return localVarFp.getContractTemplates(requestParameters.limit, requestParameters.offset, requestParameters.pageCursor, requestParameters.pageSize, requestParameters.type, requestParameters.initializationPhase, options).then(function (request) { return request(axios, basePath); });
        },
        /**
         * Return contract template`s function ABI by signature
         * @summary Return contract template\'s function
         * @param {ContractTemplatesApiGetFunctionAbiByContractTemplateIdRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getFunctionAbiByContractTemplateId: function (requestParameters, options) {
            return localVarFp.getFunctionAbiByContractTemplateId(requestParameters.contractTemplateId, requestParameters.functionSignature, options).then(function (request) { return request(axios, basePath); });
        },
        /**
         * Get supported blockchains for the template
         * @summary Get supported blockchains for the template
         * @param {ContractTemplatesApiGetSupportedBlockchainsByTemplateIdRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getSupportedBlockchainsByTemplateId: function (requestParameters, options) {
            return localVarFp.getSupportedBlockchainsByTemplateId(requestParameters.contractTemplateId, options).then(function (request) { return request(axios, basePath); });
        },
        /**
         * Upload a new contract template. This contract template will be available for the workspace
         * @summary Upload contract template
         * @param {ContractTemplatesApiUploadContractTemplateRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        uploadContractTemplate: function (requestParameters, options) {
            return localVarFp.uploadContractTemplate(requestParameters.contractUploadRequest, requestParameters.idempotencyKey, options).then(function (request) { return request(axios, basePath); });
        },
    };
};
exports.ContractTemplatesApiFactory = ContractTemplatesApiFactory;
/**
 * ContractTemplatesApi - object-oriented interface
 * @export
 * @class ContractTemplatesApi
 * @extends {BaseAPI}
 */
var ContractTemplatesApi = /** @class */ (function (_super) {
    __extends(ContractTemplatesApi, _super);
    function ContractTemplatesApi() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     * Delete a contract by id. allowed only for private contract templates. Notice: it is irreversible!
     * @summary Delete a contract template by id
     * @param {ContractTemplatesApiDeleteContractTemplateByIdRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ContractTemplatesApi
     */
    ContractTemplatesApi.prototype.deleteContractTemplateById = function (requestParameters) {
        var _this = this;
        return (0, exports.ContractTemplatesApiFp)(this.configuration).deleteContractTemplateById(requestParameters.contractTemplateId).then(function (request) { return request(_this.axios, _this.basePath); }).then(fireblocksResponse_1.convertToFireblocksResponse);
    };
    /**
     * Deploy a new contract by contract template id. If you wish to deploy a token (ERC20, ERC721 etc), and create asset please use POST /tokenization
     * @summary Deploy contract
     * @param {ContractTemplatesApiDeployContractRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ContractTemplatesApi
     */
    ContractTemplatesApi.prototype.deployContract = function (requestParameters) {
        var _this = this;
        return (0, exports.ContractTemplatesApiFp)(this.configuration).deployContract(requestParameters.contractDeployRequest, requestParameters.contractTemplateId, requestParameters.idempotencyKey).then(function (request) { return request(_this.axios, _this.basePath); }).then(fireblocksResponse_1.convertToFireblocksResponse);
    };
    /**
     * Return contract template\'s constructor ABI
     * @summary Return contract template\'s constructor
     * @param {ContractTemplatesApiGetConstructorByContractTemplateIdRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ContractTemplatesApi
     */
    ContractTemplatesApi.prototype.getConstructorByContractTemplateId = function (requestParameters) {
        var _this = this;
        return (0, exports.ContractTemplatesApiFp)(this.configuration).getConstructorByContractTemplateId(requestParameters.contractTemplateId, requestParameters.withDocs).then(function (request) { return request(_this.axios, _this.basePath); }).then(fireblocksResponse_1.convertToFireblocksResponse);
    };
    /**
     * Return detailed information about the contract template
     * @summary Return contract template by id
     * @param {ContractTemplatesApiGetContractTemplateByIdRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ContractTemplatesApi
     */
    ContractTemplatesApi.prototype.getContractTemplateById = function (requestParameters) {
        var _this = this;
        return (0, exports.ContractTemplatesApiFp)(this.configuration).getContractTemplateById(requestParameters.contractTemplateId).then(function (request) { return request(_this.axios, _this.basePath); }).then(fireblocksResponse_1.convertToFireblocksResponse);
    };
    /**
     * Return minimal representation of all the contract templates available for the workspace. Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor, Viewer.
     * @summary List all contract templates
     * @param {ContractTemplatesApiGetContractTemplatesRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ContractTemplatesApi
     */
    ContractTemplatesApi.prototype.getContractTemplates = function (requestParameters) {
        var _this = this;
        if (requestParameters === void 0) { requestParameters = {}; }
        return (0, exports.ContractTemplatesApiFp)(this.configuration).getContractTemplates(requestParameters.limit, requestParameters.offset, requestParameters.pageCursor, requestParameters.pageSize, requestParameters.type, requestParameters.initializationPhase).then(function (request) { return request(_this.axios, _this.basePath); }).then(fireblocksResponse_1.convertToFireblocksResponse);
    };
    /**
     * Return contract template`s function ABI by signature
     * @summary Return contract template\'s function
     * @param {ContractTemplatesApiGetFunctionAbiByContractTemplateIdRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ContractTemplatesApi
     */
    ContractTemplatesApi.prototype.getFunctionAbiByContractTemplateId = function (requestParameters) {
        var _this = this;
        return (0, exports.ContractTemplatesApiFp)(this.configuration).getFunctionAbiByContractTemplateId(requestParameters.contractTemplateId, requestParameters.functionSignature).then(function (request) { return request(_this.axios, _this.basePath); }).then(fireblocksResponse_1.convertToFireblocksResponse);
    };
    /**
     * Get supported blockchains for the template
     * @summary Get supported blockchains for the template
     * @param {ContractTemplatesApiGetSupportedBlockchainsByTemplateIdRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ContractTemplatesApi
     */
    ContractTemplatesApi.prototype.getSupportedBlockchainsByTemplateId = function (requestParameters) {
        var _this = this;
        return (0, exports.ContractTemplatesApiFp)(this.configuration).getSupportedBlockchainsByTemplateId(requestParameters.contractTemplateId).then(function (request) { return request(_this.axios, _this.basePath); }).then(fireblocksResponse_1.convertToFireblocksResponse);
    };
    /**
     * Upload a new contract template. This contract template will be available for the workspace
     * @summary Upload contract template
     * @param {ContractTemplatesApiUploadContractTemplateRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ContractTemplatesApi
     */
    ContractTemplatesApi.prototype.uploadContractTemplate = function (requestParameters) {
        var _this = this;
        return (0, exports.ContractTemplatesApiFp)(this.configuration).uploadContractTemplate(requestParameters.contractUploadRequest, requestParameters.idempotencyKey).then(function (request) { return request(_this.axios, _this.basePath); }).then(fireblocksResponse_1.convertToFireblocksResponse);
    };
    return ContractTemplatesApi;
}(base_1.BaseAPI));
exports.ContractTemplatesApi = ContractTemplatesApi;
/**
 * @export
 */
exports.GetContractTemplatesTypeEnum = {
    FungibleToken: 'FUNGIBLE_TOKEN',
    NonFungibleToken: 'NON_FUNGIBLE_TOKEN',
    TokenUtility: 'TOKEN_UTILITY'
};
/**
 * @export
 */
exports.GetContractTemplatesInitializationPhaseEnum = {
    OnDeployment: 'ON_DEPLOYMENT',
    PostDeployment: 'POST_DEPLOYMENT'
};
//# sourceMappingURL=contract-templates-api.js.map