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.

80 lines
1.9 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. Page *int `json:"page,string,omitempty"`
  24. PerPage *int `json:"per_page,string,omitempty"`
  25. }
  26. type heightArgs struct {
  27. Height *int64 `json:"height,string,omitempty"`
  28. }
  29. type hashArgs struct {
  30. Hash bytes.HexBytes `json:"hash"`
  31. Prove bool `json:"prove,omitempty"`
  32. }
  33. type blockchainInfoArgs struct {
  34. MinHeight int64 `json:"minHeight,string"`
  35. MaxHeight int64 `json:"maxHeight,string"`
  36. }
  37. type genesisChunkArgs struct {
  38. Chunk uint `json:"chunk,string"`
  39. }
  40. type searchArgs struct {
  41. Query string `json:"query"`
  42. Prove bool `json:"prove,omitempty"`
  43. OrderBy string `json:"order_by,omitempty"`
  44. Page *int `json:"page,string,omitempty"`
  45. PerPage *int `json:"per_page,string,omitempty"`
  46. }
  47. type validatorArgs struct {
  48. Height *int64 `json:"height,string,omitempty"`
  49. Page *int `json:"page,string,omitempty"`
  50. PerPage *int `json:"per_page,string,omitempty"`
  51. }
  52. type evidenceArgs struct {
  53. Evidence types.Evidence
  54. }
  55. // MarshalJSON implements json.Marshaler to encode the evidence using the
  56. // wrapped concrete type of the implementation.
  57. func (e evidenceArgs) MarshalJSON() ([]byte, error) {
  58. ev, err := jsontypes.Marshal(e.Evidence)
  59. if err != nil {
  60. return nil, err
  61. }
  62. return json.Marshal(struct {
  63. Evidence json.RawMessage `json:"evidence"`
  64. }{Evidence: ev})
  65. }