@@ -67,8 +67,7 @@ func GetTxCmd() *cobra.Command {
67
67
MigrateContractCmd (),
68
68
UpdateContractAdminCmd (),
69
69
ClearContractAdminCmd (),
70
- GrantAuthorizationCmd (),
71
- GrantStoreCodeAuthorizationCmd (),
70
+ GrantCmd (),
72
71
UpdateInstantiateConfigCmd (),
73
72
SubmitProposalCmd (),
74
73
)
@@ -415,17 +414,31 @@ func parseExecuteArgs(contractAddr, execMsg string, sender sdk.AccAddress, flags
415
414
}, nil
416
415
}
417
416
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
+
418
431
func GrantAuthorizationCmd () * cobra.Command {
419
432
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 " ,
422
435
Long : fmt .Sprintf (`Grant authorization to an address.
423
436
Examples:
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
425
438
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
427
440
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
429
442
` , version .AppName , version .AppName , version .AppName ),
430
443
Args : cobra .ExactArgs (3 ),
431
444
RunE : func (cmd * cobra.Command , args []string ) error {
@@ -560,15 +573,15 @@ $ %s tx grant <grantee_addr> execution <contract_addr> --allow-all-messages --ma
560
573
561
574
func GrantStoreCodeAuthorizationCmd () * cobra.Command {
562
575
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 " ,
565
578
Long : fmt .Sprintf (`Grant authorization to an address.
566
579
Examples:
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
568
581
569
- $ %s tx grant <grantee_addr> store-code *:%s1l2rsakp388kuv9k8qzq6lrm9taddae7fpx59wm,%s1vx8knpllrj7n963p9ttd80w47kpacrhuts497x
582
+ $ %s tx grant store-code <grantee_addr> *:%s1l2rsakp388kuv9k8qzq6lrm9taddae7fpx59wm,%s1vx8knpllrj7n963p9ttd80w47kpacrhuts497x
570
583
` , version .AppName , version .AppName , version .AppName , version .AppName ),
571
- Args : cobra .MinimumNArgs (3 ),
584
+ Args : cobra .MinimumNArgs (2 ),
572
585
RunE : func (cmd * cobra.Command , args []string ) error {
573
586
clientCtx , err := client .GetClientTxContext (cmd )
574
587
if err != nil {
@@ -580,11 +593,7 @@ $ %s tx grant <grantee_addr> store-code *:%s1l2rsakp388kuv9k8qzq6lrm9taddae7fpx5
580
593
return err
581
594
}
582
595
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 :])
588
597
if err != nil {
589
598
return err
590
599
}
0 commit comments