diff --git a/src/interfaces/wallet.h b/src/interfaces/wallet.h index 32fb6b28e8..cea629fead 100644 --- a/src/interfaces/wallet.h +++ b/src/interfaces/wallet.h @@ -411,6 +411,7 @@ struct WalletTx int64_t time; std::map value_map; bool is_coinbase; + bool is_platform_transfer{false}; bool is_denominate; }; diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index dc87c07152..ba56ef366d 100644 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -264,6 +264,11 @@ public: return nVersion >= SPECIAL_VERSION; } + bool IsPlatformTransfer() const noexcept + { + return IsSpecialTxVersion() && nType == TRANSACTION_ASSET_UNLOCK; + } + bool HasExtraPayloadField() const noexcept { return IsSpecialTxVersion() && nType != TRANSACTION_NORMAL; diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp index 139db97a78..0e89ffe556 100644 --- a/src/qt/transactiondesc.cpp +++ b/src/qt/transactiondesc.cpp @@ -93,6 +93,10 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall { strHTML += "" + tr("Source") + ": " + tr("Generated") + "
"; } + else if (wtx.is_platform_transfer) + { + strHTML += "" + tr("Source") + ": " + tr("Platform Transfer") + "
"; + } else if (wtx.value_map.count("from") && !wtx.value_map["from"].empty()) { // Online transaction diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index 155c368c92..949a4ad19a 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -39,7 +39,7 @@ QList TransactionRecord::decomposeTransaction(interfaces::Wal auto node = interfaces::MakeNode(); auto& coinJoinOptions = node->coinJoinOptions(); - if (nNet > 0 || wtx.is_coinbase) + if (nNet > 0 || wtx.is_coinbase || wtx.is_platform_transfer) { // // Credit @@ -74,6 +74,11 @@ QList TransactionRecord::decomposeTransaction(interfaces::Wal // Generated sub.type = TransactionRecord::Generated; } + if (wtx.is_platform_transfer) + { + // Withdrawal from platform + sub.type = TransactionRecord::PlatformTransfer; + } parts.append(sub); } diff --git a/src/qt/transactionrecord.h b/src/qt/transactionrecord.h index 113ff35f21..92a6086d65 100644 --- a/src/qt/transactionrecord.h +++ b/src/qt/transactionrecord.h @@ -96,7 +96,8 @@ public: CoinJoinCollateralPayment, CoinJoinMakeCollaterals, CoinJoinCreateDenominations, - CoinJoinSend + CoinJoinSend, + PlatformTransfer, }; /** Number of confirmation recommended for accepting a transaction */ diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index c08c7db2f9..22be8c2de1 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -530,6 +530,7 @@ QVariant TransactionTableModel::amountColor(const TransactionRecord *rec) const case TransactionRecord::RecvWithCoinJoin: case TransactionRecord::RecvWithAddress: case TransactionRecord::RecvFromOther: + case TransactionRecord::PlatformTransfer: return GUIUtil::getThemedQColor(GUIUtil::ThemedColor::GREEN); case TransactionRecord::CoinJoinSend: case TransactionRecord::SendToAddress: diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index b51361a646..6dd5d1a664 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -90,6 +90,7 @@ TransactionView::TransactionView(QWidget* parent) : typeWidget->addItem(tr("%1 Collateral Payment").arg(strCoinJoinName), TransactionFilterProxy::TYPE(TransactionRecord::CoinJoinCollateralPayment)); typeWidget->addItem(tr("To yourself"), TransactionFilterProxy::TYPE(TransactionRecord::SendToSelf)); typeWidget->addItem(tr("Mined"), TransactionFilterProxy::TYPE(TransactionRecord::Generated)); + typeWidget->addItem(tr("Platform Transfer"), TransactionFilterProxy::TYPE(TransactionRecord::PlatformTransfer)); typeWidget->addItem(tr("Other"), TransactionFilterProxy::TYPE(TransactionRecord::Other)); typeWidget->setCurrentIndex(settings.value("transactionType").toInt()); diff --git a/src/wallet/interfaces.cpp b/src/wallet/interfaces.cpp index 50f446863e..5174b0b44c 100644 --- a/src/wallet/interfaces.cpp +++ b/src/wallet/interfaces.cpp @@ -81,6 +81,7 @@ WalletTx MakeWalletTx(CWallet& wallet, const CWalletTx& wtx) result.time = wtx.GetTxTime(); result.value_map = wtx.mapValue; result.is_coinbase = wtx.IsCoinBase(); + result.is_platform_transfer = wtx.IsPlatformTransfer(); // The determination of is_denominate is based on simplified checks here because in this part of the code // we only want to know about mixing transactions belonging to this specific wallet. result.is_denominate = wtx.tx->vin.size() == wtx.tx->vout.size() && // Number of inputs is same as number of outputs diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 71d2c2c15c..bde761482a 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -167,6 +167,8 @@ static void WalletTxToJSON(interfaces::Chain& chain, const CWalletTx& wtx, UniVa entry.pushKV("chainlock", chainlock); if (wtx.IsCoinBase()) entry.pushKV("generated", true); + if (wtx.IsPlatformTransfer()) + entry.pushKV("platform-transfer", true); if (confirms > 0) { entry.pushKV("blockhash", wtx.m_confirm.hashBlock.GetHex()); @@ -1403,6 +1405,10 @@ static void ListTransactions(const CWallet& wallet, const CWalletTx& wtx, int nM else entry.pushKV("category", "generate"); } + else if (wtx.IsPlatformTransfer()) + { + entry.pushKV("category", "platform-transfer"); + } else { entry.pushKV("category", "receive"); @@ -1467,7 +1473,8 @@ static RPCHelpMan listtransactions() "\"receive\" Non-coinbase transactions received.\n" "\"generate\" Coinbase transactions received with more than 100 confirmations.\n" "\"immature\" Coinbase transactions received with 100 or fewer confirmations.\n" - "\"orphan\" Orphaned coinbase transactions received.\n"}, + "\"orphan\" Orphaned coinbase transactions received.\n" + "\"platform-transfer\" Platform Transfer transactions received.\n"}, {RPCResult::Type::STR_AMOUNT, "amount", "The amount in " + CURRENCY_UNIT + ". This is negative for the 'send' category, and is positive\n" "for all other categories"}, {RPCResult::Type::STR, "label", "A comment for the address/transaction, if any"}, @@ -1582,7 +1589,8 @@ static RPCHelpMan listsinceblock() "\"receive\" Non-coinbase transactions received.\n" "\"generate\" Coinbase transactions received with more than 100 confirmations.\n" "\"immature\" Coinbase transactions received with 100 or fewer confirmations.\n" - "\"orphan\" Orphaned coinbase transactions received.\n"}, + "\"orphan\" Orphaned coinbase transactions received.\n" + "\"platform-transfer\" Platform Transfer transactions received.\n"}, {RPCResult::Type::STR_AMOUNT, "amount", "The amount in " + CURRENCY_UNIT + ". This is negative for the 'send' category, and is positive\n" "for all other categories"}, {RPCResult::Type::NUM, "vout", "the vout value"}, @@ -1723,7 +1731,8 @@ static RPCHelpMan gettransaction() "\"receive\" Non-coinbase transactions received.\n" "\"generate\" Coinbase transactions received with more than 100 confirmations.\n" "\"immature\" Coinbase transactions received with 100 or fewer confirmations.\n" - "\"orphan\" Orphaned coinbase transactions received.\n"}, + "\"orphan\" Orphaned coinbase transactions received.\n" + "\"platform-transfer\" Platform Transfer transactions received.\n"}, {RPCResult::Type::STR_AMOUNT, "amount", "The amount in " + CURRENCY_UNIT}, {RPCResult::Type::STR, "label", "A comment for the address/transaction, if any"}, {RPCResult::Type::NUM, "vout", "the vout value"}, diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 35d00e4bae..f8a0e71cd6 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -592,6 +592,7 @@ public: void setConfirmed() { m_confirm.status = CWalletTx::CONFIRMED; } const uint256& GetHash() const { return tx->GetHash(); } bool IsCoinBase() const { return tx->IsCoinBase(); } + bool IsPlatformTransfer() const { return tx->IsPlatformTransfer(); } bool IsImmatureCoinBase() const; // Disable copying of CWalletTx objects to prevent bugs where instances get