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

# Struct PrivateContextOptions

Module: `noir_aztec::test::helpers::test_environment`

```rust
pub struct PrivateContextOptions
{ /* private fields */ }
```

Configuration values for [`TestEnvironment::private_context_opts`](/aztec-nr-api/v6.0.0/noir_aztec/test/helpers/test_environment/struct.TestEnvironment.md#private_context_opts). Meant to be used by calling `new` and then chaining methods setting each value, e.g.:

```rust
env.private_context_opts(PrivateContextOptions::new().at_anchor_block_number(5), ...);
```

## Implementations

```rust
impl PrivateContextOptions
```

```rust
pub fn new() -> Self
```

Creates a new `PrivateContextOptions` with default values, i.e. the same as if using [`TestEnvironment::private_context`](/aztec-nr-api/v6.0.0/noir_aztec/test/helpers/test_environment/struct.TestEnvironment.md#private_context) instead of [`TestEnvironment::private_context_opts`](/aztec-nr-api/v6.0.0/noir_aztec/test/helpers/test_environment/struct.TestEnvironment.md#private_context_opts). Use [`at_anchor_block_number`](/aztec-nr-api/v6.0.0/noir_aztec/test/helpers/test_environment/struct.PrivateContextOptions.md#at_anchor_block_number) and other methods to set the desired configuration values.

```rust
pub fn at_anchor_block_number(&mut self, anchor_block_number: u32) -> Self
```

Sets the desired anchor block number to base the private context in. Only past block numbers can be specified.

If not set, defaults to the last block number.

```rust
pub fn at_contract_address(&mut self, contract_address: AztecAddress) -> Self
```

Sets the contract address in which the private context will execute, which will affect note and nullifier siloing, storage access, etc.

```rust
pub fn with_gas_limits(&mut self, gas_limits: Gas) -> Self
```

Sets the gas limits for the transaction.

If not set, defaults to the maximum the protocol allows.

```rust
pub fn with_teardown_gas_limits(&mut self, teardown_gas_limits: Gas) -> Self
```

Sets the teardown gas limits for the transaction.

If not set, defaults to 1/8 of the protocol maximum.

```rust
pub fn with_max_fees_per_gas(&mut self, max_fees_per_gas: GasFees) -> Self
```

Sets the maximum fees per gas unit the sender is willing to pay.

If not set, defaults to zero.

```rust
pub fn with_max_priority_fees_per_gas(
    &mut self,
    max_priority_fees_per_gas: GasFees,
) -> Self
```

Sets the maximum priority fees per gas unit.

If not set, defaults to zero.

```rust
pub fn with_gas_settings(&mut self, gas_settings: GasSettings) -> Self
```

Sets all gas settings at once.

Equivalent to calling [`with_gas_limits`](/aztec-nr-api/v6.0.0/noir_aztec/test/helpers/test_environment/struct.PrivateContextOptions.md#with_gas_limits), [`with_teardown_gas_limits`](/aztec-nr-api/v6.0.0/noir_aztec/test/helpers/test_environment/struct.PrivateContextOptions.md#with_teardown_gas_limits), [`with_max_fees_per_gas`](/aztec-nr-api/v6.0.0/noir_aztec/test/helpers/test_environment/struct.PrivateContextOptions.md#with_max_fees_per_gas), and [`with_max_priority_fees_per_gas`](/aztec-nr-api/v6.0.0/noir_aztec/test/helpers/test_environment/struct.PrivateContextOptions.md#with_max_priority_fees_per_gas) individually.
