Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt committed Dec 10, 2024
1 parent b2f3181 commit 612b140
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions client/v2/autocli/flag/coin.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package flag

import (
"context"
"fmt"
"errors"
"strings"

"google.golang.org/protobuf/reflect/protoreflect"

basev1beta1 "cosmossdk.io/api/cosmos/base/v1beta1"
"cosmossdk.io/core/coins"
"cosmossdk.io/client/v2/internal/coins"
)

type coinType struct{}
Expand All @@ -22,8 +22,7 @@ func (c coinType) NewValue(*context.Context, *Builder) Value {
}

func (c coinType) DefaultValue() string {
stringCoin, _ := coins.FormatCoins([]*basev1beta1.Coin{}, nil)
return stringCoin
return "zero"
}

func (c *coinValue) Get(protoreflect.Value) (protoreflect.Value, error) {
Expand All @@ -43,7 +42,7 @@ func (c *coinValue) String() string {

func (c *coinValue) Set(stringValue string) error {
if strings.Contains(stringValue, ",") {
return fmt.Errorf("coin flag must be a single coin, specific multiple coins with multiple flags or spaces")
return errors.New("coin flag must be a single coin, specific multiple coins with multiple flags or spaces")
}

coin, err := coins.ParseCoin(stringValue)
Expand Down

0 comments on commit 612b140

Please sign in to comment.