@polkadot/types-create 7.7.2-7 → 7.8.2-0

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/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "./detectPackage.cjs"
21
21
  ],
22
22
  "type": "module",
23
- "version": "7.7.2-7",
23
+ "version": "7.8.2-0",
24
24
  "main": "index.cjs",
25
25
  "module": "index.js",
26
26
  "types": "index.d.ts",
@@ -115,8 +115,8 @@
115
115
  }
116
116
  },
117
117
  "dependencies": {
118
- "@babel/runtime": "^7.17.0",
119
- "@polkadot/types-codec": "7.7.2-7",
120
- "@polkadot/util": "^8.3.4-8"
118
+ "@babel/runtime": "^7.17.2",
119
+ "@polkadot/types-codec": "7.8.2-0",
120
+ "@polkadot/util": "^8.4.1"
121
121
  }
122
122
  }
package/packageInfo.cjs CHANGED
@@ -11,6 +11,6 @@ const packageInfo = {
11
11
  name: '@polkadot/types-create',
12
12
  path: typeof __dirname === 'string' ? __dirname : 'auto',
13
13
  type: 'cjs',
14
- version: '7.7.2-7'
14
+ version: '7.8.2-0'
15
15
  };
16
16
  exports.packageInfo = packageInfo;
package/packageInfo.js CHANGED
@@ -5,5 +5,5 @@ export const packageInfo = {
5
5
  name: '@polkadot/types-create',
6
6
  path: new URL('.', import.meta.url).pathname,
7
7
  type: 'esm',
8
- version: '7.7.2-7'
8
+ version: '7.8.2-0'
9
9
  };
@@ -37,8 +37,9 @@ function isRustEnum(details) {
37
37
  // { _enum: { A: 1, B: 2 } }
38
38
 
39
39
 
40
- function _decodeEnum(value, details, count) {
41
- value.info = _index.TypeDefInfo.Enum; // not as pretty, but remain compatible with oo7 for both struct and Array types
40
+ function _decodeEnum(value, details, count, fallbackType) {
41
+ value.info = _index.TypeDefInfo.Enum;
42
+ value.fallbackType = fallbackType; // not as pretty, but remain compatible with oo7 for both struct and Array types
42
43
 
43
44
  if (Array.isArray(details)) {
44
45
  value.sub = details.map((name, index) => ({
@@ -73,8 +74,9 @@ function _decodeEnum(value, details, count) {
73
74
  // { _set: { A: 0b0001, B: 0b0010, C: 0b0100 } }
74
75
 
75
76
 
76
- function _decodeSet(value, details) {
77
+ function _decodeSet(value, details, fallbackType) {
77
78
  value.info = _index.TypeDefInfo.Set;
79
+ value.fallbackType = fallbackType;
78
80
  value.length = details._bitLength;
79
81
  value.sub = Object.entries(details).filter(_ref3 => {
80
82
  let [name] = _ref3;
@@ -97,10 +99,10 @@ function _decodeStruct(value, type, _, count) {
97
99
  const parsed = JSON.parse(type);
98
100
  const keys = Object.keys(parsed);
99
101
 
100
- if (keys.length === 1 && keys[0] === '_enum') {
101
- return _decodeEnum(value, parsed[keys[0]], count);
102
- } else if (keys.length === 1 && keys[0] === '_set') {
103
- return _decodeSet(value, parsed[keys[0]]);
102
+ if (keys.includes('_enum')) {
103
+ return _decodeEnum(value, parsed._enum, count, parsed._fallback);
104
+ } else if (keys.includes('_set')) {
105
+ return _decodeSet(value, parsed._set, parsed._fallback);
104
106
  }
105
107
 
106
108
  value.alias = parsed._alias ? new Map(Object.entries(parsed._alias)) : undefined;
@@ -26,8 +26,9 @@ function isRustEnum(details) {
26
26
  // { _enum: { A: 1, B: 2 } }
27
27
 
28
28
 
29
- function _decodeEnum(value, details, count) {
30
- value.info = TypeDefInfo.Enum; // not as pretty, but remain compatible with oo7 for both struct and Array types
29
+ function _decodeEnum(value, details, count, fallbackType) {
30
+ value.info = TypeDefInfo.Enum;
31
+ value.fallbackType = fallbackType; // not as pretty, but remain compatible with oo7 for both struct and Array types
31
32
 
32
33
  if (Array.isArray(details)) {
33
34
  value.sub = details.map((name, index) => ({
@@ -56,8 +57,9 @@ function _decodeEnum(value, details, count) {
56
57
  // { _set: { A: 0b0001, B: 0b0010, C: 0b0100 } }
57
58
 
58
59
 
59
- function _decodeSet(value, details) {
60
+ function _decodeSet(value, details, fallbackType) {
60
61
  value.info = TypeDefInfo.Set;
62
+ value.fallbackType = fallbackType;
61
63
  value.length = details._bitLength;
62
64
  value.sub = Object.entries(details).filter(([name]) => !name.startsWith('_')).map(([name, index]) => ({
63
65
  index,
@@ -74,10 +76,10 @@ function _decodeStruct(value, type, _, count) {
74
76
  const parsed = JSON.parse(type);
75
77
  const keys = Object.keys(parsed);
76
78
 
77
- if (keys.length === 1 && keys[0] === '_enum') {
78
- return _decodeEnum(value, parsed[keys[0]], count);
79
- } else if (keys.length === 1 && keys[0] === '_set') {
80
- return _decodeSet(value, parsed[keys[0]]);
79
+ if (keys.includes('_enum')) {
80
+ return _decodeEnum(value, parsed._enum, count, parsed._fallback);
81
+ } else if (keys.includes('_set')) {
82
+ return _decodeSet(value, parsed._set, parsed._fallback);
81
83
  }
82
84
 
83
85
  value.alias = parsed._alias ? new Map(Object.entries(parsed._alias)) : undefined;