Why is there no `submitUserMustFail`?
App Development3 posts239 views3 likesLast activity Jul 2022
DA
DarkoOP
Jul 2022Is there a particular reason why not all party submission functions also exist for users?
(For example submitUserMustFail)
When it comes to submitMulti I’m assuming that the argument would be to just add the additional actAs/readAs parties to the user, but I don’t see an easy workaround for ..MustFail, except to use
(fromSome myUser.primaryParty) `submitMustFail` ...
DA
Darko
Jul 2022The same question also holds for queries
CO
cocreature
Jul 2022There is no good reason, we just started with the minimal API. However, submitUser is just a wrapper, you can see the definition in the code.
You can relatively easily define your own wrapper for submitMultiMustFail:
submitUserMustFail : HasCallStack => UserId -> Commands a -> Script ()
submitUserMustFail userId cmds = do
rights <- listUserRights userId
let actAs = [ p | CanActAs p <- rights ]
let readAs = [ p | CanReadAs p <- rights ]
submitMultiMustFail actAs readAs cmds