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.

36 lines
824 B

  1. package core_grpc
  2. import (
  3. "context"
  4. abci "github.com/tendermint/abci/types"
  5. core "github.com/tendermint/tendermint/rpc/core"
  6. )
  7. type broadcastAPI struct {
  8. }
  9. func (bapi *broadcastAPI) Ping(ctx context.Context, req *RequestPing) (*ResponsePing, error) {
  10. // dummy so we can check if the server is up
  11. return &ResponsePing{}, nil
  12. }
  13. func (bapi *broadcastAPI) BroadcastTx(ctx context.Context, req *RequestBroadcastTx) (*ResponseBroadcastTx, error) {
  14. res, err := core.BroadcastTxCommit(req.Tx)
  15. if err != nil {
  16. return nil, err
  17. }
  18. return &ResponseBroadcastTx{
  19. CheckTx: &abci.ResponseCheckTx{
  20. Code: res.CheckTx.Code,
  21. Data: res.CheckTx.Data,
  22. Log: res.CheckTx.Log,
  23. },
  24. DeliverTx: &abci.ResponseDeliverTx{
  25. Code: res.DeliverTx.Code,
  26. Data: res.DeliverTx.Data,
  27. Log: res.DeliverTx.Log,
  28. },
  29. }, nil
  30. }