submitDeployTx
Midnight.js API Reference v3.1.0
Midnight.js API Reference / @midnight-ntwrk/midnight-js-contracts / submitDeployTx
Function: submitDeployTx()
Creates and submits a deploy transaction for the given contract.
Transaction Execution Phases
Midnight transactions execute in two phases:
- Guaranteed phase: If failure occurs, the transaction is NOT included in the blockchain
- Fallible phase: If failure occurs, the transaction IS recorded on-chain as a partial success
Failure Behavior
Guaranteed Phase Failure:
- Transaction is rejected and not included in the blockchain
DeployTxFailedErroris thrown with transaction data- Private state (if
privateStateIdprovided) is NOT stored - Contract signing key is NOT stored in private state provider
- Contract is NOT deployed
Fallible Phase Failure:
- Transaction is recorded on-chain with non-
SucceedEntirelystatus DeployTxFailedErroris thrown with transaction data- Private state (if
privateStateIdprovided) is NOT stored - Contract signing key is NOT stored in private state provider
- Transaction appears in blockchain history as partial success
- Contract may be partially deployed but not functional
Param
The providers used to manage the deploy lifecycle.
Param
Configuration.
Throws
When transaction fails in either guaranteed or fallible phase. The error contains the finalized transaction data for debugging.
Call Signature
submitDeployTx<
C>(providers,options):Promise<FinalizedDeployTxData<C>>
Type Parameters
C
C extends Contract<undefined, Witnesses<undefined>>
Parameters
providers
ContractProviders<C, ImpureCircuitId<C>, unknown>
options
Returns
Promise<FinalizedDeployTxData<C>>
Call Signature
submitDeployTx<
C>(providers,options):Promise<FinalizedDeployTxData<C>>
Type Parameters
C
C extends Any
Parameters
providers
options
DeployTxOptionsWithPrivateStateId<C>
Returns
Promise<FinalizedDeployTxData<C>>