ui - use variable to clarify result of emptiness check

feature/default_network_editable
kumavis 6 years ago
parent 3b46478024
commit fda101912b
  1. 6
      old-ui/app/components/pending-tx.js
  2. 4
      ui/app/components/send/send.utils.js
  3. 4
      ui/app/helpers/transactions.util.js

@ -488,8 +488,10 @@ PendingTx.prototype.verifyGasParams = function () {
) )
} }
PendingTx.prototype._notZeroOrEmptyString = function (obj) { PendingTx.prototype._notZeroOrEmptyString = function (value) {
return obj !== '' && obj !== '0x0' && obj !== '0x' // '0x' means null // Geth will return '0x', and ganache-core v2.2.1 will return '0x0'
const valueIsEmpty = !value || value === '0x' || value === '0x0'
return !valueIsEmpty
} }
PendingTx.prototype.bnMultiplyByFraction = function (targetBN, numerator, denominator) { PendingTx.prototype.bnMultiplyByFraction = function (targetBN, numerator, denominator) {

@ -215,7 +215,9 @@ async function estimateGas ({
// if recipient has no code, gas is 21k max: // if recipient has no code, gas is 21k max:
if (!selectedToken && !data) { if (!selectedToken && !data) {
const code = Boolean(to) && await global.eth.getCode(to) const code = Boolean(to) && await global.eth.getCode(to)
if (!code || code === '0x' || code === '0x0') { // Infura will return '0x', and ganache-core v2.2.1 will return '0x0' // Geth will return '0x', and ganache-core v2.2.1 will return '0x0'
const codeIsEmpty = !code || code === '0x' || code === '0x0'
if (codeIsEmpty) {
return SIMPLE_GAS_COST return SIMPLE_GAS_COST
} }
} else if (selectedToken && !to) { } else if (selectedToken && !to) {

@ -114,7 +114,9 @@ export function getLatestSubmittedTxWithNonce (transactions = [], nonce = '0x0')
export async function isSmartContractAddress (address) { export async function isSmartContractAddress (address) {
const code = await global.eth.getCode(address) const code = await global.eth.getCode(address)
return code && code !== '0x' && code !== '0x0' // Infura will return '0x', and ganache-core v2.2.1 will return '0x0' // Geth will return '0x', and ganache-core v2.2.1 will return '0x0'
const codeIsEmpty = !code || code === '0x' || code === '0x0'
return !codeIsEmpty
} }
export function sumHexes (...args) { export function sumHexes (...args) {

Loading…
Cancel
Save