MCPcopy Create free account
hub / github.com/Web3Auth/Auth / processResponse

Function processResponse

src/jrpc/jrpc.ts:88–100  ·  view source on GitHub ↗
(res: JRPCResponse<unknown>)

Source from the content-addressed store, hash-verified

86 const events = new SafeEventEmitter<StreamEvents>();
87
88 function processResponse(res: JRPCResponse<unknown>) {
89 const context = idMap[res.id as unknown as string];
90 if (!context) {
91 throw new Error(`StreamMiddleware - Unknown response id "${res.id}"`);
92 }
93
94 delete idMap[res.id as unknown as string];
95 // copy whole res onto original res
96 Object.assign(context.res, res);
97 // run callback on empty stack,
98 // prevent internal stream-handler from catching errors
99 setTimeout(context.end);
100 }
101
102 function processNotification(res: JRPCNotification<JRPCParams>) {
103 events.emit("notification", res);

Callers 1

processMessageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected