Cleanup handler determination

This commit is contained in:
Jaco Greeff 2017-09-07 12:31:32 +02:00
parent 1d8886fa7d
commit afb101e234

View File

@ -91,21 +91,34 @@ class Embedded extends Component {
); );
} }
renderPending = (data, index) => { findPluginHandler (data) {
const { accounts, actions, gasLimit, netVersion } = this.props; const { accounts } = this.props;
const { date, id, isSending, payload, origin } = data; const { payload } = data;
const transaction = payload.sendTransaction || payload.signTransaction;
let Handler;
if (transaction) { let account;
Handler = this.pluginStore.findHandler(payload, accounts[transaction.from]);
if (payload.decrypt) {
account = accounts[payload.decrypt.address];
} else if (payload.sign) {
account = accounts[payload.sign.address];
} else if (payload.sendTransaction) {
account = accounts[payload.sendTransaction.from];
} else if (payload.signTransaction) {
account = accounts[payload.signTransaction.from];
} }
return this.pluginStore.findHandler(payload, account);
}
renderPending = (data, index) => {
const { actions, gasLimit, netVersion } = this.props;
const { date, id, isSending, payload, origin } = data;
return ( return (
<RequestPending <RequestPending
className={ styles.request } className={ styles.request }
date={ date } date={ date }
elementRequest={ Handler } elementRequest={ this.findPluginHandler(data) }
focus={ index === 0 } focus={ index === 0 }
gasLimit={ gasLimit } gasLimit={ gasLimit }
id={ id } id={ id }