I’m running the paint agreement use case on Canton, and trying to query the PaintHouse contract instances using DAML REPL, attached to a Canton participant node.
The problem is that the package contains two PaintHouse templates, one in the Paint module and another in the SafePaint module.
So I’m trying to use the qualified Paint.PaintHouse template name in the REPL query, but keep running into a strange error message:
balazsigyorgy@Orss-MacBook-Air ~ % daml repl --ledger-host=localhost --ledger-port=5021 /Users/balazsigyorgy/canton-0.18.2/dars/CantonExamples.dar --import CantonExamples
daml> Some details <- find (\d -> d.displayName == Some "Alice") <$> listKnownParties
daml> let alice = details.party
daml> alice
'Alice::01e74ceb0405f555dc0b05e682bf1f57a75e499084d445176eea2354dad7291dbc'
daml> ph <- query @Paint.PaintHouse alice
daml> ph
File: Line4.daml
Hidden: no
Range: 13:60-13:70
Source: typecheck
Severity: DsError
Message:
Line4.daml:13:61: error:
Ambiguous occurrence ‘PaintHouse’
It could refer to
either ‘Paint.PaintHouse’,
imported from ‘Paint’ at Line4.daml:10:1-12
or ‘SafePaint.PaintHouse’,
imported from ‘SafePaint’ at Line4.daml:11:1-16
File: Line4.daml
Hidden: no
Range: 13:72-13:82
Source: typecheck
Severity: DsError
Message:
Line4.daml:13:73: error:
Ambiguous occurrence ‘PaintHouse’
It could refer to
either ‘Paint.PaintHouse’,
imported from ‘Paint’ at Line4.daml:10:1-12
or ‘SafePaint.PaintHouse’,
imported from ‘SafePaint’ at Line4.daml:11:1-16
daml>
Hi @gyorgybalazsi, unfortunately I cannot reproduce this:
moritz@adjunction ~/D/c/d/CantonExamples> DAML_SDK_VERSION=1.5.0 daml repl .daml/dist/CantonExamples-0.18.2.dar --import CantonExamples --ledger-host localhost --ledger-port 6865
daml> p <- allocateParty "p"
daml> query @PaintHouse p
File: Line1.daml
Hidden: no
Range: 15:23-15:33
Source: typecheck
Severity: DsError
Message:
Line1.daml:15:24: error:
Ambiguous occurrence ‘PaintHouse’
It could refer to
either ‘Paint.PaintHouse’,
imported from ‘Paint’ at Line1.daml:10:1-12
or ‘SafePaint.PaintHouse’,
imported from ‘SafePaint’ at Line1.daml:11:1-16
daml> query @Paint.PaintHouse p
[]
Which SDK version are you using? I tried this with 1.5.0, the 1.5.0 snapshot used in the latest canton release as well as the latest 1.6.0 snapshot 1.6.0-snapshot.20200930.5312.0.b9a1905d.
Could you try running this and query-ing for a party which actually has a “Paint.Painthouse” contract? I think the problem occurs when you want to print out the non-empty result.
If I create the contract your way, I get the same result as you. But if I run the Scala script according to the instructions in the docs, I get the error.
Anyways, now I know what is the correct way of using query in REPL.