Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tkxkd0159 committed Feb 28, 2024
1 parent c8f1cc1 commit 009902a
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 69 deletions.
6 changes: 3 additions & 3 deletions tests/e2e/collection/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func (s *E2ETestSuite) mintNFT(contractID, operator, to, classID string) string
fmt.Sprintf("--%s=%s", cli.FlagName, "arctic fox"),
}, s.commonArgs...)

out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.NewTxCmdMintNFT(s.ac), args)
out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.NewTxCmdMintNFT(), args)
s.Require().NoError(err)
txResp := s.getTxResp(out, 0)
var event collection.EventMintedNFT
Expand Down Expand Up @@ -188,7 +188,7 @@ func (s *E2ETestSuite) grant(contractID, granter, grantee string, permission col
collection.LegacyPermission(permission).String(),
}, s.commonArgs...)

out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.NewTxCmdGrantPermission(s.ac), args)
out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.NewTxCmdGrantPermission(), args)
s.Require().NoError(err)
_ = s.getTxResp(out, 0)
}
Expand All @@ -201,7 +201,7 @@ func (s *E2ETestSuite) authorizeOperator(contractID, holder, operator string) {
operator,
}, s.commonArgs...)

out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.NewTxCmdAuthorizeOperator(s.ac), args)
out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.NewTxCmdAuthorizeOperator(), args)
s.Require().NoError(err)
_ = s.getTxResp(out, 0)
}
Expand Down
14 changes: 7 additions & 7 deletions tests/e2e/collection/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (s *E2ETestSuite) TestNewTxCmdSendNFT() {
tc := tc

s.Run(name, func() {
cmd := cli.NewTxCmdSendNFT(s.ac)
cmd := cli.NewTxCmdSendNFT()
out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, append(tc.args, s.commonArgs...))
if !tc.valid {
s.Require().Error(err)
Expand Down Expand Up @@ -141,7 +141,7 @@ func (s *E2ETestSuite) TestNewTxCmdOperatorSendNFT() {
tc := tc

s.Run(name, func() {
cmd := cli.NewTxCmdOperatorSendNFT(s.ac)
cmd := cli.NewTxCmdOperatorSendNFT()
out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, append(tc.args, s.commonArgs...))
if !tc.valid {
s.Require().Error(err)
Expand Down Expand Up @@ -308,7 +308,7 @@ func (s *E2ETestSuite) TestNewTxCmdMintNFT() {
tc := tc

s.Run(name, func() {
cmd := cli.NewTxCmdMintNFT(s.ac)
cmd := cli.NewTxCmdMintNFT()
out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, append(tc.args, s.commonArgs...))
if !tc.valid {
s.Require().Error(err)
Expand Down Expand Up @@ -443,7 +443,7 @@ func (s *E2ETestSuite) TestNewTxCmdOperatorOperatorBurnNFT() {
tc := tc

s.Run(name, func() {
cmd := cli.NewTxCmdOperatorBurnNFT(s.ac)
cmd := cli.NewTxCmdOperatorBurnNFT()
out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, append(tc.args, s.commonArgs...))
if !tc.valid {
s.Require().Error(err)
Expand Down Expand Up @@ -568,7 +568,7 @@ func (s *E2ETestSuite) TestNewTxCmdGrantPermission() {
tc := tc

s.Run(name, func() {
cmd := cli.NewTxCmdGrantPermission(s.ac)
cmd := cli.NewTxCmdGrantPermission()
out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, append(tc.args, s.commonArgs...))
if !tc.valid {
s.Require().Error(err)
Expand Down Expand Up @@ -666,7 +666,7 @@ func (s *E2ETestSuite) TestNewTxCmdAuthorizeOperator() {
tc := tc

s.Run(name, func() {
cmd := cli.NewTxCmdAuthorizeOperator(s.ac)
cmd := cli.NewTxCmdAuthorizeOperator()
out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, append(tc.args, s.commonArgs...))
if !tc.valid {
s.Require().Error(err)
Expand Down Expand Up @@ -715,7 +715,7 @@ func (s *E2ETestSuite) TestNewTxCmdRevokeOperator() {
tc := tc

s.Run(name, func() {
cmd := cli.NewTxCmdRevokeOperator(s.ac)
cmd := cli.NewTxCmdRevokeOperator()
out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, append(tc.args, s.commonArgs...))
if !tc.valid {
s.Require().Error(err)
Expand Down
24 changes: 13 additions & 11 deletions x/collection/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import (

"github.com/spf13/cobra"

"cosmossdk.io/core/address"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/version"
Expand All @@ -19,7 +17,7 @@ const (
)

// NewQueryCmd returns the cli query commands for this module
func NewQueryCmd(ac address.Codec) *cobra.Command {
func NewQueryCmd() *cobra.Command {
queryCmd := &cobra.Command{
Use: collection.ModuleName,
Short: fmt.Sprintf("Querying commands for the %s module", collection.ModuleName),
Expand All @@ -30,22 +28,22 @@ func NewQueryCmd(ac address.Codec) *cobra.Command {
}

queryCmd.AddCommand(
NewQueryCmdBalances(ac),
NewQueryCmdBalances(),
NewQueryCmdNFTSupply(),
NewQueryCmdNFTMinted(),
NewQueryCmdNFTBurnt(),
NewQueryCmdContract(),
NewQueryCmdToken(),
NewQueryCmdTokenType(),
NewQueryCmdGranteeGrants(ac),
NewQueryCmdIsOperatorFor(ac),
NewQueryCmdHoldersByOperator(ac),
NewQueryCmdGranteeGrants(),
NewQueryCmdIsOperatorFor(),
NewQueryCmdHoldersByOperator(),
)

return queryCmd
}

func NewQueryCmdBalances(ac address.Codec) *cobra.Command {
func NewQueryCmdBalances() *cobra.Command {
cmd := &cobra.Command{
Use: "balances [contract-id] [address]",
Args: cobra.ExactArgs(2),
Expand All @@ -56,6 +54,7 @@ func NewQueryCmdBalances(ac address.Codec) *cobra.Command {
if err != nil {
return err
}
ac := clientCtx.InterfaceRegistry.SigningContext().AddressCodec()

contractID := args[0]
if err := collection.ValidateContractID(contractID); err != nil {
Expand Down Expand Up @@ -343,7 +342,7 @@ func NewQueryCmdToken() *cobra.Command {
return cmd
}

func NewQueryCmdGranteeGrants(ac address.Codec) *cobra.Command {
func NewQueryCmdGranteeGrants() *cobra.Command {
cmd := &cobra.Command{
Use: "grantee-grants [contract-id] [grantee]",
Args: cobra.ExactArgs(2),
Expand All @@ -354,6 +353,7 @@ func NewQueryCmdGranteeGrants(ac address.Codec) *cobra.Command {
if err != nil {
return err
}
ac := clientCtx.InterfaceRegistry.SigningContext().AddressCodec()

contractID := args[0]
if err := collection.ValidateContractID(contractID); err != nil {
Expand Down Expand Up @@ -382,7 +382,7 @@ func NewQueryCmdGranteeGrants(ac address.Codec) *cobra.Command {
return cmd
}

func NewQueryCmdIsOperatorFor(ac address.Codec) *cobra.Command {
func NewQueryCmdIsOperatorFor() *cobra.Command {
cmd := &cobra.Command{
Use: "approved [contract-id] [operator] [holder]",
Args: cobra.ExactArgs(3),
Expand All @@ -393,6 +393,7 @@ func NewQueryCmdIsOperatorFor(ac address.Codec) *cobra.Command {
if err != nil {
return err
}
ac := clientCtx.InterfaceRegistry.SigningContext().AddressCodec()

contractID := args[0]
if err := collection.ValidateContractID(contractID); err != nil {
Expand Down Expand Up @@ -427,7 +428,7 @@ func NewQueryCmdIsOperatorFor(ac address.Codec) *cobra.Command {
return cmd
}

func NewQueryCmdHoldersByOperator(ac address.Codec) *cobra.Command {
func NewQueryCmdHoldersByOperator() *cobra.Command {
cmd := &cobra.Command{
Use: "approvers [contract-id] [operator]",
Args: cobra.ExactArgs(2),
Expand All @@ -438,6 +439,7 @@ func NewQueryCmdHoldersByOperator(ac address.Codec) *cobra.Command {
if err != nil {
return err
}
ac := clientCtx.InterfaceRegistry.SigningContext().AddressCodec()

contractID := args[0]
if err := collection.ValidateContractID(contractID); err != nil {
Expand Down
37 changes: 21 additions & 16 deletions x/collection/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import (

"github.com/spf13/cobra"

"cosmossdk.io/core/address"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
Expand All @@ -26,7 +24,7 @@ const (
)

// NewTxCmd returns the transaction commands for this module
func NewTxCmd(ac address.Codec) *cobra.Command {
func NewTxCmd() *cobra.Command {
txCmd := &cobra.Command{
Use: collection.ModuleName,
Short: fmt.Sprintf("%s transactions subcommands", collection.ModuleName),
Expand All @@ -36,22 +34,22 @@ func NewTxCmd(ac address.Codec) *cobra.Command {
}

txCmd.AddCommand(
NewTxCmdSendNFT(ac),
NewTxCmdOperatorSendNFT(ac),
NewTxCmdSendNFT(),
NewTxCmdOperatorSendNFT(),
NewTxCmdCreateContract(),
NewTxCmdIssueNFT(),
NewTxCmdMintNFT(ac),
NewTxCmdGrantPermission(ac),
NewTxCmdMintNFT(),
NewTxCmdGrantPermission(),
NewTxCmdRevokePermission(),
NewTxCmdAuthorizeOperator(ac),
NewTxCmdRevokeOperator(ac),
NewTxCmdAuthorizeOperator(),
NewTxCmdRevokeOperator(),
NewTxCmdModify(),
)

return txCmd
}

func NewTxCmdSendNFT(ac address.Codec) *cobra.Command {
func NewTxCmdSendNFT() *cobra.Command {
cmd := &cobra.Command{
Use: "send-nft [contract-id] [from] [to] [token-id]",
Args: cobra.ExactArgs(4),
Expand All @@ -68,6 +66,7 @@ func NewTxCmdSendNFT(ac address.Codec) *cobra.Command {
if err != nil {
return err
}
ac := clientCtx.InterfaceRegistry.SigningContext().AddressCodec()
if err = collection.ValidateContractID(args[0]); err != nil {
return err
}
Expand All @@ -90,7 +89,7 @@ func NewTxCmdSendNFT(ac address.Codec) *cobra.Command {
return cmd
}

func NewTxCmdOperatorSendNFT(ac address.Codec) *cobra.Command {
func NewTxCmdOperatorSendNFT() *cobra.Command {
cmd := &cobra.Command{
Use: "operator-send-nft [contract-id] [operator] [from] [to] [token-id]",
Args: cobra.ExactArgs(5),
Expand All @@ -108,6 +107,7 @@ func NewTxCmdOperatorSendNFT(ac address.Codec) *cobra.Command {
if err != nil {
return err
}
ac := clientCtx.InterfaceRegistry.SigningContext().AddressCodec()
if err = collection.ValidateContractID(args[0]); err != nil {
return err
}
Expand Down Expand Up @@ -237,7 +237,7 @@ func NewTxCmdIssueNFT() *cobra.Command {
return cmd
}

func NewTxCmdMintNFT(ac address.Codec) *cobra.Command {
func NewTxCmdMintNFT() *cobra.Command {
cmd := &cobra.Command{
Use: "mint-nft [contract-id] [operator] [to] [class-id]",
Args: cobra.ExactArgs(4),
Expand All @@ -255,6 +255,7 @@ func NewTxCmdMintNFT(ac address.Codec) *cobra.Command {
if err != nil {
return err
}
ac := clientCtx.InterfaceRegistry.SigningContext().AddressCodec()

if err = collection.ValidateContractID(args[0]); err != nil {
return err
Expand Down Expand Up @@ -334,7 +335,7 @@ func NewTxCmdBurnNFT() *cobra.Command {
return cmd
}

func NewTxCmdOperatorBurnNFT(ac address.Codec) *cobra.Command {
func NewTxCmdOperatorBurnNFT() *cobra.Command {
cmd := &cobra.Command{
Use: "operator-burn-nft [contract-id] [operator] [from] [token-id]",
Args: cobra.ExactArgs(4),
Expand All @@ -352,6 +353,7 @@ func NewTxCmdOperatorBurnNFT(ac address.Codec) *cobra.Command {
if err != nil {
return err
}
ac := clientCtx.InterfaceRegistry.SigningContext().AddressCodec()
if err = collection.ValidateContractID(args[0]); err != nil {
return err
}
Expand Down Expand Up @@ -415,7 +417,7 @@ func NewTxCmdModify() *cobra.Command {
return cmd
}

func NewTxCmdGrantPermission(ac address.Codec) *cobra.Command {
func NewTxCmdGrantPermission() *cobra.Command {
cmd := &cobra.Command{
Use: "grant-permission [contract-id] [granter] [grantee] [permission]",
Args: cobra.ExactArgs(4),
Expand All @@ -433,6 +435,7 @@ func NewTxCmdGrantPermission(ac address.Codec) *cobra.Command {
if err != nil {
return err
}
ac := clientCtx.InterfaceRegistry.SigningContext().AddressCodec()
if err = collection.ValidateContractID(args[0]); err != nil {
return err
}
Expand Down Expand Up @@ -490,7 +493,7 @@ func NewTxCmdRevokePermission() *cobra.Command {
return cmd
}

func NewTxCmdAuthorizeOperator(ac address.Codec) *cobra.Command {
func NewTxCmdAuthorizeOperator() *cobra.Command {
cmd := &cobra.Command{
Use: "authorize-operator [contract-id] [holder] [operator]",
Args: cobra.ExactArgs(3),
Expand All @@ -511,6 +514,7 @@ func NewTxCmdAuthorizeOperator(ac address.Codec) *cobra.Command {
if err = collection.ValidateContractID(args[0]); err != nil {
return err
}
ac := clientCtx.InterfaceRegistry.SigningContext().AddressCodec()
_, err = ac.StringToBytes(args[2])
if err != nil {
return err
Expand All @@ -529,7 +533,7 @@ func NewTxCmdAuthorizeOperator(ac address.Codec) *cobra.Command {
return cmd
}

func NewTxCmdRevokeOperator(ac address.Codec) *cobra.Command {
func NewTxCmdRevokeOperator() *cobra.Command {
cmd := &cobra.Command{
Use: "revoke-operator [contract-id] [holder] [operator]",
Args: cobra.ExactArgs(3),
Expand All @@ -547,6 +551,7 @@ func NewTxCmdRevokeOperator(ac address.Codec) *cobra.Command {
if err != nil {
return err
}
ac := clientCtx.InterfaceRegistry.SigningContext().AddressCodec()
if err = collection.ValidateContractID(args[0]); err != nil {
return err
}
Expand Down
Loading

0 comments on commit 009902a

Please sign in to comment.