Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions backend/core/src/core/dtos/chat/rule/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import Self

from pydantic import BaseModel, computed_field, Field
from pytonapi.utils import raw_to_userfriendly

from core.constants import (
PROMOTE_JETTON_TEMPLATE,
Expand Down Expand Up @@ -52,12 +53,22 @@ class ChatEligibilityRuleDTO(BaseModel):
def promote_url(self) -> str | None:
match self.type:
case EligibilityCheckType.JETTON:
if not self.blockchain_address:
return None

return PROMOTE_JETTON_TEMPLATE.format(
jetton_master_address=self.blockchain_address
jetton_master_address=raw_to_userfriendly(
self.blockchain_address, is_bounceable=True
)
)
case EligibilityCheckType.NFT_COLLECTION:
if not self.blockchain_address:
return None

return PROMOTE_NFT_COLLECTION_TEMPLATE.format(
collection_address=self.blockchain_address
collection_address=raw_to_userfriendly(
self.blockchain_address, is_bounceable=True
)
)
case EligibilityCheckType.TONCOIN:
return BUY_TONCOIN_URL
Expand Down
Loading