@@ -61,6 +61,12 @@ func registerQueryRoutes(cliCtx context.CLIContext, r *mux.Router,
6161 paramsHandlerFn (cliCtx , cdc , queryRoute ),
6262 ).Methods ("GET" )
6363
64+ // Get the amount held in the community pool
65+ r .HandleFunc (
66+ "/distribution/community_pool" ,
67+ communityPoolHandler (cliCtx , cdc , queryRoute ),
68+ ).Methods ("GET" )
69+
6470}
6571
6672// HTTP request handler to query the total rewards balance from all delegations
@@ -207,6 +213,26 @@ func paramsHandlerFn(cliCtx context.CLIContext, cdc *codec.Codec,
207213 }
208214}
209215
216+ func communityPoolHandler (cliCtx context.CLIContext , cdc * codec.Codec ,
217+ queryRoute string ) http.HandlerFunc {
218+
219+ return func (w http.ResponseWriter , r * http.Request ) {
220+ res , err := cliCtx .QueryWithData (fmt .Sprintf ("custom/%s/community_pool" , queryRoute ), nil )
221+ if err != nil {
222+ rest .WriteErrorResponse (w , http .StatusInternalServerError , err .Error ())
223+ return
224+ }
225+
226+ var result sdk.DecCoins
227+ if err := cdc .UnmarshalJSON (res , & result ); err != nil {
228+ rest .WriteErrorResponse (w , http .StatusInternalServerError , err .Error ())
229+ return
230+ }
231+
232+ rest .PostProcessResponse (w , cdc , result , cliCtx .Indent )
233+ }
234+ }
235+
210236// HTTP request handler to query the outstanding rewards
211237func outstandingRewardsHandlerFn (cliCtx context.CLIContext , cdc * codec.Codec ,
212238 queryRoute string ) http.HandlerFunc {
0 commit comments