Skip to content

Commit

Permalink
feat(x/nft): add autocli options for tx (#17825)
Browse files Browse the repository at this point in the history
(cherry picked from commit c0d2d70)

# Conflicts:
#	x/nft/client/cli/tx_test.go
  • Loading branch information
julienrbrt authored and mergify[bot] committed Oct 5, 2023
1 parent 3da9f9c commit 68892b7
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 74 deletions.
6 changes: 6 additions & 0 deletions x/nft/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,9 @@ Ref: https://keepachangelog.com/en/1.0.0/
-->

# Changelog

## [Unreleased]

### Features

* [#17825](https://github.com/cosmos/cosmos-sdk/pull/17825) Add AutoCLI Options.
66 changes: 0 additions & 66 deletions x/nft/client/cli/tx.go

This file was deleted.

2 changes: 1 addition & 1 deletion x/nft/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ require (
github.com/golang/mock v1.6.0
github.com/golang/protobuf v1.5.3
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/spf13/cobra v1.7.0
github.com/stretchr/testify v1.8.4
google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e
google.golang.org/grpc v1.58.1
Expand Down Expand Up @@ -123,6 +122,7 @@ require (
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/spf13/afero v1.9.5 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/cobra v1.7.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.16.0 // indirect
Expand Down
13 changes: 13 additions & 0 deletions x/nft/module/autocli.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,19 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
},
Tx: &autocliv1.ServiceCommandDescriptor{
Service: nftv1beta1.Msg_ServiceDesc.ServiceName,
RpcCommandOptions: []*autocliv1.RpcCommandOptions{
{
RpcMethod: "Send",
Use: "send [class-id] [nft-id] [receiver] --from [sender]",
Short: "Transfer ownership of NFT",
PositionalArgs: []*autocliv1.PositionalArgDescriptor{
{ProtoField: "class_id"},
{ProtoField: "id"},
{ProtoField: "receiver"},
},
// Sender is the signer of the transaction and is automatically added as from flag by AutoCLI.
},
},
},
}
}
7 changes: 0 additions & 7 deletions x/nft/module/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/json"

gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"
"google.golang.org/grpc"

modulev1 "cosmossdk.io/api/cosmos/nft/module/v1"
Expand All @@ -15,7 +14,6 @@ import (
"cosmossdk.io/depinject"
"cosmossdk.io/errors"
"cosmossdk.io/x/nft"
"cosmossdk.io/x/nft/client/cli"
"cosmossdk.io/x/nft/keeper"
"cosmossdk.io/x/nft/simulation"

Expand Down Expand Up @@ -86,11 +84,6 @@ func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx sdkclient.Context, mux
}
}

// GetTxCmd returns the transaction commands for the nft module
func (AppModuleBasic) GetTxCmd() *cobra.Command {
return cli.GetTxCmd()
}

// AppModule implements the sdk.AppModule interface
type AppModule struct {
AppModuleBasic
Expand Down

0 comments on commit 68892b7

Please sign in to comment.