Use JSON for SimulationResponse

This commit is contained in:
Aleksandr Bezobchuk
2020-03-24 16:45:34 -04:00
parent d4d4da4a6e
commit 8bb0cfdf6f
2 changed files with 10 additions and 5 deletions
+3 -3
View File
@@ -2,6 +2,7 @@ package tx
import (
"bufio"
"encoding/json"
"errors"
"fmt"
"os"
@@ -216,14 +217,13 @@ func CalculateGas(
queryFunc func(string, []byte) ([]byte, int64, error), txBytes []byte, adjustment float64,
) (sdk.SimulationResponse, uint64, error) {
rawRes, _, err := queryFunc("/app/simulate", txBytes)
bz, _, err := queryFunc("/app/simulate", txBytes)
if err != nil {
return sdk.SimulationResponse{}, 0, err
}
// TODO: Use JSON or proto instead of codec.cdc
var simRes sdk.SimulationResponse
if err := codec.Cdc.UnmarshalBinaryBare(rawRes, &simRes); err != nil {
if err := json.Unmarshal(bz, &simRes); err != nil {
return sdk.SimulationResponse{}, 0, err
}