Add user name to dispute window and to trade details window (json contract window)

This commit is contained in:
chimp1984 2020-12-25 13:46:04 -05:00
parent 2b047976af
commit e38fa9a819
No known key found for this signature in database
GPG Key ID: 9801B4EC591F90E3
4 changed files with 23 additions and 13 deletions

View File

@ -17,26 +17,32 @@
package bisq.core.support.dispute.agent;
import bisq.core.locale.Res;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.Nullable;
@Slf4j
public class DisputeAgentLookupMap {
// See also: https://bisq.wiki/Finding_your_mediator
@Nullable
public static String getKeyBaseUserName(String fullAddress) {
switch (fullAddress) {
case "sjlho4zwp3gecspf.onion":
case "sjlho4zwp3gecspf.onion:9999":
return "leo816";
case "wizbisqzd7ku25di7p2ztsajioabihlnyp5lq5av66tmu7do2dke2tid.onion":
case "wizbisqzd7ku25di7p2ztsajioabihlnyp5lq5av66tmu7do2dke2tid.onion:9999":
return "wiz";
case "apbp7ubuyezav4hy.onion":
case "apbp7ubuyezav4hy.onion:9999":
return "bisq_knight";
case "a56olqlmmpxrn5q34itq5g5tb5d3fg7vxekpbceq7xqvfl3cieocgsyd.onion":
case "a56olqlmmpxrn5q34itq5g5tb5d3fg7vxekpbceq7xqvfl3cieocgsyd.onion:9999":
return "leo816";
case "3z5jnirlccgxzoxc6zwkcgwj66bugvqplzf6z2iyd5oxifiaorhnanqd.onion":
case "3z5jnirlccgxzoxc6zwkcgwj66bugvqplzf6z2iyd5oxifiaorhnanqd.onion:9999":
return "refundagent2";
default:
return null;
log.warn("No user name for dispute agent with address {} found.", fullAddress);
return Res.get("shared.na");
}
}
}

View File

@ -33,6 +33,7 @@ import bisq.core.payment.payload.PaymentMethod;
import bisq.core.support.dispute.Dispute;
import bisq.core.support.dispute.DisputeList;
import bisq.core.support.dispute.DisputeManager;
import bisq.core.support.dispute.agent.DisputeAgentLookupMap;
import bisq.core.support.dispute.arbitration.ArbitrationManager;
import bisq.core.support.dispute.mediation.MediationManager;
import bisq.core.support.dispute.refund.RefundManager;
@ -193,17 +194,20 @@ public class ContractWindow extends Overlay<ContractWindow> {
sellerPaymentAccountPayload.getPaymentDetails()).second.setMouseTransparent(false);
String title = "";
String agentKeyBaseUserName = "";
if (dispute.getSupportType() != null) {
switch (dispute.getSupportType()) {
case ARBITRATION:
title = Res.get("shared.selectedArbitrator");
break;
case MEDIATION:
agentKeyBaseUserName = DisputeAgentLookupMap.getKeyBaseUserName(contract.getMediatorNodeAddress().getFullAddress());
title = Res.get("shared.selectedMediator");
break;
case TRADE:
break;
case REFUND:
agentKeyBaseUserName = DisputeAgentLookupMap.getKeyBaseUserName(contract.getRefundAgentNodeAddress().getFullAddress());
title = Res.get("shared.selectedRefundAgent");
break;
}
@ -212,7 +216,8 @@ public class ContractWindow extends Overlay<ContractWindow> {
if (disputeManager != null) {
NodeAddress agentNodeAddress = disputeManager.getAgentNodeAddress(dispute);
if (agentNodeAddress != null) {
addConfirmationLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, title, agentNodeAddress.getFullAddress());
String value = agentKeyBaseUserName + " (" + agentNodeAddress.getFullAddress() + ")";
addConfirmationLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, title, value);
}
}

View File

@ -32,6 +32,7 @@ import bisq.core.locale.CurrencyUtil;
import bisq.core.locale.Res;
import bisq.core.offer.Offer;
import bisq.core.payment.payload.PaymentAccountPayload;
import bisq.core.support.dispute.agent.DisputeAgentLookupMap;
import bisq.core.support.dispute.arbitration.ArbitrationManager;
import bisq.core.trade.Contract;
import bisq.core.trade.Trade;
@ -346,6 +347,7 @@ public class TradeDetailsWindow extends Overlay<TradeDetailsWindow> {
textArea.setText(trade.getContractAsJson());
String data = "Contract as json:\n";
data += trade.getContractAsJson();
data += "\n\nOther detail data:";
data += "\n\nBuyerMultiSigPubKeyHex: " + Utils.HEX.encode(contract.getBuyerMultiSigPubKey());
data += "\nSellerMultiSigPubKeyHex: " + Utils.HEX.encode(contract.getSellerMultiSigPubKey());
if (CurrencyUtil.isFiatCurrency(offer.getCurrencyCode())) {
@ -358,6 +360,9 @@ public class TradeDetailsWindow extends Overlay<TradeDetailsWindow> {
data += "\n\nRaw deposit transaction as hex:\n" + depositTxAsHex;
}
data += "\n\nSelected mediator: " + DisputeAgentLookupMap.getKeyBaseUserName(contract.getMediatorNodeAddress().getFullAddress());
data += "\nSelected arbitrator (refund agent): " + DisputeAgentLookupMap.getKeyBaseUserName(contract.getRefundAgentNodeAddress().getFullAddress());
textArea.setText(data);
textArea.setPrefHeight(50);
textArea.setEditable(false);

View File

@ -1251,12 +1251,6 @@ public abstract class DisputeView extends ActivatableView<VBox, Void> {
}
String keyBaseUserName = DisputeAgentLookupMap.getKeyBaseUserName(agentNodeAddress.getFullAddress());
if (keyBaseUserName == null) {
setText(Res.get("shared.na"));
log.warn("Support agents user name is not found: {}", keyBaseUserName);
return;
}
setText(keyBaseUserName);
} else {
setText("");