{"id":21247117,"url":"https://github.com/alchemyplatform/alchemy-web3","last_synced_at":"2025-04-06T23:17:09.751Z","repository":{"id":37212697,"uuid":"182172999","full_name":"alchemyplatform/alchemy-web3","owner":"alchemyplatform","description":"Web3 client extended with Alchemy integration","archived":false,"fork":false,"pushed_at":"2023-02-03T17:13:54.000Z","size":1101,"stargazers_count":250,"open_issues_count":15,"forks_count":64,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-03-30T21:12:34.978Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alchemyplatform.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-19T00:00:42.000Z","updated_at":"2025-03-17T05:59:38.000Z","dependencies_parsed_at":"2023-02-13T04:15:55.917Z","dependency_job_id":null,"html_url":"https://github.com/alchemyplatform/alchemy-web3","commit_stats":null,"previous_names":[],"tags_count":53,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alchemyplatform%2Falchemy-web3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alchemyplatform%2Falchemy-web3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alchemyplatform%2Falchemy-web3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alchemyplatform%2Falchemy-web3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alchemyplatform","download_url":"https://codeload.github.com/alchemyplatform/alchemy-web3/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247563937,"owners_count":20958971,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-11-21T02:16:01.935Z","updated_at":"2025-04-06T23:17:09.717Z","avatar_url":"https://github.com/alchemyplatform.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Alchemy Web3\n\nWeb3 client extended with Alchemy and browser provider integration.\n\n## ⚠️ MAINTENANCE MODE ⚠️\n\nAs of July 2022, this repo is now in maintenance mode. The new SDK based on ethers.js is now available on [GitHub](https://github.com/alchemyplatform/alchemy-sdk-js) or [NPM](https://www.npmjs.com/package/alchemy-sdk). It has feature parity with this library as well as better typing, more abstractions, and more documentation.\n\nGoing forward, updates to this library will be made on a best-effort basis. If you see a bug or have a feature request, please open an issue or pull request on the [Github issues](https://github.com/alchemyplatform/alchemy-web3/issues) section.\n\n## Introduction\n\nAlchemy Web3 provides website authors with a drop-in replacement for the\n[web3.js](https://github.com/ethereum/web3.js) Ethereum API client. It produces\na client matching that of web3.js, but brings multiple advantages to make use of\n[Alchemy API](https://alchemyapi.io):\n\n- **Uses Alchemy or an injected provider as needed.** Most requests will be sent\n  through Alchemy, but requests involving signing and sending transactions are\n  sent via a browser provider like [Metamask](https://metamask.io/) or [Trust\n  Wallet](https://trustwallet.com) if the user has it installed, or via a\n  custom provider specified in options.\n\n- **Easy access to Alchemy's higher level API.** The client exposes methods to\n  call Alchemy's exclusive features.\n\n- **Automatically retries on rate limited requests.** If Alchemy returns a 429 response (rate limited), automatically retry after a short delay. This\n  behavior is configurable.\n\n- **Robust WebSocket subscriptions** which don't miss events if the WebSocket\n  needs to be reconnected.\n\nAlchemy Web3 is designed to require minimal configuration so you can start using\nit in your app right away.\n\n## Installation\n\n### With a package manager\n\nWith Yarn:\n\n```\nyarn add @alch/alchemy-web3\n```\n\nOr with NPM:\n\n```\nnpm install @alch/alchemy-web3\n```\n\n### With a CDN in the browser\n\nAlternatively, add one of the following script tags to your page:\n\n```html\n\u003c!-- Minified --\u003e\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/@alch/alchemy-web3@latest/dist/alchemyWeb3.min.js\"\u003e\u003c/script\u003e\n```\n\n```html\n\u003c!-- Unminified --\u003e\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/@alch/alchemy-web3@latest/dist/alchemyWeb3.js\"\u003e\u003c/script\u003e\n```\n\nWhen using this option, you can create Alchemy-Web3 instances using the global variable `AlchemyWeb3.createAlchemyWeb3`.\n\n## Usage\n\n### Basic Usage\n\nYou will need an Alchemy account to access the Alchemy API. If you don't\nhave one yet, [sign up here](https://alchemy.com/?a=850af13f8e).\n\nCreate the client by importing the function `createAlchemyWeb3` and then passing\nit your Alchemy app's URL and optionally a configuration object.\n\n```ts\nimport { createAlchemyWeb3 } from \"@alch/alchemy-web3\";\n\n// Using HTTPS\nconst web3 = createAlchemyWeb3(\n  \"https://eth-mainnet.alchemyapi.io/v2/\u003capi-key\u003e\",\n);\n```\n\nor\n\n```ts\n// Using WebSockets\nconst web3 = createAlchemyWeb3(\n  \"wss://eth-mainnet.ws.alchemyapi.io/ws/\u003capi-key\u003e\",\n);\n```\n\nYou can use any of the methods described in the [web3.js\nAPI](https://web3js.readthedocs.io/en/1.0/) and they will send requests to\nAlchemy:\n\n```ts\n// Many web3.js methods return promises.\nweb3.eth.getBlock(\"latest\").then((block) =\u003e {\n  /* … */\n});\n\nweb3.eth\n  .estimateGas({\n    from: \"0xge61df…\",\n    to: \"0x087a5c…\",\n    data: \"0xa9059c…\",\n    gasPrice: \"0xa994f8…\",\n  })\n  .then((gasAmount) =\u003e {\n    /* … */\n  });\n```\n\n### With a Browser Provider\n\nIf the user has a provider in their browser available at `window.ethereum`, then\nany methods which involve user accounts or signing will automatically use it.\nThis provider might be injected by [Metamask](https://metamask.io/), [Trust\nWallet](https://trustwallet.com/dapp) or other browsers or browser extensions if\nthe user has them installed. For example, the following will use a provider from\nthe user's browser:\n\n```ts\nweb3.eth.getAccounts().then((accounts) =\u003e {\n  web3.eth.sendTransaction({\n    from: accounts[0],\n    to: \"0x6A823E…\",\n    value: \"1000000000000000000\",\n  });\n});\n```\n\n#### Note on using Metamask\n\nAs just discussed, Metamask will automatically be used for accounts and signing\nif it is installed. However, for this to work **you must first request\npermission from the user to access their accounts in Metamask**. This is a\nsecurity restriction required by Metamask: details can be found\n[here](https://medium.com/metamask/https-medium-com-metamask-breaking-change-injecting-web3-7722797916a8).\n\nTo enable the use of Metamask, you must call\n[`ethereum.enable()`](\u003chttps://metamask.github.io/metamask-docs/API_Reference/Ethereum_Provider#ethereum.enable()\u003e).\nAn example of doing so is as follows:\n\n```ts\nif (window.ethereum) {\n  ethereum\n    .enable()\n    .then((accounts) =\u003e {\n      // Metamask is ready to go!\n    })\n    .catch((reason) =\u003e {\n      // Handle error. Likely the user rejected the login.\n    });\n} else {\n  // The user doesn't have Metamask installed.\n}\n```\n\nNote that doing so will display a Metamask dialog to the user if they have not\nalready seen it and accepted, so you may choose to wait to enable Metamask until\nthe user is about to perform an action which requires it. This is also why\nAlchemy Web3 will not automatically enable Metamask on page load.\n\n### With a custom provider\n\nYou may also choose to bring your own provider for writes rather than relying on\none being present in the browser environment. To do so, use the `writeProvider`\noption when creating your client:\n\n```ts\nconst web3 = createAlchemyWeb3(ALCHEMY_URL, { writeProvider: provider });\n```\n\nYour provider should expose at least one of `sendAsync()` or `send()`, as\nspecified in [EIP\n1193](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md).\n\nYou may swap out the custom provider at any time by calling the\n`setWriteProvider()` method:\n\n```ts\nweb3.setWriteProvider(provider);\n```\n\nYou may also disable the write provider entirely by passing a value of `null`.\n\n### Automatic Retries\n\nIf Alchemy Web3 encounters a rate limited response, it will automatically retry\nthe request after a short delay. This behavior can be configured by passing the\nfollowing options when creating your client. To disable retries, set\n`maxRetries` to 0.\n\n#### `maxRetries`\n\nThe number of times the client will attempt to resend a rate limited request before giving up. Default: 3.\n\n#### `retryInterval`\n\nThe minimum time waited between consecutive retries, in milliseconds. Default: 1000.\n\n#### `retryJitter`\n\nA random amount of time is added to the retry delay to help avoid additional\nrate errors caused by too many concurrent connections, chosen as a number of\nmilliseconds between 0 and this value. Default: 250.\n\n### Sturdier WebSockets\n\nAlchemy Web3 brings multiple improvements to ensure correct WebSocket behavior\nin cases of temporary network failure or dropped connections. As with any\nnetwork connection, you should not assume that a WebSocket will remain open\nforever without interruption, but correctly handling dropped connections and\nreconnection by hand can be challenging to get right. Alchemy Web3 automatically\nadds handling for these failures with no configuration necessary.\n\nIf you use your WebSocket URL when initializing, then when you create\nsubscriptions using `web3.eth.subscribe()`, Alchemy Web3 will bring the\nfollowing advantages over standard Web3 subscriptions:\n\n- Unlike standard Web3, you will not permanently miss events which arrive while\n  the backing WebSocket is temporarily down. Instead, you will receive these\n  events as soon as the connection is reopened. Note that if the connection is\n  down for more than 120 blocks (approximately 20 minutes), you may still miss\n  some events that were not part of the most recent 120 blocks.\n\n- Compared to standard Web3, lowered rate of failure when sending requests over\n  the WebSocket while the connection is down. Alchemy Web3 will attempt to send\n  the requests once the connection is reopened. Note that it is still possible,\n  with a lower likelihood, for outgoing requests to be lost, so you should still\n  have error handling as with any network request.\n\n## Alchemy's Transfers API\n\nThe produced client also grants easy access to Alchemy's [transfer API](https://docs.alchemyapi.io/documentation/alchemy-api-reference/transfers-api).\n\n### `web3.alchemy.getAssetTransfers({fromBlock, toBlock, fromAddress, toAddress, contractAddresses, excludeZeroValue, maxCount, category, pageKey})`\n\nReturns an array of asset transfers based on the specified parameters.\n\n**Parameters:**\n\nAn object with the following fields:\n\n- `fromBlock`: Optional inclusive from hex string block (default latest)\n- `toBlock`: Optional inclusive to hex string block (default latest)\n- `order`: Optional string that specifies the ordering of the results by block number. Must be one of [\"asc\", \"desc\"] (default \"asc\")\n- `fromAddress`: Optional from hex string address (default wildcard)\n- `toAddress`: Optional to hex string address (default wildcard)\n  NOTE: `fromAddress` is ANDed with `toAddress`\n- `contractAddresses`: Optional array of hex string contract addresses for \"token\" transfers (default wildcard)\n  NOTE: `contractAddresses` are ORed together\n- `excludeZeroValue`: Optional boolean to exclude transfers with zero value (default true)\n- `maxCount`: Optional number to restrict payload size (default and max of 1000)\n- `category`: Optional array of categories (defaults to the following categories: [\"external\", \"internal\", \"token\"])\n- `pageKey`: Optional uuid pageKey to retrieve the next payload\n\n**Returns:**\n\nAn object with the following fields:\n\n- `pageKey`: Uuid for next page of results (undefined for the last page of results).\n- `transfers`: An array of objects with the following fields sorted in ascending order by block number\n  - `category`: \"external\", \"internal\", \"token\", \"erc20\", \"erc721\", \"erc1155\" - label for the transfer\n  - `blockNum`: The block where the transfer occurred (hex string).\n  - `from`: From address of transfer (hex string).\n  - `to`: To address of transfer (hex string). `null` if contract creation.\n  - `value`: Converted asset transfer value as a number (raw value divided by contract decimal). `null` if erc721 transfer or contract decimal not available.\n  - `erc721TokenId`: Raw erc721 token id (hex string). `null` if not an erc721 transfer\n  - `erc1155Metadata`: A list of objects containing the erc1155 `tokenId` (hex string) and `value` (hex string). `null` if not an erc1155 transfer\n  - `asset`: \"ETH\" or the token's symbol. `null` if not defined in the contract and not available from other sources.\n  - `hash`: Transaction hash (hex string).\n  - `rawContract`: Object of raw values:\n    - `value`: Raw transfer value (hex string). `null` if erc721 or erc1155 transfer\n    - `address`: Contract address (hex string). `null` if \"external\" or \"internal\"\n    - `decimal`: Contract decimal (hex string). `null` if not defined in the contract and not available from other sources.\n\n## Alchemy's Enhanced API\n\nThe produced client also grants easy access to Alchemy's [enhanced API](https://docs.alchemyapi.io/documentation/alchemy-web3/enhanced-web3-api).\n\n### `web3.alchemy.getTokenAllowance({contract, owner, spender})`\n\nReturns token balances for a specific address given a list of contracts.\n\n**Parameters:**\n\nAn object with the following fields:\n\n- `contract`: The address of the token contract.\n- `owner`: The address of the token owner.\n- `spender`: The address of the token spender.\n\n**Returns:**\n\nThe allowance amount, as a string representing a base-10 number.\n\n### `web3.alchemy.getTokenBalances(address, contractAddresses)`\n\nReturns token balances for a specific address given a list of contracts.\n\n**Parameters:**\n\n1. `address`: The address for which token balances will be checked.\n2. `contractAddresses`: An optional array of contract addresses. Not specifying this will return all token balances.\n\n**Returns:**\n\nAn object with the following fields:\n\n- `address`: The address for which token balances were checked.\n- `tokenBalances`: An array of token balance objects. Each object contains:\n  - `contractAddress`: The address of the contract.\n  - `tokenBalance`: The balance of the contract, as a string representing a\n    base-10 number.\n  - `error`: An error string. One of this or `tokenBalance` will be `null`.\n\n### `web3.alchemy.getTokenMetadata(address)`\n\nReturns metadata (name, symbol, decimals, logo) for a given token contract address.\n\n**Parameters:**\n\n`address`: The address of the token contract.\n\n**Returns:**\n\nAn object with the following fields:\n\n- `name`: The token's name. `null` if not defined in the contract and not available from other sources.\n- `symbol`: The token's symbol. `null` if not defined in the contract and not available from other sources.\n- `decimals`: The token's decimals. `null` if not defined in the contract and not available from other sources.\n- `logo`: URL of the token's logo image. `null` if not available.\n\n### `web3.alchemy.getNfts({owner, pageKey, contractAddresses})`\n\n**Parameters:**\n\nAn object with the following fields:\n\n- `owner`: The address that you want to fetch NFTs for.\n- `pageKey`: (Optional) A key to fetch the next page of results.\n- `contractAddresses`: (Optional) An array of contract addresses to filter the owner's results to.\n- `withMetadata`: (Optional) If `false`, the returned NFTs will omit metadata. Defaults to `true`.\n\n**Returns:**\n\nWhen metadata is included, the returned object has the following fields:\n\n- `ownedNfts`: An array of NFT objects that the address owns. Each NFT object has the following structure.\n  - `contract`:\n    - `address`: The address of the contract or collection that the NFT belongs to.\n  - `id`:\n    - `tokenId`: Raw token id.\n    - `tokenMetadata`:\n      - `tokenType`: The type of token being sent as part of the request (Can be one of [\"erc721\" | \"erc1155\"]).\n  - `title`: The title of the NFT, or an empty string if no title is available.\n  - `description`: The descriptions of the NFT, or an empty string if no description is available.\n  - `tokenUri`: (Optional)\n    - `raw`: Uri representing the location of the NFT's original metadata blob. This is a backup for you to parse\n      when the `metadata` field is not automatically populated.\n    - `gateway`: Public gateway uri for the raw uri.\n  - `media`: (Optional) An array of objects with the following structure.\n    - `uri`: A `tokenUri` as described above.\n  - `metadata`: (Optional)\n    - `image`: (Optional) A uri string that should be usable in an \u003cimage\u003e tag.\n    - `attributes`: (Optional) An array of attributes from the NFT metadata. Each attribute is a dictionary with\n      unknown keys and values, as they depend directly on the contract.\n  - `timeLastUpdated`: ISO timestamp of the last cache refresh for the information returned in the metadata field.\n- `pageKey`: (Optional) A key to fetch the next page of results, if applicable.\n- `totalCount`: The total number of NFTs in the result set.\n\nIf metadata is omitted, an object with the following fields is returned:\n\n- `ownedNfts`: An array of NFT objects that the address owns. Each NFT object has the following structure.\n  - `contract`:\n    - `address`: The address of the contract or collection that the NFT belongs to.\n  - `id`:\n    - `tokenId`: Raw token id.\n    - `tokenMetadata`:\n      - `tokenType`: The type of token being sent as part of the request (Can be one of [\"erc721\" | \"erc1155\"]).\n- `pageKey`: (Optional) A key to fetch the next page of results, if applicable.\n- `totalCount`: The total number of NFTs in the result set.\n\n### `web3.alchemy.getNftMetadata({contractAddress, tokenId, tokenType})`\n\n**Parameters:**\n\nAn object with the following fields:\n\n- `contract`: The address of the token contract.\n- `tokenId`: Raw token id (hex string).\n- `tokenType`: (Optional) The type of token being sent as part of the request (Can be one of [\"erc721\" | \"erc1155\"]).\n\n**Returns:**\n\nAn object with the following fields:\n\n- `contract`:\n  - `address`: The hex string of the contract addresses for \"token\" transfers.\n- `id`:\n  - `tokenId`: Raw token id.\n  - `tokenMetadata`:\n    - `tokenType`: The type of token being sent as part of the request (Can be one of [\"erc721\" | \"erc1155\"]).\n- `title`: Name of NFT.\n- `description`: A brief description of the NFT taken from the contract metadata.\n- `tokenUri`: (Optional)\n  - `raw`: Uri representing the location of the NFT's original metadata blob. This is a backup for you to parse when the `metadata` field is not automatically populated.\n  - `gateway`: Public gateway uri for the raw uri.\n- `media`: (Optional) An array of objects with the following structure.\n  - `uri`: A `tokenUri` as described above.\n- `metadata`: (Optional)\n  - `image`: (Optional) A uri string that should be usable in an \u003cimage\u003e tag.\n  - `attributes`: (Optional) An array of attributes from the NFT metadata. Each attribute is a dictionary with unknown keys and values, as they depend directly on the contract.\n- `timeLastUpdated`: ISO timestamp of the last cache refresh for the information returned in the metadata field.\n\n### `web3.alchemy.getTransactionReceipts({blockNumber | blockHash})`\n\nFetches all transaction receipts for a block number or a block hash.\n\n**Parameters:**\n\n- blockNumber - (hex) The block number to get transaction receipts for\n- blockHash - The block hash to get transaction receipts for\n\nNote that either `blockNumber` or `blockHash` can be set.\n\n**Returns:**\n\n- `{receipts: TransactionReceipt[]} | null` - An array of transaction receipts, or `null` if the block number or hash\n  is not found.\n\nThe returned object is a list of transaction receipts for each transaction in this block. See\n[eth_getTransactionReceipt](https://docs.alchemy.com/alchemy/apis/ethereum/eth_gettransactionreceipt#returns)\nfor the payload of an individual transaction receipt.\n\n### `web3.eth.subscribe(\"alchemy_fullPendingTransactions\")`\n\nSubscribes to pending transactions, similar to the standard Web3 call\n`web3.eth.subscribe(\"pendingTransactions\")`, but differs in that it emits\nfull transaction information rather than just transaction hashes.\n\nNote that the argument passed to this function is permitted to be either of\n`\"alchemy_fullPendingTransactions\"` or `\"alchemy_newFullPendingTransactions\"`,\nwhich have the same effect. The latter is the string used in raw `eth_subscribe`\nJSON-RPC calls, while the former is consistent with the existing Web3.js\nsubscription APIs (for example, `web3.eth.subscribe(\"pendingTransactions\")`\ncorresponds to the raw JSON-RPC call of type `newPendingTransactions`). While\nthis is unfortunately confusing, supporting both strings attempts to balance\nconsistency and convenience.\n\n### `web3.eth.subscribe(\"alchemy_filteredFullPendingTransactions\", options)`\n\nLike an `alchemy_fullPendingTransactions` subscription, but also allows passing\nan `options` argument containing an `address` field to filter the returned\ntransactions to those from or to the specified address. The options argument is\nas described in [the documentation\nhere](https://docs.alchemy.com/alchemy/guides/using-websockets#2-alchemy_filterednewfullpendingtransactions).\n\nSimilar to the previous point, note that the argument passed to this function\nmay be either of `\"alchemy_filteredFullPendingTransactions\"` or\n`\"alchemy_filteredNewPendingTransactions\"`.\n\n\u003cbr/\u003e\n\nCopyright © 2019 Alchemy Insights Inc.\n\n## EIP 1559\n\n### `web3.eth.getFeeHistory(blockRange, startingBlock, percentiles[])`\n\nFetches the fee history for the given block range as per the [eth spec](https://github.com/ethereum/eth1.0-specs/blob/master/json-rpc/spec.json).\n\n**Parameters**\n\n- `blockRange`: The number of blocks for which to fetch historical fees. Can be an integer or a hex string.\n- `startingBlock`: The block to start the search. The result will look backwards from here. Can be a hex string or a predefined block string e.g. \"latest\".\n- `percentiles`: (Optional) An array of numbers that define which percentiles of reward values you want to see for each block.\n\n**Returns**\n\nAn object with the following fields:\n\n- `oldestBlock`: The oldest block in the range that the fee history is being returned for.\n- `baseFeePerGas`: An array of base fees for each block in the range that was looked up. These are the same values that would be returned on a block for the `eth_getBlockByNumber` method.\n- `gasUsedRatio`: An array of the ratio of gas used to gas limit for each block.\n- `reward`: Only returned if a percentiles parameter was provided. Each block will have an array corresponding to the percentiles provided. Each element of the nested array will have the tip provided to miners for the percentile given. So if you provide [50, 90] as the percentiles then each block will have a 50th percentile reward and a 90th percentile reward.\n\n**Example**\n\nMethod call\n\n```\nweb3.eth.getFeeHistory(4, \"latest\", [25, 50, 75]).then(console.log);\n\n```\n\nLogged response\n\n```\n{\n  oldestBlock: 12930639,\n  reward: [\n    [ '0x649534e00', '0x66720b300', '0x826299e00' ],\n    [ '0x649534e00', '0x684ee1800', '0x7ea8ed400' ],\n    [ '0x5ea8dd480', '0x60db88400', '0x684ee1800' ],\n    [ '0x59682f000', '0x5d21dba00', '0x5d21dba00' ]\n  ],\n  baseFeePerGas: [ '0x0', '0x0', '0x0', '0x0', '0x0' ],\n  gasUsedRatio: [ 0.9992898398856537, 0.9999566454373825, 0.9999516, 0.9999378 ]\n}\n```\n\n### `web3.eth.getMaxPriorityFeePerGas()`\n\nReturns a quick estimate for `maxPriorityFeePerGas` in EIP 1559 transactions. Rather than using `feeHistory` and making a calculation yourself you can just use this method to get a quick estimate. Note: this is a geth-only method, but Alchemy handles that for you behind the scenes.\n\n**Parameters**\n\nNone!\n\n**Returns**\n\nA hex, which is the `maxPriorityFeePerGas` suggestion. You can plug this directly into your transaction field.\n\n**Example**\n\nMethod call\n\n```\nweb3.eth.getMaxPriorityFeePerGas().then(console.log);\n```\n\nLogged response\n\n```\n0x560de0700\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falchemyplatform%2Falchemy-web3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falchemyplatform%2Falchemy-web3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falchemyplatform%2Falchemy-web3/lists"}