Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eth_chainId request sent to paymaster url instead of bundler #1152

Open
itsdeka opened this issue Feb 26, 2025 · 4 comments
Open

eth_chainId request sent to paymaster url instead of bundler #1152

itsdeka opened this issue Feb 26, 2025 · 4 comments

Comments

@itsdeka
Copy link

itsdeka commented Feb 26, 2025

I assume you're developing the latest version of safe-core-sdk using pimlico.
Unfortunately this makes the library not compatible with many other providers.

PimlicoFeeEstimator at line 927 uses the paymasterClient to get the chain id. This fails using another provider (for example Candide).

A simple solution would be to retrieve the chain id using a bundlerClient

const bundlerClient = createBundlerClient(
bundlerUrl
);
const chainId = await this.#getChainId(bundlerClient);

With this change only it's possible to use Pimlico as bundler and Candide (or any other provider) as paymaster.

Ideally there should be a generic fee estimator that does not use pimlico_getUserOperationGasPrice but retrieve maxFeePerGas and maxPriorityFeePerGas from any other source

@dasanra
Copy link
Collaborator

dasanra commented Feb 27, 2025

The Kit was created in a way that can be used with any provider. Pimlico is provided as default but can be changed for any other custom implementation.

When using the createTransaction or getEstimateFee methods, one of the options is the feeEstimator. By default will rely in Pimlico provided one, but the developer can create their own, following the IFeeEstimator interface. Almost all providers have some custom methods for gasEstimation, so it was not possible for us to create a generic fee estimator.

A consideration that needs to be done is that we are about to release a new major version which will change the IFeeEstimator interface.

@mholtzman
Copy link

Couldn't a generic estimator be written using more standard methods like eth_estimateUserOperationGas? I'm running into similar issues and I'm not really sure it's reasonable to expect developers to hand roll a fee estimator as a prerequisite to using this SDK.

@itsdeka
Copy link
Author

itsdeka commented Mar 6, 2025

@mholtzman take a look #1153

@yagopv
Copy link
Member

yagopv commented Mar 7, 2025

Hey!, If you pass an empty estimator to the createTransaction method then only the eth_estimateUserOperationGas is going to be called

createTransaction({ transactions, options: { feeEstimator: {} } })

Anyway, if this don't work, ideally you should implement your own one for another provider. Taking the PimlicoFeeEstimator as base should be relatively easy to adjust the gas estimation using the pre and post methods

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants