diff --git a/packages/cli/src/deploy/getDeployClient.ts b/packages/cli/src/deploy/getDeployClient.ts index 87d9672922..fa7b259d79 100644 --- a/packages/cli/src/deploy/getDeployClient.ts +++ b/packages/cli/src/deploy/getDeployClient.ts @@ -1,6 +1,6 @@ import { transactionQueue } from "@latticexyz/common/actions"; import { rhodolite } from "@latticexyz/common/chains"; -import { claimGasPass, getAllowance, hasPassIssuer } from "@latticexyz/paymaster/internal"; +import { claimGasPass, getAllowance, hasPassIssuer, gasEstimator } from "@latticexyz/paymaster/internal"; import { wiresaw } from "@latticexyz/wiresaw/internal"; import { smartAccountActions } from "permissionless"; import { toSimpleSmartAccount } from "permissionless/accounts"; @@ -61,7 +61,8 @@ export async function getDeployClient(opts: { const account = await toSimpleSmartAccount({ client, owner: opts.account }); const bundlerClient = createBundlerClient({ chain, - transport: wiresaw(http(bundlerHttpUrl)), + // TODO: figure out how to remove gas estimator (currently times out if not present) + transport: gasEstimator(wiresaw(http(bundlerHttpUrl))), account, paymaster: { getPaymasterData: async () => ({ diff --git a/packages/entrykit/src/getBundlerTransport.ts b/packages/entrykit/src/getBundlerTransport.ts index 9b71ee460d..ed3b8325ae 100644 --- a/packages/entrykit/src/getBundlerTransport.ts +++ b/packages/entrykit/src/getBundlerTransport.ts @@ -2,13 +2,13 @@ import { transactionQueue } from "@latticexyz/common/actions"; import { Chain, createClient, fallback, http, webSocket } from "viem"; import { privateKeyToAccount, generatePrivateKey } from "viem/accounts"; import { wiresaw } from "@latticexyz/wiresaw/internal"; -import { userOpExecutor } from "@latticexyz/paymaster/internal"; +import { gasEstimator, userOpExecutor } from "@latticexyz/paymaster/internal"; export function getBundlerTransport(chain: Chain) { const bundlerHttpUrl = chain.rpcUrls.bundler?.http[0]; // TODO: bundler websocket const bundlerTransport = bundlerHttpUrl - ? wiresaw(http(bundlerHttpUrl)) + ? gasEstimator(wiresaw(http(bundlerHttpUrl))) : chain.id === 31337 ? userOpExecutor({ executor: createClient({ diff --git a/packages/entrykit/src/onboarding/useSetupSession.ts b/packages/entrykit/src/onboarding/useSetupSession.ts index ba270f872d..771e454cf7 100644 --- a/packages/entrykit/src/onboarding/useSetupSession.ts +++ b/packages/entrykit/src/onboarding/useSetupSession.ts @@ -113,15 +113,6 @@ export function useSetupSession({ userClient }: { userClient: ConnectedClient }) if (!calls.length) return; - // if (!(await userClient.account.isDeployed())) { - // // send empty tx to create the smart account, otherwise the first tx may fail due to bad gas estimation - // console.log("creating smart account at", userClient.account.address); - // const hash = await getAction(userClient, sendUserOperation, "sendUserOperation")({ calls: [] }); - // console.log("tx:", hash); - // const receipt = await getAction(userClient, waitForTransactionReceipt, "waitForTransactionReceipt")({ hash }); - // console.log("receipt:", receipt.status); - // } - console.log("setting up account with", calls, userClient); const hash = await getAction(userClient, sendUserOperation, "sendUserOperation")({ calls }); console.log("got user op hash", hash);