JsonRPC/templates/ts_service_base.ts
K35 d5cfdcadc1 First Commit
Yes, that is what I do at 31.12.2021 at 22:39 local time...
2021-12-31 21:38:26 +00:00

31 lines
583 B
TypeScript

export const Logging = {
verbose: false,
log(...args: any[]) {
if(Logging.verbose) {
console.log(...args)
}
}
}
export enum ErrorCodes {
ParseError=-32700,
InvalidRequest=-32700,
MethodNotFound=-32700,
InvalidParams=-32700,
InternalError=-32700,
}
export interface RequestObject {
jsonrpc: "2.0";
method: string;
params?: any[] | { [key: string]: any };
id?: string | null;
}
export interface ResponseObject {
jsonrpc: "2.0";
result?: any;
error?: { code: ErrorCodes, message:string, data?: any}
id: string;
}