diff --git a/packages/light-react/config-overrides.js b/packages/light-react/config-overrides.js
index a5fb965616be51727fbf4ca347d64d17f461c7bc..3718e65bb0f60ee8d5c645bef9d0899fc0690088 100644
--- a/packages/light-react/config-overrides.js
+++ b/packages/light-react/config-overrides.js
@@ -1,9 +1,9 @@
-const rewireMobX = require('react-app-rewire-mobx');
+const { injectBabelPlugin } = require('react-app-rewired');
/* config-overrides.js */
-module.exports = function override(config, env) {
- // use the MobX rewire
- config = rewireMobX(config, env);
+module.exports = function override(config) {
+ // use the MobX rewire to use @decorators
+ config = injectBabelPlugin('transform-decorators-legacy', config);
return config;
};
diff --git a/packages/light-react/package.json b/packages/light-react/package.json
index e23fccba45f45a3fe5acd262752993b684f5d659..e927674be735be1fbdab759696d56d5c7e262f83 100644
--- a/packages/light-react/package.json
+++ b/packages/light-react/package.json
@@ -36,17 +36,16 @@
},
"dependencies": {
"@parity/api": "^2.1.22",
- "@parity/light.js": "https://github.com/parity-js/light.js#99ee612acd7ee69554839a09d6c094251043bc3b",
- "@parity/shared": "^3.0.1",
+ "@parity/light.js": "https://github.com/parity-js/light.js#165a97deb86d7b77a96b324b7d42d04a27a43b0b",
+ "@parity/shared": "^3.0.2",
"is-electron": "^2.1.0",
"light-hoc": "^0.1.0",
"light-ui": "^0.1.0",
"lodash": "^4.17.10",
- "mobx": "^4.2.0",
- "mobx-react": "^5.1.2",
+ "mobx": "^5.0.2",
+ "mobx-react": "^5.2.3",
"react": "^16.3.2",
"react-blockies": "^1.3.0",
- "react-copy-to-clipboard": "^5.0.1",
"react-dom": "^16.3.2",
"react-router-dom": "^4.2.2",
"react-scripts": "1.1.4",
@@ -54,10 +53,10 @@
},
"devDependencies": {
"babel-eslint": "^8.2.3",
+ "babel-plugin-transform-decorators-legacy": "^1.3.5",
"node-sass": "^4.9.0",
"node-sass-chokidar": "^1.2.2",
"npm-run-all": "^4.1.2",
- "react-app-rewire-mobx": "^1.0.8",
"react-app-rewired": "^1.5.2",
"semistandard": "^12.0.1"
}
diff --git a/packages/light-react/src/App/App.js b/packages/light-react/src/App/App.js
index 3a779ef4b00554f202b468bd8bacf587418102f6..07aac79565da026d3bb653188b4f1c45471348fc 100644
--- a/packages/light-react/src/App/App.js
+++ b/packages/light-react/src/App/App.js
@@ -16,7 +16,6 @@ import { inject, observer } from 'mobx-react';
import Accounts from '../Accounts';
import Onboarding from '../Onboarding';
import Overlay from '../Overlay';
-import Receive from '../Receive';
import Send from '../Send';
import Settings from '../Settings';
import { STATUS } from '../stores/healthStore';
@@ -75,7 +74,6 @@ class App extends Component {
/>
-
diff --git a/packages/light-react/src/Receive/Receive.js b/packages/light-react/src/Receive/Receive.js
deleted file mode 100644
index 10b750a605d3c61742e1372f6ebab534932272d7..0000000000000000000000000000000000000000
--- a/packages/light-react/src/Receive/Receive.js
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2015-2018 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-//
-// SPDX-License-Identifier: MIT
-
-import React, { PureComponent } from 'react';
-import { accountsInfo$, defaultAccount$ } from '@parity/light.js';
-import Blockies from 'react-blockies';
-import { CopyToClipboard } from 'react-copy-to-clipboard';
-import { Header } from 'light-ui';
-import light from 'light-hoc';
-import { Link } from 'react-router-dom';
-
-@light({
- accountsInfo: accountsInfo$,
- defaultAccount: defaultAccount$
-})
-class Receive extends PureComponent {
- render () {
- const { accountsInfo, defaultAccount } = this.props;
-
- return (
-
-
- Close
-
- }
- title={
- accountsInfo &&
- defaultAccount &&
- accountsInfo[defaultAccount] && (
-
- {' '}
- {accountsInfo[defaultAccount].name}
-
- )
- }
- />
-
-
-
-
-
{defaultAccount}
-
-
-
-
-
-
-
-
-
- );
- }
-}
-
-export default Receive;
diff --git a/packages/light-react/src/Send/Signer/Signer.js b/packages/light-react/src/Send/Signer/Signer.js
index e7946fe04286ad39d750f83b2681f63a66b50155..91c9cfb78399311e85fa2a03f20cc3291d08926e 100644
--- a/packages/light-react/src/Send/Signer/Signer.js
+++ b/packages/light-react/src/Send/Signer/Signer.js
@@ -5,7 +5,6 @@
import React, { Component } from 'react';
import { FormField, Header } from 'light-ui';
-import { fromWei } from '@parity/api/lib/util/wei';
import { inject, observer } from 'mobx-react';
import { Link } from 'react-router-dom';
@@ -15,6 +14,7 @@ import TokenBalance from '../../Tokens/TokensList/TokenBalance';
@observer
class Signer extends Component {
state = {
+ isSending: false,
password: ''
};
@@ -24,7 +24,12 @@ class Signer extends Component {
e.preventDefault();
- sendStore.acceptRequest(password).then(() => history.push('/send/sent'));
+ this.setState({ isSending: true }, () => {
+ sendStore
+ .acceptRequest(password)
+ .then(() => history.push('/send/sent'))
+ .catch(() => this.setState({ isSending: false }));
+ });
};
handleChangePassword = ({ target: { value } }) => {
@@ -33,17 +38,20 @@ class Signer extends Component {
handleReject = () => {
const { history, sendStore } = this.props;
- sendStore
- .rejectRequest()
- .then(() => history.goBack())
- .catch(() => history.goBack());
+
+ this.setState({ isSending: true }, () => {
+ sendStore
+ .rejectRequest()
+ .then(() => history.goBack())
+ .catch(() => history.goBack());
+ });
};
render () {
const {
sendStore: { token, tx, txStatus }
} = this.props;
- const { password } = this.state;
+ const { isSending, password } = this.state;
return (
@@ -64,7 +72,7 @@ class Signer extends Component {
- {+fromWei(tx.value)} {token.symbol}
+ {tx.amount} {token.symbol}
@@ -95,7 +103,7 @@ class Signer extends Component {
diff --git a/packages/light-react/src/Send/TxForm/TxForm.js b/packages/light-react/src/Send/TxForm/TxForm.js
index dcbe332af992002890f8bffec11642bc942250af..ef3325aa8f4808311a48b6889babdfafdd4b87f5 100644
--- a/packages/light-react/src/Send/TxForm/TxForm.js
+++ b/packages/light-react/src/Send/TxForm/TxForm.js
@@ -4,11 +4,9 @@
// SPDX-License-Identifier: MIT
import React, { Component } from 'react';
-import { defaultAccount$ } from '@parity/light.js';
import { fromWei, toWei } from '@parity/api/lib/util/wei';
import { FormField, Header } from 'light-ui';
import { inject, observer } from 'mobx-react';
-import light from 'light-hoc';
import { Link } from 'react-router-dom';
import TokenBalance from '../../Tokens/TokensList/TokenBalance';
@@ -16,53 +14,43 @@ import TokenBalance from '../../Tokens/TokensList/TokenBalance';
const MAX_GAS_PRICE = 40; // In Gwei
const MIN_GAS_PRICE = 3; // Safelow gas price from GasStation, in Gwei
-@light({
- defaultAccount: defaultAccount$
-})
@inject('sendStore')
@observer
class Send extends Component {
- state = {
- amount: 0.01, // In Ether or in token
- gasPrice: 4, // in Gwei
- to: '0x00Ae02834e91810B223E54ce3f9B7875258a1747'
- };
+ componentDidMount () {
+ this.props.sendStore.estimateGas();
+ }
handleChangeAmount = ({ target: { value } }) =>
- this.setState({ amount: value });
+ this.props.sendStore.setTxAmount(value);
handleChangeGasPrice = ({ target: { value } }) =>
- this.setState({ gasPrice: value });
+ this.props.sendStore.setTxGasPrice(value);
handleChangeTo = ({ target: { value } }) => {
- this.setState({ to: value }, () => {
- // Estimate the gas to this address.
- this.props.sendStore.estimateGas(this.state);
- });
+ const { sendStore } = this.props;
+ sendStore.setTxTo(value);
+ // Estimate the gas to this address, if we're sending ETH.
+ if (sendStore.tokenAddress === 'ETH') {
+ sendStore.estimateGas();
+ }
};
handleSubmit = e => {
e.preventDefault();
- const { defaultAccount, history, sendStore } = this.props;
- const { amount, gasPrice, to } = this.state;
+ const { history, sendStore } = this.props;
// Post a request to the transaction. There is a next step to sign this
// request.
- sendStore.postTx({
- from: defaultAccount,
- gasPrice: toWei(gasPrice, 'shannon'), // shannon == gwei
- to,
- value: toWei(amount)
- });
+ sendStore.send();
history.push('/send/signer');
};
render () {
const {
- sendStore: { estimated, token }
+ sendStore: { estimated, token, tx }
} = this.props;
- const { amount, gasPrice, to } = this.state;
return (
@@ -93,7 +81,7 @@ class Send extends Component {
onChange={this.handleChangeAmount}
required
type='number'
- value={amount}
+ value={tx.amount}
/>
+
+
);
}
diff --git a/packages/light-react/src/Tokens/Tokens.js b/packages/light-react/src/Tokens/Tokens.js
index 6a16799dd4613aa08d41676ee93b55ce9bf6cfbb..31f9d177e77584a0e5581c9edae4b995974197d5 100644
--- a/packages/light-react/src/Tokens/Tokens.js
+++ b/packages/light-react/src/Tokens/Tokens.js
@@ -4,9 +4,8 @@
// SPDX-License-Identifier: MIT
import React, { PureComponent } from 'react';
+import { AccountHeader } from 'light-ui';
import { accountsInfo$, defaultAccount$ } from '@parity/light.js';
-import Blockies from 'react-blockies';
-import { Header } from 'light-ui';
import light from 'light-hoc';
import { Link } from 'react-router-dom';
@@ -23,26 +22,20 @@ class Tokens extends PureComponent {
return (