From 3ef7ba4964b74154eb9d394dbe25fd967b31fbed Mon Sep 17 00:00:00 2001 From: Adam Tucker Date: Fri, 12 Jan 2024 12:30:34 -0700 Subject: [PATCH] chore(types): replace amino json encoder with stdlib --- types/result.go | 3 +-- types/result_test.go | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/types/result.go b/types/result.go index ea3d491025fa..13aa5d4f84f6 100644 --- a/types/result.go +++ b/types/result.go @@ -47,8 +47,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 { - cdc := codec.NewLegacyAmino() - raw, err := cdc.MarshalJSON(logs) + raw, err := json.Marshal(logs) if err == nil { str = string(raw) } diff --git a/types/result_test.go b/types/result_test.go index 5911bda5b972..7d463a14af66 100644 --- a/types/result_test.go +++ b/types/result_test.go @@ -2,6 +2,7 @@ package types_test import ( "encoding/hex" + "encoding/json" "fmt" "strings" "testing" @@ -15,7 +16,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" ) @@ -43,14 +43,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())