{"id":21470465,"url":"https://github.com/manifoldfinance/open-gas-price","last_synced_at":"2026-04-30T02:33:28.886Z","repository":{"id":57685946,"uuid":"446518742","full_name":"manifoldfinance/open-gas-price","owner":"manifoldfinance","description":"Gas Pricing API v3","archived":false,"fork":false,"pushed_at":"2022-05-11T09:50:04.000Z","size":768,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-01-15T17:03:28.473Z","etag":null,"topics":["api","ethereum","evm","gas","gwei","nanoeth","pricing","transaction"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/manifoldfinance.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-10T17:26:42.000Z","updated_at":"2023-03-26T23:03:24.000Z","dependencies_parsed_at":"2022-09-18T23:21:45.149Z","dependency_job_id":null,"html_url":"https://github.com/manifoldfinance/open-gas-price","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/manifoldfinance/open-gas-price","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manifoldfinance%2Fopen-gas-price","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manifoldfinance%2Fopen-gas-price/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manifoldfinance%2Fopen-gas-price/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manifoldfinance%2Fopen-gas-price/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/manifoldfinance","download_url":"https://codeload.github.com/manifoldfinance/open-gas-price/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manifoldfinance%2Fopen-gas-price/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32452601,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"online","status_checked_at":"2026-04-30T02:00:05.929Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","ethereum","evm","gas","gwei","nanoeth","pricing","transaction"],"created_at":"2024-11-23T09:27:50.901Z","updated_at":"2026-04-30T02:33:28.857Z","avatar_url":"https://github.com/manifoldfinance.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[Open Gas Price](README.md) \n\n# Open Gas Price API\n\n\u003e WIP\n\n\n## Overview\n\n\u003e TODO\n\n## Quickstart\n\n\u003e TODO\n\n### Namespaces\n\n- [CalculateBusyThreshold](#)\n- [DetermineNetworkStatusInfo](#)\n- [FetchBlockFeeHistory](#)\n- [FetchBusyThreshold](#)\n- [GasUtil](#)\n\n\n## Functions\n\n### calculateBusyThreshold\n\n▸ **calculateBusyThreshold**(): `Promise`\u003c`BN`\\\u003e\n\nUses historical base fees to determine a threshold we can use to determine whether the network is\nbusy. Specifically, pulls the last 20,000 blocks (which at the time of this writing represents\naround 2 days), sorts the base fees of those blocks, then chooses the base fee which is 9/10 of\nthe way into the list (i.e. the 90th percentile).\n\n#### Parameters\n\n| Name | Type | Description |\n| :------ | :------ | :------ |\n| `ethQuery` | `any` | An GraphQL Query instance. |\n\n#### Returns\n\n`Promise`\u003c`BN`\\\u003e\n\nA promise for the 90th percentile base fee in WEI, as a BN.\n\n#### Defined in\n\n[calculateBusyThreshold.ts:17](https://github.com/manifoldfinance/open-gas-price/blob/4897ef1/src/calculateBusyThreshold.ts#L17)\n\n\n## Namespace: FetchBlockFeeHistory\n\n\n### Type aliases\n\n- [Block](FetchBlockFeeHistory.md#block)\n- [EthFeeHistoryResponse](FetchBlockFeeHistory.md#ethfeehistoryresponse)\n\n### Functions\n\n- [default](FetchBlockFeeHistory.md#default)\n\n## Type aliases\n\n### Block\n\nƬ **Block**\u003c`Percentile`\\\u003e: `Object`\n\n**`property`** number - The number of the block, as a BN.\n\n**`property`** baseFeePerGas - The base fee per gas for the block in WEI, as a BN.\n\n**`property`** gasUsedRatio - A number between 0 and 1 that represents the ratio between the gas paid\nfor the block and its set gas limit.\n\n**`property`** priorityFeesByPercentile - The priority fees paid for the transactions in the block\nthat occurred at particular levels at which those transactions contributed to the overall gas\nused for the block, indexed by those percentiles. (See docs for {@link fetchBlockFeeHistory} for more\non how this works.)\n\n#### Type parameters\n\n| Name | Type |\n| :------ | :------ |\n| `Percentile` | extends `number` |\n\n#### Type declaration\n\n| Name | Type |\n| :------ | :------ |\n| `baseFeePerGas` | `BN` |\n| `gasUsedRatio` | `number` |\n| `number` | `BN` |\n| `priorityFeesByPercentile` | `Record`\u003c`Percentile`, `BN`\\\u003e |\n\n#### Defined in\n\n[fetchBlockFeeHistory.ts:53](https://github.com/manifoldfinance/open-gas-price/blob/4897ef1/src/fetchBlockFeeHistory.ts#L53)\n\n___\n\n### EthFeeHistoryResponse\n\nƬ **EthFeeHistoryResponse**: `Object`\n\n**`property`** oldestBlock - The id of the oldest block (in hex format) in the range of blocks\nrequested.\n\n**`property`** baseFeePerGas - Base fee per gas for each block in the range of blocks requested.\n\n**`property`** gasUsedRatio - A number between 0 and 1 that represents the gas used vs. gas limit for\neach block in the range of blocks requested.\n\n**`property`** reward - The priority fee at the percentiles requested for each block in the range of\nblocks requested.\n\n#### Type declaration\n\n| Name | Type |\n| :------ | :------ |\n| `baseFeePerGas` | `string`[] |\n| `gasUsedRatio` | `number`[] |\n| `oldestBlock` | `string` |\n| `reward?` | `string`[][] |\n\n#### Defined in\n\n[fetchBlockFeeHistory.ts:33](https://github.com/manifoldfinance/open-gas-price/blob/4897ef1/src/fetchBlockFeeHistory.ts#L33)\n\n## Functions\n\n### default\n\n▸ **default**\u003c`Percentile`\\\u003e(`args`): `Promise`\u003c[`Block`](FetchBlockFeeHistory.md#block)\u003c`Percentile`\\\u003e[]\\\u003e\n\nUses `eth_feeHistory` (an EIP-1559 feature) to obtain information about gas fees from a range of\nblocks that have occurred recently on a network.\n\nTo learn more, see these resources:\n\n- \u003chttps://infura.io/docs/ethereum#operation/eth_feeHistory\u003e\n- \u003chttps://github.com/zsfelfoldi/feehistory/blob/main/docs/feeHistory.md\u003e\n- \u003chttps://github.com/ethereum/go-ethereum/blob/57a3fab8a75eeb9c2f4fab770b73b51b9fe672c5/eth/gasprice/feehistory.go#L180\u003e\n- \u003chttps://github.com/ethereum/EIPs/blob/master/EIPS/eip-1559.md\u003e\n- \u003chttps://gas-api.metaswap.codefi.network/testFeeHistory\u003e\n\n#### Type parameters\n\n| Name | Type |\n| :------ | :------ |\n| `Percentile` | extends `number` |\n\n#### Parameters\n\n| Name | Type | Description |\n| :------ | :------ | :------ |\n| `args` | `Object` | The arguments to this function. |\n| `args.endBlock?` | `BN` \\| ``\"latest\"`` | The desired end of the requested block range. Can be \"latest\" if you want to start from the latest successful block or the number of a known past block. |\n| `args.ethQuery` | `any` | An EthQuery instance that wraps a provider for the network in question. |\n| `args.numberOfBlocks` | `number` | How many total blocks to fetch. Note that if this is more than 1024, multiple calls to `eth_feeHistory` will be made. |\n| `args.percentiles?` | readonly `Percentile`[] | A set of numbers between 1 and 100 which will dictate how `priorityFeesByPercentile` in each returned block will be formed. When Ethereum runs the `eth_feeHistory` method, for each block it is considering, it will first sort all transactions by the priority fee. It will then go through each transaction and add the total amount of gas paid for that transaction to a bucket which maxes out at the total gas used for the whole block. As the bucket fills, it will cross percentages which correspond to the percentiles specified here, and the priority fees of the first transactions which cause it to reach those percentages will be recorded. Hence, `priorityFeesByPercentile` represents the priority fees of transactions at key gas used contribution levels, where earlier levels have smaller contributions and later levels have higher contributions. |\n\n#### Returns\n\n`Promise`\u003c[`Block`](FetchBlockFeeHistory.md#block)\u003c`Percentile`\\\u003e[]\\\u003e\n\nThe list of blocks and their fee data, sorted from oldest to newest.\n\n#### Defined in\n\n[fetchBlockFeeHistory.ts:92](https://github.com/manifoldfinance/open-gas-price/blob/4897ef1/src/fetchBlockFeeHistory.ts#L92)\n\n\n\n## Namespace: DetermineNetworkStatusInfo\n\n### Type aliases\n\n- [NetworkStatusInfo](DetermineNetworkStatusInfo.md#networkstatusinfo)\n\n### Functions\n\n- [default](DetermineNetworkStatusInfo.md#default)\n\n## Type aliases\n\n### NetworkStatusInfo\n\nƬ **NetworkStatusInfo**: `Object`\n\n#### Type declaration\n\n| Name | Type |\n| :------ | :------ |\n| `isNetworkBusy` | `boolean` |\n\n#### Defined in\n\n[determineNetworkStatusInfo.ts:7](https://github.com/manifoldfinance/open-gas-price/blob/4897ef1/src/determineNetworkStatusInfo.ts#L7)\n\n## Functions\n\n### default\n\n▸ **default**(`args`): `Promise`\u003c[`NetworkStatusInfo`](DetermineNetworkStatusInfo.md#networkstatusinfo)\\\u003e\n\nCollects information about the status of the network. Right now the only piece of information is\nwhether the network is \"busy\" — i.e., whether the base fee for the latest block exceeds a\nparticular \"busy\" threshold.\n\n#### Parameters\n\n| Name | Type | Description |\n| :------ | :------ | :------ |\n| `args` | `Object` | The arguments. |\n| `args.clientId` | `undefined` \\| `string` | The ID of the client making this request. |\n| `args.ethQuery` | `any` | An EthQuery instance. |\n| `args.latestBaseFee` | `BN` | The base fee for the latest block in WEI. |\n| `args.url` | `string` | The URL for the API used to determine a base fee threshold. |\n\n#### Returns\n\n`Promise`\u003c[`NetworkStatusInfo`](DetermineNetworkStatusInfo.md#networkstatusinfo)\\\u003e\n\nThe network status info.\n\n#### Defined in\n\n[determineNetworkStatusInfo.ts:23](https://github.com/manifoldfinance/open-gas-price/blob/4897ef1/src/determineNetworkStatusInfo.ts#L23)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanifoldfinance%2Fopen-gas-price","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanifoldfinance%2Fopen-gas-price","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanifoldfinance%2Fopen-gas-price/lists"}