mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-12-23 03:18:52 +00:00
Wallet::transfer in progress
This commit is contained in:
parent
830c19c934
commit
c37c856d6d
@ -32,7 +32,11 @@
|
||||
#include "wallet2.h"
|
||||
#include "mnemonics/electrum-words.h"
|
||||
#include "cryptonote_core/cryptonote_format_utils.h"
|
||||
#include "cryptonote_core/cryptonote_basic_impl.h"
|
||||
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace epee {
|
||||
unsigned int g_test_dbg_lock_sleep = 0;
|
||||
@ -44,11 +48,16 @@ struct WalletManagerImpl;
|
||||
|
||||
namespace {
|
||||
static WalletManagerImpl * g_walletManager = nullptr;
|
||||
// copy-pasted from
|
||||
static const size_t DEFAULT_MIX = 4;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
Wallet::~Wallet() {}
|
||||
|
||||
///////////////////////// Wallet implementation ////////////////////////////////
|
||||
@ -77,6 +86,7 @@ public:
|
||||
uint64_t unlockedBalance() const;
|
||||
std::string displayAmount(uint64_t amount) const;
|
||||
bool refresh();
|
||||
bool transfer(const std::string &dst_addr, uint64_t amount);
|
||||
|
||||
|
||||
private:
|
||||
@ -306,6 +316,36 @@ bool WalletImpl::refresh()
|
||||
return m_status == Status_Ok;
|
||||
}
|
||||
|
||||
bool WalletImpl::transfer(const std::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;
|
||||
size_t fake_outs_count = DEFAULT_MIX;
|
||||
if(!cryptonote::get_account_integrated_address_from_str(de.addr, has_payment_id, new_payment_id, m_wallet->testnet(), dst_addr)) {
|
||||
// TODO: copy-paste 'if treating as an address fails, try as url' from simplewallet.cpp:1982
|
||||
m_status = Status_Error;
|
||||
m_errorString = "Invalid destination address";
|
||||
return false;
|
||||
}
|
||||
|
||||
de.amount = amount;
|
||||
if (de.amount <= 0) {
|
||||
m_status = Status_Error;
|
||||
m_errorString = "Invalid amount";
|
||||
return false;
|
||||
}
|
||||
dsts.push_back(de);
|
||||
|
||||
|
||||
|
||||
|
||||
return m_status == Status_Ok;
|
||||
}
|
||||
|
||||
bool WalletImpl::connectToDaemon()
|
||||
{
|
||||
bool result = m_wallet->check_connection();
|
||||
|
@ -74,9 +74,10 @@ struct Wallet
|
||||
virtual std::string displayAmount(uint64_t amount) const = 0;
|
||||
// TODO?
|
||||
// virtual uint64_t unlockedDustBalance() const = 0;
|
||||
// TODO refresh
|
||||
virtual bool refresh() = 0;
|
||||
// TODO transfer
|
||||
virtual bool transfer(const std::string &dst_addr, uint64_t amount) = 0;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user