-
Notifications
You must be signed in to change notification settings - Fork 586
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
feat(08-wasm): expose migrate entry point for 08-wasm #6231
Changes from all commits
b29c96a
866d6dd
7e98cb7
9d4a6d2
2d74aaa
204b40e
b6515af
4b7eee7
0e7b454
77b3f6c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ func newSubmitStoreCodeProposalCmd() *cobra.Command { | |
Use: "store-code [path/to/wasm-file]", | ||
Short: "Reads wasm code from the file and creates a proposal to store the wasm code", | ||
Long: "Reads wasm code from the file and creates a proposal to store the wasm code", | ||
Example: fmt.Sprintf("%s tx %s wasm [path/to/wasm_file]", version.AppName, ibcexported.ModuleName), | ||
Example: fmt.Sprintf("%s tx %s-wasm store-code [path/to/wasm_file]", version.AppName, ibcexported.ModuleName), | ||
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. I noticed this was wrong, so I took the liberty to fix it here. |
||
Args: cobra.ExactArgs(1), | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
clientCtx, err := client.GetClientTxContext(cmd) | ||
|
@@ -82,3 +82,41 @@ func newSubmitStoreCodeProposalCmd() *cobra.Command { | |
|
||
return cmd | ||
} | ||
|
||
func newMigrateContractCmd() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "migrate-contract [client-id] [checksum] [migrate-msg]", | ||
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. I renamed 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. Does this cmd also support passing the json msg as a path to a file? We do that on many other cmds that accept some kind of sub msg. Do you think we should support this? cc. @crodriguezvega @srdtrk 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. I guess most contracts for now will not do anything with this message, so most of the times it will be just |
||
Short: "Migrates a contract to a new byte code", | ||
Long: "Migrates the contract for the specified client ID to the byte code corresponding to checksum, passing the JSON-encoded migrate message to the contract", | ||
Example: fmt.Sprintf("%s tx %s-wasm migrate-contract 08-wasm-0 b3a49b2914f5e6a673215e74325c1d153bb6776e079774e52c5b7e674d9ad3ab {}", version.AppName, ibcexported.ModuleName), | ||
Args: cobra.ExactArgs(3), // Ensure exactly three arguments are passed | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
clientCtx, err := client.GetClientTxContext(cmd) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
clientID := args[0] | ||
checksum := args[1] | ||
migrateMsg := args[2] | ||
|
||
// Construct the message | ||
msg := &types.MsgMigrateContract{ | ||
Signer: clientCtx.GetFromAddress().String(), | ||
ClientId: clientID, | ||
Checksum: []byte(checksum), | ||
Msg: []byte(migrateMsg), | ||
} | ||
|
||
if err := msg.ValidateBasic(); err != nil { | ||
return err | ||
} | ||
|
||
// Generate or broadcast the transaction | ||
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) | ||
}, | ||
} | ||
|
||
flags.AddTxFlagsToCmd(cmd) | ||
return cmd | ||
} |
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.
Ensure consistency in the use of backticks for command names.
Committable suggestion