@polkadot/types-create 8.3.3-4 → 8.3.3-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/cjs/packageInfo.js +1 -1
- package/cjs/util/getTypeDef.js +6 -6
- package/cjs/util/typeSplit.js +2 -2
- package/package.json +2 -2
- package/packageInfo.js +1 -1
- package/util/getTypeDef.js +6 -6
- package/util/typeSplit.js +2 -2
package/cjs/packageInfo.js
CHANGED
package/cjs/util/getTypeDef.js
CHANGED
|
@@ -131,8 +131,8 @@ function _decodeFixedVec(value, type, _, count) {
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
(0, _util.assert)(index !== -1, () => `${type}: Unable to extract location of ';'`);
|
|
134
|
-
const vecType = type.
|
|
135
|
-
const [strLength, displayName] = type.
|
|
134
|
+
const vecType = type.substring(1, index);
|
|
135
|
+
const [strLength, displayName] = type.substring(index + 1, max).split(';');
|
|
136
136
|
const length = parseInt(strLength.trim(), 10); // as a first round, only u8 via u8aFixed, we can add more support
|
|
137
137
|
|
|
138
138
|
(0, _util.assert)(length <= 256, () => `${type}: Only support for [Type; <length>], where length <= 256`);
|
|
@@ -151,7 +151,7 @@ function _decodeTuple(value, _, subType, count) {
|
|
|
151
151
|
|
|
152
152
|
|
|
153
153
|
function _decodeAnyInt(value, type, _, clazz) {
|
|
154
|
-
const [strLength, displayName] = type.
|
|
154
|
+
const [strLength, displayName] = type.substring(clazz.length + 1, type.length - 1).split(',');
|
|
155
155
|
const length = parseInt(strLength.trim(), 10); // as a first round, only u8 via u8aFixed, we can add more support
|
|
156
156
|
|
|
157
157
|
(0, _util.assert)(length <= 8192 && length % 8 === 0, () => `${type}: Only support for ${clazz}<bitLength>, where length <= 8192 and a power of 8, found ${length}`);
|
|
@@ -171,13 +171,13 @@ function _decodeUInt(value, type, subType) {
|
|
|
171
171
|
|
|
172
172
|
function _decodeDoNotConstruct(value, type, _) {
|
|
173
173
|
const NAME_LENGTH = 'DoNotConstruct'.length;
|
|
174
|
-
value.displayName = type.
|
|
174
|
+
value.displayName = type.substring(NAME_LENGTH + 1, type.length - 1);
|
|
175
175
|
return value;
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
function hasWrapper(type, _ref5) {
|
|
179
179
|
let [start, end] = _ref5;
|
|
180
|
-
return type.
|
|
180
|
+
return type.substring(0, start.length) === start && type.slice(-1 * end.length) === end;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
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
|
|
@@ -186,7 +186,7 @@ const wrappedExtraction = [['BTreeSet<', '>', _types.TypeDefInfo.BTreeSet], ['Co
|
|
|
186
186
|
|
|
187
187
|
function extractSubType(type, _ref6) {
|
|
188
188
|
let [start, end] = _ref6;
|
|
189
|
-
return type.
|
|
189
|
+
return type.substring(start.length, type.length - end.length);
|
|
190
190
|
} // eslint-disable-next-line @typescript-eslint/ban-types
|
|
191
191
|
|
|
192
192
|
|
package/cjs/util/typeSplit.js
CHANGED
|
@@ -24,7 +24,7 @@ function typeSplit(type) {
|
|
|
24
24
|
|
|
25
25
|
const extract = index => {
|
|
26
26
|
if (isNotNested(cDepth, fDepth, sDepth, tDepth)) {
|
|
27
|
-
result.push(type.
|
|
27
|
+
result.push(type.substring(start, index).trim());
|
|
28
28
|
start = index + 1;
|
|
29
29
|
}
|
|
30
30
|
};
|
|
@@ -76,6 +76,6 @@ function typeSplit(type) {
|
|
|
76
76
|
|
|
77
77
|
(0, _util.assert)(isNotNested(cDepth, fDepth, sDepth, tDepth), () => `Invalid definition (missing terminators) found in ${type}`); // the final leg of the journey
|
|
78
78
|
|
|
79
|
-
result.push(type.
|
|
79
|
+
result.push(type.substring(start, type.length).trim());
|
|
80
80
|
return result;
|
|
81
81
|
}
|
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"./cjs/detectPackage.js"
|
|
21
21
|
],
|
|
22
22
|
"type": "module",
|
|
23
|
-
"version": "8.3.3-
|
|
23
|
+
"version": "8.3.3-7",
|
|
24
24
|
"main": "./cjs/index.js",
|
|
25
25
|
"module": "./index.js",
|
|
26
26
|
"types": "./index.d.ts",
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
},
|
|
122
122
|
"dependencies": {
|
|
123
123
|
"@babel/runtime": "^7.17.9",
|
|
124
|
-
"@polkadot/types-codec": "8.3.3-
|
|
124
|
+
"@polkadot/types-codec": "8.3.3-7",
|
|
125
125
|
"@polkadot/util": "^9.1.1"
|
|
126
126
|
}
|
|
127
127
|
}
|
package/packageInfo.js
CHANGED
|
@@ -5,5 +5,5 @@ export const packageInfo = {
|
|
|
5
5
|
name: '@polkadot/types-create',
|
|
6
6
|
path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
|
|
7
7
|
type: 'esm',
|
|
8
|
-
version: '8.3.3-
|
|
8
|
+
version: '8.3.3-7'
|
|
9
9
|
};
|
package/util/getTypeDef.js
CHANGED
|
@@ -108,8 +108,8 @@ function _decodeFixedVec(value, type, _, count) {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
assert(index !== -1, () => `${type}: Unable to extract location of ';'`);
|
|
111
|
-
const vecType = type.
|
|
112
|
-
const [strLength, displayName] = type.
|
|
111
|
+
const vecType = type.substring(1, index);
|
|
112
|
+
const [strLength, displayName] = type.substring(index + 1, max).split(';');
|
|
113
113
|
const length = parseInt(strLength.trim(), 10); // as a first round, only u8 via u8aFixed, we can add more support
|
|
114
114
|
|
|
115
115
|
assert(length <= 256, () => `${type}: Only support for [Type; <length>], where length <= 256`);
|
|
@@ -128,7 +128,7 @@ function _decodeTuple(value, _, subType, count) {
|
|
|
128
128
|
|
|
129
129
|
|
|
130
130
|
function _decodeAnyInt(value, type, _, clazz) {
|
|
131
|
-
const [strLength, displayName] = type.
|
|
131
|
+
const [strLength, displayName] = type.substring(clazz.length + 1, type.length - 1).split(',');
|
|
132
132
|
const length = parseInt(strLength.trim(), 10); // as a first round, only u8 via u8aFixed, we can add more support
|
|
133
133
|
|
|
134
134
|
assert(length <= 8192 && length % 8 === 0, () => `${type}: Only support for ${clazz}<bitLength>, where length <= 8192 and a power of 8, found ${length}`);
|
|
@@ -148,12 +148,12 @@ function _decodeUInt(value, type, subType) {
|
|
|
148
148
|
|
|
149
149
|
function _decodeDoNotConstruct(value, type, _) {
|
|
150
150
|
const NAME_LENGTH = 'DoNotConstruct'.length;
|
|
151
|
-
value.displayName = type.
|
|
151
|
+
value.displayName = type.substring(NAME_LENGTH + 1, type.length - 1);
|
|
152
152
|
return value;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
function hasWrapper(type, [start, end]) {
|
|
156
|
-
return type.
|
|
156
|
+
return type.substring(0, start.length) === start && type.slice(-1 * end.length) === end;
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
const nestedExtraction = [['[', ']', TypeDefInfo.VecFixed, _decodeFixedVec], ['{', '}', TypeDefInfo.Struct, _decodeStruct], ['(', ')', TypeDefInfo.Tuple, _decodeTuple], // the inner for these are the same as tuple, multiple values
|
|
@@ -161,7 +161,7 @@ const nestedExtraction = [['[', ']', TypeDefInfo.VecFixed, _decodeFixedVec], ['{
|
|
|
161
161
|
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]];
|
|
162
162
|
|
|
163
163
|
function extractSubType(type, [start, end]) {
|
|
164
|
-
return type.
|
|
164
|
+
return type.substring(start.length, type.length - end.length);
|
|
165
165
|
} // eslint-disable-next-line @typescript-eslint/ban-types
|
|
166
166
|
|
|
167
167
|
|
package/util/typeSplit.js
CHANGED
|
@@ -13,7 +13,7 @@ export function typeSplit(type) {
|
|
|
13
13
|
|
|
14
14
|
const extract = index => {
|
|
15
15
|
if (isNotNested(cDepth, fDepth, sDepth, tDepth)) {
|
|
16
|
-
result.push(type.
|
|
16
|
+
result.push(type.substring(start, index).trim());
|
|
17
17
|
start = index + 1;
|
|
18
18
|
}
|
|
19
19
|
};
|
|
@@ -65,6 +65,6 @@ export function typeSplit(type) {
|
|
|
65
65
|
|
|
66
66
|
assert(isNotNested(cDepth, fDepth, sDepth, tDepth), () => `Invalid definition (missing terminators) found in ${type}`); // the final leg of the journey
|
|
67
67
|
|
|
68
|
-
result.push(type.
|
|
68
|
+
result.push(type.substring(start, type.length).trim());
|
|
69
69
|
return result;
|
|
70
70
|
}
|