-
-
Notifications
You must be signed in to change notification settings - Fork 207
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
Allow network requests in instances of the CurrencyRate and TokenRate controllers to be disabled #1002
Conversation
I think that with these modifications to this the extension PR, we can greatly simplify the changes in this controllers PR: https://github.com/MetaMask/metamask-extension/compare/optional-currency-conversion...optional-currency-conversion-alt?expand=1 I believe that we can simplify this PR to: https://github.com/MetaMask/controllers/compare/allow-disabled-config-tokenratescontroller?expand=1 |
c09ad06
to
14c1c78
Compare
…o be enabled or not
This PR is now ready for review |
Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com>
f4f0fb2
to
3536d03
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple more.
… - test name as per review comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple more suggestions but overall I'm good with this PR.
Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
This PR is the same as it was when Elliot previously approved, except that two code comments suggested by Elliot have since been added. |
… controllers to be disabled (#1002) **Allow network requests in instances of the CurrencyRate and TokenRate controllers to be disabled** **Description** - BREAKING: - A new private property is added to the CurrencyRateController: `enabled`. If this is false, then the function in that controller which makes network requests will not make any requests when called. This property is controlled by the `start` and `stop` methods, so that these methods will effectively enable or disable network requests. Previously, even if `stop` had been called, `setNativeCurrency` or `setCurrentCurrency` would trigger a network request. That is now prevented. - FIXED: - The TokenRatesController previously had a bug whereby if a `disabled` property was passed to the constructive as part of the `config` object, it would be ignored / overwritten to false. This PR fixes that. **Checklist** - [ ] Tests are included if applicable - [ ] Any added code is fully documented **Issue** Part of [#16724](MetaMask/metamask-extension#16724) Co-authored-by: Dan J Miller <danjm.com@gmail.com> Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com> Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com> Co-authored-by: Pedro Figueiredo <pedro.figueiredo@consensys.net> Co-authored-by: Pedro Figueiredo <ganseki.figueiredo@gmail.com>
… controllers to be disabled (#1002) **Allow network requests in instances of the CurrencyRate and TokenRate controllers to be disabled** **Description** - BREAKING: - A new private property is added to the CurrencyRateController: `enabled`. If this is false, then the function in that controller which makes network requests will not make any requests when called. This property is controlled by the `start` and `stop` methods, so that these methods will effectively enable or disable network requests. Previously, even if `stop` had been called, `setNativeCurrency` or `setCurrentCurrency` would trigger a network request. That is now prevented. - FIXED: - The TokenRatesController previously had a bug whereby if a `disabled` property was passed to the constructive as part of the `config` object, it would be ignored / overwritten to false. This PR fixes that. **Checklist** - [ ] Tests are included if applicable - [ ] Any added code is fully documented **Issue** Part of [#16724](MetaMask/metamask-extension#16724) Co-authored-by: Dan J Miller <danjm.com@gmail.com> Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com> Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com> Co-authored-by: Pedro Figueiredo <pedro.figueiredo@consensys.net> Co-authored-by: Pedro Figueiredo <ganseki.figueiredo@gmail.com>
… controllers to be disabled (#1002) **Allow network requests in instances of the CurrencyRate and TokenRate controllers to be disabled** **Description** - BREAKING: - A new private property is added to the CurrencyRateController: `enabled`. If this is false, then the function in that controller which makes network requests will not make any requests when called. This property is controlled by the `start` and `stop` methods, so that these methods will effectively enable or disable network requests. Previously, even if `stop` had been called, `setNativeCurrency` or `setCurrentCurrency` would trigger a network request. That is now prevented. - FIXED: - The TokenRatesController previously had a bug whereby if a `disabled` property was passed to the constructive as part of the `config` object, it would be ignored / overwritten to false. This PR fixes that. **Checklist** - [ ] Tests are included if applicable - [ ] Any added code is fully documented **Issue** Part of [#16724](MetaMask/metamask-extension#16724) Co-authored-by: Dan J Miller <danjm.com@gmail.com> Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com> Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com> Co-authored-by: Pedro Figueiredo <pedro.figueiredo@consensys.net> Co-authored-by: Pedro Figueiredo <ganseki.figueiredo@gmail.com>
Allow network requests in instances of the CurrencyRate and TokenRate controllers to be disabled
Description
BREAKING:
enabled
. If this is false, then the function in that controller which makes network requests will not make any requests when called. This property is controlled by thestart
andstop
methods, so that these methods will effectively enable or disable network requests. Previously, even ifstop
had been called,setNativeCurrency
orsetCurrentCurrency
would trigger a network request. That is now prevented.FIXED:
disabled
property was passed to the constructive as part of theconfig
object, it would be ignored / overwritten to false. This PR fixes that.Checklist
Issue
Part of #16724