UNPKG

818 BTypeScriptView Raw
1import { JsonRpcMiddleware } from 'json-rpc-engine';
2import { Payload, Block } from './utils/cache';
3interface PayloadwithOrgin extends Payload {
4 origin?: string;
5}
6interface Request {
7 method: string;
8 headers: Record<string, string>;
9 body: string;
10}
11interface FetchConfig {
12 fetchUrl: string;
13 fetchParams: Request;
14}
15interface FetchMiddlewareOptions {
16 rpcUrl: string;
17 originHttpHeaderKey?: string;
18}
19interface FetchMiddlewareFromReqOptions extends FetchMiddlewareOptions {
20 req: PayloadwithOrgin;
21}
22export declare function createFetchMiddleware({ rpcUrl, originHttpHeaderKey, }: FetchMiddlewareOptions): JsonRpcMiddleware<string[], Block>;
23export declare function createFetchConfigFromReq({ req, rpcUrl, originHttpHeaderKey, }: FetchMiddlewareFromReqOptions): FetchConfig;
24export {};