> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://www.getfoundry.sh/api/mcp` to find what you need.
>
> **Have feedback?** Use `submit_feedback` on the same MCP server.

## `getBroadcasts`

### Signature

```solidity
function getBroadcasts(string calldata contractName, uint64 chainId, BroadcastTxType txType) external view returns (BroadcastTxSummary[] memory);
function getBroadcasts(string calldata contractName, uint64 chainId) external view returns (BroadcastTxSummary[] memory);
```

`BroadcastTxType` and `BroadcastTxSummary` are described on the [`getBroadcast`](/reference/cheatcodes/get-broadcast#returns) page.

### Description

Returns every transaction for `contractName` on `chainId` with type `txType`, read from the [broadcast files](/forge/broadcast-files) that `forge script --broadcast` writes. Without `txType`, calls and deployments are both returned.

`contractName` is matched against the `contractName` key of each transaction. Only transactions with a receipt are returned.

The cheatcode reads every timestamped run file under the [`broadcast`](/config/reference/project#broadcast) directory, from any script, and skips `-latest` files. The result is sorted newest first: by run file timestamp, then by block number within a run. Transactions in the same block stay in the order the script sent them, oldest first.

### Parameters

| Parameter      | Type              | Description                                          |
|----------------|-------------------|------------------------------------------------------|
| `contractName` | `string`          | The contract name, as recorded in the broadcast file |
| `chainId`      | `uint64`          | The chain to look up                                 |
| `txType`       | `BroadcastTxType` | `Call`, `Create` or `Create2`. Optional              |

### Returns

| Type                   | Description                            |
|------------------------|----------------------------------------|
| `BroadcastTxSummary[]` | The transactions, most recent first    |

### Examples

`script/Deploy.s.sol` deploys two `Counter` contracts and then calls `increment()` on the first one. Broadcasting it to a local Anvil node (chain ID 31337) wrote `broadcast/Deploy.s.sol/31337/run-<timestamp>.json`, which the test below reads.

:::code-group
```solidity [test/BroadcastLookup.t.sol]
// [!include ~/snippets/projects/broadcast_lookup/test/BroadcastLookup.t.sol:get-broadcasts]
```

```solidity [script/Deploy.s.sol]
// [!include ~/snippets/projects/broadcast_lookup/script/Deploy.s.sol]
```
:::

### Gotchas

* Returns an empty array when nothing matches. Unlike [`getBroadcast`](/reference/cheatcodes/get-broadcast), it does not revert, and run files without receipts, such as `dry-run` simulations, add nothing.
* Reverts with `broadcast dir does not exist or is not a directory` when the `broadcast` directory is missing.

### Related Cheatcodes

* [`getBroadcast`](/reference/cheatcodes/get-broadcast) - Returns the most recent transaction of a given type
* [`getDeployments`](/reference/cheatcodes/get-deployments) - Returns every deployment address of a contract

### See Also

* [Broadcast files](/forge/broadcast-files)
