Line data Source code
1 : /**
2 : * Copyright Soramitsu Co., Ltd. All Rights Reserved.
3 : * SPDX-License-Identifier: Apache-2.0
4 : */
5 :
6 : #include "backend/protobuf/queries/proto_tx_pagination_meta.hpp"
7 :
8 : #include "cryptography/hash.hpp"
9 :
10 : namespace types = shared_model::interface::types;
11 :
12 : using namespace shared_model::proto;
13 :
14 : TxPaginationMeta::TxPaginationMeta(const TransportType &query)
15 170 : : CopyableProto(query) {}
16 :
17 : TxPaginationMeta::TxPaginationMeta(TransportType &&query)
18 0 : : CopyableProto(std::move(query)) {}
19 :
20 : TxPaginationMeta::TxPaginationMeta(const TxPaginationMeta &o)
21 0 : : TxPaginationMeta(*o.proto_) {}
22 :
23 : TxPaginationMeta::TxPaginationMeta(TxPaginationMeta &&o) noexcept
24 0 : : CopyableProto(std::move(*o.proto_)) {}
25 :
26 : types::TransactionsNumberType TxPaginationMeta::pageSize() const {
27 124 : return proto_->page_size();
28 : }
29 :
30 : boost::optional<types::HashType> TxPaginationMeta::firstTxHash() const {
31 124 : if (proto_->opt_first_tx_hash_case()
32 124 : == TransportType::OptFirstTxHashCase::OPT_FIRST_TX_HASH_NOT_SET) {
33 116 : return boost::none;
34 : }
35 8 : return types::HashType::fromHexString(proto_->first_tx_hash());
36 124 : }
|