diff --git a/apps/popup/src/lib/account-abstraction/account-adapters/to-universal-account.ts b/apps/popup/src/lib/account-abstraction/account-adapters/to-universal-account.ts index 0b59cefc..aebc9d68 100644 --- a/apps/popup/src/lib/account-abstraction/account-adapters/to-universal-account.ts +++ b/apps/popup/src/lib/account-abstraction/account-adapters/to-universal-account.ts @@ -241,17 +241,18 @@ export async function toUniversalAccount( }, async signUserOperation(parameters) { - const { ...userOperation } = parameters; + const { chainId: userOpChainId, ...userOperation } = parameters; const address = await this.getAddress(); - const _chainId = client?.chain?.id; - if (typeof _chainId !== 'number' || !isValidChain(_chainId)) { + const chainId = userOpChainId ?? client?.chain?.id; + + if (!isValidChain(chainId)) { throw new BaseError('Invalid chainId'); } // @ts-ignore const packedUserOperationHash = getUserOperationHash(userOperation); const packedUserOpTypedHash = getPackedUserOperationTypedDataHash({ address, - chainId: _chainId, + chainId, packedUserOperationHash, });