Skip to content
Discussions/App Development/How to test witnessing/divulgence using DAML Script?Forum ↗

How to test witnessing/divulgence using DAML Script?

App Development4 posts75 views4 likesLast activity Jul 2024
JV
jvelasco.intellecteuOP
Jul 2024

Hello,

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

Best
Jose

WA
WallaceKelly
Jul 2024

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

JV
jvelasco.intellecteu
Jul 2024

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?

WA
WallaceKelly
Jul 2024

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:

← Back to Discussions