async def test_deploy_python_code_async(self): eosapi_async = ChainApiAsync('http://127.0.0.1:9000') code = ''' import chain def apply(a, b, c): data = chain.read_action_data() print(data) return ''' account = 'helloworld11' code = eosapi_async.mp_compile(account, code) async def run_code(code): await eosapi_async.deploy_python_contract(account, code, b'') r = await eosapi_async.push_action(account, 'sayhello', b'hellooo,world', {account:'active'}) console = r['processed']['action_traces'][0]['console'] assert console == "b'hellooo,world'\r\n" r = await eosapi_async.push_action(account, 'sayhello', b'goodbye,world', {account:'active'}) console = r['processed']['action_traces'][0]['console'] assert console == "b'goodbye,world'\r\n" await run_code(code)
def setup_class(cls): eosapi.set_node('http://127.0.0.1:9000') eosapi_async = ChainApiAsync('http://127.0.0.1:9000') cls.testnet = Testnet(single_node=True, show_log=False) cls.testnet.run() cls.info = eosapi.get_info() # logger.info(cls.info) cls.chain_id = cls.info['chain_id']
async def test(): eosapi = ChainApiAsync('https://api.eosn.io') info = await eosapi.get_info() print(info) args = { 'from': 'test1', 'to': 'test2', 'quantity': '1.0000 EOS', 'memo': 'hello,world' } r = await eosapi.push_action('eosio.token', 'transfer', args, {'test1': 'active'}) print(r)
async def api_test(self): if os.path.exists('test.wallet'): os.remove('test.wallet') wallet.create('test') wallet.import_key( 'test', '5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3') api = ChainApiAsync('UUOS', 'http://127.0.0.1:8989') r = await api.get_info() logger.info(r) r = await api.get_account(config.system_contract) logger.info(r) r = await api.push_action(config.system_contract, 'sayhello', b'', {config.system_contract: 'active'}) logger.info(r)
async def set_contract_async(): if os.path.exists('test.wallet'): os.remove('test.wallet') psw = wallet.create('test') wallet.import_key( 'test', '5Jbb4wuwz8MAzTB9FJNmrVYGXo4ABb7wqPVoWGcZ6x8V2FwNeDo') #eosapi.set_nodes(['https://nodes.uuos.network:8443']) api = ChainApiAsync('http://127.0.0.1:8888', 'UUOS') account_name = 'helloworld11' code = ''' def apply(receiver, code, action): print('hello,world, async') ''' code = await api.compile(account_name, code, 1) r = await api.deploy_contract(account_name, code, g_abi, 1) print('done!')
def setup_method(self, method): global eosapi_async eosapi_async = ChainApiAsync('http://127.0.0.1:9000')
def setup_class(cls): cls.eosapi = ChainApiAsync('http://127.0.0.1:9000') cls.testnet = Testnet(single_node=True, show_log=True) cls.testnet.run()
async def set_code_get_code_async(): api = ChainApiAsync('http://127.0.0.1:8888') api.set_code('hello', b'abc') assert await api.get_code('hello') == b'abc'