aboutsummaryrefslogtreecommitdiff
path: root/src/interface/wallet.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/interface/wallet.h')
-rw-r--r--src/interface/wallet.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/interface/wallet.h b/src/interface/wallet.h
index 4510276446..b66ed63398 100644
--- a/src/interface/wallet.h
+++ b/src/interface/wallet.h
@@ -33,7 +33,9 @@ class Handler;
class PendingWalletTx;
struct WalletAddress;
struct WalletBalances;
+struct WalletTx;
struct WalletTxOut;
+struct WalletTxStatus;
using WalletOrderForm = std::vector<std::pair<std::string, std::string>>;
using WalletValueMap = std::map<std::string, std::string>;
@@ -158,6 +160,29 @@ public:
std::vector<std::string>& errors,
uint256& bumped_txid) = 0;
+ //! Get a transaction.
+ virtual CTransactionRef getTx(const uint256& txid) = 0;
+
+ //! Get transaction information.
+ virtual WalletTx getWalletTx(const uint256& txid) = 0;
+
+ //! Get list of all wallet transactions.
+ virtual std::vector<WalletTx> getWalletTxs() = 0;
+
+ //! Try to get updated status for a particular transaction, if possible without blocking.
+ virtual bool tryGetTxStatus(const uint256& txid,
+ WalletTxStatus& tx_status,
+ int& num_blocks,
+ int64_t& adjusted_time) = 0;
+
+ //! Get transaction details.
+ virtual WalletTx getWalletTxDetails(const uint256& txid,
+ WalletTxStatus& tx_status,
+ WalletOrderForm& order_form,
+ bool& in_mempool,
+ int& num_blocks,
+ int64_t& adjusted_time) = 0;
+
//! Get balances.
virtual WalletBalances getBalances() = 0;
@@ -170,6 +195,18 @@ public:
//! Get available balance.
virtual CAmount getAvailableBalance(const CCoinControl& coin_control) = 0;
+ //! Return whether transaction input belongs to wallet.
+ virtual isminetype txinIsMine(const CTxIn& txin) = 0;
+
+ //! Return whether transaction output belongs to wallet.
+ virtual isminetype txoutIsMine(const CTxOut& txout) = 0;
+
+ //! Return debit amount if transaction input belongs to wallet.
+ virtual CAmount getDebit(const CTxIn& txin, isminefilter filter) = 0;
+
+ //! Return credit amount if transaction input belongs to wallet.
+ virtual CAmount getCredit(const CTxOut& txout, isminefilter filter) = 0;
+
//! Return AvailableCoins + LockedCoins grouped by wallet address.
//! (put change in one group with wallet address)
using CoinsList = std::map<CTxDestination, std::vector<std::tuple<COutPoint, WalletTxOut>>>;
@@ -265,6 +302,38 @@ struct WalletBalances
}
};
+// Wallet transaction information.
+struct WalletTx
+{
+ CTransactionRef tx;
+ std::vector<isminetype> txin_is_mine;
+ std::vector<isminetype> txout_is_mine;
+ std::vector<CTxDestination> txout_address;
+ std::vector<isminetype> txout_address_is_mine;
+ CAmount credit;
+ CAmount debit;
+ CAmount change;
+ int64_t time;
+ std::map<std::string, std::string> value_map;
+ bool is_coinbase;
+};
+
+//! Updated transaction status.
+struct WalletTxStatus
+{
+ int block_height;
+ int blocks_to_maturity;
+ int depth_in_main_chain;
+ int request_count;
+ unsigned int time_received;
+ uint32_t lock_time;
+ bool is_final;
+ bool is_trusted;
+ bool is_abandoned;
+ bool is_coinbase;
+ bool is_in_main_chain;
+};
+
//! Wallet transaction output.
struct WalletTxOut
{