diff --git a/CHANGELOG.md b/CHANGELOG.md index 58b5a7f543..9b7034e36e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Features +* (x/collection) [\#1038](https://github.com/Finschia/finschia-sdk/pull/1038) Update x/collection cli for hackwasm2023 + ### Improvements ### Bug Fixes diff --git a/x/collection/client/cli/tx.go b/x/collection/client/cli/tx.go index 165e6da1df..925067357a 100644 --- a/x/collection/client/cli/tx.go +++ b/x/collection/client/cli/tx.go @@ -53,6 +53,8 @@ func NewTxCmd() *cobra.Command { NewTxCmdIssueNFT(), NewTxCmdMintFT(), NewTxCmdMintNFT(), + NewTxCmdBurnFT(), + NewTxCmdBurnNFT(), NewTxCmdAttach(), NewTxCmdDetach(), NewTxCmdOperatorAttach(), @@ -414,11 +416,11 @@ func NewTxCmdIssueNFT() *cobra.Command { func NewTxCmdMintFT() *cobra.Command { cmd := &cobra.Command{ - Use: "mint-ft [contract-id] [operator] [to] [class-id] [amount]", - Args: cobra.ExactArgs(5), + Use: "mint-ft [contract-id] [operator] [to] [amount]", + Args: cobra.ExactArgs(4), Short: "mint fungible tokens", Long: strings.TrimSpace(fmt.Sprintf(` - $ %s tx %s mint-ft [contract-id] [operator] [to] [class-id] [amount]`, version.AppName, collection.ModuleName), + $ %s tx %s mint-ft [contract-id] [operator] [to] [amount]`, version.AppName, collection.ModuleName), ), RunE: func(cmd *cobra.Command, args []string) error { operator := args[1] @@ -431,18 +433,17 @@ func NewTxCmdMintFT() *cobra.Command { return err } - amountStr := args[4] - amount, ok := sdk.NewIntFromString(amountStr) - if !ok { - return sdkerrors.ErrInvalidType.Wrapf("failed to set amount: %s", amountStr) + amountStr := args[3] + amount, err := collection.ParseCoins(amountStr) + if err != nil { + return err } - coins := collection.NewCoins(collection.NewFTCoin(args[3], amount)) msg := collection.MsgMintFT{ ContractId: args[0], From: args[1], To: args[2], - Amount: coins, + Amount: amount, } if err := msg.ValidateBasic(); err != nil { return err diff --git a/x/collection/client/testutil/suite.go b/x/collection/client/testutil/suite.go index 342b967f97..b4538b9664 100644 --- a/x/collection/client/testutil/suite.go +++ b/x/collection/client/testutil/suite.go @@ -219,12 +219,12 @@ func (s *IntegrationTestSuite) createNFTClass(contractID string, operator sdk.Ac func (s *IntegrationTestSuite) mintFT(contractID string, operator, to sdk.AccAddress, classID string, amount sdk.Int) { val := s.network.Validators[0] + amt := collection.NewCoins(collection.NewFTCoin(classID, amount)) args := append([]string{ contractID, operator.String(), to.String(), - classID, - amount.String(), + amt.String(), }, commonArgs...) out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.NewTxCmdMintFT(), args) diff --git a/x/collection/client/testutil/tx.go b/x/collection/client/testutil/tx.go index a0aee34cde..616b4df548 100644 --- a/x/collection/client/testutil/tx.go +++ b/x/collection/client/testutil/tx.go @@ -528,6 +528,7 @@ func (s *IntegrationTestSuite) TestNewTxCmdMintFT() { fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), } + amount := collection.NewCoins(collection.NewFTCoin(s.ftClassID, s.balance)) testCases := map[string]struct { args []string valid bool @@ -537,8 +538,7 @@ func (s *IntegrationTestSuite) TestNewTxCmdMintFT() { s.contractID, s.operator.String(), s.customer.String(), - s.ftClassID, - s.balance.String(), + amount.String(), }, true, }, @@ -547,8 +547,7 @@ func (s *IntegrationTestSuite) TestNewTxCmdMintFT() { s.contractID, s.operator.String(), s.customer.String(), - s.ftClassID, - s.balance.String(), + amount.String(), "extra", }, false, @@ -558,7 +557,6 @@ func (s *IntegrationTestSuite) TestNewTxCmdMintFT() { s.contractID, s.operator.String(), s.customer.String(), - s.ftClassID, }, false, }, @@ -567,8 +565,7 @@ func (s *IntegrationTestSuite) TestNewTxCmdMintFT() { "", s.operator.String(), s.customer.String(), - s.ftClassID, - s.balance.String(), + amount.String(), }, false, },