2016-06-08 13:53:24 +03:00
|
|
|
#include "TransactionInfo.h"
|
2016-10-02 21:40:40 +03:00
|
|
|
#include "WalletManager.h"
|
|
|
|
|
2016-06-08 13:53:24 +03:00
|
|
|
#include <QDateTime>
|
|
|
|
|
|
|
|
TransactionInfo::Direction TransactionInfo::direction() const
|
|
|
|
{
|
|
|
|
return static_cast<Direction>(m_pimpl->direction());
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TransactionInfo::isPending() const
|
|
|
|
{
|
|
|
|
return m_pimpl->isPending();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TransactionInfo::isFailed() const
|
|
|
|
{
|
|
|
|
return m_pimpl->isFailed();
|
|
|
|
}
|
|
|
|
|
2016-10-02 21:40:40 +03:00
|
|
|
|
2016-10-07 23:05:51 +03:00
|
|
|
double TransactionInfo::amount() const
|
|
|
|
{
|
|
|
|
// there's no unsigned uint64 for JS, so better use double
|
|
|
|
return WalletManager::instance()->displayAmount(m_pimpl->amount()).toDouble();
|
|
|
|
}
|
|
|
|
|
2016-11-10 21:55:44 +02:00
|
|
|
quint64 TransactionInfo::atomicAmount() const
|
|
|
|
{
|
|
|
|
return m_pimpl->amount();
|
|
|
|
}
|
|
|
|
|
2016-10-07 23:05:51 +03:00
|
|
|
QString TransactionInfo::displayAmount() const
|
2016-06-08 13:53:24 +03:00
|
|
|
{
|
2016-10-02 21:40:40 +03:00
|
|
|
return WalletManager::instance()->displayAmount(m_pimpl->amount());
|
2016-06-08 13:53:24 +03:00
|
|
|
}
|
|
|
|
|
2016-10-02 21:40:40 +03:00
|
|
|
QString TransactionInfo::fee() const
|
2016-06-08 13:53:24 +03:00
|
|
|
{
|
2016-10-02 21:40:40 +03:00
|
|
|
return WalletManager::instance()->displayAmount(m_pimpl->fee());
|
2016-06-08 13:53:24 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
quint64 TransactionInfo::blockHeight() const
|
|
|
|
{
|
|
|
|
return m_pimpl->blockHeight();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString TransactionInfo::hash() const
|
|
|
|
{
|
|
|
|
return QString::fromStdString(m_pimpl->hash());
|
|
|
|
}
|
|
|
|
|
2016-10-04 23:12:58 +03:00
|
|
|
QDateTime TransactionInfo::timestamp() const
|
2016-06-08 13:53:24 +03:00
|
|
|
{
|
2016-10-04 23:12:58 +03:00
|
|
|
QDateTime result = QDateTime::fromTime_t(m_pimpl->timestamp());
|
2016-06-08 13:53:24 +03:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2016-10-04 23:12:58 +03:00
|
|
|
QString TransactionInfo::date() const
|
|
|
|
{
|
|
|
|
return timestamp().date().toString(Qt::ISODate);
|
|
|
|
}
|
|
|
|
|
|
|
|
QString TransactionInfo::time() const
|
|
|
|
{
|
|
|
|
return timestamp().time().toString(Qt::ISODate);
|
|
|
|
}
|
|
|
|
|
|
|
|
QString TransactionInfo::paymentId() const
|
2016-06-08 13:53:24 +03:00
|
|
|
{
|
|
|
|
return QString::fromStdString(m_pimpl->paymentId());
|
|
|
|
}
|
|
|
|
|
|
|
|
TransactionInfo::TransactionInfo(Bitmonero::TransactionInfo *pimpl, QObject *parent)
|
|
|
|
: QObject(parent), m_pimpl(pimpl)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|