Overrding the Instruction implementation

Hi there, I am seeking to override the implementation of Instruction, but I want to re-use the logic provided by the default implementation of Batch. The problem is that the default Batch exercises by key on the default Instructions - so if I try to re-use this logic it won’t work on my custom implementation of Instruction. Having to do a copy-paste of the default Batch implementation is not a nice solution.


Hi @huw,

thanks for pointing this out. The Instruction and Batch implementations are indeed tightly coupled.

A way to decouple them would be to use interface contact keys, similiar to how Account and Instrument interfaces are keyed. Note that we currently don‘t have support for interface keys in the language, we rather have a workaround in place for achieving this (using an associated keyed Reference template instance which refers to the corresponding interface instance by contract id). We have been a bit reluctant to use this workaround frequently though. That being said, there are also alternative ways to decouple them (using contract ids).

We have planned to revisit this topic in the new year. Until then Im afraid you would need to create your own Batch implementation.

Best Regards,