Skip to main content

@midnight-ntwrk/midnight-js-contracts v0.1.15 • API


Midnight.js API Reference v0.1.15 / @midnight-ntwrk/midnight-js-contracts / deployContract

Function: deployContract()

deployContract<PSS, PSK, W, C, ICK>(providers, privateStateKey, initialPrivateState, contract, ...args): Promise<DeployedContract<PSS, PSK, C>>

Creates an unsubmitted deployment transaction. This function is the entry point for the transaction construction workflow and is used to create a DeployedContract instance.

Type parameters

PSS extends PrivateStateSchema

PSK extends string | number | symbol

W extends Witnesses<StateWithZswap<PSS[PSK]>>

C extends Contract<StateWithZswap<PSS[PSK]>, W>

ICK extends string

Parameters

providers: MidnightProviders<ICK, PSS>

The providers used to manage the transaction lifecycle.

privateStateKey: PSK

The address of the private state of the witnesses used in the contract.

initialPrivateState: PSS[PSK]

The private state to persist and use in the first call transaction.

contract: C

The contract to use to execute circuits.

• ...args: InitialStateParameters<StateWithZswap<PSS[PSK]>, C>

Arguments to pass to Contract.initialState

Returns

Promise<DeployedContract<PSS, PSK, C>>

Throws

DeployTxFailed If the transaction is submitted successfully but produces an error when executed by the node.