|
|
|
@ -131,15 +131,7 @@ var actions = { |
|
|
|
|
VIEW_PENDING_TX: 'VIEW_PENDING_TX', |
|
|
|
|
// send screen
|
|
|
|
|
estimateGas, |
|
|
|
|
updateGasEstimate, |
|
|
|
|
UPDATE_GAS_ESTIMATE: 'UPDATE_GAS_ESTIMATE', |
|
|
|
|
updateGasPrice, |
|
|
|
|
UPDATE_GAS_PRICE: 'UPDATE_GAS_PRICE', |
|
|
|
|
getGasPrice, |
|
|
|
|
CLEAR_GAS_ESTIMATE: 'CLEAR_GAS_ESTIMATE', |
|
|
|
|
CLEAR_GAS_PRICE: 'CLEAR_GAS_PRICE', |
|
|
|
|
clearGasEstimate, |
|
|
|
|
clearGasPrice, |
|
|
|
|
// app messages
|
|
|
|
|
confirmSeedWords: confirmSeedWords, |
|
|
|
|
showAccountDetail: showAccountDetail, |
|
|
|
@ -462,20 +454,30 @@ function signTx (txData) { |
|
|
|
|
|
|
|
|
|
function estimateGas ({ to, amount }) { |
|
|
|
|
return (dispatch) => { |
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
|
global.ethQuery.estimateGas({ to, amount }, (err, data) => { |
|
|
|
|
if (err) return dispatch(actions.displayWarning(err.message)) |
|
|
|
|
if (err) { |
|
|
|
|
dispatch(actions.displayWarning(err.message)) |
|
|
|
|
return reject(err) |
|
|
|
|
} |
|
|
|
|
dispatch(actions.hideWarning()) |
|
|
|
|
dispatch(actions.updateGasEstimate(data)) |
|
|
|
|
return resolve(data) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function getGasPrice () { |
|
|
|
|
return (dispatch) => { |
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
|
global.ethQuery.gasPrice((err, data) => { |
|
|
|
|
if (err) return dispatch(actions.displayWarning(err.message)) |
|
|
|
|
if (err) { |
|
|
|
|
dispatch(actions.displayWarning(err.message)) |
|
|
|
|
return reject(err) |
|
|
|
|
} |
|
|
|
|
dispatch(actions.hideWarning()) |
|
|
|
|
dispatch(actions.updateGasPrice(data)) |
|
|
|
|
return resolve(data) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -537,32 +539,6 @@ function txError (err) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function updateGasEstimate (gas) { |
|
|
|
|
return { |
|
|
|
|
type: actions.UPDATE_GAS_ESTIMATE, |
|
|
|
|
value: gas, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function clearGasEstimate () { |
|
|
|
|
return { |
|
|
|
|
type: actions.CLEAR_GAS_ESTIMATE, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function updateGasPrice (gasPrice) { |
|
|
|
|
return { |
|
|
|
|
type: actions.UPDATE_GAS_PRICE, |
|
|
|
|
value: gasPrice, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function clearGasPrice () { |
|
|
|
|
return { |
|
|
|
|
type: actions.CLEAR_GAS_PRICE, |
|
|
|
|
}
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function cancelMsg (msgData) { |
|
|
|
|
log.debug(`background.cancelMessage`) |
|
|
|
|
background.cancelMessage(msgData.id) |
|
|
|
|