split

1function split(params): CustomTransport;

Defined in: aa-sdk/core/src/transport/split.ts:43

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.

Example

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

ParameterTypeDescription

params

SplitTransportParams

split transport configuration containing the methods overrides and fallback transport

Returns

CustomTransport

a viem Transport that splits traffic