refactor: TokenCriteriaType -> TokenType
This commit is contained in:
parent
467539446d
commit
2e45889a9a
|
@ -1128,7 +1128,7 @@ method createOrEditCommunityTokenPermission*(self: Module, communityId: string,
|
|||
let viewAmount = tokenCriteria{"amount"}.getFloat
|
||||
var tokenCriteriaDto = tokenCriteria.toTokenCriteriaDto
|
||||
let contractAddresses = self.controller.getContractAddressesForToken(tokenCriteriaDto.symbol)
|
||||
if contractAddresses.len == 0 and tokenCriteriaDto.`type` != TokenCriteriaType.ENS:
|
||||
if contractAddresses.len == 0 and tokenCriteriaDto.`type` != community_dto.TokenType.ENS:
|
||||
if permissionId == "":
|
||||
self.onCommunityTokenPermissionCreationFailed(communityId)
|
||||
return
|
||||
|
|
|
@ -58,7 +58,7 @@ QtObject:
|
|||
case enumRole:
|
||||
of ModelRole.Key:
|
||||
|
||||
if item.getType() == ord(TokenCriteriaType.ENS):
|
||||
if item.getType() == ord(TokenType.ENS):
|
||||
result = newQVariant(item.getEnsPattern())
|
||||
else:
|
||||
result = newQVariant(item.getSymbol())
|
||||
|
|
|
@ -34,15 +34,15 @@ type TokenPermissionType* {.pure.}= enum
|
|||
BecomeAdmin = 1,
|
||||
BecomeMember = 2
|
||||
|
||||
type TokenCriteriaType* {.pure.}= enum
|
||||
type TokenType* {.pure.}= enum
|
||||
Unknown = 0,
|
||||
ERC20 = 1,
|
||||
ERC721 = 2,
|
||||
ENS = 3
|
||||
ENS = 3 # ENS is also ERC721 but we want to distinguish without heuristics
|
||||
|
||||
type TokenCriteriaDto* = object
|
||||
contractAddresses* {.serializedFieldName("contract_addresses").}: Table[int, string]
|
||||
`type`* {.serializedFieldName("type").}: TokenCriteriaType
|
||||
`type`* {.serializedFieldName("type").}: TokenType
|
||||
symbol* {.serializedFieldName("symbol").}: string
|
||||
name* {.serializedFieldName("name").}: string
|
||||
amount* {.serializedFieldName("amount").}: string
|
||||
|
@ -171,8 +171,8 @@ proc toTokenCriteriaDto*(jsonObj: JsonNode): TokenCriteriaDto =
|
|||
|
||||
var typeInt: int
|
||||
discard jsonObj.getProp("type", typeInt)
|
||||
if (typeInt >= ord(low(TokenCriteriaType)) and typeInt <= ord(high(TokenCriteriaType))):
|
||||
result.`type` = TokenCriteriaType(typeInt)
|
||||
if (typeInt >= ord(low(TokenType)) and typeInt <= ord(high(TokenType))):
|
||||
result.`type` = TokenType(typeInt)
|
||||
|
||||
var contractAddressesObj: JsonNode
|
||||
if(jsonObj.getProp("contractAddresses", contractAddressesObj) and contractAddressesObj.kind == JObject):
|
||||
|
@ -188,7 +188,7 @@ proc toTokenCriteriaDto*(jsonObj: JsonNode): TokenCriteriaDto =
|
|||
# When `toTokenCriteriaDto` is called with data coming from
|
||||
# the front-end, there's a key field we have to account for
|
||||
if jsonObj.hasKey("key"):
|
||||
if result.`type` == TokenCriteriaType.ENS:
|
||||
if result.`type` == TokenType.ENS:
|
||||
discard jsonObj.getProp("key", result.ensPattern)
|
||||
else:
|
||||
discard jsonObj.getProp("key", result.symbol)
|
||||
|
|
Loading…
Reference in New Issue