(c *gin.Context)
| 139 | } |
| 140 | |
| 141 | func getBalance(c *gin.Context) { |
| 142 | developer := getDeveloperID(c) |
| 143 | p, err := model.GetMainAccount(model.GetDB(c), developer) |
| 144 | if err != nil { |
| 145 | _ = c.Error(err) |
| 146 | abortWithError(c, http.StatusForbidden, ErrNoMainAccount) |
| 147 | return |
| 148 | } |
| 149 | |
| 150 | var ( |
| 151 | req = new(types.QueryAccountTokenBalanceReq) |
| 152 | resp = new(types.QueryAccountTokenBalanceResp) |
| 153 | ) |
| 154 | |
| 155 | req.Addr, err = p.Account.Get() |
| 156 | if err != nil { |
| 157 | _ = c.Error(err) |
| 158 | abortWithError(c, http.StatusBadRequest, ErrParseAccountFailed) |
| 159 | return |
| 160 | } |
| 161 | |
| 162 | if err = rpc.RequestBP(route.MCCQueryAccountTokenBalance.String(), req, resp); err != nil { |
| 163 | _ = c.Error(err) |
| 164 | abortWithError(c, http.StatusInternalServerError, ErrSendETLSRPCFailed) |
| 165 | return |
| 166 | } |
| 167 | |
| 168 | responseWithData(c, http.StatusOK, gin.H{ |
| 169 | "balance": resp.Balance, |
| 170 | }) |
| 171 | } |
| 172 | |
| 173 | func setMainAccount(c *gin.Context) { |
| 174 | r := struct { |
nothing calls this directly
no test coverage detected