github.com/Finschia/ostracon@v1.1.5/rpc/core/abci.go (about)

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