feat(status/wallet): add APIs to retreive accounts

This commit is contained in:
Pascal Precht 2020-05-19 17:04:45 +02:00 committed by Iuri Matias
parent a09f694d23
commit 407577c247
1 changed files with 15 additions and 0 deletions

View File

@ -5,6 +5,21 @@ import httpclient, json
import strformat
import stint
proc getAccounts*(): seq[string] =
var payload = %* {
"jsonrpc": "2.0",
"method": "eth_accounts",
"params": [
[]
]
}
var response = status.callPrivateRPC($payload)
result = parseJson(response)["result"].to(seq[string])
proc getAccount*(): string =
var accounts = getAccounts()
result = accounts[0]
proc getPrice*(crypto: string, fiat: string): string =
var url: string = fmt"https://min-api.cryptocompare.com/data/price?fsym={crypto}&tsyms={fiat}"
let client = newHttpClient()