Created
June 4, 2024 06:57
-
-
Save parisyup/9e5a556bbf399f9234bdfae17736d2b0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Only Two Participants | |
results["Only Two Participants"] = try { | |
val iouState = IOUState( | |
amount = 10, | |
paid = 3, | |
lender = myInfo.name, | |
borrower = otherMember.name, | |
linearId = UUID.randomUUID(), | |
participants = listOf(myInfo.ledgerKeys.first()) | |
) | |
val txBuilder = ledgerService.createTransactionBuilder() | |
.setNotary(notary.name) | |
.setTimeWindowBetween(Instant.now(), Instant.now().plusMillis(Duration.ofDays(1).toMillis())) | |
.addOutputState(iouState) | |
.addCommand(IOUContract.Issue()) | |
.addSignatories(iouState.participants) | |
@Suppress("DEPRECATION", "UNUSED_VARIABLE") | |
val signedTransaction = txBuilder.toSignedTransaction() | |
"Fail" | |
} catch (e:Exception) { | |
val exceptionMessage = e.message ?: "No exception message" | |
if (exceptionMessage.contains("only two participants")) { | |
"Pass" } | |
else { | |
"Contract failed but with a different Exception: ${e.message}" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment