Skip to content

Commit ef2ec2b

Browse files
committed
feat(CLI): add enable/disable to modules cli
1 parent 090034e commit ef2ec2b

1 file changed

Lines changed: 32 additions & 2 deletions

File tree

ape_safe/_cli/modules.py

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
from typing import TYPE_CHECKING
22

33
import click
4-
from ape.cli import ConnectedProviderCommand, network_option
4+
from ape.cli import ConnectedProviderCommand, account_option, network_option
5+
from ape.types import AddressType
56

6-
from ape_safe._cli.click_ext import safe_cli_ctx, safe_option
7+
from ape_safe._cli.click_ext import safe_argument
78

89
if TYPE_CHECKING:
10+
from ape.api import AccountAPI
911

1012
from ape_safe.accounts import SafeAccount
1113

@@ -38,3 +40,31 @@ def guard(cli_ctx, safe: "SafeAccount") -> None:
3840

3941
else:
4042
click.secho("No Module Guard set", fg="red")
43+
44+
45+
@modules.command(cls=ConnectedProviderCommand)
46+
@network_option()
47+
@account_option()
48+
@safe_argument
49+
@click.argument("module", type=AddressType)
50+
def enable(safe: "SafeAccount", account: "AccountAPI", module: AddressType):
51+
"""
52+
Enable MODULE for SAFE
53+
54+
**WARNING**: This is a potentially destructive action, and may make your safe vulnerable.
55+
"""
56+
safe.modules.enable(module, submitter=account)
57+
58+
59+
@modules.command(cls=ConnectedProviderCommand)
60+
@network_option()
61+
@account_option()
62+
@safe_argument
63+
@click.argument("module", type=AddressType)
64+
def disable(safe: "SafeAccount", account: "AccountAPI", module: AddressType):
65+
"""
66+
Disable MODULE for SAFE
67+
68+
**WARNING**: This is a potentially destructive action, and may impact operations of your safe.
69+
"""
70+
safe.modules.disable(module, submitter=account)

0 commit comments

Comments
 (0)