Switch gas price estimation in swaps to metaswap-api /gasPrices#9599
Switch gas price estimation in swaps to metaswap-api /gasPrices#9599
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Builds ready [b1e2891]
Page Load Metrics (423 ± 60 ms)
|
b1e2891 to
8a23996
Compare
Builds ready [8a23996]
Page Load Metrics (444 ± 63 ms)
|
Gudahtt
left a comment
There was a problem hiding this comment.
Did you consider creating a separate gas customization modal for this, instead of re-using this one? That is what we had discussed doing when you brought this up on a call. There isn't a whole lot here being used - just a the layout and the two inputs. Meanwhile there is over a page worth of data being pulled in in the container for this component, none of which is relevant here. This component really wasn't meant for this.
|
I just pushed a significant overhaul of this PR that creates an entirely new modal component for use just in swaps. It is a copy of existing behaviour. There are some improvements that have been discussed (e.g. warning on setting gas price too low, fetching gas price at an interval) that can be added in future PRs. |
e7d578d to
1f95d2f
Compare
Builds ready [1f95d2f]
Page Load Metrics (469 ± 77 ms)
|
|
This needs to be rebased - there are a number of conflicts to resolve |
e7edabe to
64d27e8
Compare
Builds ready [fd84b40]
Page Load Metrics (520 ± 94 ms)
|
Builds ready [4eb6146]
Page Load Metrics (465 ± 74 ms)
|
...ustomization/gas-modal-page-container/advanced-tab-content/advanced-tab-content.component.js
Outdated
Show resolved
Hide resolved
...ponents/app/gas-customization/gas-modal-page-container/gas-modal-page-container.component.js
Outdated
Show resolved
Hide resolved
ui/app/pages/swaps/swaps-gas-customization-modal/swaps-gas-customization-modal.container.js
Outdated
Show resolved
Hide resolved
ui/app/pages/swaps/swaps-gas-customization-modal/swaps-gas-customization-modal.component.js
Outdated
Show resolved
Hide resolved
ui/app/pages/swaps/swaps-gas-customization-modal/swaps-gas-customization-modal.component.js
Outdated
Show resolved
Hide resolved
ui/app/pages/swaps/swaps-gas-customization-modal/swaps-gas-customization-modal.container.js
Show resolved
Hide resolved
ui/app/pages/swaps/swaps-gas-customization-modal/swaps-gas-customization-modal.container.js
Outdated
Show resolved
Hide resolved
Builds ready [fca101c]
Page Load Metrics (381 ± 47 ms)
|
.../app/gas-customization/gas-price-button-group/tests/gas-price-button-group-component.test.js
Outdated
Show resolved
Hide resolved
ui/app/pages/swaps/swaps-gas-customization-modal/swaps-gas-customization-modal.component.js
Show resolved
Hide resolved
Builds ready [f16e669]
Page Load Metrics (456 ± 60 ms)
|
Builds ready [9517b6a]
Page Load Metrics (510 ± 77 ms)
|
Builds ready [0d43898]
Page Load Metrics (389 ± 55 ms)
|
0d43898 to
17decb1
Compare
Builds ready [17decb1]
Page Load Metrics (482 ± 73 ms)
|
|
@Gudahtt Anything else you'd like to see addressed before we merge this PR? |
17decb1 to
a417a68
Compare
Builds ready [a417a68]
Page Load Metrics (455 ± 70 ms)
|
Adds swaps-gas-customization-modal and utilize in swaps Remove swaps specific code from gas-modal-page-container/ Remove slow estimate data from swaps-gas-customization-modal.container Use average as lower safe price limit in swaps-gas-customization-modal Lint fix Fix up unit tests Update ui/app/ducks/swaps/swaps.js Co-authored-by: Mark Stacey <markjstacey@gmail.com> Remove stale properties from gas-modal-page-container.component.js Replace use of isCustomPrice safe with isCustomSwapsGasPriceSafe, in swaps-gas-customization-modal Remove use of averageIsSafe in isCustomPriceSafe function Stop calling resetCustomGasState in swaps Refactor 'setter' type actions and creators to 'event based', for swaps slice custom gas logic Replace use of advanced-tab-content.component with advanceGasInputs in swaps gas customization component Add validation for the gasPrices endpoint swaps custom gas price should be considered safe if >= to average Update renderDataSummary unit test Lint fix Remove customOnHideOpts for swapsGasCustomizationModal in modal.js Better handling for swaps gas price loading and failure states Improve semantics: isCustomSwapsGasPriceSafe renamed to isCustomSwapsGasPriceUnSafe Mutate state directly in swaps gas slice reducer Remove unused params More reliable tracking of speed setting for Gas Fees Changed metrics event Lint fix Throw error when fetchSwapsGasPrices response is invalid add disableSave and customTotalSupplement to swaps-gas-customization container return Update ui/app/ducks/swaps/swaps.js Co-authored-by: Mark Stacey <markjstacey@gmail.com> Improve error handling in fetchMetaSwapsGasPriceEstimates Remove metricsEvent from swaps-gas-customization-modal context Base check of gas speed type in swaps-gas-customization-modal on gasEstimateType Improve naming of variable and functions use to set customPriceIsSafe prop of AdvancedGasInputs in swaps-gas-customization-modal Simplify sinon spy/stub code in gas-price-button-group-component.test.js Remove unnecessary getSwapsFallbackGasPrice call in swaps-gas-customization-modal Remove use of getSwapsTradeTxParams and clean up related gas price logic in swaps Improve validator of SWAP_GAS_PRICE_VALIDATOR Ensure default tradeValue
a417a68 to
2630068
Compare
Builds ready [2630068]
Page Load Metrics (462 ± 75 ms)
|
This PR updates the gas price estimation api for swaps. We now use the the metaswap-api /gasPrices endpoint.
The follow changes are included:
hideAdvancedTimeEstimatesboolean, then the gas price chart and the time estimate on the advanced tab will be hidden. This is utilized in swaps.noFetchOnMountboolean, then the gas customization modal component will not dispatch gas duck actions to fetch new gas prices on mountHere is a demo: