Files
pay/TransactionInfo.h
T

115 lines
3.3 KiB
C++
Raw Permalink Normal View History

2020-12-17 23:12:39 +01:00
/*
* This file is part of the Flowee project
* Copyright (C) 2020 Tom Zander <tom@flowee.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRANSACTIONINFO_H
#define TRANSACTIONINFO_H
#include <QObject>
#include <QString>
#include <QList>
class TransactionInputInfo : public QObject
{
Q_OBJECT
Q_PROPERTY(QString address READ address CONSTANT)
Q_PROPERTY(QString cloakedAddress READ cloakedAddress CONSTANT)
2020-12-17 23:12:39 +01:00
Q_PROPERTY(qint64 value READ value CONSTANT)
public:
TransactionInputInfo(QObject *parent);
2020-12-17 23:12:39 +01:00
QString address() const;
void setAddress(const QString &address);
qint64 value() const;
void setValue(const qint64 &value);
const QString &cloakedAddress() const;
void setCloakedAddress(const QString &newCloakedAddress);
2020-12-17 23:12:39 +01:00
private:
QString m_address;
QString m_cloakedAddress;
2020-12-17 23:12:39 +01:00
qint64 m_value;
};
class TransactionOutputInfo : public QObject
{
Q_OBJECT
Q_PROPERTY(QString address READ address CONSTANT)
Q_PROPERTY(QString cloakedAddress READ cloakedAddress CONSTANT)
2020-12-17 23:12:39 +01:00
Q_PROPERTY(qint64 value READ value CONSTANT)
Q_PROPERTY(bool spent READ spent CONSTANT)
2020-12-26 16:51:54 +01:00
Q_PROPERTY(bool forMe READ forMe CONSTANT)
2020-12-17 23:12:39 +01:00
public:
TransactionOutputInfo(QObject *parent) : QObject(parent) {}
QString address() const;
void setAddress(const QString &address);
qint64 value() const;
void setValue(const qint64 &value);
bool spent() const;
void setSpent(bool spent);
2020-12-26 16:51:54 +01:00
/// output matches an address owned by the wallet.
bool forMe() const;
void setForMe(bool forMe);
const QString &cloakedAddress() const;
void setCloakedAddress(const QString &ad);
2020-12-17 23:12:39 +01:00
private:
QString m_address;
QString m_cloakedAddress;
2020-12-17 23:12:39 +01:00
qint64 m_value;
2020-12-26 16:51:54 +01:00
bool m_spent = false;
bool m_forMe = true;
2020-12-17 23:12:39 +01:00
};
class TransactionInfo : public QObject
{
Q_OBJECT
Q_PROPERTY(int size READ txSize CONSTANT)
Q_PROPERTY(QList<QObject*> inputs READ inputs CONSTANT)
Q_PROPERTY(QList<QObject*> outputs READ outputs CONSTANT)
2021-11-16 15:01:02 +01:00
Q_PROPERTY(QString userComment READ userComment CONSTANT)
Q_PROPERTY(bool isCoinbase READ isCoinbase CONSTANT)
Q_PROPERTY(bool isCashFusion READ isCashFusion CONSTANT)
2021-12-04 20:09:43 +01:00
Q_PROPERTY(bool createdByUs READ createdByUs CONSTANT)
2020-12-17 23:12:39 +01:00
public:
explicit TransactionInfo(QObject *parent = nullptr);
int txSize() const;
QList<QObject *> outputs() const;
QList<QObject *> inputs() const;
2021-11-16 15:01:02 +01:00
const QString &userComment() const;
bool isCoinbase() const;
bool isCashFusion() const;
2021-12-04 20:09:43 +01:00
bool createdByUs() const;
2020-12-17 23:12:39 +01:00
int m_txSize = 0;
QList<TransactionOutputInfo *> m_outputs;
QList<TransactionInputInfo *> m_inputs;
2021-11-16 15:01:02 +01:00
QString m_userComment;
bool m_isCoinbase = false;
bool m_isCashFusion = false;
2021-12-04 20:09:43 +01:00
bool m_createdByUs = false;
2020-12-17 23:12:39 +01:00
};
#endif