implement event log getter
This commit is contained in:
parent
665b15b261
commit
af71b4d081
@ -863,4 +863,29 @@ class Contract
|
|||||||
return $functionData;
|
return $functionData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getEventLogs
|
||||||
|
*
|
||||||
|
* @param string $eventName
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getEventLogs($eventName)
|
||||||
|
{
|
||||||
|
$eventSignature = $this->ethabi->encodeEventSignature($eventName);
|
||||||
|
$eventInputParametersStringArray = $this->ethabi->encodeParameters($this->events[$eventName]);
|
||||||
|
|
||||||
|
$this->eth->getLogs([
|
||||||
|
'topics' => array($eventSignature),
|
||||||
|
'address' => $this->toAddress
|
||||||
|
],
|
||||||
|
function ($error, $result) use (&$output) {
|
||||||
|
if ($error !== null) {
|
||||||
|
throw new RuntimeException($error->getMessage());
|
||||||
|
}
|
||||||
|
$output = $result;
|
||||||
|
});
|
||||||
|
|
||||||
|
return $this->ethabi->decodeParameters($eventInputParametersStringArray, $output[0]->data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user