diff options
author | Frankie <frankie.diamond@gmail.com> | 2018-11-30 02:07:05 +0800 |
---|---|---|
committer | Dan Finlay <542863+danfinlay@users.noreply.github.com> | 2018-11-30 02:07:05 +0800 |
commit | a803522a922e8e5eb0a3f1b6c2e758c743cdc62d (patch) | |
tree | b960bde29d128eb133201330d8f2905bfb6ec607 | |
parent | 67d9f445bd9c03068b63dbe0b8a6b6606fd0d880 (diff) | |
download | tangerine-wallet-browser-a803522a922e8e5eb0a3f1b6c2e758c743cdc62d.tar.gz tangerine-wallet-browser-a803522a922e8e5eb0a3f1b6c2e758c743cdc62d.tar.zst tangerine-wallet-browser-a803522a922e8e5eb0a3f1b6c2e758c743cdc62d.zip |
transactions/tx-gas-utils - add the acctual response for eth_getCode for NO_CONTRACT_ERROR's && add a debug object to simulationFailed (#5840)
-rw-r--r-- | app/scripts/controllers/transactions/tx-gas-utils.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/scripts/controllers/transactions/tx-gas-utils.js b/app/scripts/controllers/transactions/tx-gas-utils.js index def67c2c3..b296dc5eb 100644 --- a/app/scripts/controllers/transactions/tx-gas-utils.js +++ b/app/scripts/controllers/transactions/tx-gas-utils.js @@ -35,7 +35,13 @@ class TxGasUtil { txMeta.simulationFails = { reason: err.message, errorKey: err.errorKey, + debug: { blockNumber: block.number, blockGasLimit: block.gasLimit }, } + + if (err.errorKey === TRANSACTION_NO_CONTRACT_ERROR_KEY) { + txMeta.simulationFails.debug.getCodeResponse = err.getCodeResponse + } + return txMeta } this.setTxGas(txMeta, block.gasLimit, estimatedGasHex) @@ -74,6 +80,9 @@ class TxGasUtil { 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 + + // set the response on the error so that we can see in logs what the actual response was + err.getCodeResponse = code throw err } |