|
1 | 1 | from typing import TYPE_CHECKING |
2 | 2 |
|
3 | 3 | 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 |
5 | 6 |
|
6 | | -from ape_safe._cli.click_ext import safe_cli_ctx, safe_option |
| 7 | +from ape_safe._cli.click_ext import safe_argument |
7 | 8 |
|
8 | 9 | if TYPE_CHECKING: |
| 10 | + from ape.api import AccountAPI |
9 | 11 |
|
10 | 12 | from ape_safe.accounts import SafeAccount |
11 | 13 |
|
@@ -38,3 +40,31 @@ def guard(cli_ctx, safe: "SafeAccount") -> None: |
38 | 40 |
|
39 | 41 | else: |
40 | 42 | 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