parent
9adbd37729
commit
480219b823
|
@ -67,9 +67,13 @@ proc fetchTokenBalance(tokenAddress, accountAddress: string, decimals: int): flo
|
||||||
if balanceCache.hasKey(key):
|
if balanceCache.hasKey(key):
|
||||||
return balanceCache[key]
|
return balanceCache[key]
|
||||||
|
|
||||||
|
try:
|
||||||
let tokenBalanceResponse = status_go_eth.getTokenBalance(tokenAddress, accountAddress)
|
let tokenBalanceResponse = status_go_eth.getTokenBalance(tokenAddress, accountAddress)
|
||||||
result = parsefloat(hex2Balance(tokenBalanceResponse.result.getStr, decimals))
|
result = parsefloat(hex2Balance(tokenBalanceResponse.result.getStr, decimals))
|
||||||
balanceCache[key] = result
|
balanceCache[key] = result
|
||||||
|
except Exception as e:
|
||||||
|
error "Error getting token balance", msg = e.msg
|
||||||
|
|
||||||
|
|
||||||
proc fetchEthBalance(accountAddress: string): float64 =
|
proc fetchEthBalance(accountAddress: string): float64 =
|
||||||
let key = "0x0" & accountAddress
|
let key = "0x0" & accountAddress
|
||||||
|
|
Loading…
Reference in New Issue