@polkadot/extension-chains 0.44.6 → 0.44.7

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.
package/bundle.js CHANGED
@@ -1,19 +1,22 @@
1
1
  // Copyright 2019-2022 @polkadot/extension-chains authors & contributors
2
2
  // SPDX-License-Identifier: Apache-2.0
3
+
3
4
  import { Metadata, TypeRegistry } from '@polkadot/types';
4
5
  import { base64Decode } from '@polkadot/util-crypto';
5
- export { packageInfo } from "./packageInfo.js"; // imports chain details, generally metadata. For the generation of these,
6
+ export { packageInfo } from "./packageInfo.js";
7
+
8
+ // imports chain details, generally metadata. For the generation of these,
6
9
  // inside the api, run `yarn chain:info --ws <url>`
7
10
 
8
- const definitions = new Map();
11
+ const definitions = new Map(
12
+ // [kusama].map((def) => [def.genesisHash, def])
13
+ );
9
14
  const expanded = new Map();
10
15
  export function metadataExpand(definition, isPartial = false) {
11
16
  const cached = expanded.get(definition.genesisHash);
12
-
13
17
  if (cached && cached.specVersion === definition.specVersion) {
14
18
  return cached;
15
19
  }
16
-
17
20
  const {
18
21
  chain,
19
22
  genesisHash,
@@ -27,22 +30,18 @@ export function metadataExpand(definition, isPartial = false) {
27
30
  userExtensions
28
31
  } = definition;
29
32
  const registry = new TypeRegistry();
30
-
31
33
  if (!isPartial) {
32
34
  registry.register(types);
33
35
  }
34
-
35
36
  registry.setChainProperties(registry.createType('ChainProperties', {
36
37
  ss58Format,
37
38
  tokenDecimals,
38
39
  tokenSymbol
39
40
  }));
40
41
  const hasMetadata = !!metaCalls && !isPartial;
41
-
42
42
  if (hasMetadata) {
43
43
  registry.setMetadata(new Metadata(registry, base64Decode(metaCalls)), undefined, userExtensions);
44
44
  }
45
-
46
45
  const isUnknown = genesisHash === '0x';
47
46
  const result = {
48
47
  definition,
@@ -57,11 +56,9 @@ export function metadataExpand(definition, isPartial = false) {
57
56
  tokenDecimals,
58
57
  tokenSymbol
59
58
  };
60
-
61
59
  if (result.genesisHash && !isPartial) {
62
60
  expanded.set(result.genesisHash, result);
63
61
  }
64
-
65
62
  return result;
66
63
  }
67
64
  export function findChain(definitions, genesisHash) {
package/cjs/bundle.js CHANGED
@@ -13,28 +13,25 @@ Object.defineProperty(exports, "packageInfo", {
13
13
  return _packageInfo.packageInfo;
14
14
  }
15
15
  });
16
-
17
16
  var _types = require("@polkadot/types");
18
-
19
17
  var _utilCrypto = require("@polkadot/util-crypto");
20
-
21
18
  var _packageInfo = require("./packageInfo");
22
-
23
19
  // Copyright 2019-2022 @polkadot/extension-chains authors & contributors
24
20
  // SPDX-License-Identifier: Apache-2.0
21
+
25
22
  // imports chain details, generally metadata. For the generation of these,
26
23
  // inside the api, run `yarn chain:info --ws <url>`
27
- const definitions = new Map();
28
- const expanded = new Map();
29
24
 
25
+ const definitions = new Map(
26
+ // [kusama].map((def) => [def.genesisHash, def])
27
+ );
28
+ const expanded = new Map();
30
29
  function metadataExpand(definition) {
31
30
  let isPartial = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
32
31
  const cached = expanded.get(definition.genesisHash);
33
-
34
32
  if (cached && cached.specVersion === definition.specVersion) {
35
33
  return cached;
36
34
  }
37
-
38
35
  const {
39
36
  chain,
40
37
  genesisHash,
@@ -48,22 +45,18 @@ function metadataExpand(definition) {
48
45
  userExtensions
49
46
  } = definition;
50
47
  const registry = new _types.TypeRegistry();
51
-
52
48
  if (!isPartial) {
53
49
  registry.register(types);
54
50
  }
55
-
56
51
  registry.setChainProperties(registry.createType('ChainProperties', {
57
52
  ss58Format,
58
53
  tokenDecimals,
59
54
  tokenSymbol
60
55
  }));
61
56
  const hasMetadata = !!metaCalls && !isPartial;
62
-
63
57
  if (hasMetadata) {
64
58
  registry.setMetadata(new _types.Metadata(registry, (0, _utilCrypto.base64Decode)(metaCalls)), undefined, userExtensions);
65
59
  }
66
-
67
60
  const isUnknown = genesisHash === '0x';
68
61
  const result = {
69
62
  definition,
@@ -78,23 +71,18 @@ function metadataExpand(definition) {
78
71
  tokenDecimals,
79
72
  tokenSymbol
80
73
  };
81
-
82
74
  if (result.genesisHash && !isPartial) {
83
75
  expanded.set(result.genesisHash, result);
84
76
  }
85
-
86
77
  return result;
87
78
  }
88
-
89
79
  function findChain(definitions, genesisHash) {
90
80
  const def = definitions.find(def => def.genesisHash === genesisHash);
91
81
  return def ? metadataExpand(def) : null;
92
82
  }
93
-
94
83
  function addMetadata(def) {
95
84
  definitions.set(def.genesisHash, def);
96
85
  }
97
-
98
86
  function knownMetadata() {
99
87
  return [...definitions.values()];
100
88
  }
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _packageInfo = require("@polkadot/extension-inject/cjs/packageInfo");
9
-
10
8
  // Copyright 2017-2022 @polkadot/extension-chains authors & contributors
11
9
  // SPDX-License-Identifier: Apache-2.0
12
10
  var _default = [_packageInfo.packageInfo];
@@ -1,14 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  var _util = require("@polkadot/util");
6
-
7
5
  var _detectOther = _interopRequireDefault(require("./detectOther"));
8
-
9
6
  var _packageInfo = require("./packageInfo");
10
-
11
7
  // Copyright 2017-2022 @polkadot/extension-chains authors & contributors
12
8
  // SPDX-License-Identifier: Apache-2.0
9
+
13
10
  // Do not edit, auto-generated by @polkadot/dev
11
+
14
12
  (0, _util.detectPackage)(_packageInfo.packageInfo, null, _detectOther.default);
package/cjs/index.js CHANGED
@@ -3,9 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  var _bundle = require("./bundle");
8
-
9
7
  Object.keys(_bundle).forEach(function (key) {
10
8
  if (key === "default" || key === "__esModule") return;
11
9
  if (key in exports && exports[key] === _bundle[key]) return;
@@ -6,11 +6,13 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.packageInfo = void 0;
7
7
  // Copyright 2017-2022 @polkadot/extension-chains authors & contributors
8
8
  // SPDX-License-Identifier: Apache-2.0
9
+
9
10
  // Do not edit, auto-generated by @polkadot/dev
11
+
10
12
  const packageInfo = {
11
13
  name: '@polkadot/extension-chains',
12
14
  path: typeof __dirname === 'string' ? __dirname : 'auto',
13
15
  type: 'cjs',
14
- version: '0.44.6'
16
+ version: '0.44.7'
15
17
  };
16
18
  exports.packageInfo = packageInfo;
package/detectOther.js CHANGED
@@ -1,4 +1,5 @@
1
1
  // Copyright 2017-2022 @polkadot/extension-chains authors & contributors
2
2
  // SPDX-License-Identifier: Apache-2.0
3
+
3
4
  import { packageInfo as injectInfo } from '@polkadot/extension-inject/packageInfo';
4
5
  export default [injectInfo];
package/detectPackage.js CHANGED
@@ -1,6 +1,8 @@
1
1
  // Copyright 2017-2022 @polkadot/extension-chains authors & contributors
2
2
  // SPDX-License-Identifier: Apache-2.0
3
+
3
4
  // Do not edit, auto-generated by @polkadot/dev
5
+
4
6
  import { detectPackage } from '@polkadot/util';
5
7
  import others from "./detectOther.js";
6
8
  import { packageInfo } from "./packageInfo.js";
package/index.js CHANGED
@@ -1,5 +1,7 @@
1
1
  // Copyright 2019-2022 @polkadot/extension-chains authors & contributors
2
2
  // SPDX-License-Identifier: Apache-2.0
3
+
3
4
  // Since we inject into pages, we skip this
4
5
  // import './detectPackage';
6
+
5
7
  export * from "./bundle.js";
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "./cjs/detectPackage.js"
18
18
  ],
19
19
  "type": "module",
20
- "version": "0.44.6",
20
+ "version": "0.44.7",
21
21
  "main": "./cjs/index.js",
22
22
  "module": "./index.js",
23
23
  "types": "./index.d.ts",
@@ -62,11 +62,11 @@
62
62
  }
63
63
  },
64
64
  "dependencies": {
65
- "@babel/runtime": "^7.18.9",
66
- "@polkadot/extension-inject": "^0.44.6",
67
- "@polkadot/networks": "^10.1.5",
68
- "@polkadot/util": "^10.1.5",
69
- "@polkadot/util-crypto": "^10.1.5"
65
+ "@babel/runtime": "^7.20.7",
66
+ "@polkadot/extension-inject": "^0.44.7",
67
+ "@polkadot/networks": "^10.2.1",
68
+ "@polkadot/util": "^10.2.1",
69
+ "@polkadot/util-crypto": "^10.2.1"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "@polkadot/api": "*",
package/packageInfo.js CHANGED
@@ -1,9 +1,11 @@
1
1
  // Copyright 2017-2022 @polkadot/extension-chains authors & contributors
2
2
  // SPDX-License-Identifier: Apache-2.0
3
+
3
4
  // Do not edit, auto-generated by @polkadot/dev
5
+
4
6
  export const packageInfo = {
5
7
  name: '@polkadot/extension-chains',
6
8
  path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
7
9
  type: 'esm',
8
- version: '0.44.6'
10
+ version: '0.44.7'
9
11
  };