web3p / web3.php

A php interface for interacting with the Ethereum blockchain and ecosystem. Native ABI parsing and smart contract interactions.
MIT License
1.17k stars 550 forks source link

call eth_newFilter ,then call eth_getLogs,error:invalid argument 0: hex has invalid length 28 after decoding #211

Closed afanxingzhou closed 3 years ago

afanxingzhou commented 3 years ago

use eth_newFilter parameters: Array ( [fromBlock] => 0x257 [toBlock] => latest [address] => 0xE766387C9eC83DB39D5573784DA238A53aD4e339 [topics] => Array ( [0] => 0x000000000000000000000000554db88dac0d6f853fdc2985fd9cd39ab96ce87b )

) get result:0x88df8b2f5bc8e5a095b66488caebdd57; then I call eth_getLogs,this is parameters: Array ( [topics] => Array ( [0] => 0x00000000000000000000000088df8b2f5bc8e5a095b66488caebdd57 )

) get error:invalid argument 0: hex has invalid length 28 after decoding please Help me..

afanxingzhou commented 3 years ago

I want to get contact transaction logs,now I change getFilter parameters: $params['topics'] = [null,null,str_replace('0x', '0x000000000000000000000000', $address)]; and then use getFilterLogs, get transactions success! don't use eth_getLogs api.