gui: address type dropdown, add bech32m
Co-authored-by: João Barbosa <joao.paulo.barbosa@gmail.com>
This commit is contained in:
1 parent
56113daef4
commit
c9a77e227e
3 files changed
+19
-21
No files matched your search
@@ -0,0 +1,4 @@
|
|||||||
|
GUI changes
|
||||||
|
-----------
|
||||||
|
|
||||||
|
- The Bech32 checkbox has been replaced with a dropdown for all address types, including the new Bech32m (BIP-350) standard for Taproot enabled wallets.
|
||||||
@@ -195,7 +195,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="useBech32">
|
<widget class="QComboBox" name="addressType">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@@ -211,12 +211,6 @@
|
|||||||
<property name="focusPolicy">
|
<property name="focusPolicy">
|
||||||
<enum>Qt::StrongFocus</enum>
|
<enum>Qt::StrongFocus</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
|
||||||
<string>Native segwit addresses (aka Bech32 or BIP-173) reduce your transaction fees later on and offer better protection against typos, but old wallets don't support them. When unchecked, an address compatible with older wallets will be created instead.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Generate native segwit (Bech32) address</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@@ -366,7 +360,7 @@
|
|||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>reqLabel</tabstop>
|
<tabstop>reqLabel</tabstop>
|
||||||
<tabstop>reqAmount</tabstop>
|
<tabstop>reqAmount</tabstop>
|
||||||
<tabstop>useBech32</tabstop>
|
<tabstop>addressType</tabstop>
|
||||||
<tabstop>reqMessage</tabstop>
|
<tabstop>reqMessage</tabstop>
|
||||||
<tabstop>receiveButton</tabstop>
|
<tabstop>receiveButton</tabstop>
|
||||||
<tabstop>clearButton</tabstop>
|
<tabstop>clearButton</tabstop>
|
||||||
|
|||||||
@@ -87,10 +87,18 @@ void ReceiveCoinsDialog::setModel(WalletModel *_model)
|
|||||||
&QItemSelectionModel::selectionChanged, this,
|
&QItemSelectionModel::selectionChanged, this,
|
||||||
&ReceiveCoinsDialog::recentRequestsView_selectionChanged);
|
&ReceiveCoinsDialog::recentRequestsView_selectionChanged);
|
||||||
|
|
||||||
if (model->wallet().getDefaultAddressType() == OutputType::BECH32) {
|
// Populate address type dropdown and select default
|
||||||
ui->useBech32->setCheckState(Qt::Checked);
|
auto add_address_type = [&](OutputType type, const QString& text, const QString& tooltip) {
|
||||||
} else {
|
const auto index = ui->addressType->count();
|
||||||
ui->useBech32->setCheckState(Qt::Unchecked);
|
ui->addressType->addItem(text, (int) type);
|
||||||
|
ui->addressType->setItemData(index, tooltip, Qt::ToolTipRole);
|
||||||
|
if (model->wallet().getDefaultAddressType() == type) ui->addressType->setCurrentIndex(index);
|
||||||
|
};
|
||||||
|
add_address_type(OutputType::LEGACY, "Base58 (Legacy)", "Not recommended due to higher fees and less protection against typos.");
|
||||||
|
add_address_type(OutputType::P2SH_SEGWIT, "Base58 (P2SH-SegWit)", "Generates an address compatible with older wallets.");
|
||||||
|
add_address_type(OutputType::BECH32, "Bech32 (SegWit)", "Generates a native segwit address (BIP-173). Some old wallets don't support it.");
|
||||||
|
if (model->wallet().taprootEnabled()) {
|
||||||
|
add_address_type(OutputType::BECH32M, "Bech32m (Taproot)", "Bech32m (BIP-350) is an upgrade to Bech32, wallet support is still limited.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the button to be enabled or disabled based on whether the wallet can give out new addresses.
|
// Set the button to be enabled or disabled based on whether the wallet can give out new addresses.
|
||||||
@@ -144,15 +152,7 @@ void ReceiveCoinsDialog::on_receiveButton_clicked()
|
|||||||
QString address;
|
QString address;
|
||||||
QString label = ui->reqLabel->text();
|
QString label = ui->reqLabel->text();
|
||||||
/* Generate new receiving address */
|
/* Generate new receiving address */
|
||||||
OutputType address_type;
|
const OutputType address_type = (OutputType)ui->addressType->currentData().toInt();
|
||||||
if (ui->useBech32->isChecked()) {
|
|
||||||
address_type = OutputType::BECH32;
|
|
||||||
} else {
|
|
||||||
address_type = model->wallet().getDefaultAddressType();
|
|
||||||
if (address_type == OutputType::BECH32) {
|
|
||||||
address_type = OutputType::P2SH_SEGWIT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
address = model->getAddressTableModel()->addRow(AddressTableModel::Receive, label, "", address_type);
|
address = model->getAddressTableModel()->addRow(AddressTableModel::Receive, label, "", address_type);
|
||||||
|
|
||||||
switch(model->getAddressTableModel()->getEditStatus())
|
switch(model->getAddressTableModel()->getEditStatus())
|
||||||
|
|||||||
Reference in new issue
Block a user