def main(): """ Main method. """ with sandbox(daml_file) as damli_proc, \ create_client(participant_url=damli_proc.url, parties=['POSTMAN'] + [m['party_name'] for m in MEMBERS]) \ as client: app = set_up() # Print the "app" on the command line. print(app) register_application(client, app) # Set up a plugin that will simply capture all data for later output on # the console. inspector = LedgerCapturePlugin.stdout() client.register(inspector) # Expect program that is expected to terminate. It will be considered done # only once all pending commands have been completed (including any of their # follow-ups) try: client.run_until_complete() finally: inspector.dump_all() pass
def run(): with create_client(parties=parties, participant_url=url) as client_mgr: inspector = LedgerCapturePlugin.stdout() try: client_mgr.register(inspector) register_event_handlers(client_mgr) ledger_run = client_mgr.run_until_complete() return ledger_run.exit_code finally: inspector.dump_all()
def run_test(url): members = [dict(party=f'Member {i}', address=address(i)) for i in range(0, MEMBER_PARTY_COUNT)] all_parties = [POSTMAN_PARTY] + [member['party'] for member in members] with create_client(parties=all_parties, participant_url=url) as client_mgr: inspector = LedgerCapturePlugin.stdout() try: set_up(client_mgr, members) client_mgr.register(inspector) ledger_run = client_mgr.run_until_complete() return ledger_run.exit_code finally: inspector.dump_all()
def run_test(url): all_parties = [POSTMAN_PARTY] with create_client(parties=all_parties, participant_url=url) as client_mgr: inspector = LedgerCapturePlugin.stdout() try: postman_client = client_mgr.new_client(POSTMAN_PARTY) postman_client.on_ready( lambda _, __: create('Main.PostmanRole', dict(postman=POSTMAN_PARTY))) client_mgr.register(inspector) ledger_run = client_mgr.run_until_complete() return ledger_run.exit_code finally: inspector.dump_all()