Skip to content

Commit 91ed998

Browse files
committed
Fix: account.can_transact not needed anymore in instance delete (raised InsufficientFundsError)
1 parent 0a11b2d commit 91ed998

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
@@ -767,17 +767,20 @@ async def delete(
767767
fetched_settings = await fetch_settings()
768768
community_wallet_timestamp = fetched_settings.get("community_wallet_timestamp")
769769
community_wallet_address = fetched_settings.get("community_wallet_address")
770-
try: # Safety check to ensure account can transact
771-
account.can_transact()
772-
except Exception as e:
773-
echo(e)
774-
raise typer.Exit(code=1) from e
770+
775771
echo("Deleting the flows...")
776772
flow_crn_percent = Decimal("0.8") if community_wallet_timestamp < creation_time else Decimal("1")
777773
flow_com_percent = Decimal("1") - flow_crn_percent
778-
flow_hash_crn = await account.manage_flow(
779-
payment.receiver, Decimal(price.required_tokens) * flow_crn_percent, FlowUpdate.REDUCE
780-
)
774+
try:
775+
flow_hash_crn = await account.manage_flow(
776+
payment.receiver, Decimal(price.required_tokens) * flow_crn_percent, FlowUpdate.REDUCE
777+
)
778+
except InsufficientFundsError as e:
779+
echo(f"Error missing token type: {e.token_type}")
780+
echo(f"Required : {e.required_funds}")
781+
echo(f"Available : {e.available_funds}")
782+
raise typer.Exit(code=1) from e
783+
781784
if flow_hash_crn:
782785
echo(f"CRN flow has been deleted successfully (Tx: {flow_hash_crn})")
783786
if flow_com_percent > Decimal("0"):

0 commit comments

Comments
 (0)