@@ -31,11 +31,11 @@ using std::string;
31
31
using std::vector;
32
32
33
33
34
- BitcoinAPI::BitcoinAPI (const string& user, const string& password, const string& host, int port)
34
+ BitcoinAPI::BitcoinAPI (const string& user, const string& password, const string& host, int port, int httpTimeout )
35
35
: httpClient(new HttpClient(" http://" + user + " :" + password + " @" + host + " :" + IntegerToString(port))),
36
36
client(new Client(*httpClient, JSONRPC_CLIENT_V1))
37
37
{
38
- httpClient->SetTimeout (50000 );
38
+ httpClient->SetTimeout (httpTimeout );
39
39
}
40
40
41
41
BitcoinAPI::~BitcoinAPI ()
@@ -291,6 +291,15 @@ void BitcoinAPI::importprivkey(const string& bitcoinprivkey, const string& label
291
291
sendcommand (command, params);
292
292
}
293
293
294
+ void BitcoinAPI::importAddress (const string& address, const string& account, bool rescan) {
295
+ string command = " importaddress" ;
296
+ Value params, result;
297
+ params.append (address);
298
+ params.append (account);
299
+ params.append (rescan);
300
+ sendcommand (command, params);
301
+ }
302
+
294
303
string BitcoinAPI::addmultisigaddress (int nrequired, const vector<string>& keys) {
295
304
string command = " addmultisigaddress" ;
296
305
Value params, result;
@@ -428,6 +437,18 @@ double BitcoinAPI::getbalance(const string& account, int minconf) {
428
437
return result.asDouble ();
429
438
}
430
439
440
+ double BitcoinAPI::getbalance (const string& account, int minconf, bool includeWatchOnly) {
441
+ string command = " getbalance" ;
442
+ Value params, result;
443
+ params.append (account);
444
+ params.append (minconf);
445
+ params.append (includeWatchOnly);
446
+ result = sendcommand (command, params);
447
+
448
+ return result.asDouble ();
449
+ }
450
+
451
+
431
452
double BitcoinAPI::getunconfirmedbalance () {
432
453
string command = " getunconfirmedbalance" ;
433
454
Value params, result;
0 commit comments