feat(status/wallet): add APIs to retreive accounts
This commit is contained in:
parent
a09f694d23
commit
407577c247
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue