eth_sign where account === undefined (#4964)
* Update for case where account === undefined * Update tests to not mask account === undefined * default account = {} where undefined (thanks @tomusdrw)
This commit is contained in:
parent
1a6f23ad2b
commit
cb881108c3
@ -27,7 +27,7 @@ import styles from './transactionPendingFormConfirm.css';
|
|||||||
|
|
||||||
export default class TransactionPendingFormConfirm extends Component {
|
export default class TransactionPendingFormConfirm extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
account: PropTypes.object.isRequired,
|
account: PropTypes.object,
|
||||||
address: PropTypes.string.isRequired,
|
address: PropTypes.string.isRequired,
|
||||||
disabled: PropTypes.bool,
|
disabled: PropTypes.bool,
|
||||||
isSending: PropTypes.bool.isRequired,
|
isSending: PropTypes.bool.isRequired,
|
||||||
@ -36,6 +36,7 @@ export default class TransactionPendingFormConfirm extends Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
|
account: {},
|
||||||
focus: false
|
focus: false
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -80,7 +81,7 @@ export default class TransactionPendingFormConfirm extends Component {
|
|||||||
|
|
||||||
getPasswordHint () {
|
getPasswordHint () {
|
||||||
const { account } = this.props;
|
const { account } = this.props;
|
||||||
const accountHint = account && account.meta && account.meta.passwordHint;
|
const accountHint = account.meta && account.meta.passwordHint;
|
||||||
|
|
||||||
if (accountHint) {
|
if (accountHint) {
|
||||||
return accountHint;
|
return accountHint;
|
||||||
@ -149,14 +150,16 @@ export default class TransactionPendingFormConfirm extends Component {
|
|||||||
const { account } = this.props;
|
const { account } = this.props;
|
||||||
const { password } = this.state;
|
const { password } = this.state;
|
||||||
|
|
||||||
if (account && account.hardware) {
|
if (account.hardware) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isAccount = account.uuid;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Input
|
<Input
|
||||||
hint={
|
hint={
|
||||||
account.uuid
|
isAccount
|
||||||
? (
|
? (
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='signer.txPendingConfirm.password.unlock.hint'
|
id='signer.txPendingConfirm.password.unlock.hint'
|
||||||
@ -171,7 +174,7 @@ export default class TransactionPendingFormConfirm extends Component {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
label={
|
label={
|
||||||
account.uuid
|
isAccount
|
||||||
? (
|
? (
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='signer.txPendingConfirm.password.unlock.label'
|
id='signer.txPendingConfirm.password.unlock.label'
|
||||||
|
@ -48,7 +48,7 @@ function render (address) {
|
|||||||
|
|
||||||
component = shallow(
|
component = shallow(
|
||||||
<TransactionPendingFormConfirm
|
<TransactionPendingFormConfirm
|
||||||
account={ ACCOUNTS[address] || {} }
|
account={ ACCOUNTS[address] }
|
||||||
address={ address }
|
address={ address }
|
||||||
onConfirm={ onConfirm }
|
onConfirm={ onConfirm }
|
||||||
isSending={ false }
|
isSending={ false }
|
||||||
@ -130,5 +130,9 @@ describe('views/Signer/TransactionPendingFormConfirm', () => {
|
|||||||
it('renders the password', () => {
|
it('renders the password', () => {
|
||||||
expect(instance.renderPassword()).not.to.be.null;
|
expect(instance.renderPassword()).not.to.be.null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('renders the hint', () => {
|
||||||
|
expect(instance.renderHint()).to.be.null;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user