Skip to content

Instantly share code, notes, and snippets.

@lankydan
Last active April 3, 2020 16:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lankydan/4f59817a23d0b077f1e6521d3ad7956b to your computer and use it in GitHub Desktop.
Save lankydan/4f59817a23d0b077f1e6521d3ad7956b to your computer and use it in GitHub Desktop.
Verifying transactions with csv attachments - building a transaction
private fun transaction(): TransactionBuilder =
TransactionBuilder(notary()).apply {
val attachmentId = attachment()
addOutputState(message)
addCommand(Command(Send(attachmentId), message.participants.map(Party::owningKey)))
addAttachment(attachmentId)
}
private fun attachment(): AttachmentId {
return serviceHub.attachments.queryAttachments(
AttachmentQueryCriteria.AttachmentsQueryCriteria(
filenameCondition = Builder.equal(
attachmentName
)
)
).first()
}
@adelrustum
Copy link

Dan,

I think you forgot adding attachmentName as an input parameter in your function signature; it should be:

private fun attachment(attachmentName: String): AttachmentId

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment