INNER CODE UNIT · Python
_render_short_key
FLOCK4H/Dexter · Dexter.py:219
def _render_short_key(value: str | None) -> str:
if not value:
return "(unset)"
text = str(value)
if len(text) <= 12:
return text
return f"{text[:4]}...{text[-4:]}"
def _price_to_lamports(token_balance: int, price: Decimal) -> int:
if token_balance <= 0 or price <= 0:
return 0
return int(
(Decimal(int(token_balance)) / Decimal("1000000"))
* price
* Decimal("1000000000")
)