From ef3a2b3ddfcfa7dcfff1e8121f0c3e036985a338 Mon Sep 17 00:00:00 2001 From: 6ea86b96 <6ea86b96@gmail.com> Date: Sat, 22 Apr 2017 21:01:57 +0700 Subject: [PATCH] Check address ownership --- ui/js/page/wallet/index.js | 2 ++ ui/js/page/wallet/view.jsx | 54 +++++++++++++++++++++----------------- ui/js/reducers/wallet.js | 12 +++++++++ 3 files changed, 44 insertions(+), 24 deletions(-) diff --git a/ui/js/page/wallet/index.js b/ui/js/page/wallet/index.js index 29a56012b..7976808f1 100644 --- a/ui/js/page/wallet/index.js +++ b/ui/js/page/wallet/index.js @@ -7,6 +7,7 @@ import { } from 'actions/app' import { doGetNewAddress, + doCheckAddressIsMine, } from 'actions/wallet' import { selectCurrentPage, @@ -34,6 +35,7 @@ const select = (state) => ({ const perform = (dispatch) => ({ closeModal: () => dispatch(doCloseModal()), getNewAddress: () => dispatch(doGetNewAddress()), + checkAddressIsMine: (address) => dispatch(doCheckAddressIsMine(address)) }) export default connect(select, perform)(WalletPage) diff --git a/ui/js/page/wallet/view.jsx b/ui/js/page/wallet/view.jsx index 7a7f9de0b..042b6415d 100644 --- a/ui/js/page/wallet/view.jsx +++ b/ui/js/page/wallet/view.jsx @@ -12,32 +12,38 @@ import { CreditAmount } from 'component/common'; -const AddressSection = (props) => { - const { - receiveAddress, - getNewAddress, - gettingNewAddress, - } = props +class AddressSection extends React.Component { + componentWillMount() { + this.props.checkAddressIsMine(this.props.receiveAddress) + } - return ( -
-
-

Wallet Address

-
-
-
-
-
- -
-
-
-

Other LBRY users may send credits to you by entering this address on the "Send" page.

-

You can generate a new address at any time, and any previous addresses will continue to work. Using multiple addresses can be helpful for keeping track of incoming payments from multiple sources.

+ render() { + const { + receiveAddress, + getNewAddress, + gettingNewAddress, + } = this.props + + return ( +
+
+

Wallet Address

-
-
- ); +
+
+
+
+ +
+
+
+

Other LBRY users may send credits to you by entering this address on the "Send" page.

+

You can generate a new address at any time, and any previous addresses will continue to work. Using multiple addresses can be helpful for keeping track of incoming payments from multiple sources.

+
+
+ + ); + } } var SendToAddressSection = React.createClass({ diff --git a/ui/js/reducers/wallet.js b/ui/js/reducers/wallet.js index 7a719f417..6628f394f 100644 --- a/ui/js/reducers/wallet.js +++ b/ui/js/reducers/wallet.js @@ -45,6 +45,18 @@ reducers[types.UPDATE_BALANCE] = function(state, action) { }) } +reducers[types.CHECK_ADDRESS_IS_MINE_STARTED] = function(state, action) { + return Object.assign({}, state, { + checkingAddressOwnership: true + }) +} + +reducers[types.CHECK_ADDRESS_IS_MINE_COMPLETED] = function(state, action) { + return Object.assign({}, state, { + checkingAddressOwnership: false + }) +} + export default function reducer(state = defaultState, action) { const handler = reducers[action.type]; if (handler) return handler(state, action);