mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2025-11-05 11:56:37 +00:00
show signing keystores in transaction blockchain form for spends from multisig wallets
This commit is contained in:
parent
75bcfe2253
commit
2f62a9e9c8
3 changed files with 29 additions and 0 deletions
|
|
@ -4,6 +4,7 @@ import com.sparrowwallet.drongo.KeyPurpose;
|
||||||
import com.sparrowwallet.drongo.SecureString;
|
import com.sparrowwallet.drongo.SecureString;
|
||||||
import com.sparrowwallet.drongo.Utils;
|
import com.sparrowwallet.drongo.Utils;
|
||||||
import com.sparrowwallet.drongo.address.Address;
|
import com.sparrowwallet.drongo.address.Address;
|
||||||
|
import com.sparrowwallet.drongo.policy.PolicyType;
|
||||||
import com.sparrowwallet.drongo.protocol.*;
|
import com.sparrowwallet.drongo.protocol.*;
|
||||||
import com.sparrowwallet.drongo.psbt.PSBT;
|
import com.sparrowwallet.drongo.psbt.PSBT;
|
||||||
import com.sparrowwallet.drongo.psbt.PSBTInput;
|
import com.sparrowwallet.drongo.psbt.PSBTInput;
|
||||||
|
|
@ -181,6 +182,12 @@ public class HeadersController extends TransactionFormController implements Init
|
||||||
@FXML
|
@FXML
|
||||||
private CopyableLabel blockTimestamp;
|
private CopyableLabel blockTimestamp;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private Field signedByField;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private CopyableLabel signedBy;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private Form blockchainSpacerForm;
|
private Form blockchainSpacerForm;
|
||||||
|
|
||||||
|
|
@ -811,6 +818,7 @@ public class HeadersController extends TransactionFormController implements Init
|
||||||
|
|
||||||
blockHeightField.managedProperty().bind(blockHeightField.visibleProperty());
|
blockHeightField.managedProperty().bind(blockHeightField.visibleProperty());
|
||||||
blockTimestampField.managedProperty().bind(blockTimestampField.visibleProperty());
|
blockTimestampField.managedProperty().bind(blockTimestampField.visibleProperty());
|
||||||
|
signedByField.managedProperty().bind(signedByField.visibleProperty());
|
||||||
|
|
||||||
if(blockTransaction.getHeight() > 0) {
|
if(blockTransaction.getHeight() > 0) {
|
||||||
blockHeightField.setVisible(true);
|
blockHeightField.setVisible(true);
|
||||||
|
|
@ -828,6 +836,19 @@ public class HeadersController extends TransactionFormController implements Init
|
||||||
} else {
|
} else {
|
||||||
blockTimestampField.setVisible(false);
|
blockTimestampField.setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(headersForm.getWalletTransaction() != null && headersForm.getWalletTransaction().getWallet() != null
|
||||||
|
&& headersForm.getWalletTransaction().getWallet().getPolicyType() == PolicyType.MULTI
|
||||||
|
&& headersForm.getWalletTransaction().getWallet().getDefaultPolicy().getNumSignaturesRequired() < headersForm.getWalletTransaction().getWallet().getKeystores().size()) {
|
||||||
|
signedByField.setVisible(true);
|
||||||
|
Wallet wallet = headersForm.getWalletTransaction().getWallet();
|
||||||
|
Map<TransactionInput, Map<TransactionSignature, Keystore>> signedKeystores = wallet.getSignedKeystores(blockTransaction.getTransaction());
|
||||||
|
StringJoiner joiner = new StringJoiner(", ");
|
||||||
|
signedKeystores.values().stream().flatMap(map -> map.values().stream()).distinct().forEach(keystore -> joiner.add(keystore.getLabel()));
|
||||||
|
signedBy.setText(joiner.toString());
|
||||||
|
} else {
|
||||||
|
signedByField.setVisible(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeSignButton(Wallet signingWallet) {
|
private void initializeSignButton(Wallet signingWallet) {
|
||||||
|
|
@ -1478,6 +1499,7 @@ public class HeadersController extends TransactionFormController implements Init
|
||||||
errorGlyph.getStyleClass().add("failure");
|
errorGlyph.getStyleClass().add("failure");
|
||||||
blockHeightField.setVisible(false);
|
blockHeightField.setVisible(false);
|
||||||
blockTimestampField.setVisible(false);
|
blockTimestampField.setVisible(false);
|
||||||
|
signedByField.setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -329,6 +329,10 @@ HorizontalHeaderColumn > TableColumnHeader.column-header.table-column{
|
||||||
-fx-stroke: #696c77;
|
-fx-stroke: #696c77;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#blockchainForm #blockStatus {
|
||||||
|
-fx-text-fill: white;
|
||||||
|
}
|
||||||
|
|
||||||
.root .progress-indicator.progress-timer.warn > .determinate-indicator > .indicator {
|
.root .progress-indicator.progress-timer.warn > .determinate-indicator > .indicator {
|
||||||
-fx-background-color: -fx-box-border, radial-gradient(center 50% 50%, radius 50%, #e06c75 70%, derive(-fx-control-inner-background, -9%) 100%);
|
-fx-background-color: -fx-box-border, radial-gradient(center 50% 50%, radius 50%, #e06c75 70%, derive(-fx-control-inner-background, -9%) 100%);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -196,6 +196,9 @@
|
||||||
<Field fx:id="blockTimestampField" text="Timestamp:">
|
<Field fx:id="blockTimestampField" text="Timestamp:">
|
||||||
<CopyableLabel fx:id="blockTimestamp" />
|
<CopyableLabel fx:id="blockTimestamp" />
|
||||||
</Field>
|
</Field>
|
||||||
|
<Field fx:id="signedByField" text="Signed by:">
|
||||||
|
<CopyableLabel fx:id="signedBy" />
|
||||||
|
</Field>
|
||||||
</Fieldset>
|
</Fieldset>
|
||||||
</DynamicForm>
|
</DynamicForm>
|
||||||
<Form fx:id="blockchainSpacerForm" GridPane.columnIndex="1" GridPane.rowIndex="0" visible="false">
|
<Form fx:id="blockchainSpacerForm" GridPane.columnIndex="1" GridPane.rowIndex="0" visible="false">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue