Skip to content

Conversation

ashishbhungani97
Copy link

@ashishbhungani97 ashishbhungani97 commented Sep 1, 2025

Adds getEventLogs method to retrieve blockchain event logs for a given event name within a specified block range.

Details -
Method: getEventLogs(string $eventName, $fromBlock = 'latest', $toBlock = 'latest')
Parameters:
$eventName – The event name to filter logs.
$fromBlock – Starting block number or tag (default: 'latest').
$toBlock – Ending block number or tag (default: 'latest').
Returns: An array of event log entries.

This addition improves event handling by providing an easy way to query logs directly from smart contracts.

Example Usage
// Fetch logs for "Transfer" event from block 1000 to latest
$logs = $contract->getEventLogs("Transfer", 1000, "latest");

foreach ($logs as $log) {
print_r($log);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant