def decode_events_and_functions(abi: dict) -> Tuple[(Dict[(str, EventSemantics)], Dict[(str, FunctionSemantics)])]:
    events = dict()
    for (signature, raw_event_semantics) in abi.get('events', {}).items():
        parameters = _decode_parameters_list(raw_event_semantics.get('parameters'))
        events[signature] = EventSemantics(signature, raw_event_semantics['anonymous'], raw_event_semantics['name'], parameters)
    functions = dict()
    for (signature, raw_function_semantics) in abi.get('functions', {}).items():
        if raw_function_semantics:
            inputs = _decode_parameters_list(raw_function_semantics.get('inputs'))
            outputs = _decode_parameters_list(raw_function_semantics.get('outputs'))
            name = raw_function_semantics['name']
        else:
            inputs = outputs = []
            name = signature
        functions[signature] = FunctionSemantics(signature, name, inputs, outputs)
    return (events, functions)
def decode_events_and_functions(abi: dict) -> Tuple[(Dict[(str, EventSemantics)], Dict[(str, FunctionSemantics)])]:
    events = dict()
    for (signature, raw_event_semantics) in abi.get('events', {}).items():
        parameters = _decode_parameters_list(raw_event_semantics.get('parameters'))
        events[signature] = EventSemantics(signature, raw_event_semantics['anonymous'], raw_event_semantics['name'], parameters)
    functions = dict()
    for (signature, raw_function_semantics) in abi.get('functions', {}).items():
        if raw_function_semantics:
            inputs = _decode_parameters_list(raw_function_semantics.get('inputs'))
            outputs = _decode_parameters_list(raw_function_semantics.get('outputs'))
            name = raw_function_semantics['name']
        else:
            inputs = outputs = []
            name = signature
        functions[signature] = FunctionSemantics(signature, name, inputs, outputs)
    return (events, functions)