aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components
diff options
context:
space:
mode:
authorChi Kei Chan <chikeichan@gmail.com>2017-12-21 09:38:28 +0800
committerGitHub <noreply@github.com>2017-12-21 09:38:28 +0800
commit9959aea5987a123209c962632d54e503f1d458a5 (patch)
treecdb705c11731a59d59b8015918b260a07f159f8b /ui/app/components
parent7915e62d65de1bbc3419cba58f69e6d55a4df3ea (diff)
parente7e1b7a95180597308bd167bd4a152bbbf53ff21 (diff)
downloadtangerine-wallet-browser-9959aea5987a123209c962632d54e503f1d458a5.tar.gz
tangerine-wallet-browser-9959aea5987a123209c962632d54e503f1d458a5.tar.zst
tangerine-wallet-browser-9959aea5987a123209c962632d54e503f1d458a5.zip
Merge branch 'NewUI-flat' into merge-master-to-newUI-flat-dec20
Diffstat (limited to 'ui/app/components')
-rw-r--r--ui/app/components/pending-tx/confirm-send-ether.js24
-rw-r--r--ui/app/components/pending-tx/confirm-send-token.js38
-rw-r--r--ui/app/components/send/send-constants.js3
-rw-r--r--ui/app/components/send/send-v2-container.js3
4 files changed, 11 insertions, 57 deletions
diff --git a/ui/app/components/pending-tx/confirm-send-ether.js b/ui/app/components/pending-tx/confirm-send-ether.js
index 1264da153..566224864 100644
--- a/ui/app/components/pending-tx/confirm-send-ether.js
+++ b/ui/app/components/pending-tx/confirm-send-ether.js
@@ -421,7 +421,9 @@ ConfirmSendEther.prototype.onSubmit = function (event) {
ConfirmSendEther.prototype.cancel = function (event, txMeta) {
event.preventDefault()
- this.props.cancelTransaction(txMeta)
+ const { cancelTransaction } = this.props
+
+ cancelTransaction(txMeta)
}
ConfirmSendEther.prototype.checkValidity = function () {
@@ -445,26 +447,6 @@ ConfirmSendEther.prototype.gatherTxMeta = function () {
const state = this.state
const txData = clone(state.txData) || clone(props.txData)
- if (props.send.editingTransactionId) {
- const {
- send: {
- memo,
- amount: value,
- gasLimit: gas,
- gasPrice,
- },
- } = props
- const { txParams: { from, to } } = txData
- txData.txParams = {
- from: ethUtil.addHexPrefix(from),
- to: ethUtil.addHexPrefix(to),
- memo: memo && ethUtil.addHexPrefix(memo),
- value: ethUtil.addHexPrefix(value),
- gas: ethUtil.addHexPrefix(gas),
- gasPrice: ethUtil.addHexPrefix(gasPrice),
- }
- }
-
// log.debug(`UI has defaulted to tx meta ${JSON.stringify(txData)}`)
return txData
}
diff --git a/ui/app/components/pending-tx/confirm-send-token.js b/ui/app/components/pending-tx/confirm-send-token.js
index 727cd260b..aa4f29fb0 100644
--- a/ui/app/components/pending-tx/confirm-send-token.js
+++ b/ui/app/components/pending-tx/confirm-send-token.js
@@ -2,7 +2,6 @@ const Component = require('react').Component
const { connect } = require('react-redux')
const h = require('react-hyperscript')
const inherits = require('util').inherits
-const ethAbi = require('ethereumjs-abi')
const tokenAbi = require('human-standard-token-abi')
const abiDecoder = require('abi-decoder')
abiDecoder.addABI(tokenAbi)
@@ -415,7 +414,9 @@ ConfirmSendToken.prototype.onSubmit = function (event) {
ConfirmSendToken.prototype.cancel = function (event, txMeta) {
event.preventDefault()
- this.props.cancelTransaction(txMeta)
+ const { cancelTransaction } = this.props
+
+ cancelTransaction(txMeta)
}
ConfirmSendToken.prototype.checkValidity = function () {
@@ -439,39 +440,6 @@ ConfirmSendToken.prototype.gatherTxMeta = function () {
const state = this.state
const txData = clone(state.txData) || clone(props.txData)
- if (props.send.editingTransactionId) {
- const {
- send: {
- memo,
- amount,
- gasLimit: gas,
- gasPrice,
- to,
- },
- } = props
-
- const { txParams: { from, to: tokenAddress } } = txData
-
- const tokenParams = {
- from: ethUtil.addHexPrefix(from),
- value: '0',
- gas: ethUtil.addHexPrefix(gas),
- gasPrice: ethUtil.addHexPrefix(gasPrice),
- }
-
- const data = '0xa9059cbb' + Array.prototype.map.call(
- ethAbi.rawEncode(['address', 'uint256'], [to, ethUtil.addHexPrefix(amount)]),
- x => ('00' + x.toString(16)).slice(-2)
- ).join('')
-
- txData.txParams = {
- ...tokenParams,
- to: ethUtil.addHexPrefix(tokenAddress),
- memo: memo && ethUtil.addHexPrefix(memo),
- data,
- }
- }
-
// log.debug(`UI has defaulted to tx meta ${JSON.stringify(txData)}`)
return txData
}
diff --git a/ui/app/components/send/send-constants.js b/ui/app/components/send/send-constants.js
index 9c240972f..b3ee0899a 100644
--- a/ui/app/components/send/send-constants.js
+++ b/ui/app/components/send/send-constants.js
@@ -20,6 +20,8 @@ const MIN_GAS_TOTAL = multiplyCurrencies(MIN_GAS_LIMIT_HEX, MIN_GAS_PRICE_HEX, {
multiplierBase: 16,
})
+const TOKEN_TRANSFER_FUNCTION_SIGNATURE = '0xa9059cbb'
+
module.exports = {
MIN_GAS_PRICE_GWEI,
MIN_GAS_PRICE_HEX,
@@ -27,4 +29,5 @@ module.exports = {
MIN_GAS_LIMIT_HEX,
MIN_GAS_LIMIT_DEC,
MIN_GAS_TOTAL,
+ TOKEN_TRANSFER_FUNCTION_SIGNATURE,
}
diff --git a/ui/app/components/send/send-v2-container.js b/ui/app/components/send/send-v2-container.js
index 655de8897..2d2ed4546 100644
--- a/ui/app/components/send/send-v2-container.js
+++ b/ui/app/components/send/send-v2-container.js
@@ -50,6 +50,7 @@ function mapStateToProps (state) {
data,
amountConversionRate: selectedToken ? tokenToFiatRate : conversionRate,
tokenContract: getSelectedTokenContract(state),
+ unapprovedTxs: state.metamask.unapprovedTxs,
}
}
@@ -64,6 +65,7 @@ function mapDispatchToProps (dispatch) {
),
signTx: txParams => dispatch(actions.signTx(txParams)),
updateAndApproveTx: txParams => dispatch(actions.updateAndApproveTx(txParams)),
+ updateTx: txData => dispatch(actions.updateTransaction(txData)),
setSelectedAddress: address => dispatch(actions.setSelectedAddress(address)),
addToAddressBook: address => dispatch(actions.addToAddressBook(address)),
updateGasTotal: newTotal => dispatch(actions.updateGasTotal(newTotal)),
@@ -77,7 +79,6 @@ function mapDispatchToProps (dispatch) {
updateSendErrors: newError => dispatch(actions.updateSendErrors(newError)),
goHome: () => dispatch(actions.goHome()),
clearSend: () => dispatch(actions.clearSend()),
- backToConfirmScreen: editingTransactionId => dispatch(actions.showConfTxPage({ id: editingTransactionId })),
setMaxModeTo: bool => dispatch(actions.setMaxModeTo(bool)),
}
}