@polkadot/types-create 7.4.2-8 → 7.5.2-1

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/create/class.cjs CHANGED
@@ -118,7 +118,8 @@ const infoMapping = {
118
118
  [_index.TypeDefInfo.Null]: (registry, _) => _typesCodec.Null,
119
119
  [_index.TypeDefInfo.Option]: (registry, value) => createWithSub(_typesCodec.Option, value),
120
120
  [_index.TypeDefInfo.Plain]: (registry, value) => registry.getOrUnknown(value.type),
121
- [_index.TypeDefInfo.Range]: (registry, value) => (value.type.includes('RangeInclusive') ? _typesCodec.RangeInclusive : _typesCodec.Range).with(getSubType(value)),
121
+ [_index.TypeDefInfo.Range]: (registry, value) => createWithSub(_typesCodec.Range, value),
122
+ [_index.TypeDefInfo.RangeInclusive]: (registry, value) => createWithSub(_typesCodec.RangeInclusive, value),
122
123
  [_index.TypeDefInfo.Result]: (registry, value) => {
123
124
  const [Ok, Err] = getTypeClassArray(value); // eslint-disable-next-line @typescript-eslint/no-use-before-define
124
125
 
package/create/class.js CHANGED
@@ -99,7 +99,8 @@ const infoMapping = {
99
99
  [TypeDefInfo.Null]: (registry, _) => Null,
100
100
  [TypeDefInfo.Option]: (registry, value) => createWithSub(Option, value),
101
101
  [TypeDefInfo.Plain]: (registry, value) => registry.getOrUnknown(value.type),
102
- [TypeDefInfo.Range]: (registry, value) => (value.type.includes('RangeInclusive') ? RangeInclusive : Range).with(getSubType(value)),
102
+ [TypeDefInfo.Range]: (registry, value) => createWithSub(Range, value),
103
+ [TypeDefInfo.RangeInclusive]: (registry, value) => createWithSub(RangeInclusive, value),
103
104
  [TypeDefInfo.Result]: (registry, value) => {
104
105
  const [Ok, Err] = getTypeClassArray(value); // eslint-disable-next-line @typescript-eslint/no-use-before-define
105
106
 
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "./detectPackage.cjs"
21
21
  ],
22
22
  "type": "module",
23
- "version": "7.4.2-8",
23
+ "version": "7.5.2-1",
24
24
  "main": "index.cjs",
25
25
  "module": "index.js",
26
26
  "types": "index.d.ts",
@@ -116,7 +116,7 @@
116
116
  },
117
117
  "dependencies": {
118
118
  "@babel/runtime": "^7.16.7",
119
- "@polkadot/types-codec": "7.4.2-8",
120
- "@polkadot/util": "^8.3.2"
119
+ "@polkadot/types-codec": "7.5.2-1",
120
+ "@polkadot/util": "^8.3.3"
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.4.2-8'
14
+ version: '7.5.2-1'
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.4.2-8'
8
+ version: '7.5.2-1'
9
9
  };
package/types/types.cjs CHANGED
@@ -22,14 +22,15 @@ exports.TypeDefInfo = TypeDefInfo;
22
22
  TypeDefInfo[TypeDefInfo["Option"] = 9] = "Option";
23
23
  TypeDefInfo[TypeDefInfo["Plain"] = 10] = "Plain";
24
24
  TypeDefInfo[TypeDefInfo["Range"] = 11] = "Range";
25
- TypeDefInfo[TypeDefInfo["Result"] = 12] = "Result";
26
- TypeDefInfo[TypeDefInfo["Set"] = 13] = "Set";
27
- TypeDefInfo[TypeDefInfo["Si"] = 14] = "Si";
28
- TypeDefInfo[TypeDefInfo["Struct"] = 15] = "Struct";
29
- TypeDefInfo[TypeDefInfo["Tuple"] = 16] = "Tuple";
30
- TypeDefInfo[TypeDefInfo["UInt"] = 17] = "UInt";
31
- TypeDefInfo[TypeDefInfo["Vec"] = 18] = "Vec";
32
- TypeDefInfo[TypeDefInfo["VecFixed"] = 19] = "VecFixed";
33
- TypeDefInfo[TypeDefInfo["WrapperKeepOpaque"] = 20] = "WrapperKeepOpaque";
34
- TypeDefInfo[TypeDefInfo["WrapperOpaque"] = 21] = "WrapperOpaque";
25
+ TypeDefInfo[TypeDefInfo["RangeInclusive"] = 12] = "RangeInclusive";
26
+ TypeDefInfo[TypeDefInfo["Result"] = 13] = "Result";
27
+ TypeDefInfo[TypeDefInfo["Set"] = 14] = "Set";
28
+ TypeDefInfo[TypeDefInfo["Si"] = 15] = "Si";
29
+ TypeDefInfo[TypeDefInfo["Struct"] = 16] = "Struct";
30
+ TypeDefInfo[TypeDefInfo["Tuple"] = 17] = "Tuple";
31
+ TypeDefInfo[TypeDefInfo["UInt"] = 18] = "UInt";
32
+ TypeDefInfo[TypeDefInfo["Vec"] = 19] = "Vec";
33
+ TypeDefInfo[TypeDefInfo["VecFixed"] = 20] = "VecFixed";
34
+ TypeDefInfo[TypeDefInfo["WrapperKeepOpaque"] = 21] = "WrapperKeepOpaque";
35
+ TypeDefInfo[TypeDefInfo["WrapperOpaque"] = 22] = "WrapperOpaque";
35
36
  })(TypeDefInfo || (exports.TypeDefInfo = TypeDefInfo = {}));
package/types/types.d.ts CHANGED
@@ -11,16 +11,17 @@ export declare enum TypeDefInfo {
11
11
  Option = 9,
12
12
  Plain = 10,
13
13
  Range = 11,
14
- Result = 12,
15
- Set = 13,
16
- Si = 14,
17
- Struct = 15,
18
- Tuple = 16,
19
- UInt = 17,
20
- Vec = 18,
21
- VecFixed = 19,
22
- WrapperKeepOpaque = 20,
23
- WrapperOpaque = 21
14
+ RangeInclusive = 12,
15
+ Result = 13,
16
+ Set = 14,
17
+ Si = 15,
18
+ Struct = 16,
19
+ Tuple = 17,
20
+ UInt = 18,
21
+ Vec = 19,
22
+ VecFixed = 20,
23
+ WrapperKeepOpaque = 21,
24
+ WrapperOpaque = 22
24
25
  }
25
26
  export interface TypeDef {
26
27
  alias?: Map<string, string>;
package/types/types.js CHANGED
@@ -15,14 +15,15 @@ export let TypeDefInfo;
15
15
  TypeDefInfo[TypeDefInfo["Option"] = 9] = "Option";
16
16
  TypeDefInfo[TypeDefInfo["Plain"] = 10] = "Plain";
17
17
  TypeDefInfo[TypeDefInfo["Range"] = 11] = "Range";
18
- TypeDefInfo[TypeDefInfo["Result"] = 12] = "Result";
19
- TypeDefInfo[TypeDefInfo["Set"] = 13] = "Set";
20
- TypeDefInfo[TypeDefInfo["Si"] = 14] = "Si";
21
- TypeDefInfo[TypeDefInfo["Struct"] = 15] = "Struct";
22
- TypeDefInfo[TypeDefInfo["Tuple"] = 16] = "Tuple";
23
- TypeDefInfo[TypeDefInfo["UInt"] = 17] = "UInt";
24
- TypeDefInfo[TypeDefInfo["Vec"] = 18] = "Vec";
25
- TypeDefInfo[TypeDefInfo["VecFixed"] = 19] = "VecFixed";
26
- TypeDefInfo[TypeDefInfo["WrapperKeepOpaque"] = 20] = "WrapperKeepOpaque";
27
- TypeDefInfo[TypeDefInfo["WrapperOpaque"] = 21] = "WrapperOpaque";
18
+ TypeDefInfo[TypeDefInfo["RangeInclusive"] = 12] = "RangeInclusive";
19
+ TypeDefInfo[TypeDefInfo["Result"] = 13] = "Result";
20
+ TypeDefInfo[TypeDefInfo["Set"] = 14] = "Set";
21
+ TypeDefInfo[TypeDefInfo["Si"] = 15] = "Si";
22
+ TypeDefInfo[TypeDefInfo["Struct"] = 16] = "Struct";
23
+ TypeDefInfo[TypeDefInfo["Tuple"] = 17] = "Tuple";
24
+ TypeDefInfo[TypeDefInfo["UInt"] = 18] = "UInt";
25
+ TypeDefInfo[TypeDefInfo["Vec"] = 19] = "Vec";
26
+ TypeDefInfo[TypeDefInfo["VecFixed"] = 20] = "VecFixed";
27
+ TypeDefInfo[TypeDefInfo["WrapperKeepOpaque"] = 21] = "WrapperKeepOpaque";
28
+ TypeDefInfo[TypeDefInfo["WrapperOpaque"] = 22] = "WrapperOpaque";
28
29
  })(TypeDefInfo || (TypeDefInfo = {}));
@@ -36,6 +36,7 @@ function encodeWithParams(registry, typeDef, outer) {
36
36
  case _index.TypeDefInfo.Linkage:
37
37
  case _index.TypeDefInfo.Option:
38
38
  case _index.TypeDefInfo.Range:
39
+ case _index.TypeDefInfo.RangeInclusive:
39
40
  case _index.TypeDefInfo.Result:
40
41
  case _index.TypeDefInfo.Vec:
41
42
  case _index.TypeDefInfo.WrapperKeepOpaque:
@@ -120,7 +121,8 @@ const encoders = {
120
121
  } = _ref7;
121
122
  return displayName || type;
122
123
  },
123
- [_index.TypeDefInfo.Range]: (registry, typeDef) => encodeWithParams(registry, typeDef, typeDef.type.includes('RangeInclusive') ? 'RangeInclusive' : 'Range'),
124
+ [_index.TypeDefInfo.Range]: (registry, typeDef) => encodeWithParams(registry, typeDef, 'Range'),
125
+ [_index.TypeDefInfo.RangeInclusive]: (registry, typeDef) => encodeWithParams(registry, typeDef, 'RangeInclusive'),
124
126
  [_index.TypeDefInfo.Result]: (registry, typeDef) => encodeWithParams(registry, typeDef, 'Result'),
125
127
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
126
128
  [_index.TypeDefInfo.Set]: (registry, _ref8) => {
@@ -24,6 +24,7 @@ function encodeWithParams(registry, typeDef, outer) {
24
24
  case TypeDefInfo.Linkage:
25
25
  case TypeDefInfo.Option:
26
26
  case TypeDefInfo.Range:
27
+ case TypeDefInfo.RangeInclusive:
27
28
  case TypeDefInfo.Result:
28
29
  case TypeDefInfo.Vec:
29
30
  case TypeDefInfo.WrapperKeepOpaque:
@@ -89,7 +90,8 @@ const encoders = {
89
90
  displayName,
90
91
  type
91
92
  }) => displayName || type,
92
- [TypeDefInfo.Range]: (registry, typeDef) => encodeWithParams(registry, typeDef, typeDef.type.includes('RangeInclusive') ? 'RangeInclusive' : 'Range'),
93
+ [TypeDefInfo.Range]: (registry, typeDef) => encodeWithParams(registry, typeDef, 'Range'),
94
+ [TypeDefInfo.RangeInclusive]: (registry, typeDef) => encodeWithParams(registry, typeDef, 'RangeInclusive'),
93
95
  [TypeDefInfo.Result]: (registry, typeDef) => encodeWithParams(registry, typeDef, 'Result'),
94
96
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
95
97
  [TypeDefInfo.Set]: (registry, {
@@ -138,12 +138,6 @@ function _decodeFixedVec(value, type, _, count) {
138
138
  value.length = length;
139
139
  value.sub = getTypeDef(vecType, {}, count);
140
140
  return value;
141
- }
142
-
143
- function _decodeRange(value, _, subType) {
144
- const Type = getTypeDef(subType);
145
- value.sub = [Type, Type];
146
- return value;
147
141
  } // decode a tuple
148
142
 
149
143
 
@@ -185,9 +179,8 @@ function hasWrapper(type, _ref5) {
185
179
  }
186
180
 
187
181
  const nestedExtraction = [['[', ']', _index.TypeDefInfo.VecFixed, _decodeFixedVec], ['{', '}', _index.TypeDefInfo.Struct, _decodeStruct], ['(', ')', _index.TypeDefInfo.Tuple, _decodeTuple], // the inner for these are the same as tuple, multiple values
188
- ['BTreeMap<', '>', _index.TypeDefInfo.BTreeMap, _decodeTuple], ['HashMap<', '>', _index.TypeDefInfo.HashMap, _decodeTuple], ['Int<', '>', _index.TypeDefInfo.Int, _decodeInt], // Not sure about these, have a specific implementation?
189
- ['Range<', '>', _index.TypeDefInfo.Tuple, _decodeRange], ['RangeInclusive<', '>', _index.TypeDefInfo.Tuple, _decodeRange], ['Result<', '>', _index.TypeDefInfo.Result, _decodeTuple], ['UInt<', '>', _index.TypeDefInfo.UInt, _decodeUInt], ['DoNotConstruct<', '>', _index.TypeDefInfo.DoNotConstruct, _decodeDoNotConstruct]];
190
- const wrappedExtraction = [['BTreeSet<', '>', _index.TypeDefInfo.BTreeSet], ['Compact<', '>', _index.TypeDefInfo.Compact], ['Linkage<', '>', _index.TypeDefInfo.Linkage], ['Option<', '>', _index.TypeDefInfo.Option], ['Vec<', '>', _index.TypeDefInfo.Vec], ['WrapperKeepOpaque<', '>', _index.TypeDefInfo.WrapperKeepOpaque], ['WrapperOpaque<', '>', _index.TypeDefInfo.WrapperOpaque]];
182
+ ['BTreeMap<', '>', _index.TypeDefInfo.BTreeMap, _decodeTuple], ['HashMap<', '>', _index.TypeDefInfo.HashMap, _decodeTuple], ['Int<', '>', _index.TypeDefInfo.Int, _decodeInt], ['Result<', '>', _index.TypeDefInfo.Result, _decodeTuple], ['UInt<', '>', _index.TypeDefInfo.UInt, _decodeUInt], ['DoNotConstruct<', '>', _index.TypeDefInfo.DoNotConstruct, _decodeDoNotConstruct]];
183
+ const wrappedExtraction = [['BTreeSet<', '>', _index.TypeDefInfo.BTreeSet], ['Compact<', '>', _index.TypeDefInfo.Compact], ['Linkage<', '>', _index.TypeDefInfo.Linkage], ['Option<', '>', _index.TypeDefInfo.Option], ['Range<', '>', _index.TypeDefInfo.Range], ['RangeInclusive<', '>', _index.TypeDefInfo.RangeInclusive], ['Vec<', '>', _index.TypeDefInfo.Vec], ['WrapperKeepOpaque<', '>', _index.TypeDefInfo.WrapperKeepOpaque], ['WrapperOpaque<', '>', _index.TypeDefInfo.WrapperOpaque]];
191
184
 
192
185
  function extractSubType(type, _ref6) {
193
186
  let [start, end] = _ref6;
@@ -115,12 +115,6 @@ function _decodeFixedVec(value, type, _, count) {
115
115
  value.length = length;
116
116
  value.sub = getTypeDef(vecType, {}, count);
117
117
  return value;
118
- }
119
-
120
- function _decodeRange(value, _, subType) {
121
- const Type = getTypeDef(subType);
122
- value.sub = [Type, Type];
123
- return value;
124
118
  } // decode a tuple
125
119
 
126
120
 
@@ -161,9 +155,8 @@ function hasWrapper(type, [start, end]) {
161
155
  }
162
156
 
163
157
  const nestedExtraction = [['[', ']', TypeDefInfo.VecFixed, _decodeFixedVec], ['{', '}', TypeDefInfo.Struct, _decodeStruct], ['(', ')', TypeDefInfo.Tuple, _decodeTuple], // the inner for these are the same as tuple, multiple values
164
- ['BTreeMap<', '>', TypeDefInfo.BTreeMap, _decodeTuple], ['HashMap<', '>', TypeDefInfo.HashMap, _decodeTuple], ['Int<', '>', TypeDefInfo.Int, _decodeInt], // Not sure about these, have a specific implementation?
165
- ['Range<', '>', TypeDefInfo.Tuple, _decodeRange], ['RangeInclusive<', '>', TypeDefInfo.Tuple, _decodeRange], ['Result<', '>', TypeDefInfo.Result, _decodeTuple], ['UInt<', '>', TypeDefInfo.UInt, _decodeUInt], ['DoNotConstruct<', '>', TypeDefInfo.DoNotConstruct, _decodeDoNotConstruct]];
166
- const wrappedExtraction = [['BTreeSet<', '>', TypeDefInfo.BTreeSet], ['Compact<', '>', TypeDefInfo.Compact], ['Linkage<', '>', TypeDefInfo.Linkage], ['Option<', '>', TypeDefInfo.Option], ['Vec<', '>', TypeDefInfo.Vec], ['WrapperKeepOpaque<', '>', TypeDefInfo.WrapperKeepOpaque], ['WrapperOpaque<', '>', TypeDefInfo.WrapperOpaque]];
158
+ ['BTreeMap<', '>', TypeDefInfo.BTreeMap, _decodeTuple], ['HashMap<', '>', TypeDefInfo.HashMap, _decodeTuple], ['Int<', '>', TypeDefInfo.Int, _decodeInt], ['Result<', '>', TypeDefInfo.Result, _decodeTuple], ['UInt<', '>', TypeDefInfo.UInt, _decodeUInt], ['DoNotConstruct<', '>', TypeDefInfo.DoNotConstruct, _decodeDoNotConstruct]];
159
+ const wrappedExtraction = [['BTreeSet<', '>', TypeDefInfo.BTreeSet], ['Compact<', '>', TypeDefInfo.Compact], ['Linkage<', '>', TypeDefInfo.Linkage], ['Option<', '>', TypeDefInfo.Option], ['Range<', '>', TypeDefInfo.Range], ['RangeInclusive<', '>', TypeDefInfo.RangeInclusive], ['Vec<', '>', TypeDefInfo.Vec], ['WrapperKeepOpaque<', '>', TypeDefInfo.WrapperKeepOpaque], ['WrapperOpaque<', '>', TypeDefInfo.WrapperOpaque]];
167
160
 
168
161
  function extractSubType(type, [start, end]) {
169
162
  return type.substr(start.length, type.length - start.length - end.length);