- );
- }
-
- renderBalance () {
- const { balanceDisplay } = this.state;
-
- return (
- { balanceDisplay } ETH
- );
- }
-
- renderName () {
- const { address, externalLink, netVersion } = this.props;
- const name = ;
-
- if (!name) {
- return (
-
- [{ this.shortAddress(address) }]
-
- );
- }
-
- return (
-
-
- { name }
- [{ this.tinyAddress(address) }]
-
-
- );
- }
-
- tinyAddress () {
- const { address } = this.props;
- const len = address.length;
-
- return address.slice(2, 4) + '..' + address.slice(len - 2);
- }
-
- shortAddress () {
- const { address } = this.props;
- const len = address.length;
-
- return address.slice(2, 8) + '..' + address.slice(len - 7);
- }
-}
diff --git a/js/src/Signer/components/Account/index.js b/js/src/Signer/components/Account/index.js
deleted file mode 100644
index 8023eb211..000000000
--- a/js/src/Signer/components/Account/index.js
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-export default from './account';
diff --git a/js/src/Signer/components/DecryptRequest/decryptRequest.js b/js/src/Signer/components/DecryptRequest/decryptRequest.js
deleted file mode 100644
index 018c581ff..000000000
--- a/js/src/Signer/components/DecryptRequest/decryptRequest.js
+++ /dev/null
@@ -1,185 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-import { observer } from 'mobx-react';
-import React, { Component } from 'react';
-import PropTypes from 'prop-types';
-import { FormattedMessage } from 'react-intl';
-import { connect } from 'react-redux';
-
-import Account from '../Account';
-import TransactionPendingForm from '../TransactionPendingForm';
-import RequestOrigin from '../RequestOrigin';
-
-import styles from '../SignRequest/signRequest.css';
-
-@observer
-class DecryptRequest extends Component {
- static contextTypes = {
- api: PropTypes.object
- };
-
- static propTypes = {
- accounts: PropTypes.object.isRequired,
- address: PropTypes.string.isRequired,
- data: PropTypes.string.isRequired,
- id: PropTypes.object.isRequired,
- isFinished: PropTypes.bool.isRequired,
- netVersion: PropTypes.string.isRequired,
- signerStore: PropTypes.object.isRequired,
-
- className: PropTypes.string,
- focus: PropTypes.bool,
- isSending: PropTypes.bool,
- onConfirm: PropTypes.func,
- onReject: PropTypes.func,
- origin: PropTypes.any,
- status: PropTypes.string
- };
-
- static defaultProps = {
- focus: false,
- origin: {
- type: 'unknown',
- details: ''
- }
- };
-
- componentWillMount () {
- const { address, signerStore } = this.props;
-
- signerStore.fetchBalance(address);
- }
-
- render () {
- const { className } = this.props;
-
- return (
-
- );
- }
-
- return (
-
- );
- }
-
- onConfirm = (data) => {
- const { id } = this.props;
- const { password, decrypted, wallet } = data;
-
- this.props.onConfirm({ id, password, decrypted, wallet });
- }
-
- onReject = () => {
- this.props.onReject(this.props.id);
- }
-}
-
-function mapStateToProps (state) {
- const { accounts } = state.personal;
-
- return {
- accounts
- };
-}
-
-export default connect(
- mapStateToProps,
- null
-)(DecryptRequest);
diff --git a/js/src/Signer/components/DecryptRequest/index.js b/js/src/Signer/components/DecryptRequest/index.js
deleted file mode 100644
index c2bc5e1e9..000000000
--- a/js/src/Signer/components/DecryptRequest/index.js
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-export default from './decryptRequest';
diff --git a/js/src/Signer/components/RequestOrigin/index.js b/js/src/Signer/components/RequestOrigin/index.js
deleted file mode 100644
index 2f703c924..000000000
--- a/js/src/Signer/components/RequestOrigin/index.js
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-export default from './requestOrigin';
diff --git a/js/src/Signer/components/RequestOrigin/requestOrigin.css b/js/src/Signer/components/RequestOrigin/requestOrigin.css
deleted file mode 100644
index f5717e10c..000000000
--- a/js/src/Signer/components/RequestOrigin/requestOrigin.css
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright 2015-2017 Parity Technologies (UK) Ltd.
-/* This file is part of Parity.
-/*
-/* Parity is free software: you can redistribute it and/or modify
-/* it under the terms of the GNU General Public License as published by
-/* the Free Software Foundation, either version 3 of the License, or
-/* (at your option) any later version.
-/*
-/* Parity is distributed in the hope that it will be useful,
-/* but WITHOUT ANY WARRANTY; without even the implied warranty of
-/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-/* GNU General Public License for more details.
-/*
-/* You should have received a copy of the GNU General Public License
-/* along with Parity. If not, see .
-*/
-
-.container {
- text-align: left;
- margin: 3em .5em;
- opacity: 0.6;
- font-size: 0.8em;
-
- .unknown {
- color: #e44;
- }
-
- .url {
- max-width: 100%;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
-
- .hash {
- margin-left: .5em;
- }
-
- .hash, .url {
- margin-bottom: -.2em;
- display: inline-block;
- }
-}
diff --git a/js/src/Signer/components/RequestOrigin/requestOrigin.js b/js/src/Signer/components/RequestOrigin/requestOrigin.js
deleted file mode 100644
index e0136e486..000000000
--- a/js/src/Signer/components/RequestOrigin/requestOrigin.js
+++ /dev/null
@@ -1,171 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-import React, { Component } from 'react';
-import PropTypes from 'prop-types';
-import { FormattedMessage } from 'react-intl';
-
-import IdentityIcon from '@parity/ui/IdentityIcon';
-
-import styles from './requestOrigin.css';
-
-export default class RequestOrigin extends Component {
- static contextTypes = {
- api: PropTypes.object.isRequired
- };
-
- static propTypes = {
- origin: PropTypes.shape({
- type: PropTypes.oneOf(['unknown', 'dapp', 'rpc', 'ipc', 'signer']),
- details: PropTypes.oneOfType([
- PropTypes.string,
- PropTypes.shape({
- session: PropTypes.string.isRequired
- })
- ]).isRequired
- }).isRequired
- };
-
- render () {
- const { origin } = this.props;
-
- return (
-
- Requested { this.renderOrigin(origin) }
-
- );
- }
-
- renderOrigin (origin) {
- if (origin.type === 'unknown') {
- return (
-
-
-
- );
- }
-
- if (origin.type === 'dapp') {
- return (
-
-
- {
- origin.details || (
-
- )
- }
-
- )
- } }
- />
-
- );
- }
-
- if (origin.type === 'rpc') {
- return (
-
-
- ({
- origin.details || (
-
- )
- })
-
- )
- } }
- />
-
- );
- }
-
- if (origin.type === 'ipc') {
- return (
-
-
-
-
-
-
- );
- }
-
- if (origin.type === 'signer') {
- const session = origin.details && origin.details.session || origin.details;
-
- return this.renderSigner(session);
- }
- }
-
- renderSigner (session) {
- if (session.substr(2) === this.context.api.transport.sessionHash) {
- return (
-
-
-
- );
- }
-
- return (
-
-
-
-
-
-
- );
- }
-}
diff --git a/js/src/Signer/components/RequestOrigin/requestOrigin.spec.js b/js/src/Signer/components/RequestOrigin/requestOrigin.spec.js
deleted file mode 100644
index 0faac6bd3..000000000
--- a/js/src/Signer/components/RequestOrigin/requestOrigin.spec.js
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-import { shallow } from 'enzyme';
-import React from 'react';
-
-import RequestOrigin from './';
-
-const context = {
- context: {
- api: {
- transport: {
- sessionHash: '1234'
- }
- }
- }
-};
-
-describe('views/Signer/components/RequestOrigin', () => {
- it('renders unknown', () => {
- expect(shallow(
- ,
- context
- ).find('FormattedMessage').props().id).to.equal('signer.requestOrigin.unknownInterface');
- });
-
- it('renders dapps', () => {
- expect(shallow(
- ,
- context
- ).find('FormattedMessage').props().id).to.equal('signer.requestOrigin.dapp');
- });
-
- it('renders rpc', () => {
- expect(shallow(
- ,
- context
- ).find('FormattedMessage').props().id).to.equal('signer.requestOrigin.rpc');
- });
-
- it('renders ipc', () => {
- expect(shallow(
- ,
- context
- ).find('FormattedMessage').props().id).to.equal('signer.requestOrigin.ipc');
- });
-
- it('renders signer', () => {
- expect(shallow(
- ,
- context
- ).find('FormattedMessage').props().id).to.equal('signer.requestOrigin.signerUI');
-
- expect(shallow(
- ,
- context
- ).find('FormattedMessage').props().id).to.equal('signer.requestOrigin.signerCurrent');
- });
-});
diff --git a/js/src/Signer/components/RequestPending/index.js b/js/src/Signer/components/RequestPending/index.js
deleted file mode 100644
index 53511d537..000000000
--- a/js/src/Signer/components/RequestPending/index.js
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-export default from './requestPending';
diff --git a/js/src/Signer/components/RequestPending/requestPending.js b/js/src/Signer/components/RequestPending/requestPending.js
deleted file mode 100644
index e116e6906..000000000
--- a/js/src/Signer/components/RequestPending/requestPending.js
+++ /dev/null
@@ -1,126 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-import React, { Component } from 'react';
-import PropTypes from 'prop-types';
-
-import DecryptRequest from '../DecryptRequest';
-import SignRequest from '../SignRequest';
-import TransactionPending from '../TransactionPending';
-
-export default class RequestPending extends Component {
- static propTypes = {
- className: PropTypes.string,
- date: PropTypes.instanceOf(Date).isRequired,
- focus: PropTypes.bool,
- gasLimit: PropTypes.object.isRequired,
- id: PropTypes.object.isRequired,
- isSending: PropTypes.bool.isRequired,
- netVersion: PropTypes.string.isRequired,
- onConfirm: PropTypes.func.isRequired,
- onReject: PropTypes.func.isRequired,
- origin: PropTypes.object.isRequired,
- payload: PropTypes.oneOfType([
- PropTypes.shape({ decrypt: PropTypes.object.isRequired }),
- PropTypes.shape({ sendTransaction: PropTypes.object.isRequired }),
- PropTypes.shape({ sign: PropTypes.object.isRequired }),
- PropTypes.shape({ signTransaction: PropTypes.object.isRequired })
- ]).isRequired,
- signerStore: PropTypes.object.isRequired
- };
-
- static defaultProps = {
- focus: false,
- isSending: false
- };
-
- render () {
- const { className, date, focus, gasLimit, id, isSending, netVersion, onReject, payload, signerStore, origin } = this.props;
-
- if (payload.sign) {
- const { sign } = payload;
-
- return (
-
- );
- }
-
- if (payload.decrypt) {
- const { decrypt } = payload;
-
- return (
-
- );
- }
-
- const transaction = payload.sendTransaction || payload.signTransaction;
-
- if (transaction) {
- return (
-
- );
- }
-
- console.error('RequestPending: Unknown payload', payload);
- return null;
- }
-
- onConfirm = (data) => {
- const { onConfirm, payload } = this.props;
-
- data.payload = payload;
- onConfirm(data);
- };
-}
diff --git a/js/src/Signer/components/RequestPending/requestPending.spec.js b/js/src/Signer/components/RequestPending/requestPending.spec.js
deleted file mode 100644
index 3c2d29cf0..000000000
--- a/js/src/Signer/components/RequestPending/requestPending.spec.js
+++ /dev/null
@@ -1,132 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-import BigNumber from 'bignumber.js';
-import { shallow } from 'enzyme';
-import React from 'react';
-import sinon from 'sinon';
-
-import RequestPending from './';
-
-const ADDRESS = '0x1234567890123456789012345678901234567890';
-const TRANSACTION = {
- from: ADDRESS,
- gas: new BigNumber(21000),
- gasPrice: new BigNumber(20000000),
- value: new BigNumber(1)
-};
-const PAYLOAD_SENDTX = {
- sendTransaction: TRANSACTION
-};
-const PAYLOAD_SIGN = {
- sign: {
- address: ADDRESS,
- data: 'testing'
- }
-};
-const PAYLOAD_SIGNTX = {
- signTransaction: TRANSACTION
-};
-const PAYLOAD_DECRYPT = {
- decrypt: {
- address: ADDRESS,
- msg: 'testing'
- }
-};
-
-let component;
-let onConfirm;
-let onReject;
-
-function render (payload) {
- onConfirm = sinon.stub();
- onReject = sinon.stub();
-
- component = shallow(
-
- );
-
- return component;
-}
-
-describe('views/Signer/RequestPending', () => {
- describe('sendTransaction', () => {
- beforeEach(() => {
- render(PAYLOAD_SENDTX);
- });
-
- it('renders defaults', () => {
- expect(component).to.be.ok;
- });
-
- it('renders TransactionPending component', () => {
- expect(component.find('Connect(TransactionPending)')).to.have.length(1);
- });
- });
-
- describe('sign', () => {
- beforeEach(() => {
- render(PAYLOAD_SIGN);
- });
-
- it('renders defaults', () => {
- expect(component).to.be.ok;
- });
-
- it('renders SignRequest component', () => {
- expect(component.find('Connect(SignRequest)')).to.have.length(1);
- });
- });
-
- describe('signTransaction', () => {
- beforeEach(() => {
- render(PAYLOAD_SIGNTX);
- });
-
- it('renders defaults', () => {
- expect(component).to.be.ok;
- });
-
- it('renders TransactionPending component', () => {
- expect(component.find('Connect(TransactionPending)')).to.have.length(1);
- });
- });
-
- describe('decrypt', () => {
- beforeEach(() => {
- render(PAYLOAD_DECRYPT);
- });
-
- it('renders defaults', () => {
- expect(component).to.be.ok;
- });
-
- it('renders DecryptRequest component', () => {
- expect(component.find('Connect(DecryptRequest)')).to.have.length(1);
- });
- });
-});
diff --git a/js/src/Signer/components/SignRequest/index.js b/js/src/Signer/components/SignRequest/index.js
deleted file mode 100644
index 6a28008e4..000000000
--- a/js/src/Signer/components/SignRequest/index.js
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-export default from './signRequest';
diff --git a/js/src/Signer/components/SignRequest/signRequest.css b/js/src/Signer/components/SignRequest/signRequest.css
deleted file mode 100644
index a8b3ddd6d..000000000
--- a/js/src/Signer/components/SignRequest/signRequest.css
+++ /dev/null
@@ -1,91 +0,0 @@
-/* Copyright 2015-2017 Parity Technologies (UK) Ltd.
-/* This file is part of Parity.
-/*
-/* Parity is free software: you can redistribute it and/or modify
-/* it under the terms of the GNU General Public License as published by
-/* the Free Software Foundation, either version 3 of the License, or
-/* (at your option) any later version.
-/*
-/* Parity is distributed in the hope that it will be useful,
-/* but WITHOUT ANY WARRANTY; without even the implied warranty of
-/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-/* GNU General Public License for more details.
-/*
-/* You should have received a copy of the GNU General Public License
-/* along with Parity. If not, see .
-*/
-
-@import '../../_layout.css';
-
-.container {
- display: flex;
- padding: 1.5em 1em 1.5em 0;
-}
-
-.actions, .signDetails {
- vertical-align: middle;
- min-height: $pendingHeight;
-}
-
-.signData {
- border: 0.25em solid red;
- margin-left: 2em;
- padding: 0.5em;
- overflow: auto;
- max-height: 6em;
- max-width: calc(100% - 2em);
-}
-
-.signData > p {
- color: white;
-}
-
-.signDetails {
- flex: 1;
- overflow: auto;
-}
-
-.account img {
- display: inline-block;
- height: 50px;
- margin: 5px;
- width: 50px;
-}
-
-.address, .info {
- box-sizing: border-box;
- display: inline-block;
- vertical-align: top;
-}
-
-.address {
- width: 40%;
-}
-
-.info {
- color: #E53935;
- width: 60%;
-}
-
-.info p:first-child {
- margin-top: 0;
-}
-
-/* TODO [todr] copy&paste from transactions */
-.isConfirmed {
- color: green;
-}
-
-.isRejected {
- opacity: 0.7;
-}
-
-.txHash {
- display: block;
- word-break: break-all;
-}
-
-.actions {
- display: inline-block;
- min-height: $finishedHeight;
-}
diff --git a/js/src/Signer/components/SignRequest/signRequest.js b/js/src/Signer/components/SignRequest/signRequest.js
deleted file mode 100644
index b1428008d..000000000
--- a/js/src/Signer/components/SignRequest/signRequest.js
+++ /dev/null
@@ -1,232 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-import { observer } from 'mobx-react';
-import React, { Component } from 'react';
-import PropTypes from 'prop-types';
-import { FormattedMessage } from 'react-intl';
-import { connect } from 'react-redux';
-
-import HardwareStore from '@parity/shared/mobx/hardwareStore';
-
-import Account from '../Account';
-import TransactionPendingForm from '../TransactionPendingForm';
-import RequestOrigin from '../RequestOrigin';
-
-import styles from './signRequest.css';
-
-function isAscii (data) {
- for (var i = 2; i < data.length; i += 2) {
- let n = parseInt(data.substr(i, 2), 16);
-
- if (n < 32 || n >= 128) {
- return false;
- }
- }
- return true;
-}
-
-@observer
-class SignRequest extends Component {
- static contextTypes = {
- api: PropTypes.object
- };
-
- static propTypes = {
- accounts: PropTypes.object.isRequired,
- address: PropTypes.string.isRequired,
- data: PropTypes.string.isRequired,
- id: PropTypes.object.isRequired,
- isFinished: PropTypes.bool.isRequired,
- netVersion: PropTypes.string.isRequired,
- signerStore: PropTypes.object.isRequired,
-
- className: PropTypes.string,
- focus: PropTypes.bool,
- isSending: PropTypes.bool,
- onConfirm: PropTypes.func,
- onReject: PropTypes.func,
- origin: PropTypes.any,
- status: PropTypes.string
- };
-
- static defaultProps = {
- focus: false,
- origin: {
- type: 'unknown',
- details: ''
- }
- };
-
- hardwareStore = HardwareStore.get(this.context.api);
-
- componentWillMount () {
- const { address, signerStore } = this.props;
-
- signerStore.fetchBalance(address);
- }
-
- render () {
- const { className } = this.props;
-
- return (
-
- );
- }
-
- return (
-
- );
- }
-
- onConfirm = (data) => {
- const { id } = this.props;
- const { password, dataSigned, wallet } = data;
-
- this.props.onConfirm({ id, password, dataSigned, wallet });
- }
-
- onReject = () => {
- this.props.onReject(this.props.id);
- }
-}
-
-function mapStateToProps (state) {
- const { accounts } = state.personal;
-
- return {
- accounts
- };
-}
-
-export default connect(
- mapStateToProps,
- null
-)(SignRequest);
diff --git a/js/src/Signer/components/SignRequest/signRequest.spec.js b/js/src/Signer/components/SignRequest/signRequest.spec.js
deleted file mode 100644
index f5bd4f9b2..000000000
--- a/js/src/Signer/components/SignRequest/signRequest.spec.js
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-import { shallow } from 'enzyme';
-import React from 'react';
-import sinon from 'sinon';
-
-import SignRequest from './';
-
-let component;
-let reduxStore;
-let signerStore;
-
-function createSignerStore () {
- return {
- balances: {},
- fetchBalance: sinon.stub()
- };
-}
-
-function createReduxStore () {
- return {
- dispatch: sinon.stub(),
- subscribe: sinon.stub(),
- getState: () => {
- return {
- personal: {
- accounts: {}
- }
- };
- }
- };
-}
-
-function render () {
- reduxStore = createReduxStore();
- signerStore = createSignerStore();
-
- component = shallow(
- ,
- {
- context: {
- store: reduxStore
- }
- }
- ).find('SignRequest').shallow();
-
- return component;
-}
-
-describe('views/Signer/components/SignRequest', () => {
- beforeEach(() => {
- render();
- });
-
- it('renders', () => {
- expect(component).to.be.ok;
- });
-});
diff --git a/js/src/Signer/components/TransactionMainDetails/index.js b/js/src/Signer/components/TransactionMainDetails/index.js
deleted file mode 100644
index 1ad629866..000000000
--- a/js/src/Signer/components/TransactionMainDetails/index.js
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-export default from './transactionMainDetails';
diff --git a/js/src/Signer/components/TransactionMainDetails/transactionMainDetails.css b/js/src/Signer/components/TransactionMainDetails/transactionMainDetails.css
deleted file mode 100644
index 048a59c67..000000000
--- a/js/src/Signer/components/TransactionMainDetails/transactionMainDetails.css
+++ /dev/null
@@ -1,80 +0,0 @@
-/* Copyright 2015-2017 Parity Technologies (UK) Ltd.
-/* This file is part of Parity.
-/*
-/* Parity is free software: you can redistribute it and/or modify
-/* it under the terms of the GNU General Public License as published by
-/* the Free Software Foundation, either version 3 of the License, or
-/* (at your option) any later version.
-/*
-/* Parity is distributed in the hope that it will be useful,
-/* but WITHOUT ANY WARRANTY; without even the implied warranty of
-/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-/* GNU General Public License for more details.
-/*
-/* You should have received a copy of the GNU General Public License
-/* along with Parity. If not, see .
-*/
-
-@import '../../_layout.css';
-
-.account {
- text-align: center;
-}
-
-.contractIcon {
- background: #eee;
- width: 50px !important;
- height: 50px !important;
- box-sizing: border-box;
- border-radius: 50%;
- padding: 13px;
-}
-
-.editButtonRow {
- text-align: right;
-}
-
-.from {
- display: inline-block;
- width: 40%;
- vertical-align: top;
-
- .account {
- img {
- display: inline-block;
- width: 50px;
- height: 50px;
- margin: 5px;
- }
-
- span {
- display: block;
- }
- }
-}
-
-.method {
- display: inline-block;
- width: 60%;
- vertical-align: top;
- line-height: 1em;
-}
-
-.tx {
- position: relative;
- text-align: center;
- margin: 0 -75px;
- width: 150px;
- top: -20px;
- white-space: nowrap;
-}
-
-.total {
- font-size: 0.6em;
- opacity: .5;
-}
-
-.transaction {
- flex: 1;
- overflow: auto;
-}
diff --git a/js/src/Signer/components/TransactionMainDetails/transactionMainDetails.js b/js/src/Signer/components/TransactionMainDetails/transactionMainDetails.js
deleted file mode 100644
index a6f96d972..000000000
--- a/js/src/Signer/components/TransactionMainDetails/transactionMainDetails.js
+++ /dev/null
@@ -1,202 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-import React, { Component } from 'react';
-import PropTypes from 'prop-types';
-import { FormattedMessage } from 'react-intl';
-import ReactTooltip from 'react-tooltip';
-
-import { Button, MethodDecoding } from '@parity/ui';
-import { GasIcon } from '@parity/ui/Icons';
-
-import * as tUtil from '../util/transaction';
-import Account from '../Account';
-import RequestOrigin from '../RequestOrigin';
-
-import styles from './transactionMainDetails.css';
-
-export default class TransactionMainDetails extends Component {
- static propTypes = {
- children: PropTypes.node,
- disabled: PropTypes.bool,
- externalLink: PropTypes.string.isRequired,
- from: PropTypes.string.isRequired,
- fromBalance: PropTypes.object,
- gasStore: PropTypes.object,
- id: PropTypes.object.isRequired,
- netVersion: PropTypes.string.isRequired,
- origin: PropTypes.any,
- totalValue: PropTypes.object.isRequired,
- transaction: PropTypes.object.isRequired,
- value: PropTypes.object.isRequired
- };
-
- static defaultProps = {
- origin: {
- type: 'unknown',
- details: ''
- }
- };
-
- componentWillMount () {
- const { totalValue, value } = this.props;
-
- this.updateDisplayValues(value, totalValue);
- }
-
- componentWillReceiveProps (nextProps) {
- const { totalValue, value } = nextProps;
-
- this.updateDisplayValues(value, totalValue);
- }
-
- render () {
- const { children, disabled, externalLink, from, fromBalance, gasStore, netVersion, transaction, origin } = this.props;
-
- return (
-
- );
- }
-
- updateDisplayValues (value, totalValue) {
- this.setState({
- feeEth: tUtil.calcFeeInEth(totalValue, value),
- totalValueDisplay: tUtil.getTotalValueDisplay(totalValue),
- totalValueDisplayWei: tUtil.getTotalValueDisplayWei(totalValue),
- valueDisplay: tUtil.getValueDisplay(value),
- valueDisplayWei: tUtil.getValueDisplayWei(value)
- });
- }
-
- toggleGasEditor = () => {
- this.props.gasStore.setEditing(true);
- }
-}
diff --git a/js/src/Signer/components/TransactionPending/index.js b/js/src/Signer/components/TransactionPending/index.js
deleted file mode 100644
index 1dfcfb3e4..000000000
--- a/js/src/Signer/components/TransactionPending/index.js
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-export default from './transactionPending';
diff --git a/js/src/Signer/components/TransactionPending/transactionPending.css b/js/src/Signer/components/TransactionPending/transactionPending.css
deleted file mode 100644
index 61229eefb..000000000
--- a/js/src/Signer/components/TransactionPending/transactionPending.css
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright 2015-2017 Parity Technologies (UK) Ltd.
-/* This file is part of Parity.
-/*
-/* Parity is free software: you can redistribute it and/or modify
-/* it under the terms of the GNU General Public License as published by
-/* the Free Software Foundation, either version 3 of the License, or
-/* (at your option) any later version.
-/*
-/* Parity is distributed in the hope that it will be useful,
-/* but WITHOUT ANY WARRANTY; without even the implied warranty of
-/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-/* GNU General Public License for more details.
-/*
-/* You should have received a copy of the GNU General Public License
-/* along with Parity. If not, see .
-*/
-
-@import '../../_layout.css';
-
-.container {
- display: flex;
- padding: 1.5em 1em 1.5em 0;
-
- & > * {
- vertical-align: middle;
- }
-}
diff --git a/js/src/Signer/components/TransactionPending/transactionPending.js b/js/src/Signer/components/TransactionPending/transactionPending.js
deleted file mode 100644
index 2cb6314a0..000000000
--- a/js/src/Signer/components/TransactionPending/transactionPending.js
+++ /dev/null
@@ -1,204 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-import { observer } from 'mobx-react';
-import React, { Component } from 'react';
-import PropTypes from 'prop-types';
-import { FormattedMessage } from 'react-intl';
-import { connect } from 'react-redux';
-
-import HardwareStore from '@parity/shared/mobx/hardwareStore';
-import { Button, GasPriceEditor } from '@parity/ui';
-
-import TransactionMainDetails from '../TransactionMainDetails';
-import TransactionPendingForm from '../TransactionPendingForm';
-
-import styles from './transactionPending.css';
-
-import * as tUtil from '../util/transaction';
-
-@observer
-class TransactionPending extends Component {
- static contextTypes = {
- api: PropTypes.object.isRequired
- };
-
- static propTypes = {
- accounts: PropTypes.object.isRequired,
- className: PropTypes.string,
- date: PropTypes.instanceOf(Date).isRequired,
- focus: PropTypes.bool,
- gasLimit: PropTypes.object,
- id: PropTypes.object.isRequired,
- isSending: PropTypes.bool.isRequired,
- netVersion: PropTypes.string.isRequired,
- nonce: PropTypes.number,
- onConfirm: PropTypes.func.isRequired,
- onReject: PropTypes.func.isRequired,
- origin: PropTypes.any,
- signerStore: PropTypes.object.isRequired,
- transaction: PropTypes.shape({
- condition: PropTypes.object,
- data: PropTypes.string,
- from: PropTypes.string.isRequired,
- gas: PropTypes.object.isRequired,
- gasPrice: PropTypes.object.isRequired,
- to: PropTypes.string,
- value: PropTypes.object.isRequired
- }).isRequired
- };
-
- static defaultProps = {
- focus: false,
- origin: {
- type: 'unknown',
- details: ''
- }
- };
-
- gasStore = new GasPriceEditor.Store(this.context.api, {
- condition: this.props.transaction.condition,
- gas: this.props.transaction.gas.toFixed(),
- gasLimit: this.props.gasLimit,
- gasPrice: this.props.transaction.gasPrice.toFixed()
- });
-
- hardwareStore = HardwareStore.get(this.context.api);
-
- componentWillMount () {
- const { signerStore, transaction } = this.props;
- const { from, gas, gasPrice, to, value } = transaction;
-
- const fee = tUtil.getFee(gas, gasPrice); // BigNumber object
- const gasPriceEthmDisplay = tUtil.getEthmFromWeiDisplay(gasPrice);
- const gasToDisplay = tUtil.getGasDisplay(gas);
- const totalValue = tUtil.getTotalValue(fee, value);
-
- this.setState({ gasPriceEthmDisplay, totalValue, gasToDisplay });
- this.gasStore.setEthValue(value);
- signerStore.fetchBalances([from, to]);
- }
-
- render () {
- return this.gasStore.isEditing
- ? this.renderTxEditor()
- : this.renderTransaction();
- }
-
- renderTransaction () {
- const transaction = this.gasStore.overrideTransaction(this.props.transaction);
-
- const { accounts, className, focus, id, isSending, netVersion, origin, signerStore } = this.props;
- const { totalValue } = this.state;
- const { balances, externalLink } = signerStore;
- const { from, value } = transaction;
- const fromBalance = balances[from];
- const account = accounts[from] || {};
- const disabled = account.hardware && !this.hardwareStore.isConnected(from);
-
- return (
-
- );
- }
-
- onConfirm = (data) => {
- const { id, transaction } = this.props;
- const { password, txSigned, wallet } = data;
- const { condition, gas, gasPrice } = this.gasStore.overrideTransaction(transaction);
-
- const options = {
- gas,
- gasPrice,
- id,
- password,
- txSigned,
- wallet
- };
-
- if (condition && (condition.block || condition.time)) {
- options.condition = condition;
- }
-
- this.props.onConfirm(options);
- }
-
- onReject = () => {
- this.props.onReject(this.props.id);
- }
-
- toggleGasEditor = () => {
- this.gasStore.setEditing(false);
- }
-}
-
-function mapStateToProps (state) {
- const { accounts } = state.personal;
-
- return {
- accounts
- };
-}
-
-export default connect(
- mapStateToProps,
- null
-)(TransactionPending);
diff --git a/js/src/Signer/components/TransactionPendingForm/index.js b/js/src/Signer/components/TransactionPendingForm/index.js
deleted file mode 100644
index b6a8befba..000000000
--- a/js/src/Signer/components/TransactionPendingForm/index.js
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-export default from './transactionPendingForm';
diff --git a/js/src/Signer/components/TransactionPendingForm/transactionPendingForm.css b/js/src/Signer/components/TransactionPendingForm/transactionPendingForm.css
deleted file mode 100644
index 9380a54df..000000000
--- a/js/src/Signer/components/TransactionPendingForm/transactionPendingForm.css
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Copyright 2015-2017 Parity Technologies (UK) Ltd.
-/* This file is part of Parity.
-/*
-/* Parity is free software: you can redistribute it and/or modify
-/* it under the terms of the GNU General Public License as published by
-/* the Free Software Foundation, either version 3 of the License, or
-/* (at your option) any later version.
-/*
-/* Parity is distributed in the hope that it will be useful,
-/* but WITHOUT ANY WARRANTY; without even the implied warranty of
-/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-/* GNU General Public License for more details.
-/*
-/* You should have received a copy of the GNU General Public License
-/* along with Parity. If not, see .
-*/
-
-@import '../../_layout.css';
-
-.container {
- box-sizing: border-box;
- padding: 1em 0 0 2em;
- flex: 0 0 $statusWidth;
-}
-
-.rejectToggle {
- display: block;
- cursor: pointer;
- color: #00e;
- opacity: .7;
- transition: opacity .5s;
-}
-
-.rejectToggle:hover {
- opacity: 1;
- text-decoration: underline;
-}
-
-.rejectToggle svg {
- position: relative;
- width: 18px !important;
- height: 18px !important;
- top: 3px;
-}
diff --git a/js/src/Signer/components/TransactionPendingForm/transactionPendingForm.js b/js/src/Signer/components/TransactionPendingForm/transactionPendingForm.js
deleted file mode 100644
index 281d8e617..000000000
--- a/js/src/Signer/components/TransactionPendingForm/transactionPendingForm.js
+++ /dev/null
@@ -1,137 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-import React, { Component } from 'react';
-import PropTypes from 'prop-types';
-import { FormattedMessage } from 'react-intl';
-
-import { PrevIcon } from '@parity/ui/Icons';
-
-import TransactionPendingFormConfirm from '../TransactionPendingFormConfirm';
-import TransactionPendingFormReject from '../TransactionPendingFormReject';
-
-import styles from './transactionPendingForm.css';
-
-export default class TransactionPendingForm extends Component {
- static propTypes = {
- account: PropTypes.object,
- address: PropTypes.string.isRequired,
- className: PropTypes.string,
- disabled: PropTypes.bool,
- focus: PropTypes.bool,
- netVersion: PropTypes.string.isRequired,
- isSending: PropTypes.bool.isRequired,
- onConfirm: PropTypes.func.isRequired,
- onReject: PropTypes.func.isRequired,
- dataToSign: PropTypes.oneOfType([
- PropTypes.shape({
- transaction: PropTypes.object.isRequired
- }),
- PropTypes.shape({
- data: PropTypes.string.isRequired
- }),
- PropTypes.shape({
- decrypt: PropTypes.string.isRequired
- })
- ]).isRequired
- };
-
- static defaultProps = {
- account: {},
- focus: false
- };
-
- state = {
- isRejectOpen: false
- };
-
- render () {
- const { className } = this.props;
-
- return (
-
- );
- }
-
- renderForm () {
- const { account, address, disabled, focus, isSending, netVersion, onConfirm, onReject, dataToSign } = this.props;
-
- if (this.state.isRejectOpen) {
- return (
-
- );
- }
-
- return (
-
- );
- }
-
- renderRejectToggle () {
- const { isRejectOpen } = this.state;
- let html;
-
- if (!isRejectOpen) {
- html = (
-
-
-
- );
- } else {
- html = (
-
-
-
-
- );
- }
-
- return (
-
- { html }
-
- );
- }
-
- onToggleReject = () => {
- const { isRejectOpen } = this.state;
-
- this.setState({
- isRejectOpen: !isRejectOpen
- });
- }
-}
diff --git a/js/src/Signer/components/TransactionPendingFormConfirm/index.js b/js/src/Signer/components/TransactionPendingFormConfirm/index.js
deleted file mode 100644
index 1cba761a5..000000000
--- a/js/src/Signer/components/TransactionPendingFormConfirm/index.js
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-export default from './transactionPendingFormConfirm';
diff --git a/js/src/Signer/components/TransactionPendingFormConfirm/transactionPendingFormConfirm.css b/js/src/Signer/components/TransactionPendingFormConfirm/transactionPendingFormConfirm.css
deleted file mode 100644
index 3e5b86544..000000000
--- a/js/src/Signer/components/TransactionPendingFormConfirm/transactionPendingFormConfirm.css
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright 2015-2017 Parity Technologies (UK) Ltd.
-/* This file is part of Parity.
-/*
-/* Parity is free software: you can redistribute it and/or modify
-/* it under the terms of the GNU General Public License as published by
-/* the Free Software Foundation, either version 3 of the License, or
-/* (at your option) any later version.
-/*
-/* Parity is distributed in the hope that it will be useful,
-/* but WITHOUT ANY WARRANTY; without even the implied warranty of
-/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-/* GNU General Public License for more details.
-/*
-/* You should have received a copy of the GNU General Public License
-/* along with Parity. If not, see .
-*/
-.confirmForm {
- margin-top: -2em;
-}
-
-.confirmButton {
- display: block !important;
- margin-bottom: 10px;
- white-space: nowrap;
-}
-
-.signerIcon {
- vertical-align: middle;
-}
-
-.passwordHint {
- font-size: 0.75em;
- color: rgba(255, 255, 255, 0.5);
- margin-bottom: 0.75em;
-}
-
-.passwordHint span {
- opacity: 0.85;
-}
-
-.fileInput input {
- top: 22px;
-}
-
-.qr {
- margin-bottom: 0.5em;
- text-align: center;
-}
diff --git a/js/src/Signer/components/TransactionPendingFormConfirm/transactionPendingFormConfirm.js b/js/src/Signer/components/TransactionPendingFormConfirm/transactionPendingFormConfirm.js
deleted file mode 100644
index 633452347..000000000
--- a/js/src/Signer/components/TransactionPendingFormConfirm/transactionPendingFormConfirm.js
+++ /dev/null
@@ -1,580 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-import keycode from 'keycode';
-import React, { Component } from 'react';
-import PropTypes from 'prop-types';
-import ReactDOM from 'react-dom';
-import { FormattedMessage } from 'react-intl';
-import ReactTooltip from 'react-tooltip';
-
-import { generateTxQr, generateDecryptQr, generateDataQr } from '@parity/shared/util/qrscan';
-import { Button, Form, Input, IdentityIcon, QrCode, QrScan } from '@parity/ui';
-
-import styles from './transactionPendingFormConfirm.css';
-
-const QR_VISIBLE = 1;
-const QR_SCAN = 2;
-const QR_COMPLETED = 3;
-
-export default class TransactionPendingFormConfirm extends Component {
- static contextTypes = {
- api: PropTypes.object.isRequired
- };
-
- static propTypes = {
- account: PropTypes.object,
- address: PropTypes.string.isRequired,
- disabled: PropTypes.bool,
- focus: PropTypes.bool,
- netVersion: PropTypes.string.isRequired,
- isSending: PropTypes.bool.isRequired,
- onConfirm: PropTypes.func.isRequired,
- dataToSign: PropTypes.object.isRequired
- };
-
- static defaultProps = {
- account: {},
- focus: false
- };
-
- id = Math.random(); // for tooltip
-
- state = {
- password: '',
- qrState: QR_VISIBLE,
- qr: {},
- wallet: null,
- walletError: null
- }
-
- componentDidMount () {
- this.focus();
- }
-
- componentWillMount () {
- this.readNonce();
- this.subscribeNonce();
- }
-
- componentWillUnmount () {
- this.unsubscribeNonce();
- }
-
- componentWillReceiveProps (nextProps) {
- if (!this.props.focus && nextProps.focus) {
- this.focus(nextProps);
- }
- }
-
- focus (props = this.props) {
- if (props.focus) {
- const textNode = ReactDOM.findDOMNode(this.refs.input);
-
- if (!textNode) {
- return;
- }
-
- const inputNode = textNode.querySelector('input');
-
- inputNode && inputNode.focus();
- }
- }
-
- getPasswordHint () {
- const { account } = this.props;
- const accountHint = account.meta && account.meta.passwordHint;
-
- if (accountHint) {
- return accountHint;
- }
-
- const { wallet } = this.state;
- const walletHint = wallet && wallet.meta && wallet.meta.passwordHint;
-
- return walletHint || null;
- }
-
- // TODO: Now that we have 3 types, it would make sense splitting each into their own
- // sub-module and having the consistent bits combined (e.g. i18n, layouts)
- render () {
- const { account, address, disabled, isSending } = this.props;
- const { wallet, walletError } = this.state;
- const isAccount = account.external || account.hardware || account.uuid;
- const isWalletOk = isAccount || (walletError === null && wallet !== null);
- const confirmText = this.renderConfirmButton();
- const confirmButton = confirmText
- ? (
-
- );
- }
-
- // TODO: Split into sub-scomponent
- renderQrCode () {
- const { account } = this.props;
- const { qrState, qr } = this.state;
-
- if (!account.external || qrState !== QR_VISIBLE || !qr.value) {
- return null;
- }
-
- return (
-
- );
- }
-
- // TODO: Split into sub-scomponent
- renderQrScanner () {
- const { account } = this.props;
- const { qrState } = this.state;
-
- if (!account.external || qrState !== QR_SCAN) {
- return null;
- }
-
- return (
-
- );
- }
-
- renderKeyInput () {
- const { account } = this.props;
- const { walletError } = this.state;
-
- if (account.uuid || account.wallet || account.hardware || account.external) {
- return null;
- }
-
- return (
-
- }
- label={
-
- }
- onChange={ this.onKeySelect }
- type='file'
- />
- );
- }
-
- renderTooltip () {
- const { account } = this.props;
-
- if (this.state.password.length || account.hardware || account.external) {
- return null;
- }
-
- return (
-
-
-
- );
- }
-
- onScan = (signature) => {
- const { chainId, rlp, tx, data, decrypt } = this.state.qr;
-
- if (!signature) {
- return;
- }
-
- if (signature && signature.substr(0, 2) !== '0x') {
- signature = `0x${signature}`;
- }
-
- this.setState({ qrState: QR_COMPLETED });
-
- if (tx) {
- this.props.onConfirm({
- txSigned: {
- chainId,
- rlp,
- signature,
- tx
- }
- });
- return;
- }
-
- if (decrypt) {
- this.props.onConfirm({
- decrypted: {
- decrypt,
- msg: signature
- }
- });
- return;
- }
-
- this.props.onConfirm({
- dataSigned: {
- data,
- signature
- }
- });
- }
-
- onKeySelect = (event) => {
- // Check that file have been selected
- if (event.target.files.length === 0) {
- return this.setState({
- wallet: null,
- walletError: null
- });
- }
-
- const fileReader = new FileReader();
-
- fileReader.onload = (e) => {
- try {
- const wallet = JSON.parse(e.target.result);
-
- try {
- if (wallet && typeof wallet.meta === 'string') {
- wallet.meta = JSON.parse(wallet.meta);
- }
- } catch (e) {}
-
- this.setState({
- wallet,
- walletError: null
- });
- } catch (error) {
- this.setState({
- wallet: null,
- walletError: (
-
- )
- });
- }
- };
-
- fileReader.readAsText(event.target.files[0]);
- }
-
- onModifyPassword = (event) => {
- const password = event.target.value;
-
- this.setState({
- password
- });
- }
-
- onConfirm = () => {
- const { account } = this.props;
- const { password, qrState, wallet } = this.state;
-
- if (account.external && qrState === QR_VISIBLE) {
- return this.setState({ qrState: QR_SCAN });
- }
-
- this.props.onConfirm({
- password,
- wallet
- });
- }
-
- generateQr = () => {
- const { api } = this.context;
- const { netVersion, dataToSign } = this.props;
- const { transaction, data, decrypt } = dataToSign;
- const setState = qr => {
- this.setState({ qr });
- };
-
- if (transaction) {
- generateTxQr(api, netVersion, transaction).then(setState);
- return;
- }
-
- if (decrypt) {
- generateDecryptQr(decrypt).then(setState);
- return;
- }
-
- generateDataQr(data).then(setState);
- }
-
- onKeyDown = (event) => {
- const codeName = keycode(event);
-
- if (codeName !== 'enter') {
- return;
- }
-
- this.onConfirm();
- }
-
- // FIXME: Sadly the API subscription channels currently does not allow for specific values,
- // rather it can only do general queries where parameters are not specified. Hence we are
- // polling for the nonce here. Since we are moving to node-based subscriptions on the API layer,
- // this can be optimised when the subscription mechanism is reworked to conform.
- subscribeNonce () {
- const nonceTimerId = setInterval(this.readNonce, 1000);
-
- this.setState({ nonceTimerId });
- }
-
- unsubscribeNonce () {
- const { nonceTimerId } = this.state;
-
- if (!nonceTimerId) {
- return;
- }
-
- clearInterval(nonceTimerId);
- }
-
- readNonce = () => {
- const { api } = this.context;
- const { account, dataToSign } = this.props;
- const { qr } = this.state;
-
- if ((dataToSign.data || dataToSign.decrypt) && qr && !qr.value) {
- this.generateQr();
- return;
- }
-
- if (!account || !account.external || !api.transport.isConnected || !dataToSign.transaction) {
- return;
- }
-
- return api.parity
- .nextNonce(account.address)
- .then((newNonce) => {
- const { nonce } = this.state.qr;
-
- if (!nonce || !newNonce.eq(nonce)) {
- this.generateQr();
- }
- });
- }
-}
diff --git a/js/src/Signer/components/TransactionPendingFormConfirm/transactionPendingFormConfirm.spec.js b/js/src/Signer/components/TransactionPendingFormConfirm/transactionPendingFormConfirm.spec.js
deleted file mode 100644
index 2e984400d..000000000
--- a/js/src/Signer/components/TransactionPendingFormConfirm/transactionPendingFormConfirm.spec.js
+++ /dev/null
@@ -1,139 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-import { shallow } from 'enzyme';
-import React from 'react';
-import sinon from 'sinon';
-
-import TransactionPendingFormConfirm from './';
-
-const ADDR_NORMAL = '0x0123456789012345678901234567890123456789';
-const ADDR_WALLET = '0x1234567890123456789012345678901234567890';
-const ADDR_HARDWARE = '0x2345678901234567890123456789012345678901';
-const ADDR_SIGN = '0x3456789012345678901234567890123456789012';
-const ACCOUNTS = {
- [ADDR_NORMAL]: {
- address: ADDR_NORMAL,
- uuid: ADDR_NORMAL
- },
- [ADDR_WALLET]: {
- address: ADDR_WALLET,
- wallet: true
- },
- [ADDR_HARDWARE]: {
- address: ADDR_HARDWARE,
- hardware: true
- }
-};
-
-let component;
-let instance;
-let onConfirm;
-
-function render (address) {
- onConfirm = sinon.stub();
-
- component = shallow(
-
- );
- instance = component.instance();
-
- return component;
-}
-
-describe('views/Signer/TransactionPendingFormConfirm', () => {
- describe('normal accounts', () => {
- beforeEach(() => {
- render(ADDR_NORMAL);
- });
-
- it('renders defaults', () => {
- expect(component).to.be.ok;
- });
-
- it('does not render the key input', () => {
- expect(instance.renderKeyInput()).to.be.null;
- });
-
- it('renders the password', () => {
- expect(instance.renderPassword()).not.to.be.null;
- });
- });
-
- describe('hardware accounts', () => {
- beforeEach(() => {
- render(ADDR_HARDWARE);
- });
-
- it('renders defaults', () => {
- expect(component).to.be.ok;
- });
-
- it('does not render the key input', () => {
- expect(instance.renderKeyInput()).to.be.null;
- });
-
- it('does not render the password', () => {
- expect(instance.renderPassword()).to.be.null;
- });
- });
-
- describe('wallet accounts', () => {
- beforeEach(() => {
- render(ADDR_WALLET);
- });
-
- it('renders defaults', () => {
- expect(component).to.be.ok;
- });
-
- it('does not render the key input', () => {
- expect(instance.renderKeyInput()).to.be.null;
- });
-
- it('renders the password', () => {
- expect(instance.renderPassword()).not.to.be.null;
- });
- });
-
- describe('signing accounts', () => {
- beforeEach(() => {
- render(ADDR_SIGN);
- });
-
- it('renders defaults', () => {
- expect(component).to.be.ok;
- });
-
- it('renders the key input', () => {
- expect(instance.renderKeyInput()).not.to.be.null;
- });
-
- it('renders the password', () => {
- expect(instance.renderPassword()).not.to.be.null;
- });
-
- it('renders the hint', () => {
- expect(instance.renderHint()).to.be.null;
- });
- });
-});
diff --git a/js/src/Signer/components/TransactionPendingFormReject/index.js b/js/src/Signer/components/TransactionPendingFormReject/index.js
deleted file mode 100644
index 4149c4323..000000000
--- a/js/src/Signer/components/TransactionPendingFormReject/index.js
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-export default from './transactionPendingFormReject';
diff --git a/js/src/Signer/components/TransactionPendingFormReject/transactionPendingFormReject.css b/js/src/Signer/components/TransactionPendingFormReject/transactionPendingFormReject.css
deleted file mode 100644
index 1f0e1fd1e..000000000
--- a/js/src/Signer/components/TransactionPendingFormReject/transactionPendingFormReject.css
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Copyright 2015-2017 Parity Technologies (UK) Ltd.
-/* This file is part of Parity.
-/*
-/* Parity is free software: you can redistribute it and/or modify
-/* it under the terms of the GNU General Public License as published by
-/* the Free Software Foundation, either version 3 of the License, or
-/* (at your option) any later version.
-/*
-/* Parity is distributed in the hope that it will be useful,
-/* but WITHOUT ANY WARRANTY; without even the implied warranty of
-/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-/* GNU General Public License for more details.
-/*
-/* You should have received a copy of the GNU General Public License
-/* along with Parity. If not, see .
-*/
-
-/* the rejection button itself, once .reject has been pressed */
-.rejectButton {
- display: block !important;
- margin-bottom: 5px;
-}
-
-.rejectText {
- margin-bottom: 10px;
-}
diff --git a/js/src/Signer/components/TransactionPendingFormReject/transactionPendingFormReject.js b/js/src/Signer/components/TransactionPendingFormReject/transactionPendingFormReject.js
deleted file mode 100644
index d3606cc43..000000000
--- a/js/src/Signer/components/TransactionPendingFormReject/transactionPendingFormReject.js
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-import React, { Component } from 'react';
-import PropTypes from 'prop-types';
-import { FormattedMessage } from 'react-intl';
-
-import { Button } from '@parity/ui';
-
-import styles from './transactionPendingFormReject.css';
-
-export default class TransactionPendingFormReject extends Component {
- static propTypes = {
- onReject: PropTypes.func.isRequired,
- className: PropTypes.string
- };
-
- render () {
- const { onReject } = this.props;
-
- return (
-
-
-
-
-
-
-
-
-
- }
- />
-
- );
- }
-}
diff --git a/js/src/Signer/components/TxHashLink/index.js b/js/src/Signer/components/TxHashLink/index.js
deleted file mode 100644
index 534c6f2d6..000000000
--- a/js/src/Signer/components/TxHashLink/index.js
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-export default from './txHashLink';
diff --git a/js/src/Signer/components/TxHashLink/txHashLink.js b/js/src/Signer/components/TxHashLink/txHashLink.js
deleted file mode 100644
index a9146a815..000000000
--- a/js/src/Signer/components/TxHashLink/txHashLink.js
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-import React, { Component } from 'react';
-import PropTypes from 'prop-types';
-
-import { txLink } from '@parity/etherscan/links';
-
-export default class TxHashLink extends Component {
- static propTypes = {
- children: PropTypes.node,
- className: PropTypes.string,
- netVersion: PropTypes.string.isRequired,
- txHash: PropTypes.string.isRequired
- }
-
- render () {
- const { children, className, netVersion, txHash } = this.props;
-
- return (
-
- { children || txHash }
-
- );
- }
-}
diff --git a/js/src/Signer/components/util/logger.js b/js/src/Signer/components/util/logger.js
deleted file mode 100644
index 14abcb2b6..000000000
--- a/js/src/Signer/components/util/logger.js
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-const isLogging = process.env.LOGGING;
-
-export default logger();
-
-function logger () {
- return isLogging ? devLogger() : prodLogger();
-}
-
-function prodLogger () {
- return {
- log: noop,
- info: noop,
- error: noop,
- warn: noop
- };
-}
-
-function devLogger () {
- return console;
-}
-
-function noop () {}
diff --git a/js/src/Signer/components/util/react.js b/js/src/Signer/components/util/react.js
deleted file mode 100644
index 4ae260db2..000000000
--- a/js/src/Signer/components/util/react.js
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-import { isValidElement } from 'react';
-
-export function isReactComponent (componentOrElem) {
- return isValidElement(componentOrElem) && typeof componentOrElem.type === 'function';
-}
diff --git a/js/src/Signer/components/util/transaction.js b/js/src/Signer/components/util/transaction.js
deleted file mode 100644
index 4efdba58e..000000000
--- a/js/src/Signer/components/util/transaction.js
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-import BigNumber from 'bignumber.js';
-
-const WEI_TO_ETH_MULTIPLIER = 0.000000000000000001;
-const WEI_TO_SZABU_MULTIPLIER = 0.000000000001;
-
-export const getShortData = _getShortData;
-// calculations
-export const getFee = _getFee;
-export const calcFeeInEth = _calcFeeInEth;
-export const getTotalValue = _getTotalValue;
-// displays
-export const getSzaboFromWeiDisplay = _getSzaboFromWeiDisplay;
-export const getValueDisplay = _getValueDisplay;
-export const getValueDisplayWei = _getValueDisplayWei;
-export const getTotalValueDisplay = _getTotalValueDisplay;
-export const getTotalValueDisplayWei = _getTotalValueDisplayWei;
-export const getEthmFromWeiDisplay = _getEthmFromWeiDisplay;
-export const getGasDisplay = _getGasDisplay;
-
-function _getShortData (data) {
- if (data.length <= 3) {
- return data;
- }
- return data.substr(0, 3) + '...';
-}
-
-/*
- * @param {hex string} gas
- * @param {wei hex string} gasPrice
- * @return {BigNumber} fee in wei
- */
-function _getFee (gas, gasPrice) {
- gas = new BigNumber(gas);
- gasPrice = new BigNumber(gasPrice);
- return gasPrice.times(gas);
-}
-
-function _calcFeeInEth (totalValue, value) {
- let fee = new BigNumber(totalValue).sub(new BigNumber(value));
-
- return fee.times(WEI_TO_ETH_MULTIPLIER).toFormat(7);
-}
-
-/*
- * @param {wei BigNumber} fee
- * @param {wei hex string} value
- * @return {BigNumber} total value in wei
- */
-function _getTotalValue (fee, value) {
- value = new BigNumber(value);
- return fee.plus(value);
-}
-
-/*
- * @param {wei hex string} gasPrice
- * @return {string} szabo gas price with unit [szabo] i.e. 21,423 [szabo]
- */
-function _getSzaboFromWeiDisplay (gasPrice) {
- gasPrice = new BigNumber(gasPrice);
- return gasPrice.times(WEI_TO_SZABU_MULTIPLIER).toPrecision(5);
-}
-
-/*
- * @param {wei hex string} value
- * @return {string} value in WEI nicely formatted
- */
-function _getValueDisplay (value) {
- value = new BigNumber(value);
- return value.times(WEI_TO_ETH_MULTIPLIER).toFormat(5);
-}
-
-function _getValueDisplayWei (value) {
- value = new BigNumber(value);
- return value.toFormat(0);
-}
-
-/*
- * @param {wei hex string} totalValue
- * @return {string} total value (including fee) with units i.e. 1.32 [eth]
- */
-function _getTotalValueDisplay (totalValue) {
- totalValue = new BigNumber(totalValue);
- return totalValue.times(WEI_TO_ETH_MULTIPLIER).toFormat(5);
-}
-
-function _getTotalValueDisplayWei (totalValue) {
- totalValue = new BigNumber(totalValue);
- return totalValue.toFormat(0);
-}
-
-function _getEthmFromWeiDisplay (weiHexString) {
- const value = new BigNumber(weiHexString);
-
- return value.times(WEI_TO_ETH_MULTIPLIER).times(1e7).toFixed(5);
-}
-
-function _getGasDisplay (gas) {
- return new BigNumber(gas).times(1e-7).toFormat(4);
-}
diff --git a/js/src/Signer/components/util/transaction.spec.js b/js/src/Signer/components/util/transaction.spec.js
deleted file mode 100644
index 4be594ce7..000000000
--- a/js/src/Signer/components/util/transaction.spec.js
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-import BigNumber from 'bignumber.js';
-import { getShortData, getFee, getTotalValue } from './transaction';
-
-describe('Signer/components/util/transaction', () => {
- describe('getEstimatedMiningTime', () => {
- it('should return estimated mining time', () => {
- });
- });
-
- describe('getShortData', () => {
- it('should return short data', () => {
- // given
- const data = '0xh87dY78';
-
- // when
- const res = getShortData(data);
-
- // then
- expect(res).to.equal('0xh...');
- });
-
- it('should return data as is', () => {
- // given
- const data = '0x0';
-
- // when
- const shortData = getShortData(data);
-
- // then
- expect(shortData).to.equal('0x0');
- });
- });
-
- describe('getFee', () => {
- it('should return wei BigNumber object equals to gas * gasPrice', () => {
- // given
- const gas = '0x76c0'; // 30400
- const gasPrice = '0x9184e72a000'; // 10000000000000 wei
-
- // when
- const fee = getFee(gas, gasPrice);
-
- // then
- expect(fee).to.be.an.instanceOf(BigNumber);
- expect(fee.toString()).to.be.equal('304000000000000000'); // converting to string due to https://github.com/MikeMcl/bignumber.js/issues/11
- });
- });
-
- describe('getTotalValue', () => {
- it('should return wei BigNumber totalValue equals to value + fee', () => {
- // given
- const fee = new BigNumber(304000000000000000); // wei
- const value = '0x9184e72a'; // 2441406250 wei
-
- // when
- const totalValue = getTotalValue(fee, value);
-
- // then
- expect(totalValue).to.be.an.instanceOf(BigNumber);
- expect(totalValue.toString()).to.be.equal('304000002441406250'); // converting to string due to https://github.com/MikeMcl/bignumber.js/issues/11
- });
- });
-});
diff --git a/js/src/Signer/store.js b/js/src/Signer/store.js
deleted file mode 100644
index a18f4e209..000000000
--- a/js/src/Signer/store.js
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-import { isEqual } from 'lodash';
-import { action, observable } from 'mobx';
-
-export default class SignerStore {
- @observable balances = {};
- @observable localHashes = [];
-
- externalLink = '';
-
- constructor (api, withLocalTransactions = false, externalLink = '') {
- this._api = api;
- this._timeoutId = 0;
- this.externalLink = externalLink;
-
- if (withLocalTransactions) {
- this.fetchLocalTransactions();
- }
- }
-
- @action setBalance = (address, balance) => {
- this.setBalances({ [address]: balance });
- }
-
- @action setBalances = (balances) => {
- this.balances = Object.assign({}, this.balances, balances);
- }
-
- @action setLocalHashes = (localHashes = []) => {
- // Use slice to make sure they are both Arrays (MobX uses Objects for Observable Arrays)
- if (!isEqual(localHashes.slice(), this.localHashes.slice())) {
- this.localHashes = localHashes;
- }
- }
-
- @action unsubscribe () {
- if (this._timeoutId) {
- clearTimeout(this._timeoutId);
- }
- }
-
- fetchBalance (address) {
- this._api.eth
- .getBalance(address)
- .then((balance) => {
- this.setBalance(address, balance);
- })
- .catch((error) => {
- console.warn('Store:fetchBalance', error);
- });
- }
-
- fetchBalances (_addresses) {
- const addresses = _addresses.filter((address) => address) || [];
-
- if (!addresses.length) {
- return;
- }
-
- Promise
- .all(addresses.map((address) => this._api.eth.getBalance(address)))
- .then((_balances) => {
- this.setBalances(
- addresses.reduce((balances, address, index) => {
- balances[address] = _balances[index];
- return balances;
- }, {})
- );
- })
- .catch((error) => {
- console.warn('Store:fetchBalances', error);
- });
- }
-
- fetchLocalTransactions = () => {
- const nextTimeout = () => {
- this._timeoutId = setTimeout(this.fetchLocalTransactions, 1500);
- };
-
- this._api.parity
- .localTransactions()
- .then((localTransactions) => {
- const keys = Object
- .keys(localTransactions)
- .filter((key) => localTransactions[key].status !== 'canceled');
-
- this.setLocalHashes(keys);
- })
- .then(() => nextTimeout())
- .catch(() => nextTimeout());
- }
-}