diff --git a/electron/install.js b/electron/install.js index fd9e049e0..40682a49b 100644 --- a/electron/install.js +++ b/electron/install.js @@ -6,7 +6,7 @@ const process = require('process'); const axios = require('axios'); const { spawnSync } = require('child_process'); const { logger } = require('./logger'); -const { execSync} = require('child_process'); +const { execSync } = require('child_process'); const { paths } = require('./constants'); const homedir = os.homedir(); /** @@ -14,7 +14,7 @@ const homedir = os.homedir(); * - use "" (nothing as a suffix) for latest release candidate, for example "0.1.0rc26" * - use "alpha" for alpha release, for example "0.1.0rc26-alpha" */ -const OlasMiddlewareVersion = '0.1.0rc143'; +const OlasMiddlewareVersion = '0.1.0rc145'; const path = require('path'); const { app } = require('electron'); @@ -55,18 +55,16 @@ const TendermintUrls = { }, }; - function execSyncExitCode(cmd) { try { execSync(cmd); return 0; - } - catch (error) { - logger.electron(error.status); // Might be 127 in your example. + } catch (error) { + logger.electron(error.status); // Might be 127 in your example. logger.electron(error.message); // Holds the message you typically want. - logger.electron(error.stderr.toString()); // Holds the stderr output. Use `.toString()`. - logger.electron(error.stdout.toString()); // Holds the stdout output. Use `.toString()`. - return error.status; + logger.electron(error.stderr.toString()); // Holds the stderr output. Use `.toString()`. + logger.electron(error.stdout.toString()); // Holds the stdout output. Use `.toString()`. + return error.status; } } @@ -94,7 +92,6 @@ function runCmdUnix(command, options) { logger.electron(`===== stderr ===== \n${output.stderr}`); } - function runSudoUnix(command, options) { let bin = getBinPath(command); if (!bin) { @@ -132,7 +129,7 @@ function isTendermintInstalledUnix() { function isTendermintInstalledWindows() { return true; //always installed cause bundled in - return execSyncExitCode('tendermint --help') === 0; + return execSyncExitCode('tendermint --help') === 0; } async function downloadFile(url, dest) { @@ -171,24 +168,23 @@ async function installTendermintWindows() { logger.electron(`Installing tendermint binary`); try { execSync('tar -xvf tendermint.tar.gz'); - } catch (error){ - logger.electron(error.status); // Might be 127 in your example. + } catch (error) { + logger.electron(error.status); // Might be 127 in your example. logger.electron(error.message); // Holds the message you typically want. - logger.electron(error.stderr.toString()); // Holds the stderr output. Use `.toString()`. - logger.electron(error.stdout.toString()); // Holds the stdout output. Use `.toString()`. + logger.electron(error.stderr.toString()); // Holds the stderr output. Use `.toString()`. + logger.electron(error.stdout.toString()); // Holds the stdout output. Use `.toString()`. } - const bin_dir = homedir + "//AppData//Local//Microsoft//WindowsApps//" + const bin_dir = homedir + '//AppData//Local//Microsoft//WindowsApps//'; if (!Env.CI) { if (!fs.existsSync(bin_dir)) { - fs.mkdirSync(bin_dir, {recursive: true}); + fs.mkdirSync(bin_dir, { recursive: true }); } - fs.copyFileSync("tendermint.exe", bin_dir + "tendermint.exe"); + fs.copyFileSync('tendermint.exe', bin_dir + 'tendermint.exe'); } process.chdir(cwd); } - async function installTendermintUnix() { logger.electron(`Installing tendermint for ${os.platform()}-${process.arch}`); const cwd = process.cwd(); @@ -259,14 +255,14 @@ async function setupUbuntu(ipcChannel) { } } - - async function setupWindows(ipcChannel) { logger.electron('Creating required directories'); await createDirectory(`${paths.dotOperateDirectory}`); await createDirectory(`${paths.tempDir}`); - logger.electron('Checking tendermint installation: ' + isTendermintInstalledWindows()); + logger.electron( + 'Checking tendermint installation: ' + isTendermintInstalledWindows(), + ); if (!isTendermintInstalledWindows()) { ipcChannel.send('response', 'Installing tendermint'); logger.electron('Installing tendermint'); diff --git a/frontend/components/YourWalletPage/Titles.tsx b/frontend/components/YourWalletPage/Titles.tsx index 20dcbbd4f..4b2c7645f 100644 --- a/frontend/components/YourWalletPage/Titles.tsx +++ b/frontend/components/YourWalletPage/Titles.tsx @@ -1,10 +1,18 @@ import { Flex, Typography } from 'antd'; import { InfoTooltip } from '@/components/InfoTooltip'; +import { Address } from '@/types/Address'; + +import { AddressLink } from '../AddressLink'; const { Paragraph, Text, Title } = Typography; -export const SignerTitle = () => ( +type SignerTitleProps = { signerText: string; signerAddress?: Address }; + +export const SignerTitle = ({ + signerText, + signerAddress, +}: SignerTitleProps) => ( <> Signer  @@ -17,7 +25,10 @@ export const SignerTitle = () => ( This setup enables features like the backup wallet. - Note: Signer’s XDAI balance is included in wallet XDAI balances. + + {signerText} + + diff --git a/frontend/components/YourWalletPage/YourAgent.tsx b/frontend/components/YourWalletPage/YourAgent.tsx index aaa751b1c..2b81a5972 100644 --- a/frontend/components/YourWalletPage/YourAgent.tsx +++ b/frontend/components/YourWalletPage/YourAgent.tsx @@ -1,4 +1,4 @@ -import { Card, Flex, Typography } from 'antd'; +import { Card, Flex, Skeleton, Typography } from 'antd'; import Image from 'next/image'; import { useMemo } from 'react'; import styled from 'styled-components'; @@ -78,30 +78,39 @@ const ServiceAndNftDetails = () => { }; export const YourAgentWallet = () => { - const { agentSafeBalance, agentEoaBalance } = useBalance(); - const { accruedServiceStakingRewards } = useReward(); + const { isBalanceLoaded, agentSafeBalance, agentEoaBalance } = useBalance(); + const { + availableRewardsForEpochEth, + isEligibleForRewards, + accruedServiceStakingRewards, + } = useReward(); const { instanceAddress: agentEoaAddress, multisigAddress: agentSafeAddress, } = useAddress(); + const reward = useMemo(() => { + if (!isBalanceLoaded) return ; + if (!isEligibleForRewards) return 'Not yet earned'; + return `~${balanceFormat(availableRewardsForEpochEth, 2)} OLAS`; + }, [isBalanceLoaded, isEligibleForRewards, availableRewardsForEpochEth]); + const olasBalances = useMemo(() => { return [ { title: 'Claimed rewards', - value: balanceFormat(agentSafeBalance?.OLAS ?? 0, 2), + value: `${balanceFormat(agentSafeBalance?.OLAS, 2)} OLAS`, }, { title: 'Unclaimed rewards', - value: balanceFormat(accruedServiceStakingRewards ?? 0, 2), + value: `${balanceFormat(accruedServiceStakingRewards, 2)} OLAS`, + }, + { + title: 'Current epoch rewards', + value: reward, }, ]; - }, [agentSafeBalance?.OLAS, accruedServiceStakingRewards]); - - const agentXdaiBalance = useMemo( - () => (agentSafeBalance?.ETH ?? 0) + (agentEoaBalance?.ETH ?? 0), - [agentSafeBalance?.ETH, agentEoaBalance?.ETH], - ); + }, [agentSafeBalance?.OLAS, accruedServiceStakingRewards, reward]); return ( @@ -128,7 +137,7 @@ export const YourAgentWallet = () => { list={olasBalances.map((item) => ({ left: item.title, leftClassName: 'text-light text-sm', - right: `${item.value} OLAS`, + right: item.value, }))} parentStyle={infoBreakdownParentStyle} /> @@ -140,7 +149,7 @@ export const YourAgentWallet = () => { { left: , leftClassName: 'text-light text-sm', - right: `${balanceFormat(agentXdaiBalance, 2)} XDAI`, + right: `${balanceFormat(agentSafeBalance?.ETH, 2)} XDAI`, }, ]} parentStyle={infoBreakdownParentStyle} @@ -151,10 +160,14 @@ export const YourAgentWallet = () => { , + left: ( + + ), leftClassName: 'text-light text-sm', - right: , - rightClassName: 'font-normal', + right: `${balanceFormat(agentEoaBalance?.ETH, 2)} XDAI`, }, ]} parentStyle={infoBreakdownParentStyle} diff --git a/frontend/components/YourWalletPage/YourWallet.tsx b/frontend/components/YourWalletPage/YourWallet.tsx index 844e662f9..d00583b86 100644 --- a/frontend/components/YourWalletPage/YourWallet.tsx +++ b/frontend/components/YourWalletPage/YourWallet.tsx @@ -84,11 +84,7 @@ const OlasBalance = () => { }; const XdaiBalance = () => { - const { safeBalance, eoaBalance } = useBalance(); - const totalXdaiBalance = useMemo( - () => (safeBalance?.ETH ?? 0) + (eoaBalance?.ETH ?? 0), - [safeBalance?.ETH, eoaBalance?.ETH], - ); + const { safeBalance } = useBalance(); return ( @@ -97,7 +93,7 @@ const XdaiBalance = () => { { left: XDAI, leftClassName: 'text-light', - right: `${balanceFormat(totalXdaiBalance, 2)} XDAI`, + right: `${balanceFormat(safeBalance?.ETH, 2)} XDAI`, }, ]} parentStyle={infoBreakdownParentStyle} @@ -108,16 +104,21 @@ const XdaiBalance = () => { const Signer = () => { const { masterEoaAddress } = useWallet(); + const { eoaBalance } = useBalance(); return ( , + left: ( + + ), leftClassName: 'text-light', - right: , - rightClassName: 'font-normal', + right: `${balanceFormat(eoaBalance?.ETH, 2)} XDAI`, }, ]} parentStyle={infoBreakdownParentStyle} diff --git a/frontend/styles/globals.scss b/frontend/styles/globals.scss index bcd41dd3b..5a79088c4 100644 --- a/frontend/styles/globals.scss +++ b/frontend/styles/globals.scss @@ -201,6 +201,11 @@ button, input, select, textarea, .ant-input-suffix { color: #4D596A !important; } +// font color +.text-light { + color: #4D596A !important; +} + .pointer { cursor: pointer; } diff --git a/package.json b/package.json index b4a0e6390..a9dac0a04 100644 --- a/package.json +++ b/package.json @@ -59,5 +59,5 @@ "download-binaries": "sh download_binaries.sh", "build:pearl": "sh build_pearl.sh" }, - "version": "0.1.0-rc143" + "version": "0.1.0-rc145" } diff --git a/pyproject.toml b/pyproject.toml index 818dbc1f9..ddcb33b91 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "olas-operate-middleware" -version = "0.1.0-rc143" +version = "0.1.0-rc145" description = "" authors = ["David Vilela ", "Viraj Patel "] readme = "README.md"