@@ -18,6 +18,7 @@ package io.onixlabs.corda.identityframework.contract
18
18
19
19
import net.corda.core.contracts.BelongsToContract
20
20
import net.corda.core.contracts.StateRef
21
+ import net.corda.core.contracts.UniqueIdentifier
21
22
import net.corda.core.crypto.SecureHash
22
23
import net.corda.core.identity.AbstractParty
23
24
import net.corda.core.identity.CordaX500Name
@@ -35,9 +36,17 @@ val CLAIM_2 = CordaClaim(IDENTITY_B.party, IDENTITY_B.party, "example", 123)
35
36
val EMPTY_REF = StateRef (SecureHash .zeroHash, 0 )
36
37
37
38
@BelongsToContract(CordaClaimContract ::class )
38
- data class CustomCordaClaim (override val participants : List <AbstractParty > = emptyList()) :
39
- CordaClaim <String >(IDENTITY_A .party, IDENTITY_B .party, " example" , " Hello, World!" ) {
40
- fun withIssuerAndHolder () = copy(participants = listOf (issuer, holder))
41
- fun withoutIssuer () = copy(participants = listOf (holder))
42
- fun withoutHolder () = copy(participants = listOf (issuer))
39
+ class CustomCordaClaim (
40
+ value : String = " Hello, World!" ,
41
+ previousStateRef : StateRef ? = null ,
42
+ override val participants : List <AbstractParty > = emptyList()
43
+ ) : CordaClaim<String>(IDENTITY_A .party, IDENTITY_B .party, " example" , value, UniqueIdentifier (), previousStateRef) {
44
+
45
+ override fun amend (previousStateRef : StateRef , value : String ): CordaClaim <String > {
46
+ return CustomCordaClaim (value, previousStateRef)
47
+ }
48
+
49
+ fun withIssuerAndHolder () = CustomCordaClaim (participants = listOf (issuer, holder))
50
+ fun withoutIssuer () = CustomCordaClaim (participants = listOf (holder))
51
+ fun withoutHolder () = CustomCordaClaim (participants = listOf (issuer))
43
52
}
0 commit comments