use of io.bisq.core.arbitration.Arbitrator in project bisq-api by mrosseel.
the class BisqProxy method registerArbitrator.
public void registerArbitrator(List<String> languageCodes) {
// TODO most of this code is dupplication of ArbitratorRegistrationViewModel.onRegister
final String privKeyString = useDevPrivilegeKeys ? DevEnv.DEV_PRIVILEGE_PRIV_KEY : null;
// TODO hm, are we going to send private key over http?
if (null == privKeyString) {
throw new RuntimeException("Missing private key");
}
ECKey registrationKey = arbitratorManager.getRegistrationKey(privKeyString);
if (null == registrationKey) {
throw new RuntimeException("Missing registration key");
}
AddressEntry arbitratorDepositAddressEntry = btcWalletService.getOrCreateAddressEntry(AddressEntry.Context.ARBITRATOR);
String registrationSignature = arbitratorManager.signStorageSignaturePubKey(registrationKey);
Arbitrator arbitrator = new Arbitrator(p2PService.getAddress(), arbitratorDepositAddressEntry.getPubKey(), arbitratorDepositAddressEntry.getAddressString(), keyRing.getPubKeyRing(), new ArrayList<>(languageCodes), new Date().getTime(), registrationKey.getPubKey(), registrationSignature, null, null, null);
// TODO I don't know how to deal with those callbacks in order to send response back
arbitratorManager.addArbitrator(arbitrator, () -> System.out.println("Arbi registered"), message -> System.out.println("Error when registering arbi: " + message));
}
use of io.bisq.core.arbitration.Arbitrator in project bisq-api by mrosseel.
the class BisqProxy method selectArbitrator.
public Collection<Arbitrator> selectArbitrator(String arbitratorAddress) {
final Arbitrator arbitrator = getArbitratorByAddress(arbitratorAddress);
if (null == arbitrator) {
throw new NotFoundException("Arbitrator not found: " + arbitratorAddress);
}
if (!arbitratorIsTrader(arbitrator)) {
user.addAcceptedArbitrator(arbitrator);
user.addAcceptedMediator(ArbitratorManager.getMediator(arbitrator));
return user.getAcceptedArbitrators();
}
throw new ValidationException("You cannot select yourself as an arbitrator");
}
use of io.bisq.core.arbitration.Arbitrator in project bisq-api by mrosseel.
the class BisqProxy method deselectArbitrator.
public Collection<Arbitrator> deselectArbitrator(String arbitratorAddress) {
final Arbitrator arbitrator = getArbitratorByAddress(arbitratorAddress);
if (null == arbitrator) {
throw new NotFoundException("Arbitrator not found: " + arbitratorAddress);
}
user.removeAcceptedArbitrator(arbitrator);
user.removeAcceptedMediator(ArbitratorManager.getMediator(arbitrator));
return user.getAcceptedArbitrators();
}
Aggregations