Added dynamic gas station price based using API#1404
Merged
razvantomegea merged 9 commits intodevelopmentfrom Apr 24, 2025
Merged
Added dynamic gas station price based using API#1404razvantomegea merged 9 commits intodevelopmentfrom
razvantomegea merged 9 commits intodevelopmentfrom
Conversation
MiroMargineanu
approved these changes
Apr 23, 2025
razvantomegea
added a commit
that referenced
this pull request
May 7, 2025
* Added dynamic gas station price based using API (#1404) * Added dynamic gas station metadata fetch * Log * Refactor * revert * Refactor * Revert latestblock * Added chain id check * Fix * Fixed sdk-core imports (#1405) * Added dynamic gas station metadata fetch * Log * Refactor * revert * Refactor * Revert latestblock * Added chain id check * Fix * Fixed sdk-core imports * CHANGELOG * Added account cleanup on login (#1408) * Added account cleanup on login * CHANGELOG * v4.1.4 (#1409) * Fixed tests * Clear address * Added clear at web wallet login --------- Co-authored-by: Radu Mojic <radu.mojic@multiversx.com>
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.
Issue/Feature
Add dynamic fetching of gas station metadata to provide more accurate gas price estimations based on current network conditions.
Reproduce
Before this change, the dApp did not fetch real-time gas price recommendations (fast/faster) specific to the user's shard from the network's gas station endpoint. Gas price suggestions might not have accurately reflected current network congestion.
Root cause
The
ProviderInitializercomponent and the network configuration state lacked the functionality to dynamically fetch and store gas station metadata (recommended gas prices) based on the logged-in user's shard.Fix
getGasStationMetadataFromApito fetch gas price metadata (fast, faster, lastBlock) for a specific shard from the/transactions/ppu/{shard}endpoint.ProviderInitializer.tsxto:updateGasStationMetadatafunction which uses the new API call.updateNetworkConfigaction with the fetchedgasStationMetadata.NetworkTypeandBaseNetworkTypeinsrc/types/network.types.tsto accommodate the new structure ofgasStationMetadata(keyed by shard number).Additional changes
CHANGELOG.mdwith the new feature.getGasPriceDetails.test.ts) to reflect the usage of the newgasStationMetadatastructure.getGasStationMetadata.tstoapiCalls/configurationand updated the corresponding index file.getLatestBlocktoapiCalls/blocks. Useful to fetch latest block.Contains breaking changes
Updated CHANGELOG
Testing
ConfirmFeereflect fetched metadata)