Pezkuwi API
    Preparing search index...

    @pezkuwi/rpc-provider

    HttpProvider

    The HTTP Provider allows sending requests using HTTP to a HTTP RPC server TCP port. It does not support subscriptions so you won't be able to listen to events such as new blocks or balance changes. It is usually preferable using the [[WsProvider]].


    import Api from '@pezkuwi/api/promise';
    import { HttpProvider } from '@pezkuwi/rpc-provider';

    const provider = new HttpProvider('http://127.0.0.1:9933');
    const api = new Api(provider);

    [[WsProvider]]

    Implements

    • ProviderInterface
    Index
    • Parameters

      • endpoint: string = defaults.HTTP_URL

        The endpoint url starting with http://

      • headers: Record<string, string> = {}

        The headers provided to the underlying Http Endpoint

      • OptionalcacheCapacity: number

        Custom size of the HttpProvider LRUCache. Defaults to DEFAULT_CAPACITY (1024)

      • OptionalcacheTtl: number | null

        Custom TTL of the HttpProvider LRUCache. Determines how long an object can live in the cache. Defaults to DEFAULT_TTL (30000)

      Returns HttpProvider

    • get hasSubscriptions(): boolean

      Returns boolean

    • get isClonable(): boolean

      Returns boolean

    • get isConnected(): boolean

      Returns boolean

      true if connected

    • get stats(): ProviderStats

      Returns ProviderStats

      Returns the connection stats

    • get ttl(): number | null | undefined

      Returns number | null | undefined

      Returns the connection stats

    • Returns Promise<void>

      Manually connect from the connection

    • Returns Promise<void>

      Manually disconnect from the connection

    • Parameters

      • _type: ProviderInterfaceEmitted
      • _sub: ProviderInterfaceEmitCb

      Returns () => void

      HTTP Provider does not have 'on' emitters. WebSockets should be used instead.

    • Type Parameters

      • T

      Parameters

      • method: string
      • params: unknown[]
      • OptionalisCacheable: boolean

      Returns Promise<T>

    • Parameters

      • _types: string
      • _method: string
      • _params: unknown[]
      • _cb: ProviderInterfaceCallback

      Returns Promise<number>

    • Parameters

      • _type: string
      • _method: string
      • _id: number

      Returns Promise<boolean>