github.com/cosmos/cosmos-sdk@v0.50.10/client/grpc/cmtservice/types.go (about) 1 package cmtservice 2 3 import ( 4 abci "github.com/cometbft/cometbft/abci/types" 5 ) 6 7 // ToABCIRequestQuery converts a gRPC ABCIQueryRequest type to an ABCI 8 // RequestQuery type. 9 func (req *ABCIQueryRequest) ToABCIRequestQuery() *abci.RequestQuery { 10 return &abci.RequestQuery{ 11 Data: req.Data, 12 Path: req.Path, 13 Height: req.Height, 14 Prove: req.Prove, 15 } 16 } 17 18 // FromABCIResponseQuery converts an ABCI ResponseQuery type to a gRPC 19 // ABCIQueryResponse type. 20 func FromABCIResponseQuery(res *abci.ResponseQuery) *ABCIQueryResponse { 21 var proofOps *ProofOps 22 23 if res.ProofOps != nil { 24 proofOps = &ProofOps{ 25 Ops: make([]ProofOp, len(res.ProofOps.Ops)), 26 } 27 for i, proofOp := range res.ProofOps.Ops { 28 proofOps.Ops[i] = ProofOp{ 29 Type: proofOp.Type, 30 Key: proofOp.Key, 31 Data: proofOp.Data, 32 } 33 } 34 } 35 36 return &ABCIQueryResponse{ 37 Code: res.Code, 38 Log: res.Log, 39 Info: res.Info, 40 Index: res.Index, 41 Key: res.Key, 42 Value: res.Value, 43 ProofOps: proofOps, 44 Height: res.Height, 45 Codespace: res.Codespace, 46 } 47 }