@talismn/scale 0.0.2 → 0.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/dist/declarations/src/index.d.ts +2 -3
- package/dist/declarations/src/papito.d.ts +6 -0
- package/dist/declarations/src/util/compactMetadata.d.ts +24 -0
- package/dist/declarations/src/util/decodeMetadata.d.ts +13 -0
- package/dist/declarations/src/util/decodeScale.d.ts +4 -0
- package/dist/declarations/src/util/encodeMetadata.d.ts +8 -0
- package/dist/declarations/src/util/encodeStateKey.d.ts +4 -0
- package/dist/declarations/src/util/getMetadataVersion.d.ts +6 -0
- package/dist/declarations/src/util/index.d.ts +7 -0
- package/dist/declarations/src/util/serdePapi.d.ts +30 -0
- package/dist/talismn-scale.cjs.dev.js +338 -1691
- package/dist/talismn-scale.cjs.prod.js +338 -1691
- package/dist/talismn-scale.esm.js +305 -1618
- package/package.json +16 -20
- package/CHANGELOG.md +0 -15
- package/dist/declarations/src/capi/crypto/base58.d.ts +0 -18
- package/dist/declarations/src/capi/crypto/hashers.d.ts +0 -67
- package/dist/declarations/src/capi/crypto/index.d.ts +0 -3
- package/dist/declarations/src/capi/crypto/ss58.d.ts +0 -16
- package/dist/declarations/src/capi/crypto/util/index.d.ts +0 -4
- package/dist/declarations/src/capi/crypto/util/nosimd.d.ts +0 -19
- package/dist/declarations/src/capi/crypto/util/simd.d.ts +0 -1
- package/dist/declarations/src/capi/frame_metadata/Extrinsic.d.ts +0 -50
- package/dist/declarations/src/capi/frame_metadata/FrameMetadata.d.ts +0 -61
- package/dist/declarations/src/capi/frame_metadata/decodeMetadata.d.ts +0 -312
- package/dist/declarations/src/capi/frame_metadata/index.d.ts +0 -4
- package/dist/declarations/src/capi/frame_metadata/key_codecs.d.ts +0 -27
- package/dist/declarations/src/capi/frame_metadata/raw/v14.d.ts +0 -312
- package/dist/declarations/src/capi/index.d.ts +0 -4
- package/dist/declarations/src/capi/scale_info/index.d.ts +0 -4
- package/dist/declarations/src/capi/scale_info/overrides/ChainError.d.ts +0 -26
- package/dist/declarations/src/capi/scale_info/overrides/Era.d.ts +0 -33
- package/dist/declarations/src/capi/scale_info/overrides/index.d.ts +0 -1
- package/dist/declarations/src/capi/scale_info/overrides/overrides.d.ts +0 -23
- package/dist/declarations/src/capi/scale_info/raw/Ty.d.ts +0 -313
- package/dist/declarations/src/capi/scale_info/transformTys.d.ts +0 -34
- package/dist/declarations/src/capi/util/index.d.ts +0 -3
- package/dist/declarations/src/capi/util/key.d.ts +0 -22
- package/dist/declarations/src/capi/util/normalize.d.ts +0 -25
- package/dist/declarations/src/capi/util/state.d.ts +0 -25
- package/dist/declarations/src/metadata/index.d.ts +0 -2
- package/dist/declarations/src/metadata/util.d.ts +0 -10
- package/dist/declarations/src/storage/getShape.d.ts +0 -15
- package/dist/declarations/src/storage/getTypeName.d.ts +0 -25
- package/dist/declarations/src/storage/index.d.ts +0 -11
- package/dist/declarations/src/suppressPortableRegistryConsoleWarnings.d.ts +0 -1
- package/dist/nosimd-18c022ec.cjs.dev.js +0 -46
- package/dist/nosimd-8c31fb2d.esm.js +0 -43
- package/dist/nosimd-b32b4901.cjs.prod.js +0 -46
- package/dist/simd-133b8f48.cjs.prod.js +0 -14
- package/dist/simd-2ddb8d7c.cjs.dev.js +0 -14
- package/dist/simd-b794dbff.esm.js +0 -1
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Adapted from https://github.com/paritytech/capi-old copyright Parity Technologies (APACHE License 2.0)
|
|
3
|
-
* Changes August 19th 2023 :
|
|
4
|
-
* - updated to use subshape for scale decoding
|
|
5
|
-
* - adapted from deno to typescript
|
|
6
|
-
*
|
|
7
|
-
Copyright 2023 Parity Technologies
|
|
8
|
-
|
|
9
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
-
you may not use this file except in compliance with the License.
|
|
11
|
-
You may obtain a copy of the License at
|
|
12
|
-
|
|
13
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
-
|
|
15
|
-
Unless required by applicable law or agreed to in writing, software
|
|
16
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
-
See the License for the specific language governing permissions and
|
|
19
|
-
limitations under the License.
|
|
20
|
-
*/
|
|
21
|
-
import * as $ from "@talismn/subshape-fork";
|
|
22
|
-
export declare const $tyId: $.Shape<number, number>;
|
|
23
|
-
export declare const $field: $.Shape<{
|
|
24
|
-
readonly name?: string | undefined;
|
|
25
|
-
readonly ty: number;
|
|
26
|
-
readonly typeName?: string | undefined;
|
|
27
|
-
readonly docs: readonly string[];
|
|
28
|
-
}, {
|
|
29
|
-
name?: string | undefined;
|
|
30
|
-
ty: number;
|
|
31
|
-
typeName?: string | undefined;
|
|
32
|
-
docs: string[];
|
|
33
|
-
}>;
|
|
34
|
-
export declare const $primitiveKind: $.Shape<"bool" | "char" | "str" | "u8" | "u16" | "u32" | "u64" | "u128" | "u256" | "i8" | "i16" | "i32" | "i64" | "i128" | "i256", "bool" | "char" | "str" | "u8" | "u16" | "u32" | "u64" | "u128" | "u256" | "i8" | "i16" | "i32" | "i64" | "i128" | "i256">;
|
|
35
|
-
export declare const $tyDef: $.Shape<{
|
|
36
|
-
readonly type: "Struct";
|
|
37
|
-
readonly fields: readonly {
|
|
38
|
-
readonly name?: string | undefined;
|
|
39
|
-
readonly ty: number;
|
|
40
|
-
readonly typeName?: string | undefined;
|
|
41
|
-
readonly docs: readonly string[];
|
|
42
|
-
}[];
|
|
43
|
-
} | {
|
|
44
|
-
readonly type: "Union";
|
|
45
|
-
readonly members: readonly {
|
|
46
|
-
readonly name: string;
|
|
47
|
-
readonly fields: readonly {
|
|
48
|
-
readonly name?: string | undefined;
|
|
49
|
-
readonly ty: number;
|
|
50
|
-
readonly typeName?: string | undefined;
|
|
51
|
-
readonly docs: readonly string[];
|
|
52
|
-
}[];
|
|
53
|
-
readonly index: number;
|
|
54
|
-
readonly docs: readonly string[];
|
|
55
|
-
}[];
|
|
56
|
-
} | {
|
|
57
|
-
readonly type: "Sequence";
|
|
58
|
-
readonly typeParam: number;
|
|
59
|
-
} | {
|
|
60
|
-
readonly type: "SizedArray";
|
|
61
|
-
readonly len: number;
|
|
62
|
-
readonly typeParam: number;
|
|
63
|
-
} | {
|
|
64
|
-
readonly type: "Tuple";
|
|
65
|
-
readonly fields: readonly number[];
|
|
66
|
-
} | {
|
|
67
|
-
readonly type: "Primitive";
|
|
68
|
-
readonly kind: "bool" | "char" | "str" | "u8" | "u16" | "u32" | "u64" | "u128" | "u256" | "i8" | "i16" | "i32" | "i64" | "i128" | "i256";
|
|
69
|
-
} | {
|
|
70
|
-
readonly type: "Compact";
|
|
71
|
-
readonly typeParam: number;
|
|
72
|
-
} | {
|
|
73
|
-
readonly type: "BitSequence";
|
|
74
|
-
readonly bitOrderType: number;
|
|
75
|
-
readonly bitStoreType: number;
|
|
76
|
-
}, {
|
|
77
|
-
type: "Struct";
|
|
78
|
-
fields: {
|
|
79
|
-
name?: string | undefined;
|
|
80
|
-
ty: number;
|
|
81
|
-
typeName?: string | undefined;
|
|
82
|
-
docs: string[];
|
|
83
|
-
}[];
|
|
84
|
-
} | {
|
|
85
|
-
type: "Union";
|
|
86
|
-
members: {
|
|
87
|
-
name: string;
|
|
88
|
-
fields: {
|
|
89
|
-
name?: string | undefined;
|
|
90
|
-
ty: number;
|
|
91
|
-
typeName?: string | undefined;
|
|
92
|
-
docs: string[];
|
|
93
|
-
}[];
|
|
94
|
-
index: number;
|
|
95
|
-
docs: string[];
|
|
96
|
-
}[];
|
|
97
|
-
} | {
|
|
98
|
-
type: "Sequence";
|
|
99
|
-
typeParam: number;
|
|
100
|
-
} | {
|
|
101
|
-
type: "SizedArray";
|
|
102
|
-
len: number;
|
|
103
|
-
typeParam: number;
|
|
104
|
-
} | {
|
|
105
|
-
type: "Tuple";
|
|
106
|
-
fields: number[];
|
|
107
|
-
} | {
|
|
108
|
-
type: "Primitive";
|
|
109
|
-
kind: "bool" | "char" | "str" | "u8" | "u16" | "u32" | "u64" | "u128" | "u256" | "i8" | "i16" | "i32" | "i64" | "i128" | "i256";
|
|
110
|
-
} | {
|
|
111
|
-
type: "Compact";
|
|
112
|
-
typeParam: number;
|
|
113
|
-
} | {
|
|
114
|
-
type: "BitSequence";
|
|
115
|
-
bitOrderType: number;
|
|
116
|
-
bitStoreType: number;
|
|
117
|
-
}>;
|
|
118
|
-
export type Ty = $.Output<typeof $ty>;
|
|
119
|
-
export declare const $ty: $.Shape<{
|
|
120
|
-
readonly id: number;
|
|
121
|
-
readonly path: readonly string[];
|
|
122
|
-
readonly params: readonly {
|
|
123
|
-
readonly name: string;
|
|
124
|
-
readonly ty?: number | undefined;
|
|
125
|
-
}[];
|
|
126
|
-
readonly type: "Struct";
|
|
127
|
-
readonly fields: readonly {
|
|
128
|
-
readonly name?: string | undefined;
|
|
129
|
-
readonly ty: number;
|
|
130
|
-
readonly typeName?: string | undefined;
|
|
131
|
-
readonly docs: readonly string[];
|
|
132
|
-
}[];
|
|
133
|
-
readonly docs: readonly string[];
|
|
134
|
-
} | {
|
|
135
|
-
readonly id: number;
|
|
136
|
-
readonly path: readonly string[];
|
|
137
|
-
readonly params: readonly {
|
|
138
|
-
readonly name: string;
|
|
139
|
-
readonly ty?: number | undefined;
|
|
140
|
-
}[];
|
|
141
|
-
readonly type: "Union";
|
|
142
|
-
readonly members: readonly {
|
|
143
|
-
readonly name: string;
|
|
144
|
-
readonly fields: readonly {
|
|
145
|
-
readonly name?: string | undefined;
|
|
146
|
-
readonly ty: number;
|
|
147
|
-
readonly typeName?: string | undefined;
|
|
148
|
-
readonly docs: readonly string[];
|
|
149
|
-
}[];
|
|
150
|
-
readonly index: number;
|
|
151
|
-
readonly docs: readonly string[];
|
|
152
|
-
}[];
|
|
153
|
-
readonly docs: readonly string[];
|
|
154
|
-
} | {
|
|
155
|
-
readonly id: number;
|
|
156
|
-
readonly path: readonly string[];
|
|
157
|
-
readonly params: readonly {
|
|
158
|
-
readonly name: string;
|
|
159
|
-
readonly ty?: number | undefined;
|
|
160
|
-
}[];
|
|
161
|
-
readonly type: "Sequence";
|
|
162
|
-
readonly typeParam: number;
|
|
163
|
-
readonly docs: readonly string[];
|
|
164
|
-
} | {
|
|
165
|
-
readonly id: number;
|
|
166
|
-
readonly path: readonly string[];
|
|
167
|
-
readonly params: readonly {
|
|
168
|
-
readonly name: string;
|
|
169
|
-
readonly ty?: number | undefined;
|
|
170
|
-
}[];
|
|
171
|
-
readonly type: "SizedArray";
|
|
172
|
-
readonly len: number;
|
|
173
|
-
readonly typeParam: number;
|
|
174
|
-
readonly docs: readonly string[];
|
|
175
|
-
} | {
|
|
176
|
-
readonly id: number;
|
|
177
|
-
readonly path: readonly string[];
|
|
178
|
-
readonly params: readonly {
|
|
179
|
-
readonly name: string;
|
|
180
|
-
readonly ty?: number | undefined;
|
|
181
|
-
}[];
|
|
182
|
-
readonly type: "Tuple";
|
|
183
|
-
readonly fields: readonly number[];
|
|
184
|
-
readonly docs: readonly string[];
|
|
185
|
-
} | {
|
|
186
|
-
readonly id: number;
|
|
187
|
-
readonly path: readonly string[];
|
|
188
|
-
readonly params: readonly {
|
|
189
|
-
readonly name: string;
|
|
190
|
-
readonly ty?: number | undefined;
|
|
191
|
-
}[];
|
|
192
|
-
readonly type: "Primitive";
|
|
193
|
-
readonly kind: "bool" | "char" | "str" | "u8" | "u16" | "u32" | "u64" | "u128" | "u256" | "i8" | "i16" | "i32" | "i64" | "i128" | "i256";
|
|
194
|
-
readonly docs: readonly string[];
|
|
195
|
-
} | {
|
|
196
|
-
readonly id: number;
|
|
197
|
-
readonly path: readonly string[];
|
|
198
|
-
readonly params: readonly {
|
|
199
|
-
readonly name: string;
|
|
200
|
-
readonly ty?: number | undefined;
|
|
201
|
-
}[];
|
|
202
|
-
readonly type: "Compact";
|
|
203
|
-
readonly typeParam: number;
|
|
204
|
-
readonly docs: readonly string[];
|
|
205
|
-
} | {
|
|
206
|
-
readonly id: number;
|
|
207
|
-
readonly path: readonly string[];
|
|
208
|
-
readonly params: readonly {
|
|
209
|
-
readonly name: string;
|
|
210
|
-
readonly ty?: number | undefined;
|
|
211
|
-
}[];
|
|
212
|
-
readonly type: "BitSequence";
|
|
213
|
-
readonly bitOrderType: number;
|
|
214
|
-
readonly bitStoreType: number;
|
|
215
|
-
readonly docs: readonly string[];
|
|
216
|
-
}, {
|
|
217
|
-
id: number;
|
|
218
|
-
path: string[];
|
|
219
|
-
params: {
|
|
220
|
-
name: string;
|
|
221
|
-
ty?: number | undefined;
|
|
222
|
-
}[];
|
|
223
|
-
type: "Struct";
|
|
224
|
-
fields: {
|
|
225
|
-
name?: string | undefined;
|
|
226
|
-
ty: number;
|
|
227
|
-
typeName?: string | undefined;
|
|
228
|
-
docs: string[];
|
|
229
|
-
}[];
|
|
230
|
-
docs: string[];
|
|
231
|
-
} | {
|
|
232
|
-
id: number;
|
|
233
|
-
path: string[];
|
|
234
|
-
params: {
|
|
235
|
-
name: string;
|
|
236
|
-
ty?: number | undefined;
|
|
237
|
-
}[];
|
|
238
|
-
type: "Union";
|
|
239
|
-
members: {
|
|
240
|
-
name: string;
|
|
241
|
-
fields: {
|
|
242
|
-
name?: string | undefined;
|
|
243
|
-
ty: number;
|
|
244
|
-
typeName?: string | undefined;
|
|
245
|
-
docs: string[];
|
|
246
|
-
}[];
|
|
247
|
-
index: number;
|
|
248
|
-
docs: string[];
|
|
249
|
-
}[];
|
|
250
|
-
docs: string[];
|
|
251
|
-
} | {
|
|
252
|
-
id: number;
|
|
253
|
-
path: string[];
|
|
254
|
-
params: {
|
|
255
|
-
name: string;
|
|
256
|
-
ty?: number | undefined;
|
|
257
|
-
}[];
|
|
258
|
-
type: "Sequence";
|
|
259
|
-
typeParam: number;
|
|
260
|
-
docs: string[];
|
|
261
|
-
} | {
|
|
262
|
-
id: number;
|
|
263
|
-
path: string[];
|
|
264
|
-
params: {
|
|
265
|
-
name: string;
|
|
266
|
-
ty?: number | undefined;
|
|
267
|
-
}[];
|
|
268
|
-
type: "SizedArray";
|
|
269
|
-
len: number;
|
|
270
|
-
typeParam: number;
|
|
271
|
-
docs: string[];
|
|
272
|
-
} | {
|
|
273
|
-
id: number;
|
|
274
|
-
path: string[];
|
|
275
|
-
params: {
|
|
276
|
-
name: string;
|
|
277
|
-
ty?: number | undefined;
|
|
278
|
-
}[];
|
|
279
|
-
type: "Tuple";
|
|
280
|
-
fields: number[];
|
|
281
|
-
docs: string[];
|
|
282
|
-
} | {
|
|
283
|
-
id: number;
|
|
284
|
-
path: string[];
|
|
285
|
-
params: {
|
|
286
|
-
name: string;
|
|
287
|
-
ty?: number | undefined;
|
|
288
|
-
}[];
|
|
289
|
-
type: "Primitive";
|
|
290
|
-
kind: "bool" | "char" | "str" | "u8" | "u16" | "u32" | "u64" | "u128" | "u256" | "i8" | "i16" | "i32" | "i64" | "i128" | "i256";
|
|
291
|
-
docs: string[];
|
|
292
|
-
} | {
|
|
293
|
-
id: number;
|
|
294
|
-
path: string[];
|
|
295
|
-
params: {
|
|
296
|
-
name: string;
|
|
297
|
-
ty?: number | undefined;
|
|
298
|
-
}[];
|
|
299
|
-
type: "Compact";
|
|
300
|
-
typeParam: number;
|
|
301
|
-
docs: string[];
|
|
302
|
-
} | {
|
|
303
|
-
id: number;
|
|
304
|
-
path: string[];
|
|
305
|
-
params: {
|
|
306
|
-
name: string;
|
|
307
|
-
ty?: number | undefined;
|
|
308
|
-
}[];
|
|
309
|
-
type: "BitSequence";
|
|
310
|
-
bitOrderType: number;
|
|
311
|
-
bitStoreType: number;
|
|
312
|
-
docs: string[];
|
|
313
|
-
}>;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Adapted from https://github.com/paritytech/capi-old copyright Parity Technologies (APACHE License 2.0)
|
|
3
|
-
* Changes August 19th 2023 :
|
|
4
|
-
* - updated to use subshape for scale decoding
|
|
5
|
-
* - adapted from deno to typescript
|
|
6
|
-
*
|
|
7
|
-
Copyright 2023 Parity Technologies
|
|
8
|
-
|
|
9
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
-
you may not use this file except in compliance with the License.
|
|
11
|
-
You may obtain a copy of the License at
|
|
12
|
-
|
|
13
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
-
|
|
15
|
-
Unless required by applicable law or agreed to in writing, software
|
|
16
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
-
See the License for the specific language governing permissions and
|
|
19
|
-
limitations under the License.
|
|
20
|
-
*/
|
|
21
|
-
import * as $ from "@talismn/subshape-fork";
|
|
22
|
-
import { AnyShape } from "@talismn/subshape-fork";
|
|
23
|
-
import { Ty } from "./raw/Ty";
|
|
24
|
-
/**
|
|
25
|
-
* All derived codecs for ZSTs will use this exact codec,
|
|
26
|
-
* so `derivedCodec === $null` is true iff the type is a ZST.
|
|
27
|
-
*/
|
|
28
|
-
export declare const $null: $.Shape<null, null>;
|
|
29
|
-
export interface ScaleInfo {
|
|
30
|
-
ids: AnyShape[];
|
|
31
|
-
types: Record<string, AnyShape>;
|
|
32
|
-
paths: Record<string, AnyShape>;
|
|
33
|
-
}
|
|
34
|
-
export declare function transformTys(tys: Ty[]): ScaleInfo;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Adapted from https://github.com/paritytech/capi-old copyright Parity Technologies (APACHE License 2.0)
|
|
3
|
-
* Changes August 19th 2023 :
|
|
4
|
-
* - updated to use subshape for scale decoding
|
|
5
|
-
* - adapted from deno to typescript
|
|
6
|
-
*
|
|
7
|
-
Copyright 2023 Parity Technologies
|
|
8
|
-
|
|
9
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
-
you may not use this file except in compliance with the License.
|
|
11
|
-
You may obtain a copy of the License at
|
|
12
|
-
|
|
13
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
-
|
|
15
|
-
Unless required by applicable law or agreed to in writing, software
|
|
16
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
-
See the License for the specific language governing permissions and
|
|
19
|
-
limitations under the License.
|
|
20
|
-
*/
|
|
21
|
-
export declare function stringifyKey(key: string): string;
|
|
22
|
-
export declare function stringifyPropertyAccess(key: string): string;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Adapted from https://github.com/paritytech/capi-old copyright Parity Technologies (APACHE License 2.0)
|
|
3
|
-
* Changes August 19th 2023 :
|
|
4
|
-
* - updated to use subshape for scale decoding
|
|
5
|
-
* - adapted from deno to typescript
|
|
6
|
-
*
|
|
7
|
-
Copyright 2023 Parity Technologies
|
|
8
|
-
|
|
9
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
-
you may not use this file except in compliance with the License.
|
|
11
|
-
You may obtain a copy of the License at
|
|
12
|
-
|
|
13
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
-
|
|
15
|
-
Unless required by applicable law or agreed to in writing, software
|
|
16
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
-
See the License for the specific language governing permissions and
|
|
19
|
-
limitations under the License.
|
|
20
|
-
*/
|
|
21
|
-
export declare function normalizeIdent(ident: string): string;
|
|
22
|
-
export declare function normalizeDocs(docs: string[] | undefined): string;
|
|
23
|
-
export declare function normalizePackageName(name: string): string;
|
|
24
|
-
export declare function normalizeTypeName(name: string): string;
|
|
25
|
-
export declare function normalizeVariableName(name: string): string;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Adapted from https://github.com/paritytech/capi-old copyright Parity Technologies (APACHE License 2.0)
|
|
3
|
-
* Changes August 19th 2023 :
|
|
4
|
-
* - updated to use subshape for scale decoding
|
|
5
|
-
* - adapted from deno to typescript
|
|
6
|
-
*
|
|
7
|
-
Copyright 2023 Parity Technologies
|
|
8
|
-
|
|
9
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
-
you may not use this file except in compliance with the License.
|
|
11
|
-
You may obtain a copy of the License at
|
|
12
|
-
|
|
13
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
-
|
|
15
|
-
Unless required by applicable law or agreed to in writing, software
|
|
16
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
-
See the License for the specific language governing permissions and
|
|
19
|
-
limitations under the License.
|
|
20
|
-
*/
|
|
21
|
-
export interface MapLike<K, V> {
|
|
22
|
-
set(key: K, value: V): void;
|
|
23
|
-
get(key: K): undefined | V;
|
|
24
|
-
}
|
|
25
|
-
export declare function getOrInit<K, V>(container: MapLike<K, V>, key: K, init: () => V): V;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { MetadataV14 } from "../capi";
|
|
2
|
-
export type TyMV14 = MetadataV14["tys"][0];
|
|
3
|
-
export type PalletMV14 = MetadataV14["pallets"][0];
|
|
4
|
-
export type StorageEntryMV14 = NonNullable<PalletMV14["storage"]>["entries"][0];
|
|
5
|
-
export declare const getMetadataVersion: (metadataRpc: `0x${string}`) => number;
|
|
6
|
-
export declare const filterMetadataPalletsAndItems: (metadata: MetadataV14, palletsAndItems: {
|
|
7
|
-
pallet: (pallet: PalletMV14) => boolean;
|
|
8
|
-
items: ((item: StorageEntryMV14) => boolean)[];
|
|
9
|
-
}[], extraKeepTypes?: number[]) => void;
|
|
10
|
-
export declare const addDependentTypes: (metadataTysMap: Map<TyMV14["id"], TyMV14>, keepTypes: Set<number>, types: number[], addedTypes?: Set<number>) => void;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This module is largely copied from https://github.com/0xKheops/substrate-metadata-explorer/blob/4b5a991e5ced45cad3b8675ff9104b8366d20429/packages/sme-codegen/src/types/getShape.ts
|
|
3
|
-
*
|
|
4
|
-
* The primary difference between this module and `sme-codegen` is in the output.
|
|
5
|
-
*
|
|
6
|
-
* The `sme-codegen` module exports typescript code as a string, which can then be interpretted in order to construct subshape objects.
|
|
7
|
-
*
|
|
8
|
-
* Whereas this module directly exports the subshape objects described by that code.
|
|
9
|
-
*/
|
|
10
|
-
import * as $ from "@talismn/subshape-fork";
|
|
11
|
-
import { MetadataV14, Ty } from "../capi";
|
|
12
|
-
type GotShapes = Map<string, $.AnyShape>;
|
|
13
|
-
export declare const getShape: (metadata: MetadataV14, typeId: number, gotShapes?: GotShapes) => $.AnyShape;
|
|
14
|
-
export declare const getTypeShape: (metadata: MetadataV14, type: Ty, gotShapes: GotShapes) => $.AnyShape;
|
|
15
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This module is largely copied from https://github.com/0xKheops/substrate-metadata-explorer/blob/4b5a991e5ced45cad3b8675ff9104b8366d20429/packages/sme-codegen/src/types/getConstantVariableName.ts
|
|
3
|
-
*
|
|
4
|
-
* The primary difference between this module and `sme-codegen` is in the output.
|
|
5
|
-
*
|
|
6
|
-
* The `sme-codegen` module exports typescript code as a string, which can then be interpretted in order to construct subshape objects.
|
|
7
|
-
*
|
|
8
|
-
* Whereas this module directly exports the subshape objects described by that code.
|
|
9
|
-
*/
|
|
10
|
-
import { MetadataV14, Ty } from "../capi";
|
|
11
|
-
/** Returns a unique name (relative to all of the types in `metadata`) to identify this type. */
|
|
12
|
-
export declare const getTypeName: (metadata: MetadataV14, type: Ty) => string;
|
|
13
|
-
/**
|
|
14
|
-
* Tries each of `getSimpleTypeName`, `getSmartTypeName`, `getFullTypeName` in order and
|
|
15
|
-
* returns the first name which is unique in the collection of types in `metadata`.
|
|
16
|
-
*/
|
|
17
|
-
export declare const getUniqueTypeName: (metadata: MetadataV14, type: Ty) => string;
|
|
18
|
-
/** Gets "Type" + type number */
|
|
19
|
-
export declare const getRawTypeName: (type: Ty) => string;
|
|
20
|
-
/** Gets the last element of `type.path` */
|
|
21
|
-
export declare const getSimpleTypeName: (type: Ty) => string;
|
|
22
|
-
/** Gets the first two elements, and the last element, of `type.path` and joins them together with `::` */
|
|
23
|
-
export declare const getSmartTypeName: (type: Ty) => string;
|
|
24
|
-
/** Gets all elements of `type.path` and joins them together with `::` */
|
|
25
|
-
export declare const getFullTypeName: (type: Ty) => string;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This module is largely copied from https://github.com/0xKheops/substrate-metadata-explorer/tree/4b5a991e5ced45cad3b8675ff9104b8366d20429/packages/sme-codegen
|
|
3
|
-
*
|
|
4
|
-
* The primary difference between this module and `sme-codegen` is in the output.
|
|
5
|
-
*
|
|
6
|
-
* The `sme-codegen` module exports typescript code as a string, which can then be interpretted in order to construct subshape objects.
|
|
7
|
-
*
|
|
8
|
-
* Whereas this module directly exports the subshape objects described by that code.
|
|
9
|
-
*/
|
|
10
|
-
export * from "./getShape";
|
|
11
|
-
export * from "./getTypeName";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function suppressPortableRegistryConsoleWarnings(): void;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var utilCrypto = require('@polkadot/util-crypto');
|
|
4
|
-
|
|
5
|
-
class Xxhash {
|
|
6
|
-
input = new Uint8Array();
|
|
7
|
-
constructor(rounds) {
|
|
8
|
-
this.rounds = rounds;
|
|
9
|
-
}
|
|
10
|
-
update(input) {
|
|
11
|
-
this.input = input;
|
|
12
|
-
}
|
|
13
|
-
digest() {
|
|
14
|
-
return utilCrypto.xxhashAsU8a(this.input, this.rounds * 64);
|
|
15
|
-
}
|
|
16
|
-
digestInto(digest) {
|
|
17
|
-
digest.set(this.digest());
|
|
18
|
-
}
|
|
19
|
-
dispose() {
|
|
20
|
-
this.input = new Uint8Array();
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
class Blake2b {
|
|
24
|
-
input = new Uint8Array();
|
|
25
|
-
|
|
26
|
-
// digestSize defaults to 64
|
|
27
|
-
// https://github.com/paritytech/wat-the-crypto/blob/a96745c57f597b35fe1461d0e643a34ba5e7bd85/blake2b/blake2b.ts#L31
|
|
28
|
-
constructor(digestSize = 64) {
|
|
29
|
-
this.digestSize = digestSize;
|
|
30
|
-
}
|
|
31
|
-
update(input) {
|
|
32
|
-
this.input = input;
|
|
33
|
-
}
|
|
34
|
-
digest() {
|
|
35
|
-
return utilCrypto.blake2AsU8a(this.input, this.digestSize * 8);
|
|
36
|
-
}
|
|
37
|
-
digestInto(digest) {
|
|
38
|
-
digest.set(this.digest());
|
|
39
|
-
}
|
|
40
|
-
dispose() {
|
|
41
|
-
this.input = new Uint8Array();
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
exports.Blake2b = Blake2b;
|
|
46
|
-
exports.Xxhash = Xxhash;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { xxhashAsU8a, blake2AsU8a } from '@polkadot/util-crypto';
|
|
2
|
-
|
|
3
|
-
class Xxhash {
|
|
4
|
-
input = new Uint8Array();
|
|
5
|
-
constructor(rounds) {
|
|
6
|
-
this.rounds = rounds;
|
|
7
|
-
}
|
|
8
|
-
update(input) {
|
|
9
|
-
this.input = input;
|
|
10
|
-
}
|
|
11
|
-
digest() {
|
|
12
|
-
return xxhashAsU8a(this.input, this.rounds * 64);
|
|
13
|
-
}
|
|
14
|
-
digestInto(digest) {
|
|
15
|
-
digest.set(this.digest());
|
|
16
|
-
}
|
|
17
|
-
dispose() {
|
|
18
|
-
this.input = new Uint8Array();
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
class Blake2b {
|
|
22
|
-
input = new Uint8Array();
|
|
23
|
-
|
|
24
|
-
// digestSize defaults to 64
|
|
25
|
-
// https://github.com/paritytech/wat-the-crypto/blob/a96745c57f597b35fe1461d0e643a34ba5e7bd85/blake2b/blake2b.ts#L31
|
|
26
|
-
constructor(digestSize = 64) {
|
|
27
|
-
this.digestSize = digestSize;
|
|
28
|
-
}
|
|
29
|
-
update(input) {
|
|
30
|
-
this.input = input;
|
|
31
|
-
}
|
|
32
|
-
digest() {
|
|
33
|
-
return blake2AsU8a(this.input, this.digestSize * 8);
|
|
34
|
-
}
|
|
35
|
-
digestInto(digest) {
|
|
36
|
-
digest.set(this.digest());
|
|
37
|
-
}
|
|
38
|
-
dispose() {
|
|
39
|
-
this.input = new Uint8Array();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export { Blake2b, Xxhash };
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var utilCrypto = require('@polkadot/util-crypto');
|
|
4
|
-
|
|
5
|
-
class Xxhash {
|
|
6
|
-
input = new Uint8Array();
|
|
7
|
-
constructor(rounds) {
|
|
8
|
-
this.rounds = rounds;
|
|
9
|
-
}
|
|
10
|
-
update(input) {
|
|
11
|
-
this.input = input;
|
|
12
|
-
}
|
|
13
|
-
digest() {
|
|
14
|
-
return utilCrypto.xxhashAsU8a(this.input, this.rounds * 64);
|
|
15
|
-
}
|
|
16
|
-
digestInto(digest) {
|
|
17
|
-
digest.set(this.digest());
|
|
18
|
-
}
|
|
19
|
-
dispose() {
|
|
20
|
-
this.input = new Uint8Array();
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
class Blake2b {
|
|
24
|
-
input = new Uint8Array();
|
|
25
|
-
|
|
26
|
-
// digestSize defaults to 64
|
|
27
|
-
// https://github.com/paritytech/wat-the-crypto/blob/a96745c57f597b35fe1461d0e643a34ba5e7bd85/blake2b/blake2b.ts#L31
|
|
28
|
-
constructor(digestSize = 64) {
|
|
29
|
-
this.digestSize = digestSize;
|
|
30
|
-
}
|
|
31
|
-
update(input) {
|
|
32
|
-
this.input = input;
|
|
33
|
-
}
|
|
34
|
-
digest() {
|
|
35
|
-
return utilCrypto.blake2AsU8a(this.input, this.digestSize * 8);
|
|
36
|
-
}
|
|
37
|
-
digestInto(digest) {
|
|
38
|
-
digest.set(this.digest());
|
|
39
|
-
}
|
|
40
|
-
dispose() {
|
|
41
|
-
this.input = new Uint8Array();
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
exports.Blake2b = Blake2b;
|
|
46
|
-
exports.Xxhash = Xxhash;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var watTheCrypto = require('wat-the-crypto');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, 'Blake2b', {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function () { return watTheCrypto.Blake2b; }
|
|
10
|
-
});
|
|
11
|
-
Object.defineProperty(exports, 'Xxhash', {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
get: function () { return watTheCrypto.Xxhash; }
|
|
14
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var watTheCrypto = require('wat-the-crypto');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, 'Blake2b', {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function () { return watTheCrypto.Blake2b; }
|
|
10
|
-
});
|
|
11
|
-
Object.defineProperty(exports, 'Xxhash', {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
get: function () { return watTheCrypto.Xxhash; }
|
|
14
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Blake2b, Xxhash } from 'wat-the-crypto';
|