return FALSE; $r = well_tag_thread__update(array('id' => $id), $update); return $r; } function well_tag_thread_find($tagid, $page, $pagesize) { $arr = well_tag_thread__find(array('tagid' => $tagid), array('id' => -1), $page, $pagesize); return $arr; } function well_tag_thread_find_by_tid($tid, $page, $pagesize) { $arr = well_tag_thread__find(array('tid' => $tid), array(), $page, $pagesize); return $arr; } ?>ethereum - How to decode back to a DynamicStruct object using web3j? - Stack Overflow
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

ethereum - How to decode back to a DynamicStruct object using web3j? - Stack Overflow

programmeradmin0浏览0评论

web3j 12.0.0

the solidity source code like this

abi.encode(_from, _to, _value)

Here is my JAVA test code, step 1 I encoded a DynamicStruct, and step 2, how to decode back to a DynamicStruct object? I tried and failed.

@Test
    public void test_typeDecoder() {
//encoded = "00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000001e078";
        String encoded =
                TypeEncoder.encode(
                        new DynamicStruct(
                                new Address("0x01"),
                                new Address("0x02"),
                                new Uint256(123000)));


        //Decode fails with: TypeReferenced struct must contain a constructor with types that extend Type
        //DynamicStruct struct = TypeDecoder.decodeDynamicStruct(encoded, 0, TypeReference.create(DynamicStruct.class));

        //Decode fails with: Array types must be wrapped in a TypeReference
        //DynamicStruct struct = TypeDecoder.decode(encoded, DynamicStruct.class);
    }

I trid TypeDecoder.decodeDynamicStruct / TypeDecoder.decode, but failed.

Please give me a hand, thanks.

发布评论

评论列表(0)

  1. 暂无评论