Open mitschabaude opened 1 hour ago
@Trivo25 @nholland94 something to consider from the get-go in the new API
a clear-cut use case for conditional method calls is spawning method calls from a reducer, where some of the input actions (necessarily) are dummy actions
see also discord discussion https://discord.com/channels/484437221055922177/1298526066394140672/1300855340522537084
Currently, it's possible to add account updates to the tx conditionally with
AccountUpdate.createIf()
, but it's not possible to call another method conditionally.Since a method call just means adding the account update that another method produces to the AU tree, it should be fairly easy to support conditional method calls. There's simply an additional boolean condition that needs to be considered before pushing the AU to the tree.
The API probably can't be as clean as the current zkApp call API, but I think that's ok, something like this should work well enough:
note, the method name + arguments can be made type-safe if this is polymorphic over the contract, something like: