Skip to content
Alchemy Logo

split

function 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.

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),
  }),
});

ParameterTypeDescription

params

SplitTransportParams

split transport configuration containing the methods overrides and fallback transport

CustomTransport

a viem Transport that splits traffic

Was this page helpful?