Copy account data to clipboard

Use ctrl+c to copy accountagewitness and pubkey to clipboard in a format to
be used by arbitrator to sign the account
This commit is contained in:
sqrrm 2020-12-15 14:53:34 +01:00
parent 0e7dd21745
commit de25105fa8
No known key found for this signature in database
GPG key ID: 45235F9EF87089EC
3 changed files with 21 additions and 0 deletions

View file

@ -880,4 +880,10 @@ public class AccountAgeWitnessService {
!peerHasSignedWitness(trade) &&
tradeAmountIsSufficient(trade.getTradeAmount());
}
public String signInfoFromAccount(PaymentAccount paymentAccount) {
var pubKey = keyRing.getSignatureKeyPair().getPublic();
var witness = getMyWitness(paymentAccount.getPaymentAccountPayload());
return Utilities.bytesAsHexString(witness.getHash()) + "," + Utilities.bytesAsHexString(pubKey.getEncoded());
}
}

View file

@ -62,6 +62,8 @@ public abstract class PaymentAccountsView<R extends Node, M extends ActivatableW
accountAgeWitnessService.getAccountAgeWitnessUtils().logSigners();
} else if (Utilities.isCtrlShiftPressed(KeyCode.U, event)) {
accountAgeWitnessService.getAccountAgeWitnessUtils().logUnsignedSignerPubKeys();
} else if (Utilities.isAltOrCtrlPressed(KeyCode.C, event)) {
copyAccount();
}
};
@ -174,4 +176,7 @@ public abstract class PaymentAccountsView<R extends Node, M extends ActivatableW
protected abstract void buildForm();
protected abstract void onSelectAccount(PaymentAccount paymentAccount);
protected void copyAccount() {
}
}

View file

@ -99,6 +99,7 @@ import bisq.core.util.validation.InputValidator;
import bisq.common.config.Config;
import bisq.common.util.Tuple2;
import bisq.common.util.Tuple3;
import bisq.common.util.Utilities;
import org.bitcoinj.core.Coin;
@ -540,5 +541,14 @@ public class FiatAccountsView extends PaymentAccountsView<GridPane, FiatAccounts
gridRow = 1;
}
@Override
protected void copyAccount() {
var selectedAccount = paymentAccountsListView.getSelectionModel().getSelectedItem();
if (selectedAccount == null) {
return;
}
Utilities.copyToClipboard(accountAgeWitnessService.signInfoFromAccount(selectedAccount));
}
}