Skip to content

Commit

Permalink
Fix ripple explorer (de)serialization issues (#938)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoatelen-ledger authored Jun 28, 2023
1 parent 48242ce commit a0ff9a8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ namespace ledger {
bodyRequest.pushParameter("account", addresses[0]);
bodyRequest.pushParameterBool("forward", true);
if (fromBlockHash.hasValue() && _paginationMarker.empty()) {
bodyRequest.pushParameter("ledger_index_min", fromBlockHash.getValue());
BigInt blockHash{fromBlockHash.getValue()};
bodyRequest.pushParameter("ledger_index_min", blockHash.toUint64());
}

// handle transaction pagination in the case we have a pagination marker, which happens
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@ namespace ledger {
return *this;
};

NodeRippleLikeBodyRequest &pushParameter(const std::string &key, uint64_t value) {
rapidjson::Document::AllocatorType &allocator = _document.GetAllocator();
rapidjson::Value vKeyParam(rapidjson::kStringType);
vKeyParam.SetString(key.c_str(), static_cast<rapidjson::SizeType>(key.length()), allocator);
rapidjson::Value vParam(rapidjson::kNumberType);
vParam.SetUint64(value);
_params.AddMember(vKeyParam, vParam, allocator);
return *this;
};

NodeRippleLikeBodyRequest &pushParameterBool(const std::string &key, bool value) {
// TODO: C++17 group all 3 pushParameter in a single one with a if constexpr ()
rapidjson::Document::AllocatorType &allocator = _document.GetAllocator();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ namespace ledger {
_transaction->sender = value;
} else if (_lastKey == "Destination") {
_transaction->receiver = value;
} else if (_lastKey == "Amount") {
} else if (_lastKey == "Amount" || _lastKey == "DeliveredAmount") {
BigInt valueBigInt = BigInt::fromString(value);
_transaction->value = valueBigInt;
} else if (_lastKey == "Fee") {
Expand Down

0 comments on commit a0ff9a8

Please sign in to comment.