mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2025-11-05 11:56:37 +00:00
add show transaction as qr button to signed transaction tab when offline
* [feature/1630] Add QR code button on signed transaction screen * [feature/1630] Button positioning improvements * [feature/1630] Added owner to qrDisplayDialog
This commit is contained in:
parent
d0c827c2c7
commit
b366177782
2 changed files with 26 additions and 0 deletions
|
|
@ -9,6 +9,7 @@ import com.sparrowwallet.drongo.psbt.PSBT;
|
||||||
import com.sparrowwallet.drongo.psbt.PSBTInput;
|
import com.sparrowwallet.drongo.psbt.PSBTInput;
|
||||||
import com.sparrowwallet.drongo.uri.BitcoinURI;
|
import com.sparrowwallet.drongo.uri.BitcoinURI;
|
||||||
import com.sparrowwallet.drongo.wallet.*;
|
import com.sparrowwallet.drongo.wallet.*;
|
||||||
|
import com.sparrowwallet.hummingbird.UR;
|
||||||
import com.sparrowwallet.hummingbird.registry.CryptoPSBT;
|
import com.sparrowwallet.hummingbird.registry.CryptoPSBT;
|
||||||
import com.sparrowwallet.sparrow.AppServices;
|
import com.sparrowwallet.sparrow.AppServices;
|
||||||
import com.sparrowwallet.sparrow.EventManager;
|
import com.sparrowwallet.sparrow.EventManager;
|
||||||
|
|
@ -227,6 +228,9 @@ public class HeadersController extends TransactionFormController implements Init
|
||||||
@FXML
|
@FXML
|
||||||
private Button broadcastButton;
|
private Button broadcastButton;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private Button showTransactionButton;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private Button saveFinalButton;
|
private Button saveFinalButton;
|
||||||
|
|
||||||
|
|
@ -461,6 +465,8 @@ public class HeadersController extends TransactionFormController implements Init
|
||||||
broadcastProgressBar.visibleProperty().bind(signaturesProgressBar.visibleProperty().not());
|
broadcastProgressBar.visibleProperty().bind(signaturesProgressBar.visibleProperty().not());
|
||||||
|
|
||||||
broadcastButton.managedProperty().bind(broadcastButton.visibleProperty());
|
broadcastButton.managedProperty().bind(broadcastButton.visibleProperty());
|
||||||
|
showTransactionButton.managedProperty().bind(showTransactionButton.visibleProperty());
|
||||||
|
showTransactionButton.visibleProperty().bind(broadcastButton.visibleProperty().not());
|
||||||
saveFinalButton.managedProperty().bind(saveFinalButton.visibleProperty());
|
saveFinalButton.managedProperty().bind(saveFinalButton.visibleProperty());
|
||||||
saveFinalButton.visibleProperty().bind(broadcastButton.visibleProperty().not());
|
saveFinalButton.visibleProperty().bind(broadcastButton.visibleProperty().not());
|
||||||
broadcastButton.visibleProperty().bind(AppServices.onlineProperty());
|
broadcastButton.visibleProperty().bind(AppServices.onlineProperty());
|
||||||
|
|
@ -1255,6 +1261,21 @@ public class HeadersController extends TransactionFormController implements Init
|
||||||
broadcastTransactionService.start();
|
broadcastTransactionService.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void showTransaction(ActionEvent event) {
|
||||||
|
try {
|
||||||
|
Transaction transaction = headersForm.getPsbt().extractTransaction();
|
||||||
|
byte[] txBytes = transaction.bitcoinSerialize();
|
||||||
|
UR ur = UR.fromBytes(txBytes);
|
||||||
|
BBQR bbqr = new BBQR(BBQRType.TXN, txBytes);
|
||||||
|
QRDisplayDialog qrDisplayDialog = new QRDisplayDialog(ur, bbqr, false, false, false);
|
||||||
|
qrDisplayDialog.initOwner(showTransactionButton.getScene().getWindow());
|
||||||
|
qrDisplayDialog.showAndWait();
|
||||||
|
} catch (Exception exception) {
|
||||||
|
log.error("Error creating UR", exception);
|
||||||
|
AppServices.showErrorDialog("Error displaying transaction QR code", exception.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void saveFinalTransaction(ActionEvent event) {
|
public void saveFinalTransaction(ActionEvent event) {
|
||||||
Stage window = new Stage();
|
Stage window = new Stage();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -285,6 +285,11 @@
|
||||||
<Glyph fontFamily="Font Awesome 5 Free Solid" fontSize="20" icon="SATELLITE_DISH" />
|
<Glyph fontFamily="Font Awesome 5 Free Solid" fontSize="20" icon="SATELLITE_DISH" />
|
||||||
</graphic>
|
</graphic>
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button fx:id="showTransactionButton" HBox.hgrow="ALWAYS" text="Show Transaction as QR" contentDisplay="TOP" wrapText="true" textAlignment="CENTER" onAction="#showTransaction">
|
||||||
|
<graphic>
|
||||||
|
<Glyph fontFamily="Font Awesome 5 Free Solid" fontSize="20" icon="QRCODE" />
|
||||||
|
</graphic>
|
||||||
|
</Button>
|
||||||
<Button fx:id="saveFinalButton" defaultButton="true" HBox.hgrow="ALWAYS" text="Save Final Transaction" contentDisplay="TOP" wrapText="true" textAlignment="CENTER" onAction="#saveFinalTransaction">
|
<Button fx:id="saveFinalButton" defaultButton="true" HBox.hgrow="ALWAYS" text="Save Final Transaction" contentDisplay="TOP" wrapText="true" textAlignment="CENTER" onAction="#saveFinalTransaction">
|
||||||
<graphic>
|
<graphic>
|
||||||
<Glyph fontFamily="Font Awesome 5 Free Solid" fontSize="20" icon="ARROW_DOWN" />
|
<Glyph fontFamily="Font Awesome 5 Free Solid" fontSize="20" icon="ARROW_DOWN" />
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue