-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.d.ts
59 lines (48 loc) · 1.13 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
type version = '2.0'
type signature = {
readonly '@context': string[]
readonly id: string
readonly type: string
readonly controller: string
readonly expires: string
readonly publicKeyBase58: string
}
export interface JSONRPCResponseBase {
jsonrpc: version;
id: string | null;
}
export interface JSONRPCSuccessResponse extends JSONRPCResponseBase {
result: string;
error: never;
}
export interface JSONRPCErrorResponse extends JSONRPCResponseBase {
error: {
code: number;
message: string;
};
result: never;
}
export type JSONRPCResponse = JSONRPCSuccessResponse | JSONRPCErrorResponse;
type AuthParams = {
user: string
pass: string
}
type RequestParams<T> = T extends object ? T : string[]
export interface JSONRPCRequest {
url: string
body: {
jsonrpc: version
id: string
method: string
params: RequestParams<any>
}
headers?: Record<string, string>
auth?: AuthParams
credentials?: string
signature?: signature
}
declare const _default: (request: JSONRPCRequest) => Promise<JSONRPCResponse>;
export default _default;
declare module 'request-json-rpc2' {
export = _default;
}