1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Merge branch 'master' into i3076-UseStorageLocalInstead

This commit is contained in:
kumavis 2018-03-13 15:43:37 -07:00 committed by GitHub
commit dc5fbf5eb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 2 deletions

View File

@ -3,6 +3,8 @@
## Current Master ## Current Master
- Add ability for internationalization. - Add ability for internationalization.
- 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. - Fix flashing to Log in screen after logging in or restoring from seed phrase.
- Increase tap areas for menu buttons on mobile - Increase tap areas for menu buttons on mobile
- Change all fonts in new-ui onboarding to Roboto, size 400 - Change all fonts in new-ui onboarding to Roboto, size 400

View File

@ -4,7 +4,7 @@ const {
BnMultiplyByFraction, BnMultiplyByFraction,
bnToHex, bnToHex,
} = require('./util') } = 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. const SIMPLE_GAS_COST = '0x5208' // Hex for 21000, cost of a simple send.
/* /*
@ -113,12 +113,14 @@ module.exports = class TxGasUtil {
} }
} }
validateRecipient (txParams) { validateRecipient (txParams) {
if (txParams.to === '0x') { if (txParams.to === '0x' || txParams.to === null ) {
if (txParams.data) { if (txParams.data) {
delete txParams.to delete txParams.to
} else { } else {
throw new Error('Invalid recipient address') throw new Error('Invalid recipient address')
} }
} else if ( txParams.to !== undefined && !isValidAddress(txParams.to) ) {
throw new Error('Invalid recipient address')
} }
return txParams return txParams
} }

View File

@ -140,6 +140,19 @@ RestoreVaultScreen.prototype.createNewVaultAndRestore = function () {
// check seed // check seed
var seedBox = document.querySelector('textarea.twelve-word-phrase') var seedBox = document.querySelector('textarea.twelve-word-phrase')
var seed = seedBox.value.trim() var seed = seedBox.value.trim()
// true if the string has more than a space between words.
if (seed.split(' ').length > 1) {
this.warning = 'there can only be a space between words'
this.props.dispatch(actions.displayWarning(this.warning))
return
}
// true if seed contains a character that is not between a-z or a space
if (!seed.match(/^[a-z ]+$/)) {
this.warning = 'seed words only have lowercase characters'
this.props.dispatch(actions.displayWarning(this.warning))
return
}
if (seed.split(' ').length !== 12) { if (seed.split(' ').length !== 12) {
this.warning = 'seed phrases are 12 words long' this.warning = 'seed phrases are 12 words long'
this.props.dispatch(actions.displayWarning(this.warning)) this.props.dispatch(actions.displayWarning(this.warning))

View File

@ -144,6 +144,19 @@ RestoreVaultScreen.prototype.createNewVaultAndRestore = function () {
// check seed // check seed
var seedBox = document.querySelector('textarea.twelve-word-phrase') var seedBox = document.querySelector('textarea.twelve-word-phrase')
var seed = seedBox.value.trim() var seed = seedBox.value.trim()
// true if the string has more than a space between words.
if (seed.split(' ').length > 1) {
this.warning = 'there can only a space between words'
this.props.dispatch(actions.displayWarning(this.warning))
return
}
// true if seed contains a character that is not between a-z or a space
if (!seed.match(/^[a-z ]+$/)) {
this.warning = 'seed words only have lowercase characters'
this.props.dispatch(actions.displayWarning(this.warning))
return
}
if (seed.split(' ').length !== 12) { if (seed.split(' ').length !== 12) {
this.warning = 'seed phrases are 12 words long' this.warning = 'seed phrases are 12 words long'
this.props.dispatch(actions.displayWarning(this.warning)) this.props.dispatch(actions.displayWarning(this.warning))