JSON Proto changes
This commit is contained in:
+5
-5
@@ -1,7 +1,6 @@
|
||||
package baseapp
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"sort"
|
||||
@@ -10,6 +9,7 @@ import (
|
||||
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
)
|
||||
@@ -189,7 +189,7 @@ func (app *BaseApp) CheckTx(req abci.RequestCheckTx) abci.ResponseCheckTx {
|
||||
GasUsed: int64(gInfo.GasUsed), // TODO: Should type accept unsigned ints?
|
||||
Log: result.Log,
|
||||
Data: result.Data,
|
||||
Events: result.Events.ToABCIEvents(),
|
||||
Events: result.Events,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ func (app *BaseApp) DeliverTx(req abci.RequestDeliverTx) abci.ResponseDeliverTx
|
||||
GasUsed: int64(gInfo.GasUsed), // TODO: Should type accept unsigned ints?
|
||||
Log: result.Log,
|
||||
Data: result.Data,
|
||||
Events: result.Events.ToABCIEvents(),
|
||||
Events: result.Events,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,12 +331,12 @@ func handleQueryApp(app *BaseApp, path []string, req abci.RequestQuery) abci.Res
|
||||
return sdkerrors.QueryResult(sdkerrors.Wrap(err, "failed to simulate tx"))
|
||||
}
|
||||
|
||||
simRes := sdk.SimulationResponse{
|
||||
simRes := &sdk.SimulationResponse{
|
||||
GasInfo: gInfo,
|
||||
Result: res,
|
||||
}
|
||||
|
||||
bz, err := json.Marshal(simRes)
|
||||
bz, err := codec.ProtoMarshalJSON(simRes)
|
||||
if err != nil {
|
||||
return sdkerrors.QueryResult(sdkerrors.Wrap(err, "failed to JSON encode simulation response"))
|
||||
}
|
||||
|
||||
+2
-2
@@ -606,7 +606,7 @@ func (app *BaseApp) runMsgs(ctx sdk.Context, msgs []sdk.Msg, mode runTxMode) (*s
|
||||
msgEvents := sdk.Events{
|
||||
sdk.NewEvent(sdk.EventTypeMessage, sdk.NewAttribute(sdk.AttributeKeyAction, msg.Type())),
|
||||
}
|
||||
msgEvents = msgEvents.AppendEvents(msgResult.Events)
|
||||
msgEvents = msgEvents.AppendEvents(msgResult.GetEvents())
|
||||
|
||||
// append message events, data and logs
|
||||
//
|
||||
@@ -620,6 +620,6 @@ func (app *BaseApp) runMsgs(ctx sdk.Context, msgs []sdk.Msg, mode runTxMode) (*s
|
||||
return &sdk.Result{
|
||||
Data: data,
|
||||
Log: strings.TrimSpace(msgLogs.String()),
|
||||
Events: events,
|
||||
Events: events.ToABCIEvents(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user