ProviderOptions: {
    cache?: ProviderCacheJson;
    fetch?: ((url: string, requestInit?: RequestInit, providerOptions?: Omit<ProviderOptions, "fetch">) => Promise<Response>);
    headers?: RequestInit["headers"];
    requestMiddleware?: ((request: RequestInit) => RequestInit | Promise<RequestInit>);
    resourceCacheTTL?: number;
    retryOptions?: RetryOptions;
    timeout?: number;
}

Type declaration

  • Optionalcache?: ProviderCacheJson

    The cache can be passed in to avoid re-fetching the chain + node info.

  • Optionalfetch?: ((url: string, requestInit?: RequestInit, providerOptions?: Omit<ProviderOptions, "fetch">) => Promise<Response>)

    Custom fetch function to use for making requests.

      • (url, requestInit?, providerOptions?): Promise<Response>
      • Parameters

        • url: string
        • OptionalrequestInit: RequestInit
        • OptionalproviderOptions: Omit<ProviderOptions, "fetch">

        Returns Promise<Response>

  • Optionalheaders?: RequestInit["headers"]

    Custom headers to include in the request.

  • OptionalrequestMiddleware?: ((request: RequestInit) => RequestInit | Promise<RequestInit>)

    Middleware to modify the request before it is sent. This can be used to add headers, modify the body, etc.

      • (request): RequestInit | Promise<RequestInit>
      • Parameters

        • request: RequestInit

        Returns RequestInit | Promise<RequestInit>

  • OptionalresourceCacheTTL?: number

    Resources cache for the given time [ms]. If set to -1, the cache will be disabled.

  • OptionalretryOptions?: RetryOptions

    Retry options to use when fetching data from the node.

  • Optionaltimeout?: number

    Timeout [ms] after which every request will be aborted.