parseBlockField extracts a top-level string field (e.g. "number" or "timestamp") from a JSON block result. Returns "" when absent or unparsable.
(b []byte, field string)
| 408 | // parseBlockField extracts a top-level string field (e.g. "number" or |
| 409 | // "timestamp") from a JSON block result. Returns "" when absent or unparsable. |
| 410 | func parseBlockField(b []byte, field string) string { |
| 411 | if len(b) == 0 { |
| 412 | return "" |
| 413 | } |
| 414 | node, err := sonic.Get(b, field) |
| 415 | if err == nil { |
| 416 | v, _ := node.String() |
| 417 | return v |
| 418 | } |
| 419 | return "" |
| 420 | } |
| 421 | |
| 422 | func fetchGrpcServers(ctx context.Context, logger *zerolog.Logger, endpoint string) ([]string, error) { |
| 423 | // Simple HTTP GET that returns a JSON array of URLs or newline separated text |
no test coverage detected