Skip to content

Commit

Permalink
add missing eth_feeHistory response params
Browse files Browse the repository at this point in the history
  • Loading branch information
SahilAujla committed May 28, 2024
1 parent 2df54df commit 30079d7
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 73 deletions.
75 changes: 40 additions & 35 deletions arbitrum/eth_feeHistory.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,43 @@ x-sandbox:
value: core
paths:
/{apiKey}:
post:
summary: eth_feeHistory - Arbitrum
operationId: eth-feehistory-arbitrum
$ref: ../ethereum/eth_feeHistory.yaml#/components/pathItems/path/post
x-readme:
samples-languages:
- curl
- javascript
- python
code-samples:
- language: javascript
name: Alchemy SDK
code: |
// Setup: npm install alchemy-sdk
// Github: https://github.com/alchemyplatform/alchemy-sdk-js
import { Network, Alchemy } from "alchemy-sdk";
// Optional config object, but defaults to demo api-key and eth-mainnet.
const settings = {
apiKey: "demo", // Replace with your Alchemy API Key.
network: Network.ETH_MAINNET, // Replace with your network.
};
const alchemy = new Alchemy(settings);
// Using send method from alchemy-sdk with specific transaction details
const res = await alchemy.core.send('eth_feeHistory', [
'0x5',
'latest',
[]
]);
console.log(res);
responses:
'200':
description: 'Returns latest block and gas fee details.'
$ref: '#/components/pathItems/path'
components:
pathItems:
path:
post:
summary: eth_feeHistory - Arbitrum
description: Returns a collection of historical gas information.
tags: []
parameters:
- name: apiKey
in: path
schema:
type: string
default: docs-demo
description: |
<style>
.custom-style {
color: #048FF4;
}
</style>
For higher throughput, <span class="custom-style"><a href="https://alchemy.com/?a=docs-demo" target="_blank">create your own API key</a></span>
required: true
requestBody:
content:
application/json:
schema:
$ref: ../evm_body.yaml#/eth_feeHistory
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: ../evm_responses.yaml#/eth_feeHistory
operationId: eth-feeHistory-arbitrum
x-readme:
samples-languages:
- curl
- javascript
- python
57 changes: 26 additions & 31 deletions evm_examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -759,37 +759,32 @@ sendTxn_result_response:

eth_feeHistory:
{
'jsonrpc': '2.0',
'id': 0,
'result':
{
'oldestBlock': '0xfd6a75',
'reward':
[
['0x3b9aca00', '0x3b9aca00', '0x59682f00'],
['0x3b9aca00', '0x3b9aca00', '0x77359400'],
['0x3b9aca00', '0x3b9aca00', '0x3b9aca00'],
['0x2e7ddb00', '0x3b9aca00', '0x77359400'],
['0x3b9aca00', '0x3b9aca00', '0x59682f00'],
],
'baseFeePerGas':
[
'0x4c9d974c3',
'0x4c38a847a',
'0x49206d475',
'0x47ac58b63',
'0x471e805d8',
'0x46f5f64a6',
],
'gasUsedRatio':
[
0.4794155666666667,
0.3375966,
0.42049746666666665,
0.4690773,
0.49109343333333333,
],
},
"jsonrpc": "2.0",
"id": 1,
"result": {
"oldestBlock": "0x130b1e6",
"reward": [
["0x5041e1e", "0xdd221b80"],
["0x5041e1e", "0xb8346df0"],
["0x55d4a80", "0xb2d05e00"],
["0x4dd9818", "0x3b9aca00"]
],
"baseFeePerGas": [
"0x52d80a82c",
"0x50f43f659",
"0x50012de8d",
"0x4e30357d6",
"0x57efff9e7"
],
"gasUsedRatio": [
0.40875283333333334,
0.45308523333333334,
0.4091907,
0.9987537
],
"baseFeePerBlobGas": ["0x1", "0x1", "0x1", "0x1", "0x1"],
"blobGasUsedRatio": [0.5, 1, 0.6666666666666666, 1]
}
}

net_version: { 'jsonrpc': '2.0', 'id': 0, 'result': '1' }
Expand Down
26 changes: 19 additions & 7 deletions evm_responses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -670,29 +670,41 @@ eth_feeHistory:
result:
type: object
required:
- OLDESTBLOCK
- BASEFEEPERGAS
- GASUSEDRATIO
- oldestBlock
- baseFeePerGas
- gasUsedRatio
properties:
OLDESTBLOCK:
oldestBlock:
type: integer
format: int64
description: Lowest number block of the returned range.
BASEFEEPERGAS:
baseFeePerGas:
type: array
description: 'An array of block base fees per gas. This includes the next block after the newest of the returned range, because this value can be derived from the newest block. Zeroes are returned for pre-EIP-1559 blocks.'
items:
type: string
GASUSEDRATIO:
gasUsedRatio:
type: array
description: An array representing the ratios of block gas used. These ratios are calculated by dividing gasUsed by gasLimit.
items:
type: number
REWARD:
reward:
type: array
description: A two-dimensional array showing the effective priority fees per gas at the specified block percentiles.
items:
type: array
items:
type: string
baseFeePerBlobGas:
type: array
description: An array of base fees per blob gas for blocks. This includes the next block following the newest in the returned range, as this value can be derived from the latest block. For blocks before EIP-4844, zeroes are returned.
items:
type: string
blobGasUsedRatio:
type: array
description: An array showing the ratios of blob gas used in blocks. These ratios are calculated by dividing blobGasUsed by the maximum blob gas per block.
items:
type: number
example:
$ref: ./evm_examples.yaml#/eth_feeHistory
net_version:
Expand Down

0 comments on commit 30079d7

Please sign in to comment.