-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug/3137 token address crasher #3152
Conversation
try { | ||
await TokensController.addToken(address, symbol, decimals); | ||
} catch (error) { | ||
Logger.log('Error while trying to add a custom token', error); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it would be better to create a method in a utils file since you use this code in multiple parts?
app/store/migrations.js
Outdated
const newAllTokens = {}; | ||
Object.entries(allTokens).forEach(([chainId, tokensByAccountAddress]) => { | ||
Object.entries(tokensByAccountAddress).forEach(([accountAddress, tokens]) => { | ||
const newTokens = tokens.filter(({ address }) => !!address); | ||
if (newAllTokens[chainId] === undefined) { | ||
newAllTokens[chainId] = { [accountAddress]: newTokens }; | ||
} else { | ||
newAllTokens[chainId] = { | ||
...newAllTokens[chainId], | ||
[accountAddress]: newTokens, | ||
}; | ||
} | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this logic its the same as the one between lines 229-242, it could be transferred to a new method to avoid repetition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
* Filter out tokens with missing address in migration. Catch and log token removal action. * Attempt to catch and log failures when adding token * Remove puncuations from removal error message * Update migration * Clean up migration to only apply for ignored tokens. Map into array of strings * Revert "Attempt to catch and log failures when adding token" This reverts commit 7e2752e. * Update remove token catch log
Description
#3137
Checklist
Issue
Resolves #???