Skip to content
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

BREAKING: Token detection V2 #763

Closed
wants to merge 23 commits into from

Conversation

Cal-L
Copy link
Contributor

@Cal-L Cal-L commented Apr 5, 2022

Description

  • Introduce detected tokens state in addition to existing states, added and ignored

  • Support token detection on Mainnet, BSC, Polygon, and Avalanche

  • Remove use of tokens from contract-metadata AKA static tokens

  • BREAKING:

    • AssetsContractController - Added onNetworkChange to constructor for updating chainId in controller's config
    • TokensController - Changed addTokens to importTokens. Added ignoreTokens to batch ignore detected tokens. Added addDetectedTokens to add detected tokens from TokenDetectionController.
    • TokenListController - Removed useStaticTokenList and onPreferencesStateChange from constructor. Removed static token list from under the hood. Format token images to use Codefi's proxy. Expose aggregators property on token object.
    • TokenDetectionController - Added onTokenListStateChange to constructor to trigger token detection action whenever token list has changed.
    • PreferencesController - Renamed useStaticTokenList to useTokenDetection in constructor.
    • util - Added isTokenDetectionEnabledForNetwork helper function that takes a chainId and returns a boolean.

Checklist

  • Tests are included if applicable
  • Any added code is fully documented

References
Notion - https://www.notion.so/Improve-token-detection-support-custom-networks-aka-TDF-v2-fb3ef7b7299c4ddb8e9481c2b22f1e87
Figma - https://www.figma.com/file/2h15YfvbT2q4q1FOMJFPP1/Token-Detection-V2?node-id=0%3A1

@Cal-L Cal-L requested a review from a team as a code owner April 5, 2022 21:57
@Cal-L Cal-L marked this pull request as draft April 5, 2022 21:58
@rekmarks rekmarks changed the title [BREAKING] Token detection V2 BREAKING: Token detection V2 Apr 7, 2022
@Cal-L Cal-L marked this pull request as ready for review April 10, 2022 06:41
@NiranjanaBinoy NiranjanaBinoy force-pushed the feature/3157-token-detection-v2-controllers branch from 067a76f to 969ba69 Compare April 27, 2022 01:30
@@ -77,7 +77,7 @@ export class PreferencesController extends BaseController<
ipfsGateway: 'https://ipfs.io/ipfs/',
lostIdentities: {},
selectedAddress: '',
useStaticTokenList: false,
useTokenDetection: false,
Copy link
Contributor

@NiranjanaBinoy NiranjanaBinoy Apr 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Cal-L useStaticTokenList used to depict that we are using the static token list instead of the dynamic token list since we have changed the name and the purpose of the flag I feel like the useTokenDetection value as true will make it less confusing for the condition token detection ON by default. Would like to hear your thoughts on the same!?

@Cal-L
Copy link
Contributor Author

Cal-L commented Apr 27, 2022

This PR has been broken out into 7 smaller PRs. Please use the description in this PR as reference for breaking changes.
1 of 7 - #812
2 of 7 - #811
3 of 7 - #810
4 of 7 - #809
5 of 7 - #806
6 of 6 - #808
7 of 7 - #807

@Cal-L
Copy link
Contributor Author

Cal-L commented Jun 2, 2022

Closing in favor of #808

@Cal-L Cal-L closed this Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants