github.com/okex/exchain@v1.8.0/libs/ibc-go/modules/apps/transfer/client/rest/query.go (about)

     1  package rest
     2  
     3  import (
     4  	"net/http"
     5  
     6  	"github.com/okex/exchain/libs/cosmos-sdk/client/context"
     7  	"github.com/okex/exchain/libs/cosmos-sdk/types/rest"
     8  	"github.com/okex/exchain/libs/ibc-go/modules/apps/transfer/types"
     9  )
    10  
    11  func queryDenomTraces(ctx context.CLIContext, endpoint string) http.HandlerFunc {
    12  	return func(w http.ResponseWriter, r *http.Request) {
    13  		var params types.QueryDenomTracesRequest
    14  		pr, err := rest.ParseCM45PageRequest(r)
    15  		if rest.CheckInternalServerError(w, err) {
    16  			return
    17  		}
    18  		params = types.QueryDenomTracesRequest{
    19  			Pagination: pr,
    20  		}
    21  		clientCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, ctx, r)
    22  		if !ok {
    23  			return
    24  		}
    25  
    26  		bz, err := clientCtx.CodecProy.GetCdc().MarshalJSON(params)
    27  		res, height, err := clientCtx.QueryWithData(endpoint, bz)
    28  		if rest.CheckInternalServerError(w, err) {
    29  			return
    30  		}
    31  
    32  		clientCtx = clientCtx.WithHeight(height)
    33  		rest.PostProcessResponse(w, clientCtx, res)
    34  	}
    35  }