iexbase / tron-api

A PHP API for interacting with Tron (TRX)
https://iexbase.github.io/tron-api/
MIT License
416 stars 300 forks source link

why always listens to erc20 ABI and usdterc20 address events #186

Open vnxz opened 1 year ago

vnxz commented 1 year ago

This package make me confuse.when i try to listen events by using this package, it show events are ERC20 events with erc20 address , even I use TRC20 Contract address , events are as follow

  "caller_contract_address" => "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"
    "result" => array:6 [▼
      0 => "0x7b64f080b919f781892d88446f4948befa8274a3"
      1 => "0x5aba65d4f38d98bbae846ad902e6ea7201c32202"
      2 => "113213150"
      "from" => "0x7b64f080b919f781892d88446f4948befa8274a3"
      "to" => "0x5aba65d4f38d98bbae846ad902e6ea7201c32202"
      "value" => "113213150"
    ]
    "transaction_id" => "eb652c70149ea79ffc80763ed95605f202742beff176701ce00ef7bf645dc086"
    "result_type" => array:3 [▶]
    "_unconfirmed" => true
    "block_timestamp" => 1693940001000
    "block_number" => 54436546
    "event_name" => "Transfer"
    "contract_address" => "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"
    "event" => "Transfer(address indexed from, address indexed to, uint256 value)"
    "_fingerprint" => "3EHwYj8Z1CjpX8dohWQYgWzRgV8wxxvsCfo5Ljg6BKaAXWemRTqgHdR7puwmRvaNaBdX7UoyXL6vTbZSXkG3hxfBrUiN4RRBVS5JdPTDwSzxNLpnqCjb6knniKCPrAB6pj9vWYGGN9abvunpcgqgfNKHDAT8zxtx ▶"
    "event_index" => 0
  ]

from , to address are not TRC20 address, Lol , what the hell is going on, ABI Json error? do you have same issue?

ygcool commented 1 year ago

1: Replace 0x with 41

0x7b64f080b919f781892d88446f4948befa8274a3 => 417b64f080b919f781892d88446f4948befa8274a3

2: $tron->fromHex("417b64f080b919f781892d88446f4948befa8274a3");

// TMDf33v2phNDQ2gFPYZgswF78sZsJN6Fnx