@polkadot/types-create 9.14.2 → 10.1.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/create/class.js CHANGED
@@ -1,183 +1,151 @@
1
- // Copyright 2017-2023 @polkadot/types-create authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
1
  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';
5
2
  import { isNumber, stringify } from '@polkadot/util';
6
- import { TypeDefInfo } from "../types/index.js";
7
- import { getTypeDef } from "../util/getTypeDef.js";
8
- function getTypeDefType({
9
- lookupName,
10
- type
11
- }) {
12
- return lookupName || type;
3
+ import { TypeDefInfo } from '../types/index.js';
4
+ import { getTypeDef } from '../util/getTypeDef.js';
5
+ function getTypeDefType({ lookupName, type }) {
6
+ return lookupName || type;
13
7
  }
14
8
  function getSubDefArray(value) {
15
- if (!Array.isArray(value.sub)) {
16
- throw new Error(`Expected subtype as TypeDef[] in ${stringify(value)}`);
17
- }
18
- return value.sub;
9
+ if (!Array.isArray(value.sub)) {
10
+ throw new Error(`Expected subtype as TypeDef[] in ${stringify(value)}`);
11
+ }
12
+ return value.sub;
19
13
  }
20
14
  function getSubDef(value) {
21
- if (!value.sub || Array.isArray(value.sub)) {
22
- throw new Error(`Expected subtype as TypeDef in ${stringify(value)}`);
23
- }
24
- return value.sub;
15
+ if (!value.sub || Array.isArray(value.sub)) {
16
+ throw new Error(`Expected subtype as TypeDef in ${stringify(value)}`);
17
+ }
18
+ return value.sub;
25
19
  }
26
20
  function getSubType(value) {
27
- return getTypeDefType(getSubDef(value));
21
+ return getTypeDefType(getSubDef(value));
28
22
  }
29
-
30
- // create a maps of type string CodecClasss from the input
31
23
  function getTypeClassMap(value) {
32
- const subs = getSubDefArray(value);
33
- const map = {};
34
- for (let i = 0; i < subs.length; i++) {
35
- map[subs[i].name] = getTypeDefType(subs[i]);
36
- }
37
- return map;
24
+ const subs = getSubDefArray(value);
25
+ const map = {};
26
+ for (let i = 0; i < subs.length; i++) {
27
+ map[subs[i].name] = getTypeDefType(subs[i]);
28
+ }
29
+ return map;
38
30
  }
39
-
40
- // create an array of type string CodecClasss from the input
41
31
  function getTypeClassArray(value) {
42
- return getSubDefArray(value).map(getTypeDefType);
32
+ return getSubDefArray(value).map(getTypeDefType);
43
33
  }
44
- function createInt(Clazz, {
45
- displayName,
46
- length
47
- }) {
48
- if (!isNumber(length)) {
49
- throw new Error(`Expected bitLength information for ${displayName || Clazz.constructor.name}<bitLength>`);
50
- }
51
- return Clazz.with(length, displayName);
34
+ function createInt(Clazz, { displayName, length }) {
35
+ if (!isNumber(length)) {
36
+ throw new Error(`Expected bitLength information for ${displayName || Clazz.constructor.name}<bitLength>`);
37
+ }
38
+ return Clazz.with(length, displayName);
52
39
  }
53
40
  function createHashMap(Clazz, value) {
54
- const [keyType, valueType] = getTypeClassArray(value);
55
- return Clazz.with(keyType, valueType);
41
+ const [keyType, valueType] = getTypeClassArray(value);
42
+ return Clazz.with(keyType, valueType);
56
43
  }
57
44
  function createWithSub(Clazz, value) {
58
- return Clazz.with(getSubType(value));
45
+ return Clazz.with(getSubType(value));
59
46
  }
60
47
  const infoMapping = {
61
- [TypeDefInfo.BTreeMap]: (registry, value) => createHashMap(BTreeMap, value),
62
- [TypeDefInfo.BTreeSet]: (registry, value) => createWithSub(BTreeSet, value),
63
- [TypeDefInfo.Compact]: (registry, value) => createWithSub(Compact, value),
64
- [TypeDefInfo.DoNotConstruct]: (registry, value) => DoNotConstruct.with(value.displayName || value.type),
65
- [TypeDefInfo.Enum]: (registry, value) => {
66
- const subs = getSubDefArray(value);
67
- return Enum.with(subs.every(({
68
- type
69
- }) => type === 'Null') ? subs.reduce((out, {
70
- index,
71
- name
72
- }, count) => {
73
- out[name] = index || count;
74
- return out;
75
- }, {}) : getTypeClassMap(value));
76
- },
77
- [TypeDefInfo.HashMap]: (registry, value) => createHashMap(HashMap, value),
78
- [TypeDefInfo.Int]: (registry, value) => createInt(Int, value),
79
- // We have circular deps between Linkage & Struct
80
- [TypeDefInfo.Linkage]: (registry, value) => {
81
- const type = `Option<${getSubType(value)}>`;
82
- // eslint-disable-next-line sort-keys
83
- const Clazz = Struct.with({
84
- previous: type,
85
- next: type
86
- });
87
-
88
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
89
- Clazz.prototype.toRawType = function () {
90
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call
91
- return `Linkage<${this.next.toRawType(true)}>`;
92
- };
93
- return Clazz;
94
- },
95
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
96
- [TypeDefInfo.Null]: (registry, _) => Null,
97
- [TypeDefInfo.Option]: (registry, value) => {
98
- if (!value.sub || Array.isArray(value.sub)) {
99
- throw new Error('Expected type information for Option');
100
- }
101
-
102
- // NOTE This is opt-in (unhandled), not by default
103
- // if (value.sub.type === 'bool') {
104
- // return OptionBool;
105
- // }
106
-
107
- return createWithSub(Option, value);
108
- },
109
- [TypeDefInfo.Plain]: (registry, value) => registry.getOrUnknown(value.type),
110
- [TypeDefInfo.Range]: (registry, value) => createWithSub(Range, value),
111
- [TypeDefInfo.RangeInclusive]: (registry, value) => createWithSub(RangeInclusive, value),
112
- [TypeDefInfo.Result]: (registry, value) => {
113
- const [Ok, Err] = getTypeClassArray(value);
114
-
115
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
116
- return Result.with({
117
- Err,
118
- Ok
119
- });
120
- },
121
- [TypeDefInfo.Set]: (registry, value) => CodecSet.with(getSubDefArray(value).reduce((result, {
122
- index,
123
- name
124
- }) => {
125
- result[name] = index;
126
- return result;
127
- }, {}), value.length),
128
- [TypeDefInfo.Si]: (registry, value) => getTypeClass(registry, registry.lookup.getTypeDef(value.type)),
129
- [TypeDefInfo.Struct]: (registry, value) => Struct.with(getTypeClassMap(value), value.alias),
130
- [TypeDefInfo.Tuple]: (registry, value) => Tuple.with(getTypeClassArray(value)),
131
- [TypeDefInfo.UInt]: (registry, value) => createInt(UInt, value),
132
- [TypeDefInfo.Vec]: (registry, {
133
- sub
134
- }) => {
135
- if (!sub || Array.isArray(sub)) {
136
- throw new Error('Expected type information for vector');
137
- }
138
- return sub.type === 'u8' ? Bytes : Vec.with(getTypeDefType(sub));
139
- },
140
- [TypeDefInfo.VecFixed]: (registry, {
141
- displayName,
142
- length,
143
- sub
144
- }) => {
145
- if (!isNumber(length) || !sub || Array.isArray(sub)) {
146
- throw new Error('Expected length & type information for fixed vector');
147
- }
148
- return sub.type === 'u8' ? U8aFixed.with(length * 8, displayName) : VecFixed.with(getTypeDefType(sub), length);
149
- },
150
- [TypeDefInfo.WrapperKeepOpaque]: (registry, value) => createWithSub(WrapperKeepOpaque, value),
151
- [TypeDefInfo.WrapperOpaque]: (registry, value) => createWithSub(WrapperOpaque, value)
48
+ [TypeDefInfo.BTreeMap]: (registry, value) => createHashMap(BTreeMap, value),
49
+ [TypeDefInfo.BTreeSet]: (registry, value) => createWithSub(BTreeSet, value),
50
+ [TypeDefInfo.Compact]: (registry, value) => createWithSub(Compact, value),
51
+ [TypeDefInfo.DoNotConstruct]: (registry, value) => DoNotConstruct.with(value.displayName || value.type),
52
+ [TypeDefInfo.Enum]: (registry, value) => {
53
+ const subs = getSubDefArray(value);
54
+ return Enum.with(subs.every(({ type }) => type === 'Null')
55
+ ? subs.reduce((out, { index, name }, count) => {
56
+ out[name] = index || count;
57
+ return out;
58
+ }, {})
59
+ : getTypeClassMap(value));
60
+ },
61
+ [TypeDefInfo.HashMap]: (registry, value) => createHashMap(HashMap, value),
62
+ [TypeDefInfo.Int]: (registry, value) => createInt(Int, value),
63
+ // We have circular deps between Linkage & Struct
64
+ [TypeDefInfo.Linkage]: (registry, value) => {
65
+ const type = `Option<${getSubType(value)}>`;
66
+ // eslint-disable-next-line sort-keys
67
+ const Clazz = Struct.with({ previous: type, next: type });
68
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
69
+ Clazz.prototype.toRawType = function () {
70
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call
71
+ return `Linkage<${this.next.toRawType(true)}>`;
72
+ };
73
+ return Clazz;
74
+ },
75
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
76
+ [TypeDefInfo.Null]: (registry, _) => Null,
77
+ [TypeDefInfo.Option]: (registry, value) => {
78
+ if (!value.sub || Array.isArray(value.sub)) {
79
+ throw new Error('Expected type information for Option');
80
+ }
81
+ // NOTE This is opt-in (unhandled), not by default
82
+ // if (value.sub.type === 'bool') {
83
+ // return OptionBool;
84
+ // }
85
+ return createWithSub(Option, value);
86
+ },
87
+ [TypeDefInfo.Plain]: (registry, value) => registry.getOrUnknown(value.type),
88
+ [TypeDefInfo.Range]: (registry, value) => createWithSub(Range, value),
89
+ [TypeDefInfo.RangeInclusive]: (registry, value) => createWithSub(RangeInclusive, value),
90
+ [TypeDefInfo.Result]: (registry, value) => {
91
+ const [Ok, Err] = getTypeClassArray(value);
92
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
93
+ return Result.with({ Err, Ok });
94
+ },
95
+ [TypeDefInfo.Set]: (registry, value) => CodecSet.with(getSubDefArray(value).reduce((result, { index, name }) => {
96
+ result[name] = index;
97
+ return result;
98
+ }, {}), value.length),
99
+ [TypeDefInfo.Si]: (registry, value) => getTypeClass(registry, registry.lookup.getTypeDef(value.type)),
100
+ [TypeDefInfo.Struct]: (registry, value) => Struct.with(getTypeClassMap(value), value.alias),
101
+ [TypeDefInfo.Tuple]: (registry, value) => Tuple.with(getTypeClassArray(value)),
102
+ [TypeDefInfo.UInt]: (registry, value) => createInt(UInt, value),
103
+ [TypeDefInfo.Vec]: (registry, { sub }) => {
104
+ if (!sub || Array.isArray(sub)) {
105
+ throw new Error('Expected type information for vector');
106
+ }
107
+ return (sub.type === 'u8'
108
+ ? Bytes
109
+ : Vec.with(getTypeDefType(sub)));
110
+ },
111
+ [TypeDefInfo.VecFixed]: (registry, { displayName, length, sub }) => {
112
+ if (!isNumber(length) || !sub || Array.isArray(sub)) {
113
+ throw new Error('Expected length & type information for fixed vector');
114
+ }
115
+ return (sub.type === 'u8'
116
+ ? U8aFixed.with((length * 8), displayName)
117
+ : VecFixed.with(getTypeDefType(sub), length));
118
+ },
119
+ [TypeDefInfo.WrapperKeepOpaque]: (registry, value) => createWithSub(WrapperKeepOpaque, value),
120
+ [TypeDefInfo.WrapperOpaque]: (registry, value) => createWithSub(WrapperOpaque, value)
152
121
  };
153
122
  export function constructTypeClass(registry, typeDef) {
154
- try {
155
- const Type = infoMapping[typeDef.info](registry, typeDef);
156
- if (!Type) {
157
- throw new Error('No class created');
123
+ try {
124
+ const Type = infoMapping[typeDef.info](registry, typeDef);
125
+ if (!Type) {
126
+ throw new Error('No class created');
127
+ }
128
+ // don't clobber any existing
129
+ if (!Type.__fallbackType && typeDef.fallbackType) {
130
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
131
+ // @ts-ignore ...this is the only place we we actually assign this...
132
+ Type.__fallbackType = typeDef.fallbackType;
133
+ }
134
+ return Type;
158
135
  }
159
-
160
- // don't clobber any existing
161
- if (!Type.__fallbackType && typeDef.fallbackType) {
162
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
163
- // @ts-ignore ...this is the only place we we actually assign this...
164
- Type.__fallbackType = typeDef.fallbackType;
136
+ catch (error) {
137
+ throw new Error(`Unable to construct class from ${stringify(typeDef)}: ${error.message}`);
165
138
  }
166
- return Type;
167
- } catch (error) {
168
- throw new Error(`Unable to construct class from ${stringify(typeDef)}: ${error.message}`);
169
- }
170
139
  }
171
-
172
- // Returns the type Class for construction
173
140
  export function getTypeClass(registry, typeDef) {
174
- return registry.getUnsafe(typeDef.type, false, typeDef);
141
+ return registry.getUnsafe(typeDef.type, false, typeDef);
175
142
  }
176
143
  export function createClassUnsafe(registry, type) {
177
- return (
144
+ return (
178
145
  // just retrieve via name, no creation via typeDef
179
146
  registry.getUnsafe(type) ||
180
- // we don't have an existing type, create the class via typeDef
181
- getTypeClass(registry, registry.isLookupType(type) ? registry.lookup.getTypeDef(type) : getTypeDef(type))
182
- );
147
+ // we don't have an existing type, create the class via typeDef
148
+ getTypeClass(registry, registry.isLookupType(type)
149
+ ? registry.lookup.getTypeDef(type)
150
+ : getTypeDef(type)));
183
151
  }
package/create/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from './class';
2
- export * from './type';
1
+ export * from './class.js';
2
+ export * from './type.js';
package/create/index.js CHANGED
@@ -1,5 +1,2 @@
1
- // Copyright 2017-2023 @polkadot/types-create authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- export * from "./class.js";
5
- export * from "./type.js";
1
+ export * from './class.js';
2
+ export * from './type.js';
package/create/type.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import type { Codec, Registry } from '@polkadot/types-codec/types';
2
- import type { CreateOptions } from '../types';
2
+ import type { CreateOptions } from '../types/index.js';
3
3
  export declare function createTypeUnsafe<T extends Codec = Codec, K extends string = string>(registry: Registry, type: K, params?: unknown[], options?: CreateOptions): T;
package/create/type.js CHANGED
@@ -1,72 +1,63 @@
1
- // Copyright 2017-2023 @polkadot/types-create authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
1
  import { Option } from '@polkadot/types-codec';
5
2
  import { isHex, isU8a, u8aEq, u8aToHex, u8aToU8a } from '@polkadot/util';
6
- import { createClassUnsafe } from "./class.js";
7
-
8
- // With isPedantic, actually check that the encoding matches that supplied. This
9
- // is much slower, but verifies that we have the correct types defined
3
+ import { createClassUnsafe } from './class.js';
10
4
  function checkInstance(created, matcher) {
11
- const u8a = created.toU8a();
12
- const rawType = created.toRawType();
13
- const isOk =
14
- // full match, all ok
15
- u8aEq(u8a, matcher) ||
16
- // on a length-prefixed type, just check the actual length
17
- ['Bytes', 'Text', 'Type'].includes(rawType) && matcher.length === created.length ||
18
- // when the created is empty and matcher is also empty, let it slide...
19
- created.isEmpty && matcher.every(v => !v);
20
- if (!isOk) {
21
- throw new Error(`${rawType}:: Decoded input doesn't match input, received ${u8aToHex(matcher, 512)} (${matcher.length} bytes), created ${u8aToHex(u8a, 512)} (${u8a.length} bytes)`);
22
- }
5
+ const u8a = created.toU8a();
6
+ const rawType = created.toRawType();
7
+ const isOk = (
8
+ // full match, all ok
9
+ u8aEq(u8a, matcher) ||
10
+ (
11
+ // on a length-prefixed type, just check the actual length
12
+ ['Bytes', 'Text', 'Type'].includes(rawType) &&
13
+ matcher.length === created.length) ||
14
+ (
15
+ // when the created is empty and matcher is also empty, let it slide...
16
+ created.isEmpty &&
17
+ matcher.every((v) => !v)));
18
+ if (!isOk) {
19
+ throw new Error(`${rawType}:: Decoded input doesn't match input, received ${u8aToHex(matcher, 512)} (${matcher.length} bytes), created ${u8aToHex(u8a, 512)} (${u8a.length} bytes)`);
20
+ }
23
21
  }
24
22
  function checkPedantic(created, [value]) {
25
- if (isU8a(value)) {
26
- checkInstance(created, value);
27
- } else if (isHex(value)) {
28
- checkInstance(created, u8aToU8a(value));
29
- }
23
+ if (isU8a(value)) {
24
+ checkInstance(created, value);
25
+ }
26
+ else if (isHex(value)) {
27
+ checkInstance(created, u8aToU8a(value));
28
+ }
30
29
  }
31
-
32
- // Initializes a type with a value. This also checks for fallbacks and in the cases
33
- // where isPedantic is specified (storage decoding), also check the format/structure
34
- function initType(registry, Type, params = [], {
35
- blockHash,
36
- isFallback,
37
- isOptional,
38
- isPedantic
39
- } = {}) {
40
- const created = new (isOptional ? Option.with(Type) : Type)(registry, ...params);
41
- isPedantic && checkPedantic(created, params);
42
- if (blockHash) {
43
- created.createdAtHash = createTypeUnsafe(registry, 'BlockHash', [blockHash]);
44
- }
45
- if (isFallback) {
46
- created.isStorageFallback = true;
47
- }
48
- return created;
30
+ function initType(registry, Type, params = [], { blockHash, isFallback, isOptional, isPedantic } = {}) {
31
+ const created = new (isOptional
32
+ ? Option.with(Type)
33
+ : Type)(registry, ...params);
34
+ isPedantic && checkPedantic(created, params);
35
+ if (blockHash) {
36
+ created.createdAtHash = createTypeUnsafe(registry, 'BlockHash', [blockHash]);
37
+ }
38
+ if (isFallback) {
39
+ created.isStorageFallback = true;
40
+ }
41
+ return created;
49
42
  }
50
-
51
- // An unsafe version of the `createType` below. It's unsafe because the `type`
52
- // argument here can be any string, which, when it cannot parse, will yield a
53
- // runtime error.
54
43
  export function createTypeUnsafe(registry, type, params = [], options = {}) {
55
- let Clazz = null;
56
- let firstError = null;
57
- try {
58
- Clazz = createClassUnsafe(registry, type);
59
- return initType(registry, Clazz, params, options);
60
- } catch (error) {
61
- firstError = new Error(`createType(${type}):: ${error.message}`);
62
- }
63
- if (Clazz && Clazz.__fallbackType) {
44
+ let Clazz = null;
45
+ let firstError = null;
64
46
  try {
65
- Clazz = createClassUnsafe(registry, Clazz.__fallbackType);
66
- return initType(registry, Clazz, params, options);
67
- } catch {
68
- // swallow, we will throw the first error again
47
+ Clazz = createClassUnsafe(registry, type);
48
+ return initType(registry, Clazz, params, options);
49
+ }
50
+ catch (error) {
51
+ firstError = new Error(`createType(${type}):: ${error.message}`);
52
+ }
53
+ if (Clazz && Clazz.__fallbackType) {
54
+ try {
55
+ Clazz = createClassUnsafe(registry, Clazz.__fallbackType);
56
+ return initType(registry, Clazz, params, options);
57
+ }
58
+ catch {
59
+ // swallow, we will throw the first error again
60
+ }
69
61
  }
70
- }
71
- throw firstError;
62
+ throw firstError;
72
63
  }
package/detectOther.js CHANGED
@@ -1,5 +1,2 @@
1
- // Copyright 2017-2023 @polkadot/types-create authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
1
  import { packageInfo as codecInfo } from '@polkadot/types-codec/packageInfo';
5
2
  export default [codecInfo];
package/detectPackage.js CHANGED
@@ -1,9 +1,4 @@
1
- // Copyright 2017-2023 @polkadot/types-create authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- // Do not edit, auto-generated by @polkadot/dev
5
-
6
1
  import { detectPackage } from '@polkadot/util';
7
- import others from "./detectOther.js";
8
- import { packageInfo } from "./packageInfo.js";
2
+ import others from './detectOther.js';
3
+ import { packageInfo } from './packageInfo.js';
9
4
  detectPackage(packageInfo, null, others);
package/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import './detectPackage';
2
- export * from './bundle';
1
+ import './detectPackage.js';
2
+ export * from './bundle.js';
package/index.js CHANGED
@@ -1,5 +1,2 @@
1
- // Copyright 2017-2023 @polkadot/types-create authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import "./detectPackage.js";
5
- export * from "./bundle.js";
1
+ import './detectPackage.js';
2
+ export * from './bundle.js';
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "./cjs/detectPackage.js"
21
21
  ],
22
22
  "type": "module",
23
- "version": "9.14.2",
23
+ "version": "10.1.1",
24
24
  "main": "./cjs/index.js",
25
25
  "module": "./index.js",
26
26
  "types": "./index.d.ts",
@@ -62,7 +62,10 @@
62
62
  "require": "./cjs/detectPackage.js",
63
63
  "default": "./detectPackage.js"
64
64
  },
65
- "./package.json": "./package.json",
65
+ "./package.json": {
66
+ "require": "./cjs/package.json",
67
+ "default": "./package.json"
68
+ },
66
69
  "./packageInfo.js": {
67
70
  "types": "./packageInfo.d.ts",
68
71
  "require": "./cjs/packageInfo.js",
@@ -120,8 +123,8 @@
120
123
  }
121
124
  },
122
125
  "dependencies": {
123
- "@babel/runtime": "^7.20.13",
124
- "@polkadot/types-codec": "9.14.2",
125
- "@polkadot/util": "^10.4.2"
126
+ "@polkadot/types-codec": "10.1.1",
127
+ "@polkadot/util": "^11.0.2",
128
+ "tslib": "^2.5.0"
126
129
  }
127
130
  }
package/packageInfo.js CHANGED
@@ -1,11 +1 @@
1
- // Copyright 2017-2023 @polkadot/types-create authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- // Do not edit, auto-generated by @polkadot/dev
5
-
6
- export const packageInfo = {
7
- name: '@polkadot/types-create',
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
- type: 'esm',
10
- version: '9.14.2'
11
- };
1
+ export const packageInfo = { name: '@polkadot/types-create', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '10.1.1' };
@@ -1,6 +1 @@
1
- // Copyright 2017-2023 @polkadot/types-create authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- // import type lookup before we augment - in some environments
5
- // this is required to allow for ambient/previous definitions
6
1
  import '@polkadot/types-codec/types/registry';
package/types/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import './augmentRegistry';
1
+ import './augmentRegistry.js';
2
2
  export type { CodecCreateOptions as CreateOptions } from '@polkadot/types-codec/types';
3
- export * from './lookup';
4
- export * from './types';
3
+ export * from './lookup.js';
4
+ export * from './types.js';
package/types/index.js CHANGED
@@ -1,6 +1,3 @@
1
- // Copyright 2017-2023 @polkadot/types-create authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import "./augmentRegistry.js";
5
- export * from "./lookup.js";
6
- export * from "./types.js";
1
+ import './augmentRegistry.js';
2
+ export * from './lookup.js';
3
+ export * from './types.js';
package/types/lookup.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { Option, Text } from '@polkadot/types-codec';
2
2
  import type { ICompact, INumber, LookupString } from '@polkadot/types-codec/types';
3
- import type { TypeDef } from './types';
3
+ import type { TypeDef } from './types.js';
4
4
  interface SiTypeBase {
5
5
  def: {
6
6
  asTuple: ICompact<INumber>[];
package/types/types.js CHANGED
@@ -1,29 +1,26 @@
1
- // Copyright 2017-2023 @polkadot/types-create authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- export let TypeDefInfo;
1
+ export var TypeDefInfo;
5
2
  (function (TypeDefInfo) {
6
- TypeDefInfo[TypeDefInfo["BTreeMap"] = 0] = "BTreeMap";
7
- TypeDefInfo[TypeDefInfo["BTreeSet"] = 1] = "BTreeSet";
8
- TypeDefInfo[TypeDefInfo["Compact"] = 2] = "Compact";
9
- TypeDefInfo[TypeDefInfo["DoNotConstruct"] = 3] = "DoNotConstruct";
10
- TypeDefInfo[TypeDefInfo["Enum"] = 4] = "Enum";
11
- TypeDefInfo[TypeDefInfo["HashMap"] = 5] = "HashMap";
12
- TypeDefInfo[TypeDefInfo["Int"] = 6] = "Int";
13
- TypeDefInfo[TypeDefInfo["Linkage"] = 7] = "Linkage";
14
- TypeDefInfo[TypeDefInfo["Null"] = 8] = "Null";
15
- TypeDefInfo[TypeDefInfo["Option"] = 9] = "Option";
16
- TypeDefInfo[TypeDefInfo["Plain"] = 10] = "Plain";
17
- TypeDefInfo[TypeDefInfo["Range"] = 11] = "Range";
18
- TypeDefInfo[TypeDefInfo["RangeInclusive"] = 12] = "RangeInclusive";
19
- TypeDefInfo[TypeDefInfo["Result"] = 13] = "Result";
20
- TypeDefInfo[TypeDefInfo["Set"] = 14] = "Set";
21
- TypeDefInfo[TypeDefInfo["Si"] = 15] = "Si";
22
- TypeDefInfo[TypeDefInfo["Struct"] = 16] = "Struct";
23
- TypeDefInfo[TypeDefInfo["Tuple"] = 17] = "Tuple";
24
- TypeDefInfo[TypeDefInfo["UInt"] = 18] = "UInt";
25
- TypeDefInfo[TypeDefInfo["Vec"] = 19] = "Vec";
26
- TypeDefInfo[TypeDefInfo["VecFixed"] = 20] = "VecFixed";
27
- TypeDefInfo[TypeDefInfo["WrapperKeepOpaque"] = 21] = "WrapperKeepOpaque";
28
- TypeDefInfo[TypeDefInfo["WrapperOpaque"] = 22] = "WrapperOpaque";
3
+ TypeDefInfo[TypeDefInfo["BTreeMap"] = 0] = "BTreeMap";
4
+ TypeDefInfo[TypeDefInfo["BTreeSet"] = 1] = "BTreeSet";
5
+ TypeDefInfo[TypeDefInfo["Compact"] = 2] = "Compact";
6
+ TypeDefInfo[TypeDefInfo["DoNotConstruct"] = 3] = "DoNotConstruct";
7
+ TypeDefInfo[TypeDefInfo["Enum"] = 4] = "Enum";
8
+ TypeDefInfo[TypeDefInfo["HashMap"] = 5] = "HashMap";
9
+ TypeDefInfo[TypeDefInfo["Int"] = 6] = "Int";
10
+ TypeDefInfo[TypeDefInfo["Linkage"] = 7] = "Linkage";
11
+ TypeDefInfo[TypeDefInfo["Null"] = 8] = "Null";
12
+ TypeDefInfo[TypeDefInfo["Option"] = 9] = "Option";
13
+ TypeDefInfo[TypeDefInfo["Plain"] = 10] = "Plain";
14
+ TypeDefInfo[TypeDefInfo["Range"] = 11] = "Range";
15
+ TypeDefInfo[TypeDefInfo["RangeInclusive"] = 12] = "RangeInclusive";
16
+ TypeDefInfo[TypeDefInfo["Result"] = 13] = "Result";
17
+ TypeDefInfo[TypeDefInfo["Set"] = 14] = "Set";
18
+ TypeDefInfo[TypeDefInfo["Si"] = 15] = "Si";
19
+ TypeDefInfo[TypeDefInfo["Struct"] = 16] = "Struct";
20
+ TypeDefInfo[TypeDefInfo["Tuple"] = 17] = "Tuple";
21
+ TypeDefInfo[TypeDefInfo["UInt"] = 18] = "UInt";
22
+ TypeDefInfo[TypeDefInfo["Vec"] = 19] = "Vec";
23
+ TypeDefInfo[TypeDefInfo["VecFixed"] = 20] = "VecFixed";
24
+ TypeDefInfo[TypeDefInfo["WrapperKeepOpaque"] = 21] = "WrapperKeepOpaque";
25
+ TypeDefInfo[TypeDefInfo["WrapperOpaque"] = 22] = "WrapperOpaque";
29
26
  })(TypeDefInfo || (TypeDefInfo = {}));