Skip to content

Commit

Permalink
Merge pull request #24 from CityOfZion/alpha-release
Browse files Browse the repository at this point in the history
Alpha release
  • Loading branch information
Ejhfast authored Aug 1, 2017
2 parents ea977ef + adb7aa5 commit 7ab4d06
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 15 deletions.
2 changes: 1 addition & 1 deletion app/components/CreateWallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class CreateWallet extends Component {
<span className="key">{this.props.wif}</span>
<span className="copyKey" onClick={() => clipboard.writeText(this.props.wif, 'selection')}><Copy data-tip data-for="copyPrivateKeyTip" /></span>
</div>
<button><Link to="/">Back to Login</Link></button>
<Link to="/"><button>Back to Login</button></Link>
<ReactTooltip class="solidTip" id="copyPublicKeyTip" place="bottom" type="dark" effect="solid">
<span>Copy Public Key</span>
</ReactTooltip>
Expand Down
4 changes: 2 additions & 2 deletions app/components/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ let Login = ({ dispatch, loggedIn, wif }) =>
<div className="logo"><img src={logo} width="60px"/></div>
<input type="text" placeholder="Enter your private key here (WIF)" onChange={() => onWifChange(dispatch)} ref={node => {input_wif = node;}} />
<div className="loginButtons">
{loggedIn ? <button><Link to="/dashboard">Login</Link></button> : <button disabled="true">Login</button>}
<button><Link to="/create">New Wallet</Link></button>
{loggedIn ? <Link to="/dashboard"><button>Login</button></Link> : <button disabled="true">Login</button>}
<Link to="/create"><button>New Wallet</button></Link>
</div>
<div id="footer">Created by Ethan Fast and COZ. Donations: Adr3XjZ5QDzVJrWvzmsTTchpLRRGSzgS5A</div>
</div>
Expand Down
7 changes: 2 additions & 5 deletions app/components/NetworkSwitch.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,12 @@ const syncTransactionHistory = (dispatch, net, address) => {
getTransactionHistory(net, address).then((transactions) => {
let txs = [];
for (let i = 0; i < transactions.length; i++){
if (transactions[i].NEO !== 0){
if (transactions[i].neo_sent === true){
txs = txs.concat([{type: "NEO", amount: transactions[i].NEO, txid: transactions[i].txid, block_index: transactions[i].block_index }]);
}
if (transactions[i].GAS !== 0){
if (transactions[i].gas_sent === true){
txs = txs.concat([{type: "GAS", amount: transactions[i].GAS, txid: transactions[i].txid, block_index: transactions[i].block_index }]);
}
if (transactions[i].GAS === 0 && transactions[i].NEO === 0){
txs = txs.concat([{type: "NEO", amount: 0, txid: transactions[i].txid, block_index: transactions[i].block_index }]);
}
}
dispatch(setTransactionHistory(txs));
});
Expand Down
6 changes: 5 additions & 1 deletion app/components/Send.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ const sendTransaction = (dispatch, net, wif, asset, neo_balance, gas_balance) =>
} else {
assetSwap = "AntCoins";
}
dispatch(sendEvent(true, "Processing..."))
dispatch(sendEvent(true, "Processing..."));
if (verifyAddress(sendAddress.value) !== true){
dispatch(sendEvent(false, "The address you entered was not valid. No NEO was sent."));
setTimeout(() => dispatch(clearTransactionEvent()), 5000);
}
else if (asset === "NEO" && parseFloat(sendAmount.value) !== parseInt(sendAmount.value)){
dispatch(sendEvent(false, "You cannot send fractional amounts of Neo."));
setTimeout(() => dispatch(clearTransactionEvent()), 5000);
}
else if (asset === "NEO" && parseInt(sendAmount.value) > neo_balance){
dispatch(sendEvent(false, "You do not have enough NEO to send. No NEO was sent."));
setTimeout(() => dispatch(clearTransactionEvent()), 5000);
Expand Down
14 changes: 13 additions & 1 deletion app/components/TransactionHistory.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,19 @@ class TransactionHistory extends Component {
<div className="columnHeader">Transaction History</div>
<div className="headerSpacer"></div>
<ul id="transactionList">
{this.props.transactions.map((t) => <li><div className="txid" onClick={() => openExplorer(getExplorerLink(this.props.net, t.txid))}>{t.txid.substring(0,32)}</div><div className="amount">{t.amount} {t.type}</div></li>)}
{this.props.transactions.map((t) => {
let formatAmount;
if (t.type === "NEO"){ formatAmount = parseInt(t.amount); }
else{ formatAmount = parseFloat(t.amount).toPrecision(5); }
// ignore precision rounding errors for GAS
if ((formatAmount > 0 && formatAmount < 0.001) || (formatAmount < 0 && formatAmount > -0.001)){
formatAmount = 0.0.toPrecision(5);
}
return (<li>
<div className="txid" onClick={() => openExplorer(getExplorerLink(this.props.net, t.txid))}>
{t.txid.substring(0,32)}</div><div className="amount">{formatAmount} {t.type}
</div></li>);
})}
</ul>
</div>;
}
Expand Down
11 changes: 10 additions & 1 deletion app/components/WalletInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import MdSync from 'react-icons/lib/md/sync';
import QRCode from 'qrcode';
import { initiateGetBalance, intervals } from "../components/NetworkSwitch";
import { resetPrice, sendEvent, clearTransactionEvent } from '../actions/index.js';
import { clipboard } from 'electron';
import Copy from 'react-icons/lib/md/content-copy';
import ReactTooltip from 'react-tooltip'

// need handlers on these as otherwise the interval is not cleared when switching between accounts

Expand Down Expand Up @@ -34,7 +37,13 @@ class WalletInfo extends Component {
if (this.props.address !== null){
return (<div id="accountInfo">
<div className="label">Your Public Neo Address:</div>
<div className="address">{this.props.address}</div>
<div className="address">
{this.props.address}
<span className="copyKey" onClick={() => clipboard.writeText(this.props.address, 'selection')}><Copy data-tip data-for="copyAddressTip" /></span>
</div>
<ReactTooltip class="solidTip" id="copyAddressTip" place="bottom" type="dark" effect="solid">
<span>Copy Public Address</span>
</ReactTooltip>
<div className="spacer"></div>
<div id="balance">
<div className="split">
Expand Down
2 changes: 1 addition & 1 deletion app/containers/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Dashboard extends Component {
<SplitPane className="navSplit" split="horizontal" size="40px" allowResize={false}>
<div id="navBar">
<div id="title"><img src={logo} width="60px"/></div>
<div id="version"><span className="grey">Version</span><span className="darker">0.0.1</span></div>
<div id="version"><span className="grey">Version</span><span className="darker">0.0.2</span></div>
<div id="height"><span className="grey">Block</span><span className="darker">{this.props.blockHeight}</span></div>
<NetworkSwitch />
<Logout />
Expand Down
4 changes: 4 additions & 0 deletions app/styles/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,10 @@ button a{
margin:20px 0px;
width:100%;
text-align: center;
span.copyKey{
margin-left: 3px;
cursor:pointer;
}
.label{
font-size:.85em;
}
Expand Down
6 changes: 3 additions & 3 deletions app/wallet/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ export const transferTransaction = ($coin, $publicKeyEncoded, $toAddress, $Amoun
//data.set(hexstring2ab($coin['assetid']), inputLen + 4);

// output value
const num1 = $Amount * 100000000;
const num1 = parseInt($Amount * 100000000);
const num1str = numStoreInMemory(num1.toString(16), 16);
data.set(hexstring2ab(num1str), inputLen + 36);

Expand All @@ -348,7 +348,7 @@ export const transferTransaction = ($coin, $publicKeyEncoded, $toAddress, $Amoun
//data.set(hexstring2ab($coin['assetid']), inputLen + 4);

// output value
const num1 = $Amount * 100000000;
const num1 = parseInt($Amount * 100000000);
const num1str = numStoreInMemory(num1.toString(16), 16);
data.set(hexstring2ab(num1str), inputLen + 36);

Expand All @@ -363,7 +363,7 @@ export const transferTransaction = ($coin, $publicKeyEncoded, $toAddress, $Amoun
//data.set(hexstring2ab($coin['assetid']), inputLen + 64);

// output value
const num2 = inputAmount * 100000000 - num1;
const num2 = parseInt(inputAmount * 100000000 - num1);
const num2str = numStoreInMemory(num2.toString(16), 16);
data.set(hexstring2ab(num2str), inputLen + 96);

Expand Down

0 comments on commit 7ab4d06

Please sign in to comment.