async def icx_getTransactionByAddress(**kwargs): channel_name = StubCollection().conf[ConfigKey.CHANNEL] address = kwargs.get("address", None) index = kwargs.get("index", None) if address is None or index is None: return { 'response_code': message_code.Response.fail_illegal_params, 'message': message_code.get_response_msg( message_code.Response.fail_illegal_params) } channel_stub = StubCollection().channel_stubs[channel_name] tx_list, next_index = await channel_stub.async_task( ).get_tx_by_address(address=address, index=index) response = { 'next_index': next_index, 'response': tx_list[:-1], 'response_code': message_code.Response.success } return response
async def node_AnnounceConfirmedBlock(**kwargs): try: channel = kwargs['context']['channel'] del kwargs['context'] channel = channel if channel is not None else kwargs['channel'] except KeyError: channel = kwargs['channel'] block, commit_state = kwargs['block'], kwargs.get('commit_state', "{}") channel_stub = get_channel_stub_by_channel_name(channel) response_code = await channel_stub.async_task().announce_confirmed_block(block.encode('utf-8'), commit_state) return {"response_code": response_code, "message": message_code.get_response_msg(response_code)}