UNPKG

@gear-js/react-hooks

Version:
32 lines (31 loc) 876 B
import { GearApi } from '@gear-js/api'; import { ScProvider } from '@polkadot/api'; import { ProviderProps } from '../types'; type WsProviderArgs = { endpoint: string | string[]; autoConnectMs?: number | false; headers?: Record<string, string>; timeout?: number; }; type ScProviderArgs = { spec: string; sharedSandbox?: ScProvider; }; type ProviderArgs = WsProviderArgs | ScProviderArgs; type Value = { switchNetwork: (args: ProviderArgs) => Promise<void>; } & ({ api: undefined; isApiReady: false; isV110Runtime: false; } | { api: GearApi; isApiReady: true; isV110Runtime: boolean; }); type Props = ProviderProps & { initialArgs: ProviderArgs; }; declare function ApiProvider({ initialArgs, children }: Props): import("react/jsx-runtime").JSX.Element; declare const useApi: () => Value; export { ApiProvider, useApi };