Files
pezkuwi-api/packages/metadata-builders/dist/index.d.ts
T
pezkuwichain 31467f90d4 feat: add PAPI rebrand packages
- @pezkuwi/papi-utils (rebrand of @polkadot-api/utils)
- @pezkuwi/bizinikiwi-bindings (rebrand of @polkadot-api/substrate-bindings)
- @pezkuwi/metadata-builders (rebrand of @polkadot-api/metadata-builders)
- @pezkuwi/merkleize-metadata (rebrand of @polkadot-api/merkleize-metadata)

All @polkadot-api references replaced with @pezkuwi equivalents.
2026-01-22 15:40:12 +03:00

153 lines
5.0 KiB
TypeScript

import * as scale from '@pezkuwi/bizinikiwi-bindings';
import { StringRecord, UnifiedMetadata, V14Lookup, Codec } from '@pezkuwi/bizinikiwi-bindings';
type SignedPrimitive = "i8" | "i16" | "i32" | "i64" | "i128" | "i256";
type UnsignedPrimitive = "u8" | "u16" | "u32" | "u64" | "u128" | "u256";
type MetadataPrimitives = "bool" | "char" | "str" | SignedPrimitive | UnsignedPrimitive;
type PrimitiveVar = {
type: "primitive";
value: MetadataPrimitives;
};
type VoidVar = {
type: "void";
};
type CompactVar = {
type: "compact";
isBig: boolean;
size: UnsignedPrimitive;
};
type BitSequenceVar = {
type: "bitSequence";
isLSB: boolean;
};
type AccountId32 = {
type: "AccountId32";
};
type AccountId20 = {
type: "AccountId20";
};
type TerminalVar = PrimitiveVar | VoidVar | CompactVar | BitSequenceVar | AccountId32 | AccountId20;
type TupleVar = {
type: "tuple";
value: LookupEntry[];
innerDocs: Array<string[]>;
};
type StructVar = {
type: "struct";
value: StringRecord<LookupEntry>;
innerDocs: StringRecord<string[]>;
};
type EnumVar = {
type: "enum";
value: StringRecord<({
type: "lookupEntry";
value: LookupEntry;
} | VoidVar | TupleVar | StructVar | ArrayVar) & {
idx: number;
}>;
innerDocs: StringRecord<string[]>;
byteLength?: number;
};
type OptionVar = {
type: "option";
value: LookupEntry;
};
type ResultVar = {
type: "result";
value: {
ok: LookupEntry;
ko: LookupEntry;
};
};
type SequenceVar = {
type: "sequence";
value: LookupEntry;
};
type ArrayVar = {
type: "array";
value: LookupEntry;
len: number;
};
type ComposedVar = TupleVar | StructVar | SequenceVar | ArrayVar | OptionVar | ResultVar | EnumVar;
type Var = TerminalVar | ComposedVar;
type LookupEntry = {
id: number;
} & Var;
interface MetadataLookup {
(id: number): LookupEntry;
metadata: UnifiedMetadata;
call: number | null;
}
declare const denormalizeLookup: (lookupData: V14Lookup) => (id: number) => LookupEntry;
declare const getLookupFn: (metadata: UnifiedMetadata) => MetadataLookup;
declare const getDynamicBuilder: (getLookupEntryDef: MetadataLookup) => {
buildDefinition: (id: number) => Codec<any>;
buildStorage: (pallet: string, entry: string) => {
args: [scale.Encoder<any[]>, scale.Decoder<any[]>] & {
enc: scale.Encoder<any[]>;
dec: scale.Decoder<any[]>;
} & {
inner: Codec<any>[];
};
keys: {
enc: (...args: any[]) => string;
dec: (value: string) => any[];
};
value: Codec<any>;
len: number;
fallback: any;
};
buildEvent: (pallet: string, name: string) => {
codec: Codec<any>;
location: [number, number];
};
buildError: (pallet: string, name: string) => {
codec: Codec<any>;
location: [number, number];
};
buildViewFn: (pallet: string, entry: string) => {
args: [scale.Encoder<any[]>, scale.Decoder<any[]>] & {
enc: scale.Encoder<any[]>;
dec: scale.Decoder<any[]>;
} & {
inner: Codec<any>[];
};
value: Codec<any>;
};
buildRuntimeCall: (api: string, method: string) => {
args: [scale.Encoder<any[]>, scale.Decoder<any[]>] & {
enc: scale.Encoder<any[]>;
dec: scale.Decoder<any[]>;
} & {
inner: Codec<any>[];
};
value: Codec<any>;
};
buildCall: (pallet: string, name: string) => {
codec: Codec<any>;
location: [number, number];
};
buildConstant: (pallet: string, constantName: string) => Codec<any>;
ss58Prefix: number | undefined;
};
declare const getChecksumBuilder: (getLookupEntryDef: MetadataLookup) => {
buildDefinition: (id: number) => string | null;
buildRuntimeCall: (api: string, method: string) => string | null;
buildStorage: (pallet: string, entry: string) => string | null;
buildViewFns: (pallet: string, entry: string) => string | null;
buildCall: (pallet: string, name: string) => string | null;
buildEvent: (pallet: string, name: string) => string | null;
buildError: (pallet: string, name: string) => string | null;
buildConstant: (pallet: string, constantName: string) => string | null;
buildComposite: (input: VoidVar | TupleVar | StructVar | ArrayVar) => string | null;
buildNamedTuple: (input: StructVar) => string | null;
getAllGeneratedChecksums: () => string[];
};
declare const getLookupCodecBuilder: (lookup: (id: number) => LookupEntry, accountId?: Codec<scale.SS58String>) => (id: number) => Codec<any>;
export { denormalizeLookup, getChecksumBuilder, getDynamicBuilder, getLookupCodecBuilder, getLookupFn };
export type { AccountId20, AccountId32, ArrayVar, BitSequenceVar, CompactVar, ComposedVar, EnumVar, LookupEntry, MetadataLookup, MetadataPrimitives, OptionVar, PrimitiveVar, ResultVar, SequenceVar, SignedPrimitive, StructVar, TerminalVar, TupleVar, UnsignedPrimitive, Var, VoidVar };