1 // Copyright (c) 2015-2022 Clearmatics Technologies Ltd
3 // SPDX-License-Identifier: LGPL-3.0+
5 #ifndef __ZECALE_CORE_NESTED_TRANSACTION_TCC__
6 #define __ZECALE_CORE_NESTED_TRANSACTION_TCC__
8 #include "libzecale/core/nested_transaction.hpp"
10 #include <libzeth/core/utils.hpp>
15 template<typename nppT, typename nsnarkT>
16 nested_transaction<nppT, nsnarkT>::nested_transaction()
20 template<typename nppT, typename nsnarkT>
21 nested_transaction<nppT, nsnarkT>::nested_transaction(
22 const std::string &application_name,
23 const libzeth::extended_proof<nppT, nsnarkT> &extended_proof,
24 const std::vector<uint8_t> ¶meters,
26 : _application_name(application_name)
27 , _parameters(parameters)
30 this->_extended_proof =
31 std::make_shared<libzeth::extended_proof<nppT, nsnarkT>>(
35 template<typename nppT, typename nsnarkT>
36 const std::string &nested_transaction<nppT, nsnarkT>::application_name() const
38 return _application_name;
41 template<typename nppT, typename nsnarkT>
42 const libzeth::extended_proof<nppT, nsnarkT>
43 &nested_transaction<nppT, nsnarkT>::extended_proof() const
45 return *(_extended_proof);
48 template<typename nppT, typename nsnarkT>
49 const std::vector<uint8_t> &nested_transaction<nppT, nsnarkT>::parameters()
55 template<typename nppT, typename nsnarkT>
56 uint32_t nested_transaction<nppT, nsnarkT>::fee_wei() const
61 template<typename nppT, typename nsnarkT>
62 std::ostream &nested_transaction<nppT, nsnarkT>::write_json(
63 std::ostream &os) const
67 << "\"" << _application_name << "\"";
70 _extended_proof->write_json(os);
73 << "\"" << libzeth::bytes_to_hex(_parameters.data(), _parameters.size())
74 << ",\n\t\"fee_wei\": " << _fee_wei << "\"\n}\n";
78 template<typename nppT, typename nsnarkT>
79 bool nested_transaction<nppT, nsnarkT>::operator<(
80 const nested_transaction<nppT, nsnarkT> &right) const
82 return fee_wei() < right.fee_wei();
85 } // namespace libzecale
87 #endif // __ZECALE_CORE_NESTED_TRANSACTION_TCC__