feat(@desktop/wallet): Add chain id to internal API

This commit is contained in:
Anthony Laibe 2021-09-13 10:45:57 +02:00 committed by Iuri Matias
parent efbc8073e1
commit 83a0ea391d
6 changed files with 8 additions and 7 deletions

View File

@ -6,6 +6,7 @@ import # vendor libs
import # status-desktop libs
status/[utils, tokens, settings],
status/types/network_type,
status/status
import ../../../../app_service/[main]
import ../../../../app_service/tasks/[qt, threadpool]
@ -27,7 +28,7 @@ const getTokenDetailsTask: Task = proc(argEncoded: string) {.gcsafe, nimcall.} =
let arg = decode[GetTokenDetailsTaskArg](argEncoded)
try:
let
tkn = newErc20Contract(getCurrentNetwork(), arg.address.parseAddress)
tkn = newErc20Contract(getCurrentNetwork().toChainId(), arg.address.parseAddress)
decimals = tkn.tokenDecimals()
output = %* {
"address": arg.address,
@ -69,7 +70,7 @@ QtObject:
proc loadDefaultTokens*(self:TokenList) =
if self.tokens.len == 0:
self.tokens = getErc20Contracts()
self.tokens = allErc20ContractsByChainId(getCurrentNetwork().toChainId())
self.isCustom = false
self.tokensLoaded(self.tokens.len)

View File

@ -42,7 +42,7 @@ QtObject:
self.accountsView.setAccountItems()
proc removeCustomToken*(self: TokensView, tokenAddress: string) {.slot.} =
let t = self.status.tokens.getCustomTokens().getErc20ContractByAddress(parseAddress(tokenAddress))
let t = self.status.tokens.getCustomTokens().findByAddress(parseAddress(tokenAddress))
if t == nil: return
self.status.wallet.hideAsset(t.symbol)
self.status.tokens.removeCustomToken(tokenAddress)

View File

@ -1,5 +1,5 @@
import NimQml, Tables, chronicles
from status/wallet2/network import Network
from status/types/network import Network
logScope:
topics = "networks-view"

View File

@ -1,5 +1,5 @@
import NimQml, chronicles, sequtils, sugar
from status/wallet2/network import Network, `$`
from status/types/network import Network, `$`
import ./network_list

2
vendor/status-go vendored

@ -1 +1 @@
Subproject commit 95dcbef5e5ba147c1c19bce1770a757e20e535e8
Subproject commit b0e8110992c0f5ef6beb856aa775c52033b72c90

2
vendor/status-lib vendored

@ -1 +1 @@
Subproject commit a9b06fde83e9c7566b69cfbaa7b66f0ee5facbd4
Subproject commit 3c20de8c07c51e2d6a2a7e9c2262b0ba26a0adcc