I have a requirement to query all templates from a ledger which has no contracts created. Is there a java or grpc api that will allow me to do this?
For ledger metaprogramming like this, you have basically two steps:
- Use the package service to retrieve all uploaded packages (dalfs).
- Parse and extract the information you want from the dalfs you get back from that service. There are several prior topics discussing this; here is a good starting point. There are some shortcuts that are possible depending on how much information about the templates you really need.
Ledger metaprogramming isn’t really officially supported, but interest on this forum means that searching around here is your best bet for further resources and pointers.
I applied ledger metaprogramming e.g. for easing the pains of migration via codegen.