# createConstructorContext

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

[**@midnight-ntwrk/compact-runtime v0.21.0**](https://docs.midnight.network/api-reference/compact-runtime.md)

***

[@midnight-ntwrk/compact-runtime](https://docs.midnight.network/api-reference/compact-runtime/globals.md) / createConstructorContext

# Function: createConstructorContext()

```
function createConstructorContext<PS>(initialPrivateState, coinPublicKey): ConstructorContext<PS>;
```

Creates a new [ConstructorContext](https://docs.midnight.network/api-reference/compact-runtime/interfaces/ConstructorContext.md) with the given initial private state and an empty Zswap local state.

## Type Parameters[​](#type-parameters "Direct link to Type Parameters")

### PS[​](#ps "Direct link to PS")

`PS`

## Parameters[​](#parameters "Direct link to Parameters")

### initialPrivateState[​](#initialprivatestate "Direct link to initialPrivateState")

`PS`

The private state to use to execute the contract's constructor.

### coinPublicKey[​](#coinpublickey "Direct link to coinPublicKey")

The Zswap coin public key of the user executing the contract.

`string` | [`EncodedCoinPublicKey`](https://docs.midnight.network/api-reference/compact-runtime/interfaces/EncodedCoinPublicKey.md)

## Returns[​](#returns "Direct link to Returns")

[`ConstructorContext`](https://docs.midnight.network/api-reference/compact-runtime/interfaces/ConstructorContext.md)<`PS`>
