diff --git a/electron/install.js b/electron/install.js index 944ceac5..29691a4d 100644 --- a/electron/install.js +++ b/electron/install.js @@ -6,12 +6,12 @@ const fs = require('fs'); const os = require('os'); const sudo = require('sudo-prompt'); const process = require('process'); -const axios = require("axios") +const axios = require('axios'); const Docker = require('dockerode'); const { spawnSync } = require('child_process'); -const Version = '0.1.0rc34'; +const Version = '0.1.0rc35'; const OperateDirectory = `${os.homedir()}/.operate`; const VenvDir = `${OperateDirectory}/venv`; const TempDir = `${OperateDirectory}/temp`; @@ -22,6 +22,7 @@ const OperateCmd = `${os.homedir()}/.operate/venv/bin/operate`; const Env = { ...process.env, PATH: `${process.env.PATH}:/opt/homebrew/bin:/usr/local/bin`, + HOMEBREW_NO_AUTO_UPDATE: '1', }; const SudoOptions = { name: 'Pearl', @@ -29,18 +30,21 @@ const SudoOptions = { }; const TendermintUrls = { darwin: { - x64: "https://github.com/tendermint/tendermint/releases/download/v0.34.19/tendermint_0.34.19_darwin_amd64.tar.gz", - arm64: "https://github.com/tendermint/tendermint/releases/download/v0.34.19/tendermint_0.34.19_darwin_arm64.tar.gz", + x64: 'https://github.com/tendermint/tendermint/releases/download/v0.34.19/tendermint_0.34.19_darwin_amd64.tar.gz', + arm64: + 'https://github.com/tendermint/tendermint/releases/download/v0.34.19/tendermint_0.34.19_darwin_arm64.tar.gz', }, linux: { - x64: "https://github.com/tendermint/tendermint/releases/download/v0.34.19/tendermint_0.34.19_linux_amd64.tar.gz", - arm64: "https://github.com/tendermint/tendermint/releases/download/v0.34.19/tendermint_0.34.19_linux_arm64.tar.gz", + x64: 'https://github.com/tendermint/tendermint/releases/download/v0.34.19/tendermint_0.34.19_linux_amd64.tar.gz', + arm64: + 'https://github.com/tendermint/tendermint/releases/download/v0.34.19/tendermint_0.34.19_linux_arm64.tar.gz', }, win32: { - x64: "https://github.com/tendermint/tendermint/releases/download/v0.34.19/tendermint_0.34.19_windows_amd64.tar.gz", - arm64: "https://github.com/tendermint/tendermint/releases/download/v0.34.19/tendermint_0.34.19_windows_arm64.tar.gz" - } -} + x64: 'https://github.com/tendermint/tendermint/releases/download/v0.34.19/tendermint_0.34.19_windows_amd64.tar.gz', + arm64: + 'https://github.com/tendermint/tendermint/releases/download/v0.34.19/tendermint_0.34.19_windows_arm64.tar.gz', + }, +}; function getBinPath(command) { return spawnSync('/usr/bin/which', [command], { env: Env }) @@ -63,10 +67,8 @@ function appendLog(log) { } function runCmdUnix(command, options) { - fs.appendFileSync( - OperateInstallationLog, - `Runninng ${command} with options ${JSON.stringify(options)}`, - { encoding: 'utf-8' }, + console.log( + appendLog(`Runninng ${command} with options ${JSON.stringify(options)}`), ); let bin = getBinPath(command); if (!bin) { @@ -133,7 +135,7 @@ async function downloadFile(url, dest) { const response = await axios({ url, method: 'GET', - responseType: 'stream' + responseType: 'stream', }); response.data.pipe(writer); return new Promise((resolve, reject) => { @@ -141,28 +143,29 @@ async function downloadFile(url, dest) { writer.on('error', reject); }); } catch (err) { - fs.unlink(dest, () => { }); // Delete the file if there is an error + fs.unlink(dest, () => {}); // Delete the file if there is an error console.error('Error downloading the file:', err.message); } } async function installTendermintUnix() { - const cwd = process.cwd() - process.chdir(TempDir) + const cwd = process.cwd(); + process.chdir(TempDir); - console.log(appendLog(`Installing tendermint for ${os.platform()}-${process.arch}`)) - const url = TendermintUrls[os.platform()][process.arch] + console.log( + appendLog(`Installing tendermint for ${os.platform()}-${process.arch}`), + ); + const url = TendermintUrls[os.platform()][process.arch]; - console.log(appendLog(`Downloading ${url}, might take a while...`)) - await downloadFile(url, `${TempDir}/tendermint.tar.gz`) + console.log(appendLog(`Downloading ${url}, might take a while...`)); + await downloadFile(url, `${TempDir}/tendermint.tar.gz`); - console.log(appendLog(`Installing tendermint binary`)) - await runCmdUnix("tar", ["-xvf", "tendermint.tar.gz"]) - await runSudoUnix("install", "tendermint /usr/local/bin") - process.chdir(cwd) + console.log(appendLog(`Installing tendermint binary`)); + await runCmdUnix('tar', ['-xvf', 'tendermint.tar.gz']); + await runSudoUnix('install', 'tendermint /usr/local/bin'); + process.chdir(cwd); } - function isDockerInstalledDarwin() { return Boolean(getBinPath('docker')); } @@ -310,7 +313,7 @@ async function setupDarwin(ipcChannel) { if (!isTendermintInstalledUnix()) { ipcChannel.send('response', 'Installing Pearl Daemon'); console.log(appendLog('Installing tendermint')); - await installTendermintUnix() + await installTendermintUnix(); } if (!fs.existsSync(VenvDir)) { @@ -364,7 +367,7 @@ async function setupUbuntu(ipcChannel) { if (!isTendermintInstalledUnix()) { ipcChannel.send('response', 'Installing Pearl Daemon'); console.log(appendLog('Installing tendermint')); - await installTendermintUnix() + await installTendermintUnix(); } if (!fs.existsSync(VenvDir)) { diff --git a/operate/services/manage.py b/operate/services/manage.py index 803ee852..cfbda1d9 100644 --- a/operate/services/manage.py +++ b/operate/services/manage.py @@ -758,13 +758,8 @@ def unstake_service_on_chain_from_safe(self, hash: str) -> None: service_id=service.chain_data.token, staking_contract=STAKING[service.ledger_config.chain], ) - ).add( - sftxb.get_staking_data( - service_id=service.chain_data.token, - staking_contract=STAKING[service.ledger_config.chain], - ) ).settle() - service.chain_data.staked = True + service.chain_data.staked = False service.store() def fund_service( # pylint: disable=too-many-arguments diff --git a/package.json b/package.json index d866e908..e3478c17 100644 --- a/package.json +++ b/package.json @@ -55,5 +55,5 @@ "start": "electron .", "build": "rm -rf dist/ && electron-builder build" }, - "version": "0.1.0-rc34" + "version": "0.1.0-rc35" } diff --git a/pyproject.toml b/pyproject.toml index fe6eee3e..ff4e5a05 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "olas-operate-middleware" -version = "0.1.0-rc34" +version = "0.1.0-rc35" description = "" authors = ["David Vilela ", "Viraj Patel "] readme = "README.md"