Skip to content
Snippets Groups Projects
Commit 40bd0763 authored by Jakub Ziebinski's avatar Jakub Ziebinski Committed by Jakub Ziebinski
Browse files

Create operation_summary screen with remove withdraw vesting route

parent b11603e2
No related branches found
No related tags found
No related merge requests found
from __future__ import annotations
from typing import TYPE_CHECKING, ClassVar, Final
from clive.__private.ui.operations.operation_summary.operation_summary import OperationSummary
from clive.__private.ui.widgets.inputs.labelized_input import LabelizedInput
from schemas.operations import SetWithdrawVestingRouteOperation
if TYPE_CHECKING:
from textual.app import ComposeResult
from schemas.apis.database_api.fundaments_of_reponses import WithdrawVestingRoutesFundament as WithdrawRoute
WITHDRAW_ROUTE_REMOVE_PERCENT: Final[int] = 0
class RemoveWithdrawVestingRoute(OperationSummary):
"""Screen to remove withdraw vesting route."""
BIG_TITLE: ClassVar[str] = "Remove withdraw route"
def __init__(self, withdraw_route: WithdrawRoute) -> None:
super().__init__()
self._withdraw_route = withdraw_route
def content(self) -> ComposeResult:
yield LabelizedInput("From account", self.working_account)
yield LabelizedInput("To account", self._withdraw_route.to_account)
yield LabelizedInput("Percent", str(self._withdraw_route.percent / 100))
yield LabelizedInput("Auto vest", str(self._withdraw_route.auto_vest))
def _create_operation(self) -> SetWithdrawVestingRouteOperation | None:
return SetWithdrawVestingRouteOperation(
from_account=self.working_account,
to_account=self._withdraw_route.to_account,
auto_vest=self._withdraw_route.auto_vest,
percent=WITHDRAW_ROUTE_REMOVE_PERCENT,
)
@property
def working_account(self) -> str:
return self.app.world.profile_data.working_account.name
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment