-
-
Notifications
You must be signed in to change notification settings - Fork 260
Add GasFeeController #494
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
Merged
Merged
Add GasFeeController #494
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
a71c93e
First draft of gas fee controller
danjm c4a2606
Second draft of gas fee controller
danjm 7886180
Third draft of gas fee controller
danjm 2be94cb
Delete use of legacy gas fee
danjm ba8e275
Track whether polling should be instantiated or stopped with tokens
danjm 179dee6
Network controller getEIP1559Compatibility can be called whenever a n…
danjm 55d3607
update tests (#495)
rickycodes 16075b0
Fetch estimate using eth_gasPrice if on a custom network
danjm b70d323
getGasFeeEstimatesAndStartPolling returns poll token, and a new one i…
danjm 0a8a248
Add getTimeEstimate to GasFee controller
danjm cb88478
export GasFeeController
rickycodes 1ccd62a
Add public method for calling and returning gas estimates without pol…
danjm dbf9f6c
Fix return of fetchLegacyGasPriceEstimate
danjm 16b313b
Proper error handling and fallback for _fetchGasFeeEstimateData
danjm a782c9d
Include estimated time bounds in gas fee state
danjm 32b2930
rename
rickycodes 97e9e8f
Add GasFeeController.test.ts
rickycodes 47f3659
remove TODO
rickycodes 9971e68
Add result token length test
rickycodes 91a2cd2
Add estimates property test
rickycodes 0dec6e7
Add should fail to re-initialize test
rickycodes e4e962e
remove console.log
rickycodes afdc385
do not modify state directly
rickycodes fd4bd64
Use before/afterEach and fix messenger
rickycodes b1c5631
check gasFeeEstimates properties
rickycodes 3646d62
check that state is empty to start
rickycodes 51dad0d
Add one additional property check
rickycodes 4ac4ffe
Adding TokenListController to fetch the token list from token service…
NiranjanaBinoy c1ca513
address feedback
rickycodes 0458679
add mock server for eip1559
rickycodes 728c039
get tests working again
rickycodes cd90799
Use heroku endpoint
rickycodes 8d570bb
Handle fetch correctly in gasfeecontroller unit tests, using nock
danjm 2e2b1a7
gasFee controller calculateTimeEstimate handles decimals, by way of u…
danjm 1516d87
Lint fix
danjm 6eac11c
Fix dec to gwi (#504)
brad-decker 3df6baf
use ethjs-unit for unit conversions (#506)
brad-decker 117d898
Add metaswaps API and normalize all gas fee units to dec gwei (#507)
brad-decker b4eebac
update types to be more identifiable (#508)
brad-decker 6fbf024
use LegacyGasFeeEstimate type
brad-decker 5d2908e
handle hex prefixed
brad-decker 283fc88
baseFee -> baseFeePerGas
brad-decker cf82e70
make more configurable (#513)
brad-decker 8d04cc5
use optional chaining
brad-decker 41cdace
update test case wording
brad-decker 3a42d98
use testdata instead of programmatic testing
brad-decker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
update test case wording
- Loading branch information
commit 41cdace735728de3790b0475a2a1aff3354b765b
There are no files selected for viewing
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
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.
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.
Might be personal preference, but I think these tests can be clearer in intent, and also less prone to error, if the hard coded inputs and hard coded outputs are explicitly provided, as opposed to be calculated by other functions.
This is how I would write these tests, feel free to copy and paste:
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.
I was not going to comment about this, but jest has a
test.eachfunction which is my personal preference, either as string literal table or array table.Example:
Example from mobile:
https://github.com/MetaMask/metamask-mobile/blob/978b73d88a5208a7d5d74415af980a2f3a59403d/app/components/Base/Keypad/createKeypadRule.test.js
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.
copy and pasted, just had to update the expectedResult to strings
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.
3a42d98