Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixed cli issues #10

Merged
merged 1 commit into from
Dec 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions client/cli/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,16 @@ func init() {
FsMintONFT.String(FlagDescription, "", "Description of onft")
FsMintONFT.String(FlagData, "", "custom data of onft")

FsMintONFT.Bool(FlagTransferable, true, "transferability of onft (true | false)")
FsMintONFT.Bool(FlagExtensible, false, "extensisbility of onft (true | false)")
FsMintONFT.String(FlagTransferable, "yes", "transferability of onft (yes | no)")
FsMintONFT.String(FlagExtensible, "yes", "extensisbility of onft (yes | no)")

FsEditONFT.String(FlagMediaURI, "[do-not-modify]", "Media uri of onft")
FsEditONFT.String(FlagPreviewURI, "[do-not-modify]", "Preview uri of onft")
FsEditONFT.String(FlagName, "[do-not-modify]", "Name of nft")
FsEditONFT.String(FlagDescription, "[do-not-modify]", "Description of onft")
FsEditONFT.String(FlagTransferable, "[do-not-modify]", "transferability of onft")
FsEditONFT.String(FlagData, "[do-not-modify]", "custom data of onft")
FsEditONFT.String(FlagExtensible, "yes", "extensibility of onft (yes | no)")

FsTransferONFT.String(FlagRecipient, "", "Receiver of the onft. default value is sender address of transaction")
FsQuerySupply.String(FlagOwner, "", "The owner of a nft")
Expand Down
29 changes: 22 additions & 7 deletions client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func GetCmdMintONFT() *cobra.Command {
fmt.Sprintf(`Mint an oNFT.
Example:
$ %s tx onft mint [denom-id] --type <onft-type> --name <onft-name> --description <onft-descritpion> --media-uri=<uri> --preview-uri=<uri>
--transferable --extensible --recipient=<recipient> --from=<key-name> --chain-id=<chain-id> --fees=<fee>`,
--transferable yes --extensible yes --recipient=<recipient> --from=<key-name> --chain-id=<chain-id> --fees=<fee>`,
version.AppName,
),
),
Expand Down Expand Up @@ -167,15 +167,31 @@ $ %s tx onft mint [denom-id] --type <onft-type> --name <onft-name> --description
return err
}

transferable, err := cmd.Flags().GetBool(FlagTransferable)
var transferable bool
transferability, err := cmd.Flags().GetString(FlagTransferable)
if err != nil {
return err
}

extensible, err := cmd.Flags().GetBool(FlagExtensible)
transferability = strings.ToLower(transferability)
if transferability == "false" || transferability == "no" {
transferable = false
} else if transferability == "true" || transferability == "yes" {
transferable = true
} else {
return fmt.Errorf("invalid option for transferable flag , valid options are true|false, yes|no")
}
var extensible bool
extensibility, err := cmd.Flags().GetString(FlagExtensible)
if err != nil {
return err
}
if extensibility == "false" || extensibility == "no" {
extensible = false
} else if extensibility == "true" || extensibility == "yes" {
extensible = true
} else {
return fmt.Errorf("invalid option for extensible flag , valid options are yes|no")
}

msg := types.NewMsgMintONFT(
denomId,
Expand Down Expand Up @@ -206,7 +222,7 @@ func GetCmdEditONFT() *cobra.Command {
fmt.Sprintf(`Edit the data of an oNFT.
Example:
$ %s tx onft edit [denom-id] [onft-id] --name=<onft-name> --description=<onft-description> --media-uri=<uri>
--preview-uri=<uri> --type=<onft-type> --transferable=<yes|no> --from=<key-name> --chain-id=<chain-id> --fees=<fee>`,
--preview-uri=<uri> --type=<onft-type> --transferable=yes --extensible=yes --from=<key-name> --chain-id=<chain-id> --fees=<fee>`,
version.AppName,
),
),
Expand Down Expand Up @@ -273,8 +289,7 @@ $ %s tx onft edit [denom-id] [onft-id] --name=<onft-name> --description=<onft-de
if err != nil {
return err
}
if !(len(extensible) > 0 && (extensible == "no" || extensible == "yes" ||
extensible == types.DoNotModify)) {
if !(len(extensible) > 0 && (extensible == "no" || extensible == "yes" || extensible == types.DoNotModify)) {
return fmt.Errorf("invalid option for extensible flag , valid options are yes|no")
}
msg := types.NewMsgEditONFT(
Expand Down