Add nonRPCGasFeeApisDisabled property to the gas fee controller#4094
Merged
Add nonRPCGasFeeApisDisabled property to the gas fee controller#4094
Conversation
DDDDDanica
previously approved these changes
Mar 21, 2024
mcmire
reviewed
Mar 21, 2024
| "peerDependencies": { | ||
| "@metamask/network-controller": "^18.0.0" | ||
| "@metamask/network-controller": "^18.0.0", | ||
| "@metamask/preferences-controller": "^9.0.0" |
Contributor
There was a problem hiding this comment.
Is this dependency necessary? I'm not seeing it used below. Specifically adding a peer dependency would be a breaking change since clients would now have to use this version for compatibility. But if we don't need to have this then it doesn't need to be a breaking change.
Contributor
Author
There was a problem hiding this comment.
oh, yeah, that was included by mistake
mcmire
previously approved these changes
Mar 21, 2024
Contributor
mcmire
left a comment
There was a problem hiding this comment.
Thanks for the reply! Looks good.
…e user to prevent requests for gas fees to the external 'APIEndpoints'
ffc64cc to
0a7c524
Compare
Contributor
Author
|
I just pushed changes to resolve merge conflicts |
NEllusion
approved these changes
Apr 10, 2024
13 tasks
3 tasks
danjm
added a commit
that referenced
this pull request
May 7, 2024
## Explanation This should have been part of #4094 The absence of this metadata results in an error being thrown from here: https://github.com/MetaMask/core/blob/main/packages/base-controller/src/BaseControllerV2.ts#L295-L297 ## Changelog FIXED: Add metadata for the `nonRPCGasFeeApisDisabled` of gas-fee-controller state ### `@metamask/gas-fee-controller` - **FIXED**: Add metadata for the `nonRPCGasFeeApisDisabled` of gas-fee-controller state ## Checklist - [ ] I've updated the test suite for new or updated code as appropriate - [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [ ] I've highlighted breaking changes using the "BREAKING" category above as appropriate
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
This PR allows the user of this controller to control whether it makes any network requests to extermal APIs other than the rpc provider. To do this it adds a
nonRPCGasFeeApisDisabledproperty to the controller state. This property defaults tofalse. Methods to set that property to true and false are addedIf that property is
true, thendetermineGasFeeCalculationswill not make requests to thelegacyAPIEndpoint/fetchLegacyGasPriceEstimatesUrlnor theEIP1559APIEndpoint/fetchGasEstimatesUrl. It will, in this case, only get gas data viaeth_feeHistoryoreth_gasPricerequests to the rpc provider.The goal is to allow the user of the controller to prevent network requests to additional parties, which may be desired to allow end users greater control over privacy.
References
This is part of resolving https://github.com/MetaMask/MetaMask-planning/issues/2076
Changelog
@metamask/gas-fee-controllerChecklist