Skip to content

Commit

Permalink
chore: add userOp chainId as default in signuserop
Browse files Browse the repository at this point in the history
  • Loading branch information
marthendalnunes committed Dec 3, 2024
1 parent 45d93cb commit ca99fdb
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});

Expand Down

0 comments on commit ca99fdb

Please sign in to comment.