Skip to content
CCPEDIAby Unity Nodes
App Development

How to test witnessing/divulgence using DAML Script?

4 posts103 views4 likesLast activity Jul 2024

  1. jvelasco.intellecteuOP 1

    Hello,

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

    Best
    Jose

  2. WallaceKelly 1

    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

  3. jvelasco.intellecteu

    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?

  4. WallaceKelly 2

    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: