@dedot/api 0.9.1 → 0.9.2

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.
@@ -360,7 +360,17 @@ class ChainHead extends JsonRpcGroup_js_1.JsonRpcGroup {
360
360
  if (!runtimeEvent)
361
361
  return;
362
362
  if (runtimeEvent.type == 'valid') {
363
- return runtimeEvent.spec;
363
+ const newRuntimeVersion = runtimeEvent.spec;
364
+ // fix inconsistent type of returned apis
365
+ // in some network endpoints this newRuntimeVersion.apis is an array (maybe using an old version of the sdk)
366
+ // here we convert it to a map format for consistency.
367
+ if (Array.isArray(newRuntimeVersion.apis)) {
368
+ newRuntimeVersion.apis = newRuntimeVersion.apis.reduce((o, [name, version]) => {
369
+ o[name] = version;
370
+ return o;
371
+ }, {});
372
+ }
373
+ return newRuntimeVersion;
364
374
  }
365
375
  // If the runtime is invalid,
366
376
  // we safely return an undefined runtime for now
@@ -357,7 +357,17 @@ export class ChainHead extends JsonRpcGroup {
357
357
  if (!runtimeEvent)
358
358
  return;
359
359
  if (runtimeEvent.type == 'valid') {
360
- return runtimeEvent.spec;
360
+ const newRuntimeVersion = runtimeEvent.spec;
361
+ // fix inconsistent type of returned apis
362
+ // in some network endpoints this newRuntimeVersion.apis is an array (maybe using an old version of the sdk)
363
+ // here we convert it to a map format for consistency.
364
+ if (Array.isArray(newRuntimeVersion.apis)) {
365
+ newRuntimeVersion.apis = newRuntimeVersion.apis.reduce((o, [name, version]) => {
366
+ o[name] = version;
367
+ return o;
368
+ }, {});
369
+ }
370
+ return newRuntimeVersion;
361
371
  }
362
372
  // If the runtime is invalid,
363
373
  // we safely return an undefined runtime for now
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@dedot/api",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "description": "A delightful JavaScript/TypeScript client for Polkadot & Substrate",
5
- "author": "Thang X. Vu <thang@coongcrafts.io>",
6
- "homepage": "https://github.com/dedotdev/dedot/tree/main/packages/api",
5
+ "author": "Thang X. Vu <thang@dedot.dev>",
6
+ "homepage": "https://dedot.dev",
7
7
  "repository": {
8
8
  "directory": "packages/api",
9
9
  "type": "git",
@@ -13,13 +13,13 @@
13
13
  "type": "module",
14
14
  "sideEffects": false,
15
15
  "dependencies": {
16
- "@dedot/codecs": "0.9.1",
17
- "@dedot/providers": "0.9.1",
18
- "@dedot/runtime-specs": "0.9.1",
19
- "@dedot/shape": "0.9.1",
20
- "@dedot/storage": "0.9.1",
21
- "@dedot/types": "0.9.1",
22
- "@dedot/utils": "0.9.1"
16
+ "@dedot/codecs": "0.9.2",
17
+ "@dedot/providers": "0.9.2",
18
+ "@dedot/runtime-specs": "0.9.2",
19
+ "@dedot/shape": "0.9.2",
20
+ "@dedot/storage": "0.9.2",
21
+ "@dedot/types": "0.9.2",
22
+ "@dedot/utils": "0.9.2"
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": "9329cadcd2062d0f10dc1d8f700d8ade25214199",
51
+ "gitHead": "b28ae48371785d44bf734cf45a5b8d0716d9bd70",
52
52
  "module": "./index.js",
53
53
  "types": "./index.d.ts"
54
54
  }