UNPKG

@fastlane-labs/shbundler-sdk

Version:

SDK for interacting with Fastlane's 4337 ShBundler

47 lines (43 loc) 1.58 kB
import { LocalAccount, Chain, Address, createPublicClient, createWalletClient } from 'viem'; import { createPaymasterClient, createBundlerClient } from 'viem/account-abstraction'; interface ShBundlerClientOptions { signer: LocalAccount; rpcUrl: string; chain: Chain; bundlerUrl?: string; paymasterUrl?: string; paymasterAddress?: Address; entryPointVersion?: "0.7" | "0.8"; } interface SendUserOperationParams { to: Address; data: `0x${string}`; chain: Chain; paymasterContext?: { paymasterAddress: Address; mode: "user" | "sponsor"; sponsor?: Address; sponsorSignature?: `0x${string}`; validUntil?: string; validAfter?: string; }; } interface ShBundlerSDK { publicClient: ReturnType<typeof createPublicClient>; walletClient: ReturnType<typeof createWalletClient>; smartAccount: any; paymasterClient: ReturnType<typeof createPaymasterClient>; bundlerClient: ReturnType<typeof createBundlerClient>; sendUserOperation: (params: SendUserOperationParams) => Promise<`0x${string}`>; } interface ShBundlerFromSmartAccountOptions { smartAccount: any; rpcUrl: string; chain: Chain; bundlerUrl: string; paymasterUrl: string; paymasterAddress: Address; } declare function createShBundlerClient(opts: ShBundlerClientOptions): Promise<ShBundlerSDK>; declare function createShBundlerClientFromSmartAccount(opts: ShBundlerFromSmartAccountOptions): Promise<ShBundlerSDK>; export { createShBundlerClient, createShBundlerClientFromSmartAccount };