import { HexString, Enum, Binary, Descriptors, QueryFromDescriptors, TxFromDescriptors, EventsFromDescriptors, ConstFromDescriptors, BlockHeader, RuntimeDescriptor } from '@polkadot-api/substrate-bindings'; export { AccountId, AssetDescriptor, Binary, Codec, ConstFromDescriptors, Enum, ErrorsFromDescriptors, EventsFromDescriptors, FixedSizeBinary, GetEnum, HexString, PlainDescriptor, QueryFromDescriptors, ResultPayload, RuntimeDescriptor, SS58String, StorageDescriptor, TxDescriptor, TxFromDescriptors, _Enum } from '@polkadot-api/substrate-bindings'; import { Observable } from 'rxjs'; import { BlockInfo, SystemEvent as SystemEvent$1 } from '@polkadot-api/observable-client'; import { JsonRpcProvider } from '@polkadot-api/json-rpc-provider'; export { PolkadotSigner } from '@polkadot-api/polkadot-signer'; declare class Runtime { protected _ctx: unknown; protected _checksums: string[]; private constructor(); } type RuntimeApi = Observable & { latest: () => Promise; }; interface IsCompatible { (): Promise; (runtime: Runtime): boolean; } type EventPhase = { type: "ApplyExtrinsic"; value: number; } | { type: "Finalization"; } | { type: "Initialization"; }; type EvWatch = (filter?: (value: T) => boolean) => Observable<{ meta: { block: BlockInfo; phase: EventPhase; }; payload: T; }>; type EvPull = () => Promise>; type EvFilter = (collection: SystemEvent["event"][]) => Array; type EvClient = { watch: EvWatch; pull: EvPull; filter: EvFilter; isCompatible: IsCompatible; }; type SystemEvent = { phase: EventPhase; event: { type: string; value: { type: string; value: any; }; }; topics: Array; }; type CallOptions$1 = Partial<{ at: string; signal: AbortSignal; }>; type WithCallOptions$1> = [ ...args: Args, options?: CallOptions$1 ]; type PossibleParents> = A extends [...infer Left, any] ? Left | PossibleParents : []; type StorageEntryWithoutKeys = { isCompatible: IsCompatible; getValue: (options?: CallOptions$1) => Promise; watchValue: (bestOrFinalized?: "best" | "finalized") => Observable; }; type StorageEntryWithKeys, Payload> = { isCompatible: IsCompatible; getValue: (...args: [...WithCallOptions$1]) => Promise; watchValue: (...args: [...Args, bestOrFinalized?: "best" | "finalized"]) => Observable; getValues: (keys: Array<[...Args]>, options?: CallOptions$1) => Promise>; getEntries: (...args: WithCallOptions$1>) => Promise; }>>; }; type StorageEntry, Payload> = Args extends [] ? StorageEntryWithoutKeys : StorageEntryWithKeys; interface PolkadotSigner { publicKey: Uint8Array; sign: (callData: Uint8Array, signedExtensions: Record, metadata: Uint8Array, atBlockNumber: number, hasher?: (data: Uint8Array) => Uint8Array) => Promise; } type TxBroadcastEvent = { type: "broadcasted"; } | { type: "bestChainBlockIncluded"; block: { hash: string; index: number; }; } | ({ type: "finalized"; } & TxFinalizedPayload); type TxEvent = TxBroadcastEvent | { type: "signed"; tx: HexString; }; type TxFinalizedPayload = { ok: boolean; events: Array; block: { hash: string; index: number; }; }; type TxFunction = (from: PolkadotSigner, hintedSignExtensions?: Partial) => Promise; type TxObservable = (from: PolkadotSigner, hintedSignExtensions?: Partial) => Observable; interface TxCall { (): Promise; (runtime: Runtime): Binary; } type TxSigned = (from: PolkadotSigner, hintedSignExtensions?: Partial) => Promise; type Transaction = { sign: TxSigned; signSubmitAndWatch: TxObservable; signAndSubmit: TxFunction; getEncodedData: TxCall; decodedCall: Enum<{ type: Pallet; value: Enum<{ type: Name; value: Arg; }>; }>; }; interface TxEntry { (...args: Arg extends undefined ? [] : [data: Arg]): Transaction; isCompatible: IsCompatible; } interface ConstantEntry { (): Promise; (runtime: Runtime): T; isCompatible: IsCompatible; } type CallOptions = Partial<{ at: string; signal: AbortSignal; }>; type WithCallOptions> = Args["length"] extends 0 ? [options?: CallOptions] : [...args: Args, options?: CallOptions]; interface RuntimeCall, Payload> { (...args: WithCallOptions): Promise; isCompatible: IsCompatible; } type StorageApi; Value: any; IsOptional: false | true; } | unknown>>> = { [K in keyof A]: { [KK in keyof A[K]]: A[K][KK] extends { KeyArgs: Array; Value: any; IsOptional: false | true; } ? StorageEntry : unknown; }; }; type RuntimeCallsApi, any>>>> = { [K in keyof A]: { [KK in keyof A[K]]: A[K][KK] extends RuntimeDescriptor ? RuntimeCall : unknown; }; }; type TxApi>, Asset> = { [K in keyof A]: { [KK in keyof A[K]]: A[K][KK] extends {} | undefined ? TxEntry : unknown; }; }; type EvApi>> = { [K in keyof A]: { [KK in keyof A[K]]: EvClient; }; }; type ConstApi>> = { [K in keyof A]: { [KK in keyof A[K]]: ConstantEntry; }; }; type TypedApi = { query: StorageApi>; tx: TxApi, D["asset"]["_type"]>; event: EvApi>; apis: RuntimeCallsApi; constants: ConstApi>; runtime: RuntimeApi; }; interface PolkadotClient { finalized$: Observable; bestBlocks$: Observable; getBlockHeader: (hash?: string) => Promise; getBlockBody: (hash: string) => Observable; getTypedApi: (descriptors: D) => TypedApi; destroy: () => void; submit: (transaction: HexString) => Promise; submitAndWatch: (transaction: HexString) => Observable; } type FixedSizeArray = Array & { length: L; }; declare function createClient(provider: JsonRpcProvider): PolkadotClient; export { type EventPhase, type FixedSizeArray, type PolkadotClient, type TxBroadcastEvent, type TxEvent, type TxFinalizedPayload, type TypedApi, createClient };