Skip to content

Commit

Permalink
fix w
Browse files Browse the repository at this point in the history
  • Loading branch information
tkxkd0159 committed Mar 4, 2024
1 parent 009902a commit d9647e7
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions x/collection/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strings"

abci "github.com/cometbft/cometbft/abci/types"
authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec"
"github.com/cosmos/gogoproto/proto"

"cosmossdk.io/math"
Expand All @@ -28,6 +29,27 @@ func mustJSONMarshal(v any) string {
// w wraps input with double quotes if it is a string or fmt.Stringer.
func w(input any) string {
switch input.(type) {
case sdk.AccAddress:
ac := authcodec.NewBech32Codec("link")
s, err := ac.BytesToString(input.([]byte))
if err != nil {
panic(err)
}
return fmt.Sprintf("\"%s\"", s)
case sdk.ValAddress:
ac := authcodec.NewBech32Codec("linkvaloper")
s, err := ac.BytesToString(input.([]byte))
if err != nil {
panic(err)
}
return fmt.Sprintf("\"%s\"", s)
case sdk.ConsAddress:
ac := authcodec.NewBech32Codec("linkvalcons")
s, err := ac.BytesToString(input.([]byte))
if err != nil {
panic(err)
}
return fmt.Sprintf("\"%s\"", s)
case string, fmt.Stringer:
return fmt.Sprintf("\"%s\"", input)
default:
Expand Down

0 comments on commit d9647e7

Please sign in to comment.