Reputation: 39
We have a custom Implementation of Nonfungible token state and Nonfungible token contract in our project. We are using the below piece of code to issue our custom non fungible token.
Party notary = NotaryUtilitiesKt.getPreferredNotary(getServiceHub(),NotaryUtilitiesKt.firstNotary());
TransactionBuilder transactionBuilder = new TransactionBuilder(notary);
IssueTokensUtilitiesKt.addIssueTokens(transactionBuilder, tokensToIssue);
FlowUtilitiesKt.addTokenTypeJar(tokensToIssue, transactionBuilder);
when trying to convert the above obtained transaction builder to a wired transaction( builder.toWireTransaction(serviceHub);
) we are getting an error with the below stack trace.
java.lang.IllegalArgumentException: This AttachmentWithContext was not initialised properly. Please ensure all Corda contracts extending existing Corda contracts also implement the Contract base class.
at net.corda.core.internal.AttachmentWithContext.<init>(AttachmentWithContext.kt:18)
at net.corda.core.transactions.TransactionBuilder.handleContract(TransactionBuilder.kt:487)
at net.corda.core.transactions.TransactionBuilder.selectContractAttachmentsAndOutputStateConstraints(TransactionBuilder.kt:359)
at net.corda.core.transactions.TransactionBuilder.toWireTransactionWithContext(TransactionBuilder.kt:159)
at net.corda.core.transactions.TransactionBuilder.toWireTransactionWithContext$core(TransactionBuilder.kt:146)
at net.corda.core.transactions.TransactionBuilder.toWireTransaction(TransactionBuilder.kt:140)
Upvotes: 1
Views: 190
Reputation: 1053
Like Alesandro said, the error does seem to point to a contract class issue.
Please ensure all Corda contracts extending existing Corda contracts also implement the Contract base class.
I'd double check that your contract class does implement contract correctly. Something like this:
class IOUContract : Contract {
companion object {
@JvmStatic
val IOU_CONTRACT_ID = "net.corda.training.contracts.IOUContract"
}
Good luck!
Upvotes: 1