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