Skip to content

Commit

Permalink
add a description to BlockchainTxLogEntry (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
Essbante authored May 11, 2022
1 parent 8417ed9 commit 7881311
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
14 changes: 7 additions & 7 deletions src/main/kotlin/com/rootsid/wal/library/DLT.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private fun transactionId(oid: AtalaOperationId): String {
* @param action action associated with the operation (for traceability)
* @return Log Entry
*/
private fun waitForSubmission(nodePublicApi: NodePublicApi, operationId: AtalaOperationId, action: BlockchainTxAction): BlockchainTxLogEntry {
private fun waitForSubmission(nodePublicApi: NodePublicApi, operationId: AtalaOperationId, action: BlockchainTxAction, description: String): BlockchainTxLogEntry {
var status = runBlocking {
nodePublicApi.getOperationInfo(operationId).status
}
Expand All @@ -62,7 +62,7 @@ private fun waitForSubmission(nodePublicApi: NodePublicApi, operationId: AtalaOp
}
val tid = transactionId(operationId)
println("Track the transaction in:\n- ${Config.TESTNET_URL}$tid\n")
return BlockchainTxLogEntry(tid, action, "${Config.TESTNET_URL}$tid")
return BlockchainTxLogEntry(tid, action, "${Config.TESTNET_URL}$tid", description)
}

/**
Expand Down Expand Up @@ -269,7 +269,7 @@ fun publishDid(wallet: Wallet, didAlias: String): Wallet {
}

wallet.addBlockchainTxLog(
waitForSubmission(nodeAuthApi, createDidOperationId, BlockchainTxAction.PUBLISH_DID)
waitForSubmission(nodeAuthApi, createDidOperationId, BlockchainTxAction.PUBLISH_DID, "${did.alias}")
)
waitUntilConfirmed(nodeAuthApi, createDidOperationId)

Expand Down Expand Up @@ -345,7 +345,7 @@ fun addKey(wallet: Wallet, didAlias: String, keyId: String, keyTypeValue: Int):
}

wallet.addBlockchainTxLog(
waitForSubmission(nodeAuthApi, updateDidOperationId, BlockchainTxAction.ADD_KEY)
waitForSubmission(nodeAuthApi, updateDidOperationId, BlockchainTxAction.ADD_KEY, "${didAlias}/${keyId}")
)
waitUntilConfirmed(nodeAuthApi, updateDidOperationId)

Expand Down Expand Up @@ -404,7 +404,7 @@ fun revokeKey(wallet: Wallet, didAlias: String, keyId: String): Wallet {
}

wallet.addBlockchainTxLog(
waitForSubmission(nodeAuthApi, updateDidOperationId, BlockchainTxAction.REVOKE_KEY)
waitForSubmission(nodeAuthApi, updateDidOperationId, BlockchainTxAction.REVOKE_KEY, "${didAlias}/${keyId}")
)
waitUntilConfirmed(nodeAuthApi, updateDidOperationId)

Expand Down Expand Up @@ -473,7 +473,7 @@ fun issueCredential(wallet: Wallet, didAlias: String, issuedCredential: IssuedCr
}

wallet.addBlockchainTxLog(
waitForSubmission(nodeAuthApi, issueCredentialsOperationId, BlockchainTxAction.ISSUE_CREDENTIAL)
waitForSubmission(nodeAuthApi, issueCredentialsOperationId, BlockchainTxAction.ISSUE_CREDENTIAL, "${didAlias}/${issuedCredential.alias}")
)
waitUntilConfirmed(nodeAuthApi, issueCredentialsOperationId)

Expand Down Expand Up @@ -531,7 +531,7 @@ fun revokeCredential(wallet: Wallet, credentialAlias: String): Wallet {
}

wallet.addBlockchainTxLog(
waitForSubmission(nodeAuthApi, revokeOperationId, BlockchainTxAction.REVOKE_CREDENTIAL)
waitForSubmission(nodeAuthApi, revokeOperationId, BlockchainTxAction.REVOKE_CREDENTIAL, "${credentialAlias}")
)
waitUntilConfirmed(nodeAuthApi, revokeOperationId)

Expand Down
3 changes: 2 additions & 1 deletion src/main/kotlin/com/rootsid/wal/library/Model.kt
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ data class KeyPair(
data class BlockchainTxLogEntry(
val txId: String,
val action: BlockchainTxAction,
val url: String
val url: String,
val description: String
)

// Enum for blockchain tx actions
Expand Down

0 comments on commit 7881311

Please sign in to comment.