aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/wallet2_api.cpp27
-rw-r--r--src/wallet/wallet2_api.h17
2 files changed, 25 insertions, 19 deletions
diff --git a/src/wallet/wallet2_api.cpp b/src/wallet/wallet2_api.cpp
index 3947084e3..edf7d9931 100644
--- a/src/wallet/wallet2_api.cpp
+++ b/src/wallet/wallet2_api.cpp
@@ -66,14 +66,14 @@ using namespace cryptonote;
Wallet::~Wallet() {}
-Transaction::~Transaction() {}
+PendingTransaction::~PendingTransaction() {}
class WalletImpl;
///////////////////////// Transaction implementation ///////////////////////////
-class TransactionImpl : public Transaction
+class TransactionImpl : public PendingTransaction
{
public:
TransactionImpl(WalletImpl * wallet);
@@ -131,8 +131,8 @@ public:
uint64_t balance() const;
uint64_t unlockedBalance() const;
bool refresh();
- Transaction * createTransaction(const std::string &dst_addr, uint64_t amount);
- virtual void disposeTransaction(Transaction * t);
+ PendingTransaction * createTransaction(const std::string &dst_addr, uint64_t amount);
+ virtual void disposeTransaction(PendingTransaction * t);
private:
void clearStatus();
@@ -357,16 +357,24 @@ bool WalletImpl::refresh()
return m_status == Status_Ok;
}
-
-Transaction *WalletImpl::createTransaction(const string &dst_addr, uint64_t amount)
+// TODO:
+// 1 - properly handle payment id (add another menthod with explicit 'payment_id' param)
+// 2 - check / design how "Transaction" can be single interface
+// (instead of few different data structures within wallet2 implementation:
+// - pending_tx;
+// - transfer_details;
+// - payment_details;
+// - unconfirmed_transfer_details;
+// - confirmed_transfer_details)
+PendingTransaction *WalletImpl::createTransaction(const string &dst_addr, uint64_t amount)
{
clearStatus();
vector<cryptonote::tx_destination_entry> dsts;
cryptonote::tx_destination_entry de;
bool has_payment_id;
- bool payment_id_seen = false;
crypto::hash8 new_payment_id;
- // TODO: how this number affects (https://bitcointalk.org/index.php?topic=753252.msg9985441#msg9985441)
+
+ // TODO: (https://bitcointalk.org/index.php?topic=753252.msg9985441#msg9985441)
size_t fake_outs_count = m_wallet->default_mixin();
if (fake_outs_count == 0)
fake_outs_count = DEFAULT_MIX;
@@ -396,7 +404,6 @@ Transaction *WalletImpl::createTransaction(const string &dst_addr, uint64_t amou
try {
transaction->m_pending_tx = m_wallet->create_transactions(dsts, fake_outs_count, 0 /* unlock_time */, 0 /* unused fee arg*/, extra);
- // TODO: move it to transaction class
} catch (const tools::error::daemon_busy&) {
// TODO: make it translatable with "tr"?
@@ -465,7 +472,7 @@ Transaction *WalletImpl::createTransaction(const string &dst_addr, uint64_t amou
return transaction;
}
-void WalletImpl::disposeTransaction(Transaction *t)
+void WalletImpl::disposeTransaction(PendingTransaction *t)
{
delete t;
}
diff --git a/src/wallet/wallet2_api.h b/src/wallet/wallet2_api.h
index c064aeba8..56a91bfbb 100644
--- a/src/wallet/wallet2_api.h
+++ b/src/wallet/wallet2_api.h
@@ -39,13 +39,13 @@ namespace Bitmonero {
/**
* @brief Transaction interface
*/
-struct Transaction
+struct PendingTransaction
{
enum Status {
Status_Ok,
Status_Error
};
- virtual ~Transaction() = 0;
+ virtual ~PendingTransaction() = 0;
virtual int status() const = 0;
virtual std::string errorString() const = 0;
virtual bool commit() = 0;
@@ -60,17 +60,12 @@ struct Transaction
*/
struct Wallet
{
- // TODO define wallet interface (decide what needed from wallet2)
enum Status {
Status_Ok,
Status_Error
};
- struct Listener
- {
- // TODO
- };
virtual ~Wallet() = 0;
virtual std::string seed() const = 0;
@@ -92,8 +87,12 @@ struct Wallet
// TODO?
// virtual uint64_t unlockedDustBalance() const = 0;
virtual bool refresh() = 0;
- virtual Transaction * createTransaction(const std::string &dst_addr, uint64_t amount) = 0;
- virtual void disposeTransaction(Transaction * t) = 0;
+ virtual PendingTransaction * createTransaction(const std::string &dst_addr, uint64_t amount) = 0;
+ virtual void disposeTransaction(PendingTransaction * t) = 0;
+ // TODO
+ virtual void getPayments() const;
+
+
};
/**