handleVergexFlowMarkets proxies the Vergex net-flow market ranking (paid x402 endpoint) using the caller's claw402 wallet. The upstream JSON is passed through verbatim: { data: { window, by, inflow: [{ symbol, netFlow, buyNotional, sellNotional, trades, latestPrice }, ...] } }.
(c *gin.Context)
| 78 | // through verbatim: { data: { window, by, inflow: [{ symbol, netFlow, |
| 79 | // buyNotional, sellNotional, trades, latestPrice }, ...] } }. |
| 80 | func (s *Server) handleVergexFlowMarkets(c *gin.Context) { |
| 81 | client, ok := s.newVergexClientForRequest(c) |
| 82 | if !ok { |
| 83 | return |
| 84 | } |
| 85 | chain := withDefault(strings.TrimSpace(c.Query("chain")), "mainnet") |
| 86 | window := withDefault(strings.TrimSpace(c.Query("window")), "1h") |
| 87 | limit := parsePositiveInt(c.Query("limit"), 25) |
| 88 | |
| 89 | body, err := client.GetFlowMarkets(context.Background(), chain, window, limit) |
| 90 | if err != nil { |
| 91 | logger.Warnf("Vergex flow-markets failed: %v", err) |
| 92 | c.JSON(http.StatusBadGateway, gin.H{"error": err.Error()}) |
| 93 | return |
| 94 | } |
| 95 | c.Data(http.StatusOK, "application/json; charset=utf-8", body) |
| 96 | } |
| 97 | |
| 98 | func (s *Server) newVergexClientForRequest(c *gin.Context) (*vergex.Client, bool) { |
| 99 | userID := c.GetString("user_id") |
nothing calls this directly
no test coverage detected