Skip to content

Commit

Permalink
fix: send transaction clobbers fee (fixes #67) (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
moldy530 authored Aug 11, 2023
1 parent e288f40 commit fbec62d
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions packages/core/src/provider/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,21 @@ export class SmartAccountProvider<
throw new Error("transaction is missing to address");
}

const overrides: UserOperationOverrides = {};
if (request.maxFeePerGas) {
overrides.maxFeePerGas = request.maxFeePerGas;
}
if (request.maxPriorityFeePerGas) {
overrides.maxPriorityFeePerGas = request.maxPriorityFeePerGas;
}

const { hash } = await this.sendUserOperation(
{
target: request.to,
data: request.data ?? "0x",
value: request.value ? fromHex(request.value, "bigint") : 0n,
},
{
maxFeePerGas: request.maxFeePerGas,
maxPriorityFeePerGas: request.maxPriorityFeePerGas,
}
overrides
);

return await this.waitForUserOperationTransaction(hash as Hash);
Expand Down Expand Up @@ -239,11 +244,16 @@ export class SmartAccountProvider<
.filter((x) => x.maxPriorityFeePerGas != null)
.map((x) => fromHex(x.maxPriorityFeePerGas!, "bigint"))
);
const overrides: UserOperationOverrides = {};
if (maxFeePerGas != null) {
overrides.maxFeePerGas = maxFeePerGas;
}

const { hash } = await this.sendUserOperation(batch, {
maxFeePerGas,
maxPriorityFeePerGas,
});
if (maxPriorityFeePerGas != null) {
overrides.maxPriorityFeePerGas = maxPriorityFeePerGas;
}

const { hash } = await this.sendUserOperation(batch, overrides);

return await this.waitForUserOperationTransaction(hash as Hash);
};
Expand Down

0 comments on commit fbec62d

Please sign in to comment.