aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/actions.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/app/actions.js')
-rw-r--r--ui/app/actions.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js
index 0a2b4a636..a0dbbbf11 100644
--- a/ui/app/actions.js
+++ b/ui/app/actions.js
@@ -129,6 +129,9 @@ var actions = {
cancelAllTx: cancelAllTx,
viewPendingTx: viewPendingTx,
VIEW_PENDING_TX: 'VIEW_PENDING_TX',
+ // send screen
+ estimateGas,
+ getGasPrice,
// app messages
confirmSeedWords: confirmSeedWords,
showAccountDetail: showAccountDetail,
@@ -449,6 +452,36 @@ function signTx (txData) {
}
}
+function estimateGas ({ to, amount }) {
+ return (dispatch) => {
+ return new Promise((resolve, reject) => {
+ global.ethQuery.estimateGas({ to, amount }, (err, data) => {
+ if (err) {
+ dispatch(actions.displayWarning(err.message))
+ return reject(err)
+ }
+ dispatch(actions.hideWarning())
+ return resolve(data)
+ })
+ })
+ }
+}
+
+function getGasPrice () {
+ return (dispatch) => {
+ return new Promise((resolve, reject) => {
+ global.ethQuery.gasPrice((err, data) => {
+ if (err) {
+ dispatch(actions.displayWarning(err.message))
+ return reject(err)
+ }
+ dispatch(actions.hideWarning())
+ return resolve(data)
+ })
+ })
+ }
+}
+
function sendTx (txData) {
log.info(`actions - sendTx: ${JSON.stringify(txData.txParams)}`)
return (dispatch) => {