aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts
diff options
context:
space:
mode:
authorEsteban MiƱo <efmino@uc.cl>2018-11-06 03:06:34 +0800
committerWhymarrh Whitby <whymarrh.whitby@gmail.com>2018-11-06 03:06:34 +0800
commit4489a57f2fd32ae4b9b5aa12aede289fa0b03fb1 (patch)
treee90e28e3ffe696fe51750f01cd7faccbe3d3bea8 /app/scripts
parent6883787c14ba5e3a26a865887e0626a01e96e56a (diff)
downloadtangerine-wallet-browser-4489a57f2fd32ae4b9b5aa12aede289fa0b03fb1.tar.gz
tangerine-wallet-browser-4489a57f2fd32ae4b9b5aa12aede289fa0b03fb1.tar.zst
tangerine-wallet-browser-4489a57f2fd32ae4b9b5aa12aede289fa0b03fb1.zip
Update watchAsset ERC20 validation (#5653)
* update ERC20 token valodation for watchAsset * update ERC20 validation test descriptions
Diffstat (limited to 'app/scripts')
-rw-r--r--app/scripts/controllers/preferences.js4
1 files changed, 2 insertions, 2 deletions
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`)