blob: 4e6b6787bd5e1167698b20728974cbaf832d5fd3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
#include "Wallet.h"
#include "PendingTransaction.h"
#include "TransactionHistory.h"
#include "wallet/wallet2_api.h"
#include <QFile>
#include <QDir>
#include <QDebug>
#include <QUrl>
#include <QTimer>
namespace {
}
QString Wallet::getSeed() const
{
return QString::fromStdString(m_walletImpl->seed());
}
QString Wallet::getSeedLanguage() const
{
return QString::fromStdString(m_walletImpl->getSeedLanguage());
}
void Wallet::setSeedLanguage(const QString &lang)
{
m_walletImpl->setSeedLanguage(lang.toStdString());
}
Wallet::Status Wallet::status() const
{
return static_cast<Status>(m_walletImpl->status());
}
QString Wallet::errorString() const
{
return QString::fromStdString(m_walletImpl->errorString());
}
bool Wallet::setPassword(const QString &password)
{
return m_walletImpl->setPassword(password.toStdString());
}
QString Wallet::address() const
{
return QString::fromStdString(m_walletImpl->address());
}
bool Wallet::store(const QString &path)
{
return m_walletImpl->store(path.toStdString());
}
bool Wallet::init(const QString &daemonAddress, quint64 upperTransactionLimit)
{
return m_walletImpl->init(daemonAddress.toStdString(), upperTransactionLimit);
}
bool Wallet::connectToDaemon()
{
return m_walletImpl->connectToDaemon();
}
void Wallet::setTrustedDaemon(bool arg)
{
m_walletImpl->setTrustedDaemon(arg);
}
quint64 Wallet::balance() const
{
return m_walletImpl->balance();
}
quint64 Wallet::unlockedBalance() const
{
return m_walletImpl->unlockedBalance();
}
bool Wallet::refresh()
{
bool result = m_walletImpl->refresh();
if (result)
emit updated();
return result;
}
PendingTransaction *Wallet::createTransaction(const QString &dst_addr, quint64 amount, quint32 mixin_count)
{
Bitmonero::PendingTransaction * ptImpl = m_walletImpl->createTransaction(
dst_addr.toStdString(), amount, mixin_count);
PendingTransaction * result = new PendingTransaction(ptImpl, this);
return result;
}
void Wallet::disposeTransaction(PendingTransaction *t)
{
m_walletImpl->disposeTransaction(t->m_pimpl);
delete t;
}
TransactionHistory *Wallet::history()
{
if (!m_history) {
Bitmonero::TransactionHistory * impl = m_walletImpl->history();
m_history = new TransactionHistory(impl, this);
}
return m_history;
}
Wallet::Wallet(Bitmonero::Wallet *w, QObject *parent)
: QObject(parent), m_walletImpl(w), m_history(nullptr)
{
}
Wallet::~Wallet()
{
Bitmonero::WalletManagerFactory::getWalletManager()->closeWallet(m_walletImpl);
}
|