Skip to content

Commit

Permalink
wip: making progress converting handlers
Browse files Browse the repository at this point in the history
* Related #512
* Related #495

[ci skip]
  • Loading branch information
tegefaulkes committed Jul 7, 2023
1 parent d83c63e commit ed89487
Show file tree
Hide file tree
Showing 18 changed files with 415 additions and 353 deletions.
17 changes: 0 additions & 17 deletions src/agent-old/service/echo.ts

This file was deleted.

57 changes: 0 additions & 57 deletions src/agent-old/service/nodesChainDataGet.ts

This file was deleted.

22 changes: 0 additions & 22 deletions src/agent-old/service/nodesClaimsGet.ts

This file was deleted.

72 changes: 0 additions & 72 deletions src/agent-old/service/nodesClosestLocalNodesGet.ts

This file was deleted.

58 changes: 0 additions & 58 deletions src/agent-old/service/nodesCrossSignClaim.ts

This file was deleted.

127 changes: 0 additions & 127 deletions src/agent-old/service/nodesHolePunchMessageSend.ts

This file was deleted.

19 changes: 19 additions & 0 deletions src/agent/handlers/clientManifest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import {ClientRPCRequestParams, ClientRPCResponseResult} from "@/client/types";
import { EchoMessage } from "./types";
import { UnaryCaller } from '../../rpc/callers';


const echo = new UnaryCaller<
ClientRPCRequestParams<EchoMessage>,
ClientRPCResponseResult<EchoMessage>
>();

// No type used here, it will override type inference
const clientManifest = {
echo,
}

export {
clientManifest,
echo,
}
19 changes: 19 additions & 0 deletions src/agent/handlers/echo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { UnaryHandler } from "../../rpc/handlers";
import type { EchoMessage } from './types';
import {AgentRPCRequestParams, AgentRPCResponseResult} from "../types";

class EchoHandler extends UnaryHandler<
{},
AgentRPCRequestParams<EchoMessage>,
AgentRPCResponseResult<EchoMessage>
> {
public async handle(
input: AgentRPCRequestParams<EchoMessage>,
): Promise<AgentRPCResponseResult<EchoMessage>> {
return {
message: input.message,
}
}
}

export { EchoHandler };
Loading

0 comments on commit ed89487

Please sign in to comment.