Custom bundlerUrl does not get passed down to userop methods
Closed this issue · 1 comments
I am currently unable to use a custom bundler URL with Connect. Looking at my network tab, it seems like it always ends up calling the thirdweb bundler instead of the bundler I specify in my Web3Connect button.
I believe this is caused by the fact that the createUnsignedUserOp
function is currently not passing down custom bundler URLs to downstream methods such as getGasFees
We have the following in createUnsignedUserOp
:
async function createUnsignedUserOp(args) {
const { transaction: executeTx, accountContract, factoryContract, adminAddress, overrides, sponsorGas, waitForDeployment = true, } = args;
const chain = executeTx.chain;
const client = executeTx.client;
const bundlerOptions = {
client,
chain,
entrypointAddress: overrides?.entrypointAddress,
};
const entrypointVersion = (0, constants_js_1.getEntryPointVersion)(args.overrides?.entrypointAddress || constants_js_1.ENTRYPOINT_ADDRESS_v0_6);
const [isDeployed, callData, callGasLimit, gasFees, nonce] = await Promise.all([
(0, is_contract_deployed_js_1.isContractDeployed)(accountContract),
(0, encode_js_1.encode)(executeTx),
(0, resolve_promised_value_js_1.resolvePromisedValue)(executeTx.gas),
getGasFees({
executeTx,
bundlerOptions,
chain,
client,
}),
getAccountNonce({
accountContract,
chain,
client,
entrypointAddress: overrides?.entrypointAddress,
getNonceOverride: overrides?.getAccountNonce,
}),
]);
...
<omitting the rest of the function>
Notably, the const bundlerOptions
here does not provide an override for bundlerUrl
Then, in getGasFees
we have:
async function getGasFees(args) {
const { executeTx, bundlerOptions, chain, client } = args;
let { maxFeePerGas, maxPriorityFeePerGas } = executeTx;
const bundlerUrl = bundlerOptions?.bundlerUrl ?? (0, constants_js_1.getDefaultBundlerUrl)(chain);
...
<omitting the rest of the function>
By construction, const bundlerUrl = bundlerOptions?.bundlerUrl ?? (0, constants_js_1.getDefaultBundlerUrl)(chain);
will always end up using the default bundler since bundlerOptions
passed in from createUnsignedUserOp
doesn't actually override