> Aztec.nr API reference, v6.0.0 (mainnet and testnet). Index: https://docs.aztec.network/aztec-nr-api/v6.0.0/llms.txt

# Struct ContractDeployment

Module: `noir_aztec::test::helpers::utils`

```rust
pub struct ContractDeployment<let O: u32> {
    pub env: TestEnvironment,
    pub path: str<O>,
    pub secret: Field,
    pub salt: Field,
    pub immutables_hash: Field,
}
```

## Fields

```rust
env: TestEnvironment
```

```rust
path: str<O>
```

```rust
secret: Field
```

```rust
salt: Field
```

```rust
immutables_hash: Field
```

## Implementations

```rust
impl<let O: u32> ContractDeployment<O>
```

```rust
pub unconstrained fn with_private_initializer<let M: u32, let N: u32, T>(
    self,
    from: AztecAddress,
    initializer_call: PrivateCall<M, N, T>,
) -> AztecAddress
where
    T: Deserialize
```

Finalizes a contract deployment prepared via `TestEnvironment::deploy` by calling a private initializer function from the `from` account.

The `initializer_call` is created by calling the intended private initializer function inside the contract's `interface()` with its arguments:

```rust
contract MyContract {
  #[external("private")]
  #[initializer]
  fn init_fn(owner: AztecAddress) { ... }
}

#[test]
unconstrained fn test_deployment() {
  let contract_address = TestEnvironment::new().deploy("MyContract").with_private_initializer(
    MyContract::interface().init_fn(owner)
  );
}
```

```rust
pub unconstrained fn with_public_initializer<let M: u32, let N: u32, T>(
    self,
    from: AztecAddress,
    initializer_call: PublicCall<M, N, T>,
) -> AztecAddress
where
    T: Deserialize
```

Finalizes a contract deployment prepared via `TestEnvironment::deploy` by calling a public initializer function from the `from` account.

The `initializer_call` is created by calling the intended public initializer function inside the contract's `interface()` with its arguments:

```rust
contract MyContract {
  #[external("public")] #[initializer] fn init_fn(owner: AztecAddress) { ... }
}

#[test] unconstrained fn test_deployment() {
  let contract_address = TestEnvironment::new().deploy("MyContract").with_public_initializer(
    MyContract::interface().init_fn(owner)
  );
}
```

```rust
pub unconstrained fn without_initializer(self) -> AztecAddress
```

Finalizes a contract deployment prepared via `TestEnvironment::deploy` without calling any initializer function.

Note that initializers cannot be manually called once this function returns, since the contract address itself contains a commitment to the lack of initialization arguments as per the protocol rules. Initializers can only be invoked by using the `with_private_initializer` or `with_public_initializer` functions.
