refactor token_list usage of libstatus
This commit is contained in:
parent
000ddf0ddc
commit
29e794b8cf
|
@ -5,8 +5,7 @@ import # vendor libs
|
||||||
NimQml
|
NimQml
|
||||||
|
|
||||||
import # status-desktop libs
|
import # status-desktop libs
|
||||||
../../../status/[utils],
|
../../../status/[utils, tokens, settings],
|
||||||
../../../status/libstatus/[tokens, settings, eth/contracts],
|
|
||||||
../../../status/tasks/[qt, task_runner_impl], ../../../status/status
|
../../../status/tasks/[qt, task_runner_impl], ../../../status/status
|
||||||
from web3/conversions import `$`
|
from web3/conversions import `$`
|
||||||
|
|
||||||
|
@ -72,7 +71,7 @@ QtObject:
|
||||||
|
|
||||||
proc loadCustomTokens*(self: TokenList) =
|
proc loadCustomTokens*(self: TokenList) =
|
||||||
self.beginResetModel()
|
self.beginResetModel()
|
||||||
self.tokens = getCustomTokens()
|
self.tokens = self.status.tokens.getCustomTokens()
|
||||||
self.tokensLoaded(self.tokens.len)
|
self.tokensLoaded(self.tokens.len)
|
||||||
self.isCustom = true
|
self.isCustom = true
|
||||||
self.endResetModel()
|
self.endResetModel()
|
||||||
|
|
|
@ -45,5 +45,8 @@ proc saveMailserver*(self: SettingsModel, name, enode: string) =
|
||||||
proc getFleet*(self: SettingsModel): Fleet =
|
proc getFleet*(self: SettingsModel): Fleet =
|
||||||
result = status_settings.getFleet()
|
result = status_settings.getFleet()
|
||||||
|
|
||||||
proc getCurrentNetwork*(self: SettingsModel): Network =
|
proc getCurrentNetwork*(): Network =
|
||||||
result = status_settings.getCurrentNetwork()
|
result = status_settings.getCurrentNetwork()
|
||||||
|
|
||||||
|
proc getCurrentNetwork*(self: SettingsModel): Network =
|
||||||
|
result = getCurrentNetwork()
|
||||||
|
|
|
@ -4,6 +4,7 @@ import
|
||||||
sugar, sequtils, strutils, atomics
|
sugar, sequtils, strutils, atomics
|
||||||
|
|
||||||
import libstatus/tokens as status_tokens
|
import libstatus/tokens as status_tokens
|
||||||
|
import libstatus/eth/contracts
|
||||||
import ../eventemitter
|
import ../eventemitter
|
||||||
import signals/types
|
import signals/types
|
||||||
|
|
||||||
|
@ -21,6 +22,21 @@ proc newTokensModel*(events: EventEmitter): TokensModel =
|
||||||
proc getSNTAddress*(): string =
|
proc getSNTAddress*(): string =
|
||||||
result = status_tokens.getSNTAddress()
|
result = status_tokens.getSNTAddress()
|
||||||
|
|
||||||
|
proc getCustomTokens*(self: TokensModel, useCached: bool = true): seq[Erc20Contract] =
|
||||||
|
result = status_tokens.getCustomTokens(useCached)
|
||||||
|
|
||||||
proc getSNTBalance*(account: string): string =
|
proc getSNTBalance*(account: string): string =
|
||||||
result = status_tokens.getSNTBalance(account)
|
result = status_tokens.getSNTBalance(account)
|
||||||
|
|
||||||
|
proc tokenDecimals*(contract: Contract): int =
|
||||||
|
result = status_tokens.tokenDecimals(contract)
|
||||||
|
|
||||||
|
proc tokenName*(contract: Contract): string =
|
||||||
|
result = status_tokens.tokenName(contract)
|
||||||
|
|
||||||
|
proc tokensymbol*(contract: Contract): string =
|
||||||
|
result = status_tokens.tokensymbol(contract)
|
||||||
|
|
||||||
|
export newErc20Contract
|
||||||
|
export getErc20Contracts
|
||||||
|
export Erc20Contract
|
||||||
|
|
Loading…
Reference in New Issue