-
Notifications
You must be signed in to change notification settings - Fork 402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add currentPeers RPC Endpoint #1630
feat: Add currentPeers RPC Endpoint #1630
Conversation
🦋 Changeset detectedLatest commit: e9d4108 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Just needs a few minor changes.
Also looks like build is failing because the docs need to be updated.
@@ -402,6 +402,10 @@ class SyncEngine extends TypedEmitter<SyncEvents> { | |||
return this.currentHubPeerContacts.get(peerId); | |||
} | |||
|
|||
public getCurrentHubPeerContacts() { | |||
return this.currentHubPeerContacts; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should just return the .values()
so it's not possible to modify this outside of this class.
//================peerList================ | ||
// @doc-tag: /peerList | ||
this.app.get("/v1/peerList", (request, reply) => { | ||
const call = getCallObject("getCurrentPeers", {}, request); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep the name consistent between the http and the rpc apis. Maybe rename the httpEndpoint to currentPeers
?
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1630 +/- ##
=========================================
+ Coverage 0 76.99% +76.99%
=========================================
Files 0 99 +99
Lines 0 9619 +9619
Branches 0 2348 +2348
=========================================
+ Hits 0 7406 +7406
- Misses 0 2183 +2183
- Partials 0 30 +30 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thank you!
Motivation
This endpoint was added to get an approximate list of all peers on the network
Change Summary
/v1/peerList
Merge Checklist
Choose all relevant options below by adding an
x
now or at any time before submitting for reviewAdditional Context
Response looks like the following:
PR-Codex overview
This PR adds a new
currentPeers
API endpoint and related changes to support fetching current peer contacts in the Hub network.Detailed summary
currentPeers
RPC endpointContactInfoResponse
currentPeers
API callContactInfoResponse
and related functions