wharfkit / antelope

Core types, client interfaces, and other tools for working with Antelope-based blockchains.
Other
42 stars 23 forks source link

How to supppress variant types in Serializer.decode()? #61

Closed cc32d9 closed 1 year ago

cc32d9 commented 1 year ago

Code in question: https://github.com/EOSChronicleProject/chronos-client-npm/blob/abb109e10094c7ae4d5062753b2cf767793c3d71/src/chronos-client.ts#L39

I'm loading the SHIP ABI definition into an ABI object, and calling Serializer.decode()' to convert a binary representation oftransaction_trace` into JSON.

For every variant, I'm getting a pair [name, value], instead of just value:

[
  "transaction_trace_v0",
  {
    "id": "fc885861953788adcd2515099d7210196a07d7f0656c0f5048203833b9a0578e",
    "status": 0,
    "cpu_usage_us": 273,
    "net_usage_words": 0,
    "elapsed": 101,
    "net_usage": 0,
    "scheduled": true,
    "action_traces": [
      [
        "action_trace_v0",
        {
          "action_ordinal": 1,
          "creator_action_ordinal": 0,

It seems like this line is doing that: https://github.com/greymass/eosio-core/blob/f0d1c8811cfec24f43e25431ba3700f76f35634c/src/serializer/decoder.ts#L213

How can I instruct the decoder that I only need the value, and not the type name?

cc32d9 commented 1 year ago

solved it in https://github.com/EOSChronicleProject/chronos-client-npm/commit/7c05aab646cf086bcf960201fd31052067ef8d9e