Skip to content

Commit

Permalink
still WIP rbrunner7 review round 2
Browse files Browse the repository at this point in the history
  • Loading branch information
SNeedlewoods committed Sep 16, 2024
1 parent 7d37965 commit 7c6537c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 98 deletions.
44 changes: 0 additions & 44 deletions src/wallet/api/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3053,11 +3053,6 @@ WalletState WalletImpl::getWalletState()
return wallet_state;
}
//-------------------------------------------------------------------------------------------------------------------
bool WalletImpl::hasUnknownKeyImages()
{
return m_wallet->has_unknown_key_images();
}
//-------------------------------------------------------------------------------------------------------------------
void WalletImpl::rewriteWalletFile(const std::string &wallet_name, const std::string &password)
{
clearStatus();
Expand Down Expand Up @@ -3088,16 +3083,6 @@ void WalletImpl::writeWatchOnlyWallet(const std::string &wallet_name, const std:
}
}
//-------------------------------------------------------------------------------------------------------------------
std::map<std::uint32_t, std::uint64_t> WalletImpl::balancePerSubaddress(std::uint32_t index_major, bool strict)
{
return m_wallet->balance_per_subaddress(index_major, strict);
}
//-------------------------------------------------------------------------------------------------------------------
std::map<std::uint32_t, std::pair<std::uint64_t, std::pair<std::uint64_t, std::uint64_t>>> WalletImpl::unlockedBalancePerSubaddress(std::uint32_t index_major, bool strict)
{
return m_wallet->unlocked_balance_per_subaddress(index_major, strict);
}
//-------------------------------------------------------------------------------------------------------------------
void WalletImpl::updatePoolState(std::vector<std::tuple<cryptonote::transaction, std::string, bool>> &process_txs, bool refreshed, bool try_incremental)
{
clearStatus();
Expand Down Expand Up @@ -3436,35 +3421,6 @@ void WalletImpl::setTxKey(const std::string &txid, const std::string &tx_key, co
}
}
//-------------------------------------------------------------------------------------------------------------------
std::uint64_t WalletImpl::getDaemonAdjustedTime()
{
clearStatus();

try
{
return m_wallet->get_daemon_adjusted_time();
}
catch (const std::exception &e)
{
setStatusError((boost::format(tr("Failed to get daemon adjusted time. Error: %s")) % e.what()).str());
}
return 0;
}
//-------------------------------------------------------------------------------------------------------------------
void WalletImpl::setCacheDescription(const std::string &description)
{
m_wallet->set_description(description);
// TODO : Add ATTRIBUTE_DESCRIPTION to API and then call
// setCacheAttribute(ATTRIBUTE_DESCRIPTION, description);
}
//-------------------------------------------------------------------------------------------------------------------
std::string WalletImpl::getCacheDescription()
{
return m_wallet->get_description();
// TODO : Add ATTRIBUTE_DESCRIPTION to API and then call
// return getCacheAttribute(ATTRIBUTE_DESCRIPTION);
}
//-------------------------------------------------------------------------------------------------------------------
const std::pair<std::map<std::string, std::string>, std::vector<std::string>>& WalletImpl::getAccountTags()
{
return m_wallet->get_account_tags();
Expand Down
6 changes: 0 additions & 6 deletions src/wallet/api/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,8 @@ class WalletImpl : public Wallet
bool isFrozen(const std::string multisig_sign_data) const override;
void createOneOffSubaddress(std::uint32_t account_index, std::uint32_t address_index) override;
virtual WalletState getWalletState() const = 0;
bool hasUnknownKeyImages() const override;
void rewriteWalletFile(const std::string &wallet_name, const std::string &password) override;
void writeWatchOnlyWallet(const std::string &wallet_name, const std::string &password, std::string &new_keys_file_name) override;
std::map<std::uint32_t, std::uint64_t> balancePerSubaddress(std::uint32_t index_major, bool strict) const override;
std::map<std::uint32_t, std::pair<std::uint64_t, std::pair<std::uint64_t, std::uint64_t>>> unlockedBalancePerSubaddress(std::uint32_t index_major, bool strict) const override;
void updatePoolState(std::vector<std::tuple<cryptonote::transaction, std::string, bool>> &process_txs, bool refreshed = false, bool try_incremental = false) override;
void processPoolState(const std::vector<std::tuple<cryptonote::transaction, std::string, bool>> &txs) override;
void getEnoteDetails(std::vector<EnoteDetails> enote_details) const override;
Expand All @@ -268,9 +265,6 @@ class WalletImpl : public Wallet
// const wallet2::transfer_details &getTransferDetails(std::size_t idx) const override;
void discardUnmixableOutputs() override;
void setTxKey(const std::string &txid, const std::string &tx_key, const std::vector<std::string> &additional_tx_keys, const boost::optional<std::string> &single_destination_subaddress) override;
std::uint64_t getDaemonAdjustedTime() const override;
void setCacheDescription(const std::string &description) override;
std::string getCacheDescription() const override;
const std::pair<std::map<std::string, std::string>, std::vector<std::string>>& getAccountTags() override;
void setAccountTag(const std::set<uint32_t> &account_indices, const std::string &tag) override;
void setAccountTagDescription(const std::string &tag, const std::string &description) override;
Expand Down
51 changes: 3 additions & 48 deletions src/wallet/api/wallet2_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -1284,11 +1284,6 @@ struct Wallet
*/
virtual WalletState getWalletState() const = 0;
/**
* brief: hasUnknownKeyImages - check if any enotes have missing key images
* return: true if any stored enote is missing its key image, else false
*/
virtual bool hasUnknownKeyImages() const = 0;
/**
* brief: rewriteWalletFile - rewrite the wallet file for wallet update
* param: wallet_name - name of the wallet file (should exist)
* param: password - wallet password
Expand All @@ -1305,20 +1300,6 @@ struct Wallet
*/
virtual void writeWatchOnlyWallet(const std::string &wallet_name, const std::string &password, std::string &new_keys_file_name) = 0;
/**
* brief: balancePerSubaddress - get balance for each subaddress in given account
* param: index_major - account index
* param: strict -
* return: [minor subaddress index: amount, ... ]
*/
virtual std::map<std::uint32_t, std::uint64_t> balancePerSubaddress(std::uint32_t index_major, bool strict) const = 0;
/**
* brief: unlockedBalancePerSubaddress - get unlocked balance for each subaddresses in given account
* param: index_major - account index
* param: strict -
* return: [minor subaddress index: {amount, {blocks to unlock, time to unlock} }, ... ]
*/
virtual std::map<std::uint32_t, std::pair<std::uint64_t, std::pair<std::uint64_t, std::uint64_t>>> unlockedBalancePerSubaddress(std::uint32_t index_major, bool strict) const = 0;
/**
* brief: updatePoolState -
* outparam: process_txs - [ [tx, tx_id, double_spend_seen], ... ]
* param: refreshed - (default: false)
Expand All @@ -1341,16 +1322,11 @@ struct Wallet
* note: sets status error on fail
*/
virtual void processPoolState(const std::vector<std::tuple<cryptonote::transaction, std::string, bool>> &txs) = 0;
// TODO / QUESTION : How to translate the following types to a standard type for the API?
// - tools::wallet2::signed_tx
// - cryptonote::address_parse_info

/**
* brief: getEnoteDetails - get information about all enotes
* outparam: enote_details -
*/
virtual void getEnoteDetails(std::vector<EnoteDetails> enote_details) const = 0;

/**
* brief: convertMultisigTxToString - get the encrypted unsigned multisig transaction as hex string from a multisig pending transaction
* param: multisig_ptx - multisig pending transaction
Expand Down Expand Up @@ -1379,6 +1355,9 @@ struct Wallet
* return: true if succeeded
*/
virtual bool parseUnsignedTxFromStr(const std::string &unsigned_tx_str, UnsignedTransaction &exported_txs) const = 0;
// TODO / QUESTION : How to translate the following types to a standard type for the API?
// - tools::wallet2::signed_tx
// - cryptonote::address_parse_info
// TODO : wallet2::signed_tx_set
/**
* brief: signTxDumpToStr - get a signed transaction set from unsigned transaction set
Expand Down Expand Up @@ -1476,14 +1455,6 @@ struct Wallet
* note: sets status error on fail
*/
// virtual bool useForkRules(std::uint8_t version, std::int64_t early_blocks) const = 0;
// TODO : wallet2::transfer_details
/**
* brief: getTransferDetails -
* param: idx - index in transfer storage
* return: transfer details for given index
* note: sets status error on fail
*/
// virtual const wallet2::transfer_details &getTransferDetails(std::size_t idx) const = 0;
/**
* brief: discardUnmixableOutputs - freeze all unmixable outputs
* note: sets status error on fail
Expand All @@ -1501,22 +1472,6 @@ struct Wallet
// If we add access to boost::optional revisit all new functions to see which would benefit from it.
virtual void setTxKey(const std::string &txid, const std::string &tx_key, const std::vector<std::string> &additional_tx_keys, const boost::optional<std::string> &single_destination_subaddress) = 0;
/**
* brief: getDaemonAdjustedTime -
* return: daemon adjusted time
* note: sets status error on fail
*/
virtual std::uint64_t getDaemonAdjustedTime() const = 0;
/**
* brief: setCacheDescription - set wallet cache attribute with key ATTRIBUTE_DESCRIPTION
* param: description -
*/
virtual void setCacheDescription(const std::string &description) = 0;
/**
* brief: getCacheDescription - get wallet cache attribute with key ATTRIBUTE_DESCRIPTION
* return: description
*/
virtual std::string getCacheDescription() const = 0;
/**
* brief: getAccountTags - get the list of registered account tags
* return: first.Key=(tag's name), first.Value=(tag's label), second[i]=(i-th account's tag)
*/
Expand Down

0 comments on commit 7c6537c

Please sign in to comment.