diff --git a/src/Send/Signer/Signer.js b/src/Send/Signer/Signer.js
new file mode 100644
index 0000000000000000000000000000000000000000..b1ffcf1b4ca4087d1d4106c3654899c7b0371099
--- /dev/null
+++ b/src/Send/Signer/Signer.js
@@ -0,0 +1,105 @@
+import React, { Component } from 'react';
+import { fromWei } from '@parity/api/lib/util/wei';
+import { inject, observer } from 'mobx-react';
+import { post$ } from '@parity/light.js';
+
+@inject('signerStore')
+@observer
+class Signer extends Component {
+ state = {
+ password: '',
+ status: null
+ };
+
+ componentWillMount () {
+ // If we accessed this URL via URL change, then something's not right, so
+ // we go back. If we accessed after the Send page, then location.state is
+ // set as the tx.
+ if (!this.props.location.state) {
+ this.props.history.goBack();
+ }
+ }
+
+ componentDidMount () {
+ const tx = this.props.location.state;
+ this.subscription = post$(tx).subscribe(status => {
+ if (status.requested) {
+ this.requestId = status.requested;
+ }
+ this.setState({ status });
+ });
+ }
+
+ componentWillUnmount () {
+ if (this.subscription) {
+ this.subscription.unsubscribe();
+ }
+ }
+
+ handleAccept = () => {
+ const { signerStore } = this.props;
+ const { password } = this.state;
+ signerStore.acceptRequest(this.requestId, password);
+ };
+
+ handleChangePassword = ({ target: { value } }) => {
+ this.setState({ password: value });
+ };
+
+ handleReject = () => {
+ const { history, signerStore } = this.props;
+ signerStore.rejectRequest(this.requestId).then(() => history.goBack());
+ };
+
+ handleSubmit = e => {
+ e.preventDefault();
+ this.handleAccept();
+ };
+
+ render () {
+ const {
+ location: { state: tx }
+ } = this.props;
+ const { password, status } = this.state;
+
+ return (
+
+ );
+ }
+}
+
+export default Signer;
diff --git a/src/Signer/index.js b/src/Send/Signer/index.js
similarity index 100%
rename from src/Signer/index.js
rename to src/Send/Signer/index.js
diff --git a/src/Settings/Settings.js b/src/Settings/Settings.js
index 5288014247a4965a836fb1523a9a1834bc593335..5775c57ebd9fedc8bcbe1d29302489309571f4db 100644
--- a/src/Settings/Settings.js
+++ b/src/Settings/Settings.js
@@ -5,14 +5,11 @@
import React, { Component } from 'react';
-import Accounts from '../Accounts';
-
class Settings extends Component {
render () {
return (
This is the settings page.
-
);
}
diff --git a/src/Signer/Signer.js b/src/Signer/Signer.js
deleted file mode 100644
index 8541349f8584069bdef87c2a4408eac762cc4ed3..0000000000000000000000000000000000000000
--- a/src/Signer/Signer.js
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2015-2018 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-//
-// SPDX-License-Identifier: MIT
-
-import React, { Component } from 'react';
-import { Route } from 'react-router-dom';
-
-import SignerDetails from './SignerDetails';
-import SignerList from './SignerList';
-
-class Signer extends Component {
- render () {
- return (
-
-
-
-
-
- );
- }
-}
-
-export default Signer;
diff --git a/src/Signer/SignerDetails/SignerDetails.js b/src/Signer/SignerDetails/SignerDetails.js
deleted file mode 100644
index f82251380e4b48f2f748bfbb0a7e13add0731a40..0000000000000000000000000000000000000000
--- a/src/Signer/SignerDetails/SignerDetails.js
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright 2015-2018 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-//
-// SPDX-License-Identifier: MIT
-
-import React, { Component } from 'react';
-import { fromWei } from '@parity/api/lib/util/wei';
-import { inject, observer } from 'mobx-react';
-
-@inject('signerStore')
-@observer
-class SignerDetails extends Component {
- state = {
- password: ''
- };
-
- handleAccept = () => {
- const {
- match: {
- params: { requestId }
- },
- signerStore
- } = this.props;
- const { password } = this.state;
- signerStore.acceptRequest(requestId, password);
- };
-
- handleChangePassword = ({ target: { value } }) => {
- this.setState({ password: value });
- };
-
- handleReject = () => {
- const {
- match: {
- params: { requestId }
- },
- signerStore
- } = this.props;
- signerStore.rejectRequest(requestId);
- };
-
- handleSubmit = e => {
- e.preventDefault();
- };
-
- render () {
- const {
- match: {
- params: { requestId }
- },
- signerStore: { requests }
- } = this.props;
- const { password } = this.state;
- const request = requests[requestId];
-
- if (!request) {
- // This happens after we accept/reject a request
- return null;
- }
-
- const transaction = request.payload.sendTransaction;
-
- return (
-
- );
- }
-}
-
-export default SignerDetails;
diff --git a/src/Signer/SignerDetails/index.js b/src/Signer/SignerDetails/index.js
deleted file mode 100644
index 7afc360dd1e5ab0298935da2d8a39d32831bd7d3..0000000000000000000000000000000000000000
--- a/src/Signer/SignerDetails/index.js
+++ /dev/null
@@ -1,8 +0,0 @@
-// Copyright 2015-2018 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-//
-// SPDX-License-Identifier: MIT
-
-import SignerDetails from './SignerDetails';
-
-export default SignerDetails;
diff --git a/src/Signer/SignerList/SignerList.js b/src/Signer/SignerList/SignerList.js
deleted file mode 100644
index a28706400332edf91bccc3ee31ce139ac3c90fc8..0000000000000000000000000000000000000000
--- a/src/Signer/SignerList/SignerList.js
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2015-2018 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-//
-// SPDX-License-Identifier: MIT
-
-import React, { Component } from 'react';
-import { fromWei } from '@parity/api/lib/util/wei';
-import { inject, observer } from 'mobx-react';
-import { Link } from 'react-router-dom';
-
-@inject('signerStore')
-@observer
-class SignerList extends Component {
- render () {
- const {
- signerStore: { pending }
- } = this.props;
- return (
-
- List of requests to be signed (click to sign):
- {pending.map(({ id, payload: { sendTransaction: { value } } }) => (
- -
- {/* TODO inline style is bad */}
-
- - The one with {+fromWei(value)}ETH (show to? from?)
-
-
- ))}
-
-
- );
- }
-}
-
-export default SignerList;
diff --git a/src/Signer/SignerList/index.js b/src/Signer/SignerList/index.js
deleted file mode 100644
index 54c165f137fe10aa18abcc7788d1487d97bcbeb9..0000000000000000000000000000000000000000
--- a/src/Signer/SignerList/index.js
+++ /dev/null
@@ -1,8 +0,0 @@
-// Copyright 2015-2018 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-//
-// SPDX-License-Identifier: MIT
-
-import SignerList from './SignerList';
-
-export default SignerList;
diff --git a/src/Tokens/BalanceLayout/BalanceLayout.js b/src/Tokens/BalanceLayout/BalanceLayout.js
index bd597eee7ca3f6b290910283766b83429b5870ad..b85ae613d8779bb012b8a32ed4c8f6de1f1664ee 100644
--- a/src/Tokens/BalanceLayout/BalanceLayout.js
+++ b/src/Tokens/BalanceLayout/BalanceLayout.js
@@ -5,8 +5,6 @@
import React from 'react';
-const ETHER_IN_WEI = 1000000000000000000; // Is there a util function for this?
-
const BalanceLayout = ({ balance, image, name, symbol }) => (
@@ -14,7 +12,7 @@ const BalanceLayout = ({ balance, image, name, symbol }) => (
{name}
- {Number.isFinite(balance) ? (balance / ETHER_IN_WEI).toFixed(2) : '...'}{' '}
+ {Number.isFinite(balance) ? balance.toFixed(2) : '...'}{' '}
{symbol}
diff --git a/src/Tokens/EthBalance/EthBalance.js b/src/Tokens/EthBalance/EthBalance.js
index 3deb19b35c5133e5a3784c52f528406a49215a4d..beaca486f9cee0371a3bd854fddcb7e5f09eb550 100644
--- a/src/Tokens/EthBalance/EthBalance.js
+++ b/src/Tokens/EthBalance/EthBalance.js
@@ -4,14 +4,20 @@
// SPDX-License-Identifier: MIT
import React, { Component } from 'react';
-import { balanceOf$ } from '@parity/light.js';
+import { balanceOf$, defaultAccount$ } from '@parity/light.js';
+import { fromWei } from '@parity/api/lib/util/wei';
import { Link } from 'react-router-dom';
+import { map, switchMap } from 'rxjs/operators';
import BalanceLayout from '../BalanceLayout';
import light from '../../hoc';
@light({
- balance: ({ address }) => balanceOf$(address)
+ balance: () =>
+ defaultAccount$().pipe(
+ switchMap(balanceOf$),
+ map(value => +fromWei(value.toString()))
+ )
})
class EthBalance extends Component {
render () {
diff --git a/src/Tokens/TokenBalance/TokenBalance.js b/src/Tokens/TokenBalance/TokenBalance.js
index 385aeb5a3e9355379491d4c9b66b2d4ef3e16b5d..3c0bd52d32a3676716c054d374e4bc09f19677c7 100644
--- a/src/Tokens/TokenBalance/TokenBalance.js
+++ b/src/Tokens/TokenBalance/TokenBalance.js
@@ -14,7 +14,7 @@ class TokenBalance extends Component {
};
render () {
- const balance = Math.round(Math.random() * 1000000000000000000000);
+ const balance = Math.round(Math.random() * 100);
return
;
}
}
diff --git a/src/Tokens/Tokens.js b/src/Tokens/Tokens.js
index 13407eaa9d1ba1704f91282d13a240749b75790f..e7e07911781e2a91c9f799b59a10f4f62428e6d7 100644
--- a/src/Tokens/Tokens.js
+++ b/src/Tokens/Tokens.js
@@ -5,22 +5,16 @@
import React, { Component } from 'react';
import { inject, observer } from 'mobx-react';
-import { defaultAccount$ } from '@parity/light.js';
import { Redirect } from 'react-router-dom';
import EthBalance from './EthBalance';
-import light from '../hoc';
import TokenBalance from './TokenBalance';
@inject('parityStore', 'tokensStore')
@observer
-@light({
- me: defaultAccount$
-})
class Tokens extends Component {
render () {
const {
- me,
parityStore: { isApiConnected },
tokensStore: { tokens }
} = this.props;
@@ -32,16 +26,15 @@ class Tokens extends Component {
return (
- {me &&
- Array.from(tokens.keys()).map(key => (
- -
- {key === 'ETH' ? (
-
- ) : (
-
- )}
-
- ))}
+ {Array.from(tokens.keys()).map(key => (
+ -
+ {key === 'ETH' ? (
+
+ ) : (
+
+ )}
+
+ ))}
);
diff --git a/yarn.lock b/yarn.lock
index ad9dcdcf94457bcd9eb55c6b90d467b34524814f..1c2a7152be7f380edf31b4577dd6ff9daa3c01e7 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1730,10 +1730,6 @@ case-sensitive-paths-webpack-plugin@2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/case-sensitive-paths-webpack-plugin/-/case-sensitive-paths-webpack-plugin-2.1.1.tgz#3d29ced8c1f124bf6f53846fb3f5894731fdc909"
-case-sensitive-paths-webpack-plugin@^2.1.2:
- version "2.1.2"
- resolved "https://registry.yarnpkg.com/case-sensitive-paths-webpack-plugin/-/case-sensitive-paths-webpack-plugin-2.1.2.tgz#c899b52175763689224571dad778742e133f0192"
-
caseless@~0.11.0:
version "0.11.0"
resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.11.0.tgz#715b96ea9841593cc33067923f5ec60ebda4f7d7"
@@ -7260,6 +7256,12 @@ react-app-rewired@^1.5.2:
cross-spawn "^5.1.0"
dotenv "^4.0.0"
+react-blockies@^1.3.0:
+ version "1.3.0"
+ resolved "https://registry.yarnpkg.com/react-blockies/-/react-blockies-1.3.0.tgz#2db6123bdfa8295a32dfa8acb62ce88abd1090e3"
+ dependencies:
+ prop-types "^15.5.10"
+
react-dev-utils@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/react-dev-utils/-/react-dev-utils-5.0.1.tgz#1f396e161fe44b595db1b186a40067289bf06613"