Is there a way to get template names/identifers on the ledger via java APIs

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?

1 Like

For ledger metaprogramming like this, you have basically two steps:

  1. Use the package service to retrieve all uploaded packages (dalfs).
  2. 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.

1 Like

I applied ledger metaprogramming e.g. for easing the pains of migration via codegen.