Check address ownership

This commit is contained in:
6ea86b96 2017-04-22 21:01:57 +07:00 committed by Jeremy Kauffman
parent bd103ee956
commit 823a936c19
3 changed files with 44 additions and 24 deletions

View file

@ -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)

View file

@ -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 (
<section className="card">
<div className="card__title-primary">
<h3>Wallet Address</h3>
</div>
<div className="card__content">
<Address address={receiveAddress} />
</div>
<div className="card__actions">
<Link label="Get New Address" button="primary" icon='icon-refresh' onClick={getNewAddress} disabled={gettingNewAddress}/>
</div>
<div className="card__content">
<div className="help">
<p>Other LBRY users may send credits to you by entering this address on the "Send" page.</p>
<p>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.</p>
render() {
const {
receiveAddress,
getNewAddress,
gettingNewAddress,
} = this.props
return (
<section className="card">
<div className="card__title-primary">
<h3>Wallet Address</h3>
</div>
</div>
</section>
);
<div className="card__content">
<Address address={receiveAddress} />
</div>
<div className="card__actions">
<Link label="Get New Address" button="primary" icon='icon-refresh' onClick={getNewAddress} disabled={gettingNewAddress}/>
</div>
<div className="card__content">
<div className="help">
<p>Other LBRY users may send credits to you by entering this address on the "Send" page.</p>
<p>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.</p>
</div>
</div>
</section>
);
}
}
var SendToAddressSection = React.createClass({

View file

@ -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);