HomeGuidesAPI ReferenceChangelog
GuidesAPI ReferenceCommunityDiscordBlogFAQBug BountyAnnouncementsChange Log
API Reference

getEventResult

Returns all events matching the filters.

🚧

API Change

Applies Starting From TronWeb 2.1.31

This new API function differs from the previous function in that it takes in an additional 3 parameters in the optional object input. These additional 3 parameters are onlyConfirmed, onlyUnconfirmed, and fingerprint.

Usage

tronWeb.getEventResult(contractAddress, {}, callback);

Parameter
String
Object

The { } input parameter refers to an object that contains 7 parameters whose values can be customized. If the values are not customized, then default values are set in place. The 7 parameters and their descriptions are below:

Options ParameterDescription
sinceTimestampFilter for events since certain timestamp.
eventNameName of the event to filter by.
blockNumberSpecific block number to query
sizemaximum number returned
onlyConfirmedIf set to true, only returns confirmed transactions.
onlyUnconfirmedIf set to true, only returns unconfirmed transactions.
fingerprintThe fingerprint field appears in the last data of the previous query. After specifying the corresponding field content this time, subsequent data will be returned. If there is no this field in the last data of the query, it means that there is no more data

Return
Promise Object(Array)

Example

> tronWeb.getEventResult("TUPz3wD356e3iV337s4cnjQS2weUdhX5ci",{eventName:"RNGIterated",size:2}).then(result => {console.log(result)})
Promise { <pending> }
> [
  {
    block: 615212,
    timestamp: 1577440164000,
    contract: 'TUPz3wD356e3iV337s4cnjQS2weUdhX5ci',
    name: 'RNGIterated',
    transaction: 'a8929bcfb8a7337d6c8c5850b5ed63cdd09ff17bbde46dad07b2c1f20c427e89',
    result: {
      index: '41796',
      rng: '3f7bf1c50a01cbcb980360effa904e0e11880af8daeeb2f8da686b7b3e5d9a50',
      timestamp: '1577440164'
    },
    resourceNode: 'solidityNode'
  },
  {
    block: 615205,
    timestamp: 1577440143000,
    contract: 'TUPz3wD356e3iV337s4cnjQS2weUdhX5ci',
    name: 'RNGIterated',
    transaction: 'fa9e91282de9eb462efabea838c2d0465602312a87ded06524c87d8afafd743d',
    result: {
      index: '41795',
      rng: 'bf190910aa5293ab12f644eb723b5460340e3ec11ac073124147e5fc92ca44d2',
      timestamp: '1577440143'
    },
    resourceNode: 'solidityNode',
    fingerprint: '2TBTeOqO3x2kJDyxT'
  }
]