32 #ifndef LEDGER_CORE_BITCOINLIKEUTXOPICKER_H 33 #define LEDGER_CORE_BITCOINLIKEUTXOPICKER_H 35 #include <async/DedicatedContext.hpp> 36 #include "BitcoinLikeTransactionBuilder.h" 37 #include <wallet/bitcoin/keychains/BitcoinLikeKeychain.hpp> 38 #include <wallet/bitcoin/types.h> 39 #include <wallet/bitcoin/explorers/BitcoinLikeBlockchainExplorer.hpp> 40 #include <api/Currency.hpp> 41 #include <async/Future.hpp> 42 #include <api/BitcoinLikeOutput.hpp> 47 class BitcoinLikeTransactionApi;
48 class BitcoinLikeWritableInputApi;
49 using BitcoinLikeGetUtxoFunction = std::function<Future<std::vector<std::shared_ptr<api::BitcoinLikeOutput>>> ()>;
50 using BitcoinLikeGetTxFunction = std::function<FuturePtr<BitcoinLikeBlockchainExplorerTransaction> (
const std::string&)>;
55 const std::shared_ptr<api::ExecutionContext> &context,
58 virtual BitcoinLikeTransactionBuildFunction getBuildFunction(
59 const BitcoinLikeGetUtxoFunction& getUtxo,
60 const BitcoinLikeGetTxFunction& getTransaction,
61 const std::shared_ptr<BitcoinLikeBlockchainExplorer>& explorer,
62 const std::shared_ptr<BitcoinLikeKeychain>& keychain,
63 const uint64_t currentBlockHeight,
64 const std::shared_ptr<spdlog::logger>&
logger,
69 using UTXODescriptor = std::tuple<std::string, int32_t, uint32_t >;
70 using UTXODescriptorList = std::vector<UTXODescriptor>;
74 const BitcoinLikeGetUtxoFunction& g,
75 const BitcoinLikeGetTxFunction& tx,
76 const std::shared_ptr<BitcoinLikeBlockchainExplorer>& e,
77 const std::shared_ptr<BitcoinLikeKeychain>& k,
78 const std::shared_ptr<spdlog::logger>& l,
79 std::shared_ptr<BitcoinLikeTransactionApi> t,
80 bool partial) : request(r), explorer(e), keychain(k), transaction(t), getUtxo(g),
81 getTransaction(tx), logger(l), isPartial(partial)
84 outputAmount = ledger::core::BigInt::ZERO;
86 for (
auto& output : r.outputs)
87 outputAmount = outputAmount + *std::get<0>(output);
91 BitcoinLikeGetUtxoFunction getUtxo;
92 BitcoinLikeGetTxFunction getTransaction;
93 std::shared_ptr<BitcoinLikeBlockchainExplorer> explorer;
94 std::shared_ptr<BitcoinLikeKeychain> keychain;
95 std::shared_ptr<BitcoinLikeTransactionApi> transaction;
97 std::shared_ptr<spdlog::logger> logger;
102 virtual Future<Unit> fillInputs(
const std::shared_ptr<Buddy>& buddy);
104 virtual Future<Unit> fillOutputs(
const std::shared_ptr<Buddy>& buddy);
105 virtual Future<Unit> fillTransactionInfo(
const std::shared_ptr<Buddy>& buddy);
108 Future<Unit> fillInput(
const std::shared_ptr<Buddy>& buddy,
const UTXODescriptor& desc);
110 const BitcoinLikeGetUtxoFunction& getUtxo);
118 #endif //LEDGER_CORE_BITCOINLIKEUTXOPICKER_H Definition: BitcoinLikeUtxoPicker.h:71
Definition: BitcoinLikeUtxoPicker.h:52
Definition: Deffered.hpp:49
Definition: BitcoinLikeTransactionBuilder.h:50
Definition: Currency.hpp:23
Definition: Account.cpp:8
Definition: DedicatedContext.hpp:39
Definition: logger.hpp:44