There was an error while loading. Please reload this page.
1 parent 1297ac4 commit fb88a90Copy full SHA for fb88a90
1 file changed
src/sdk/common/OperationUtils.ts
@@ -1,13 +1,17 @@
1
import { resolveProperties } from './utils';
2
import { BaseAccountUserOperationStruct } from '../types/user-operation-types';
3
import { toHex } from 'viem';
4
+import { BigNumber } from '../types/bignumber';
5
6
export function toJSON(op: Partial<BaseAccountUserOperationStruct>): Promise<any> {
7
return resolveProperties(op).then((userOp) =>
8
Object.keys(userOp)
9
.map((key) => {
10
let val = (userOp as any)[key];
- if (typeof val !== 'string' || !val.startsWith('0x')) {
11
+ if (typeof val === 'object' && BigNumber.isBigNumber(val)) {
12
+ val = val.toHexString()
13
+ }
14
+ else if (typeof val !== 'string' || !val.startsWith('0x')) {
15
val = toHex(val);
16
}
17
return [key, val];
0 commit comments