Good Day, I am following the Second tutorial instructions and I got this error in the DAML code
I don’t know what I am doing wrong
the error is this
it is not very clear which code I should reeplace
Good Day, I am following the Second tutorial instructions and I got this error in the DAML code
I don’t know what I am doing wrong
the error is this
it is not very clear which code I should reeplace
the SendMessage
choice should be a choice on the User
template not on Message
. In your example, that means moving it above the definition of Message
in line 30. The final state should look something like the following:
-- MAIN_TEMPLATE_BEGIN
template User with
username: Party
following: [Party]
where
signatory username
observer following
-- MAIN_TEMPLATE_END
key username: Party
maintainer key
-- FOLLOW_BEGIN
nonconsuming choice Follow: ContractId User with
userToFollow: Party
controller username
do
assertMsg "You cannot follow yourself" (userToFollow /= username)
assertMsg "You cannot follow the same user twice" (notElem userToFollow following)
archive self
create this with following = userToFollow :: following
-- FOLLOW_END
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
template Message with
sender: Party
receiver: Party
content: Text
where
signatory sender, receiver
At the bottom of the tutorial UI pane it says (paraphrase) that the ‘sendmessage’ choice should be in/on the same indentation or alignment of the ‘follow’. Is that correct?
It is not easy to see the alignments on those screenshots.
thank you so much for your reply, I can understand now what was wrong >D
Hi, just another tip to help the forum members help you.
Perhaps when you display code in a UI Pane like you did, you can grab the central vertical slider and move it horizontally to the right. That way you can expand the UI Pane out and the tutorial code is displayed visually as it should be written. Now, take a screenshot.
Then grab the central vertical slider and slide it to the left, until the code in the code viewer UI is displayed visually, as it should be written (Except for very long lines). Now take a screenshot.
Post the tutorial instructions first, followed by the code viewer screenshot. That way we get the best view at your issue.
See the following screenshot where I have highlighted the vertical.
Hope this helps
An even better option is to copy the code and format it in a code block instead of using a screenshot. That way people can reproduce the issue much easier, the code becomes searchable and it’s more accessible.
To use a code block simply wrap your code in triple backticks.
OK, @cocreature 1, @quidagis 0