You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(proxy): add list, reject, and remove --all (Closes#742)
New commands:
- btcli proxy list: query Proxy.Proxies storage for an account
- btcli proxy reject: reject a previously announced proxy call
Modified command:
- btcli proxy remove --all: remove every proxy at once
Implementation:
- proxy.py: _parse_proxy_storage, list_proxies, reject_announcement,
remove_all_proxies; handles nested substrate response formats
- cli.py: register proxy list/reject; extend proxy remove with --all
flag (mutually exclusive with --delegate)
- Specific exception handling (KeyError/TypeError/ValueError/IndexError)
with debug logging in _parse_proxy_storage
Note: CI will fail on import due to a pre-existing staging bug where
extract_mev_shield_id was removed from mev_shield.py but still imported
by sudo.py. This is not related to this PR.
Tests:
- 16 unit tests for parsing, list, reject, remove --all
- 2 E2E tests (test_proxy_list_after_add, test_proxy_remove_all)
- 1 E2E test (test_proxy_reject_announced)
prompt="Enter the SS58 address of the delegate to remove, e.g. 5dxds...",
9824
-
help="The SS58 address of the delegate to remove",
9829
+
help="The SS58 address of the delegate to remove. Mutually exclusive with --all.",
9825
9830
),
9826
-
] ="",
9831
+
] =None,
9832
+
remove_all: bool=typer.Option(
9833
+
False,
9834
+
"--all",
9835
+
help="Remove all proxies for the account at once.",
9836
+
),
9827
9837
network: Optional[list[str]] =Options.network,
9828
-
proxy_type: ProxyType=Options.proxy_type,
9838
+
proxy_type: ProxyType=typer.Option(
9839
+
ProxyType.Any.value,
9840
+
"--proxy-type",
9841
+
help="Type of proxy (only used with --delegate, not --all)",
9842
+
),
9829
9843
delay: int=typer.Option(0, help="Delay, in number of blocks"),
9830
9844
wallet_name: str=Options.wallet_name,
9831
9845
wallet_path: str=Options.wallet_path,
@@ -9842,24 +9856,21 @@ def proxy_remove(
9842
9856
"""
9843
9857
Unregisters a proxy from an account.
9844
9858
9845
-
Revokes proxy permissions previously granted to another account. This prevents the delegate account from executing any further transactions on your behalf.
9846
-
9847
-
9848
-
[bold]Example:[/bold]
9849
-
Revoke proxy permissions from a single proxy account
9850
-
[green]$[/green] btcli proxy remove --delegate 5GDel... --proxy-type Transfer
9851
-
9859
+
Revokes proxy permissions previously granted to another account. Use --delegate for a single proxy or --all to remove every proxy.
9852
9860
"""
9853
-
# TODO should add a --all flag to call Proxy.remove_proxies ?
9861
+
ifremove_allanddelegate:
9862
+
print_error("Cannot use --all and --delegate together. Choose one.")
9863
+
raisetyper.Exit(1)
9864
+
ifnotremove_allandnotdelegate:
9865
+
print_error("Either --delegate or --all is required.")
0 commit comments