gas_prices
Get real-time gas price estimates for blockchain transactions to optimize costs and confirmation times. Specify network and transaction type (ERC20, native tokens, or Uniswap V3).
Instructions
Get real-time gas estimates for different transaction speeds on a specific network, enabling users to optimize transaction costs and confirmation times. Requires chainName (blockchain network) and eventType (erc20, nativetokens, or uniswapv3). Optional parameter quoteCurrency allows conversion to different currencies (USD, EUR, etc). Returns estimated gas prices for low, medium, and high priority transactions for the specified event type.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chainName | Yes | The blockchain network to get gas prices for (e.g., 'eth-mainnet', 'matic-mainnet', 'bsc-mainnet'). | |
| eventType | Yes | Type of transaction to estimate gas for: 'erc20' for token transfers, 'nativetokens' for native transfers, 'uniswapv3' for DEX swaps. | |
| quoteCurrency | No | Currency to quote gas costs in (e.g., 'USD', 'EUR'). If not specified, uses default quote currency. |
Implementation Reference
- src/services/BaseService.ts:53-76 (handler)The handler function for the "gas_prices" tool, which executes the gas price estimate request using the goldRushClient.
async (params) => { try { const response = await goldRushClient.BaseService.getGasPrices( params.chainName as Chain, params.eventType, { quoteCurrency: params.quoteCurrency as Quote, } ); return { content: [ { type: "text", text: stringifyWithBigInt(response.data), }, ], }; } catch (err) { return { content: [{ type: "text", text: `Error: ${err}` }], isError: true, }; } } - src/services/BaseService.ts:35-52 (schema)The Zod schema defining the input parameters for the "gas_prices" tool.
{ chainName: z .enum(Object.values(ChainName) as [string, ...string[]]) .describe( "The blockchain network to get gas prices for (e.g., 'eth-mainnet', 'matic-mainnet', 'bsc-mainnet')." ), eventType: z .enum(["erc20", "nativetokens", "uniswapv3"]) .describe( "Type of transaction to estimate gas for: 'erc20' for token transfers, 'nativetokens' for native transfers, 'uniswapv3' for DEX swaps." ), quoteCurrency: z .enum(Object.values(validQuoteValues) as [string, ...string[]]) .optional() .describe( "Currency to quote gas costs in (e.g., 'USD', 'EUR'). If not specified, uses default quote currency." ), }, - src/services/BaseService.ts:29-77 (registration)Registration of the "gas_prices" tool using server.tool within addBaseServiceTools.
server.tool( "gas_prices", "Get real-time gas estimates for different transaction speeds on a specific network, enabling users to optimize transaction costs and confirmation times. " + "Requires chainName (blockchain network) and eventType (erc20, nativetokens, or uniswapv3). " + "Optional parameter quoteCurrency allows conversion to different currencies (USD, EUR, etc). " + "Returns estimated gas prices for low, medium, and high priority transactions for the specified event type.", { chainName: z .enum(Object.values(ChainName) as [string, ...string[]]) .describe( "The blockchain network to get gas prices for (e.g., 'eth-mainnet', 'matic-mainnet', 'bsc-mainnet')." ), eventType: z .enum(["erc20", "nativetokens", "uniswapv3"]) .describe( "Type of transaction to estimate gas for: 'erc20' for token transfers, 'nativetokens' for native transfers, 'uniswapv3' for DEX swaps." ), quoteCurrency: z .enum(Object.values(validQuoteValues) as [string, ...string[]]) .optional() .describe( "Currency to quote gas costs in (e.g., 'USD', 'EUR'). If not specified, uses default quote currency." ), }, async (params) => { try { const response = await goldRushClient.BaseService.getGasPrices( params.chainName as Chain, params.eventType, { quoteCurrency: params.quoteCurrency as Quote, } ); return { content: [ { type: "text", text: stringifyWithBigInt(response.data), }, ], }; } catch (err) { return { content: [{ type: "text", text: `Error: ${err}` }], isError: true, }; } } );