How can I submit several commands as one transaction using the Python binding (formerly Dazl)?
App Development5 posts360 views3 likesLast activity Jan 2023
GY
gyorgybalazsiOP
Jan 2023I couldn’t find this in the docs.
CO
cocreature
Jan 2023submit takes a list of commands. You can find an example in one of the tests.
digital-asset/dazl-client/blob/23078291536e932567abca54d735b36a7542354c/python/tests/unit/test_threadsafe_methods.py#L34
- operator_cid, _ = client.find_one(OperatorRole)
-
- client.exercise(operator_cid, "PublishMany", dict(count=5))
-
- notifications = client.find_nonempty(OperatorNotification, {"operator": party}, min_count=5)
- contracts_to_delete = []
- for cid, cdata in notifications.items():
- if int(cdata["text"]) <= 3:
- contracts_to_delete.append(cid)
-
- client.submit([ExerciseCommand(cid, "Archive") for cid in contracts_to_delete])
-
- client.exercise(operator_cid, "PublishMany", dict(count=3))
-
- print(client.find_active("*"))
GY
gyorgybalazsi
Jan 2023Thank you, Moritz.
This can be useful temporarily, though the dazl.client package will be deprecated: " The types in this class are scheduled to be deprecated in dazl v8.0.0 in favor of the symbols in the dazl.ledger package."
Maybe this feature is one of those which are only available here? As the docs put it: “They are not currently deprecated, as some functionality still only exists in these types.”
CO
cocreature
Jan 2023Sorry my bad, daazl.ledger also has the same method though dazl-client/__init__.py at 23078291536e932567abca54d735b36a7542354c · digital-asset/dazl-client · GitHub
GY
gyorgybalazsi
Jan 2023Oh, that’s fantastic, thank you!