@@ -704,6 +704,7 @@ PYBIND11_MODULE(monero, m) {
704704 // monero_tx
705705 py_monero_tx
706706 .def (py::init<>())
707+ .def_property_readonly_static (" DEFAULT_PAYMENT_ID" , [](py::object /* self */ ) { return monero::monero_tx::DEFAULT_PAYMENT_ID; })
707708 .def_readwrite (" block" , &monero::monero_tx::m_block)
708709 .def_readwrite (" hash" , &monero::monero_tx::m_hash)
709710 .def_readwrite (" version" , &monero::monero_tx::m_version)
@@ -983,6 +984,20 @@ PYBIND11_MODULE(monero, m) {
983984 .def_readwrite (" change_amount" , &monero::monero_tx_wallet::m_change_amount)
984985 .def_readwrite (" num_dummy_outputs" , &monero::monero_tx_wallet::m_num_dummy_outputs)
985986 .def_readwrite (" extra_hex" , &monero::monero_tx_wallet::m_extra_hex)
987+ .def (" get_incoming_amount" , [](monero::monero_tx_wallet& self) {
988+ uint64_t amount = 0 ;
989+ for (const auto & transfer : self.m_incoming_transfers ) {
990+ if (transfer->m_amount != boost::none)
991+ amount += transfer->m_amount .get ();
992+ }
993+ return amount;
994+ })
995+ .def (" get_outgoing_amount" , [](monero::monero_tx_wallet& self) {
996+ uint64_t amount = 0 ;
997+ if (self.m_outgoing_transfer != boost::none && self.m_outgoing_transfer .value ()->m_amount != boost::none)
998+ amount = self.m_outgoing_transfer .value ()->m_amount .get ();
999+ return amount;
1000+ })
9861001 .def (" get_transfers" , [](monero::monero_tx_wallet& self) {
9871002 MONERO_CATCH_AND_RETHROW (self.get_transfers ());
9881003 })
@@ -992,6 +1007,16 @@ PYBIND11_MODULE(monero, m) {
9921007 .def (" filter_transfers" , [](monero::monero_tx_wallet& self, const monero_transfer_query& query) {
9931008 MONERO_CATCH_AND_RETHROW (self.filter_transfers (query));
9941009 }, py::arg (" query" ))
1010+ .def (" get_inputs_wallet" , [](monero::monero_tx_wallet& self, const boost::optional<monero_output_query>& query) {
1011+ std::vector<std::shared_ptr<monero::monero_output_wallet>> inputs;
1012+ for (const auto & i : self.m_inputs ) {
1013+ auto input = std::dynamic_pointer_cast<monero::monero_output_wallet>(i);
1014+ if (!input) continue ;
1015+ if (query == boost::none || query.value ().meets_criteria (input.get ()))
1016+ inputs.push_back (input);
1017+ }
1018+ return inputs;
1019+ }, py::arg (" query" ) = py::none ())
9951020 .def (" get_outputs_wallet" , [](monero::monero_tx_wallet& self) {
9961021 MONERO_CATCH_AND_RETHROW (self.get_outputs_wallet ());
9971022 })
0 commit comments