Inconsistent contract key format using ledger api services

HI
We are trying to build a local cache using ledger API by first initializing all the known active contracts and later getting the list of all transaction events to update the cache (created/archived event)
However we see inconsistent formatting of the contract key in the ActiveContractResponse and TransactionResponse. Below are the contract key from GetActiveContractsResponse and GetTransactionResponse .
Is there a way to retrieve a consistent formatting of the contract key and contract event in general. This is vital for us to build the cache, so any help will be greatly appreciated.

ContractKey retrived from GetActiveContractsResponse

INFO: Fetching contractKey: record {
  record_id {
    package_id: "40f452260bef3f29dede136108fc08a88d5a5250310281067087da6f0baddff7"
    module_name: "DA.Types"
    entity_name: "Tuple2"
  }
  fields {
    label: "_1"
    value {
      party: "ABC::12209e5755b7f8b769b1ea18cf6e60cd21b03db45a7b2c821747fd10362fe963797f"
    }
  }
  fields {
    label: "_2"
    value {
      record {
        record_id {
          package_id: "d6d7148a9c2c5f6491e80bcc9cae950c232fca79e9744ffd998f12a9a7a6513b"
          module_name: "DA.Finance.Types"
          entity_name: "Id"
        }
        fields {
          label: "signatories"
          value {
            record {
              record_id {
                package_id: "97b883cd8a2b7f49f90d5d39c981cf6e110cf1f1c64427a28a6d58ec88c43657"
                module_name: "DA.Set.Types"
                entity_name: "Set"
              }
              fields {
                label: "map"
                value {
                  gen_map {
                    entries {
                      key {
                        party: "DEF::12209e5755b7f8b769b1ea18cf6e60cd21b03db45a7b2c821747fd10362fe963797f"
                      }
                      value {
                        unit {
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
        fields {
          label: "label"
          value {
            text: "damlConnectorCacheTest"
          }
        }
        fields {
          label: "version"
          value {
            int64: 16506009981
          }
        }
      }
    }
  }
}

ContractKey retrievd from CreatedEvent of GetTransactionResponse

contract_key {
  record {
    fields {
      value {
        party: "ABC::12209e5755b7f8b769b1ea18cf6e60cd21b03db45a7b2c821747fd10362fe963797f"
      }
    }
    fields {
      value {
        record {
          fields {
            value {
              record {
                fields {
                  value {
                    gen_map {
                      entries {
                        key {
                          party: "DEF::12209e5755b7f8b769b1ea18cf6e60cd21b03db45a7b2c821747fd10362fe963797f"
                        }
                        value {
                          unit {
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
          fields {
            value {
              text: "damlConnectorCacheTest"
            }
          }
          fields {
            value {
              int64: 16506009981
            }
          }
        }
      }
    }
  }
}

This looks like you set verbose = true for the active contracts service but not for the transaction service.

1 Like

Thanks. This helps. Is there a way to set “verbose” flag as default

There is no way to set the default you have to set it per request.