Skip to content
This repository has been archived by the owner on Mar 28, 2020. It is now read-only.

Commit

Permalink
v0.7.4 (#158)
Browse files Browse the repository at this point in the history
v0.7.4
  • Loading branch information
andrerfneves authored Jun 18, 2019
2 parents 7f3fda9 + edf3060 commit e1927bc
Show file tree
Hide file tree
Showing 10 changed files with 105 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Question 🤔
about: Usage question or discussion about Gatsby.
about: Usage question or discussion about Zepio.
---

## Summary
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,4 @@ In order to contribute and submit PRs to improve the **Zepio** codebase, please

## License

MIT © Zcash Foundation 2019 [zfnd.org](zfnd.org)
MIT © Zcash Foundation 2019 [zfnd.org](https://zfnd.org)
100 changes: 61 additions & 39 deletions app/views/console.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
// @flow

import React, { PureComponent, Fragment } from 'react';
// eslint-disable-next-line import/no-extraneous-dependencies
import { ipcRenderer } from 'electron';
import styled, { withTheme } from 'styled-components';
import uuid from 'uuid/v4';
import eres from 'eres';
import humanizeDuration from 'humanize-duration';

import { TextComponent } from '../components/text';

import ConsoleSymbolDark from '../assets/images/console_zcash_dark.png';
import ConsoleSymbolLight from '../assets/images/console_zcash_light.png';
import { DARK } from '../constants/themes';
import rpc from '../../services/api';
import store from '../../config/electron-store';

const Wrapper = styled.div`
max-height: 100%;
Expand All @@ -31,57 +33,75 @@ const ConsoleImg = styled.img`
width: auto;
`;

const initialLog = `
Thank you for running a Zcash node!
You're helping to strengthen the network and contributing to a social good :)
In order to ensure you are adequately protecting your privacy when using Zcash, please see <https://z.cash/support/security/>.
`;

const defaultState = `
Thank you for running a Zcash node!
You're helping to strengthen the network and contributing to a social good :)
In order to ensure you are adequately protecting your privacy when using Zcash, please see <https://z.cash/support/security/>.
Block height | 0
Connections | 0
Network solution rate | 0 Sol/s
You are currently not mining.
To enable mining, add 'gen=1' to your zcash.conf and restart.
Since starting this node 0 minutes, 0 seconds ago:
- You have validated 0 transactions!
\n
------------------------------------------
`;

const breakpoints = [1, 4, 7, 10, 13];

type Props = {
theme: AppTheme,
};

type State = {
log: string,
blockHeight: number,
connections: number,
networkSolutionsRate: number,
};

class Component extends PureComponent<Props, State> {
interval: ?IntervalID = null;

requestOnTheFly: boolean = false;

state = {
log: defaultState,
blockHeight: 0,
connections: 0,
networkSolutionsRate: 0,
};

componentDidMount() {
ipcRenderer.on('zcashd-log', (event: empty, message: string) => {
this.setState(() => ({ log: initialLog + message }));
});
this.interval = setInterval(() => this.update(), 3000);
}

componentWillUnmount() {
ipcRenderer.removeAllListeners('zcashd-log');
clearInterval(this.interval);
}

update = async () => {
if (this.requestOnTheFly) return;

this.requestOnTheFly = true;

const [err, result] = await eres(Promise.all([rpc.getinfo(), rpc.getmininginfo()]));

if (err) return;

this.setState(
{
blockHeight: result[0].blocks,
connections: result[0].connections,
networkSolutionsRate: result[1].networksolps,
},
() => {
this.requestOnTheFly = false;
},
);
};

getLog = (state: State) => `
Thank you for running a Zcash node!
You're helping to strengthen the network and contributing to a social good :)
In order to ensure you are adequately protecting your privacy when using Zcash, please see <https://z.cash/support/security/>.
Block height | ${state.blockHeight}
Connections | ${state.connections}
Network solution rate | ${state.networkSolutionsRate} Sol/s
Started ${humanizeDuration(new Date() - new Date(store.get('DAEMON_START_TIME')), {
round: true,
})} ago
\n
------------------------------------------
`;

render() {
const { log } = this.state;
const { theme } = this.props;

const ConsoleSymbol = theme.mode === DARK ? ConsoleSymbolDark : ConsoleSymbolLight;
Expand All @@ -90,12 +110,14 @@ class Component extends PureComponent<Props, State> {
<Wrapper id='console-wrapper'>
<Fragment>
<ConsoleImg src={ConsoleSymbol} alt='Zcashd' />
{log.split('\n').map((item, idx) => (
<Fragment key={uuid()}>
<ConsoleText value={item} />
{breakpoints.includes(idx) ? <br /> : null}
</Fragment>
))}
{this.getLog(this.state)
.split('\n')
.map((item, idx) => (
<Fragment key={uuid()}>
<ConsoleText value={item} />
{breakpoints.includes(idx) ? <br /> : null}
</Fragment>
))}
</Fragment>
</Wrapper>
);
Expand Down
9 changes: 8 additions & 1 deletion app/views/send.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import { formatNumber } from '../utils/format-number';
import { ascii2hex } from '../utils/ascii-to-hexadecimal';
import { isHex } from '../utils/is-hex';
import { getCoinName } from '../utils/get-coin-name';
import { openExternal } from '../utils/open-external';
import { ZCASH_EXPLORER_BASE_URL } from '../constants/explorer';

import SentIcon from '../assets/images/transaction_sent_icon_dark.svg';
import MenuIconDark from '../assets/images/menu_icon_dark.svg';
Expand Down Expand Up @@ -387,6 +389,11 @@ const ZSuccessMessage = styled(TextComponent)`
const ZSuccessTransactionId = styled(TextComponent)`
text-align: center;
word-break: break-all !important;
&:hover {
cursor: pointer;
text-decoration: underline;
}
`;

const CustomFeeWarning = styled(TextComponent)`
Expand Down Expand Up @@ -634,7 +641,7 @@ class Component extends PureComponent<Props, State> {
<ZSuccessLabel value='Success!' />
<ZSuccessContentWrapper>
<ZSuccessMessage value='Your transaction was sent successfully.' />
<ZSuccessTransactionId value={`Transaction ID: ${operationId}`} />
<ZSuccessTransactionId value={`Transaction ID: ${operationId}`} onClick={() => openExternal(ZCASH_EXPLORER_BASE_URL + operationId)} />
</ZSuccessContentWrapper>
<FormButton
label='Done'
Expand Down
4 changes: 3 additions & 1 deletion config/daemon/zcashd-child-process.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ let resolved = false;

const ZCASHD_PROCESS_NAME = getDaemonName();
const DAEMON_PROCESS_PID = 'DAEMON_PROCESS_PID';
const DAEMON_START_TIME = 'DAEMON_START_TIME';

let isWindowOpened = false;

Expand Down Expand Up @@ -95,6 +96,7 @@ const runDaemon: () => Promise<?ChildProcess> = () => new Promise(async (resolve
store.delete('rpcconnect');
store.delete('rpcport');
store.delete(DAEMON_PROCESS_PID);
store.delete(DAEMON_START_TIME);

const processName = path.join(getBinariesPath(), getOsFolder(), ZCASHD_PROCESS_NAME);
const isRelaunch = Boolean(process.argv.find(arg => arg === '--relaunch'));
Expand Down Expand Up @@ -223,8 +225,8 @@ const runDaemon: () => Promise<?ChildProcess> = () => new Promise(async (resolve
store.set(DAEMON_PROCESS_PID, childProcess.pid);

childProcess.stdout.on('data', (data) => {
sendToRenderer('zcashd-log', data.toString(), false);
if (!resolved) {
store.set(DAEMON_START_TIME, Date.now());
resolve(childProcess);
resolved = true;
}
Expand Down
22 changes: 22 additions & 0 deletions flow-custom-typedefs/humanize-duration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
declare module 'humanize-duration' {
declare type options = {
language?: string,
fallbacks?: string[],
delimiter?: string,
spacer?: string,
largest?: number,
units?: string[],
round?: boolean,
decimal?: string,
conjunction?: string,
maxDecimalPoints?: number,
unitMeasures?: {
y?: number,
mo?: number,
w?: number,
d?: number,
},
};

declare module.exports: (milli: number, opt?: options) => string;
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "zepio",
"productName": "Zepio",
"version": "0.7.3",
"version": "0.7.4",
"description": "Zepio | Cross-platform sapling-enabled full-node Zcash wallet",
"main": "config/main.js",
"homepage": "https://zepiowallet.com",
Expand Down Expand Up @@ -230,6 +230,7 @@
"find-process": "^1.2.1",
"got": "^9.6.0",
"history": "^4.7.2",
"humanize-duration": "^3.18.0",
"lodash.flow": "^3.5.0",
"lodash.groupby": "^4.6.0",
"lodash.uniqby": "^4.7.0",
Expand Down
2 changes: 1 addition & 1 deletion public/flow-badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion public/flow-coverage-badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7887,6 +7887,11 @@ humanize-duration@^3.15.3:
version "3.16.0"
resolved "https://registry.yarnpkg.com/humanize-duration/-/humanize-duration-3.16.0.tgz#c7ec3b898305f007c63893f891870b2b5a2e0a7d"

humanize-duration@^3.18.0:
version "3.18.0"
resolved "https://registry.yarnpkg.com/humanize-duration/-/humanize-duration-3.18.0.tgz#ba07a945d6d4358b9751fecabe27864bf965afbc"
integrity sha512-reYy4EJMqlhX13TDlgSqLYfVGKOoixoEzsSL6DBlp22dScWN8Q2eMgDF4L0q28mzbgO40rnBy3WyEUQEhfYALw==

humanize-string@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/humanize-string/-/humanize-string-1.0.2.tgz#fef0a8bc9b1b857ca4013bbfaea75071736988f6"
Expand Down

0 comments on commit e1927bc

Please sign in to comment.