mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-10 14:26:34 +00:00
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]
|
accounts: seq[string]
|
||||||
storeResult: bool
|
storeResult: bool
|
||||||
|
|
||||||
|
# TODO:: Clean up once all dependencies are removed
|
||||||
const prepareTokensTask: Task = proc(argEncoded: string) {.gcsafe, nimcall.} =
|
const prepareTokensTask: Task = proc(argEncoded: string) {.gcsafe, nimcall.} =
|
||||||
let arg = decode[BuildTokensTaskArg](argEncoded)
|
let arg = decode[BuildTokensTaskArg](argEncoded)
|
||||||
var output = %*{
|
var output = %*{
|
||||||
@ -98,6 +99,20 @@ const prepareTokensTask: Task = proc(argEncoded: string) {.gcsafe, nimcall.} =
|
|||||||
let err = fmt"Error getting wallet tokens"
|
let err = fmt"Error getting wallet tokens"
|
||||||
arg.finish(output)
|
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)
|
||||||
|
|
||||||
#################################################
|
#################################################
|
||||||
# Async add new keycard or accounts
|
# Async add new keycard or accounts
|
||||||
#################################################
|
#################################################
|
||||||
|
@ -79,7 +79,7 @@ proc newBuildAllTokens*(self: Service, accounts: seq[string], store: bool) =
|
|||||||
self.events.emit(SIGNAL_WALLET_ACCOUNT_TOKENS_BEING_FETCHED, Args())
|
self.events.emit(SIGNAL_WALLET_ACCOUNT_TOKENS_BEING_FETCHED, Args())
|
||||||
|
|
||||||
let arg = BuildTokensTaskArg(
|
let arg = BuildTokensTaskArg(
|
||||||
tptr: cast[ByteAddress](prepareTokensTask),
|
tptr: cast[ByteAddress](newPrepareTokensTask),
|
||||||
vptr: cast[ByteAddress](self.vptr),
|
vptr: cast[ByteAddress](self.vptr),
|
||||||
slot: "onNewAllTokensBuilt",
|
slot: "onNewAllTokensBuilt",
|
||||||
accounts: accounts,
|
accounts: accounts,
|
||||||
|
@ -141,6 +141,9 @@ rpc(getTransfersForIdentities, "wallet"):
|
|||||||
rpc(getWalletToken, "wallet"):
|
rpc(getWalletToken, "wallet"):
|
||||||
accounts: seq[string]
|
accounts: seq[string]
|
||||||
|
|
||||||
|
rpc(getWalletTokenBalances, "wallet"):
|
||||||
|
accounts: seq[string]
|
||||||
|
|
||||||
rpc(fetchMarketValues, "wallet"):
|
rpc(fetchMarketValues, "wallet"):
|
||||||
symbols: seq[string]
|
symbols: seq[string]
|
||||||
currency: string
|
currency: string
|
||||||
|
2
vendor/status-go
vendored
2
vendor/status-go
vendored
@ -1 +1 @@
|
|||||||
Subproject commit a8357dceacd1b737952660272bf80251df19b8f8
|
Subproject commit 6599be1721e180fdb78d5c3f2c3daf3a6600b8e7
|
Loading…
x
Reference in New Issue
Block a user