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)
|
2021-11-19 11:54:07 +01:00
|
|
|
Q_PROPERTY(QString cloakedAddress READ cloakedAddress CONSTANT)
|
2020-12-17 23:12:39 +01:00
|
|
|
Q_PROPERTY(qint64 value READ value CONSTANT)
|
|
|
|
|
public:
|
2021-11-19 11:54:07 +01:00
|
|
|
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);
|
|
|
|
|
|
2021-11-19 11:54:07 +01:00
|
|
|
const QString &cloakedAddress() const;
|
|
|
|
|
void setCloakedAddress(const QString &newCloakedAddress);
|
|
|
|
|
|
2020-12-17 23:12:39 +01:00
|
|
|
private:
|
|
|
|
|
QString m_address;
|
2021-11-19 11:54:07 +01:00
|
|
|
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)
|
2021-11-19 11:54:07 +01:00
|
|
|
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);
|
|
|
|
|
|
2021-11-19 11:54:07 +01:00
|
|
|
const QString &cloakedAddress() const;
|
|
|
|
|
void setCloakedAddress(const QString &ad);
|
|
|
|
|
|
2020-12-17 23:12:39 +01:00
|
|
|
private:
|
|
|
|
|
QString m_address;
|
2021-11-19 11:54:07 +01:00
|
|
|
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)
|
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;
|
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;
|
2020-12-17 23:12:39 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|