algorand / algorand/js-algorand-sdk
"Invalid byte array" when using `lookupAccountByID(...).includeAll().do()`
- Linguagem predominante
- TypeScript
- Estrelas
- 297
- Forks
- 214
- Merge médio
- 1h 3min
- PRs com merge (30d)
- 3
Descrição
### 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)
```
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Avaliação
Esta issue ainda não foi avaliada.