Skip to content

Commit

Permalink
chore(types): replace amino json encoder with stdlib
Browse files Browse the repository at this point in the history
  • Loading branch information
czarcas7ic committed Jan 12, 2024
1 parent bfa713a commit cf358f6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion types/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func NewABCIMessageLog(i uint32, log string, events Events) ABCIMessageLog {
// String implements the fmt.Stringer interface for the ABCIMessageLogs type.
func (logs ABCIMessageLogs) String() (str string) {
if logs != nil {
raw, err := cdc.MarshalJSON(logs)
raw, err := json.Marshal(logs)
if err == nil {
str = string(raw)
}
Expand Down
5 changes: 2 additions & 3 deletions types/result_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package types_test

import (
"encoding/hex"
"encoding/json"
"fmt"
"strings"
"testing"
Expand All @@ -13,7 +14,6 @@ import (
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"

"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/testutil/testdata"
sdk "github.com/cosmos/cosmos-sdk/types"
)
Expand Down Expand Up @@ -41,14 +41,13 @@ func (s *resultTestSuite) TestParseABCILog() {
}

func (s *resultTestSuite) TestABCIMessageLog() {
cdc := codec.NewLegacyAmino()
events := sdk.Events{
sdk.NewEvent("transfer", sdk.NewAttribute("sender", "foo")),
sdk.NewEvent("transfer", sdk.NewAttribute("sender", "bar")),
}
msgLog := sdk.NewABCIMessageLog(0, "", events)
msgLogs := sdk.ABCIMessageLogs{msgLog}
bz, err := cdc.MarshalJSON(msgLogs)
bz, err := json.Marshal(msgLogs)

s.Require().NoError(err)
s.Require().Equal(string(bz), msgLogs.String())
Expand Down

0 comments on commit cf358f6

Please sign in to comment.