Hi team,
I was deploying the DAR file and running the initial script in Canton setup. After that I ran navigator to view contracts by certain user with CanReadAs Public access but it didn’t return all the contracts which are visible to Public party.
Here is the details:
My Daml script steps:
- in script of allocateParties, allocate parties into two participant nodes( pOperator, pParticipant1) , create Alias contract for each of the party and set observer as Public . There should be 4 Alias contract created(i.e. for Operator, FundManager, Distributor1, Investor1) and all visible to Public party
- in script of initialize, create users with CanReadAs public access in the corresponding participant node
allocateParties : Script Parties
allocateParties = do
operator <- allocatePartyWithHintOn "Operator" (PartyIdHint "Operator") ( ParticipantName "pOperator")
fundManager <- allocatePartyWithHintOn "FundManager" (PartyIdHint "FundManager") ( ParticipantName "pOperator")
distributor1 <- allocatePartyWithHintOn "Distributor1" (PartyIdHint "Distributor1") ( ParticipantName "pParticipant1")
investor1 <- allocatePartyWithHintOn "Investor1" (PartyIdHint "Investor1") ( ParticipantName "pParticipant1")
public <- allocatePartyWithHintOn "Public" (PartyIdHint "Public") ( ParticipantName "pOperator")
let parties = [operator, fundManager, investmentManager, fundAdmin, settlementAgent, transferAgent, distributor1, distributor2, investor1, investor2]
let
getPartyHint p = head (splitOn ":" $ partyToText p)
createAlias: Party -> Script ()
createAlias p = do
-- add alias for mapping
let hint = getPartyHint p
submit p do createCmd Alias with currentParty = p; displayName = hint; ..
pure()
mapA_ ( \p -> createAlias p) parties
initialize : Parties -> Script()
initialize parties@Parties{..} = do
let
getPartyHint p = head (splitOn ":" $ partyToText p)
pOperatorParties = [operator, fundManager]
pParticipant1Parties = [ distributor1, investor1]
createUserFromParty: Party -> Text -> Script ()
createUserFromParty p participantName = do
-- add alias for mapping
let hint = getPartyHint p
userId <- validateUserId $ asciiToLower hint
createUserOn (User userId $ Some p) ((CanActAs p) :: [CanReadAs public]) ( ParticipantName participantName)
mapA_ (`createUserFromParty` "pOperator") pOperatorParties
mapA_ (`createUserFromParty` "pParticipant1") pParticipant1Parties
pure()
- In Canton Console, I allocated the public party in both pOperator and pParticipant node following below instruction
Host party on multiple nodes using participants.json - #2 by drsk
and the output from canton console shows Public party already on both participant nodes
ListPartiesResult(
party = Public::122089916be7...,
participants = Vector(
ParticipantDomains(participant = PAR::participant2::12208b792584..., domains = Vector(DomainPermission(domain = mydomain::1220dd2ff7c3..., permission = Observation))),
ParticipantDomains(participant = PAR::participant1::122089916be7..., domains = Vector(DomainPermission(domain = mydomain::1220dd2ff7c3..., permission = Submission)))
)
),
- run daml navigator server localhost 5041 --feature-user-management=true and login is as operator but I only see one alias contract but not 4
Apologies for the long description, but any reason why I can’t view the other Alias contract from Navigator while I try using Json API to query, I can get all.
Thanks,
Dorrit