@polkadot/types-codec 8.5.2-7 → 8.5.2-8
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/abstract/AbstractArray.js +2 -2
- package/base/Enum.js +2 -2
- package/base/Tuple.js +2 -2
- package/base/Vec.js +4 -4
- package/base/VecFixed.js +2 -2
- package/cjs/abstract/AbstractArray.js +1 -1
- package/cjs/base/Enum.js +1 -1
- package/cjs/base/Tuple.js +1 -1
- package/cjs/base/Vec.js +3 -3
- package/cjs/base/VecFixed.js +1 -1
- package/cjs/extended/BTreeSet.js +2 -3
- package/cjs/extended/BitVec.js +4 -4
- package/cjs/extended/Bytes.js +3 -3
- package/cjs/extended/Map.js +2 -3
- package/cjs/native/Struct.js +1 -1
- package/cjs/native/Text.js +3 -3
- package/cjs/packageInfo.js +1 -1
- package/extended/BTreeSet.js +3 -4
- package/extended/BitVec.js +5 -5
- package/extended/Bytes.js +4 -4
- package/extended/Map.js +3 -4
- package/native/Struct.js +2 -2
- package/native/Text.js +4 -4
- package/package.json +2 -2
- package/packageInfo.js +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { compactToU8a,
|
|
3
|
+
import { compactToU8a, u8aConcatStrict, u8aToHex } from '@polkadot/util';
|
|
4
4
|
import { compareArray } from "../utils/compareArray.js";
|
|
5
5
|
/**
|
|
6
6
|
* @name AbstractArray
|
|
@@ -154,7 +154,7 @@ export class AbstractArray extends Array {
|
|
|
154
154
|
|
|
155
155
|
toU8a(isBare) {
|
|
156
156
|
const encoded = this.toU8aInner();
|
|
157
|
-
return isBare ?
|
|
157
|
+
return isBare ? u8aConcatStrict(encoded) : u8aConcatStrict([compactToU8a(this.length), ...encoded]);
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
toU8aInner(isBare) {
|
package/base/Enum.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { assert, isCodec, isHex, isNumber, isObject, isString, isU8a, isUndefined, objectProperties, stringCamelCase, stringify, stringPascalCase,
|
|
3
|
+
import { assert, isCodec, isHex, isNumber, isObject, isString, isU8a, isUndefined, objectProperties, stringCamelCase, stringify, stringPascalCase, u8aConcatStrict, u8aToHex, u8aToU8a } from '@polkadot/util';
|
|
4
4
|
import { mapToTypeMap, typesToMap } from "../utils/index.js";
|
|
5
5
|
import { Null } from "./Null.js"; // export interface, this is used in Enum.with, so required as public by TS
|
|
6
6
|
|
|
@@ -416,7 +416,7 @@ export class Enum {
|
|
|
416
416
|
|
|
417
417
|
|
|
418
418
|
toU8a(isBare) {
|
|
419
|
-
return
|
|
419
|
+
return isBare ? this.#raw.toU8a(isBare) : u8aConcatStrict([new Uint8Array([this.index]), this.#raw.toU8a(isBare)]);
|
|
420
420
|
}
|
|
421
421
|
|
|
422
422
|
}
|
package/base/Tuple.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { isFunction, isHex, isString, isU8a, stringify,
|
|
3
|
+
import { isFunction, isHex, isString, isU8a, stringify, u8aConcatStrict, u8aToU8a } from '@polkadot/util';
|
|
4
4
|
import { AbstractArray } from "../abstract/AbstractArray.js";
|
|
5
5
|
import { decodeU8a, mapToTypeMap, typeToConstructor } from "../utils/index.js";
|
|
6
6
|
|
|
@@ -122,7 +122,7 @@ export class Tuple extends AbstractArray {
|
|
|
122
122
|
|
|
123
123
|
|
|
124
124
|
toU8a(isBare) {
|
|
125
|
-
return
|
|
125
|
+
return u8aConcatStrict(this.toU8aInner(isBare));
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
}
|
package/base/Vec.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { assert,
|
|
3
|
+
import { assert, compactFromU8aLim, isU8a, logger, u8aToU8a } from '@polkadot/util';
|
|
4
4
|
import { AbstractArray } from "../abstract/AbstractArray.js";
|
|
5
5
|
import { decodeU8aVec, typeToConstructor } from "../utils/index.js";
|
|
6
6
|
const MAX_LENGTH = 64 * 1024;
|
|
@@ -16,9 +16,9 @@ function decodeVecLength(value) {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
const u8a = u8aToU8a(value);
|
|
19
|
-
const [startAt, length] =
|
|
20
|
-
assert(length
|
|
21
|
-
return [u8a, length
|
|
19
|
+
const [startAt, length] = compactFromU8aLim(u8a);
|
|
20
|
+
assert(length <= MAX_LENGTH, () => `Vec length ${length.toString()} exceeds ${MAX_LENGTH}`);
|
|
21
|
+
return [u8a, length, startAt];
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export function decodeVec(registry, result, value, startAt, Type) {
|
package/base/VecFixed.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { isU8a,
|
|
3
|
+
import { isU8a, u8aConcatStrict } from '@polkadot/util';
|
|
4
4
|
import { AbstractArray } from "../abstract/AbstractArray.js";
|
|
5
5
|
import { decodeU8aVec, typeToConstructor } from "../utils/index.js";
|
|
6
6
|
import { decodeVec } from "./Vec.js";
|
|
@@ -80,7 +80,7 @@ export class VecFixed extends AbstractArray {
|
|
|
80
80
|
// we override, we don't add the length prefix for ourselves, and at the same time we
|
|
81
81
|
// ignore isBare on entries, since they should be properly encoded at all times
|
|
82
82
|
const encoded = this.toU8aInner();
|
|
83
|
-
return encoded.length ?
|
|
83
|
+
return encoded.length ? u8aConcatStrict(encoded) : new Uint8Array([]);
|
|
84
84
|
}
|
|
85
85
|
/**
|
|
86
86
|
* @description Returns the base runtime type name for this instance
|
|
@@ -163,7 +163,7 @@ class AbstractArray extends Array {
|
|
|
163
163
|
|
|
164
164
|
toU8a(isBare) {
|
|
165
165
|
const encoded = this.toU8aInner();
|
|
166
|
-
return isBare ? (0, _util.
|
|
166
|
+
return isBare ? (0, _util.u8aConcatStrict)(encoded) : (0, _util.u8aConcatStrict)([(0, _util.compactToU8a)(this.length), ...encoded]);
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
toU8aInner(isBare) {
|
package/cjs/base/Enum.js
CHANGED
|
@@ -435,7 +435,7 @@ class Enum {
|
|
|
435
435
|
|
|
436
436
|
|
|
437
437
|
toU8a(isBare) {
|
|
438
|
-
return (0, _util.
|
|
438
|
+
return isBare ? this.#raw.toU8a(isBare) : (0, _util.u8aConcatStrict)([new Uint8Array([this.index]), this.#raw.toU8a(isBare)]);
|
|
439
439
|
}
|
|
440
440
|
|
|
441
441
|
}
|
package/cjs/base/Tuple.js
CHANGED
package/cjs/base/Vec.js
CHANGED
|
@@ -27,9 +27,9 @@ function decodeVecLength(value) {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
const u8a = (0, _util.u8aToU8a)(value);
|
|
30
|
-
const [startAt, length] = (0, _util.
|
|
31
|
-
(0, _util.assert)(length
|
|
32
|
-
return [u8a, length
|
|
30
|
+
const [startAt, length] = (0, _util.compactFromU8aLim)(u8a);
|
|
31
|
+
(0, _util.assert)(length <= MAX_LENGTH, () => `Vec length ${length.toString()} exceeds ${MAX_LENGTH}`);
|
|
32
|
+
return [u8a, length, startAt];
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
function decodeVec(registry, result, value, startAt, Type) {
|
package/cjs/base/VecFixed.js
CHANGED
|
@@ -92,7 +92,7 @@ class VecFixed extends _AbstractArray.AbstractArray {
|
|
|
92
92
|
// we override, we don't add the length prefix for ourselves, and at the same time we
|
|
93
93
|
// ignore isBare on entries, since they should be properly encoded at all times
|
|
94
94
|
const encoded = this.toU8aInner();
|
|
95
|
-
return encoded.length ? (0, _util.
|
|
95
|
+
return encoded.length ? (0, _util.u8aConcatStrict)(encoded) : new Uint8Array([]);
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
98
98
|
* @description Returns the base runtime type name for this instance
|
package/cjs/extended/BTreeSet.js
CHANGED
|
@@ -16,8 +16,7 @@ const l = (0, _util.logger)('BTreeSet');
|
|
|
16
16
|
|
|
17
17
|
function decodeSetFromU8a(registry, ValClass, u8a) {
|
|
18
18
|
const output = new Set();
|
|
19
|
-
const [offset,
|
|
20
|
-
const count = length.toNumber();
|
|
19
|
+
const [offset, count] = (0, _util.compactFromU8aLim)(u8a);
|
|
21
20
|
const result = new Array(count);
|
|
22
21
|
const [decodedLength] = (0, _utils.decodeU8aVec)(registry, result, u8a, offset, ValClass);
|
|
23
22
|
|
|
@@ -223,7 +222,7 @@ class BTreeSet extends Set {
|
|
|
223
222
|
encoded.push(v.toU8a(isBare));
|
|
224
223
|
}
|
|
225
224
|
|
|
226
|
-
return (0, _util.
|
|
225
|
+
return (0, _util.u8aConcatStrict)(encoded);
|
|
227
226
|
}
|
|
228
227
|
|
|
229
228
|
}
|
package/cjs/extended/BitVec.js
CHANGED
|
@@ -19,10 +19,10 @@ function decodeBitVecU8a(value) {
|
|
|
19
19
|
} // handle all other Uint8Array inputs, these do have a length prefix which is the number of bits encoded
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
const [offset, length] = (0, _util.
|
|
23
|
-
const total = offset + Math.ceil(length
|
|
22
|
+
const [offset, length] = (0, _util.compactFromU8aLim)(value);
|
|
23
|
+
const total = offset + Math.ceil(length / 8);
|
|
24
24
|
(0, _util.assert)(total <= value.length, () => `BitVec: required length less than remainder, expected at least ${total}, found ${value.length}`);
|
|
25
|
-
return [length
|
|
25
|
+
return [length, value.subarray(offset, total)];
|
|
26
26
|
}
|
|
27
27
|
/** @internal */
|
|
28
28
|
|
|
@@ -94,7 +94,7 @@ class BitVec extends _Raw.Raw {
|
|
|
94
94
|
|
|
95
95
|
toU8a(isBare) {
|
|
96
96
|
const bitVec = super.toU8a();
|
|
97
|
-
return isBare ? bitVec : (0, _util.
|
|
97
|
+
return isBare ? bitVec : (0, _util.u8aConcatStrict)([(0, _util.compactToU8a)(this.#decodedLength), bitVec]);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
}
|
package/cjs/extended/Bytes.js
CHANGED
|
@@ -21,9 +21,9 @@ function decodeBytesU8a(value) {
|
|
|
21
21
|
} // handle all other Uint8Array inputs, these do have a length prefix
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
const [offset, length] = (0, _util.
|
|
25
|
-
const total = offset + length
|
|
26
|
-
(0, _util.assert)(length
|
|
24
|
+
const [offset, length] = (0, _util.compactFromU8aLim)(value);
|
|
25
|
+
const total = offset + length;
|
|
26
|
+
(0, _util.assert)(length <= MAX_LENGTH, () => `Bytes length ${length.toString()} exceeds ${MAX_LENGTH}`);
|
|
27
27
|
(0, _util.assert)(total <= value.length, () => `Bytes: required length less than remainder, expected at least ${total}, found ${value.length}`);
|
|
28
28
|
return [value.subarray(offset, total), total];
|
|
29
29
|
}
|
package/cjs/extended/Map.js
CHANGED
|
@@ -22,8 +22,7 @@ const l = (0, _util.logger)('Map');
|
|
|
22
22
|
|
|
23
23
|
function decodeMapFromU8a(registry, KeyClass, ValClass, u8a) {
|
|
24
24
|
const output = new Map();
|
|
25
|
-
const [offset,
|
|
26
|
-
const count = length.toNumber();
|
|
25
|
+
const [offset, count] = (0, _util.compactFromU8aLim)(u8a);
|
|
27
26
|
const types = [];
|
|
28
27
|
|
|
29
28
|
for (let i = 0; i < count; i++) {
|
|
@@ -231,7 +230,7 @@ class CodecMap extends Map {
|
|
|
231
230
|
encoded.push(k.toU8a(isBare), v.toU8a(isBare));
|
|
232
231
|
}
|
|
233
232
|
|
|
234
|
-
return (0, _util.
|
|
233
|
+
return (0, _util.u8aConcatStrict)(encoded);
|
|
235
234
|
}
|
|
236
235
|
|
|
237
236
|
}
|
package/cjs/native/Struct.js
CHANGED
package/cjs/native/Text.js
CHANGED
|
@@ -26,9 +26,9 @@ function decodeText(value) {
|
|
|
26
26
|
return [(0, _util.u8aToString)(value), 0];
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
const [offset, length] = (0, _util.
|
|
30
|
-
const total = offset + length
|
|
31
|
-
(0, _util.assert)(length
|
|
29
|
+
const [offset, length] = (0, _util.compactFromU8aLim)(value);
|
|
30
|
+
const total = offset + length;
|
|
31
|
+
(0, _util.assert)(length <= MAX_LENGTH, () => `Text: length ${length.toString()} exceeds ${MAX_LENGTH}`);
|
|
32
32
|
(0, _util.assert)(total <= value.length, () => `Text: required length less than remainder, expected at least ${total}, found ${value.length}`);
|
|
33
33
|
return [(0, _util.u8aToString)(value.subarray(offset, total)), total];
|
|
34
34
|
} else if ((0, _util.isHex)(value)) {
|
package/cjs/packageInfo.js
CHANGED
package/extended/BTreeSet.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import {
|
|
3
|
+
import { compactFromU8aLim, compactToU8a, isHex, isU8a, logger, stringify, u8aConcatStrict, u8aToHex, u8aToU8a } from '@polkadot/util';
|
|
4
4
|
import { compareSet, decodeU8aVec, sortSet, typeToConstructor } from "../utils/index.js";
|
|
5
5
|
const l = logger('BTreeSet');
|
|
6
6
|
/** @internal */
|
|
7
7
|
|
|
8
8
|
function decodeSetFromU8a(registry, ValClass, u8a) {
|
|
9
9
|
const output = new Set();
|
|
10
|
-
const [offset,
|
|
11
|
-
const count = length.toNumber();
|
|
10
|
+
const [offset, count] = compactFromU8aLim(u8a);
|
|
12
11
|
const result = new Array(count);
|
|
13
12
|
const [decodedLength] = decodeU8aVec(registry, result, u8a, offset, ValClass);
|
|
14
13
|
|
|
@@ -214,7 +213,7 @@ export class BTreeSet extends Set {
|
|
|
214
213
|
encoded.push(v.toU8a(isBare));
|
|
215
214
|
}
|
|
216
215
|
|
|
217
|
-
return
|
|
216
|
+
return u8aConcatStrict(encoded);
|
|
218
217
|
}
|
|
219
218
|
|
|
220
219
|
}
|
package/extended/BitVec.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { assert,
|
|
3
|
+
import { assert, compactFromU8aLim, compactToU8a, isString, u8aConcatStrict, u8aToU8a } from '@polkadot/util';
|
|
4
4
|
import { Raw } from "../native/Raw.js";
|
|
5
5
|
/** @internal */
|
|
6
6
|
|
|
@@ -10,10 +10,10 @@ function decodeBitVecU8a(value) {
|
|
|
10
10
|
} // handle all other Uint8Array inputs, these do have a length prefix which is the number of bits encoded
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
const [offset, length] =
|
|
14
|
-
const total = offset + Math.ceil(length
|
|
13
|
+
const [offset, length] = compactFromU8aLim(value);
|
|
14
|
+
const total = offset + Math.ceil(length / 8);
|
|
15
15
|
assert(total <= value.length, () => `BitVec: required length less than remainder, expected at least ${total}, found ${value.length}`);
|
|
16
|
-
return [length
|
|
16
|
+
return [length, value.subarray(offset, total)];
|
|
17
17
|
}
|
|
18
18
|
/** @internal */
|
|
19
19
|
|
|
@@ -84,7 +84,7 @@ export class BitVec extends Raw {
|
|
|
84
84
|
|
|
85
85
|
toU8a(isBare) {
|
|
86
86
|
const bitVec = super.toU8a();
|
|
87
|
-
return isBare ? bitVec :
|
|
87
|
+
return isBare ? bitVec : u8aConcatStrict([compactToU8a(this.#decodedLength), bitVec]);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
}
|
package/extended/Bytes.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { assert, compactAddLength,
|
|
3
|
+
import { assert, compactAddLength, compactFromU8aLim, compactToU8a, isCodec, isString, isU8a, u8aToU8a } from '@polkadot/util';
|
|
4
4
|
import { Raw } from "../native/Raw.js"; // Bytes are used for things like on-chain code, so it has a healthy limit
|
|
5
5
|
|
|
6
6
|
const MAX_LENGTH = 10 * 1024 * 1024;
|
|
@@ -12,9 +12,9 @@ function decodeBytesU8a(value) {
|
|
|
12
12
|
} // handle all other Uint8Array inputs, these do have a length prefix
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
const [offset, length] =
|
|
16
|
-
const total = offset + length
|
|
17
|
-
assert(length
|
|
15
|
+
const [offset, length] = compactFromU8aLim(value);
|
|
16
|
+
const total = offset + length;
|
|
17
|
+
assert(length <= MAX_LENGTH, () => `Bytes length ${length.toString()} exceeds ${MAX_LENGTH}`);
|
|
18
18
|
assert(total <= value.length, () => `Bytes: required length less than remainder, expected at least ${total}, found ${value.length}`);
|
|
19
19
|
return [value.subarray(offset, total), total];
|
|
20
20
|
}
|
package/extended/Map.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import {
|
|
3
|
+
import { compactFromU8aLim, compactToU8a, isHex, isObject, isU8a, logger, stringify, u8aConcatStrict, u8aToHex, u8aToU8a } from '@polkadot/util';
|
|
4
4
|
import { AbstractArray } from "../abstract/AbstractArray.js";
|
|
5
5
|
import { Enum } from "../base/Enum.js";
|
|
6
6
|
import { Struct } from "../native/Struct.js";
|
|
@@ -10,8 +10,7 @@ const l = logger('Map');
|
|
|
10
10
|
|
|
11
11
|
function decodeMapFromU8a(registry, KeyClass, ValClass, u8a) {
|
|
12
12
|
const output = new Map();
|
|
13
|
-
const [offset,
|
|
14
|
-
const count = length.toNumber();
|
|
13
|
+
const [offset, count] = compactFromU8aLim(u8a);
|
|
15
14
|
const types = [];
|
|
16
15
|
|
|
17
16
|
for (let i = 0; i < count; i++) {
|
|
@@ -218,7 +217,7 @@ export class CodecMap extends Map {
|
|
|
218
217
|
encoded.push(k.toU8a(isBare), v.toU8a(isBare));
|
|
219
218
|
}
|
|
220
219
|
|
|
221
|
-
return
|
|
220
|
+
return u8aConcatStrict(encoded);
|
|
222
221
|
}
|
|
223
222
|
|
|
224
223
|
}
|
package/native/Struct.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { assert, isBoolean, isFunction, isHex, isObject, isU8a, isUndefined, objectProperties, stringCamelCase, stringify,
|
|
3
|
+
import { assert, isBoolean, isFunction, isHex, isObject, isU8a, isUndefined, objectProperties, stringCamelCase, stringify, u8aConcatStrict, u8aToHex, u8aToU8a } from '@polkadot/util';
|
|
4
4
|
import { compareMap, decodeU8a, mapToTypeMap, typesToMap } from "../utils/index.js";
|
|
5
5
|
|
|
6
6
|
function noopSetDefinition(d) {
|
|
@@ -293,7 +293,7 @@ export class Struct extends Map {
|
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
295
|
|
|
296
|
-
return
|
|
296
|
+
return u8aConcatStrict(encoded);
|
|
297
297
|
}
|
|
298
298
|
|
|
299
299
|
}
|
package/native/Text.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { assert, compactAddLength,
|
|
3
|
+
import { assert, compactAddLength, compactFromU8aLim, compactToU8a, hexToU8a, isHex, isString, isU8a, stringToU8a, u8aToHex, u8aToString } from '@polkadot/util';
|
|
4
4
|
import { Raw } from "./Raw.js";
|
|
5
5
|
const MAX_LENGTH = 128 * 1024;
|
|
6
6
|
/** @internal */
|
|
@@ -17,9 +17,9 @@ function decodeText(value) {
|
|
|
17
17
|
return [u8aToString(value), 0];
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
const [offset, length] =
|
|
21
|
-
const total = offset + length
|
|
22
|
-
assert(length
|
|
20
|
+
const [offset, length] = compactFromU8aLim(value);
|
|
21
|
+
const total = offset + length;
|
|
22
|
+
assert(length <= MAX_LENGTH, () => `Text: length ${length.toString()} exceeds ${MAX_LENGTH}`);
|
|
23
23
|
assert(total <= value.length, () => `Text: required length less than remainder, expected at least ${total}, found ${value.length}`);
|
|
24
24
|
return [u8aToString(value.subarray(offset, total)), total];
|
|
25
25
|
} else if (isHex(value)) {
|
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"./cjs/detectPackage.js"
|
|
21
21
|
],
|
|
22
22
|
"type": "module",
|
|
23
|
-
"version": "8.5.2-
|
|
23
|
+
"version": "8.5.2-8",
|
|
24
24
|
"main": "./cjs/index.js",
|
|
25
25
|
"module": "./index.js",
|
|
26
26
|
"types": "./index.d.ts",
|
|
@@ -415,6 +415,6 @@
|
|
|
415
415
|
},
|
|
416
416
|
"dependencies": {
|
|
417
417
|
"@babel/runtime": "^7.18.0",
|
|
418
|
-
"@polkadot/util": "^9.2.
|
|
418
|
+
"@polkadot/util": "^9.2.2-15"
|
|
419
419
|
}
|
|
420
420
|
}
|
package/packageInfo.js
CHANGED
|
@@ -5,5 +5,5 @@ export const packageInfo = {
|
|
|
5
5
|
name: '@polkadot/types-codec',
|
|
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.5.2-
|
|
8
|
+
version: '8.5.2-8'
|
|
9
9
|
};
|