tronprotocol / tronweb

Javascript API Library for interacting with the TRON Network
MIT License
444 stars 275 forks source link

Clarification on Event_index in Tronweb #555

Open AmardeepSambaru opened 2 months ago

AmardeepSambaru commented 2 months ago

I am a Node operator and have set up the Tron event subscription using the official documentation (https://developers.tron.network/docs/event-plugin-deployment-mongodb). After executing the getEventResult method in TronWeb, I noticed that the output does not include the event_index parameter. see the below output of this method

{ block: 64894266, timestamp: 1725330330000, contract: 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t', name: 'Transfer', transaction: '3b1d5a1020104e179140acd8c3c6defc963bb139ec1bd665830179e2819913ca', result: { from: '0xbae017880fb02f310e418e4a135c77f3d567ccb3', to: '0x7d98443d36f2ad2740d52f0f4fd8a7bafb4403db', value: '69000000' }, resourceNode: 'fullNode', unconfirmed: true, fingerprint: 'qgYzMgexxTFqgNTFNTNeqYbMTDqeNJIJ' }

However, when using TronGrid with public url, the event_index parameter is present in the output. see the below output

{
  block_number: 64874111,
  block_timestamp: 1725269847000,
  caller_contract_address: 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t',
  contract_address: 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t',
  **event_index: 7,**
  event_name: 'Transfer',
  result: [Object],
  result_type: [Object],
  event: 'Transfer(address indexed from, address indexed to, uint256 value)',
  transaction_id: '74d0d411a30f4f6061201d42ee3510eb652a1d0b34a2efb88309f1444998d258'
}

Could you please confirm whether the event_index parameter is only available through TronGrid, or if it is possible to retrieve it via TronWeb as well? Please help me. Thank you.

Satan-web3 commented 2 months ago

TronWeb beta versions adapted TronGrid api which may be not compatible with java-tron api. It is recommended that you always use event service with TronGrid.

zachariahevans174 commented 2 months ago

I own that node the contract and the currency. Who authorized you to be on it attempting large transfers let alone any?

Get Outlook for iOShttps://aka.ms/o0ukef


From: Satan-web3 @.> Sent: Sunday, September 8, 2024 9:32:36 PM To: tronprotocol/tronweb @.> Cc: Subscribed @.***> Subject: Re: [tronprotocol/tronweb] Clarification on Event_index in Tronweb (Issue #555)

TronWeb beta versions adapted TronGrid api which may be not compatible with java-tron api. It is recommended that you always use event service with TronGrid.

— Reply to this email directly, view it on GitHubhttps://github.com/tronprotocol/tronweb/issues/555#issuecomment-2336993206, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BDV43C5FM4QIBX3T2PREFT3ZVUCEJAVCNFSM6AAAAABNVYSMHCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZWHE4TGMRQGY. You are receiving this because you are subscribed to this thread.Message ID: @.***>

Satan-web3 commented 1 month ago

Sorry I don't understand what you mean. Could you make it clear?