package core_grpc
|
|
|
|
import (
|
|
context "golang.org/x/net/context"
|
|
|
|
abci "github.com/tendermint/abci/types"
|
|
core "github.com/tendermint/tendermint/rpc/core"
|
|
)
|
|
|
|
type broadcastAPI struct {
|
|
}
|
|
|
|
func (bapi *broadcastAPI) BroadcastTx(ctx context.Context, req *RequestBroadcastTx) (*ResponseBroadcastTx, error) {
|
|
res, err := core.BroadcastTxCommit(req.Tx)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &ResponseBroadcastTx{
|
|
|
|
CheckTx: &abci.ResponseCheckTx{
|
|
Code: res.CheckTx.Code,
|
|
Data: res.CheckTx.Data,
|
|
Log: res.CheckTx.Log,
|
|
},
|
|
DeliverTx: &abci.ResponseDeliverTx{
|
|
Code: res.DeliverTx.Code,
|
|
Data: res.DeliverTx.Data,
|
|
Log: res.DeliverTx.Log,
|
|
},
|
|
}, nil
|
|
}
|