Use block tracker to poll incoming transactions#1579
Merged
matthewwalsh0 merged 6 commits intomainfrom Aug 22, 2023
Merged
Conversation
Add start, stop, and update methods to controller. Add mutex to helper. Add API key to remote transaction source.
OGPoyraz
previously approved these changes
Aug 16, 2023
vinistevam
previously approved these changes
Aug 18, 2023
Contributor
vinistevam
left a comment
There was a problem hiding this comment.
Amazing PR @matthewwalsh0 🚀
cd90e91
OGPoyraz
approved these changes
Aug 22, 2023
vinistevam
approved these changes
Aug 22, 2023
Contributor
|
Related: MetaMask/eth-block-tracker#169 |
Merged
MajorLift
pushed a commit
that referenced
this pull request
Oct 11, 2023
MajorLift
pushed a commit
that referenced
this pull request
Oct 11, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
Currently the
TransactionControllerretrieves incoming transactions when explicitly requested via thefetchAllmethod meaning the cadence of polling is dictated by the client.This PR removes the
fetchAllmethod and instead uses theblockTrackerinstance provided to the controller to automatically poll for incoming transactions whenever the current network has a new block.This polling can be started and stopped using the
startIncomingTransactionPollingandstopIncomingTransactionPollingmethods respectively. Or an update can be required immediately via theupdateIncomingTransactionsmethod.Additional optional arguments have also been added to the constructor to configure the incoming transaction support.
References
Closes #965
Changelog
@metamask/transaction-controllerfetchAllmethod.getSelectedAddresscallback argument to constructor.fromBlockandlimittypes inRemoteTransactionSourceRequest.isSupportedNetworkmethod toRemoteTransactionSourceinterface.incomingTransactionsconstructor arguments includingapiKey,includeTokenTransfers,isEnabled, andupdateTransactions.startIncomingTransactionPolling,stopIncomingTransactionPolling, andupdateIncomingTransactionsmethods.Checklist