Skip to content

Commit

Permalink
Merge branch 'develop' into fix/eac.js-client-bump
Browse files Browse the repository at this point in the history
  • Loading branch information
e00dan authored Mar 2, 2018
2 parents 5d3becb + e3ad4e6 commit 56c3e88
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 80 deletions.
127 changes: 61 additions & 66 deletions app/components/TransactionScanner/TransactionDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ class TransactionDetails extends ScrollbarComponent {
async cancelTransaction() {
const { transactionStore } = this.props;
const { transaction } = this.state;
return await transactionStore.cancel(transaction);
await transactionStore.cancel(transaction);
this.setState({
status: TRANSACTION_STATUS.CANCELLED
});
}

async componentWillMount() {
Expand All @@ -107,22 +110,17 @@ class TransactionDetails extends ScrollbarComponent {
}

getCancelSection() {
const { transaction, isFrozen } = this.state;
const { transaction, isFrozen, status } = this.state;

const isOwner = this.isOwner(transaction);

if (isOwner && !isFrozen) {
if (isOwner && !isFrozen && status !== TRANSACTION_STATUS.CANCELLED) {
return (
<div className="row">
<div className="footer-buttons col-md-10">
<ul className="pager wizard no-style">
<li className="next">
<button className="btn btn-danger btn-cons" disabled= { isFrozen !== false } onClick= { this.cancelTransaction } type="button">
<span>Cancel</span>
</button>
</li>
</ul>
</div>
<div className="text-center mt-5">
<button className="btn btn-danger btn-cons" disabled={ isFrozen } onClick={ this.cancelTransaction } type="button">
<span>Cancel</span>
</button>
{ isFrozen ? 'The transaction has been frozen.' : '' }
</div>
);
}
Expand All @@ -136,59 +134,56 @@ class TransactionDetails extends ScrollbarComponent {

return (
<div className="tab-pane slide active show">
<div className="row">
<div className="col-md-10">

<table className="table">
<tbody>
<tr>
<td>Status</td>
<td>{status}<span className= { status !== TRANSACTION_STATUS.EXECUTED ? 'd-none' : '' } >&nbsp;at <a href="#"> { executedAt } </a></span></td>
</tr>
<tr>
<td>To Address</td>
<td><a href="#">{toAddress}</a></td>
</tr>
<tr>
<td>Value/Amount</td>
<td><ValueDisplay priceInWei= { callValue } /></td>
</tr>
<tr>
<td>Data</td>
<td>{callData}</td>
</tr>
<tr>
<td>{ isTimestamp ? 'Time' : 'Block' }</td>
<td><BlockOrTimeDisplay model= { windowStart } isTimestamp= { isTimestamp } /></td>
</tr>
<tr>
<td>Window Size</td>
<td><BlockOrTimeDisplay model= { windowSize } isTimestamp= { isTimestamp } duration= { true } /></td>
</tr>
<tr>
<td>Gas Amount</td>
<td> { callGas && callGas.toFixed() } </td>
</tr>
<tr>
<td>Gas Price</td>
<td><ValueDisplay priceInWei= { gasPrice } /></td>
</tr>
<tr>
<td>Time Bounty</td>
<td><ValueDisplay priceInWei= { bounty } /></td>
</tr>
<tr>
<td>Fee</td>
<td><ValueDisplay priceInWei= { fee } /></td>
</tr>
<tr>
<td>Deposit</td>
<td><ValueDisplay priceInWei= { requiredDeposit } /></td>
</tr>
</tbody>
</table>
</div>
</div>

<table className="table">
<tbody>
<tr>
<td>Status</td>
<td>{status}<span className= { status !== TRANSACTION_STATUS.EXECUTED ? 'd-none' : '' } >&nbsp;at <a href="#"> { executedAt } </a></span></td>
</tr>
<tr>
<td>To Address</td>
<td><a href="#">{toAddress}</a></td>
</tr>
<tr>
<td>Value/Amount</td>
<td><ValueDisplay priceInWei= { callValue } /></td>
</tr>
<tr>
<td>Data</td>
<td>{callData}</td>
</tr>
<tr>
<td>{ isTimestamp ? 'Time' : 'Block' }</td>
<td><BlockOrTimeDisplay model= { windowStart } isTimestamp= { isTimestamp } /></td>
</tr>
<tr>
<td>Window Size</td>
<td><BlockOrTimeDisplay model= { windowSize } isTimestamp= { isTimestamp } duration= { true } /></td>
</tr>
<tr>
<td>Gas Amount</td>
<td> { callGas && callGas.toFixed() } </td>
</tr>
<tr>
<td>Gas Price</td>
<td><ValueDisplay priceInWei= { gasPrice } /></td>
</tr>
<tr>
<td>Time Bounty</td>
<td><ValueDisplay priceInWei= { bounty } /></td>
</tr>
<tr>
<td>Fee</td>
<td><ValueDisplay priceInWei= { fee } /></td>
</tr>
<tr>
<td>Deposit</td>
<td><ValueDisplay priceInWei= { requiredDeposit } /></td>
</tr>
</tbody>
</table>

{this.getCancelSection()}
</div>
);
Expand Down
6 changes: 3 additions & 3 deletions app/components/TransactionsRoute/TransactionDetailsRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,18 @@ class TransactionDetailsRoute extends Component {
}

return (
<div>
<div className="container">
<h1 className="view-title">Transaction details <span className="view-subtitle">{txAddress}</span></h1>
<div className="widget-12 card no-border widget-loader-circle no-margin">
<div className="tab-content p-4">
{ !this.state.fetchedTransactions &&
<div className='sweet-loading horizontal-center'>
<div className='sweet-loading horizontal-center my-5'>
<BeatLoader loading={true} />
</div>
}
{content}
</div>
<PoweredByEAC className="col-md-2 mb-4 ml-3" />
<PoweredByEAC className="mb-4 ml-4" />
</div>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion app/components/TransactionsRoute/TransactionsCompleted.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import TransactionScanner from '../TransactionScanner/TransactionScanner';
export default class TransactionsCompleted extends Component {
render() {
return (
<div>
<div className="container-fluid container-fixed-lg">
<h1 className="view-title">Transaction Scanner - Completed</h1>
<div className="widget-12 card no-border widget-loader-circle no-margin">
<TransactionScanner showStatus={true} includeResolved={true} includeUnresolved={false} />
Expand Down
2 changes: 1 addition & 1 deletion app/components/TransactionsRoute/TransactionsRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import TransactionDetailsRoute from './TransactionDetailsRoute';
class TransactionsRoute extends MetamaskComponent {
render() {
return (
<div id="transactionScanner" className="container-fluid container-fixed-lg padding-25 sm-padding-10 subsection">
<div id="transactionScanner" className="padding-25 sm-padding-10 subsection">
<Switch>
<Redirect exact path="/transactions" to="/transactions/completed"/>
<Route path="/transactions/completed" component={TransactionsCompleted}/>
Expand Down
2 changes: 1 addition & 1 deletion app/components/TransactionsRoute/TransactionsScheduled.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import TransactionScanner from '../TransactionScanner/TransactionScanner';
export default class TransactionsScheduled extends Component {
render() {
return (
<div>
<div className="container-fluid container-fixed-lg">
<h1 className="view-title">Transaction Scanner - Scheduled</h1>
<div className="widget-12 card no-border widget-loader-circle no-margin">
<TransactionScanner showStatus={false} includeResolved={false} includeUnresolved={true} />
Expand Down
8 changes: 5 additions & 3 deletions app/services/web3.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,17 @@ export default class Web3Service {
window.web3 = web3;
this.web3 = web3;
}
if (!this.connectedToMetaMask || !this.web3.isConnected()) return;
this.accounts = web3.eth.accounts;
web3.eth.defaultAccount = this.accounts[0];

const netId = await Bb.fromCallback(callback => web3.version.getNetwork(callback));
runInAction(() => {
this.netId = netId;
this.explorer = Explorers[this.netId];
});

if (!this.connectedToMetaMask || !this.web3.isConnected()) return;

this.accounts = web3.eth.accounts;
web3.eth.defaultAccount = this.accounts[0];
}

async awaitInitialized() {
Expand Down
8 changes: 3 additions & 5 deletions app/stores/TimeNodeStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,11 @@ export default class TimeNodeStore {
}

async getBalance(address = this.getMyAddress()) {
const web3 = this._web3Service.web3;

const balance = await this._eacService.Util.getBalance(address);
const balanceEther = web3.fromWei(balance, 'ether');

this.balanceETH = balanceEther;
return balanceEther;
this.balanceETH = balance.div(10**18).toNumber().toFixed(2);

return this.balanceETH;
}

async getDAYBalance(address = this.getMyAttachedAddress()) {
Expand Down

0 comments on commit 56c3e88

Please sign in to comment.