Created
May 28, 2024 13:42
-
-
Save parisyup/0544617632530b19ec96b933f035669a 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
// Multiple Commands not permitted | |
results["Multiple Commands not permitted"] = try { | |
val iouState = IOUState( | |
amount = 10, | |
paid = 3, | |
lender = myInfo.name, | |
borrower = otherMember.name, | |
linearId = UUID.randomUUID(), | |
participants = listOf(myInfo.ledgerKeys.first(), otherMember.ledgerKeys.first()) | |
) | |
val txBuilder = ledgerService.createTransactionBuilder() | |
.setNotary(notary.name) | |
.setTimeWindowBetween(Instant.now(), Instant.now().plusMillis(Duration.ofDays(1).toMillis())) | |
.addOutputState(iouState) | |
.addInputState(inputStateRef) | |
.addCommand(IOUContract.Issue()) | |
.addCommand(IOUContract.Transfer()) | |
.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("Requires a single command.")) { | |
"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