(eosjs) How to fetch a row with string type

357 Views Asked by At

In A.cpp, there is starinfo struct and memo property of string type.

struct starinfo{
        uint64_t num;
        account_name account;
        asset price;
        string memo;
}

I published contract, and wrote some value using push action.

This is result. (cleos.sh get table aaaa0000aaaa0000 aaaa0000aaaa0000 starinfo)

{
  "rows": [{
      "num": 0,
      "account": "aaabbbcccddd",
      "price": "1.0000 EOS",
      "memo": "M"
    }
  ],
  "more": false
}

But when I use eos.getTableRows below error occured.

"Unable to unpack built-in type 'string' while processing 'starinfo.memo'"

In detail,

 Error: {"code":500,"message":"Internal Service Error","error":{"code":3015013,  "name":"unpack_exception","what":"Unpack data exception","details":[{"message"  :"Unable to unpack built-in type 'string' while processing 'starinfo.memo'","f  ile":"abi_serializer.cpp","line_number":327,"method":"_binary_to_variant"},{"m  essage":"read datastream of length 58 over by -40","file":"datastream.cpp","li  ne_number":6,"method":"throw_datastream_range_error"}]}}

When I fetch a row under cleos console, it works. But when i fetch a row using eosjs, it doesn't work.

0

There are 0 best solutions below