Skip to content

Commit

Permalink
[WIP] Support polling for network congestion level
Browse files Browse the repository at this point in the history
When a user is about to send a transaction or is looking at a swap
quote, we would like to inform them if the network is busy so that we can
push them to use a lower fee setting. The GasFeeController already
provides a way to poll for fee estimates, which we employ on transaction
preview screens. This commit updates the polling mechanism so that we
can also gauge the network congestion level. This is done by hitting the
`eth_feeHistory` endpoint, which was added in EIP-1559. This endpoint
allows us to see the base and priority fees that were used in the last N
blocks, where N is a number we can choose. We use this data to determine
whether there has been a recent spike in fees.
  • Loading branch information
mcmire committed Oct 7, 2021
1 parent 3651918 commit 7ce8597
Show file tree
Hide file tree
Showing 9 changed files with 1,251 additions and 284 deletions.
4 changes: 4 additions & 0 deletions .eslintrc.js
Expand Up @@ -65,6 +65,10 @@ module.exports = {
'no-param-reassign': 'off',
radix: 'off',
'require-atomic-updates': 'off',
'jsdoc/match-description': [
'error',
{ matchDescription: '^([A-Z]|[`\\d_])[\\s\\S]*[.?!`>]$' },
],
},
settings: {
'import/resolver': {
Expand Down
2 changes: 2 additions & 0 deletions package.json
Expand Up @@ -74,10 +74,12 @@
"@metamask/eslint-config-jest": "^9.0.0",
"@metamask/eslint-config-nodejs": "^9.0.0",
"@metamask/eslint-config-typescript": "^9.0.1",
"@sinonjs/fake-timers": "^8.0.1",
"@types/jest": "^26.0.22",
"@types/node": "^14.14.31",
"@types/punycode": "^2.1.0",
"@types/sinon": "^9.0.10",
"@types/sinonjs__fake-timers": "^6.0.4",
"@types/web3": "^1.0.6",
"@typescript-eslint/eslint-plugin": "^4.22.0",
"@typescript-eslint/parser": "^4.22.0",
Expand Down

0 comments on commit 7ce8597

Please sign in to comment.