How to test witnessing/divulgence using DAML Script?

Hello,

Is there any way to test (using Daml script) that a contract has been witnessed or divulged to a party?

Best
Jose

1 Like

See @cocreature’s answer here.

There isn’t a great way of doing that unfortunately. At this point you can try fetching it but that results in a warning since that behavior is deprecated. I think it’s the best you can do atm

1 Like

Thanks @WallaceKelly !
So the workaround is to create a XXX_Fetcher template and exercise a choice Fetch_XXX by the non-stakeholder party who has gained visibility via witnessing or divulgence, right?

Correct. Here is an example of changes I added to my divulgence example to test for divulgence in a Daml Script.

While implementing, I realized a bit of subtlety to it. Just because the contract is divulged to a party, does not mean the party can fetch it without a stakeholder’s authorization. Thus, the stakeholder is the signatory of the “Fetcher” contract. But you probably realized that. :smile:

2 Likes