Skip to content

Commit

Permalink
fix: arbitrum min fee per bid needs to be a 1/10th the default on oth…
Browse files Browse the repository at this point in the history
…er chains (#17)

This addresses and issue with how arbitrum handles gas. The min fee per bid needs to be 1/10th the bid on other chains. 

This also fixes an issue where the minimum was 10x higher than it was supposed to be (rundler only requires .1 wei, it was set to 1 wei)
  • Loading branch information
moldy530 authored Jun 5, 2023
1 parent 5747ec1 commit 453ecec
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/core/src/provider/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
type RpcTransactionRequest,
type Transport,
} from "viem";
import { arbitrum, arbitrumGoerli } from "viem/chains";
import { BaseSmartContractAccount } from "../account/base.js";
import { createPublicErc4337Client } from "../client/create-client.js";
import type {
Expand Down Expand Up @@ -68,6 +69,11 @@ export interface SmartAccountProviderOpts {
minPriorityFeePerBid?: bigint;
}

const minPriorityFeePerBidDefaults = new Map<number, bigint>([
[arbitrum.id, 10_000_000n],
[arbitrumGoerli.id, 10_000_000n],
]);

export class SmartAccountProvider<
TTransport extends SupportedTransports = Transport
> implements ISmartAccountProvider<TTransport>
Expand All @@ -86,7 +92,11 @@ export class SmartAccountProvider<
) {
this.txMaxRetries = opts?.txMaxRetries ?? 5;
this.txRetryIntervalMs = opts?.txRetryIntervalMs ?? 2000;
this.minPriorityFeePerBid = opts?.minPriorityFeePerBid ?? 1000000000n;
this.minPriorityFeePerBid =
opts?.minPriorityFeePerBid ??
minPriorityFeePerBidDefaults.get(chain.id) ??
100_000_000n;

this.rpcClient =
typeof rpcProvider === "string"
? createPublicErc4337Client({
Expand Down

0 comments on commit 453ecec

Please sign in to comment.