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

Decoding JSON RPC Response. #48

Open bvandermeersch opened 6 years ago

bvandermeersch commented 6 years ago

I have made my own curl request to etherscan and infura via php to get my contract data into php.

how would I use this project just to decode the json-rpc response returned data?

I dont see any php libraries to decode the response.

bvandermeersch commented 6 years ago

Im guessing I use the

public function decodeParameters($types, $param)

What exactly am I passing into it?

sc0Vu commented 6 years ago

Hi @bvandermeersch

What kind of contract data did you want to decode? Deployed contract data? The decodeParameters function is aimed to decode return value from function call. This function might not be the choice.

wuchenge commented 6 years ago

i want dedecode getLogs return "data" {#229 ▼ +"address": "0x714884690a285a430a89cbebde169b96f1694b4e" +"topics": array:3 [▼ 0 => "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925" 1 => "0x0000000000000000000000004645268f11f3a485a462999c98fec1dd0b621c60" 2 => "0x0000000000000000000000003ad0d259d1b47f2b06b5f2041f02c4e87c6a6178" ] +"data": "0x0000000000000000000000000000000000000000033b2e3c9fd0803ce8000000" +"blockNumber": "0x34862" +"transactionHash": "0xc62133366736f19296682c731b70225b51dc0db5941659e8e448ba4d31a73e79" +"transactionIndex": "0x0" +"blockHash": "0x796588535701ed3c907d2d3a782da4a3824ac6efd48065179ebfec22e0ae1e4d" +"logIndex": "0x0" +"removed": false }