mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Fix watchAsset symbol validation (#9960)
This commit is contained in:
parent
429847a686
commit
cb44cff168
@ -800,14 +800,16 @@ export default class PreferencesController {
|
||||
* doesn't fulfill requirements
|
||||
*
|
||||
*/
|
||||
_validateERC20AssetParams(opts) {
|
||||
const { rawAddress, symbol, decimals } = opts
|
||||
_validateERC20AssetParams({ rawAddress, symbol, decimals } = {}) {
|
||||
if (!rawAddress || !symbol || typeof decimals === 'undefined') {
|
||||
throw new Error(
|
||||
`Cannot suggest token without address, symbol, and decimals`,
|
||||
)
|
||||
}
|
||||
if (!(symbol.length < 7)) {
|
||||
if (typeof symbol !== 'string') {
|
||||
throw new Error(`Invalid symbol: not a string`)
|
||||
}
|
||||
if (symbol.length > 6) {
|
||||
throw new Error(`Invalid symbol ${symbol} more than six characters`)
|
||||
}
|
||||
const numDecimals = parseInt(decimals, 10)
|
||||
|
Loading…
Reference in New Issue
Block a user