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.

111 lines
2.4 KiB

  1. package types
  2. type ParamsEcho struct {
  3. Message string `json:"message,omitempty"`
  4. }
  5. type ParamsFlush struct {
  6. }
  7. type ParamsInfo struct {
  8. Version string `json:"version,omitempty"`
  9. }
  10. func ToParamsInfo(req RequestInfo) ParamsInfo {
  11. return ParamsInfo{
  12. Version: req.Version,
  13. }
  14. }
  15. type ParamsSetOption struct {
  16. Key string `json:"key,omitempty"`
  17. Value string `json:"value,omitempty"`
  18. }
  19. func ToParamsSetOption(req RequestSetOption) ParamsSetOption {
  20. return ParamsSetOption{
  21. Key: req.Key,
  22. Value: req.Value,
  23. }
  24. }
  25. type ParamsInitChain struct {
  26. Validators []Validator `json:"validators"`
  27. GenesisBytes []byte `json:"genesis_bytes,omitempty"`
  28. }
  29. func ToParamsInitChain(req RequestInitChain) ParamsInitChain {
  30. vals := make([]Validator, len(req.Validators))
  31. for i := 0; i < len(vals); i++ {
  32. v := req.Validators[i]
  33. vals[i] = *v
  34. }
  35. return ParamsInitChain{
  36. Validators: vals,
  37. GenesisBytes: req.GenesisBytes,
  38. }
  39. }
  40. type ParamsQuery struct {
  41. Data []byte `json:"data,omitempty"`
  42. Path string `json:"path,omitempty"`
  43. Height int64 `json:"height,omitempty"`
  44. Prove bool `json:"prove,omitempty"`
  45. }
  46. func ToParamsQuery(req RequestQuery) ParamsQuery {
  47. return ParamsQuery{
  48. Data: req.Data,
  49. Path: req.Path,
  50. Height: req.Height,
  51. Prove: req.Prove,
  52. }
  53. }
  54. type ParamsBeginBlock struct {
  55. Hash []byte `json:"hash,omitempty"`
  56. Header Header `json:"header"`
  57. Validators []SigningValidator `json:"validators,omitempty"`
  58. ByzantineValidators []Evidence `json:"byzantine_validators"`
  59. }
  60. func ToParamsBeginBlock(req RequestBeginBlock) ParamsBeginBlock {
  61. vals := make([]SigningValidator, len(req.Validators))
  62. for i := 0; i < len(vals); i++ {
  63. v := req.Validators[i]
  64. vals[i] = *v
  65. }
  66. evidence := make([]Evidence, len(req.ByzantineValidators))
  67. for i := 0; i < len(evidence); i++ {
  68. ev := req.ByzantineValidators[i]
  69. evidence[i] = *ev
  70. }
  71. return ParamsBeginBlock{
  72. Hash: req.Hash,
  73. Header: *req.Header,
  74. Validators: vals,
  75. ByzantineValidators: evidence,
  76. }
  77. }
  78. type ParamsCheckTx struct {
  79. Tx []byte `json:"tx,omitempty"`
  80. }
  81. type ParamsDeliverTx struct {
  82. Tx []byte `json:"tx,omitempty"`
  83. }
  84. type ParamsEndBlock struct {
  85. Height int64 `json:"height,omitempty"`
  86. }
  87. func ToParamsEndBlock(req RequestEndBlock) ParamsEndBlock {
  88. return ParamsEndBlock{
  89. Height: req.Height,
  90. }
  91. }
  92. type ParamsCommit struct {
  93. }