Skip to content
CCPEDIAby Unity Nodes
App Development

Extract choice arguments defined in DAML template from builded .dar file using dazl

1 posts218 viewsLast activity Mar 2023

  1. AntonMelentievOP

    Hello!

    I try to inspect .dar file using dazl.
    Example of Python code:

    dar = dazl.util.dar.DarFile("path_to_dar_file")
    package_ids = list(get_dar_package_ids(dar="path_to_dar_file"))
    
    for package_id in package_ids:
        bytes_dar = dar.package_bytes(package_id)
        archive = parse_archive(package_id, bytes_dar)
    

    So, I can get Archive object and take from it Packages, Modules, Template, and finally Choices.
    The choice is a TemplateChoice object.

    Part of DAML code of the Choice:

        nonconsuming choice RequestToken: ContractId Token.TokenRequest
          with
            token          : Text
            activationDate : Date
            expiryDate     : Optional Date
    

    Is it possible to parse arguments, types of arguments, and informational if the argument is optional using dazl? I didn’t find such options. If there is not a such possibility is it possible to add it to dazl?

    Thanks for support.