@dedot/api 0.9.3 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -555,16 +555,13 @@ class ChainHead extends JsonRpcGroup_js_1.JsonRpcGroup {
555
555
  const isSmoldot = typeof this.client.provider['chain'] === 'function';
556
556
  if (isSmoldot) {
557
557
  const fetchItem = async (item) => {
558
- const [newBatch, newDiscardedItems] = await this.#getStorage([item], childTrie ?? null, hash);
558
+ const [batch, newDiscardedItems] = await this.#getStorage([item], childTrie ?? null, hash);
559
559
  if (newDiscardedItems.length > 0) {
560
560
  return fetchItem(item);
561
561
  }
562
- if (newBatch.length === 0) {
563
- return { key: item.key, value: undefined };
564
- }
565
- return newBatch[0];
562
+ return batch;
566
563
  };
567
- results = await Promise.all(items.map((one) => fetchItem(one)));
564
+ results = (await Promise.all(items.map((one) => fetchItem(one)))).flat();
568
565
  }
569
566
  else {
570
567
  let queryItems = items;
@@ -552,16 +552,13 @@ export class ChainHead extends JsonRpcGroup {
552
552
  const isSmoldot = typeof this.client.provider['chain'] === 'function';
553
553
  if (isSmoldot) {
554
554
  const fetchItem = async (item) => {
555
- const [newBatch, newDiscardedItems] = await this.#getStorage([item], childTrie ?? null, hash);
555
+ const [batch, newDiscardedItems] = await this.#getStorage([item], childTrie ?? null, hash);
556
556
  if (newDiscardedItems.length > 0) {
557
557
  return fetchItem(item);
558
558
  }
559
- if (newBatch.length === 0) {
560
- return { key: item.key, value: undefined };
561
- }
562
- return newBatch[0];
559
+ return batch;
563
560
  };
564
- results = await Promise.all(items.map((one) => fetchItem(one)));
561
+ results = (await Promise.all(items.map((one) => fetchItem(one)))).flat();
565
562
  }
566
563
  else {
567
564
  let queryItems = items;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dedot/api",
3
- "version": "0.9.3",
3
+ "version": "0.9.4",
4
4
  "description": "A delightful JavaScript/TypeScript client for Polkadot & Substrate",
5
5
  "author": "Thang X. Vu <thang@dedot.dev>",
6
6
  "homepage": "https://dedot.dev",
@@ -13,13 +13,13 @@
13
13
  "type": "module",
14
14
  "sideEffects": false,
15
15
  "dependencies": {
16
- "@dedot/codecs": "0.9.3",
17
- "@dedot/providers": "0.9.3",
18
- "@dedot/runtime-specs": "0.9.3",
19
- "@dedot/shape": "0.9.3",
20
- "@dedot/storage": "0.9.3",
21
- "@dedot/types": "0.9.3",
22
- "@dedot/utils": "0.9.3"
16
+ "@dedot/codecs": "0.9.4",
17
+ "@dedot/providers": "0.9.4",
18
+ "@dedot/runtime-specs": "0.9.4",
19
+ "@dedot/shape": "0.9.4",
20
+ "@dedot/storage": "0.9.4",
21
+ "@dedot/types": "0.9.4",
22
+ "@dedot/utils": "0.9.4"
23
23
  },
24
24
  "scripts": {
25
25
  "build": "tsc --project tsconfig.build.json && tsc --project tsconfig.build.cjs.json",
@@ -48,7 +48,7 @@
48
48
  "node": ">=18"
49
49
  },
50
50
  "license": "Apache-2.0",
51
- "gitHead": "206c4999865cddbd1078bf5b059c7b49822e20d0",
51
+ "gitHead": "1deabbf35425a688e76f1612210bcda3f7bedba3",
52
52
  "module": "./index.js",
53
53
  "types": "./index.d.ts"
54
54
  }