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 SmartTransactionsController state by ChainId for MultiChain + Integrate PollingController Mixin #237

Merged
merged 7 commits into from
Nov 30, 2023

Conversation

adonesky1
Copy link
Contributor

@adonesky1 adonesky1 commented Nov 9, 2023

TODO:

  • E2E test with extension to ensure working properly before taking out of draft

Working e2e test here:
https://github.com/MetaMask/smart-transactions-controller/assets/34557516/307de2da-1fe3-43c8-8faa-7bf51da28eaa

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

Integrates new PollingController abstraction into the SmartTransactionsController, implements the _executePoll method and parameterizes the updateSmartTransactions method by networkClientId such that pending SmartTransaction statuses can be polled for concurrently across different chains.

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 liveness and fees state but rather access these values by chainId from livenessByChainId and feesByChainId.

Added

  • Integrates PollingController mixin into the SmartTransactionsController and implements the abstract _executePoll method.

Changed

  • Adds optional options object containing a networkClientId argument to the updateSmartTransaction method which, if passed, is used fetch the chainId that corresponds to the networkClientId and is then used to fetch and update the status of pending smart transactions for that chainId.

@adonesky1 adonesky1 force-pushed the multichain-refactor-again branch from 3729ab4 to 5c467b0 Compare November 14, 2023 18:10
@adonesky1 adonesky1 marked this pull request as ready for review November 15, 2023 17:15
@adonesky1 adonesky1 requested a review from a team as a code owner November 15, 2023 17:15
@adonesky1 adonesky1 requested a review from dan437 November 15, 2023 17:15
@adonesky1 adonesky1 force-pushed the multichain-refactor-again branch from 5c467b0 to 5f1df33 Compare November 16, 2023 15:07
Comment on lines -366 to -371
const txReceipt = mapValues(transactionReceipt, (value) => {
if (value instanceof ethersBigNumber) {
return value.toHexString();
}
return value;
});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dan437 so now we don't need to modify the transactionReceipt object since none of the values will be in ethersBigNumber format.

…ain + Integrate PollingController Mixin (#210)

* integrating multichain controller upgrades

* add test

* cleanup

* need to move confirmSmartTransaction tests into another test since confirmSmartTransaction is now private

* actually for now leave it as a public method

* cleanup

* fix typeerror?

* add test + cleanup

* add a test + bump test coverage

* update type

* fix type issue

* address feedback

* fix provider logic

* update test coverage threshholds

* make a private and public version of updateSmartTransaction

* fix capitalization"

* addressing feedback

* replace @ethersproject/providers with @metamask/eth-query

* cleanup

* address more feedback

* remove @ethersproject/bignumber

* make confirmSmartTransaction a private method

* remove comment

* getTransaction -> getTransactionByHash

* fix ethquery mock
@adonesky1 adonesky1 force-pushed the multichain-refactor-again branch from 1b608f2 to 93a05f1 Compare November 28, 2023 15:45
Copy link

Removed dependencies detected. Learn more about Socket for GitHub ↗︎

🚮 Removed packages: @metamask/[email protected]

@MajorLift
Copy link

Looks good from my end! I'll defer to the team for final approval.

@adonesky1 adonesky1 requested a review from jiexi November 29, 2023 18: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.

🚀

@adonesky1
Copy link
Contributor Author

Going to wait for a review from @dan437 before merging

@adonesky1 adonesky1 merged commit e88f5ae into main Nov 30, 2023
@adonesky1 adonesky1 deleted the multichain-refactor-again branch November 30, 2023 15:38
@legobeat legobeat mentioned this pull request Nov 30, 2023
1 task
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