fix: TLS verification
This commit is contained in:
parent
1ad506e746
commit
b1b32d354d
|
@ -1,6 +1,6 @@
|
|||
import ./core as status, ./types, ./eth/contracts, ./settings, ./edn_helpers
|
||||
import
|
||||
json, json_serialization, tables, chronicles, sequtils, httpclient,
|
||||
json, json_serialization, tables, chronicles, sequtils, httpclient, net,
|
||||
stint, libp2p/[multihash, multicodec, cid], web3/[ethtypes, conversions]
|
||||
from strutils import parseHexInt, parseInt
|
||||
from nimcrypto import fromHex
|
||||
|
@ -115,7 +115,8 @@ proc getPackData*(id: Stuint[256]): StickerPack =
|
|||
# an IPFS identifier. Once decoded, download the content from IPFS. This content
|
||||
# is in EDN format, ie https://ipfs.infura.io/ipfs/QmWVVLwVKCwkVNjYJrRzQWREVvEk917PhbHYAUhA1gECTM
|
||||
# and it also needs to be decoded in to a nim type
|
||||
var client = newHttpClient()
|
||||
let secureSSLContext = newContext()
|
||||
let client = newHttpClient(sslContext = secureSSLContext)
|
||||
let contentHash = contracts.toHex(packData.contentHash)
|
||||
let url = "https://ipfs.infura.io/ipfs/" & decodeContentHash(contentHash)
|
||||
var ednMeta = client.getContent(url)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import json, strformat, strutils, chronicles, sequtils, httpclient, tables
|
||||
import json, strformat, strutils, chronicles, sequtils, httpclient, tables, net
|
||||
import json_serialization, stint
|
||||
from web3/ethtypes import Address, EthSend, Quantity
|
||||
from web3/conversions import `$`
|
||||
|
@ -340,7 +340,8 @@ proc getGasPricePredictions*(self: WalletModel): GasPricePrediction =
|
|||
return GasPricePrediction(safeLow: 1.0, standard: 2.0, fast: 3.0, fastest: 4.0)
|
||||
try:
|
||||
let url: string = fmt"https://etherchain.org/api/gasPriceOracle"
|
||||
let client = newHttpClient()
|
||||
let secureSSLContext = newContext()
|
||||
let client = newHttpClient(sslContext = secureSSLContext)
|
||||
client.headers = newHttpHeaders({ "Content-Type": "application/json" })
|
||||
let response = client.request(url)
|
||||
result = Json.decode(response.body, GasPricePrediction)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import strformat, strutils, stint, httpclient, json, chronicles
|
||||
import strformat, strutils, stint, httpclient, json, chronicles, net
|
||||
import ../libstatus/wallet as status_wallet
|
||||
import ../libstatus/tokens as status_tokens
|
||||
import ../libstatus/types as status_types
|
||||
|
@ -23,7 +23,8 @@ var balanceManager = newBalanceManager()
|
|||
proc getPrice(crypto: string, fiat: string): string =
|
||||
try:
|
||||
let url: string = fmt"https://min-api.cryptocompare.com/data/price?fsym={crypto}&tsyms={fiat}"
|
||||
let client = newHttpClient()
|
||||
let secureSSLContext = newContext()
|
||||
let client = newHttpClient(sslContext = secureSSLContext)
|
||||
client.headers = newHttpHeaders({ "Content-Type": "application/json" })
|
||||
|
||||
let response = client.request(url)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import strformat, httpclient, json, chronicles, sequtils, strutils, tables, sugar
|
||||
import strformat, httpclient, json, chronicles, sequtils, strutils, tables, sugar, net
|
||||
import ../libstatus/core as status
|
||||
import ../libstatus/eth/contracts as contracts
|
||||
import ../libstatus/stickers as status_stickers
|
||||
|
@ -69,7 +69,8 @@ proc getCryptoKittiesBatch*(address: Address, offset: int = 0): seq[Collectible]
|
|||
cryptokitties = @[]
|
||||
# TODO handle testnet -- does this API exist in testnet??
|
||||
let url: string = fmt"https://api.cryptokitties.co/kitties?limit=20&offset={$offset}&owner_wallet_address={$address}&parents=false"
|
||||
let client = newHttpClient()
|
||||
let secureSSLContext = newContext()
|
||||
let client = newHttpClient(sslContext = secureSSLContext)
|
||||
client.headers = newHttpHeaders({ "Content-Type": "application/json" })
|
||||
|
||||
let response = client.request(url)
|
||||
|
@ -130,7 +131,8 @@ proc getEthermons*(address: Address): string =
|
|||
|
||||
let tokensJoined = strutils.join(tokens, ",")
|
||||
let url = fmt"https://www.ethermon.io/api/monster/get_data?monster_ids={tokensJoined}"
|
||||
let client = newHttpClient()
|
||||
let secureSSLContext = newContext()
|
||||
let client = newHttpClient(sslContext = secureSSLContext)
|
||||
client.headers = newHttpHeaders({ "Content-Type": "application/json" })
|
||||
|
||||
let response = client.request(url)
|
||||
|
@ -173,7 +175,8 @@ proc getKudos*(address: Address): string =
|
|||
if (url == ""):
|
||||
return $(%*kudos)
|
||||
|
||||
let client = newHttpClient()
|
||||
let secureSSLContext = newContext()
|
||||
let client = newHttpClient(sslContext = secureSSLContext)
|
||||
client.headers = newHttpHeaders({ "Content-Type": "application/json" })
|
||||
|
||||
let response = client.request(url)
|
||||
|
|
Loading…
Reference in New Issue