module Main where
import Daml.Script
import DA.Foldable (mapA_)
data VFoo = VFoo with
deriving (Eq, Show)
interface IFoo where
viewtype VFoo
c : Party
choice Bar : ()
controller (c this)
do return ()
template Foo
with
p : Party
where
signatory p
interface instance IFoo for Foo where
view = VFoo
c = p
test_foo p = do
submit p do createCmd Foo with ..
(cidList, _) <- unzip <$> queryInterface @IFoo p
mapA_ (\ cid -> submit p do exerciseCmd cid Bar) cidList
See https://discuss.daml.com/t/exercise-interface-choice-on-daml-script-with-json-api/7134.
Repro:
Script:
Script call:
Decoded token:
input.json:
Replace the participant Id as appropriate.