@@ -32,7 +32,7 @@ using std::vector;
32
32
33
33
34
34
BitcoinAPI::BitcoinAPI (const string& user, const string& password, const string& host, int port)
35
- : httpClient(new HttpClient(" http://" + user + " :" + password + " @" + host + " :" + NumberToString (port))),
35
+ : httpClient(new HttpClient(" http://" + user + " :" + password + " @" + host + " :" + IntegerToString (port))),
36
36
client(new Client(*httpClient, JSONRPC_CLIENT_V1))
37
37
{
38
38
httpClient->SetTimeout (50000 );
@@ -44,27 +44,28 @@ BitcoinAPI::~BitcoinAPI()
44
44
delete httpClient;
45
45
}
46
46
47
- string BitcoinAPI::NumberToString (int number ){
47
+ string BitcoinAPI::IntegerToString (int num ){
48
48
std::ostringstream ss;
49
- ss << number ;
49
+ ss << num ;
50
50
return ss.str ();
51
51
}
52
52
53
- int BitcoinAPI::StringToNumber (const string &text){
54
- std::istringstream ss (text);
55
- int result;
56
- return ss >> result ? result : 0 ;
57
- }
58
-
59
- double BitcoinAPI::RoundDouble (double num)
53
+ std::string BitcoinAPI::RoundDouble (double num)
60
54
{
61
- return floor (num * pow (10 ,8 )) / pow (10 ,8 );
55
+ std::ostringstream ss;
56
+ ss.precision (16 );
57
+
58
+ ss << num;
59
+ return ss.str ();
62
60
}
63
61
64
62
Value BitcoinAPI::sendcommand (const string& command, const Value& params){
65
63
Value result;
66
64
67
65
try {
66
+ std::cout << " DEBUG:" << std::endl;
67
+ std::cout << params << std::endl;
68
+
68
69
result = client->CallMethod (command, params);
69
70
}
70
71
catch (JsonRpcException& e){
0 commit comments