You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.2 KiB

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