wharfkit / antelope

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

Unexpectedly encountered null for non-optional in get_account response #33

Closed theblockstalk closed 1 year ago

theblockstalk commented 1 year ago

In a developer environment, I have deployed the eosio.bios account but not a token.

When I call api.v1.chain.get_account("account_name") I receive an account response such as the one below

{
   "account_name": "xprq3ryq2ewx",
   "head_block_num": 153,
   "head_block_time": "2022-08-23T19:11:48.500",
   "privileged": false,
   "last_code_update": "1970-01-01T00:00:00.000",
   "created": "2022-08-23T19:10:57.000",
   "ram_quota": -1,
   "net_weight": -1,
   "cpu_weight": -1,
   "net_limit": {
      "used": -1,
      "available": -1,
      "max": -1
   },
   "cpu_limit": {
      "used": -1,
      "available": -1,
      "max": -1
   },
   "ram_usage": 3898,
   "permissions": [...],
   "total_resources": null,
   "self_delegated_bandwidth": null,
   "refund_request": null,
   "voter_info": null,
   "rex_info": null,
   "subjective_cpu_bill_limit": {
      "used": 0,
      "available": 0,
      "max": 0
   }
}

as you can see, several items have a null value, which when processed are causing the following error

Unexpectedly encountered null for non-optional

      at decodeObject (node_modules/@greymass/eosio/src/serializer/decoder.ts:244:6)

I am using @greymass/eosio-core 0.6.2. It seems to me that the library should work for all chains, even if not fully initialized with a resource token. Hope this helps.

aaroncox commented 1 year ago

Resolved in https://github.com/greymass/eosio-core/commit/c2ceafadd0be68f32fbdbb82ea2d2305b80a0812 - published in 0.6.4.