TransactionContext
For the complete documentation index, see llms.txt
Midnight.js API Reference v4.0.4
Midnight.js API Reference / @midnight-ntwrk/midnight-js-contracts / TransactionContext
Interface: TransactionContext<C, PCK>
Encapsulates the context for managing a scoped contract transaction.
Type Parameters
C
C extends Contract.Any
PCK
PCK extends Contract.ProvableCircuitId<C> = Contract.ProvableCircuitId<C>
Properties
[CacheStates]
readonly[CacheStates]: (states,identity) =>void
Parameters
states
PublicContractStates | ContractStates<PrivateState<C>>
identity
CachedStateIdentity
Returns
void
[GetCurrentStatesForIdentity]
readonly[GetCurrentStatesForIdentity]: (identity) =>PublicContractStates|ContractStates<PrivateState<C>> |undefined
Parameters
identity
CachedStateIdentity
Returns
PublicContractStates | ContractStates<PrivateState<C>> | undefined
[MergeUnsubmittedCallTxData]
readonly[MergeUnsubmittedCallTxData]: (circuitId,callData,privateStateId?) =>void
Parameters
circuitId
PCK
callData
UnsubmittedCallTxData<C, PCK>
privateStateId?
string
Returns
void
[Submit]
readonly[Submit]: () =>Promise<FinalizedCallTxData<C,PCK>>
Returns
Promise<FinalizedCallTxData<C, PCK>>
[TypeId]
readonly[TypeId]: typeofTypeId
Methods
getAdditionalMappings()
getAdditionalMappings():
ReadonlyMap<string,string> |undefined
Gets the additional scoped CoinPublicKey to EncPublicKey mappings.
Returns
ReadonlyMap<string, string> | undefined
A ReadonlyMap<CoinPublicKey, EncPublicKey> instance, or undefined if no additional
mappings were specified for the current transaction context.
getCurrentStates()
getCurrentStates():
PublicContractStates|ContractStates<PrivateState<C>> |undefined
Gets the current cached contract states within the transaction context.
Returns
PublicContractStates | ContractStates<PrivateState<C>> | undefined
A cached ContractStates instance, or undefined if circuit calls are yet to be made.
Remarks
The returned states represent the unsubmitted running state of the contract within the transaction context, reflecting any unsubmitted circuit calls made to the contract during the scope of the transaction.
getLastUnsubmittedCallTxDataToTransact()
getLastUnsubmittedCallTxDataToTransact(): [
UnsubmittedCallTxData<C,PCK>,string?] |undefined
Gets the last unsubmitted call transaction data.
Returns
[UnsubmittedCallTxData<C, PCK>, string?] | undefined
A tuple containing an UnsubmittedCallTxData instance, and an optional private state
ID, or undefined if circuit calls are yet to be made.