Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions qml/models/walletqmlmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ QString WalletQmlModel::name() const
return QString::fromStdString(m_wallet->getWalletName());
}

QString WalletQmlModel::newAddress(QString label)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rename to getNewAddress.

{
if (!m_wallet) {
return QString();
}
OutputType output_type = m_wallet->getDefaultAddressType();
util::Result<CTxDestination> dest{m_wallet->getNewDestination(output_type, label.toStdString())};
return QString::fromStdString(EncodeDestination(dest.value()));
}

std::set<interfaces::WalletTx> WalletQmlModel::getWalletTxs() const
{
if (!m_wallet) {
Expand Down
1 change: 1 addition & 0 deletions qml/models/walletqmlmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class WalletQmlModel : public QObject
WalletQmlModelTransaction* currentTransaction() const { return m_current_transaction; }
Q_INVOKABLE bool prepareTransaction();
Q_INVOKABLE void sendTransaction();
Q_INVOKABLE QString newAddress(QString label);

std::set<interfaces::WalletTx> getWalletTxs() const;
interfaces::WalletTx getWalletTx(const uint256& hash) const;
Expand Down
7 changes: 5 additions & 2 deletions qml/pages/wallet/RequestPayment.qml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Page {
background: null

property int requestCounter: 0
property WalletQmlModel wallet: walletController.selectedWallet
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make required and move binding to DesktopWallets:

        RequestPayment {
            wallet: walletController.selectedWallet
        }


ScrollView {
clip: true
Expand Down Expand Up @@ -198,8 +199,10 @@ Page {
requestCounter = requestCounter + 1
clearRequest.visible = true
title.text = qsTr("Payment request #" + requestCounter)
address.text = "bc1q f5xe y2tf 89k9 zy6k gnru wszy 5fsa truy 9te1 bu"
qrImage.code = "bc1qf5xey2tf89k9zy6kgnruwszy5fsatruy9te1bu"
var newAddress = root.wallet.newAddress(label.text)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const address = root.wallet.getNewAddress(label.text)
qrImage.code = address
address.text = address.replace(/(.{4})/g, "$1 ").trim()

var groupedAddress = newAddress.replace(/(.{4})/g, "$1 ").trim()
address.text = groupedAddress
qrImage.code = newAddress
continueButton.text = qsTr("Copy payment request")
}
}
Expand Down