Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/funny-facts-beam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"thirdweb": patch
---

Handle serialized bigints for packing userops
16 changes: 8 additions & 8 deletions packages/thirdweb/src/wallets/smart/lib/packUserOp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ function getInitCode(unpackedUserOperation: UserOperationV07) {

function getAccountGasLimits(unpackedUserOperation: UserOperationV07) {
return concat([
pad(toHex(unpackedUserOperation.verificationGasLimit), {
pad(toHex(BigInt(unpackedUserOperation.verificationGasLimit)), {
size: 16,
}),
pad(toHex(unpackedUserOperation.callGasLimit), { size: 16 }),
pad(toHex(BigInt(unpackedUserOperation.callGasLimit)), { size: 16 }),
]) as Hex;
}

function getGasLimits(unpackedUserOperation: UserOperationV07) {
return concat([
pad(toHex(unpackedUserOperation.maxPriorityFeePerGas), {
pad(toHex(BigInt(unpackedUserOperation.maxPriorityFeePerGas)), {
size: 16,
}),
pad(toHex(unpackedUserOperation.maxFeePerGas), { size: 16 }),
pad(toHex(BigInt(unpackedUserOperation.maxFeePerGas)), { size: 16 }),
]) as Hex;
}

Expand All @@ -34,13 +34,13 @@ function getPaymasterAndData(unpackedUserOperation: UserOperationV07) {
unpackedUserOperation.paymaster as Hex,
pad(
toHex(
unpackedUserOperation.paymasterVerificationGasLimit || BigInt(0),
BigInt(unpackedUserOperation.paymasterVerificationGasLimit || 0),
),
{
size: 16,
},
),
pad(toHex(unpackedUserOperation.paymasterPostOpGasLimit || BigInt(0)), {
pad(toHex(BigInt(unpackedUserOperation.paymasterPostOpGasLimit || 0)), {
size: 16,
}),
unpackedUserOperation.paymasterData || ("0x" as Hex),
Expand All @@ -53,11 +53,11 @@ export const getPackedUserOperation = (
): PackedUserOperation => {
return {
sender: userOperation.sender,
nonce: userOperation.nonce,
nonce: BigInt(userOperation.nonce),
initCode: getInitCode(userOperation),
callData: userOperation.callData,
accountGasLimits: getAccountGasLimits(userOperation),
preVerificationGas: userOperation.preVerificationGas,
preVerificationGas: BigInt(userOperation.preVerificationGas),
gasFees: getGasLimits(userOperation),
paymasterAndData: getPaymasterAndData(userOperation),
signature: userOperation.signature,
Expand Down