-
Notifications
You must be signed in to change notification settings - Fork 5.1k
eth_feeHistory (EIP 1559) #4191
Changes from 4 commits
f2703cb
afea9b2
1672830
ce0cd54
989da0c
6f85eb7
45d1c13
86afed7
7472eb0
44a62a8
509fccd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -149,6 +149,13 @@ export class Eth { | |
callback?: (error: Error, gasPrice: string) => void | ||
): Promise<string>; | ||
|
||
getFeeHistory( | ||
blockCount: number, | ||
newestBlock: string, | ||
rewardPercentiles: number[], | ||
callback?: (error: Error, feeHistory: FeeHistoryResult) => void | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should contain There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you mixed up There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually I think the docs here are misleading https://github.com/ChainSafe/web3.js/pull/4190/files#diff-b1b5b8a010cd61ad800e528887f49730db04064d59d3ee5ed14de0f49f2ba11cR740 Looks like you still have to pass an empty array so I'm not sure if web3 should just do that as the default if that param isn't set? Would be more user friendly than having to pass an empty array. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @GregTheGreek Whoops, forgot to push, thank you @corymsmith I think web3 defaulting an empty array would be nice for the user, but we can't have two optional arguments in typescript, so I'm not sure how we could do this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True, I suppose the only way to do it would be to add a formatter that formats |
||
): Promise<FeeHistoryResult>; | ||
|
||
getAccounts( | ||
callback?: (error: Error, accounts: string[]) => void | ||
): Promise<string[]>; | ||
|
@@ -439,3 +446,10 @@ export interface StorageProof { | |
value: string; | ||
proof: string[]; | ||
} | ||
|
||
export interface FeeHistoryResult { | ||
oldestBlock: string; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This specifies There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right, I just blindly followed the RPC docs, thank you |
||
baseFeePerGas: string[]; | ||
gasUsedRatio: number[]; | ||
reward: string[][]; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
var testMethod = require('./helpers/test.method.js'); | ||
|
||
var method = 'getFeeHistory'; | ||
var methodCall = 'eth_feeHistory'; | ||
|
||
var tests = [{ | ||
args: [4, "0xA30953", []], | ||
formattedArgs: [4, "0xA30953", []], | ||
result: { | ||
"baseFeePerGas": [ | ||
"0xa", | ||
"0x9", | ||
"0x8", | ||
"0x9", | ||
"0x9" | ||
], | ||
"gasUsedRatio": [ | ||
0.003920375, | ||
0.002625, | ||
0.904999125, | ||
0.348347625 | ||
], | ||
"oldestBlock": 10684752 | ||
}, | ||
formattedResult: { | ||
"baseFeePerGas": [ | ||
"0xa", | ||
"0x9", | ||
"0x8", | ||
"0x9", | ||
"0x9" | ||
], | ||
"gasUsedRatio": [ | ||
0.003920375, | ||
0.002625, | ||
0.904999125, | ||
0.348347625 | ||
], | ||
"oldestBlock": 10684752 | ||
}, | ||
call: methodCall | ||
}]; | ||
|
||
|
||
testMethod.runTests('eth', method, tests); | ||
|
Uh oh!
There was an error while loading. Please reload this page.