Skip to content

Commit

Permalink
Merge pull request #145 from DecentralCardGame/144-fix-openpack-error
Browse files Browse the repository at this point in the history
Fixed cli tx_set_card_rarity
  • Loading branch information
lxgr-linux authored Oct 7, 2023
2 parents 8c37732 + 9f0d536 commit 9f95b09
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
4 changes: 2 additions & 2 deletions scripts/migrate_with_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@


# delete all sets # TODO REMOVE THIS PART ONCE EVERYTHING IS FINE
print(old_dict["app_state"]["cardchain"]["sets"])
old_dict["app_state"]["cardchain"]["sets"] = []
#print(old_dict["app_state"]["cardchain"]["sets"])
#old_dict["app_state"]["cardchain"]["sets"] = []


params = new_dict["app_state"]["cardchain"]["params"]
Expand Down
16 changes: 6 additions & 10 deletions x/cardchain/client/cli/tx_set_card_rarity.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cli

import (
"github.com/DecentralCardGame/cardobject/cardobject"
"fmt"
"strconv"

"github.com/DecentralCardGame/Cardchain/x/cardchain/types"
Expand All @@ -10,6 +10,7 @@ import (
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/spf13/cast"
"github.com/spf13/cobra"
"golang.org/x/exp/maps"
)

var _ = strconv.Itoa(0)
Expand All @@ -28,17 +29,12 @@ func CmdSetCardRarity() *cobra.Command {
if err != nil {
return err
}
rar, err := strconv.Atoi(args[2])
if err != nil {
return err
rar, found := types.CardRarity_value[args[2]]
if (!found) {
return fmt.Errorf("Rarity has to be in %s", maps.Keys(types.CardRarity_value))
}
argRarity := types.CardRarity(rar)

rarity := cardobject.Rarity(argRarity)
err = rarity.ValidateType(cardobject.Card{})
if err != nil {
return err
}
argRarity := types.CardRarity(rar)

clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
Expand Down

0 comments on commit 9f95b09

Please sign in to comment.