fix: code review

This commit is contained in:
Richard Ramos 2020-11-02 14:22:54 -04:00 committed by Iuri Matias
parent bba08d87b8
commit 3e4e2dae0d
2 changed files with 4 additions and 2 deletions

View File

@ -81,10 +81,9 @@ QtObject:
TokenRoles.Decimals.int:"decimals",
TokenRoles.IsCustom.int:"isCustom"}.toTable
# Resolving a ENS name
proc getTokenDetails*(self: TokenList, address: string) {.slot.} =
spawnAndSend(self, "tokenDetailsResolved") do:
let tkn = newErc20Contract("", getCurrentNetwork(), address.parseAddress, "", 18, false)
let tkn = newErc20Contract(getCurrentNetwork(), address.parseAddress)
let decimals = tkn.tokenDecimals()

View File

@ -73,6 +73,9 @@ type
proc newErc20Contract*(name: string, network: Network, address: Address, symbol: string, decimals: int, hasIcon: bool): Erc20Contract =
Erc20Contract(name: name, network: network, address: address, methods: ERC20_METHODS.toTable, symbol: symbol, decimals: decimals, hasIcon: hasIcon)
proc newErc20Contract*(network: Network, address: Address): Erc20Contract =
Erc20Contract(name: "", network: network, address: address, methods: ERC20_METHODS.toTable, symbol: "", decimals: 0, hasIcon: false)
proc newErc721Contract(name: string, network: Network, address: Address, symbol: string, hasIcon: bool, addlMethods: seq[tuple[name: string, meth: Method]] = @[]): Erc721Contract =
Erc721Contract(name: name, network: network, address: address, symbol: symbol, hasIcon: hasIcon, methods: ERC721_ENUMERABLE_METHODS.concat(addlMethods).toTable)