@polkadot/types-create 7.2.2-5 → 7.2.2-9

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
@@ -155,6 +155,7 @@ const infoMapping = {
155
155
  (0, _util.assert)(sub && (0, _util.isNumber)(length) && !Array.isArray(sub), 'Expected length & type information for fixed vector');
156
156
  return sub.type === 'u8' ? _typesCodec.U8aFixed.with(length * 8, displayName) : _typesCodec.VecFixed.with(getTypeDefType(sub), length);
157
157
  },
158
+ [_types.TypeDefInfo.WrapperKeepOpaque]: (registry, value) => createWithSub(_typesCodec.WrapperKeepOpaque, value),
158
159
  [_types.TypeDefInfo.WrapperOpaque]: (registry, value) => createWithSub(_typesCodec.WrapperOpaque, value)
159
160
  };
160
161
 
package/create/class.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // Copyright 2017-2022 @polkadot/types-create authors & contributors
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- import { BTreeMap, BTreeSet, Bytes, CodecSet, Compact, DoNotConstruct, Enum, HashMap, Int, Null, Option, Range, RangeInclusive, Result, Struct, Tuple, U8aFixed, UInt, Vec, VecFixed, WrapperOpaque } from '@polkadot/types-codec';
3
+ import { BTreeMap, BTreeSet, Bytes, CodecSet, Compact, DoNotConstruct, Enum, HashMap, Int, Null, Option, Range, RangeInclusive, Result, Struct, Tuple, U8aFixed, UInt, Vec, VecFixed, WrapperKeepOpaque, WrapperOpaque } from '@polkadot/types-codec';
4
4
  import { assert, isNumber, stringify } from '@polkadot/util';
5
5
  import { TypeDefInfo } from "../types.js";
6
6
  import { getTypeDef } from "../util/getTypeDef.js";
@@ -133,6 +133,7 @@ const infoMapping = {
133
133
  assert(sub && isNumber(length) && !Array.isArray(sub), 'Expected length & type information for fixed vector');
134
134
  return sub.type === 'u8' ? U8aFixed.with(length * 8, displayName) : VecFixed.with(getTypeDefType(sub), length);
135
135
  },
136
+ [TypeDefInfo.WrapperKeepOpaque]: (registry, value) => createWithSub(WrapperKeepOpaque, value),
136
137
  [TypeDefInfo.WrapperOpaque]: (registry, value) => createWithSub(WrapperOpaque, value)
137
138
  };
138
139
  export function constructTypeClass(registry, typeDef) {
package/detectOther.cjs CHANGED
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var _packageInfo = require("@polkadot/types-codec/packageInfo");
8
+ var _packageInfo = require("@polkadot/types-codec/packageInfo.cjs");
9
9
 
10
10
  // Copyright 2017-2022 @polkadot/types-create authors & contributors
11
11
  // SPDX-License-Identifier: Apache-2.0
package/detectOther.js CHANGED
@@ -1,4 +1,4 @@
1
1
  // Copyright 2017-2022 @polkadot/types-create authors & contributors
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- import { packageInfo as codecInfo } from '@polkadot/types-codec/packageInfo';
3
+ import { packageInfo as codecInfo } from '@polkadot/types-codec/packageInfo.js';
4
4
  export default [codecInfo];
package/package.json CHANGED
@@ -20,16 +20,10 @@
20
20
  "./detectPackage.cjs"
21
21
  ],
22
22
  "type": "module",
23
- "version": "7.2.2-5",
24
- "main": "index.js",
25
- "dependencies": {
26
- "@babel/runtime": "^7.16.7",
27
- "@polkadot/types-codec": "7.2.2-5",
28
- "@polkadot/util": "^8.2.2"
29
- },
30
- "devDependencies": {
31
- "@polkadot/types": "7.2.2-5"
32
- },
23
+ "version": "7.2.2-9",
24
+ "main": "index.cjs",
25
+ "module": "index.js",
26
+ "types": "index.d.ts",
33
27
  "exports": {
34
28
  ".": {
35
29
  "types": "./index.d.ts",
@@ -67,6 +61,8 @@
67
61
  "default": "./detectPackage.js"
68
62
  },
69
63
  "./package.json": "./package.json",
64
+ "./packageInfo.cjs": "./packageInfo.cjs",
65
+ "./packageInfo.js": "./packageInfo.js",
70
66
  "./packageInfo": {
71
67
  "types": "./packageInfo.d.ts",
72
68
  "require": "./packageInfo.cjs",
@@ -102,5 +98,10 @@
102
98
  "require": "./util/xcm.cjs",
103
99
  "default": "./util/xcm.js"
104
100
  }
101
+ },
102
+ "dependencies": {
103
+ "@babel/runtime": "^7.16.7",
104
+ "@polkadot/types-codec": "7.2.2-9",
105
+ "@polkadot/util": "^8.2.3-30"
105
106
  }
106
107
  }
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.2.2-5'
14
+ version: '7.2.2-9'
15
15
  };
16
16
  exports.packageInfo = packageInfo;
package/packageInfo.js CHANGED
@@ -3,7 +3,7 @@
3
3
  // Do not edit, auto-generated by @polkadot/dev
4
4
  export const packageInfo = {
5
5
  name: '@polkadot/types-create',
6
- path: typeof __dirname === 'string' ? __dirname : 'auto',
6
+ path: new URL('.', import.meta.url).pathname,
7
7
  type: 'esm',
8
- version: '7.2.2-5'
8
+ version: '7.2.2-9'
9
9
  };
package/types.cjs CHANGED
@@ -30,5 +30,6 @@ exports.TypeDefInfo = TypeDefInfo;
30
30
  TypeDefInfo[TypeDefInfo["UInt"] = 17] = "UInt";
31
31
  TypeDefInfo[TypeDefInfo["Vec"] = 18] = "Vec";
32
32
  TypeDefInfo[TypeDefInfo["VecFixed"] = 19] = "VecFixed";
33
- TypeDefInfo[TypeDefInfo["WrapperOpaque"] = 20] = "WrapperOpaque";
33
+ TypeDefInfo[TypeDefInfo["WrapperKeepOpaque"] = 20] = "WrapperKeepOpaque";
34
+ TypeDefInfo[TypeDefInfo["WrapperOpaque"] = 21] = "WrapperOpaque";
34
35
  })(TypeDefInfo || (exports.TypeDefInfo = TypeDefInfo = {}));
package/types.d.ts CHANGED
@@ -21,7 +21,8 @@ export declare enum TypeDefInfo {
21
21
  UInt = 17,
22
22
  Vec = 18,
23
23
  VecFixed = 19,
24
- WrapperOpaque = 20
24
+ WrapperKeepOpaque = 20,
25
+ WrapperOpaque = 21
25
26
  }
26
27
  export interface TypeDef {
27
28
  alias?: Map<string, string>;
package/types.js CHANGED
@@ -23,5 +23,6 @@ export let TypeDefInfo;
23
23
  TypeDefInfo[TypeDefInfo["UInt"] = 17] = "UInt";
24
24
  TypeDefInfo[TypeDefInfo["Vec"] = 18] = "Vec";
25
25
  TypeDefInfo[TypeDefInfo["VecFixed"] = 19] = "VecFixed";
26
- TypeDefInfo[TypeDefInfo["WrapperOpaque"] = 20] = "WrapperOpaque";
26
+ TypeDefInfo[TypeDefInfo["WrapperKeepOpaque"] = 20] = "WrapperKeepOpaque";
27
+ TypeDefInfo[TypeDefInfo["WrapperOpaque"] = 21] = "WrapperOpaque";
27
28
  })(TypeDefInfo || (TypeDefInfo = {}));
@@ -37,6 +37,7 @@ function encodeWithParams(CodecRegistry, typeDef, outer) {
37
37
  case _types.TypeDefInfo.Option:
38
38
  case _types.TypeDefInfo.Result:
39
39
  case _types.TypeDefInfo.Vec:
40
+ case _types.TypeDefInfo.WrapperKeepOpaque:
40
41
  case _types.TypeDefInfo.WrapperOpaque:
41
42
  return paramsNotation(outer, sub, p => encodeTypeDef(CodecRegistry, p));
42
43
  }
@@ -186,6 +187,7 @@ const encoders = {
186
187
  (0, _util.assert)((0, _util.isNumber)(length) && !(0, _util.isUndefined)(sub) && !Array.isArray(sub), 'Unable to encode VecFixed type');
187
188
  return `[${sub.type};${length}]`;
188
189
  },
190
+ [_types.TypeDefInfo.WrapperKeepOpaque]: (CodecRegistry, typeDef) => encodeWithParams(CodecRegistry, typeDef, 'WrapperKeepOpaque'),
189
191
  [_types.TypeDefInfo.WrapperOpaque]: (CodecRegistry, typeDef) => encodeWithParams(CodecRegistry, typeDef, 'WrapperOpaque')
190
192
  };
191
193
 
@@ -25,6 +25,7 @@ function encodeWithParams(CodecRegistry, typeDef, outer) {
25
25
  case TypeDefInfo.Option:
26
26
  case TypeDefInfo.Result:
27
27
  case TypeDefInfo.Vec:
28
+ case TypeDefInfo.WrapperKeepOpaque:
28
29
  case TypeDefInfo.WrapperOpaque:
29
30
  return paramsNotation(outer, sub, p => encodeTypeDef(CodecRegistry, p));
30
31
  }
@@ -139,6 +140,7 @@ const encoders = {
139
140
  assert(isNumber(length) && !isUndefined(sub) && !Array.isArray(sub), 'Unable to encode VecFixed type');
140
141
  return `[${sub.type};${length}]`;
141
142
  },
143
+ [TypeDefInfo.WrapperKeepOpaque]: (CodecRegistry, typeDef) => encodeWithParams(CodecRegistry, typeDef, 'WrapperKeepOpaque'),
142
144
  [TypeDefInfo.WrapperOpaque]: (CodecRegistry, typeDef) => encodeWithParams(CodecRegistry, typeDef, 'WrapperOpaque')
143
145
  };
144
146
 
@@ -187,7 +187,7 @@ function hasWrapper(type, _ref5) {
187
187
  const nestedExtraction = [['[', ']', _types.TypeDefInfo.VecFixed, _decodeFixedVec], ['{', '}', _types.TypeDefInfo.Struct, _decodeStruct], ['(', ')', _types.TypeDefInfo.Tuple, _decodeTuple], // the inner for these are the same as tuple, multiple values
188
188
  ['BTreeMap<', '>', _types.TypeDefInfo.BTreeMap, _decodeTuple], ['HashMap<', '>', _types.TypeDefInfo.HashMap, _decodeTuple], ['Int<', '>', _types.TypeDefInfo.Int, _decodeInt], // Not sure about these, have a specific implementation?
189
189
  ['Range<', '>', _types.TypeDefInfo.Tuple, _decodeRange], ['RangeInclusive<', '>', _types.TypeDefInfo.Tuple, _decodeRange], ['Result<', '>', _types.TypeDefInfo.Result, _decodeTuple], ['UInt<', '>', _types.TypeDefInfo.UInt, _decodeUInt], ['DoNotConstruct<', '>', _types.TypeDefInfo.DoNotConstruct, _decodeDoNotConstruct]];
190
- const wrappedExtraction = [['BTreeSet<', '>', _types.TypeDefInfo.BTreeSet], ['Compact<', '>', _types.TypeDefInfo.Compact], ['Linkage<', '>', _types.TypeDefInfo.Linkage], ['Option<', '>', _types.TypeDefInfo.Option], ['Vec<', '>', _types.TypeDefInfo.Vec], ['WrapperOpaque<', '>', _types.TypeDefInfo.WrapperOpaque]];
190
+ const wrappedExtraction = [['BTreeSet<', '>', _types.TypeDefInfo.BTreeSet], ['Compact<', '>', _types.TypeDefInfo.Compact], ['Linkage<', '>', _types.TypeDefInfo.Linkage], ['Option<', '>', _types.TypeDefInfo.Option], ['Vec<', '>', _types.TypeDefInfo.Vec], ['WrapperKeepOpaque<', '>', _types.TypeDefInfo.WrapperKeepOpaque], ['WrapperOpaque<', '>', _types.TypeDefInfo.WrapperOpaque]];
191
191
 
192
192
  function extractSubType(type, _ref6) {
193
193
  let [start, end] = _ref6;
@@ -163,7 +163,7 @@ function hasWrapper(type, [start, end]) {
163
163
  const nestedExtraction = [['[', ']', TypeDefInfo.VecFixed, _decodeFixedVec], ['{', '}', TypeDefInfo.Struct, _decodeStruct], ['(', ')', TypeDefInfo.Tuple, _decodeTuple], // the inner for these are the same as tuple, multiple values
164
164
  ['BTreeMap<', '>', TypeDefInfo.BTreeMap, _decodeTuple], ['HashMap<', '>', TypeDefInfo.HashMap, _decodeTuple], ['Int<', '>', TypeDefInfo.Int, _decodeInt], // Not sure about these, have a specific implementation?
165
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], ['WrapperOpaque<', '>', TypeDefInfo.WrapperOpaque]];
166
+ const wrappedExtraction = [['BTreeSet<', '>', TypeDefInfo.BTreeSet], ['Compact<', '>', TypeDefInfo.Compact], ['Linkage<', '>', TypeDefInfo.Linkage], ['Option<', '>', TypeDefInfo.Option], ['Vec<', '>', TypeDefInfo.Vec], ['WrapperKeepOpaque<', '>', TypeDefInfo.WrapperKeepOpaque], ['WrapperOpaque<', '>', TypeDefInfo.WrapperOpaque]];
167
167
 
168
168
  function extractSubType(type, [start, end]) {
169
169
  return type.substr(start.length, type.length - start.length - end.length);