getUserOperationGasPrice
Return the gas price that Pimlico's bundler will accept for the User Operation.
Usage
import { pimlicoClient } from "./client"
const smartAccountClient = createSmartAccountClient({
account,
chain: sepolia,
bundlerTransport: http(pimlicoUrl),
paymaster: pimlicoClient,
userOperation: {
estimateFeesPerGas: async () => {
return (await pimlicoClient.getUserOperationGasPrice()).fast
},
}
})
/* other gas alternatives */
const gasPriceResult = await pimlicoClient.getUserOperationGasPrice()
/**
* {
"slow": {
"maxFeePerGas": 3267781404n,
"maxPriorityFeePerGas": 3267781404n
},
"standard": {
"maxFeePerGas": 3439769899n,
"maxPriorityFeePerGas": 3439769899n
},
"fast": {
"maxFeePerGas": 3620810421n,
"maxPriorityFeePerGas": 3620810421n
}
}
*/import { createPimlicoClient } from "permissionless/clients/pimlico"
import { http } from "viem"
import { entryPoint07Address } from "viem/account-abstraction"
import { sepolia } from "viem/chains"
export const pimlicoClient = createPimlicoClient({
chain: sepolia,
entryPoint: {
address: entryPoint07Address,
version: "0.7",
},
transport: http("https://api.pimlico.io/v2/sepolia/rpc?apikey=YOUR_API_KEY_HERE"),
})Returns
- Type:
GetUserOperationGasPriceReturnType
The maxFeePerGas and maxPriorityFeePerGas values for the different gas price tiers. Choosing a faster gas price will mean faster inclusion by the Pimlico Bundler.