|
|
@ -9,7 +9,8 @@ const numericBalance = require('./util').numericBalance |
|
|
|
const addressSummary = require('./util').addressSummary |
|
|
|
const addressSummary = require('./util').addressSummary |
|
|
|
const EthBalance = require('./components/eth-balance') |
|
|
|
const EthBalance = require('./components/eth-balance') |
|
|
|
const ethUtil = require('ethereumjs-util') |
|
|
|
const ethUtil = require('ethereumjs-util') |
|
|
|
|
|
|
|
const RangeSlider = require('./components/range-slider') |
|
|
|
|
|
|
|
const Tooltip = require('./components/tooltip') |
|
|
|
module.exports = connect(mapStateToProps)(SendTransactionScreen) |
|
|
|
module.exports = connect(mapStateToProps)(SendTransactionScreen) |
|
|
|
|
|
|
|
|
|
|
|
function mapStateToProps (state) { |
|
|
|
function mapStateToProps (state) { |
|
|
@ -50,7 +51,7 @@ SendTransactionScreen.prototype.render = function () { |
|
|
|
// Sender Profile
|
|
|
|
// Sender Profile
|
|
|
|
//
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
h('.account-data-subsection.flex-column.flex-grow', { |
|
|
|
h('.account-data-subsection.flex-row.flex-grow', { |
|
|
|
style: { |
|
|
|
style: { |
|
|
|
margin: '0 20px', |
|
|
|
margin: '0 20px', |
|
|
|
}, |
|
|
|
}, |
|
|
@ -59,10 +60,9 @@ SendTransactionScreen.prototype.render = function () { |
|
|
|
// header - identicon + nav
|
|
|
|
// header - identicon + nav
|
|
|
|
h('.flex-row.flex-space-between', { |
|
|
|
h('.flex-row.flex-space-between', { |
|
|
|
style: { |
|
|
|
style: { |
|
|
|
marginTop: 28, |
|
|
|
marginTop: '15px', |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, [ |
|
|
|
}, [ |
|
|
|
|
|
|
|
|
|
|
|
// back button
|
|
|
|
// back button
|
|
|
|
h('i.fa.fa-arrow-left.fa-lg.cursor-pointer.color-orange', { |
|
|
|
h('i.fa.fa-arrow-left.fa-lg.cursor-pointer.color-orange', { |
|
|
|
onClick: this.back.bind(this), |
|
|
|
onClick: this.back.bind(this), |
|
|
@ -77,42 +77,53 @@ SendTransactionScreen.prototype.render = function () { |
|
|
|
]), |
|
|
|
]), |
|
|
|
|
|
|
|
|
|
|
|
// invisible place holder
|
|
|
|
// invisible place holder
|
|
|
|
h('i.fa.fa-users.fa-lg.invisible'), |
|
|
|
h('i.fa.fa-users.fa-lg.invisible', { |
|
|
|
|
|
|
|
style: { |
|
|
|
|
|
|
|
marginTop: '28px', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}), |
|
|
|
|
|
|
|
|
|
|
|
]), |
|
|
|
]), |
|
|
|
|
|
|
|
|
|
|
|
// account label
|
|
|
|
// account label
|
|
|
|
h('h2.font-medium.color-forest.flex-center', { |
|
|
|
|
|
|
|
style: { |
|
|
|
|
|
|
|
paddingTop: 8, |
|
|
|
|
|
|
|
marginBottom: 8, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, identity && identity.name), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// address and getter actions
|
|
|
|
h('.flex-column', { |
|
|
|
h('.flex-row.flex-center', { |
|
|
|
|
|
|
|
style: { |
|
|
|
style: { |
|
|
|
marginBottom: 8, |
|
|
|
marginTop: '10px', |
|
|
|
|
|
|
|
alignItems: 'flex-start', |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, [ |
|
|
|
}, [ |
|
|
|
|
|
|
|
h('h2.font-medium.color-forest.flex-center', { |
|
|
|
|
|
|
|
style: { |
|
|
|
|
|
|
|
paddingTop: '8px', |
|
|
|
|
|
|
|
marginBottom: '8px', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, identity && identity.name), |
|
|
|
|
|
|
|
|
|
|
|
h('div', { |
|
|
|
// address and getter actions
|
|
|
|
|
|
|
|
h('.flex-row.flex-center', { |
|
|
|
style: { |
|
|
|
style: { |
|
|
|
lineHeight: '16px', |
|
|
|
marginBottom: '8px', |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, addressSummary(address)), |
|
|
|
}, [ |
|
|
|
|
|
|
|
|
|
|
|
]), |
|
|
|
h('div', { |
|
|
|
|
|
|
|
style: { |
|
|
|
|
|
|
|
lineHeight: '16px', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, addressSummary(address)), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
]), |
|
|
|
|
|
|
|
|
|
|
|
// balance
|
|
|
|
// balance
|
|
|
|
h('.flex-row.flex-center', [ |
|
|
|
h('.flex-row.flex-center', [ |
|
|
|
|
|
|
|
|
|
|
|
h(EthBalance, { |
|
|
|
h(EthBalance, { |
|
|
|
value: account && account.balance, |
|
|
|
value: account && account.balance, |
|
|
|
}), |
|
|
|
}), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
]), |
|
|
|
]), |
|
|
|
]), |
|
|
|
|
|
|
|
|
|
|
|
]), |
|
|
|
]), |
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
//
|
|
|
@ -123,8 +134,8 @@ SendTransactionScreen.prototype.render = function () { |
|
|
|
style: { |
|
|
|
style: { |
|
|
|
background: '#EBEBEB', |
|
|
|
background: '#EBEBEB', |
|
|
|
color: '#AEAEAE', |
|
|
|
color: '#AEAEAE', |
|
|
|
marginTop: 32, |
|
|
|
marginTop: '15px', |
|
|
|
marginBottom: 16, |
|
|
|
marginBottom: '16px', |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, [ |
|
|
|
}, [ |
|
|
|
'Send Transaction', |
|
|
|
'Send Transaction', |
|
|
@ -152,7 +163,7 @@ SendTransactionScreen.prototype.render = function () { |
|
|
|
placeholder: 'Amount', |
|
|
|
placeholder: 'Amount', |
|
|
|
type: 'number', |
|
|
|
type: 'number', |
|
|
|
style: { |
|
|
|
style: { |
|
|
|
marginRight: 6, |
|
|
|
marginRight: '6px', |
|
|
|
}, |
|
|
|
}, |
|
|
|
dataset: { |
|
|
|
dataset: { |
|
|
|
persistentFormId: 'tx-amount', |
|
|
|
persistentFormId: 'tx-amount', |
|
|
@ -171,20 +182,19 @@ SendTransactionScreen.prototype.render = function () { |
|
|
|
//
|
|
|
|
//
|
|
|
|
// Optional Fields
|
|
|
|
// Optional Fields
|
|
|
|
//
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
h('h3.flex-center.text-transform-uppercase', { |
|
|
|
h('h3.flex-center.text-transform-uppercase', { |
|
|
|
style: { |
|
|
|
style: { |
|
|
|
background: '#EBEBEB', |
|
|
|
background: '#EBEBEB', |
|
|
|
color: '#AEAEAE', |
|
|
|
color: '#AEAEAE', |
|
|
|
marginTop: 16, |
|
|
|
marginTop: '16px', |
|
|
|
marginBottom: 16, |
|
|
|
marginBottom: '16px', |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, [ |
|
|
|
}, [ |
|
|
|
'Transactional Data (optional)', |
|
|
|
'Transactional Data (optional)', |
|
|
|
]), |
|
|
|
]), |
|
|
|
|
|
|
|
|
|
|
|
// 'data' field
|
|
|
|
// 'data' field
|
|
|
|
h('section.flex-row.flex-center', [ |
|
|
|
h('section.flex-column.flex-center', [ |
|
|
|
h('input.large-input', { |
|
|
|
h('input.large-input', { |
|
|
|
name: 'txData', |
|
|
|
name: 'txData', |
|
|
|
placeholder: '0x01234', |
|
|
|
placeholder: '0x01234', |
|
|
@ -197,6 +207,75 @@ SendTransactionScreen.prototype.render = function () { |
|
|
|
}, |
|
|
|
}, |
|
|
|
}), |
|
|
|
}), |
|
|
|
]), |
|
|
|
]), |
|
|
|
|
|
|
|
// custom gas field
|
|
|
|
|
|
|
|
h('h3.flex-center.text-transform-uppercase', { |
|
|
|
|
|
|
|
style: { |
|
|
|
|
|
|
|
background: '#EBEBEB', |
|
|
|
|
|
|
|
color: '#AEAEAE', |
|
|
|
|
|
|
|
marginBottom: '5px', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, [ |
|
|
|
|
|
|
|
'Transaction Fee (optional)', |
|
|
|
|
|
|
|
h(Tooltip, { |
|
|
|
|
|
|
|
title: ` |
|
|
|
|
|
|
|
This is used to set the transactions |
|
|
|
|
|
|
|
gas price. seting it to 100% will use |
|
|
|
|
|
|
|
the full recomend value. |
|
|
|
|
|
|
|
`,
|
|
|
|
|
|
|
|
}, [ |
|
|
|
|
|
|
|
h('i.fa.fa-question-circle', { |
|
|
|
|
|
|
|
style: { |
|
|
|
|
|
|
|
marginLeft: '5px', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}), |
|
|
|
|
|
|
|
]), |
|
|
|
|
|
|
|
]), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
h('section.flex-column.flex-center', [ |
|
|
|
|
|
|
|
h('.flex-row', [ |
|
|
|
|
|
|
|
h(RangeSlider, { |
|
|
|
|
|
|
|
name: 'gasInput', |
|
|
|
|
|
|
|
options: { |
|
|
|
|
|
|
|
mirrorInput: true, |
|
|
|
|
|
|
|
defaultValue: 100, |
|
|
|
|
|
|
|
min: 80, |
|
|
|
|
|
|
|
max: 220, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
style: { |
|
|
|
|
|
|
|
container: { |
|
|
|
|
|
|
|
marginBottom: '16px', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
range: { |
|
|
|
|
|
|
|
width: '68vw', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
input: { |
|
|
|
|
|
|
|
width: '5em', |
|
|
|
|
|
|
|
marginLeft: '5px', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
h('div', { |
|
|
|
|
|
|
|
style: { |
|
|
|
|
|
|
|
fontSize: '12px', |
|
|
|
|
|
|
|
paddingTop: '8px', |
|
|
|
|
|
|
|
paddingLeft: '5px', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, '%'), |
|
|
|
|
|
|
|
]), |
|
|
|
|
|
|
|
h('.flex-row', { |
|
|
|
|
|
|
|
style: { |
|
|
|
|
|
|
|
justifyContent: 'space-between', |
|
|
|
|
|
|
|
width: '243px', |
|
|
|
|
|
|
|
position: 'relative', |
|
|
|
|
|
|
|
fontSize: '12px', |
|
|
|
|
|
|
|
right: '42px', |
|
|
|
|
|
|
|
bottom: '30px', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, [ |
|
|
|
|
|
|
|
h('span', 'Cheaper'), h('span', 'Faster'), |
|
|
|
|
|
|
|
]), |
|
|
|
|
|
|
|
]), |
|
|
|
]) |
|
|
|
]) |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
@ -211,11 +290,12 @@ SendTransactionScreen.prototype.back = function () { |
|
|
|
this.props.dispatch(actions.backToAccountDetail(address)) |
|
|
|
this.props.dispatch(actions.backToAccountDetail(address)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
SendTransactionScreen.prototype.onSubmit = function () { |
|
|
|
SendTransactionScreen.prototype.onSubmit = function (gasPrice) { |
|
|
|
const recipient = document.querySelector('input[name="address"]').value |
|
|
|
const recipient = document.querySelector('input[name="address"]').value |
|
|
|
const input = document.querySelector('input[name="amount"]').value |
|
|
|
const input = document.querySelector('input[name="amount"]').value |
|
|
|
const value = util.normalizeEthStringToWei(input) |
|
|
|
const value = util.normalizeEthStringToWei(input) |
|
|
|
const txData = document.querySelector('input[name="txData"]').value |
|
|
|
const txData = document.querySelector('input[name="txData"]').value |
|
|
|
|
|
|
|
const gasMultiplier = document.querySelector('input[name="gasInput"]').value |
|
|
|
const balance = this.props.balance |
|
|
|
const balance = this.props.balance |
|
|
|
let message |
|
|
|
let message |
|
|
|
|
|
|
|
|
|
|
@ -243,6 +323,6 @@ SendTransactionScreen.prototype.onSubmit = function () { |
|
|
|
|
|
|
|
|
|
|
|
if (recipient) txParams.to = ethUtil.addHexPrefix(recipient) |
|
|
|
if (recipient) txParams.to = ethUtil.addHexPrefix(recipient) |
|
|
|
if (txData) txParams.data = txData |
|
|
|
if (txData) txParams.data = txData |
|
|
|
|
|
|
|
txParams.gasMultiplier = gasMultiplier * 0.01 |
|
|
|
this.props.dispatch(actions.signTx(txParams)) |
|
|
|
this.props.dispatch(actions.signTx(txParams)) |
|
|
|
} |
|
|
|
} |
|
|
|