@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.
@@ -1,6 +1,8 @@
1
- export { getDynamicBuilder, getLookupFn } from "@polkadot-api/metadata-builders";
2
- export type { V14, V15, V15Extrinsic, Codec, Binary } from "@polkadot-api/substrate-bindings";
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 { v14, v15, metadata } from "@polkadot-api/substrate-bindings";
8
+ export type MetadataBuilder = ReturnType<typeof getDynamicBuilder>;
@@ -0,0 +1,3 @@
1
+ export type Prettify<T> = {
2
+ [K in keyof T]: T[K];
3
+ } & {};
@@ -1,10 +1,11 @@
1
- import { V14, V15 } from "../papito";
2
- export type V14Type = V14["lookup"][0];
3
- export type V14Pallet = V14["pallets"][0];
4
- export type V14StorageItem = NonNullable<V14Pallet["storage"]>["items"][0];
5
- export type V15Type = V15["lookup"][0];
6
- export type V15Pallet = V15["pallets"][0];
7
- export type V15StorageItem = NonNullable<V15Pallet["storage"]>["items"][0];
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: (metadata: V15 | V14, palletsAndItems?: Array<{
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 { getDynamicBuilder } from "@polkadot-api/metadata-builders";
2
- type ScaleStorageCoder = ReturnType<ReturnType<typeof getDynamicBuilder>["buildStorage"]>;
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 { V14, V15 } from "@polkadot-api/substrate-bindings";
2
- export declare const encodeMetadata: ({ metadata, tag, }: {
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 { getDynamicBuilder } from "@polkadot-api/metadata-builders";
2
- type ScaleStorageCoder = ReturnType<ReturnType<typeof getDynamicBuilder>["buildStorage"]>;
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";