@tevm/actions
Version:
A typesafe library for writing forge scripts in typescript
17 lines (15 loc) • 532 B
JavaScript
import { numberToHex } from '@tevm/utils'
import { gasPriceHandler } from './gasPriceHandler.js'
/**
* @param {Parameters<typeof gasPriceHandler>[0]} options
* @returns {import('./EthProcedure.js').EthGasPriceJsonRpcProcedure}
*/
export const gasPriceProcedure =
({ getVm, forkTransport }) =>
async (req) => ({
...(req.id ? { id: req.id } : {}),
jsonrpc: '2.0',
method: req.method,
// TODO pass in a client instead
result: await gasPriceHandler(/** @type any*/ ({ getVm, forkTransport }))({}).then(numberToHex),
})