Skip to content

Commit 0906347

Browse files
committed
feat: custom polling interval for select chains
1 parent 94370d5 commit 0906347

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

packages/core/clients/kernelAccountClient.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
} from "viem/account-abstraction"
2727
import type { KernelSmartAccountImplementation } from "../accounts/index.js"
2828
import { getUserOperationGasPrice } from "../actions/index.js"
29+
import { FAST_POLLING_CHAIN_IDS } from "../constants.js"
2930
import {
3031
type KernelAccountClientActions,
3132
kernelAccountClientActions
@@ -142,15 +143,23 @@ export function createKernelAccountClient(
142143
userOperation
143144
} = parameters
144145

146+
const chain = parameters.chain ?? client_?.chain
147+
const defaultPollingInterval = FAST_POLLING_CHAIN_IDS.includes(
148+
chain?.id as number
149+
)
150+
? 250
151+
: 1000
152+
145153
const client = Object.assign(
146154
createClient({
147155
...parameters,
148-
chain: parameters.chain ?? client_?.chain,
156+
chain,
149157
transport: bundlerTransport,
150158
key,
151159
name,
152160
type: "kernelAccountClient",
153-
pollingInterval: parameters.pollingInterval ?? 1000
161+
pollingInterval:
162+
parameters.pollingInterval ?? defaultPollingInterval
154163
}),
155164
{ client: client_, paymaster, paymasterContext, userOperation }
156165
)

packages/core/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,5 @@ export const getEntryPoint = <TEntryPointVersion extends EntryPointVersion>(
171171

172172
export const KERNEL_7702_DELEGATION_ADDRESS =
173173
"0xd6CEDDe84be40893d153Be9d467CD6aD37875b28"
174+
175+
export const FAST_POLLING_CHAIN_IDS = [1, 10, 56, 137, 8453, 42161, 84532]

0 commit comments

Comments
 (0)