Skip to content

Commit deebe12

Browse files
committed
Fixed string to double conversions on omni calls
1 parent 903c4dd commit deebe12

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/bitcoinapi/bitcoinapi.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,9 +1427,9 @@ std::vector<omni_detailed_balance_t> BitcoinAPI::omni_getwalletbalances(bool inc
14271427
omni_detailed_balance_t tmp;
14281428
Value val = (*it);
14291429

1430-
tmp.balance = val["balance"].asDouble();
1431-
tmp.reserved = val["reserved"].asDouble();
1432-
tmp.propertyid = val["propertyid"].asDouble();
1430+
tmp.balance = stod(val["balance"].asString());
1431+
tmp.reserved = stod(val["reserved"].asString());
1432+
tmp.frozen = stod(val["frozen"].asString());
14331433
tmp.name = val["name"].asString();
14341434
tmp.propertyid = val["propertyid"].asInt();
14351435

@@ -1450,9 +1450,9 @@ omni_balance_t BitcoinAPI::omni_getbalance(const std::string& address, int prope
14501450

14511451
result = sendcommand(command, params);
14521452

1453-
ret.balance = result["balance"].asDouble();
1454-
ret.reserved = result["reserved"].asDouble();
1455-
ret.frozen = result["frozen"].asDouble();
1453+
ret.balance = stod(result["balance"].asString());
1454+
ret.reserved = stod(result["reserved"].asString());
1455+
ret.frozen = stod(result["frozen"].asString());
14561456

14571457
return ret;
14581458
}
@@ -1478,14 +1478,16 @@ std::vector<omni_transaction_t> BitcoinAPI::omni_listtransactions(const std::str
14781478
tmp.referenceaddress = val["referenceaddress"].asString();
14791479
tmp.ismine = val["ismine"].asBool();
14801480
tmp.confirmations = val["confirmations"].asInt();
1481-
tmp.fee = val["fee"].asDouble();
1481+
1482+
tmp.fee = stod(val["fee"].asString());
14821483
tmp.blocktime = val["blocktime"].asUInt();
14831484
tmp.valid = val["valid"].asBool();
14841485
tmp.positioninblock = val["positioninblock"].asUInt();
14851486
tmp.version = val["version"].asInt();
14861487
tmp.type_int = val["type_int"].asInt();
14871488
tmp.type = val["type"].asString();
1488-
tmp.amount = val["amount"].asDouble();
1489+
1490+
tmp.amount = stod(val["amount"].asString());
14891491
tmp.blockhash = val["blockhash"].asString();
14901492
tmp.block = val["block"].asUInt();
14911493

0 commit comments

Comments
 (0)