Skip to content

Commit 7242559

Browse files
committed
chore: changed rpc types to be easily seralisable
1 parent 029577f commit 7242559

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/client/handlers/NodesSyncGraph.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ import type {
77
NodesSyncGraphMessage,
88
} from '../types.js';
99
import type { AgentClientManifest } from '../../nodes/agent/callers/index.js';
10+
import type { NodeId, NodeAddress } from '../../nodes/types.js';
1011
import { UnaryHandler } from '@matrixai/rpc';
12+
import * as nodesUtils from '../../nodes/utils.js';
1113

1214
class NodesSyncGraph extends UnaryHandler<
1315
{
@@ -27,9 +29,14 @@ class NodesSyncGraph extends UnaryHandler<
2729
}: {
2830
nodeManager: NodeManager<AgentClientManifest>;
2931
} = this.container;
32+
// Convert the encoded node id to the binary one we expect
33+
const parsedInitialNodes = input.initialNodes.map(
34+
(value) =>
35+
[nodesUtils.decodeNodeId(value[0]), value[1]] as [NodeId, NodeAddress],
36+
);
3037
await nodeManager.syncNodeGraph(
3138
input.network,
32-
input.initialNodes,
39+
parsedInitialNodes,
3340
input.connectionTimeout,
3441
true,
3542
ctx,

src/client/types.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import type {
2727
NodeContact,
2828
NodeAddress,
2929
NodeContactAddressData,
30-
NodeId,
3130
} from '../nodes/types.js';
3231
import type { AuditEventsGetTypeOverride } from './callers/auditEventsGet.js';
3332

@@ -154,7 +153,7 @@ type NodeConnectionMessage = NodeAddressMessage & {
154153

155154
type NodesSyncGraphMessage = {
156155
network: string;
157-
initialNodes: Array<[NodeId, NodeAddress]>;
156+
initialNodes: Array<[NodeIdEncoded, NodeAddress]>;
158157
connectionTimeout?: number;
159158
};
160159

0 commit comments

Comments
 (0)