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.

79 lines
1.8 KiB

  1. package http
  2. // The types in this file define the JSON encoding for RPC method parameters
  3. // from the client to the server.
  4. import (
  5. "encoding/json"
  6. "github.com/tendermint/tendermint/internal/jsontypes"
  7. "github.com/tendermint/tendermint/libs/bytes"
  8. "github.com/tendermint/tendermint/types"
  9. )
  10. type abciQueryArgs struct {
  11. Path string `json:"path"`
  12. Data bytes.HexBytes `json:"data"`
  13. Height int64 `json:"height,string"`
  14. Prove bool `json:"prove"`
  15. }
  16. type txArgs struct {
  17. Tx []byte `json:"tx"`
  18. }
  19. type txKeyArgs struct {
  20. TxKey []byte `json:"tx_key"`
  21. }
  22. type unconfirmedArgs struct {
  23. Limit *int `json:"limit,string,omitempty"`
  24. }
  25. type heightArgs struct {
  26. Height *int64 `json:"height,string,omitempty"`
  27. }
  28. type hashArgs struct {
  29. Hash bytes.HexBytes `json:"hash"`
  30. Prove bool `json:"prove,omitempty"`
  31. }
  32. type blockchainInfoArgs struct {
  33. MinHeight int64 `json:"minHeight,string"`
  34. MaxHeight int64 `json:"maxHeight,string"`
  35. }
  36. type genesisChunkArgs struct {
  37. Chunk uint `json:"chunk,string"`
  38. }
  39. type searchArgs struct {
  40. Query string `json:"query"`
  41. Prove bool `json:"prove,omitempty"`
  42. OrderBy string `json:"order_by,omitempty"`
  43. Page *int `json:"page,string,omitempty"`
  44. PerPage *int `json:"per_page,string,omitempty"`
  45. }
  46. type validatorArgs struct {
  47. Height *int64 `json:"height,string,omitempty"`
  48. Page *int `json:"page,string,omitempty"`
  49. PerPage *int `json:"per_page,string,omitempty"`
  50. }
  51. type evidenceArgs struct {
  52. Evidence types.Evidence
  53. }
  54. // MarshalJSON implements json.Marshaler to encode the evidence using the
  55. // wrapped concrete type of the implementation.
  56. func (e evidenceArgs) MarshalJSON() ([]byte, error) {
  57. ev, err := jsontypes.Marshal(e.Evidence)
  58. if err != nil {
  59. return nil, err
  60. }
  61. return json.Marshal(struct {
  62. Evidence json.RawMessage `json:"evidence"`
  63. }{Evidence: ev})
  64. }