-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Add the option of emitting amino encoded json from the CLI #7221
Merged
Merged
Changes from 2 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
df7d601
Add the option of emitting amino encoded json
zmanian 1b1eb57
Update AMINO JSON serialization with ConvertTxToStdTx
zmanian 9469598
Make the Amino flag more self documenting by serializing the Broadcas…
zmanian 2f82b06
Merge branch 'master' of github.com:cosmos/cosmos-sdk into zaki-cli-g…
zmanian f344fdb
Handle amino encoding error
zmanian a2a8247
Merge branch 'master' into zaki-cli-generates-signed-amino-encoded-txs
fedekunze fd55fd0
Merge branch 'master' into zaki-cli-generates-signed-amino-encoded-txs
ca1d556
Update x/auth/client/cli/tx_multisign.go
zmanian ebb14b4
Update x/auth/client/cli/tx_sign.go
zmanian 877e0fd
Merge branch 'master' into zaki-cli-generates-signed-amino-encoded-txs
zmanian fe9c271
Apply suggestions from code review
zmanian f4b15a9
Merge branch 'master' into zaki-cli-generates-signed-amino-encoded-txs
mergify[bot] c821343
Fix go format
zmanian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -18,6 +18,7 @@ const ( | |||||||
flagMultisig = "multisig" | ||||||||
flagAppend = "append" | ||||||||
flagSigOnly = "signature-only" | ||||||||
flagAmino = "amino" | ||||||||
) | ||||||||
|
||||||||
// GetSignBatchCommand returns the transaction sign-batch command. | ||||||||
|
@@ -187,6 +188,7 @@ be generated via the 'multisign' command. | |||||||
cmd.Flags().Bool(flagSigOnly, false, "Print only the generated signature, then exit") | ||||||||
cmd.Flags().String(flags.FlagOutputDocument, "", "The document will be written to the given file instead of STDOUT") | ||||||||
cmd.Flags().String(flags.FlagChainID, "", "The network chain ID") | ||||||||
cmd.Flags().Bool(flagAmino, false, "Generate Amino encoded JSON suitable for submiting to the txs REST endpoint") | ||||||||
cmd.MarkFlagRequired(flags.FlagFrom) | ||||||||
flags.AddTxFlagsToCmd(cmd) | ||||||||
|
||||||||
|
@@ -257,11 +259,32 @@ func makeSignCmd() func(cmd *cobra.Command, args []string) error { | |||||||
return err | ||||||||
} | ||||||||
|
||||||||
json, err := marshalSignatureJSON(txCfg, txBuilder, generateSignatureOnly) | ||||||||
aminoJSON, err := cmd.Flags().GetBool(flagAmino) | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto
zmanian marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
|
||||||||
if err != nil { | ||||||||
return err | ||||||||
} | ||||||||
Comment on lines
265
to
267
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
|
||||||||
var json []byte | ||||||||
|
||||||||
if aminoJSON { | ||||||||
stdTx, err := tx.ConvertTxToStdTx(clientCtx.LegacyAmino, txBuilder.GetTx()) | ||||||||
if err != nil { | ||||||||
return err | ||||||||
} | ||||||||
|
||||||||
json, err = clientCtx.LegacyAmino.MarshalJSON(stdTx) | ||||||||
if err != nil { | ||||||||
return err | ||||||||
} | ||||||||
|
||||||||
zmanian marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
} else { | ||||||||
json, err = marshalSignatureJSON(txCfg, txBuilder, generateSignatureOnly) | ||||||||
if err != nil { | ||||||||
return err | ||||||||
} | ||||||||
} | ||||||||
|
||||||||
outputDoc, _ := cmd.Flags().GetString(flags.FlagOutputDocument) | ||||||||
if outputDoc == "" { | ||||||||
cmd.Printf("%s\n", json) | ||||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can ignore the error IMHO