Skip to content
CCPEDIAby Unity Nodes
App Development

DAML learning - Messaging feature

3 posts285 views10 likesLast activity Jul 2021

  1. ariscatanOP 2

    Hi all,
    I am just new to DAML and excited to learn. Currently I am following the daml learn and I am on the topic
    " Add a new feature with UI elements to your Daml app" on Step 5 of 7. I get this error in my VS Code and when compiled I get the error below kindly see screenshot. Let me know if I need to do fixing on other code but I just actually followed what is on the step.

    Thanks and really appreciated your thoughts.

    Best

  2. cocreature 4

    Hi @ariscatan and welcome to the forum!

    Looking at the error it seems like there might have been a mixup between the fields in the Message template and those in the SendMessage choice.
    Copying from the documentation, the Message template has 3 fields including a receiver field.

    template Message with
        sender: Party
        receiver: Party
        content: Text
      where
        signatory sender, receiver
    

    while the SendMessage choice only has 2 and no receiver:

     nonconsuming choice SendMessage: ContractId Message with
            sender: Party
            content: Text
          controller sender
          do
            assertMsg "Designated user must follow you back to send a message" (elem sender following)
            create Message with sender, receiver = username, content
    

    I suspect that your code might have a receiver field on SendMessage as well. In that case simply drop it and adjust your code to match the example in the docs.

  3. ariscatan 4

    Thanks @cocreature for the reply. Yes you are correct I removed the receiver and it works like a charm.
    This case is solved.

    Thanks and more power!