(c *gin.Context)
| 96 | } |
| 97 | |
| 98 | func (s *Server) newVergexClientForRequest(c *gin.Context) (*vergex.Client, bool) { |
| 99 | userID := c.GetString("user_id") |
| 100 | if userID == "" { |
| 101 | c.JSON(http.StatusUnauthorized, gin.H{"error": "Unauthorized"}) |
| 102 | return nil, false |
| 103 | } |
| 104 | walletKey, err := s.resolveStrategyDataWalletKey(userID, c.Query("ai_model_id")) |
| 105 | if err != nil { |
| 106 | c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) |
| 107 | return nil, false |
| 108 | } |
| 109 | if walletKey == "" { |
| 110 | c.JSON(http.StatusBadRequest, gin.H{"error": "claw402 wallet is not configured"}) |
| 111 | return nil, false |
| 112 | } |
| 113 | client, err := vergex.NewClient("", walletKey, &logger.MCPLogger{}) |
| 114 | if err != nil { |
| 115 | c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) |
| 116 | return nil, false |
| 117 | } |
| 118 | return client, true |
| 119 | } |
| 120 | |
| 121 | func parsePositiveInt(raw string, fallback int) int { |
| 122 | if raw == "" { |
no test coverage detected