Skip to content
Alchemy Logo

alchemy

function alchemy(config): AlchemyTransport;

Defined in: account-kit/infra/src/alchemyTransport.ts:143

Creates an Alchemy transport with the specified configuration options. When sending all traffic to Alchemy, you must pass in one of rpcUrl, apiKey, or jwt. If you want to send Bundler and Paymaster traffic to Alchemy and Node traffic to a different RPC, you must pass in alchemyConnection and nodeRpcUrl.

If the chain you're using is supported for both Bundler and Node RPCs, then you can do the following:

import { alchemy } from "@account-kit/infra";
 
const transport = alchemy({
  // NOTE: you can also pass in an rpcUrl or jwt here or rpcUrl and jwt
  apiKey: "your-api-key",
});

For AA-only chains, you need to specify the alchemyConnection and nodeRpcUrl since Alchemy only handles the Bundler and Paymaster RPCs for these chains.

import { alchemy } from "@account-kit/infra";
 
const transport = alchemy({
  alchemyConnection: {
    apiKey: "your-api-key",
  },
  nodeRpcUrl: "https://zora.rpc.url",
});

ParameterTypeDescription

config

AlchemyTransportConfig

The configuration object for the Alchemy transport.

AlchemyTransport

The configured Alchemy transport object.

Was this page helpful?