@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.
- package/bundle.js +4 -7
- package/cjs/bundle.js +9 -46
- package/cjs/create/class.js +129 -172
- package/cjs/create/index.js +4 -26
- package/cjs/create/type.js +60 -75
- package/cjs/detectOther.js +3 -10
- package/cjs/detectPackage.js +6 -11
- package/cjs/index.js +3 -15
- package/cjs/packageInfo.js +2 -16
- package/cjs/types/augmentRegistry.js +1 -1
- package/cjs/types/index.js +4 -26
- package/cjs/types/lookup.js +2 -1
- package/cjs/types/types.js +26 -32
- package/cjs/util/encodeTypes.js +116 -199
- package/cjs/util/getTypeDef.js +166 -190
- package/cjs/util/index.js +6 -48
- package/cjs/util/typeSplit.js +57 -72
- package/cjs/util/xcm.js +7 -16
- package/create/class.js +121 -153
- package/create/index.js +2 -5
- package/create/type.js +52 -61
- package/detectOther.js +0 -3
- package/detectPackage.js +2 -7
- package/index.js +2 -5
- package/package.json +8 -5
- package/packageInfo.js +1 -11
- package/types/augmentRegistry.js +0 -5
- package/types/index.js +3 -6
- package/types/types.js +24 -27
- package/util/encodeTypes.js +108 -152
- package/util/getTypeDef.js +159 -165
- package/util/index.js +4 -7
- package/util/typeSplit.js +53 -66
- package/util/xcm.js +1 -6
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
|
|
7
|
-
import { getTypeDef } from
|
|
8
|
-
function getTypeDefType({
|
|
9
|
-
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
32
|
+
return getSubDefArray(value).map(getTypeDefType);
|
|
43
33
|
}
|
|
44
|
-
function createInt(Clazz, {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
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
|
-
|
|
55
|
-
|
|
41
|
+
const [keyType, valueType] = getTypeClassArray(value);
|
|
42
|
+
return Clazz.with(keyType, valueType);
|
|
56
43
|
}
|
|
57
44
|
function createWithSub(Clazz, value) {
|
|
58
|
-
|
|
45
|
+
return Clazz.with(getSubType(value));
|
|
59
46
|
}
|
|
60
47
|
const infoMapping = {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
// eslint-disable-next-line @typescript-eslint/no-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
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
|
-
|
|
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
|
-
|
|
141
|
+
return registry.getUnsafe(typeDef.type, false, typeDef);
|
|
175
142
|
}
|
|
176
143
|
export function createClassUnsafe(registry, type) {
|
|
177
|
-
|
|
144
|
+
return (
|
|
178
145
|
// just retrieve via name, no creation via typeDef
|
|
179
146
|
registry.getUnsafe(type) ||
|
|
180
|
-
|
|
181
|
-
|
|
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.js
CHANGED
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
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
56
|
-
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
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
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
|
|
8
|
-
import { packageInfo } from
|
|
2
|
+
import others from './detectOther.js';
|
|
3
|
+
import { packageInfo } from './packageInfo.js';
|
|
9
4
|
detectPackage(packageInfo, null, others);
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"./cjs/detectPackage.js"
|
|
21
21
|
],
|
|
22
22
|
"type": "module",
|
|
23
|
-
"version": "
|
|
23
|
+
"version": "10.0.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":
|
|
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
|
-
"@
|
|
124
|
-
"@polkadot/
|
|
125
|
-
"
|
|
126
|
+
"@polkadot/types-codec": "10.0.1",
|
|
127
|
+
"@polkadot/util": "^11.0.1",
|
|
128
|
+
"tslib": "^2.5.0"
|
|
126
129
|
}
|
|
127
130
|
}
|
package/packageInfo.js
CHANGED
|
@@ -1,11 +1 @@
|
|
|
1
|
-
|
|
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.1'
|
|
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.0.1' };
|
package/types/augmentRegistry.js
CHANGED
|
@@ -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.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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/types.js
CHANGED
|
@@ -1,29 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
export let TypeDefInfo;
|
|
1
|
+
export var TypeDefInfo;
|
|
5
2
|
(function (TypeDefInfo) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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 = {}));
|