File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
apps/namadillo/src/atoms/fees Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -37,14 +37,14 @@ export const gasEstimateFamily = atomFamily(
37
37
}
38
38
39
39
const gasEstimate = await fetchGasEstimate ( api , txKinds ) ;
40
-
41
- // TODO: we need to improve this estimate API. Currently, gasEstimate.min returns
42
- // the minimum gas limit ever used for a TX, and avg is failing in most of the transactions.
43
- const newMin = gasEstimate . max ;
40
+ const precision = Math . max (
41
+ 0 ,
42
+ Math . min ( 1 , gasEstimate . totalEstimates / 1000 )
43
+ ) ;
44
44
return {
45
- min : newMin ,
46
- avg : Math . ceil ( newMin * 1.25 ) ,
47
- max : Math . ceil ( newMin * 1.5 ) ,
45
+ min : gasEstimate . min * 1.1 - precision * 0.1 ,
46
+ avg : gasEstimate . avg * 1.25 - precision * 0.25 ,
47
+ max : gasEstimate . max * 1.5 - precision * 0.5 ,
48
48
totalEstimates : gasEstimate . totalEstimates ,
49
49
} ;
50
50
} ,
You can’t perform that action at this time.
0 commit comments