algorand / algorand/js-algorand-sdk
"Invalid byte array" when using `lookupAccountByID(...).includeAll().do()`
- Dominant language
- TypeScript
- Stars
- 297
- Forks
- 214
- Avg merge
- 1h 3m
- Merged PRs (30d)
- 3
Description
### Subject of the issue
When looking up an account using `.includeAll()` it'll retrieve extra data like deleted applications, destroyed assets, etc. and it seems to result in the algosdk failing to parse the response.
I noticed the approval and clearstate programs are `null` for the deleted applications and I'm wondering if this is resulting in the error.
extra info: I also noticed #909 shares the same error, though this might be because there are empty app args `""` instead of a null value?
Thanks to @cryptomalgo for identifying the issue.
### Steps to reproduce
```ts
import algosdk from "algosdk";
const indexer = new algosdk.Indexer("", "https://mainnet-idx.algonode.cloud", 443);
(async () => {
const works = await indexer.lookupAccountByID("EMNETCRVN2B4LYV4BDQ5JFYBJVAK663G2AOEENUV2WZK5U6FS3LNEIWTCU").do();
console.log(works);
const fails = await indexer.lookupAccountByID("EMNETCRVN2B4LYV4BDQ5JFYBJVAK663G2AOEENUV2WZK5U6FS3LNEIWTCU").includeAll().do();
console.log(fails);
})();
```
### Expected behaviour
Full account data is returned.
### Actual behaviour
```sh
error: Invalid byte array: (object) null
at fromPreparedJSON (~/demo/node_modules/algosdk/dist/esm/encoding/schema/bytearray.js:37:15)
at fromPreparedJSON (~/demo/node_modules/algosdk/dist/esm/encoding/schema/map.js:140:54)
at fromPreparedJSON (~/demo/node_modules/algosdk/dist/esm/encoding/schema/map.js:140:54)
at map (1:11)
at fromPreparedJSON (~/demo/node_modules/algosdk/dist/esm/encoding/schema/map.js:140:54)
at fromPreparedJSON (~/demo/node_modules/algosdk/dist/esm/encoding/schema/map.js:140:54)
at decodeJSON (~/demo/node_modules/algosdk/dist/esm/encoding/encoding.js:370:48)
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.