44 "errors"
55 "fmt"
66
7+ "github.com/mdp/qrterminal/v3"
78 "github.com/spf13/cobra"
89
910 "cosmossdk.io/core/address"
@@ -30,6 +31,7 @@ const (
3031 FlagDevice = "device"
3132
3233 flagMultiSigThreshold = "multisig-threshold"
34+ flagQRCode = "qrcode"
3335)
3436
3537// ShowKeysCmd shows key information for a given key name.
@@ -49,6 +51,7 @@ consisting of all the keys provided by name and multisig threshold.`,
4951 f .BoolP (FlagPublicKey , "p" , false , "Output the public key only (overrides --output)" )
5052 f .BoolP (FlagDevice , "d" , false , "Output the address in a ledger device" )
5153 f .Int (flagMultiSigThreshold , 1 , "K out of N required signatures" )
54+ f .Bool (flagQRCode , false , "Display keys payment QR code, will be ignored if -a or --address is false" )
5255
5356 return cmd
5457}
@@ -96,6 +99,7 @@ func runShowCmd(cmd *cobra.Command, args []string) (err error) {
9699 isShowAddr , _ := cmd .Flags ().GetBool (FlagAddress )
97100 isShowPubKey , _ := cmd .Flags ().GetBool (FlagPublicKey )
98101 isShowDevice , _ := cmd .Flags ().GetBool (FlagDevice )
102+ isShowQRCode , _ := cmd .Flags ().GetBool (flagQRCode )
99103
100104 isOutputSet := false
101105 tmp := cmd .Flag (flags .FlagOutput )
@@ -126,6 +130,8 @@ func runShowCmd(cmd *cobra.Command, args []string) (err error) {
126130 out := ko .Address
127131 if isShowPubKey {
128132 out = ko .PubKey
133+ } else if isShowQRCode {
134+ qrterminal .GenerateHalfBlock (out , qrterminal .H , cmd .OutOrStdout ())
129135 }
130136
131137 if _ , err := fmt .Fprintln (cmd .OutOrStdout (), out ); err != nil {
0 commit comments