split

The Split Transport allows you to split RPC traffic for specific methods across different RPC providers. This is done by specifying the methods you want handled specially as overrides and providing a fallback transport for all other methods.

Import

1import { split } from "@aa-sdk/core";

Usage

1import { createPublicClient, http } from "viem";
2import { split } from "@aa-sdk/core";
3
4const bundlerMethods = [
5 "eth_sendUserOperation",
6 "eth_estimateUserOperationGas",
7 "eth_getUserOperationReceipt",
8 "eth_getUserOperationByHash",
9 "eth_supportedEntryPoints",
10];
11
12const clientWithSplit = createPublicClient({
13 transport: split({
14 overrides: [
15 {
16 methods: bundlerMethods,
17 transport: http(BUNDLER_RPC_URL),
18 },
19 ],
20 fallback: http(OTHER_RPC_URL),
21 }),
22});

Parameters

params

SplitTransportParams split transport configuration containing the methods overrides and fallback transport

Returns

CustomTransport a viem Transport that splits traffic