@talismn/scale 0.1.1 → 0.2.0
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/papito.d.ts +5 -3
- package/dist/declarations/src/util/Prettify.d.ts +3 -0
- package/dist/declarations/src/util/compactMetadata.d.ts +10 -8
- package/dist/declarations/src/util/decodeScale.d.ts +2 -2
- package/dist/declarations/src/util/encodeMetadata.d.ts +2 -8
- package/dist/declarations/src/util/encodeStateKey.d.ts +3 -4
- package/dist/declarations/src/util/getStorageKeyPrefix.d.ts +1 -0
- package/dist/declarations/src/util/hash.d.ts +1 -0
- package/dist/declarations/src/util/index.d.ts +3 -1
- package/dist/declarations/src/util/parseMetadataRpc.d.ts +835 -0
- package/dist/talismn-scale.cjs.dev.js +105 -77
- package/dist/talismn-scale.cjs.prod.js +105 -77
- package/dist/talismn-scale.esm.js +66 -70
- package/package.json +6 -6
- package/dist/declarations/src/util/decodeMetadata.d.ts +0 -13
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
import { getDynamicBuilder } from "@polkadot-api/metadata-builders";
|
|
2
|
+
export { getDynamicBuilder, getLookupFn, type MetadataLookup, } from "@polkadot-api/metadata-builders";
|
|
3
|
+
export type { Codec, UnifiedMetadata } from "@polkadot-api/substrate-bindings";
|
|
4
|
+
export { decAnyMetadata, unifyMetadata, metadata } from "@polkadot-api/substrate-bindings";
|
|
3
5
|
export { toHex, fromHex } from "@polkadot-api/utils";
|
|
4
6
|
/** Constant: https://docs.substrate.io/build/application-development/#metadata-format */
|
|
5
7
|
export declare const magicNumber = 1635018093;
|
|
6
|
-
export
|
|
8
|
+
export type MetadataBuilder = ReturnType<typeof getDynamicBuilder>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type
|
|
3
|
-
export type
|
|
4
|
-
export type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { Metadata } from "@polkadot-api/substrate-bindings";
|
|
2
|
+
export type MetadataType = SupportedMetadata["lookup"][number];
|
|
3
|
+
export type MetadataPallet = SupportedMetadata["pallets"][number];
|
|
4
|
+
export type MetadataStorageItem = NonNullable<MetadataPallet["storage"]>["items"][number];
|
|
5
|
+
type SupportedMetadata = Extract<Metadata["metadata"], {
|
|
6
|
+
tag: SupportedMetadataVersion;
|
|
7
|
+
}>["value"];
|
|
8
|
+
type SupportedMetadataVersion = "v14" | "v15" | "v16";
|
|
8
9
|
/**
|
|
9
10
|
* Converts a `Metadata` into a `MiniMetadata`.
|
|
10
11
|
*
|
|
@@ -14,7 +15,7 @@ export type V15StorageItem = NonNullable<V15Pallet["storage"]>["items"][0];
|
|
|
14
15
|
* E.g. if `palletsAndItems` is `{ pallet: "System", items: ["Account"] }`, then only the
|
|
15
16
|
* types used in the `System.Account` storage query will remain inside of metadata.lookups.
|
|
16
17
|
*/
|
|
17
|
-
export declare const compactMetadata: (
|
|
18
|
+
export declare const compactMetadata: (anyMetadata: Metadata, palletsAndItems?: Array<{
|
|
18
19
|
pallet: string;
|
|
19
20
|
constants?: string[];
|
|
20
21
|
items: string[];
|
|
@@ -22,3 +23,4 @@ export declare const compactMetadata: (metadata: V15 | V14, palletsAndItems?: Ar
|
|
|
22
23
|
runtimeApi: string;
|
|
23
24
|
methods: string[];
|
|
24
25
|
}>, extraKeepTypes?: number[]) => void;
|
|
26
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type ScaleStorageCoder = ReturnType<
|
|
1
|
+
import { MetadataBuilder } from "../papito";
|
|
2
|
+
type ScaleStorageCoder = ReturnType<MetadataBuilder["buildStorage"]>;
|
|
3
3
|
export declare const decodeScale: <T>(scaleCoder: ScaleStorageCoder | undefined, change: string | null, error?: string) => T | null;
|
|
4
4
|
export {};
|
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const encodeMetadata: (
|
|
3
|
-
metadata: V15;
|
|
4
|
-
tag: "v15";
|
|
5
|
-
} | {
|
|
6
|
-
metadata: V14;
|
|
7
|
-
tag: "v14";
|
|
8
|
-
}) => string;
|
|
1
|
+
import { Metadata } from "@polkadot-api/substrate-bindings";
|
|
2
|
+
export declare const encodeMetadata: (metadata: Metadata) => `0x${string}`;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type ScaleStorageCoder = ReturnType<
|
|
3
|
-
export declare const encodeStateKey: (scaleCoder: ScaleStorageCoder | undefined, error?: string, ...args: any[]) => string | undefined;
|
|
4
|
-
export {};
|
|
1
|
+
import { MetadataBuilder } from "../papito";
|
|
2
|
+
export type ScaleStorageCoder = ReturnType<MetadataBuilder["buildStorage"]>;
|
|
3
|
+
export declare const encodeStateKey: (scaleCoder: ScaleStorageCoder | undefined, error?: string, ...args: any[]) => `0x${string}` | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getStorageKeyPrefix: (palletName: string, storageName: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Twox128, Blake2128, Blake2128Concat, Blake2256, Blake3256, Blake3256Concat, Twox256, Twox64Concat, } from "@polkadot-api/substrate-bindings";
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export * from "./compactMetadata";
|
|
2
|
-
export * from "./decodeMetadata";
|
|
3
2
|
export * from "./decodeScale";
|
|
4
3
|
export * from "./encodeMetadata";
|
|
5
4
|
export * from "./encodeStateKey";
|
|
6
5
|
export * from "./getMetadataVersion";
|
|
7
6
|
export * from "./serdePapi";
|
|
7
|
+
export * from "./parseMetadataRpc";
|
|
8
|
+
export * from "./getStorageKeyPrefix";
|
|
9
|
+
export * from "./hash";
|