aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-10-21 13:01:21 +0800
committerkumavis <aaron@kumavis.me>2018-10-21 13:01:21 +0800
commit31e5cad1e34c1b07079c430bb1903f7914021111 (patch)
treebf7a4cd6c1a4ed75d48230a904bfc837cffe5b6c /app/scripts/controllers
parent17a856cfd35a0e419524cf00e852be6c797b1e0b (diff)
downloadtangerine-wallet-browser-31e5cad1e34c1b07079c430bb1903f7914021111.tar
tangerine-wallet-browser-31e5cad1e34c1b07079c430bb1903f7914021111.tar.gz
tangerine-wallet-browser-31e5cad1e34c1b07079c430bb1903f7914021111.tar.bz2
tangerine-wallet-browser-31e5cad1e34c1b07079c430bb1903f7914021111.tar.lz
tangerine-wallet-browser-31e5cad1e34c1b07079c430bb1903f7914021111.tar.xz
tangerine-wallet-browser-31e5cad1e34c1b07079c430bb1903f7914021111.tar.zst
tangerine-wallet-browser-31e5cad1e34c1b07079c430bb1903f7914021111.zip
tx-gas-util - set error message when invalidating tx based on tx data but no contract code
Diffstat (limited to 'app/scripts/controllers')
-rw-r--r--app/scripts/controllers/transactions/tx-gas-utils.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/app/scripts/controllers/transactions/tx-gas-utils.js b/app/scripts/controllers/transactions/tx-gas-utils.js
index 436900715..def67c2c3 100644
--- a/app/scripts/controllers/transactions/tx-gas-utils.js
+++ b/app/scripts/controllers/transactions/tx-gas-utils.js
@@ -62,20 +62,21 @@ class TxGasUtil {
const recipient = txParams.to
const hasRecipient = Boolean(recipient)
- // see if we can set the gas based on the recipient
+ // see if we can set the gas based on the recipient
if (hasRecipient) {
const code = await this.query.getCode(recipient)
// For an address with no code, geth will return '0x', and ganache-core v2.2.1 will return '0x0'
const codeIsEmpty = !code || code === '0x' || code === '0x0'
-
+
if (codeIsEmpty) {
// if there's data in the params, but there's no contract code, it's not a valid transaction
if (txParams.data) {
- const err = new Error()
+ const err = new Error('TxGasUtil - Trying to call a function on a non-contract address')
+ // set error key so ui can display localized error message
err.errorKey = TRANSACTION_NO_CONTRACT_ERROR_KEY
throw err
}
-
+
// This is a standard ether simple send, gas requirement is exactly 21k
txParams.gas = SIMPLE_GAS_COST
// prevents buffer addition