@polkadot/types-codec 9.6.2 → 9.8.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/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # @polkadot/types-codec
2
+
3
+ Base scale-codec types.
@@ -13,6 +13,6 @@ const packageInfo = {
13
13
  name: '@polkadot/types-codec',
14
14
  path: typeof __dirname === 'string' ? __dirname : 'auto',
15
15
  type: 'cjs',
16
- version: '9.6.2'
16
+ version: '9.8.1'
17
17
  };
18
18
  exports.packageInfo = packageInfo;
@@ -11,7 +11,7 @@ var _util = require("@polkadot/util");
11
11
  // SPDX-License-Identifier: Apache-2.0
12
12
 
13
13
  /** @internal */
14
- function formatFailure(registry, result, _ref, u8a, i, count, Type, key) {
14
+ function formatFailure(registry, fn, result, _ref, u8a, i, count, Type, key) {
15
15
  let {
16
16
  message
17
17
  } = _ref;
@@ -26,7 +26,7 @@ function formatFailure(registry, result, _ref, u8a, i, count, Type, key) {
26
26
  // but at this point not quite sure how to include and format it (it can be quite massive)
27
27
  // console.error(JSON.stringify(result, null, 2));
28
28
 
29
- return `decodeU8a: failed at ${(0, _util.u8aToHex)(u8a.subarray(0, 16))}…${key ? ` on ${key}` : ''} (index ${i + 1}/${count})${type}:: ${message}`;
29
+ return `${fn}: failed at ${(0, _util.u8aToHex)(u8a.subarray(0, 16))}…${key ? ` on ${key}` : ''} (index ${i + 1}/${count})${type}:: ${message}`;
30
30
  }
31
31
 
32
32
  /**
@@ -52,7 +52,7 @@ function decodeU8a(registry, result, u8a, _ref2) {
52
52
  i++;
53
53
  }
54
54
  } catch (error) {
55
- throw new Error(formatFailure(registry, result, error, u8a.subarray(offset), i, count, Types[i], keys[i]));
55
+ throw new Error(formatFailure(registry, 'decodeU8a', result, error, u8a.subarray(offset), i, count, Types[i], keys[i]));
56
56
  }
57
57
  return [result, offset];
58
58
  }
@@ -76,7 +76,7 @@ function decodeU8aStruct(registry, result, u8a, _ref3) {
76
76
  i++;
77
77
  }
78
78
  } catch (error) {
79
- throw new Error(formatFailure(registry, result, error, u8a.subarray(offset), i, count, Types[i], keys[i]));
79
+ throw new Error(formatFailure(registry, 'decodeU8aStruct', result, error, u8a.subarray(offset), i, count, Types[i], keys[i]));
80
80
  }
81
81
  return [result, offset];
82
82
  }
@@ -99,7 +99,7 @@ function decodeU8aVec(registry, result, u8a, startAt, Type) {
99
99
  i++;
100
100
  }
101
101
  } catch (error) {
102
- throw new Error(formatFailure(registry, result, error, u8a.subarray(offset), i, count, Type));
102
+ throw new Error(formatFailure(registry, 'decodeU8aVec', result, error, u8a.subarray(offset), i, count, Type));
103
103
  }
104
104
  return [offset, offset - startAt];
105
105
  }
package/cjs/utils/util.js CHANGED
@@ -9,6 +9,5 @@ var _util = require("@polkadot/util");
9
9
  // SPDX-License-Identifier: Apache-2.0
10
10
 
11
11
  function hasEq(o) {
12
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
13
12
  return (0, _util.isFunction)(o.eq);
14
13
  }
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "./cjs/detectPackage.js"
21
21
  ],
22
22
  "type": "module",
23
- "version": "9.6.2",
23
+ "version": "9.8.1",
24
24
  "main": "./cjs/index.js",
25
25
  "module": "./index.js",
26
26
  "types": "./index.d.ts",
@@ -434,8 +434,8 @@
434
434
  }
435
435
  },
436
436
  "dependencies": {
437
- "@babel/runtime": "^7.20.0",
438
- "@polkadot/util": "^10.1.11",
439
- "@polkadot/x-bigint": "^10.1.11"
437
+ "@babel/runtime": "^7.20.1",
438
+ "@polkadot/util": "^10.1.12",
439
+ "@polkadot/x-bigint": "^10.1.12"
440
440
  }
441
441
  }
package/packageInfo.js CHANGED
@@ -7,5 +7,5 @@ export const packageInfo = {
7
7
  name: '@polkadot/types-codec',
8
8
  path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
9
9
  type: 'esm',
10
- version: '9.6.2'
10
+ version: '9.8.1'
11
11
  };
@@ -4,7 +4,7 @@
4
4
  import { u8aToHex } from '@polkadot/util';
5
5
 
6
6
  /** @internal */
7
- function formatFailure(registry, result, {
7
+ function formatFailure(registry, fn, result, {
8
8
  message
9
9
  }, u8a, i, count, Type, key) {
10
10
  let type = '';
@@ -18,7 +18,7 @@ function formatFailure(registry, result, {
18
18
  // but at this point not quite sure how to include and format it (it can be quite massive)
19
19
  // console.error(JSON.stringify(result, null, 2));
20
20
 
21
- return `decodeU8a: failed at ${u8aToHex(u8a.subarray(0, 16))}…${key ? ` on ${key}` : ''} (index ${i + 1}/${count})${type}:: ${message}`;
21
+ return `${fn}: failed at ${u8aToHex(u8a.subarray(0, 16))}…${key ? ` on ${key}` : ''} (index ${i + 1}/${count})${type}:: ${message}`;
22
22
  }
23
23
 
24
24
  /**
@@ -43,7 +43,7 @@ export function decodeU8a(registry, result, u8a, [Types, keys]) {
43
43
  i++;
44
44
  }
45
45
  } catch (error) {
46
- throw new Error(formatFailure(registry, result, error, u8a.subarray(offset), i, count, Types[i], keys[i]));
46
+ throw new Error(formatFailure(registry, 'decodeU8a', result, error, u8a.subarray(offset), i, count, Types[i], keys[i]));
47
47
  }
48
48
  return [result, offset];
49
49
  }
@@ -66,7 +66,7 @@ export function decodeU8aStruct(registry, result, u8a, [Types, keys]) {
66
66
  i++;
67
67
  }
68
68
  } catch (error) {
69
- throw new Error(formatFailure(registry, result, error, u8a.subarray(offset), i, count, Types[i], keys[i]));
69
+ throw new Error(formatFailure(registry, 'decodeU8aStruct', result, error, u8a.subarray(offset), i, count, Types[i], keys[i]));
70
70
  }
71
71
  return [result, offset];
72
72
  }
@@ -89,7 +89,7 @@ export function decodeU8aVec(registry, result, u8a, startAt, Type) {
89
89
  i++;
90
90
  }
91
91
  } catch (error) {
92
- throw new Error(formatFailure(registry, result, error, u8a.subarray(offset), i, count, Type));
92
+ throw new Error(formatFailure(registry, 'decodeU8aVec', result, error, u8a.subarray(offset), i, count, Type));
93
93
  }
94
94
  return [offset, offset - startAt];
95
95
  }
package/utils/util.js CHANGED
@@ -3,6 +3,5 @@
3
3
 
4
4
  import { isFunction } from '@polkadot/util';
5
5
  export function hasEq(o) {
6
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
7
6
  return isFunction(o.eq);
8
7
  }