Skip to content

Commit 3548b53

Browse files
committed
Fix: account.can_transact not needed anymore in instance delete (raised InsufficientFundsError)
1 parent 671ea0e commit 3548b53

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/aleph_client/commands/instance/__init__.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -772,17 +772,20 @@ async def delete(
772772
fetched_settings = await fetch_settings()
773773
community_wallet_timestamp = fetched_settings.get("community_wallet_timestamp")
774774
community_wallet_address = fetched_settings.get("community_wallet_address")
775-
try: # Safety check to ensure account can transact
776-
account.can_transact()
777-
except Exception as e:
778-
echo(e)
779-
raise typer.Exit(code=1) from e
775+
780776
echo("Deleting the flows...")
781777
flow_crn_percent = Decimal("0.8") if community_wallet_timestamp < creation_time else Decimal("1")
782778
flow_com_percent = Decimal("1") - flow_crn_percent
783-
flow_hash_crn = await account.manage_flow(
784-
payment.receiver, Decimal(price.required_tokens) * flow_crn_percent, FlowUpdate.REDUCE
785-
)
779+
try:
780+
flow_hash_crn = await account.manage_flow(
781+
payment.receiver, Decimal(price.required_tokens) * flow_crn_percent, FlowUpdate.REDUCE
782+
)
783+
except InsufficientFundsError as e:
784+
echo(f"Error missing token type: {e.token_type}")
785+
echo(f"Required : {e.required_funds}")
786+
echo(f"Available : {e.available_funds}")
787+
raise typer.Exit(code=1) from e
788+
786789
if flow_hash_crn:
787790
echo(f"CRN flow has been deleted successfully (Tx: {flow_hash_crn})")
788791
if flow_com_percent > Decimal("0"):

0 commit comments

Comments
 (0)