1
1
package cli
2
2
3
3
import (
4
- "errors"
5
4
"fmt"
6
5
"os"
7
6
8
7
"github.com/spf13/cobra"
9
8
"github.com/spf13/viper"
10
- "github.com/tendermint/go-amino"
9
+ amino "github.com/tendermint/go-amino"
11
10
12
11
"github.com/cosmos/cosmos-sdk/client"
13
12
"github.com/cosmos/cosmos-sdk/client/context"
@@ -55,7 +54,7 @@ be generated via the 'multisign' command.
55
54
RunE : makeSignCmd (codec ),
56
55
Args : cobra .ExactArgs (1 ),
57
56
}
58
- cmd . Flags (). String ( client . FlagName , "" , "Name of private key with which to sign" )
57
+
59
58
cmd .Flags ().String (flagMultisig , "" ,
60
59
"Address of the multisig account on behalf of which the " +
61
60
"transaction shall be signed" )
@@ -69,7 +68,7 @@ be generated via the 'multisign' command.
69
68
cmd .Flags ().String (flagOutfile , "" ,
70
69
"The document will be written to the given file instead of STDOUT" )
71
70
72
- // Add the flags here and return the command
71
+ // add the flags here and return the command
73
72
return client .PostCommands (cmd )[0 ]
74
73
}
75
74
@@ -92,9 +91,9 @@ func makeSignCmd(cdc *amino.Codec) func(cmd *cobra.Command, args []string) error
92
91
return nil
93
92
}
94
93
95
- name := viper .GetString (client .FlagName )
96
- if name == "" {
97
- return errors . New ("required flag \" name \" has not been set" )
94
+ from := viper .GetString (client .FlagFrom )
95
+ if from == "" {
96
+ return fmt . Errorf ("required flag '%s' has not been set" , client . FlagFrom )
98
97
}
99
98
100
99
// if --signature-only is on, then override --append
@@ -104,19 +103,21 @@ func makeSignCmd(cdc *amino.Codec) func(cmd *cobra.Command, args []string) error
104
103
105
104
if multisigAddrStr != "" {
106
105
var multisigAddr sdk.AccAddress
106
+
107
107
multisigAddr , err = sdk .AccAddressFromBech32 (multisigAddrStr )
108
108
if err != nil {
109
109
return err
110
110
}
111
111
112
112
newTx , err = utils .SignStdTxWithSignerAddress (
113
- txBldr , cliCtx , multisigAddr , name , stdTx , offline )
113
+ txBldr , cliCtx , multisigAddr , cliCtx .GetFromName (), stdTx , offline ,
114
+ )
114
115
generateSignatureOnly = true
115
116
} else {
116
117
appendSig := viper .GetBool (flagAppend ) && ! generateSignatureOnly
117
- newTx , err = utils .SignStdTx (
118
- txBldr , cliCtx , name , stdTx , appendSig , offline )
118
+ newTx , err = utils .SignStdTx (txBldr , cliCtx , cliCtx .GetFromName (), stdTx , appendSig , offline )
119
119
}
120
+
120
121
if err != nil {
121
122
return err
122
123
}
@@ -128,13 +129,16 @@ func makeSignCmd(cdc *amino.Codec) func(cmd *cobra.Command, args []string) error
128
129
switch cliCtx .Indent {
129
130
case true :
130
131
json , err = cdc .MarshalJSONIndent (newTx .Signatures [0 ], "" , " " )
132
+
131
133
default :
132
134
json , err = cdc .MarshalJSON (newTx .Signatures [0 ])
133
135
}
136
+
134
137
default :
135
138
switch cliCtx .Indent {
136
139
case true :
137
140
json , err = cdc .MarshalJSONIndent (newTx , "" , " " )
141
+
138
142
default :
139
143
json , err = cdc .MarshalJSON (newTx )
140
144
}
0 commit comments