-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
bountyThis issue has a bounty associated with itThis issue has a bounty associated with it
Description
At present, DigixDAO platform uses a hard-coded value of 10 gwei for the default gas price.
We would like to integrate Ethgasstation API to:
- Provide user-friendly clickable options for gas price
- Provide time estimate for the transaction to be mined
Details
- Fetch gas price data from the Ethgasstation API
- fill up the default options with gas price and estimated time
- Transaction Fee
transaction fee = gas limit * gas price
Note: the gas limit can be found out from the txData object (refer)
gasLimit = txData.gas
API
Endpoint: https://ethgasstation.info/json/ethgasAPI.json
Note:
- To convert the gas price values to
gweiunit, divide them by 10 - The wait times are in minutes. Please convert them to
hours and minutes and seconds- 0.4 would be 24 seconds
- 1.3 would be 1 minutes 18 seconds
- 61.5 would be 1 hours 1 minutes 30 seconds
If sample response is:
{
"fast": 40.0,
"fastest": 60.0,
"safeLow": 10.0,
"average": 10.0,
"block_time": 12.534883720930232,
"blockNum": 8243182,
"speed": 0.8315751882176169,
"safeLowWait": 3.6,
"avgWait": 3.6,
"fastWait": 0.5,
"fastestWait": 0.4
}
Then:
- Gas price for
fasttransaction is 4 gwei - Gas price for
fastesttransaction is 6 gwei - Gas price for
safeLowtransaction is 1 gwei - Gas price for
averagetransaction is 1 gwei - Estimated time for
fasttransaction is 30 seconds - Estimated time for
fastesttransaction is 24 seconds - Estimated time for
safeLowtransaction is 3 minutes 36 seconds - Estimated time for
averagetransaction is 3 minutes 36 seconds
Design
Behaviour
If response is the json response from the API call
- Default state
fastoption is selected- Gas price is
response.fast/10 - Estimated wait time is
format(response.fastWait) - The slider under
advancedsection is set to the gas price value - The
Transaction Feeis set totxData.gas * gasPrice
- Clicking on any option (safe low/average/fast/fastest) will
- Deselect the previously selected option
- Select the clicked option
- Update the gas price as per
response - Update the estimated wait time
response - Update the slider under
advancedsection, set it to the gas price value - Update the
Transaction Feebased on the newly selectedgasPrice
- Moving the slider under
advancedsection will- Deselect all the gas price options (safe low, average, fast, fastest)
- Update the gas price as per slider value
- Remove the estimated wait time for transaction (we show this only in the case of selected options from the API)
- Update the
Transaction Feebased on the newly selectedgasPrice
Note: If the Ethgasstation API is down and returns null values:
- Deselect all options
- Set the slider and gas price to a default value of
10 gwei
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bountyThis issue has a bounty associated with itThis issue has a bounty associated with it

