Skip to content

Commit

Permalink
Implement BNS Confirmation Prompt with Conversion to Primary Address …
Browse files Browse the repository at this point in the history
…from Integrated Address
  • Loading branch information
deen-kakarot committed Dec 12, 2023
1 parent a0f7cdc commit bfbbf30
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/daemon/rpc_command_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1321,7 +1321,7 @@ bool rpc_command_executor::print_coinbase_tx_sum(uint64_t height, uint64_t count
<< height << ", " << (height + count) << ") is "
<< cryptonote::print_money(res.emission_amount + res.fee_amount) << " "
<< "consisting of " << cryptonote::print_money(res.emission_amount)
<< " in emissions, and " << cryptonote::print_money(res.fee_amount) << " in fees";
<< " in emissions, " << cryptonote::print_money(res.fee_amount) << " in fees, and " << cryptonote::print_money(res.burn_amount) << " in burn amount";
return true;
}

Expand Down
4 changes: 2 additions & 2 deletions src/rpc/core_rpc_server_commands_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1620,8 +1620,8 @@ namespace rpc {
struct response
{
std::string status; // General RPC error code. "OK" means everything looks good.
int64_t emission_amount; // Amount of coinbase reward in atomic units.
int64_t fee_amount; // Amount of fees in atomic units.
uint64_t emission_amount; // Amount of coinbase reward in atomic units.
int64_t fee_amount; // Amount of fees in atomic units.
int64_t burn_amount; // Amount of burnt beldex.

KV_MAP_SERIALIZABLE
Expand Down
55 changes: 54 additions & 1 deletion src/simplewallet/simplewallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6491,6 +6491,23 @@ bool simple_wallet::bns_buy_mapping(std::vector<std::string> args)
std::string reason;
std::vector<tools::wallet2::pending_tx> ptx_vector;

for(std::string check : {owner, backup_owner, value_wallet})
{
cryptonote::address_parse_info info;
if(!check.empty() && get_account_address_from_str(info, m_wallet->nettype(), check))
{
if (info.has_payment_id)
{
std::string confirm = input_line(tr("The integrated address provided will be converted into the primary address. Do you want to continue ? (Y/Yes/N/No) "));
if(!std::cin.eof())
{
if (!command_line::is_yes(confirm))
return true;
}
}
}
}

try
{
ptx_vector = m_wallet->bns_create_buy_mapping_tx(*mapping_years,
Expand Down Expand Up @@ -6659,6 +6676,24 @@ bool simple_wallet::bns_update_mapping(std::vector<std::string> args)
std::string reason;
std::vector<tools::wallet2::pending_tx> ptx_vector;
std::vector<cryptonote::rpc::BNS_NAMES_TO_OWNERS::response_entry> response;

for(std::string check : {owner, backup_owner, value_wallet})
{
cryptonote::address_parse_info info;
if(!check.empty() && get_account_address_from_str(info, m_wallet->nettype(), check))
{
if (info.has_payment_id)
{
std::string confirm = input_line(tr("The integrated address provided will be converted into the primary address. Do you want to continue ? (Y/Yes/N/No) "));
if(!std::cin.eof())
{
if (!command_line::is_yes(confirm))
return true;
}
}
}
}

try
{
ptx_vector = m_wallet->bns_create_update_mapping_tx(name,
Expand Down Expand Up @@ -6925,6 +6960,24 @@ bool simple_wallet::bns_make_update_mapping_signature(std::vector<std::string> a
SCOPED_WALLET_UNLOCK();
bns::generic_signature signature_binary;
std::string reason;

for(std::string check : {owner, backup_owner})
{
cryptonote::address_parse_info info;
if(!check.empty() && get_account_address_from_str(info, m_wallet->nettype(), check))
{
if (info.has_payment_id)
{
std::string confirm = input_line(tr("The integrated address provided will be converted into the primary address. Do you want to continue ? (Y/Yes/N/No) "));
if(!std::cin.eof())
{
if (!command_line::is_yes(confirm))
return true;
}
}
}
}

if (m_wallet->bns_make_update_mapping_signature(name,
nullptr,
nullptr,
Expand Down Expand Up @@ -9034,7 +9087,7 @@ bool simple_wallet::rescan_blockchain(const std::vector<std::string> &args_)
if (start_height > wallet_from_height)
{
message_writer() << tr("Warning: your restore height is higher than wallet restore height: ") << wallet_from_height;
std::string confirm = input_line(tr("Rescan anyway ? (Y/Yes/N/No): "));
std::string confirm = input_line(tr("Rescan anyway ? (Y/Yes/N/No) "));
if(!std::cin.eof())
{
if (!command_line::is_yes(confirm))
Expand Down

0 comments on commit bfbbf30

Please sign in to comment.