diff --git a/js/src/api/transport/error.js b/js/src/api/transport/error.js
index 5fe9aac06a7..512d4289e7a 100644
--- a/js/src/api/transport/error.js
+++ b/js/src/api/transport/error.js
@@ -25,6 +25,7 @@ export const ERROR_CODES = {
UNKNOWN_ERROR: -32009,
TRANSACTION_ERROR: -32010,
EXECUTION_ERROR: -32015,
+ EXCEPTION_ERROR: -32016,
ACCOUNT_LOCKED: -32020,
PASSWORD_INVALID: -32021,
ACCOUNT_ERROR: -32023,
diff --git a/js/src/modals/DeployContract/deployContract.js b/js/src/modals/DeployContract/deployContract.js
index 1bda0dddf77..701c689ad6d 100644
--- a/js/src/modals/DeployContract/deployContract.js
+++ b/js/src/modals/DeployContract/deployContract.js
@@ -391,6 +391,10 @@ class DeployContract extends Component {
.then(([gasEst, gas]) => {
this.gasStore.setEstimated(gasEst.toFixed(0));
this.gasStore.setGas(gas.toFixed(0));
+ })
+ .catch((error) => {
+ this.gasStore.setEstimatedError();
+ console.warn('estimateGas', error);
});
}
diff --git a/js/src/modals/ExecuteContract/executeContract.js b/js/src/modals/ExecuteContract/executeContract.js
index 569356cf9c0..689678a7c74 100644
--- a/js/src/modals/ExecuteContract/executeContract.js
+++ b/js/src/modals/ExecuteContract/executeContract.js
@@ -155,8 +155,7 @@ class ExecuteContract extends Component {
}
return (
-
+
);
}
@@ -378,6 +377,7 @@ class ExecuteContract extends Component {
this.gasStore.setGas(gas.toFixed(0));
})
.catch((error) => {
+ this.gasStore.setEstimatedError();
console.warn('estimateGas', error);
});
}
diff --git a/js/src/modals/Transfer/store.js b/js/src/modals/Transfer/store.js
index 3a01b94aeb6..9da9023f1a3 100644
--- a/js/src/modals/Transfer/store.js
+++ b/js/src/modals/Transfer/store.js
@@ -357,6 +357,7 @@ export default class TransferStore {
});
})
.catch((error) => {
+ this.gasStore.setEstimatedError();
console.warn('etimateGas', error);
this.recalculate(redo);
});
diff --git a/js/src/ui/GasPriceEditor/store.js b/js/src/ui/GasPriceEditor/store.js
index 22867fdd098..bb83738546c 100644
--- a/js/src/ui/GasPriceEditor/store.js
+++ b/js/src/ui/GasPriceEditor/store.js
@@ -62,6 +62,10 @@ export default class GasPriceEditor {
this.errorTotal = errorTotal;
}
+ @action setEstimatedError = (errorEstimated = ERRORS.gasException) => {
+ this.errorEstimated = errorEstimated;
+ }
+
@action setEstimated = (estimated) => {
transaction(() => {
const bn = new BigNumber(estimated);
@@ -69,11 +73,11 @@ export default class GasPriceEditor {
this.estimated = estimated;
if (bn.gte(MAX_GAS_ESTIMATION)) {
- this.errorEstimated = ERRORS.gasException;
+ this.setEstimatedError(ERRORS.gasException);
} else if (bn.gte(this.gasLimit)) {
- this.errorEstimated = ERRORS.gasBlockLimit;
+ this.setEstimatedError(ERRORS.gasBlockLimit);
} else {
- this.errorEstimated = null;
+ this.setEstimatedError(null);
}
});
}
diff --git a/js/src/ui/GasPriceEditor/store.spec.js b/js/src/ui/GasPriceEditor/store.spec.js
index 889eee4db30..3dcf2e22c2a 100644
--- a/js/src/ui/GasPriceEditor/store.spec.js
+++ b/js/src/ui/GasPriceEditor/store.spec.js
@@ -82,6 +82,24 @@ describe('ui/GasPriceEditor/store', () => {
});
});
+ describe('setEstimatedError', () => {
+ it('sets the value as provided', () => {
+ store.setEstimatedError('errorTest');
+ expect(store.errorEstimated).to.equal('errorTest');
+ });
+
+ it('sets the null value as provided', () => {
+ store.setEstimatedError('errorTest');
+ store.setEstimatedError(null);
+ expect(store.errorEstimated).to.be.null;
+ });
+
+ it('sets a default error when none provided', () => {
+ store.setEstimatedError();
+ expect(store.errorEstimated).to.equal(ERRORS.gasException);
+ });
+ });
+
describe('setEstimated', () => {
it('sets the value', () => {
store.setEstimated('789');