> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://sdk.railnet.org/api/mcp` to find what you need.

# spawnAccessControl

Deploys an ExternalAccessControl contract via the factory. Requires a `WalletClient` to sign and send the transaction.

## Import

```ts
import { spawnAccessControl } from '@railnetorg/railnet-sdk'
```

## Usage

```ts
import { createWalletClient, http } from 'viem'
import { base } from 'viem/chains'
import { spawnAccessControl } from '@railnetorg/railnet-sdk'

const walletClient = createWalletClient({
  chain: base,
  transport: http(),
})

const hash = await spawnAccessControl(walletClient, {
  factory: '0x1234...',
  initialDefaultAdmin: '0xd2135CfB216b74109775236E36d4b433F1DF507B',
  account: '0xd2135CfB216b74109775236E36d4b433F1DF507B',
})
```

## Returns

`Hash`

The transaction hash.

:::info
Use [`extractAccessControlAddress`](/utilities/receiptHelpers#extractaccesscontroladdress) to extract the deployed access control address from the transaction receipt.
:::

## Parameters

### factory

* **Type:** `Address`

The address of the access control factory contract.

### initialDefaultAdmin

* **Type:** `Address`

The address of the initial default admin.

### initialDelay (optional)

* **Type:** `number`

The initial delay (in seconds) for admin role changes. Defaults to `0`.

### initialRoles (optional)

* **Type:** `Array<{account: Address, role: Hex}>`

Initial roles to grant. Defaults to `[]`.

### deploymentSalt

* **Type:** `Hex`

Fixes the deployed address. Generate it with [`randomSalt`](/utilities/randomSalt) and keep the value.

### account

* **Type:** `Address`

The address of the account executing the transaction.
