fix(@desktop/wallet): Create new go API to get token balances without market details so that we are making wasteful api calls to coingecko/cryptocompare
fixes #13084
This commit is contained in:
parent
a2aedb5c6a
commit
104d7b0a90
|
@ -84,6 +84,7 @@ type
|
|||
accounts: seq[string]
|
||||
storeResult: bool
|
||||
|
||||
# TODO:: Clean up once all dependencies are removed
|
||||
const prepareTokensTask: Task = proc(argEncoded: string) {.gcsafe, nimcall.} =
|
||||
let arg = decode[BuildTokensTaskArg](argEncoded)
|
||||
var output = %*{
|
||||
|
@ -96,6 +97,20 @@ const prepareTokensTask: Task = proc(argEncoded: string) {.gcsafe, nimcall.} =
|
|||
output["storeResult"] = %* arg.storeResult
|
||||
except Exception as e:
|
||||
let err = fmt"Error getting wallet tokens"
|
||||
arg.finish(output)
|
||||
|
||||
const newPrepareTokensTask: Task = proc(argEncoded: string) {.gcsafe, nimcall.} =
|
||||
let arg = decode[BuildTokensTaskArg](argEncoded)
|
||||
var output = %*{
|
||||
"result": "",
|
||||
"storeResult": false
|
||||
}
|
||||
try:
|
||||
let response = backend.getWalletTokenBalances(arg.accounts)
|
||||
output["result"] = response.result
|
||||
output["storeResult"] = %* arg.storeResult
|
||||
except Exception as e:
|
||||
let err = fmt"Error getting wallet tokens"
|
||||
arg.finish(output)
|
||||
|
||||
#################################################
|
||||
|
|
|
@ -79,7 +79,7 @@ proc newBuildAllTokens*(self: Service, accounts: seq[string], store: bool) =
|
|||
self.events.emit(SIGNAL_WALLET_ACCOUNT_TOKENS_BEING_FETCHED, Args())
|
||||
|
||||
let arg = BuildTokensTaskArg(
|
||||
tptr: cast[ByteAddress](prepareTokensTask),
|
||||
tptr: cast[ByteAddress](newPrepareTokensTask),
|
||||
vptr: cast[ByteAddress](self.vptr),
|
||||
slot: "onNewAllTokensBuilt",
|
||||
accounts: accounts,
|
||||
|
|
|
@ -141,6 +141,9 @@ rpc(getTransfersForIdentities, "wallet"):
|
|||
rpc(getWalletToken, "wallet"):
|
||||
accounts: seq[string]
|
||||
|
||||
rpc(getWalletTokenBalances, "wallet"):
|
||||
accounts: seq[string]
|
||||
|
||||
rpc(fetchMarketValues, "wallet"):
|
||||
symbols: seq[string]
|
||||
currency: string
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit a8357dceacd1b737952660272bf80251df19b8f8
|
||||
Subproject commit 6599be1721e180fdb78d5c3f2c3daf3a6600b8e7
|
Loading…
Reference in New Issue