pub fn events_emitted(&self, executor: Executor, events: &[(&str, &[ethabi::Token])]) {
        let raw_logs = executor
            .deconstruct()
            .1
            .into_iter()
            .map(|log| ethabi::RawLog::from((log.topics, log.data)))
            .collect::<Vec<ethabi::RawLog>>();

        for (name, expected_output) in events {
            let event = self
                .abi
                .events()
                .find(|event| event.name.eq(name))
                .expect("unable to find event for name");

            let outputs_for_event = raw_logs
                .iter()
                .filter_map(|raw_log| event.parse_log(raw_log.to_owned()).ok())
                .map(|event_log| {
                    event_log
                        .params
                        .into_iter()
                        .map(|param| param.value)
                        .collect::<Vec<_>>()
                })
                .collect::<Vec<_>>();

            if !outputs_for_event.iter().any(|v| &v == expected_output) {
                panic!(
                    "no {} logs matching: {:?}\nfound: {:?}",
                    name, expected_output, outputs_for_event
                )
            }
        }
    }
// Executor must be passed by value to get emitted events.
Executor must be passed by value to get emitted events.
Executor must be passed by value to get emitted events .
pub fn events_emitted(&self, executor: Executor, events: &[(&str, &[ethabi::Token])]) {
        let raw_logs = executor
            .deconstruct()
            .1
            .into_iter()
            .map(|log| ethabi::RawLog::from((log.topics, log.data)))
            .collect::<Vec<ethabi::RawLog>>();
        for (name, expected_output) in events {
            let event = self
                .abi
                .events()
                .find(|event| event.name.eq(name))
                .expect("unable to find event for name");
            let outputs_for_event = raw_logs
                .iter()
                .filter_map(|raw_log| event.parse_log(raw_log.to_owned()).ok())
                .map(|event_log| {
                    event_log
                        .params
                        .into_iter()
                        .map(|param| param.value)
                        .collect::<Vec<_>>()
                })
                .collect::<Vec<_>>();
            if !outputs_for_event.iter().any(|v| &v == expected_output) {
                panic!(
                    "no {} logs matching: {:?}\nfound: {:?}",
                    name, expected_output, outputs_for_event
                )
            }
        }
    }
pub fn events_emitted ( & self , executor : Executor , events : & [ ( & str , & [ ethabi :: Token ] ) ] ) { let raw_logs = executor . deconstruct ( ) . 1 . into_iter ( ) . map ( | log | ethabi :: RawLog :: from ( ( log . topics , log . data ) ) ) . collect :: < Vec < ethabi :: RawLog > > ( ) ; for ( name , expected_output ) in events { let event = self . abi . events ( ) . find ( | event | event . name . eq ( name ) ) . expect ( " " ) ; let outputs_for_event = raw_logs . iter ( ) . filter_map ( | raw_log | event . parse_log ( raw_log . to_owned ( ) ) . ok ( ) ) . map ( | event_log | { event_log . params . into_iter ( ) . map ( | param | param . value ) . collect :: < Vec < _ > > ( ) } ) . collect :: < Vec < _ > > ( ) ; if ! outputs_for_event . iter ( ) . any ( | v | & v == expected_output ) { panic ! ( " \n " name expected_output outputs_for_event ) } } }
Executor must be passed by value to get emitted events.
Executor must be passed by value to get emitted events .
&self
executor
Executor
events
&[(&str, &[ethabi::Token])]
&self
executor
Executor
events
&[(&str, &[ethabi::Token])]