I am not seeing an archived contract in the TransactionTree
- cohen.avrahamOP
G-d willing
Hello guys,
I have the following code:template A with owner : Party id : Int value : Int something : Text where signatory owner choice DoSomething: ContractId A controller owner do create this with value = 10The
DoSomethingchoice basically archives the previous version of its own.
However, when looking at theTransactionTreeI cannot see the archived version.
I am trying to check that using the following script:testDoSomething : Script () testDoSomething = script do alice <- allocateParty "alice" a <- submit alice do createCmd A with owner = alice, id = 1, value = 1, something = "Some Text" TransactionTree{rootEvents = [ExercisedEvent Exercised{contractId, choice, childEvents = [CreatedEvent created] }]} <- submitTree alice do exerciseCmd a DoSomething debug $ fromAnyTemplate @A created.argument pure ()I expected to get more from in the transaction tree. For example, when I tried to do:
TransactionTree{rootEvents = [ExercisedEvent Exercised{contractId, choice, childEvents = [CreatedEvent created, ExercisedEvent archived] }]} <- submitTree alice do exerciseCmd a DoSomethingBut this code fails since there is no
ExercisedEventin the return value.
So, how can I get the archived contract that happened during the exercise ofDoSomething?Thanks,
- WallaceKelly
Disclaimer: I do not answer your question.

You are correct that the Transaction Tree does not include explicit mention of the archiving of the contract.
That is consistent with what we see in the Daml Studio Transaction View.
That is also consistent with the fact that
Archiveis an auto-generated choice on the contract. And, to be honest, you are not exercising that choice, like this example:There have been related discussions on these two posts:
- Explicit archives on the TransactionTree stream.
- Why isn't there an archive node in the transaction graph on a (consuming) choice - #2 by cocreature
So, how can I get the archived contract that happened during the exercise of
DoSomething?
- bernhard
The consuming exercise is the root node.
- cohen.avraham
Thanks @bernhard for your comment.
Can you tell me how I can detect all of the true archived contracts that happened during an exercise of a choice?
After examining theTransactionTreeI can do that by matching aCreateEventwith anExercisedEventthat has the same contracted.
Why when the call to thearchivefunction does not addExerciseEventwith a choice namedArchive? If that could happen, it would be very useful.

