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
import { split } from "@aa-sdk/core";
Usage
import { createPublicClient, http } from "viem";
import { split } from "@aa-sdk/core";
const bundlerMethods = [
"eth_sendUserOperation",
"eth_estimateUserOperationGas",
"eth_getUserOperationReceipt",
"eth_getUserOperationByHash",
"eth_supportedEntryPoints",
];
const clientWithSplit = createPublicClient({
transport: split({
overrides: [
{
methods: bundlerMethods,
transport: http(BUNDLER_RPC_URL),
},
],
fallback: http(OTHER_RPC_URL),
}),
});
Parameters
params
SplitTransportParams
split transport configuration containing the methods overrides and fallback transport
Returns
CustomTransport
a viem Transport that splits traffic