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

Use account API in TokenDetectionController #4743

Open
bergeron opened this issue Sep 30, 2024 · 0 comments
Open

Use account API in TokenDetectionController #4743

bergeron opened this issue Sep 30, 2024 · 0 comments
Assignees

Comments

@bergeron
Copy link
Contributor

bergeron commented Sep 30, 2024

Account API docs:
https://docs.cx.metamask.io/docs/multichainAccounts/api-reference/

Use the account API as a means of detecting tokens in TokenDetectionController. This API uses off chain indexing to determine which tokens the wallet interacted with, and will be more efficient than the current approach of bulk calling balanceOf on the entire token list.

The account API can only be used on chains that it supports. If the account API does not support the current chain, we fall back to the old mechanism. Also if the request to the API fails, we can fallback to the old mechanism.

In the future, the account API may be used to replace additional functionality like the balance updates in TokenBalancesController. But we're starting with detection since its the highest perf impact.

@Prithpal-Sooriya Prithpal-Sooriya self-assigned this Sep 30, 2024
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

No branches or pull requests

2 participants