moved to puppy, sorry for all the breaming changes

This commit is contained in:
user 2025-01-16 06:44:59 -05:00
parent df5dbb7f90
commit e4138ffc2d
2 changed files with 8 additions and 8 deletions

View file

@ -1,6 +1,6 @@
version = "10"
version = "11"
author = "Caroline Marceano [Albassort]"
description = "A BTC RPC Wrapper for Nim"
license = "MIT"
srcDir = "src/"
requires "nim >= 2.2.0", "jsony"
requires "nim >= 2.2.0", "jsony", "puppy"

View file

@ -1,5 +1,4 @@
import base64
import httpclient
import json
import jsony
import times
@ -9,6 +8,7 @@ import net
import std/options
import tables
import std/jsonutils
import puppy
type
BTCResponse* = object
errorMessage* : string
@ -16,8 +16,9 @@ type
hasResult* : bool
resultObject* : JsonNode
BTCClient* = object
url* : string
client* : HttpClient
url : string
auth : string
SigHashType* = enum
All = "ALL", None = "NONE", Single = "SINGLE"
EstimateMode* = enum
@ -139,8 +140,7 @@ proc initBTCClient*(path, username, password : string) : BTCClient =
"Authorization": "Basic" & " " & authy
}
let headers = newHttpHeaders(headerTable)
result.client = newHttpClient(headers = headers)
result.auth = "Basic" & " " & authy
result.url = path
@ -173,7 +173,7 @@ proc callAPI(api : BTCClient, methody : string, body : JsonNode = newJNull()) :
baseRequest["method"] = %* methody
baseRequest["id"] = %* $(now().utc.toTime().toUnix())
#echo baseRequest
let resultString = api.client.post(api.url, jsony.toJson baseRequest).body
let resultString = post(api.url, @[("Authorization", api.auth)], $baseRequest ).body
#echo resultString
return parseBTCResponse(resultString)