Nested MapA for Triggers to Exercise a choice

Your doSomething looks like it has type [[Command]], which is a good place to be. You now need to decide how you want to execute those commands. Each emitCommands results in one ledger transaction.

Do you want them all to be executed in one big transaction?

emitCommands (concat doSomething) []

Do you want them to be batched per account?

mapA (\cs -> emitCommands cs []) doSomething

Or do you want to run each command in its own transaction?

mapA (\c -> emitCommands [c] []) (concat doSomething)
2 Likes