diff --git a/api/src/feat/transactions/transactions.service.ts b/api/src/feat/transactions/transactions.service.ts index 4d4c126d0..92996bb98 100644 --- a/api/src/feat/transactions/transactions.service.ts +++ b/api/src/feat/transactions/transactions.service.ts @@ -169,19 +169,29 @@ export class TransactionsService { const network = this.networks.get(chain); const paymaster = this.paymasters.for(chain); + const isActive = !!(await network.getCode({ address: asAddress(account) }))?.length; + const getGas = async () => gasInput ?? ( await network.estimateFee({ type: 'eip712', account: asAddress(account), - paymaster, - paymasterInput: encodePaymasterInput({ - token: feeToken, - amount: 0n, - maxAmount: 0n, - }), ...encodeOperations(operations), + // Only active accounts can estimate paymaster fees. Inactive accounts use EOA account code and throw 'Unsupported paymaster flow' + ...(isActive + ? { + paymaster, + paymasterInput: encodePaymasterInput({ + token: feeToken, + amount: 0n, + maxAmount: 0n, + }), + } + : { + paymaster: undefined, + paymasterInput: undefined, + }), }) ).gasLimit;