# alchemyTransport

> Overview of the alchemyTransport function

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

{/* This file is auto-generated by TypeDoc. Do not edit manually. */}

```ts
function alchemyTransport<rpcSchema>(config): AlchemyTransport<rpcSchema>;
```

Defined in: [packages/common/src/transport/alchemy.ts:146](https://github.com/alchemyplatform/aa-sdk/blob/v5.x.x/packages/common/src/transport/alchemy.ts#L146)

Creates an Alchemy HTTP transport for connecting to Alchemy's services.

## Type Parameters

<table>
  <thead>
    <tr>
      <th align="left">Type Parameter</th>
      <th align="left">Default type</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `rpcSchema` *extends* `undefined` | [`RpcSchema`](https://viem.sh)
      </td>

      <td>
        `undefined`
      </td>
    </tr>

  </tbody>
</table>

## Parameters

<table>
  <thead>
    <tr>
      <th align="left">Parameter</th>
      <th align="left">Type</th>
      <th align="left">Description</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `config`
      </td>

      <td>
        [`AlchemyTransportConfig`](../interfaces/AlchemyTransportConfig)
      </td>

      <td>
        The configuration object for the Alchemy transport (extends viem's HttpTransportConfig)
      </td>
    </tr>

  </tbody>
</table>

## Returns

[`AlchemyTransport`](../type-aliases/AlchemyTransport)\<`rpcSchema`>

The configured Alchemy transport function

## Examples

Using API Key:

```ts
import { alchemyTransport } from "@alchemy/common";

const transport = alchemyTransport({ apiKey: "your-api-key" });
```

Using JWT:

```ts
import { alchemyTransport } from "@alchemy/common";

const transport = alchemyTransport({ jwt: "your-jwt-token" });
```

Using URL directly:

```ts
import { alchemyTransport } from "@alchemy/common";

const transport = alchemyTransport({
  url: "https://eth-mainnet.g.alchemy.com/v2/your-key",
});
```

Using custom URL with API key:

```ts
import { alchemyTransport } from "@alchemy/common";

const transport = alchemyTransport({
  url: "https://custom-alchemy.com/v2",
  apiKey: "your-api-key",
});
```

Using custom URL with JWT:

```ts
import { alchemyTransport } from "@alchemy/common";

const transport = alchemyTransport({
  url: "https://custom-alchemy.com/v2",
  jwt: "your-jwt-token",
});
```

Using HTTP debugging options:

```ts
import { alchemyTransport } from "@alchemy/common";

const transport = alchemyTransport({
  apiKey: "your-api-key",
  onFetchRequest: (request) => console.log("Request:", request),
  onFetchResponse: (response) => console.log("Response:", response),
  timeout: 30000,
  retryCount: 3,
  retryDelay: 1000,
});
```