@polkadot/types-create 9.14.1 → 10.0.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.
@@ -1,220 +1,196 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getTypeDef = getTypeDef;
7
- var _typesCodec = require("@polkadot/types-codec");
8
- var _util = require("@polkadot/util");
9
- var _types = require("../types");
10
- var _typeSplit = require("./typeSplit");
11
- // Copyright 2017-2023 @polkadot/types-create authors & contributors
12
- // SPDX-License-Identifier: Apache-2.0
13
-
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTypeDef = void 0;
4
+ const types_codec_1 = require("@polkadot/types-codec");
5
+ const util_1 = require("@polkadot/util");
6
+ const types_1 = require("../types");
7
+ const typeSplit_1 = require("./typeSplit");
14
8
  const KNOWN_INTERNALS = ['_alias', '_fallback'];
15
9
  function getTypeString(typeOrObj) {
16
- return (0, _util.isString)(typeOrObj) ? typeOrObj.toString() : JSON.stringify(typeOrObj);
10
+ return (0, util_1.isString)(typeOrObj)
11
+ ? typeOrObj.toString()
12
+ : JSON.stringify(typeOrObj);
17
13
  }
18
14
  function isRustEnum(details) {
19
- const values = Object.values(details);
20
- if (values.some(v => (0, _util.isNumber)(v))) {
21
- if (!values.every(v => (0, _util.isNumber)(v) && v >= 0 && v <= 255)) {
22
- throw new Error('Invalid number-indexed enum definition');
15
+ const values = Object.values(details);
16
+ if (values.some((v) => (0, util_1.isNumber)(v))) {
17
+ if (!values.every((v) => (0, util_1.isNumber)(v) && v >= 0 && v <= 255)) {
18
+ throw new Error('Invalid number-indexed enum definition');
19
+ }
20
+ return false;
23
21
  }
24
- return false;
25
- }
26
- return true;
22
+ return true;
27
23
  }
28
-
29
- // decode an enum of either of the following forms
30
- // { _enum: ['A', 'B', 'C'] }
31
- // { _enum: { A: AccountId, B: Balance, C: u32 } }
32
- // { _enum: { A: 1, B: 2 } }
33
24
  function _decodeEnum(value, details, count, fallbackType) {
34
- value.info = _types.TypeDefInfo.Enum;
35
- value.fallbackType = fallbackType;
36
-
37
- // not as pretty, but remain compatible with oo7 for both struct and Array types
38
- if (Array.isArray(details)) {
39
- value.sub = details.map((name, index) => ({
40
- index,
41
- info: _types.TypeDefInfo.Plain,
42
- name,
43
- type: 'Null'
44
- }));
45
- } else if (isRustEnum(details)) {
46
- value.sub = Object.entries(details).map((_ref, index) => {
47
- let [name, typeOrObj] = _ref;
48
- return (0, _util.objectSpread)({}, getTypeDef(getTypeString(typeOrObj || 'Null'), {
49
- name
50
- }, count), {
51
- index
52
- });
53
- });
54
- } else {
55
- value.sub = Object.entries(details).map(_ref2 => {
56
- let [name, index] = _ref2;
57
- return {
25
+ value.info = types_1.TypeDefInfo.Enum;
26
+ value.fallbackType = fallbackType;
27
+ // not as pretty, but remain compatible with oo7 for both struct and Array types
28
+ if (Array.isArray(details)) {
29
+ value.sub = details.map((name, index) => ({
30
+ index,
31
+ info: types_1.TypeDefInfo.Plain,
32
+ name,
33
+ type: 'Null'
34
+ }));
35
+ }
36
+ else if (isRustEnum(details)) {
37
+ value.sub = Object.entries(details).map(([name, typeOrObj], index) => (0, util_1.objectSpread)({}, getTypeDef(getTypeString(typeOrObj || 'Null'), { name }, count), { index }));
38
+ }
39
+ else {
40
+ value.sub = Object.entries(details).map(([name, index]) => ({
41
+ index,
42
+ info: types_1.TypeDefInfo.Plain,
43
+ name,
44
+ type: 'Null'
45
+ }));
46
+ }
47
+ return value;
48
+ }
49
+ function _decodeSet(value, details, fallbackType) {
50
+ value.info = types_1.TypeDefInfo.Set;
51
+ value.fallbackType = fallbackType;
52
+ value.length = details._bitLength;
53
+ value.sub = Object
54
+ .entries(details)
55
+ .filter(([name]) => !name.startsWith('_'))
56
+ .map(([name, index]) => ({
58
57
  index,
59
- info: _types.TypeDefInfo.Plain,
58
+ info: types_1.TypeDefInfo.Plain,
60
59
  name,
61
60
  type: 'Null'
62
- };
63
- });
64
- }
65
- return value;
66
- }
67
-
68
- // decode a set of the form
69
- // { _set: { A: 0b0001, B: 0b0010, C: 0b0100 } }
70
- function _decodeSet(value, details, fallbackType) {
71
- value.info = _types.TypeDefInfo.Set;
72
- value.fallbackType = fallbackType;
73
- value.length = details._bitLength;
74
- value.sub = Object.entries(details).filter(_ref3 => {
75
- let [name] = _ref3;
76
- return !name.startsWith('_');
77
- }).map(_ref4 => {
78
- let [name, index] = _ref4;
79
- return {
80
- index,
81
- info: _types.TypeDefInfo.Plain,
82
- name,
83
- type: 'Null'
84
- };
85
- });
86
- return value;
61
+ }));
62
+ return value;
87
63
  }
88
-
89
- // decode a struct, set or enum
90
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
91
64
  function _decodeStruct(value, type, _, count) {
92
- const parsed = JSON.parse(type);
93
- const keys = Object.keys(parsed);
94
- if (keys.includes('_enum')) {
95
- return _decodeEnum(value, parsed._enum, count, parsed._fallback);
96
- } else if (keys.includes('_set')) {
97
- return _decodeSet(value, parsed._set, parsed._fallback);
98
- }
99
- value.alias = parsed._alias ? new Map(Object.entries(parsed._alias)) : undefined;
100
- value.fallbackType = parsed._fallback;
101
- value.sub = keys.filter(name => !KNOWN_INTERNALS.includes(name)).map(name => getTypeDef(getTypeString(parsed[name]), {
102
- name
103
- }, count));
104
- return value;
65
+ const parsed = JSON.parse(type);
66
+ const keys = Object.keys(parsed);
67
+ if (keys.includes('_enum')) {
68
+ return _decodeEnum(value, parsed._enum, count, parsed._fallback);
69
+ }
70
+ else if (keys.includes('_set')) {
71
+ return _decodeSet(value, parsed._set, parsed._fallback);
72
+ }
73
+ value.alias = parsed._alias
74
+ ? new Map(Object.entries(parsed._alias))
75
+ : undefined;
76
+ value.fallbackType = parsed._fallback;
77
+ value.sub = keys
78
+ .filter((name) => !KNOWN_INTERNALS.includes(name))
79
+ .map((name) => getTypeDef(getTypeString(parsed[name]), { name }, count));
80
+ return value;
105
81
  }
106
-
107
- // decode a fixed vector, e.g. [u8;32]
108
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
109
82
  function _decodeFixedVec(value, type, _, count) {
110
- const max = type.length - 1;
111
- let index = -1;
112
- let inner = 0;
113
- for (let i = 1; i < max && index === -1; i++) {
114
- switch (type[i]) {
115
- case ';':
116
- {
117
- if (inner === 0) {
118
- index = i;
119
- }
120
- break;
83
+ const max = type.length - 1;
84
+ let index = -1;
85
+ let inner = 0;
86
+ for (let i = 1; (i < max) && (index === -1); i++) {
87
+ switch (type[i]) {
88
+ case ';': {
89
+ if (inner === 0) {
90
+ index = i;
91
+ }
92
+ break;
93
+ }
94
+ case '[':
95
+ case '(':
96
+ case '<':
97
+ inner++;
98
+ break;
99
+ case ']':
100
+ case ')':
101
+ case '>':
102
+ inner--;
103
+ break;
121
104
  }
122
- case '[':
123
- case '(':
124
- case '<':
125
- inner++;
126
- break;
127
- case ']':
128
- case ')':
129
- case '>':
130
- inner--;
131
- break;
132
105
  }
133
- }
134
- if (index === -1) {
135
- throw new Error(`${type}: Unable to extract location of ';'`);
136
- }
137
- const vecType = type.substring(1, index);
138
- const [strLength, displayName] = type.substring(index + 1, max).split(';');
139
- const length = parseInt(strLength.trim(), 10);
140
- if (length > 2048) {
141
- throw new Error(`${type}: Only support for [Type; <length>], where length <= 2048`);
142
- }
143
- value.displayName = displayName;
144
- value.length = length;
145
- value.sub = getTypeDef(vecType, {}, count);
146
- return value;
106
+ if (index === -1) {
107
+ throw new Error(`${type}: Unable to extract location of ';'`);
108
+ }
109
+ const vecType = type.substring(1, index);
110
+ const [strLength, displayName] = type.substring(index + 1, max).split(';');
111
+ const length = parseInt(strLength.trim(), 10);
112
+ if (length > 2048) {
113
+ throw new Error(`${type}: Only support for [Type; <length>], where length <= 2048`);
114
+ }
115
+ value.displayName = displayName;
116
+ value.length = length;
117
+ value.sub = getTypeDef(vecType, {}, count);
118
+ return value;
147
119
  }
148
-
149
- // decode a tuple
150
120
  function _decodeTuple(value, _, subType, count) {
151
- value.sub = subType.length === 0 ? [] : (0, _typeSplit.typeSplit)(subType).map(inner => getTypeDef(inner, {}, count));
152
- return value;
121
+ value.sub = subType.length === 0
122
+ ? []
123
+ : (0, typeSplit_1.typeSplit)(subType).map((inner) => getTypeDef(inner, {}, count));
124
+ return value;
153
125
  }
154
-
155
- // decode a Int/UInt<bitLength[, name]>
156
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
157
126
  function _decodeAnyInt(value, type, _, clazz) {
158
- const [strLength, displayName] = type.substring(clazz.length + 1, type.length - 1).split(',');
159
- const length = parseInt(strLength.trim(), 10);
160
- if (length > 8192 || length % 8) {
161
- throw new Error(`${type}: Only support for ${clazz}<bitLength>, where length <= 8192 and a power of 8, found ${length}`);
162
- }
163
- value.displayName = displayName;
164
- value.length = length;
165
- return value;
127
+ const [strLength, displayName] = type.substring(clazz.length + 1, type.length - 1).split(',');
128
+ const length = parseInt(strLength.trim(), 10);
129
+ if ((length > 8192) || (length % 8)) {
130
+ throw new Error(`${type}: Only support for ${clazz}<bitLength>, where length <= 8192 and a power of 8, found ${length}`);
131
+ }
132
+ value.displayName = displayName;
133
+ value.length = length;
134
+ return value;
166
135
  }
167
136
  function _decodeInt(value, type, subType) {
168
- return _decodeAnyInt(value, type, subType, 'Int');
137
+ return _decodeAnyInt(value, type, subType, 'Int');
169
138
  }
170
139
  function _decodeUInt(value, type, subType) {
171
- return _decodeAnyInt(value, type, subType, 'UInt');
140
+ return _decodeAnyInt(value, type, subType, 'UInt');
172
141
  }
173
-
174
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
175
142
  function _decodeDoNotConstruct(value, type, _) {
176
- const NAME_LENGTH = 'DoNotConstruct'.length;
177
- value.displayName = type.substring(NAME_LENGTH + 1, type.length - 1);
178
- return value;
143
+ const NAME_LENGTH = 'DoNotConstruct'.length;
144
+ value.displayName = type.substring(NAME_LENGTH + 1, type.length - 1);
145
+ return value;
179
146
  }
180
- function hasWrapper(type, _ref5) {
181
- let [start, end] = _ref5;
182
- return type.substring(0, start.length) === start && type.slice(-1 * end.length) === end;
147
+ function hasWrapper(type, [start, end]) {
148
+ return (type.substring(0, start.length) === start) && (type.slice(-1 * end.length) === end);
183
149
  }
184
- const nestedExtraction = [['[', ']', _types.TypeDefInfo.VecFixed, _decodeFixedVec], ['{', '}', _types.TypeDefInfo.Struct, _decodeStruct], ['(', ')', _types.TypeDefInfo.Tuple, _decodeTuple],
185
- // the inner for these are the same as tuple, multiple values
186
- ['BTreeMap<', '>', _types.TypeDefInfo.BTreeMap, _decodeTuple], ['HashMap<', '>', _types.TypeDefInfo.HashMap, _decodeTuple], ['Int<', '>', _types.TypeDefInfo.Int, _decodeInt], ['Result<', '>', _types.TypeDefInfo.Result, _decodeTuple], ['UInt<', '>', _types.TypeDefInfo.UInt, _decodeUInt], ['DoNotConstruct<', '>', _types.TypeDefInfo.DoNotConstruct, _decodeDoNotConstruct]];
187
- const wrappedExtraction = [['BTreeSet<', '>', _types.TypeDefInfo.BTreeSet], ['Compact<', '>', _types.TypeDefInfo.Compact], ['Linkage<', '>', _types.TypeDefInfo.Linkage], ['Opaque<', '>', _types.TypeDefInfo.WrapperOpaque], ['Option<', '>', _types.TypeDefInfo.Option], ['Range<', '>', _types.TypeDefInfo.Range], ['RangeInclusive<', '>', _types.TypeDefInfo.RangeInclusive], ['Vec<', '>', _types.TypeDefInfo.Vec], ['WrapperKeepOpaque<', '>', _types.TypeDefInfo.WrapperKeepOpaque], ['WrapperOpaque<', '>', _types.TypeDefInfo.WrapperOpaque]];
188
- function extractSubType(type, _ref6) {
189
- let [start, end] = _ref6;
190
- return type.substring(start.length, type.length - end.length);
150
+ const nestedExtraction = [
151
+ ['[', ']', types_1.TypeDefInfo.VecFixed, _decodeFixedVec],
152
+ ['{', '}', types_1.TypeDefInfo.Struct, _decodeStruct],
153
+ ['(', ')', types_1.TypeDefInfo.Tuple, _decodeTuple],
154
+ // the inner for these are the same as tuple, multiple values
155
+ ['BTreeMap<', '>', types_1.TypeDefInfo.BTreeMap, _decodeTuple],
156
+ ['HashMap<', '>', types_1.TypeDefInfo.HashMap, _decodeTuple],
157
+ ['Int<', '>', types_1.TypeDefInfo.Int, _decodeInt],
158
+ ['Result<', '>', types_1.TypeDefInfo.Result, _decodeTuple],
159
+ ['UInt<', '>', types_1.TypeDefInfo.UInt, _decodeUInt],
160
+ ['DoNotConstruct<', '>', types_1.TypeDefInfo.DoNotConstruct, _decodeDoNotConstruct]
161
+ ];
162
+ const wrappedExtraction = [
163
+ ['BTreeSet<', '>', types_1.TypeDefInfo.BTreeSet],
164
+ ['Compact<', '>', types_1.TypeDefInfo.Compact],
165
+ ['Linkage<', '>', types_1.TypeDefInfo.Linkage],
166
+ ['Opaque<', '>', types_1.TypeDefInfo.WrapperOpaque],
167
+ ['Option<', '>', types_1.TypeDefInfo.Option],
168
+ ['Range<', '>', types_1.TypeDefInfo.Range],
169
+ ['RangeInclusive<', '>', types_1.TypeDefInfo.RangeInclusive],
170
+ ['Vec<', '>', types_1.TypeDefInfo.Vec],
171
+ ['WrapperKeepOpaque<', '>', types_1.TypeDefInfo.WrapperKeepOpaque],
172
+ ['WrapperOpaque<', '>', types_1.TypeDefInfo.WrapperOpaque]
173
+ ];
174
+ function extractSubType(type, [start, end]) {
175
+ return type.substring(start.length, type.length - end.length);
176
+ }
177
+ function getTypeDef(_type, { displayName, name } = {}, count = 0) {
178
+ // create the type via Type, allowing types to be sanitized
179
+ const type = (0, types_codec_1.sanitize)(_type);
180
+ const value = { displayName, info: types_1.TypeDefInfo.Plain, name, type };
181
+ if (++count > 64) {
182
+ throw new Error('getTypeDef: Maximum nested limit reached');
183
+ }
184
+ const nested = nestedExtraction.find((nested) => hasWrapper(type, nested));
185
+ if (nested) {
186
+ value.info = nested[2];
187
+ return nested[3](value, type, extractSubType(type, nested), count);
188
+ }
189
+ const wrapped = wrappedExtraction.find((wrapped) => hasWrapper(type, wrapped));
190
+ if (wrapped) {
191
+ value.info = wrapped[2];
192
+ value.sub = getTypeDef(extractSubType(type, wrapped), {}, count);
193
+ }
194
+ return value;
191
195
  }
192
- function getTypeDef(_type) {
193
- let {
194
- displayName,
195
- name
196
- } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
197
- let count = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
198
- // create the type via Type, allowing types to be sanitized
199
- const type = (0, _typesCodec.sanitize)(_type);
200
- const value = {
201
- displayName,
202
- info: _types.TypeDefInfo.Plain,
203
- name,
204
- type
205
- };
206
- if (++count > 64) {
207
- throw new Error('getTypeDef: Maximum nested limit reached');
208
- }
209
- const nested = nestedExtraction.find(nested => hasWrapper(type, nested));
210
- if (nested) {
211
- value.info = nested[2];
212
- return nested[3](value, type, extractSubType(type, nested), count);
213
- }
214
- const wrapped = wrappedExtraction.find(wrapped => hasWrapper(type, wrapped));
215
- if (wrapped) {
216
- value.info = wrapped[2];
217
- value.sub = getTypeDef(extractSubType(type, wrapped), {}, count);
218
- }
219
- return value;
220
- }
196
+ exports.getTypeDef = getTypeDef;
package/cjs/util/index.js CHANGED
@@ -1,49 +1,7 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _encodeTypes = require("./encodeTypes");
7
- Object.keys(_encodeTypes).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _encodeTypes[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _encodeTypes[key];
14
- }
15
- });
16
- });
17
- var _getTypeDef = require("./getTypeDef");
18
- Object.keys(_getTypeDef).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _getTypeDef[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function () {
24
- return _getTypeDef[key];
25
- }
26
- });
27
- });
28
- var _typeSplit = require("./typeSplit");
29
- Object.keys(_typeSplit).forEach(function (key) {
30
- if (key === "default" || key === "__esModule") return;
31
- if (key in exports && exports[key] === _typeSplit[key]) return;
32
- Object.defineProperty(exports, key, {
33
- enumerable: true,
34
- get: function () {
35
- return _typeSplit[key];
36
- }
37
- });
38
- });
39
- var _xcm = require("./xcm");
40
- Object.keys(_xcm).forEach(function (key) {
41
- if (key === "default" || key === "__esModule") return;
42
- if (key in exports && exports[key] === _xcm[key]) return;
43
- Object.defineProperty(exports, key, {
44
- enumerable: true,
45
- get: function () {
46
- return _xcm[key];
47
- }
48
- });
49
- });
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./encodeTypes"), exports);
5
+ tslib_1.__exportStar(require("./getTypeDef"), exports);
6
+ tslib_1.__exportStar(require("./typeSplit"), exports);
7
+ tslib_1.__exportStar(require("./xcm"), exports);
@@ -1,76 +1,61 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.typeSplit = typeSplit;
7
- // Copyright 2017-2023 @polkadot/types-create authors & contributors
8
- // SPDX-License-Identifier: Apache-2.0
9
-
10
- // safely split a string on ', ' while taking care of any nested occurences
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.typeSplit = void 0;
11
4
  function typeSplit(type) {
12
- const result = [];
13
-
14
- // these are the depths of the various tokens: <, [, {, (
15
- let c = 0;
16
- let f = 0;
17
- let s = 0;
18
- let t = 0;
19
-
20
- // current start position
21
- let start = 0;
22
- for (let i = 0; i < type.length; i++) {
23
- switch (type[i]) {
24
- // if we are not nested, add the type
25
- case ',':
26
- {
27
- if (!(c || f || s || t)) {
28
- result.push(type.substring(start, i).trim());
29
- start = i + 1;
30
- }
31
- break;
5
+ const result = [];
6
+ // these are the depths of the various tokens: <, [, {, (
7
+ let c = 0;
8
+ let f = 0;
9
+ let s = 0;
10
+ let t = 0;
11
+ // current start position
12
+ let start = 0;
13
+ for (let i = 0; i < type.length; i++) {
14
+ switch (type[i]) {
15
+ // if we are not nested, add the type
16
+ case ',': {
17
+ if (!(c || f || s || t)) {
18
+ result.push(type.substring(start, i).trim());
19
+ start = i + 1;
20
+ }
21
+ break;
22
+ }
23
+ // adjust compact/vec (and friends) depth
24
+ case '<':
25
+ c++;
26
+ break;
27
+ case '>':
28
+ c--;
29
+ break;
30
+ // adjust fixed vec depths
31
+ case '[':
32
+ f++;
33
+ break;
34
+ case ']':
35
+ f--;
36
+ break;
37
+ // adjust struct depth
38
+ case '{':
39
+ s++;
40
+ break;
41
+ case '}':
42
+ s--;
43
+ break;
44
+ // adjust tuple depth
45
+ case '(':
46
+ t++;
47
+ break;
48
+ case ')':
49
+ t--;
50
+ break;
32
51
  }
33
-
34
- // adjust compact/vec (and friends) depth
35
- case '<':
36
- c++;
37
- break;
38
- case '>':
39
- c--;
40
- break;
41
-
42
- // adjust fixed vec depths
43
- case '[':
44
- f++;
45
- break;
46
- case ']':
47
- f--;
48
- break;
49
-
50
- // adjust struct depth
51
- case '{':
52
- s++;
53
- break;
54
- case '}':
55
- s--;
56
- break;
57
-
58
- // adjust tuple depth
59
- case '(':
60
- t++;
61
- break;
62
- case ')':
63
- t--;
64
- break;
65
52
  }
66
- }
67
-
68
- // ensure we have all the terminators taken care of
69
- if (c || f || s || t) {
70
- throw new Error(`Invalid definition (missing terminators) found in ${type}`);
71
- }
72
-
73
- // the final leg of the journey
74
- result.push(type.substring(start, type.length).trim());
75
- return result;
76
- }
53
+ // ensure we have all the terminators taken care of
54
+ if (c || f || s || t) {
55
+ throw new Error(`Invalid definition (missing terminators) found in ${type}`);
56
+ }
57
+ // the final leg of the journey
58
+ result.push(type.substring(start, type.length).trim());
59
+ return result;
60
+ }
61
+ exports.typeSplit = typeSplit;
package/cjs/util/xcm.js CHANGED
@@ -1,18 +1,9 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.XCM_MAPPINGS = void 0;
7
- exports.mapXcmTypes = mapXcmTypes;
8
- var _util = require("@polkadot/util");
9
- // Copyright 2017-2023 @polkadot/types-create authors & contributors
10
- // SPDX-License-Identifier: Apache-2.0
11
-
12
- const XCM_MAPPINGS = ['AssetInstance', 'Fungibility', 'Junction', 'Junctions', 'MultiAsset', 'MultiAssetFilter', 'MultiLocation', 'Response', 'WildFungibility', 'WildMultiAsset', 'Xcm', 'XcmError', 'XcmOrder'];
13
- exports.XCM_MAPPINGS = XCM_MAPPINGS;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mapXcmTypes = exports.XCM_MAPPINGS = void 0;
4
+ const util_1 = require("@polkadot/util");
5
+ exports.XCM_MAPPINGS = ['AssetInstance', 'Fungibility', 'Junction', 'Junctions', 'MultiAsset', 'MultiAssetFilter', 'MultiLocation', 'Response', 'WildFungibility', 'WildMultiAsset', 'Xcm', 'XcmError', 'XcmOrder'];
14
6
  function mapXcmTypes(version) {
15
- return XCM_MAPPINGS.reduce((all, key) => (0, _util.objectSpread)(all, {
16
- [key]: `${key}${version}`
17
- }), {});
18
- }
7
+ return exports.XCM_MAPPINGS.reduce((all, key) => (0, util_1.objectSpread)(all, { [key]: `${key}${version}` }), {});
8
+ }
9
+ exports.mapXcmTypes = mapXcmTypes;