Skip to content

Commit

Permalink
Update packages/core/src/utils/index.ts
Browse files Browse the repository at this point in the history
Co-authored-by: Ajay Vasisht <[email protected]>
  • Loading branch information
denniswon and avasisht23 committed Nov 29, 2023
1 parent 4106a28 commit 9048fcb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
16 changes: 5 additions & 11 deletions packages/core/src/provider/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,25 +404,19 @@ export class SmartAccountProvider<
const { maxFeePerGas, maxPriorityFeePerGas } =
await this._runMiddlewareStack(uoToSubmit, overrides);

const _maxPriorityFeePerGas =
bigIntMax(
BigInt(maxPriorityFeePerGas ?? 0n),
bigIntPercent(uoToDrop.maxPriorityFeePerGas, 110n)
) ?? 0n;
const _overrides: UserOperationOverrides = {
maxFeePerGas: bigIntMax(
BigInt(maxFeePerGas ?? 0n),
bigIntPercent(
BigInt(uoToDrop.maxFeePerGas) - _maxPriorityFeePerGas,
110n
) + _maxPriorityFeePerGas
bigIntPercent(uoToDrop.maxFeePerGas, 110n)
),
maxPriorityFeePerGas: bigIntMax(
BigInt(maxPriorityFeePerGas ?? 0n),
bigIntPercent(uoToDrop.maxPriorityFeePerGas, 110n)
),
maxPriorityFeePerGas: _maxPriorityFeePerGas,
paymasterAndData: uoToDrop.paymasterAndData,
};

const uoToSend = await this._runMiddlewareStack(uoToSubmit, _overrides);

return this._sendUserOperation(uoToSend);
};

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export function filterUndefined(
obj: Record<string, unknown>
): Record<string, unknown> {
Object.keys(obj).forEach((key) => {
if (obj[key] === undefined) {
if (obj[key] == null) {
delete obj[key];
}
});
Expand Down

0 comments on commit 9048fcb

Please sign in to comment.