From a4896e5706077187887ff5e30dafff60099ae588 Mon Sep 17 00:00:00 2001 From: Mohammad Kermani Date: Sun, 6 Oct 2024 12:50:49 +0330 Subject: [PATCH] feat(rosenet-node): add info APIs --- .changeset/polite-cycles-bow.md | 5 +++++ packages/rosenet-node/lib/createRoseNetNode.ts | 4 ++++ 2 files changed, 9 insertions(+) create mode 100644 .changeset/polite-cycles-bow.md diff --git a/.changeset/polite-cycles-bow.md b/.changeset/polite-cycles-bow.md new file mode 100644 index 0000000..9f1a94c --- /dev/null +++ b/.changeset/polite-cycles-bow.md @@ -0,0 +1,5 @@ +--- +'@rosen-bridge/rosenet-node': minor +--- + +Add info APIs diff --git a/packages/rosenet-node/lib/createRoseNetNode.ts b/packages/rosenet-node/lib/createRoseNetNode.ts index 038fc51..65310a1 100644 --- a/packages/rosenet-node/lib/createRoseNetNode.ts +++ b/packages/rosenet-node/lib/createRoseNetNode.ts @@ -147,6 +147,10 @@ const createRoseNetNode = async ({ handleIncomingMessage: handleIncomingMessageFactory(node), publish: publishFactory(node), subscribe: subscribeFactory(node), + info: { + getPeerId: () => node.peerId.toString(), + getConnectedPeers: () => node.getPeers().map((peer) => peer.toString()), + }, }; };