algorand / algorand/js-algorand-sdk

"Invalid byte array" when using `lookupAccountByID(...).includeAll().do()`

未關閉
#968 1 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視
new-bug
主要語言
TypeScript
星號
297
分支
214
平均合併
1 小時 3 分鐘
30 天內合併 PR
3

描述

### 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)
```

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。