mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 23:18:17 +01:00
Merge pull request #5004 from chimp1984/add-mediators-keybase-usernames
Add mediators keybase usernames
This commit is contained in:
commit
78d4176f8a
7 changed files with 140 additions and 3 deletions
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* This file is part of Bisq.
|
||||
*
|
||||
* Bisq is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Bisq is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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:9999":
|
||||
return "leo816";
|
||||
case "wizbisqzd7ku25di7p2ztsajioabihlnyp5lq5av66tmu7do2dke2tid.onion:9999":
|
||||
return "wiz";
|
||||
case "apbp7ubuyezav4hy.onion:9999":
|
||||
return "bisq_knight";
|
||||
case "a56olqlmmpxrn5q34itq5g5tb5d3fg7vxekpbceq7xqvfl3cieocgsyd.onion:9999":
|
||||
return "leo816";
|
||||
case "3z5jnirlccgxzoxc6zwkcgwj66bugvqplzf6z2iyd5oxifiaorhnanqd.onion:9999":
|
||||
return "refundagent2";
|
||||
default:
|
||||
log.warn("No user name for dispute agent with address {} found.", fullAddress);
|
||||
return Res.get("shared.na");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1114,6 +1114,7 @@ support.error=Receiver could not process message. Error: {0}
|
|||
support.buyerAddress=BTC buyer address
|
||||
support.sellerAddress=BTC seller address
|
||||
support.role=Role
|
||||
support.agent=Support agent
|
||||
support.state=State
|
||||
support.closed=Closed
|
||||
support.open=Open
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -44,6 +44,7 @@ import bisq.core.support.dispute.DisputeList;
|
|||
import bisq.core.support.dispute.DisputeManager;
|
||||
import bisq.core.support.dispute.DisputeResult;
|
||||
import bisq.core.support.dispute.DisputeSession;
|
||||
import bisq.core.support.dispute.agent.DisputeAgentLookupMap;
|
||||
import bisq.core.support.dispute.mediation.mediator.MediatorManager;
|
||||
import bisq.core.support.dispute.refund.refundagent.RefundAgentManager;
|
||||
import bisq.core.support.messages.ChatMessage;
|
||||
|
@ -910,6 +911,8 @@ public abstract class DisputeView extends ActivatableView<VBox, Void> {
|
|||
TableColumn<Dispute, Dispute> roleColumn = getRoleColumn();
|
||||
tableView.getColumns().add(roleColumn);
|
||||
|
||||
maybeAddAgentColumn();
|
||||
|
||||
stateColumn = getStateColumn();
|
||||
tableView.getColumns().add(stateColumn);
|
||||
|
||||
|
@ -923,6 +926,15 @@ public abstract class DisputeView extends ActivatableView<VBox, Void> {
|
|||
tableView.getSortOrder().add(dateColumn);
|
||||
}
|
||||
|
||||
protected void maybeAddAgentColumn() {
|
||||
// Only relevant client views will impl it
|
||||
}
|
||||
|
||||
// Relevant client views will override that
|
||||
protected NodeAddress getAgentNodeAddress(Contract contract) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private TableColumn<Dispute, Dispute> getSelectColumn() {
|
||||
TableColumn<Dispute, Dispute> column = new AutoTooltipTableColumn<>(Res.get("shared.select"));
|
||||
column.setMinWidth(80);
|
||||
|
@ -1076,7 +1088,7 @@ public abstract class DisputeView extends ActivatableView<VBox, Void> {
|
|||
private TableColumn<Dispute, Dispute> getBuyerOnionAddressColumn() {
|
||||
TableColumn<Dispute, Dispute> column = new AutoTooltipTableColumn<>(Res.get("support.buyerAddress")) {
|
||||
{
|
||||
setMinWidth(190);
|
||||
setMinWidth(160);
|
||||
}
|
||||
};
|
||||
column.setCellValueFactory((dispute) -> new ReadOnlyObjectWrapper<>(dispute.getValue()));
|
||||
|
@ -1102,7 +1114,7 @@ public abstract class DisputeView extends ActivatableView<VBox, Void> {
|
|||
private TableColumn<Dispute, Dispute> getSellerOnionAddressColumn() {
|
||||
TableColumn<Dispute, Dispute> column = new AutoTooltipTableColumn<>(Res.get("support.sellerAddress")) {
|
||||
{
|
||||
setMinWidth(190);
|
||||
setMinWidth(160);
|
||||
}
|
||||
};
|
||||
column.setCellValueFactory((dispute) -> new ReadOnlyObjectWrapper<>(dispute.getValue()));
|
||||
|
@ -1216,6 +1228,40 @@ public abstract class DisputeView extends ActivatableView<VBox, Void> {
|
|||
return column;
|
||||
}
|
||||
|
||||
protected TableColumn<Dispute, Dispute> getAgentColumn() {
|
||||
TableColumn<Dispute, Dispute> column = new AutoTooltipTableColumn<>(Res.get("support.agent")) {
|
||||
{
|
||||
setMinWidth(70);
|
||||
}
|
||||
};
|
||||
column.setCellValueFactory((dispute) -> new ReadOnlyObjectWrapper<>(dispute.getValue()));
|
||||
column.setCellFactory(
|
||||
new Callback<>() {
|
||||
@Override
|
||||
public TableCell<Dispute, Dispute> call(TableColumn<Dispute, Dispute> column) {
|
||||
return new TableCell<>() {
|
||||
@Override
|
||||
public void updateItem(final Dispute item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
if (item != null && !empty) {
|
||||
NodeAddress agentNodeAddress = getAgentNodeAddress(item.getContract());
|
||||
if (agentNodeAddress == null) {
|
||||
setText(Res.get("shared.na"));
|
||||
return;
|
||||
}
|
||||
|
||||
String keyBaseUserName = DisputeAgentLookupMap.getKeyBaseUserName(agentNodeAddress.getFullAddress());
|
||||
setText(keyBaseUserName);
|
||||
} else {
|
||||
setText("");
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
return column;
|
||||
}
|
||||
|
||||
private TableColumn<Dispute, Dispute> getStateColumn() {
|
||||
TableColumn<Dispute, Dispute> column = new AutoTooltipTableColumn<>(Res.get("support.state")) {
|
||||
{
|
||||
|
|
|
@ -35,16 +35,21 @@ import bisq.core.support.dispute.mediation.MediationManager;
|
|||
import bisq.core.support.dispute.mediation.MediationSession;
|
||||
import bisq.core.support.dispute.mediation.mediator.MediatorManager;
|
||||
import bisq.core.support.dispute.refund.refundagent.RefundAgentManager;
|
||||
import bisq.core.trade.Contract;
|
||||
import bisq.core.trade.TradeManager;
|
||||
import bisq.core.util.FormattingUtils;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
|
||||
import bisq.network.p2p.NodeAddress;
|
||||
|
||||
import bisq.common.config.Config;
|
||||
import bisq.common.crypto.KeyRing;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import javafx.scene.control.TableColumn;
|
||||
|
||||
@FxmlView
|
||||
public class MediationClientView extends DisputeClientView {
|
||||
@Inject
|
||||
|
@ -103,4 +108,15 @@ public class MediationClientView extends DisputeClientView {
|
|||
.onAction(this::reOpenDispute)
|
||||
.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NodeAddress getAgentNodeAddress(Contract contract) {
|
||||
return contract.getMediatorNodeAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void maybeAddAgentColumn() {
|
||||
TableColumn<Dispute, Dispute> agentColumn = getAgentColumn();
|
||||
tableView.getColumns().add(agentColumn);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,16 +33,21 @@ import bisq.core.support.dispute.mediation.mediator.MediatorManager;
|
|||
import bisq.core.support.dispute.refund.RefundManager;
|
||||
import bisq.core.support.dispute.refund.RefundSession;
|
||||
import bisq.core.support.dispute.refund.refundagent.RefundAgentManager;
|
||||
import bisq.core.trade.Contract;
|
||||
import bisq.core.trade.TradeManager;
|
||||
import bisq.core.util.FormattingUtils;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
|
||||
import bisq.network.p2p.NodeAddress;
|
||||
|
||||
import bisq.common.config.Config;
|
||||
import bisq.common.crypto.KeyRing;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import javafx.scene.control.TableColumn;
|
||||
|
||||
@FxmlView
|
||||
public class RefundClientView extends DisputeClientView {
|
||||
@Inject
|
||||
|
@ -73,4 +78,15 @@ public class RefundClientView extends DisputeClientView {
|
|||
protected DisputeSession getConcreteDisputeChatSession(Dispute dispute) {
|
||||
return new RefundSession(dispute, disputeManager.isTrader(dispute));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NodeAddress getAgentNodeAddress(Contract contract) {
|
||||
return contract.getRefundAgentNodeAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void maybeAddAgentColumn() {
|
||||
TableColumn<Dispute, Dispute> agentColumn = getAgentColumn();
|
||||
tableView.getColumns().add(agentColumn);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue