mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Convert ConfirmTxScreen component to use JSX (#7559)
This commit is contained in:
parent
caefda5f47
commit
921134bad1
@ -1,6 +1,5 @@
|
||||
import React, {Component} from 'react'
|
||||
const inherits = require('util').inherits
|
||||
const Component = require('react').Component
|
||||
const h = require('react-hyperscript')
|
||||
const connect = require('react-redux').connect
|
||||
const { withRouter } = require('react-router-dom')
|
||||
const { compose } = require('recompose')
|
||||
@ -148,35 +147,41 @@ ConfirmTxScreen.prototype.signatureSelect = function (type, version) {
|
||||
}
|
||||
|
||||
ConfirmTxScreen.prototype.render = function () {
|
||||
const props = this.props
|
||||
const {
|
||||
currentCurrency,
|
||||
blockGasLimit,
|
||||
conversionRate,
|
||||
} = props
|
||||
} = this.props
|
||||
|
||||
var txData = this.getTxData() || {}
|
||||
const { msgParams, type, msgParams: { version } } = txData
|
||||
log.debug('msgParams detected, rendering pending msg')
|
||||
|
||||
return msgParams ? h(this.signatureSelect(type, version), {
|
||||
// Properties
|
||||
txData: txData,
|
||||
key: txData.id,
|
||||
selectedAddress: props.selectedAddress,
|
||||
accounts: props.accounts,
|
||||
identities: props.identities,
|
||||
conversionRate,
|
||||
currentCurrency,
|
||||
blockGasLimit,
|
||||
// Actions
|
||||
signMessage: this.signMessage.bind(this, txData),
|
||||
signPersonalMessage: this.signPersonalMessage.bind(this, txData),
|
||||
signTypedMessage: this.signTypedMessage.bind(this, txData),
|
||||
cancelMessage: this.cancelMessage.bind(this, txData),
|
||||
cancelPersonalMessage: this.cancelPersonalMessage.bind(this, txData),
|
||||
cancelTypedMessage: this.cancelTypedMessage.bind(this, txData),
|
||||
}) : h(Loading)
|
||||
if (!msgParams) {
|
||||
return (
|
||||
<Loading />
|
||||
)
|
||||
}
|
||||
|
||||
const SigComponent = this.signatureSelect(type, version)
|
||||
return (
|
||||
<SigComponent
|
||||
txData={txData}
|
||||
key={txData.id}
|
||||
selectedAddress={this.props.selectedAddress}
|
||||
accounts={this.props.accounts}
|
||||
identities={this.props.identities}
|
||||
conversionRate={conversionRate}
|
||||
currentCurrency={currentCurrency}
|
||||
blockGasLimit={blockGasLimit}
|
||||
signMessage={this.signMessage.bind(this, txData)}
|
||||
signPersonalMessage={this.signPersonalMessage.bind(this, txData)}
|
||||
signTypedMessage={this.signTypedMessage.bind(this, txData)}
|
||||
cancelMessage={this.cancelMessage.bind(this, txData)}
|
||||
cancelPersonalMessage={this.cancelPersonalMessage.bind(this, txData)}
|
||||
cancelTypedMessage={this.cancelTypedMessage.bind(this, txData)}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
ConfirmTxScreen.prototype.signMessage = function (msgData, event) {
|
||||
|
Loading…
Reference in New Issue
Block a user