import type { BN } from '@polkadot/util'; import type { Codec, CodecClass } from './codec.js'; import type { AnyTuple, LookupString } from './helpers.js'; import type { ICompact, IEnum, IMap, IMethod, INumber, IOption, IResult, ISet, IStruct, ITuple, IU8a, IVec } from './interfaces.js'; export type OnlyCodec = K extends keyof Types ? Types[K] : T extends ICompact | IEnum | IMap | IMethod | INumber | IOption | IResult | ISet | IStruct | ITuple | IU8a | IVec ? T : T extends Codec ? T : never; export interface RegistryError { args: string[]; docs: string[]; index: number; method: string; name: string; section: string; } export type RegistryTypes = Record | { _enum: string[] | Record | Record; } | { _set: Record; }>; export interface CodecCreateOptions { blockHash?: Uint8Array | string | null | undefined; isFallback?: boolean; isOptional?: boolean; isPedantic?: boolean; } export interface CallBase extends IMethod { readonly method: string; readonly section: string; toJSON: () => any; } export interface CallFunction extends CallBase { (...args: any[]): IMethod; } export interface Registry { readonly chainDecimals: number[]; readonly chainIsEthereum: boolean; readonly chainSS58: number | undefined; readonly chainTokens: string[]; createdAtHash?: IU8a; findMetaCall(callIndex: Uint8Array): CallFunction; findMetaError(errorIndex: Uint8Array | { error: BN; index: BN; } | { error: BN | Uint8Array; index: BN; }): RegistryError; findMetaEvent(eventIndex: Uint8Array): CodecClass; isLookupType(value: string): value is LookupString; createLookupType(lookupId: ICompact | number): LookupString; createClassUnsafe(type: K): CodecClass; createTypeUnsafe(type: K, params: unknown[], options?: CodecCreateOptions): T; get(...params: never[]): any; getClassName(clazz: CodecClass): string | undefined; getOrThrow(name: K, msg?: string): CodecClass; getOrUnknown(name: K): CodecClass; getTransactionExtensionVersion(): number; getSignedExtensionExtra(): Record; getSignedExtensionTypes(): Record; hasClass(name: string): boolean; hasDef(name: string): boolean; hasType(name: string): boolean; hash(data: Uint8Array): IU8a; register(type: CodecClass | RegistryTypes): void; register(name: string, type: CodecClass): void; register(arg1: string | CodecClass | RegistryTypes, arg2?: CodecClass): void; setMetadata(metadata: unknown, signedExtensions?: string[], userExtensions?: unknown, noInitWarn?: boolean): void; }