From 4489a57f2fd32ae4b9b5aa12aede289fa0b03fb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20Mi=C3=B1o?= Date: Mon, 5 Nov 2018 16:06:34 -0300 Subject: Update watchAsset ERC20 validation (#5653) * update ERC20 token valodation for watchAsset * update ERC20 validation test descriptions --- app/scripts/controllers/preferences.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/scripts/controllers/preferences.js') diff --git a/app/scripts/controllers/preferences.js b/app/scripts/controllers/preferences.js index eaeaee499..dc6fecaf5 100644 --- a/app/scripts/controllers/preferences.js +++ b/app/scripts/controllers/preferences.js @@ -583,8 +583,8 @@ class PreferencesController { */ _validateERC20AssetParams (opts) { const { rawAddress, symbol, decimals } = opts - if (!rawAddress || !symbol || !decimals) throw new Error(`Cannot suggest token without address, symbol, and decimals`) - if (!(symbol.length < 6)) throw new Error(`Invalid symbol ${symbol} more than five characters`) + if (!rawAddress || !symbol || typeof decimals === 'undefined') throw new Error(`Cannot suggest token without address, symbol, and decimals`) + if (!(symbol.length < 7)) throw new Error(`Invalid symbol ${symbol} more than six characters`) const numDecimals = parseInt(decimals, 10) if (isNaN(numDecimals) || numDecimals > 36 || numDecimals < 0) { throw new Error(`Invalid decimals ${decimals} must be at least 0, and not over 36`) -- cgit v1.2.3 From c76c9ca2c86317f902f443db2c5704d4bf6311c0 Mon Sep 17 00:00:00 2001 From: bitpshr Date: Thu, 27 Sep 2018 14:19:09 -0400 Subject: EIP-1102: updated implementation --- app/scripts/controllers/preferences.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/scripts/controllers/preferences.js') diff --git a/app/scripts/controllers/preferences.js b/app/scripts/controllers/preferences.js index dc6fecaf5..ffb593b09 100644 --- a/app/scripts/controllers/preferences.js +++ b/app/scripts/controllers/preferences.js @@ -46,7 +46,7 @@ class PreferencesController { this.diagnostics = opts.diagnostics this.network = opts.network this.store = new ObservableStore(initState) - this.showWatchAssetUi = opts.showWatchAssetUi + this.openPopup = opts.openPopup this._subscribeProviderType() } // PUBLIC METHODS @@ -567,7 +567,7 @@ class PreferencesController { } const tokenOpts = { rawAddress, decimals, symbol, image } this.addSuggestedERC20Asset(tokenOpts) - return this.showWatchAssetUi().then(() => { + return this.openPopup().then(() => { const tokenAddresses = this.getTokens().filter(token => token.address === normalizeAddress(rawAddress)) return tokenAddresses.length > 0 }) -- cgit v1.2.3 From c482c9926c4514e67105c61f4909ff019caeb7f0 Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Mon, 24 Sep 2018 13:27:37 -0230 Subject: Default to the new UI for first time users --- app/scripts/controllers/preferences.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'app/scripts/controllers/preferences.js') diff --git a/app/scripts/controllers/preferences.js b/app/scripts/controllers/preferences.js index ffb593b09..a5931ddc9 100644 --- a/app/scripts/controllers/preferences.js +++ b/app/scripts/controllers/preferences.js @@ -32,7 +32,9 @@ class PreferencesController { tokens: [], suggestedTokens: {}, useBlockie: false, - featureFlags: {}, + featureFlags: { + betaUI: true, + }, currentLocale: opts.initLangCode, identities: {}, lostIdentities: {}, -- cgit v1.2.3 From 444c68ae535bb7b7da1a65c95f8b5d6f4af6e324 Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Mon, 24 Sep 2018 15:59:00 -0230 Subject: Don't announce new UI to users switching back --- app/scripts/controllers/preferences.js | 1 + 1 file changed, 1 insertion(+) (limited to 'app/scripts/controllers/preferences.js') diff --git a/app/scripts/controllers/preferences.js b/app/scripts/controllers/preferences.js index a5931ddc9..b21cdfb36 100644 --- a/app/scripts/controllers/preferences.js +++ b/app/scripts/controllers/preferences.js @@ -34,6 +34,7 @@ class PreferencesController { useBlockie: false, featureFlags: { betaUI: true, + skipAnnounceBetaUI: true, }, currentLocale: opts.initLangCode, identities: {}, -- cgit v1.2.3