feat(@desktop/token): Add community id to Token struct (#12534)

This commit is contained in:
Cuteivist 2023-10-27 19:09:03 +02:00 committed by GitHub
parent 113810e31a
commit bbfe9a89f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -481,6 +481,7 @@ proc buildTokensAndCollectiblesFromWallet(self: Module) =
name = token.name,
symbol = token.symbol,
color = token.color,
communityId = token.communityId,
image = "",
category = ord(TokenListItemCategory.General),
)

View File

@ -23,6 +23,7 @@ type
color*: string
isCustom* {.dontSerialize.}: bool
isVisible* {.dontSerialize.}: bool
communityId*: string
proc newTokenDto*(
name: string,
@ -32,6 +33,7 @@ proc newTokenDto*(
decimals: int,
hasIcon: bool,
isCustom: bool = false,
communityId: string = ""
): TokenDto =
return TokenDto(
name: name,
@ -40,6 +42,7 @@ proc newTokenDto*(
symbol: symbol,
decimals: decimals,
hasIcon: hasIcon,
communityId: communityId,
isCustom: isCustom
)
@ -54,6 +57,7 @@ proc toTokenDto*(jsonObj: JsonNode, isVisible: bool, hasIcon: bool = false, isCu
discard jsonObj.getProp("symbol", result.symbol)
discard jsonObj.getProp("decimals", result.decimals)
discard jsonObj.getProp("color", result.color)
discard jsonObj.getProp("communityId", result.communityId)
result.isVisible = isVisible
proc addressAsString*(self: TokenDto): string =