gitlab.com/gpdionisio/tendermint@v0.34.19-dev2/rpc/core/abci.go (about)

     1  package core
     2  
     3  import (
     4  	abci "github.com/tendermint/tendermint/abci/types"
     5  	"github.com/tendermint/tendermint/libs/bytes"
     6  	"github.com/tendermint/tendermint/proxy"
     7  	ctypes "github.com/tendermint/tendermint/rpc/core/types"
     8  	rpctypes "github.com/tendermint/tendermint/rpc/jsonrpc/types"
     9  )
    10  
    11  // ABCIQuery queries the application for some information.
    12  // More: https://docs.tendermint.com/master/rpc/#/ABCI/abci_query
    13  func ABCIQuery(
    14  	ctx *rpctypes.Context,
    15  	path string,
    16  	data bytes.HexBytes,
    17  	height int64,
    18  	prove bool,
    19  ) (*ctypes.ResultABCIQuery, error) {
    20  	resQuery, err := env.ProxyAppQuery.QuerySync(abci.RequestQuery{
    21  		Path:   path,
    22  		Data:   data,
    23  		Height: height,
    24  		Prove:  prove,
    25  	})
    26  	if err != nil {
    27  		return nil, err
    28  	}
    29  
    30  	return &ctypes.ResultABCIQuery{Response: *resQuery}, nil
    31  }
    32  
    33  // ABCIInfo gets some info about the application.
    34  // More: https://docs.tendermint.com/master/rpc/#/ABCI/abci_info
    35  func ABCIInfo(ctx *rpctypes.Context) (*ctypes.ResultABCIInfo, error) {
    36  	resInfo, err := env.ProxyAppQuery.InfoSync(proxy.RequestInfo)
    37  	if err != nil {
    38  		return nil, err
    39  	}
    40  
    41  	return &ctypes.ResultABCIInfo{Response: *resInfo}, nil
    42  }