@@ -67,8 +67,7 @@ func GetTxCmd() *cobra.Command {
6767 MigrateContractCmd (),
6868 UpdateContractAdminCmd (),
6969 ClearContractAdminCmd (),
70- GrantAuthorizationCmd (),
71- GrantStoreCodeAuthorizationCmd (),
70+ GrantCmd (),
7271 UpdateInstantiateConfigCmd (),
7372 SubmitProposalCmd (),
7473 )
@@ -415,17 +414,31 @@ func parseExecuteArgs(contractAddr, execMsg string, sender sdk.AccAddress, flags
415414 }, nil
416415}
417416
417+ func GrantCmd () * cobra.Command {
418+ txCmd := & cobra.Command {
419+ Use : "grant" ,
420+ Short : "Grant a authz permission" ,
421+ DisableFlagParsing : true ,
422+ SilenceUsage : true ,
423+ }
424+ txCmd .AddCommand (
425+ GrantAuthorizationCmd (),
426+ GrantStoreCodeAuthorizationCmd (),
427+ )
428+ return txCmd
429+ }
430+
418431func GrantAuthorizationCmd () * cobra.Command {
419432 cmd := & cobra.Command {
420- Use : "grant [grantee] [ message_type=\" execution\" |\" migration\" ] [contract_addr_bech32] --allow-raw-msgs [msg1,msg2,...] --allow-msg-keys [key1,key2,...] --allow-all-messages" ,
421- Short : "Grant authorization to an address " ,
433+ Use : "contract [ message_type=\" execution\" |\" migration\" ] [grantee ] [contract_addr_bech32] --allow-raw-msgs [msg1,msg2,...] --allow-msg-keys [key1,key2,...] --allow-all-messages" ,
434+ Short : "Grant authorization to interact with a contract on behalf of you " ,
422435 Long : fmt .Sprintf (`Grant authorization to an address.
423436Examples:
424- $ %s tx grant <grantee_addr> execution <contract_addr> --allow-all-messages --max-calls 1 --no-token-transfer --expiration 1667979596
437+ $ %s tx grant contract execution <grantee_addr> <contract_addr> --allow-all-messages --max-calls 1 --no-token-transfer --expiration 1667979596
425438
426- $ %s tx grant <grantee_addr> execution <contract_addr> --allow-all-messages --max-funds 100000uwasm --expiration 1667979596
439+ $ %s tx grant contract execution <grantee_addr> <contract_addr> --allow-all-messages --max-funds 100000uwasm --expiration 1667979596
427440
428- $ %s tx grant <grantee_addr> execution <contract_addr> --allow-all-messages --max-calls 5 --max-funds 100000uwasm --expiration 1667979596
441+ $ %s tx grant contract execution <grantee_addr> <contract_addr> --allow-all-messages --max-calls 5 --max-funds 100000uwasm --expiration 1667979596
429442` , version .AppName , version .AppName , version .AppName ),
430443 Args : cobra .ExactArgs (3 ),
431444 RunE : func (cmd * cobra.Command , args []string ) error {
@@ -560,15 +573,15 @@ $ %s tx grant <grantee_addr> execution <contract_addr> --allow-all-messages --ma
560573
561574func GrantStoreCodeAuthorizationCmd () * cobra.Command {
562575 cmd := & cobra.Command {
563- Use : "grant [grantee] store-code [code_hash:permission]" ,
564- Short : "Grant authorization to an address " ,
576+ Use : "store-code [grantee] [code_hash:permission]" ,
577+ Short : "Grant authorization to upload contract code on behalf of you " ,
565578 Long : fmt .Sprintf (`Grant authorization to an address.
566579Examples:
567- $ %s tx grant <grantee_addr> store-code 13a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a5:everybody 1wqrtry681b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a5:nobody --expiration 1667979596
580+ $ %s tx grant store-code <grantee_addr> 13a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a5:everybody 1wqrtry681b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a5:nobody --expiration 1667979596
568581
569- $ %s tx grant <grantee_addr> store-code *:%s1l2rsakp388kuv9k8qzq6lrm9taddae7fpx59wm,%s1vx8knpllrj7n963p9ttd80w47kpacrhuts497x
582+ $ %s tx grant store-code <grantee_addr> *:%s1l2rsakp388kuv9k8qzq6lrm9taddae7fpx59wm,%s1vx8knpllrj7n963p9ttd80w47kpacrhuts497x
570583` , version .AppName , version .AppName , version .AppName , version .AppName ),
571- Args : cobra .MinimumNArgs (3 ),
584+ Args : cobra .MinimumNArgs (2 ),
572585 RunE : func (cmd * cobra.Command , args []string ) error {
573586 clientCtx , err := client .GetClientTxContext (cmd )
574587 if err != nil {
@@ -580,11 +593,7 @@ $ %s tx grant <grantee_addr> store-code *:%s1l2rsakp388kuv9k8qzq6lrm9taddae7fpx5
580593 return err
581594 }
582595
583- if args [1 ] != "store-code" {
584- return fmt .Errorf ("%s authorization type not supported" , args [1 ])
585- }
586-
587- grants , err := parseStoreCodeGrants (args [2 :])
596+ grants , err := parseStoreCodeGrants (args [1 :])
588597 if err != nil {
589598 return err
590599 }
0 commit comments