/** * Copyright (c) 2024-2025 Тарабанов Александр Викторович * All rights reserved. * * This software is proprietary and confidential. * Unauthorized copying, modification, or distribution is prohibited. * * For licensing inquiries: info@hb3-accelerator.com * Website: https://hb3-accelerator.com * GitHub: https://github.com/HB3-ACCELERATOR */ // Сервис для работы с операциями модулей DLE import api from '@/api/axios'; /** * Получает доступные операции для модулей DLE * @param {string} dleAddress - Адрес DLE * @returns {Promise} - Доступные операции */ export const getModuleOperations = async (dleAddress) => { try { const response = await api.post('/dle-modules/get-module-operations', { dleAddress }); return response.data; } catch (error) { console.error('Ошибка при получении операций модулей:', error); throw error; } }; /** * Получает операции для конкретного модуля * @param {string} dleAddress - Адрес DLE * @param {string} moduleType - Тип модуля * @param {string} moduleAddress - Адрес модуля * @param {number} chainId - ID сети * @returns {Promise} - Операции модуля */ export const getModuleSpecificOperations = async (dleAddress, moduleType, moduleAddress, chainId) => { try { const response = await api.post('/dle-modules/get-module-specific-operations', { dleAddress, moduleType, moduleAddress, chainId }); return response.data; } catch (error) { console.error('Ошибка при получении операций конкретного модуля:', error); throw error; } }; /** * Создает предложение для выполнения операции модуля * @param {string} dleAddress - Адрес DLE * @param {Object} operationData - Данные операции * @returns {Promise} - Результат создания предложения */ export const createModuleOperationProposal = async (dleAddress, operationData) => { try { const response = await api.post('/dle-modules/create-module-operation-proposal', { dleAddress, ...operationData }); return response.data; } catch (error) { console.error('Ошибка при создании предложения для операции модуля:', error); throw error; } }; /** * Получает ABI и интерфейс модуля * @param {string} moduleType - Тип модуля * @param {string} moduleAddress - Адрес модуля * @param {number} chainId - ID сети * @returns {Promise} - ABI и интерфейс модуля */ export const getModuleInterface = async (moduleType, moduleAddress, chainId) => { try { const response = await api.post('/dle-modules/get-module-interface', { moduleType, moduleAddress, chainId }); return response.data; } catch (error) { console.error('Ошибка при получении интерфейса модуля:', error); throw error; } }; /** * Получает доступные функции модуля для создания предложений * @param {string} dleAddress - Адрес DLE * @param {string} moduleType - Тип модуля * @param {string} moduleAddress - Адрес модуля * @param {number} chainId - ID сети * @returns {Promise} - Доступные функции */ export const getModuleAvailableFunctions = async (dleAddress, moduleType, moduleAddress, chainId) => { try { const response = await api.post('/dle-modules/get-module-available-functions', { dleAddress, moduleType, moduleAddress, chainId }); return response.data; } catch (error) { console.error('Ошибка при получении доступных функций модуля:', error); throw error; } }; /** * Получает параметры функции модуля * @param {string} moduleType - Тип модуля * @param {string} functionName - Имя функции * @returns {Promise} - Параметры функции */ export const getModuleFunctionParameters = async (moduleType, functionName) => { try { const response = await api.post('/dle-modules/get-module-function-parameters', { moduleType, functionName }); return response.data; } catch (error) { console.error('Ошибка при получении параметров функции модуля:', error); throw error; } }; /** * Валидирует параметры операции модуля * @param {string} dleAddress - Адрес DLE * @param {Object} operationData - Данные операции * @returns {Promise} - Результат валидации */ export const validateModuleOperation = async (dleAddress, operationData) => { try { const response = await api.post('/dle-modules/validate-module-operation', { dleAddress, ...operationData }); return response.data; } catch (error) { console.error('Ошибка при валидации операции модуля:', error); throw error; } }; /** * Получает историю операций модуля * @param {string} dleAddress - Адрес DLE * @param {string} moduleType - Тип модуля * @param {Object} filters - Фильтры * @returns {Promise} - История операций */ export const getModuleOperationsHistory = async (dleAddress, moduleType, filters = {}) => { try { const response = await api.post('/dle-modules/get-module-operations-history', { dleAddress, moduleType, ...filters }); return response.data; } catch (error) { console.error('Ошибка при получении истории операций модуля:', error); throw error; } }; /** * Получает статус выполнения операции модуля * @param {string} dleAddress - Адрес DLE * @param {string} operationId - ID операции * @returns {Promise} - Статус операции */ export const getModuleOperationStatus = async (dleAddress, operationId) => { try { const response = await api.post('/dle-modules/get-module-operation-status', { dleAddress, operationId }); return response.data; } catch (error) { console.error('Ошибка при получении статуса операции модуля:', error); throw error; } };