9 from zeth.core.contracts
import InstanceDescription
10 from click
import command, argument, option, Context, pass_context, ClickException
15 @argument(
"batch-file")
17 "--application-instance-file",
"-i",
18 default=APPLICATION_INSTANCE_FILE_DEFAULT,
19 help=
"Address or instance file of the application contract")
20 @option(
"--wait", is_flag=
True, help=
"Wait for the resulting transaction")
25 application_instance_file: str,
28 Submit an aggregated transaction ("batch") to a zecale dispatcher contract
32 cmd_ctx: CommandContext = ctx.obj
33 aggregator_config = cmd_ctx.get_aggregator_configuration()
34 wrapper_snark = aggregator_config.wrapper_snark
35 pp = aggregator_config.wrapper_pairing_parameters
41 with open(application_instance_file,
"r")
as app_instance_f:
42 app_instance = InstanceDescription.from_json_dict(
43 json.load(app_instance_f))
46 eth_addr, eth_private_key = cmd_ctx.get_eth_key_and_address()
47 dispatcher_contract = cmd_ctx.get_dispatcher_contract()
48 tx_id = dispatcher_contract.process_batch(
49 pp, aggregated_tx, app_instance.address, eth_addr, eth_private_key)
53 tx_receipt = cmd_ctx.get_web3().eth.waitForTransactionReceipt(
55 gas_used = tx_receipt.gasUsed
56 status = tx_receipt.status
57 print(f
"(gasUsed={gas_used}, status={status})")
59 raise ClickException(
"transaction failed")
63 dispatcher_contract.dump_logs(tx_receipt)