SmartContractService

Service for managing SmartContracts. Integrates with TrustWeave for verifiable credentials and blockchain anchoring.

Inheritors

Functions

Link copied to clipboard
abstract suspend fun activateContract(contractId: String): Result<SmartContract>

Activate a contract (move from PENDING to ACTIVE).

Link copied to clipboard
abstract suspend fun anchorContract(contract: SmartContract, credential: VerifiableCredential, chainId: String = "algorand:mainnet"): Result<AnchorRef>

Anchor contract to blockchain for audit trail.

Link copied to clipboard
abstract suspend fun bindContract(contractId: String, issuerDid: String, issuerKeyId: String, chainId: String = "algorand:mainnet"): Result<BoundContract>

Bind a contract (issue credential and anchor to blockchain).

Link copied to clipboard
abstract suspend fun createDraft(request: ContractDraftRequest): Result<SmartContract>

Create a contract draft.

Link copied to clipboard
abstract suspend fun evaluateConditions(contract: SmartContract, inputData: JsonElement): Result<ConditionEvaluation>

Evaluate contract conditions.

Link copied to clipboard
abstract suspend fun executeContract(contract: SmartContract, executionContext: ExecutionContext): Result<ExecutionResult>

Execute contract based on execution model.

Link copied to clipboard
suspend fun SmartContractService.executeEvent(contract: SmartContract, vararg eventData: Pair<String, Any?>): Result<ExecutionResult>

Execute a contract with event data supplied as key/value pairs.

Link copied to clipboard
suspend fun SmartContractService.executeParametric(contract: SmartContract, vararg triggerData: Pair<String, Any?>): Result<ExecutionResult>

Execute a contract with parametric trigger data supplied as key/value pairs.

Link copied to clipboard
abstract suspend fun getContract(contractId: String): Result<SmartContract>

Get contract by ID.

Link copied to clipboard
abstract suspend fun issueContractCredential(contract: SmartContract, issuerDid: String, issuerKeyId: String): Result<VerifiableCredential>

Issue verifiable credential for the contract.

Link copied to clipboard
Link copied to clipboard
abstract suspend fun updateStatus(contractId: String, newStatus: ContractStatus, reason: String? = null, metadata: JsonElement? = null): Result<SmartContract>

Update contract status.

Link copied to clipboard
abstract suspend fun verifyContract(credentialId: String): Result<Boolean>

Verify contract credential.