@ -17,7 +17,6 @@ import {
addHexPrefix ,
getChainType ,
} from '../../lib/util' ;
import { TRANSACTION _NO _CONTRACT _ERROR _KEY } from '../../../../ui/helpers/constants/error-keys' ;
import { calcGasTotal } from '../../../../ui/pages/send/send.utils' ;
import { getSwapsTokensReceivedFromTxMeta } from '../../../../ui/pages/swaps/swaps.util' ;
import {
@ -1000,10 +999,9 @@ export default class TransactionController extends EventEmitter {
* Gets default gas limit , or debug information about why gas estimate failed .
*
* @ param { object } txMeta - The txMeta object
* @ param { string } getCodeResponse - The transaction category code response , used for debugging purposes
* @ returns { Promise < object > } Object containing the default gas limit , or the simulation failure object
* /
async _getDefaultGasLimit ( txMeta , getCodeResponse ) {
async _getDefaultGasLimit ( txMeta ) {
const chainId = this . _getCurrentChainId ( ) ;
const customNetworkGasBuffer = CHAIN _ID _TO _GAS _LIMIT _BUFFER _MAP [ chainId ] ;
const chainType = getChainType ( chainId ) ;
@ -1013,21 +1011,9 @@ export default class TransactionController extends EventEmitter {
} else if (
txMeta . txParams . to &&
txMeta . type === TRANSACTION _TYPES . SIMPLE _SEND &&
chainType !== 'custom'
chainType !== 'custom' &&
! txMeta . txParams . data
) {
// if there's data in the params, but there's no contract code, it's not a valid transaction
if ( txMeta . txParams . data ) {
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 = getCodeResponse ;
throw err ;
}
// This is a standard ether simple send, gas requirement is exactly 21k
return { gasLimit : GAS _LIMITS . SIMPLE } ;
}