Skip to content

Commit

Permalink
eth_sign where account === undefined (openethereum#4964)
Browse files Browse the repository at this point in the history
* Update for case where account === undefined

* Update tests to not mask account === undefined

* default account = {} where undefined (thanks @tomusdrw)
  • Loading branch information
jacogr authored Mar 21, 2017
1 parent 1a6f23a commit cb88110
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import styles from './transactionPendingFormConfirm.css';

export default class TransactionPendingFormConfirm extends Component {
static propTypes = {
account: PropTypes.object.isRequired,
account: PropTypes.object,
address: PropTypes.string.isRequired,
disabled: PropTypes.bool,
isSending: PropTypes.bool.isRequired,
Expand All @@ -36,6 +36,7 @@ export default class TransactionPendingFormConfirm extends Component {
};

static defaultProps = {
account: {},
focus: false
};

Expand Down Expand Up @@ -80,7 +81,7 @@ export default class TransactionPendingFormConfirm extends Component {

getPasswordHint () {
const { account } = this.props;
const accountHint = account && account.meta && account.meta.passwordHint;
const accountHint = account.meta && account.meta.passwordHint;

if (accountHint) {
return accountHint;
Expand Down Expand Up @@ -149,14 +150,16 @@ export default class TransactionPendingFormConfirm extends Component {
const { account } = this.props;
const { password } = this.state;

if (account && account.hardware) {
if (account.hardware) {
return null;
}

const isAccount = account.uuid;

return (
<Input
hint={
account.uuid
isAccount
? (
<FormattedMessage
id='signer.txPendingConfirm.password.unlock.hint'
Expand All @@ -171,7 +174,7 @@ export default class TransactionPendingFormConfirm extends Component {
)
}
label={
account.uuid
isAccount
? (
<FormattedMessage
id='signer.txPendingConfirm.password.unlock.label'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function render (address) {

component = shallow(
<TransactionPendingFormConfirm
account={ ACCOUNTS[address] || {} }
account={ ACCOUNTS[address] }
address={ address }
onConfirm={ onConfirm }
isSending={ false }
Expand Down Expand Up @@ -130,5 +130,9 @@ describe('views/Signer/TransactionPendingFormConfirm', () => {
it('renders the password', () => {
expect(instance.renderPassword()).not.to.be.null;
});

it('renders the hint', () => {
expect(instance.renderHint()).to.be.null;
});
});
});

0 comments on commit cb88110

Please sign in to comment.