github.com/vipernet-xyz/tm@v0.34.24/rpc/core/abci.go (about)

     1  package core
     2  
     3  import (
     4  	abci "github.com/vipernet-xyz/tm/abci/types"
     5  	"github.com/vipernet-xyz/tm/libs/bytes"
     6  	"github.com/vipernet-xyz/tm/proxy"
     7  	ctypes "github.com/vipernet-xyz/tm/rpc/core/types"
     8  	rpctypes "github.com/vipernet-xyz/tm/rpc/jsonrpc/types"
     9  )
    10  
    11  // ABCIQuery queries the application for some information.
    12  // More: https://docs.tendermint.com/v0.34/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/v0.34/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  }