Skip to content
CCPEDIAby Unity Nodes
App Development

Navigator not showing contracts

5 posts638 views1 likesLast activity Sep 2022

  1. Neelam_DwivediOP

    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
    
    
  2. Mate_Varga

    Could you please try to start the navigator with the user management disabled?
    https://docs.daml.com/tools/navigator/index.html#logging-in-as-a-party

  3. Neelam_Dwivedi

    I modified daml.yaml with

    navigator-options:
      - --feature-user-management=false
    

    followed by

    daml start
    

    but that doesn’t help.

  4. Mate_Varga 1

    Could you also remove the parties section as well? When you start the navigator you should see long party IDs like ::, otherwise your navigator did not query the allocated parties properly.

  5. Neelam_Dwivedi

    Thanks @Mate_Varga, yes that worked. Now I can see the contracts.