0

hello i use the env is android go ethereum light client not web3j not web3j i init geth code

        FilterQuery selfFQ = Geth.newFilterQuery();
        selfFQ.setTopics(Geth.newTopicsEmpty());
        selfFQ.setAddresses(Geth.newAddressesEmpty());
        Topics tps = selfFQ.getTopics();
        String strFunction = "ReturnValue(address,int256)";
        String HashStr = Sha3.hash(strFunction);
        List<String> topics = new ArrayList<>();
        topics.add("0x" + HashStr);
        tps.append(fromListToHashes(topics));
        selfFQ.setTopics(tps);
        node.getEthereumClient().subscribeFilterLogs(Geth.newContext(),selfFQ,new MyFilterLogsHandler(),16L);

then i receiver the log in bellow

    public void  onFilterLogs(org.ethereum.geth.Log var1){
    try{
        byte[] topics = var1.getTopics().get(0).getBytes();
        byte[] args = var1.getTopics().get(1).getBytes();
    }catch (Exception e){
        Log.d("111","onFilterLogs getTopics " + var1.toString());
    }
}

then i don't know how to parse the event and param ...... anybody can told me thanks

0

you will need abi to parse the event and inputs. I did the parsing in golang like this, abiParsed, err = abi.JSON(strings.NewReader(YourContract_ABI)) abiParsed.Events[eventName].Inputs.Unpack(v, rawLog.Data)

  • i cannot find the any detail about abi in geth.aar ..... maybe it's not been export in geth.aar – rexzhao May 25 '18 at 7:24
  • sorry, i dont fimilliar with mobile client. If abi not exposed, you may post a request to the eth team on github. And, you could try BoundContract and see if it gives your any API to unpack logs. – Rader May 25 '18 at 8:34
  • ok i'll try it ths a lot ! – rexzhao May 25 '18 at 8:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.