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

Parameterize TokenListController by NetworkClientId + Integrate PollingController #1763

Merged
merged 13 commits into from
Oct 10, 2023

Conversation

adonesky1
Copy link
Contributor

@adonesky1 adonesky1 commented Oct 3, 2023

Resolves: https://github.com/MetaMask/MetaMask-planning/issues/1032

Integrates new PollingController abstraction into the TokenListController, implements the executePoll method and parameterizes the fetchTokenList method by networkClientId such that tokenLists can be fetched and cached for different networks via concurrent polling sessions.

A note: As is our current controller refactor strategy, these changes are additive, backwards compatible and coexist alongside the existing globally selected network pattern. Once we fully adopt this polling pattern we should no longer access the root tokenList state but rather access from the cache with a chainId selector.

Added

  • Integrates PollingController mixin into the TokenListController and implements the abstract executePoll method.

Changed

  • Adds optional networkClientId argument to fetchTokenList method on TokenListController which, if passed, is used fetch the chainId that corresponds to the networkClientId and is then used to fetch and cache the appropriate tokenList.

@adonesky1 adonesky1 force-pushed the tokenlistcontroller-multichain branch 2 times, most recently from c9b92b0 to 07bc063 Compare October 3, 2023 19:18
@adonesky1 adonesky1 force-pushed the tokenlistcontroller-multichain branch from 1b8bf7f to 57b2884 Compare October 6, 2023 16:42
@adonesky1 adonesky1 changed the title WIP Multichainify TokenListController Parameterize TokenListController by NetworkClientId + Integrate PollingController Oct 6, 2023
@adonesky1 adonesky1 force-pushed the tokenlistcontroller-multichain branch from c29085d to e10b445 Compare October 6, 2023 17:06
@adonesky1 adonesky1 marked this pull request as ready for review October 6, 2023 17:13
@adonesky1 adonesky1 requested a review from a team as a code owner October 6, 2023 17:13
jiexi
jiexi previously approved these changes Oct 6, 2023
Copy link
Contributor

@jiexi jiexi left a comment

Choose a reason for hiding this comment

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

LGTM.

@adonesky1 adonesky1 force-pushed the tokenlistcontroller-multichain branch from 73ff166 to 3ff7eee Compare October 6, 2023 22:24
@adonesky1 adonesky1 requested a review from jiexi October 6, 2023 22:25
Copy link
Contributor

@jiexi jiexi left a comment

Choose a reason for hiding this comment

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

LGTM again. If you could add a changelog to the PR description, I'm sure the person who cuts the next core release would greatly appreciate that.

@adonesky1 adonesky1 merged commit 033bba6 into main Oct 10, 2023
107 checks passed
@adonesky1 adonesky1 deleted the tokenlistcontroller-multichain branch October 10, 2023 16:10
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
…PollingController` (#1763)

Resolves: MetaMask/MetaMask-planning#1032

Integrates new `PollingController` abstraction into the
`TokenListController`, implements the `executePoll` method and
parameterizes the `fetchTokenList` method by `networkClientId` such that
tokenLists can be fetched and cached for different networks via
concurrent polling sessions.

**A note:** As is our current controller refactor strategy, these
changes are additive, backwards compatible and coexist alongside the
existing globally selected network pattern. Once we fully adopt this
polling pattern we should no longer access the root `tokenList` state
but rather access from the cache with a chainId selector.
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
…PollingController` (#1763)

Resolves: MetaMask/MetaMask-planning#1032

Integrates new `PollingController` abstraction into the
`TokenListController`, implements the `executePoll` method and
parameterizes the `fetchTokenList` method by `networkClientId` such that
tokenLists can be fetched and cached for different networks via
concurrent polling sessions.

**A note:** As is our current controller refactor strategy, these
changes are additive, backwards compatible and coexist alongside the
existing globally selected network pattern. Once we fully adopt this
polling pattern we should no longer access the root `tokenList` state
but rather access from the cache with a chainId selector.
MajorLift pushed a commit that referenced this pull request Oct 12, 2023
…PollingController` (#1763)

Resolves: MetaMask/MetaMask-planning#1032

Integrates new `PollingController` abstraction into the
`TokenListController`, implements the `executePoll` method and
parameterizes the `fetchTokenList` method by `networkClientId` such that
tokenLists can be fetched and cached for different networks via
concurrent polling sessions.

**A note:** As is our current controller refactor strategy, these
changes are additive, backwards compatible and coexist alongside the
existing globally selected network pattern. Once we fully adopt this
polling pattern we should no longer access the root `tokenList` state
but rather access from the cache with a chainId selector.
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.

3 participants