2022-01-01 00:39:15 +00:00
|
|
|
export const Logging = {
|
2021-12-31 21:38:26 +00:00
|
|
|
verbose: false,
|
|
|
|
log(...args: any[]) {
|
2022-01-01 00:39:15 +00:00
|
|
|
if (Logging.verbose) {
|
|
|
|
console.log(...args);
|
2021-12-31 21:38:26 +00:00
|
|
|
}
|
2022-01-01 00:39:15 +00:00
|
|
|
},
|
|
|
|
};
|
2021-12-31 21:38:26 +00:00
|
|
|
|
|
|
|
export enum ErrorCodes {
|
2022-01-01 00:39:15 +00:00
|
|
|
ParseError = -32700,
|
2022-01-05 21:16:17 +00:00
|
|
|
InvalidRequest = -32600,
|
|
|
|
MethodNotFound = -32601,
|
|
|
|
InvalidParams = -32602,
|
|
|
|
InternalError = -32603,
|
2021-12-31 21:38:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface RequestObject {
|
|
|
|
jsonrpc: "2.0";
|
|
|
|
method: string;
|
|
|
|
params?: any[] | { [key: string]: any };
|
|
|
|
id?: string | null;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ResponseObject {
|
|
|
|
jsonrpc: "2.0";
|
|
|
|
result?: any;
|
2022-01-01 00:39:15 +00:00
|
|
|
error?: { code: ErrorCodes; message: string; data?: any };
|
2021-12-31 21:38:26 +00:00
|
|
|
id: string;
|
|
|
|
}
|