I have a template and a script that creates and updates a contract. When running the script, the contract creation and modification displays correctly. But Navigator does not show the contracts. It only shows the template.
I followed the two suggestions elsewhere in this forum for a similar issue: using PartyIdHint and removing ‘parties’ from daml.yaml. But that doesn’t help. Any suggestions will be very helpful!
Here is my code:
daml.yaml
sdk-version: 2.3.2
name: college
source: daml
init-script: Main:setup
version: 0.0.1
dependencies:
- daml-prim
- daml-stdlib
- daml-script
parties:
- Prof
- Student
Course.daml
module Course where
template Gradebook
with
professor: Party
student: Party
courseId: Text
score: Int
where
signatory professor
observer student
choice UpdateGrade: ContractId Gradebook
with
newCourseId: Text
newScore: Int
controller professor
do
newGradeBook <- create Gradebook
with
professor
student
courseId = newCourseId
score = newScore
return (newGradeBook)
Main.daml
module Main where
import Daml.Script
import Course
import DA.Assert (assertEq)
setup : Script()
setup = script do
prof <- allocatePartyWithHint "Prof" (PartyIdHint "Prof")
student <- allocatePartyWithHint "Student" (PartyIdHint "Student")
gradebookId <- submit prof do
createCmd Gradebook { professor = prof, student = student, courseId = "101", score = 0}
gradebookId <- submit prof do
exerciseCmd gradebookId UpdateGrade { newCourseId = "101", newScore = 10}
Some id <- queryContractId prof gradebookId
assertEq id.score 10