import { JsonRpcProvider } from '@polkadot-api/json-rpc-provider'; export { JsonRpcProvider } from '@polkadot-api/json-rpc-provider'; import { HexString, Codec, ResultPayload } from '@polkadot-api/substrate-bindings'; export { AccountId, Binary, BlockHeader, Codec, Enum, EnumVariant, GetEnum, HexString, ResultPayload, SS58AddressInfo, SS58String, SizedHex, _Enum, getSs58AddressInfo } from '@polkadot-api/substrate-bindings'; import { P as PolkadotClient, C as ChainDefinition, O as OfflineApi, D as DescriptorEntry, S as StorageDescriptor, T as TxDescriptor, a as PlainDescriptor, R as RuntimeDescriptor } from '../types-DGFm0iG3.js'; export { A as ApisFromDef, b as ApisTypedef, c as ConstFromPalletsDef, E as ErrorsFromPalletsDef, d as EventPhase, e as EventsFromPalletsDef, F as FixedSizeArray, f as PalletsTypedef, Q as QueryFromPalletsDef, g as Transaction, h as TransactionValidityError, i as TxBroadcasted, j as TxCallData, k as TxCreated, l as TxEntry, m as TxEvent, n as TxEventsPayload, o as TxFinalized, p as TxFinalizedPayload, q as TxFromPalletsDef, r as TxInBestBlock, s as TxNotInBestBlock, t as TypedApi, V as ViewFnsFromPalletsDef } from '../types-DGFm0iG3.js'; export { CompatibilityLevel } from '@polkadot-api/metadata-compatibility'; export { BlockInfo, BlockNotPinnedError } from '@polkadot-api/observable-client'; export { TxCreator } from '@polkadot-api/tx-creator'; export { DescriptorValues } from '@polkadot-api/codegen'; import '@polkadot-api/substrate-client'; import 'rxjs'; declare class InvalidTxError extends Error { error: any; constructor(e: any); } type CreateClientOptions = Partial<{ getMetadata: (codeHash: HexString) => Promise; setMetadata: (codeHash: HexString, metadata: Uint8Array) => void; }>; /** * This is the top-level export for `polkadot-api`. * * @param provider A `JsonRpcProvider` compliant with the [JSON-RPC * spec](https://paritytech.github.io/json-rpc-interface-spec/), * which must support the `chainHead`, `transaction` and * `chainSpec` groups. * @param options - *(Optional)* An object that allows customization of * metadata handling. * You can supply functions to retrieve and/or persist the * metadata associated with runtime `codeHash` values: * * - `getMetadata`: A function that, given a `codeHash` (the * `:code:` hash), * returns a `Promise` resolving to a `Uint8Array` * representing the metadata, * or `null` if unavailable. * - `setMetadata`: A function that accepts a `codeHash` and * its associated `Uint8Array` metadata, * allowing you to persist the metadata (e.g., in a cache or * local store). * @example * * import { getMetadata } from "@polkadot-api/descriptors" * import { createClient } from "polkadot-api" * import { getSmProvider } from "polkadot-api/sm-provider" * import { chainSpec } from "polkadot-api/chains/polkadot" * import { start } from "polkadot-api/smoldot" * * const smoldot = start() * const chain = await smoldot.addChain({ chainSpec }) * * // Connect to the polkadot relay chain. * const client = createClient(getSmProvider(chain), { getMetadata }) * */ declare function createClient(provider: JsonRpcProvider, { getMetadata, setMetadata }?: CreateClientOptions): PolkadotClient; /** * Asynchronously create an instance of `OfflineApi`. * OfflineApi allows to create and sign transactions and access chain constants. * * @param chainDefinition Pass descriptors from `@polkadot-api/descriptors` * generated by `papi` CLI. * @param hasher Blockchain's hasher. Defaults to `Blake2256` */ declare const getOfflineApi: (chainDefinition: D, hasher?: (payload: Uint8Array) => Uint8Array) => Promise>; type Tuple = [T, ...T[]]; type UnionToIntersection = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; type UndoEnum = UnionToIntersection; type _Inner = T extends void ? {} : undefined extends T ? { inner: ShapedCodec>; } : T extends string | number | bigint | boolean | void | undefined | null | symbol | Uint8Array ? {} : T extends Tuple ? { inner: { [K in keyof T]: ShapedCodec; }; } : T extends Array ? { inner: ShapedCodec; } : T extends ResultPayload ? { inner: { ok: ShapedCodec; ko: ShapedCodec; }; } : { inner: { [K in keyof T]: ShapedCodec; }; }; type Inner = _Inner>; type ShapedCodec = Codec & Inner; type StorageCodecs, T> = { args: ShapedCodec; value: ShapedCodec; }; type ExtractStorageCodec>> = { [K in keyof T]: { [KK in keyof T[K]]: T[K][KK] extends StorageDescriptor ? StorageCodecs : unknown; }; }; type ExtractTxCodec>> = { [K in keyof T]: { [KK in keyof T[K]]: T[K][KK] extends TxDescriptor ? ShapedCodec : unknown; }; }; type ExtractRuntimeCodec>> = { [K in keyof T]: { [KK in keyof T[K]]: T[K][KK] extends RuntimeDescriptor ? { args: ShapedCodec; value: ShapedCodec; } : unknown; }; }; type ExtractPlainCodec>> = { [K in keyof T]: { [KK in keyof T[K]]: T[K][KK] extends PlainDescriptor ? ShapedCodec : unknown; }; }; type TypedCodecs = { query: ExtractStorageCodec; tx: ExtractTxCodec; event: ExtractPlainCodec; apis: ExtractRuntimeCodec; constants: ExtractPlainCodec; view: ExtractRuntimeCodec; }; /** * It provides access the codecs of all possible on-chain interactions. * * @param descriptors Pass descriptors from `@polkadot-api/descriptors` * generated by `papi` CLI. */ declare const getTypedCodecs: (descriptors: D) => Promise>; export { ChainDefinition, DescriptorEntry, InvalidTxError, OfflineApi, PlainDescriptor, PolkadotClient, RuntimeDescriptor, StorageDescriptor, TxDescriptor, createClient, getOfflineApi, getTypedCodecs }; export type { CreateClientOptions };