Skip to content

Commit

Permalink
Fix function overloads
Browse files Browse the repository at this point in the history
  • Loading branch information
U65535F committed Jan 29, 2025
1 parent 25b3ef2 commit a55f1f1
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 6 deletions.
16 changes: 13 additions & 3 deletions src/wallet/api/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2551,11 +2551,13 @@ bool WalletImpl::checkBackgroundSync(const std::string &message) const
bool WalletImpl::parse_uri(const std::string &uri, std::string &address, std::string &payment_id, uint64_t &amount, std::string &tx_description, std::string &recipient_name, std::vector<std::string> &unknown_parameters, std::string &error)
{
std::vector<tools::wallet2::uri_data> data;
if (!m_wallet->parse_uri(uri, data, payment_id, tx_description, unknown_parameters, error)) {
if (!m_wallet->parse_uri(uri, data, payment_id, tx_description, unknown_parameters, error))
{
setStatusError(tr("Failed to parse uri"));
return false;
}
if (data.size() > 1) {
if (data.size() > 1)
{
setStatusError(tr("Multi-recipient URIs currently unsupported"));
return false;
}
Expand All @@ -2567,7 +2569,15 @@ bool WalletImpl::parse_uri(const std::string &uri, std::string &address, std::st

std::string WalletImpl::make_uri(const std::string &address, const std::string &payment_id, uint64_t amount, const std::string &tx_description, const std::string &recipient_name, std::string &error) const
{
return m_wallet->make_uri(address, payment_id, amount, tx_description, recipient_name, error);
tools::wallet2::uri_data entry;
entry.address = address;
entry.amount = amount;
entry.recipient_name = recipient_name;

std::vector<tools::wallet2::uri_data> data;
data.push_back(entry);

return make_uri(data, payment_id, tx_description, error);
}

std::string WalletImpl::getDefaultDataDir() const
Expand Down
21 changes: 18 additions & 3 deletions src/wallet/wallet2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15143,9 +15143,24 @@ bool wallet2::parse_uri(const std::string &uri, std::vector<uri_data> &data, std

return true;
}
}
bool wallet2::parse_uri(const std::string& uri, std::string& address, std::string& payment_id, uint64_t& amount, std::string& description, std::string& recipient_name, std::unordered_map<std::string, std::string>& unknown_parameters, std::string& error) {
return parse_uri(uri, address, payment_id, amount, description, error);

bool wallet2::parse_uri(const std::string& uri, std::string& address, std::string& payment_id, uint64_t& amount, std::string& description, std::string& recipient_name, std::unordered_map<std::string, std::string>& unknown_parameters, std::string& error)
{
std::vector<tools::wallet2::uri_data> data;
if (!m_wallet->parse_uri(uri, data, payment_id, tx_description, unknown_parameters, error))
{
setStatusError(tr("Failed to parse uri"));
return false;
}
if (data.size() > 1)
{
setStatusError(tr("Multi-recipient URIs currently unsupported"));
return false;
}
address = data[0].address;
amount = data[0].amount;
recipient_name = data[0].recipient_name;
return true;
}
//----------------------------------------------------------------------------------------------------
uint64_t wallet2::get_blockchain_height_by_date(uint16_t year, uint8_t month, uint8_t day)
Expand Down
1 change: 1 addition & 0 deletions src/wallet/wallet2.h
Original file line number Diff line number Diff line change
Expand Up @@ -1650,6 +1650,7 @@ namespace tools

std::string make_uri(std::vector<uri_data> data, const std::string &payment_id, const std::string &tx_description, std::string &error) const;
bool parse_uri(const std::string &uri, std::vector<uri_data> &data, std::string &payment_id, std::string &tx_description, std::vector<std::string> &unknown_parameters, std::string &error);
bool parse_uri(const std::string& uri, std::string& address, std::string& payment_id, uint64_t& amount, std::string& description, std::string& recipient_name, std::unordered_map<std::string, std::string>& unknown_parameters, std::string& error);

uint64_t get_blockchain_height_by_date(uint16_t year, uint8_t month, uint8_t day); // 1<=month<=12, 1<=day<=31

Expand Down

0 comments on commit a55f1f1

Please sign in to comment.