-
Notifications
You must be signed in to change notification settings - Fork 39
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
Add network config endpoint #2016
Conversation
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.
LGTM
} | ||
|
||
// Define a struct to represent the response | ||
type NetworkConfigResponse struct { |
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.
Bit of a shame that we can't use ObscuroNetworkInfo
like the ObsClient but I guess it's for json compatibility? Maybe better to have separate control over it anyway.
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.
Yeah, it is because of that + we need to convert data fields to strings. I was also asking ChatGPT if there is a good way, but unfortunately nothing simpler than that :/
@@ -283,6 +283,14 @@ func (w *Services) GetTenNodeHealthStatus() (bool, error) { | |||
return *res, err | |||
} | |||
|
|||
func (w *Services) GetTenNetworkConfig() (tencommon.TenNetworkInfo, error) { | |||
res, err := withPlainRPCConnection[tencommon.TenNetworkInfo](context.Background(), w, func(client *gethrpc.Client) (*tencommon.TenNetworkInfo, error) { |
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.
Does this do any caching by default? Maybe safer not to cache for now I guess, there are some edge cases when network starts up before L2 contract deployment maybe.
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.
No, it doesn't do any caching. I was thinking about it, but it's not an expensive call to the node and we can add it later if needed.
Why this change is needed
We need gateway endpoint for getting network config:
Ticket
What changes were made as part of this PR
Please provide a high level list of the changes made
PR checks pre-merging
Please indicate below by ticking the checkbox that you have read and performed the required
PR checks