question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add interface_id in Ledger API Exercise Command

See original GitHub issue

In case of exercise-interface, we abuse the field templateId of the Exercise Command to be actually an interfaceId.

We will add a new file interface_Id to the exercise command

// Exercise a choice on an existing contract.
message ExerciseCommand {
  // The template or the interface where the choice is defined.
  // One and only one of template_id interface_id is required.
  Identifier template_id = 1;
  Identifier interface_id = 5;

  // The ID of the contract the client wants to exercise upon.
  // Must be a valid LedgerString (as described in ``value.proto``).
  // Required
  string contract_id = 2;

  // The name of the choice the client wants to exercise.
  // Must be a valid NameString (as described in ``value.proto``)
  // Required
  string choice = 3;

  // The argument for this choice.
  // Required
  Value choice_argument = 4;
}

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
S11001001commented, Aug 19, 2022

using a field name called template_id to specify an interface_id is very confusion.

There’s a smaller change to deal with the naming problem without breaking how commands are built in current codegen and JSON API.

  1. add a contract_type_id to ExerciseCommand, or whatever you care to call the union of template IDs and interface IDs (I have generally called it “contract type ID” but have not seen any other opinions on this)
  2. give it exactly the same semantics as template_id does now; command resolves to contract_type_id or template_id, preferring the former
  3. deprecate template_id
1reaction
S11001001commented, Aug 19, 2022

it will not be possible to abuse the templateId to specify interface ID.

Then, maybe this should be added to exercise-by-key and create-and-exercise first? At least for those commands, it lets you express something that is impossible, currently. Adding it to by-id will just cause regressions in clients like JSON API.

The current behavior doesn’t seem like “abuse” at all. It is really just a case of a field that is now misnamed; rename it contract_type_id and suddenly it isn’t “abuse”.

Read more comments on GitHub >

github_iconTop Results From Across the Web

pass in interface ID to create-and-exercise, exercise-by-key ...
When #13653 introduces the optional interface ID to these commands, change CreateAnd.java and ByKey.java to pass in the interface ID as ...
Read more >
The Ledger API Services — Daml SDK 2.5.0 documentation
Use the command submission service to submit commands to the ledger. Commands either create a new contract, or exercise a choice on an...
Read more >
Interface for Exercise by Key command in DAML node js ...
We have exercise command with contractId as one of the field. ContractId can be fetched on listening to transaction events. How can we...
Read more >
digital-asset - Bountysource
It is not possible via the command daml ledger navigator (handy for debugging as it ... deprecate hasInterfaceId and getInterfaceId; add a property...
Read more >
dazl.ledger
This flag is ignored when connecting to gRPC Ledger API implementations. ... the command submission methods create() , exercise() , submit() are coroutines....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found