mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Merge pull request #3551 from MetaMask/i#3509
fix for where null is not supported in txParams
This commit is contained in:
commit
b7a24840f2
@ -1,6 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## Current Master
|
||||
|
||||
- Will now throw an error if the `to` field in txParams is not valid.
|
||||
- Will strip null values from the `to` field.
|
||||
- Fix flashing to Log in screen after logging in or restoring from seed phrase.
|
||||
- Increase tap areas for menu buttons on mobile
|
||||
- Change all fonts in new-ui onboarding to Roboto, size 400
|
||||
|
@ -4,7 +4,7 @@ const {
|
||||
BnMultiplyByFraction,
|
||||
bnToHex,
|
||||
} = require('./util')
|
||||
const addHexPrefix = require('ethereumjs-util').addHexPrefix
|
||||
const { addHexPrefix, isValidAddress } = require('ethereumjs-util')
|
||||
const SIMPLE_GAS_COST = '0x5208' // Hex for 21000, cost of a simple send.
|
||||
|
||||
/*
|
||||
@ -113,12 +113,14 @@ module.exports = class TxGasUtil {
|
||||
}
|
||||
}
|
||||
validateRecipient (txParams) {
|
||||
if (txParams.to === '0x') {
|
||||
if (txParams.to === '0x' || txParams.to === null ) {
|
||||
if (txParams.data) {
|
||||
delete txParams.to
|
||||
} else {
|
||||
throw new Error('Invalid recipient address')
|
||||
}
|
||||
} else if ( txParams.to !== undefined && !isValidAddress(txParams.to) ) {
|
||||
throw new Error('Invalid recipient address')
|
||||
}
|
||||
return txParams
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user