7 #ifndef PIVX_QT_WALLETMODEL_H
8 #define PIVX_QT_WALLETMODEL_H
10 #if defined(HAVE_CONFIG_H)
91 std::string address_str, label_str, message_str, auth_merchant_str;
93 SER_WRITE(obj, address_str = obj.address.toStdString());
94 SER_WRITE(obj, label_str = obj.label.toStdString());
95 SER_WRITE(obj, message_str = obj.message.toStdString());
96 SER_WRITE(obj, auth_merchant_str = obj.authenticatedMerchant.toStdString());
98 READWRITE(obj.nVersion, address_str, label_str, obj.amount, message_str, obj.sPaymentRequest, auth_merchant_str);
100 SER_READ(obj, obj.address = QString::fromStdString(address_str));
101 SER_READ(obj, obj.label = QString::fromStdString(label_str));
102 SER_READ(obj, obj.message = QString::fromStdString(message_str));
103 SER_READ(obj, obj.authenticatedMerchant = QString::fromStdString(auth_merchant_str));
167 CAmount getBalance(
const CCoinControl* coinControl =
nullptr,
bool fIncludeDelegated =
true,
bool fUnlockedOnly =
false,
bool fIncludeShielded =
true)
const;
187 bool validateAddress(
const QString& address,
bool fStaking,
bool& isShielded);
224 bool fromTransparent,
300 bool isMine(
const QString& addressStr);
319 return this->address < key2.
address ||
338 void listCoins(std::map<
ListCoinsKey, std::vector<ListCoinsValue>>& mapCoins,
bool fSelectTransparent)
const;
343 void lockCoin(
uint256 hash,
unsigned int n,
bool isTransparent =
true);
350 bool saveReceiveRequest(
const std::string& sAddress,
const int64_t nId,
const std::string& sRequest);
423 void message(
const QString& title,
const QString& body,
unsigned int style,
bool* ret =
nullptr);
452 void updateAddressBook(
const QString& address,
const QString& label,
bool isMine,
const QString& purpose,
int status);
int64_t CAmount
Amount in PIV (Can be negative)
Qt model of the address book in the core.
bool GetKey(const CKeyID &address, CKey &keyOut) const override
bool HaveKey(const CKeyID &address) const override
Check whether a key corresponding to a given address is present in the store.
An encapsulated private key.
A reference to a CKey: the Hash160 of its serialized public key.
An outpoint - a combination of a transaction hash and an index n into its vout.
An encapsulated public key.
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances,...
A transaction with a bunch of additional info that only the owner cares about.
Model for PIVX network client.
Interface from Qt to configuration data structure for PIVX client.
An outpoint - a combination of a transaction hash and an index n into its sapling output description ...
static const int CURRENT_VERSION
SendCoinsRecipient(const QString &addr, const QString &label, const CAmount &amount, const QString &message)
SERIALIZE_METHODS(SendCoinsRecipient, obj)
std::string sPaymentRequest
QString authenticatedMerchant
UI model for the transaction table of a wallet.
Optional< QString > stakerAddress
bool operator<(const ListCoinsKey &key2) const
bool operator==(const ListCoinsKey &key2) const
ListCoinsValue(const uint256 &_txhash, int _outIndex, CAmount _nValue, int64_t _nTime, int _nDepth)
UnlockContext & operator=(UnlockContext &&rhs)
UnlockContext & operator=(const UnlockContext &)=default
UnlockContext(WalletModel *wallet, bool valid, const WalletModel::EncryptionStatus &status_before)
UnlockContext(const UnlockContext &)=delete
WalletModel::EncryptionStatus was_status
UnlockContext(UnlockContext &&obj)
void CopyFrom(UnlockContext &&rhs)
Interface to PIVX wallet from Qt view code.
OptionsModel * optionsModel
int getLastBlockProcessedNum() const
bool validateAddress(const QString &address)
AddressTableModel * addressTableModel
void getAvailableP2CSCoins(std::vector< COutput > &vCoins) const
bool isStakingStatusActive() const
void balanceChanged(const interfaces::WalletBalances &walletBalances)
void loadReceiveRequests(std::vector< std::string > &vReceiveRequests)
std::unique_ptr< interfaces::Handler > m_handler_notify_watch_only_changed
void lockCoin(uint256 hash, unsigned int n, bool isTransparent=true)
EncryptionStatus cachedEncryptionStatus
QString getSaplingAddressString(const CWalletTx *wtx, const SaplingOutPoint &op) const
void coinsSent(CWallet *wallet, const SendCoinsRecipient &recipient, const QByteArray &transaction)
void message(const QString &title, const QString &body, unsigned int style, bool *ret=nullptr)
CallResult< Destination > getNewAddress(const std::string &label="") const
ClientModel * m_client_model
bool isWalletLocked(bool fFullUnlocked=true) const
bool isMine(const CWDestination &address)
bool isTestNetwork() const
std::string getLabelForAddress(const CTxDestination &address)
bool updateAddressBookLabels(const CWDestination &address, const std::string &strName, const std::string &strPurpose)
bool isSaplingInMaintenance() const
void resetWalletOptions(QSettings &settings)
CAmount getLockedBalance(bool isTransparent) const
bool isShutdownRequested()
void unlockCoin(uint256 hash, unsigned int n, bool isTransparent=true)
bool setWalletEncrypted(bool encrypted, const SecureString &passphrase)
CAmount getUnlockedBalance(const CCoinControl *coinControl=nullptr, bool fIncludeDelegated=true, bool fIncludeShielded=true) const
bool haveKey(const CKeyID &keyID) const
WalletRescanReserver getRescanReserver() const
Return new wallet rescan reserver.
void listCoins(std::map< ListCoinsKey, std::vector< ListCoinsValue >> &mapCoins, bool fSelectTransparent) const
void listAvailableNotes(std::map< ListCoinsKey, std::vector< ListCoinsValue >> &mapCoins) const
void setWalletCustomFee(bool fUseCustomFee, const CAmount nFee=DEFAULT_TRANSACTION_FEE)
void encryptionStatusChanged(int status)
void pollBalanceChanged()
SendCoinsReturn sendCoins(WalletModelTransaction &transaction)
bool isV6Enforced() const
CallResult< Destination > getNewShieldedAddress(std::string strLabel="")
Return a new shielded address.
bool getWalletCustomFee(CAmount &nFeeRet)
bool addKeys(const CKey &key, const CPubKey &pubkey, WalletRescanReserver &reserver)
bool upgradeWallet(std::string &upgradeError)
TransactionTableModel * transactionTableModel
std::unique_ptr< interfaces::Handler > m_handler_notify_transaction_changed
ClientModel & clientModel() const
void notifyWatchonlyChanged(bool fHaveWatchonly)
bool updateAddressBookPurpose(const QString &addressStr, const std::string &purpose)
bool changePassphrase(const SecureString &oldPass, const SecureString &newPass)
void showProgress(const QString &title, int nProgress)
interfaces::Wallet walletWrapper
void notifyReceiveAddressChanged()
bool isStakingOnlyUnlocked()
bool getKeyId(const CTxDestination &address, CKeyID &keyID)
void emitBalanceChanged()
void setCacheNumBlocks(int _cachedNumBlocks)
CAmount getMinColdStakingAmount() const
bool isWalletUnlocked() const
void setClientModel(ClientModel *client_model)
OperationResult PrepareShieldedTransaction(WalletModelTransaction *modelTransaction, bool fromTransparent, const CCoinControl *coinControl=nullptr)
bool saveReceiveRequest(const std::string &sAddress, const int64_t nId, const std::string &sRequest)
AddressTableModel * getAddressTableModel()
bool blacklistAddressFromColdStaking(const QString &address)
CAmount getWalletStakeSplitThreshold() const
OptionsModel * getOptionsModel()
int getWalletTxDepth(const uint256 &txHash) const
SendCoinsReturn prepareTransaction(WalletModelTransaction *transaction, const CCoinControl *coinControl=nullptr, bool fIncludeDelegations=true)
std::set< COutPoint > listLockedCoins()
bool whitelistAddressFromColdStaking(const QString &addressStr)
bool getMNCollateralCandidate(COutPoint &outPoint)
bool processBalanceChangeInternal()
bool isColdStaking() const
bool backupWallet(const QString &filename)
std::unique_ptr< interfaces::Handler > m_handler_notify_status_changed
bool setWalletLocked(bool locked, const SecureString &passPhrase=SecureString(), bool stakingOnly=false)
std::unique_ptr< interfaces::Handler > m_handler_notify_sst_changed
double getSSTMinimum() const
EncryptionStatus getEncryptionStatus() const
CAmount getDelegatedBalance() const
bool isColdStakingNetworkelyEnabled() const
Whether cold staking is enabled or disabled in the network.
uint256 m_cached_best_block_hash
interfaces::WalletBalances m_cached_balances
int64_t getKeyCreationTime(const CPubKey &key)
bool fForceCheckBalanceChanged
bool haveWatchOnly() const
interfaces::WalletBalances getBalances()
void notifySSTChanged(const double sstVal)
notify stake-split threshold changed
bool getPubKey(const CKeyID &address, CPubKey &vchPubKeyOut) const
Q_INVOKABLE void checkBalanceChanged(const interfaces::WalletBalances &new_balances)
OperationResult createAndSendProposalFeeTx(CBudgetProposal &prop)
bool getKey(const CKeyID &keyID, CKey &key) const
void unsubscribeFromCoreSignals()
bool isSpent(const COutPoint &outpoint) const
bool IsShieldedDestination(const CWDestination &address)
bool isLockedCoin(uint256 hash, unsigned int n, bool isTransparent=true) const
Optional< QString > getShieldedAddressFromSpendDesc(const uint256 &txHash, int index)
std::unique_ptr< interfaces::Handler > m_handler_notify_walletbacked
int64_t getCreationTime() const
void updateAddressBook(const QString &address, const QString &label, bool isMine, const QString &purpose, int status)
uint256 getLastBlockProcessed() const
void updateWatchOnlyFlag(bool fHaveWatchonly)
CallResult< Destination > getNewStakingAddress(const std::string &label="") const
Return a new address used to receive for delegated cold stake purpose.
void setCacheBlockHash(const uint256 &_blockHash)
interfaces::WalletBalances GetWalletBalances()
void setWalletDefaultFee(CAmount fee=DEFAULT_TRANSACTION_FEE)
CAmount getBalance(const CCoinControl *coinControl=nullptr, bool fIncludeDelegated=true, bool fUnlockedOnly=false, bool fIncludeShielded=true) const
std::set< SaplingOutPoint > listLockedNotes()
UnlockContext requestUnlock()
QFuture< void > pollFuture
void setWalletStakeSplitThreshold(const CAmount nStakeSplitThreshold)
std::unique_ptr< interfaces::Handler > m_handler_notify_addressbook_changed
WalletModel(CWallet *wallet, OptionsModel *optionsModel, QObject *parent=0)
bool isRegTestNetwork() const
const CWalletTx * getTx(uint256 id)
bool hasForceCheckBalance()
void setfForceCheckBalanceChanged(bool _fForceCheckBalanceChanged)
std::unique_ptr< interfaces::Handler > m_handler_show_progress
bool lockForStakingOnly(const SecureString &passPhrase=SecureString())
bool isUsed(CTxDestination address)
bool isSaplingWalletEnabled() const
@ AmountWithFeeExceedsBalance
@ TransactionCreationFailed
@ CannotCreateInternalAddress
@ TransactionCommitFailed
void subscribeToCoreSignals()
bool hasWalletCustomFee()
TransactionTableModel * getTransactionTableModel()
Data model for a walletmodel transaction.
RAII object to check and reserve a wallet rescan.
WalletBalances getBalances()
boost::variant< CTxDestination, libzcash::SaplingPaymentAddress > CWDestination
boost::optional< T > Optional
Substitute for C++17 std::optional.
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString
#define SER_WRITE(obj, code)
#define SER_READ(obj, code)
boost::variant< CNoDestination, CKeyID, CScriptID, CExchangeKeyID > CTxDestination
A txout script template with a specific destination.
CWallet::CommitStatus status
SendCoinsReturn(CWallet::CommitResult _commitRes)
SendCoinsReturn(StatusCode status=OK)
CWallet::CommitResult commitRes
Collection of wallet balances.