Skip to content

Commit 71a210b

Browse files
Adding new claim commands.
1 parent ff0ca6a commit 71a210b

File tree

2 files changed

+37
-14
lines changed

2 files changed

+37
-14
lines changed

build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ buildscript {
1414
junit_version = '5.3.1'
1515

1616
onixlabs_group = 'io.onixlabs'
17-
onixlabs_corda_core_release_version = '1.0.0'
17+
onixlabs_corda_core_release_version = '1.1.0'
1818

1919
cordapp_platform_version = 8
2020
cordapp_contract_name = 'ONIXLabs Corda Identity Framework Contract'
@@ -45,7 +45,7 @@ buildscript {
4545
}
4646

4747
group 'io.onixlabs'
48-
version '1.0.0'
48+
version '2.0.0'
4949

5050
subprojects {
5151
repositories {
@@ -65,6 +65,7 @@ subprojects {
6565
}
6666
}
6767

68+
apply plugin: 'java'
6869
apply plugin: 'kotlin'
6970
apply plugin: 'maven-publish'
7071
apply plugin: 'net.corda.plugins.cordapp'

onixlabs-corda-identity-framework-integration/src/main/kotlin/io/onixlabs/corda/identityframework/integration/ClaimCommandService.kt

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,21 @@ import net.corda.core.transactions.SignedTransaction
3939
*/
4040
class ClaimCommandService(rpc: CordaRPCOps) : RPCService(rpc) {
4141

42+
/**
43+
* Issues a claim.
44+
*
45+
* @param claim The claim to issue.
46+
* @param notary The notary to use for the transaction.
47+
* @param observers Additional observers of the transaction.
48+
*/
49+
fun <T : Any> issueClaim(
50+
claim: CordaClaim<T>,
51+
notary: Party? = null,
52+
observers: Set<Party> = emptySet()
53+
): FlowProgressHandle<SignedTransaction> {
54+
return rpc.startTrackedFlow(IssueClaimFlow::Initiator, claim, notary, observers)
55+
}
56+
4257
/**
4358
* Issues a claim.
4459
*
@@ -60,12 +75,24 @@ class ClaimCommandService(rpc: CordaRPCOps) : RPCService(rpc) {
6075
notary: Party? = null,
6176
observers: Set<Party> = emptySet()
6277
): FlowProgressHandle<SignedTransaction> {
63-
return rpc.startTrackedFlow(
64-
IssueClaimFlow::Initiator,
65-
CordaClaim(issuer, holder, property, value, linearId),
66-
notary,
67-
observers
68-
)
78+
val claim = CordaClaim(issuer, holder, property, value, linearId)
79+
return issueClaim(claim, notary, observers)
80+
}
81+
82+
/**
83+
* Amends a claim.
84+
*
85+
* @param T The underlying claim value type.
86+
* @param oldClaim The claim to be consumed.
87+
* @param newClaim The claim to be created.
88+
* @param observers Additional observers of the transaction.
89+
*/
90+
fun <T : Any> amendClaim(
91+
oldClaim: StateAndRef<CordaClaim<T>>,
92+
newClaim: CordaClaim<T>,
93+
observers: Set<Party> = emptySet()
94+
): FlowProgressHandle<SignedTransaction> {
95+
return rpc.startTrackedFlow(AmendClaimFlow::Initiator, oldClaim, newClaim, observers)
6996
}
7097

7198
/**
@@ -81,12 +108,7 @@ class ClaimCommandService(rpc: CordaRPCOps) : RPCService(rpc) {
81108
value: T,
82109
observers: Set<Party> = emptySet()
83110
): FlowProgressHandle<SignedTransaction> {
84-
return rpc.startTrackedFlow(
85-
AmendClaimFlow::Initiator,
86-
claim,
87-
claim.amend(value),
88-
observers
89-
)
111+
return amendClaim(claim, claim.amend(value), observers)
90112
}
91113

92114
/**

0 commit comments

Comments
 (0)