Batching commands using HTTP JSON API
App Development3 posts277 views2 likesLast activity May 2022
LE
Leonid_RozenbergOP
May 2022This is a Feature request, but AFAIU, there is no way to batch commands via the HTTP-JSON API. For example, ask it to archive 100 contracts.
CO
cocreature
May 2022You’re right that there is nothing builtin. However, you can usually emulate that via createAndExercise, e.g.,
template Helper
with
p : Party
where
signatory p
choice ArchiveBatched : ()
with
cids : [ContractId T]
controller p
do mapA_ archive cids
If you then call ArchiveBatched via create and exercise you get more or less the same behavior as if you passed multiple archives over the grpc definition. The main downside of this approach is that you have to define the sets of batched command submissions you intend to make upfront in your daml model.
LE
Leonid_Rozenberg
May 2022I love how the solution to Daml limitations is to write more Daml, createAnd Exercise is quickly becoming my favorite action.