async def run_test(): if config.system_contract == 'eosio': print('This example only works on uuos network currently') return uuosapi = chainapi.ChainApiAsync(config.network_url) code = uuosapi.mp_compile(test_account1, src) r = await uuosapi.deploy_python_contract(test_account1, code, abi) args = {'account': test_account1, 'group_name': 'group1'} try: r = await uuosapi.push_action(test_account1, 'creategroup', args, {test_account1: 'active'}) test_helper.print_console(r) except chainapi.ChainException as e: print('++++error:', e.json['error']['details'][1]['message']) if not hasattr(chainapi, 'count'): chainapi.count = 0 chainapi.count += 1 print('++++count:', chainapi.count) args = { 'account': test_account1, 'group_name': 'group1', 'msg': 'hello,world' + str(chainapi.count) } try: r = await uuosapi.push_action(test_account1, 'chat', args, {test_account1: 'active'}) test_helper.print_console(r) print(r['processed']['elapsed']) except chainapi.ChainException as e: print('++++chat error:', e)
async def run_test(): uuosapi = chainapi.ChainApiAsync(config.network_url) code = uuosapi.mp_compile(test_account1, src) r = await uuosapi.deploy_python_contract(test_account1, code, abi) args = 'hello,world' r = await uuosapi.exec(test_account1, args) test_helper.print_console(r)
async def run_test(): if config.system_contract == 'eosio': print('This example only works on uuos network') return uuosapi = chainapi.ChainApiAsync(config.network_url) code = uuosapi.mp_compile(test_account1, src) r = await uuosapi.deploy_python_contract(test_account1, code, abi) args = 'hello,world' r = await uuosapi.exec(test_account1, args) test_helper.print_console(r)
async def run_test(): uuosapi = chainapi.ChainApiAsync(config.network_url) code2 = uuosapi.mp_compile('hello', src2) r = await uuosapi.deploy_module(test_account1, 'hello', code2) # deploy_contract comes after deploy_module # if a module deployed used by contract has been changed # deploy_contract must call again to reflect the changes made in the module code = uuosapi.mp_compile(test_account1, src1) r = await uuosapi.deploy_python_contract(test_account1, code, abi) args = uuosapi.s2b(test_account1) r = await uuosapi.exec(test_account1, args) test_helper.print_console(r)
async def run_test(): uuosapi = chainapi.ChainApiAsync(config.network_url) code = uuosapi.mp_compile(test_account1, src) print(test_account1, test_account2) try: r = await uuosapi.deploy_contract(test_account2, wasm_code, wasm_abi, vm_type=0) except chainapi.ChainException as e: print('+++deploy error:', e.json['message']) r = await uuosapi.deploy_python_contract(test_account1, code, abi) args = 'hello,world' try: r = await uuosapi.push_action(test_account1, 'sayhello', args, {test_account1: 'active'}) test_helper.print_console(r) except chainapi.ChainException as e: print('+++test error:', e)
async def run_test(): uuosapi = chainapi.ChainApiAsync(config.network_url) code = uuosapi.mp_compile(test_account1, src) r = await uuosapi.deploy_python_contract(test_account1, code, abi) args = b'hello,world' try: r = await uuosapi.push_action(test_account1, 'test1', args, {test_account1: 'active'}) test_helper.print_console(r) except chainapi.ChainException as e: print('+++test1:', e) args = b'hello,world' try: r = await uuosapi.push_action(test_account1, 'test2', args, {test_account1: 'active'}) test_helper.print_console(r) except chainapi.ChainException as e: print('+++test2: assertion failed as expected:', e) args = b'hello,world' try: r = await uuosapi.push_action(test_account1, 'test3', args, {test_account1: 'active'}) test_helper.print_console(r) except chainapi.ChainException as e: print('+++test3, assertion raised:') msg = e.json['error']['details'][0]['message'] print(msg) assert msg == "assertion failure with message: bad action"
async def run_test(): uuosapi = chainapi.ChainApiAsync(config.network_url) code = uuosapi.mp_compile(test_account1, src) r = await uuosapi.deploy_python_contract(test_account1, code, abi) args = b'hello,world' try: r = await uuosapi.push_action(test_account1, 'test1', args, {test_account1: 'active'}) test_helper.print_console(r) except chainapi.ChainException as e: print('+++test1 error:', e) args = b'hello,world' try: r = await uuosapi.push_action(test_account1, 'test2', args, {test_account1: 'active'}) test_helper.print_console(r) except chainapi.ChainException as e: msg = e.json['error']['details'][0]['message'] assert msg == f"missing authority of {test_account1}/owner"
async def run_test(): uuosapi = chainapi.ChainApiAsync(config.network_url) code = uuosapi.mp_compile(test_account1, src) try: r = await uuosapi.deploy_python_contract(test_account1, code, abi) print('++++deploy time:', r['processed']['elapsed']) except chainapi.ChainException as e: print('+++deploy error:', e) if not hasattr(chainapi, 'count'): chainapi.count = 0 chainapi.count += 1 r = await uuosapi.get_table_rows(False, test_account1, test_account1, 'log', '', '', 1) old_state = None if r['rows']: old_state = r['rows'][0] args = 'hello,world' + str(chainapi.count) r = await uuosapi.exec(test_account1, args) test_helper.print_console(r) await show_log(uuosapi, old_state)
async def run_test(): uuosapi = chainapi.ChainApiAsync(config.network_url) code = uuosapi.mp_compile(test_account1, src) await uuosapi.deploy_abi(test_account1, abi) try: r = await uuosapi.deploy_python_contract(test_account1, code, abi) except chainapi.ChainException as e: print('+++deploy error:', e.json['message']) args = {'issuer': test_account1, 'maximum_supply': '1000.0000 TTT'} try: r = await uuosapi.push_action(test_account1, 'create', args, {test_account1: 'active'}) test_helper.print_console(r) except chainapi.ChainException as e: print(e) msg = e.json['error']['details'][0]['message'] print('+++create:', msg) args = { 'to': test_account1, 'quantity': '10.0000 TTT', 'memo': f'issue 10 TTT to {test_account1}' } balance1 = await uuosapi.get_balance(test_account1, token_account=test_account1, token_name='TTT') try: r = await uuosapi.push_action(test_account1, 'issue', args, {test_account1: 'active'}) test_helper.print_console(r) except chainapi.ChainException as e: print('+++issue error:', e) balance2 = await uuosapi.get_balance(test_account1, token_account=test_account1, token_name='TTT') print(balance1, balance2) args = { 'from': test_account1, 'to': test_account2, 'quantity': '10.0000 TTT', 'memo': f'transfer 10 TTT to {test_account2}' } print('++++++++++:', test_account1, test_account2) balance1 = await uuosapi.get_balance(test_account1, token_account=test_account1, token_name='TTT') r = await uuosapi.push_action(test_account1, 'transfer', args, {test_account1: 'active'}) test_helper.print_console(r) print('+++transfer:', r['processed']['elapsed']) balance2 = await uuosapi.get_balance(test_account2, token_account=test_account1, token_name='TTT') print(balance1, balance2)