mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-23 15:00:30 +01:00
Use super classes for cryptCurrencyAccount and payload
This commit is contained in:
parent
6c11fc18c7
commit
11adc99f3c
8 changed files with 24 additions and 21 deletions
|
@ -126,7 +126,7 @@ public class AccountAgeWitnessService {
|
|||
private void republishAllFiatAccounts() {
|
||||
if (user.getPaymentAccounts() != null)
|
||||
user.getPaymentAccounts().stream()
|
||||
.filter(e -> !(e instanceof CryptoCurrencyAccount))
|
||||
.filter(e -> !(e instanceof AssetAccount))
|
||||
.forEach(e -> {
|
||||
// We delay with a random interval of 20-60 sec to ensure to be better connected and don't stress the
|
||||
// P2P network with publishing all at once at startup time.
|
||||
|
|
|
@ -30,6 +30,7 @@ import bisq.core.payment.payload.F2FAccountPayload;
|
|||
import bisq.core.payment.payload.FasterPaymentsAccountPayload;
|
||||
import bisq.core.payment.payload.HalCashAccountPayload;
|
||||
import bisq.core.payment.payload.InteracETransferAccountPayload;
|
||||
import bisq.core.payment.payload.LiveAssetsAccountPayload;
|
||||
import bisq.core.payment.payload.MoneyBeamAccountPayload;
|
||||
import bisq.core.payment.payload.MoneyGramAccountPayload;
|
||||
import bisq.core.payment.payload.NationalBankAccountPayload;
|
||||
|
@ -132,6 +133,8 @@ public class CoreProtoResolver implements ProtoResolver {
|
|||
return PromptPayAccountPayload.fromProto(proto);
|
||||
case ADVANCED_CASH_ACCOUNT_PAYLOAD:
|
||||
return AdvancedCashAccountPayload.fromProto(proto);
|
||||
case LIVE_ASSETS_ACCOUNT_PAYLOAD:
|
||||
return LiveAssetsAccountPayload.fromProto(proto);
|
||||
default:
|
||||
throw new ProtobufferRuntimeException("Unknown proto message case(PB.PaymentAccountPayload). messageCase=" + messageCase);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ import bisq.core.locale.TradeCurrency;
|
|||
import bisq.core.payment.AccountAgeWitnessService;
|
||||
import bisq.core.payment.AssetAccount;
|
||||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.payload.CryptoCurrencyAccountPayload;
|
||||
import bisq.core.payment.payload.AssetsAccountPayload;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.validation.AltCoinAddressValidator;
|
||||
import bisq.core.util.BSFormatter;
|
||||
|
@ -68,7 +68,7 @@ public class CryptoCurrencyForm extends PaymentMethodForm {
|
|||
PaymentAccountPayload paymentAccountPayload,
|
||||
String labelTitle) {
|
||||
addCompactTopLabelTextFieldWithCopyIcon(gridPane, ++gridRow, labelTitle,
|
||||
((CryptoCurrencyAccountPayload) paymentAccountPayload).getAddress());
|
||||
((AssetsAccountPayload) paymentAccountPayload).getAddress());
|
||||
return gridRow;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ import bisq.core.locale.Res;
|
|||
import bisq.core.locale.TradeCurrency;
|
||||
import bisq.core.offer.Offer;
|
||||
import bisq.core.payment.AccountAgeWitnessService;
|
||||
import bisq.core.payment.CryptoCurrencyAccount;
|
||||
import bisq.core.payment.AssetAccount;
|
||||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.util.BSFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
@ -166,7 +166,7 @@ public abstract class PaymentMethodForm {
|
|||
else if (!paymentAccount.getTradeCurrencies().isEmpty())
|
||||
tradeCurrency = paymentAccount.getTradeCurrencies().get(0);
|
||||
else
|
||||
tradeCurrency = paymentAccount instanceof CryptoCurrencyAccount ?
|
||||
tradeCurrency = paymentAccount instanceof AssetAccount ?
|
||||
CurrencyUtil.getAllSortedCryptoCurrencies().get(0) :
|
||||
CurrencyUtil.getDefaultTradeCurrency();
|
||||
|
||||
|
@ -174,7 +174,7 @@ public abstract class PaymentMethodForm {
|
|||
final boolean isAddAccountScreen = paymentAccount.getAccountName() == null;
|
||||
final long accountAge = !isAddAccountScreen ? accountAgeWitnessService.getMyAccountAge(paymentAccount.getPaymentAccountPayload()) : 0L;
|
||||
|
||||
final String limitationsText = paymentAccount instanceof CryptoCurrencyAccount ?
|
||||
final String limitationsText = paymentAccount instanceof AssetAccount ?
|
||||
Res.get("payment.maxPeriodAndLimitCrypto",
|
||||
getTimeText(hours),
|
||||
formatter.formatCoinWithCode(Coin.valueOf(accountAgeWitnessService.getMyTradeLimit(paymentAccount, tradeCurrency.getCode()))))
|
||||
|
|
|
@ -25,7 +25,7 @@ import bisq.core.locale.FiatCurrency;
|
|||
import bisq.core.locale.TradeCurrency;
|
||||
import bisq.core.offer.OpenOfferManager;
|
||||
import bisq.core.payment.AccountAgeWitnessService;
|
||||
import bisq.core.payment.CryptoCurrencyAccount;
|
||||
import bisq.core.payment.AssetAccount;
|
||||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.trade.TradeManager;
|
||||
import bisq.core.user.Preferences;
|
||||
|
@ -116,7 +116,7 @@ class AltCoinAccountsDataModel extends ActivatableDataModel {
|
|||
});
|
||||
}
|
||||
|
||||
if (!(paymentAccount instanceof CryptoCurrencyAccount))
|
||||
if (!(paymentAccount instanceof AssetAccount))
|
||||
accountAgeWitnessService.publishMyAccountAgeWitness(paymentAccount.getPaymentAccountPayload());
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ class AltCoinAccountsDataModel extends ActivatableDataModel {
|
|||
public void exportAccounts(Stage stage) {
|
||||
if (user.getPaymentAccounts() != null) {
|
||||
ArrayList<PaymentAccount> accounts = new ArrayList<>(user.getPaymentAccounts().stream()
|
||||
.filter(paymentAccount -> paymentAccount instanceof CryptoCurrencyAccount)
|
||||
.filter(paymentAccount -> paymentAccount instanceof AssetAccount)
|
||||
.collect(Collectors.toList()));
|
||||
GUIUtil.exportAccounts(accounts, accountsFileName, preferences, stage, persistenceProtoResolver);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import bisq.core.locale.FiatCurrency;
|
|||
import bisq.core.locale.TradeCurrency;
|
||||
import bisq.core.offer.OpenOfferManager;
|
||||
import bisq.core.payment.AccountAgeWitnessService;
|
||||
import bisq.core.payment.CryptoCurrencyAccount;
|
||||
import bisq.core.payment.AssetAccount;
|
||||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.trade.TradeManager;
|
||||
import bisq.core.user.Preferences;
|
||||
|
@ -145,7 +145,7 @@ class FiatAccountsDataModel extends ActivatableDataModel {
|
|||
public void exportAccounts(Stage stage) {
|
||||
if (user.getPaymentAccounts() != null) {
|
||||
ArrayList<PaymentAccount> accounts = new ArrayList<>(user.getPaymentAccounts().stream()
|
||||
.filter(paymentAccount -> !(paymentAccount instanceof CryptoCurrencyAccount))
|
||||
.filter(paymentAccount -> !(paymentAccount instanceof AssetAccount))
|
||||
.collect(Collectors.toList()));
|
||||
GUIUtil.exportAccounts(accounts, accountsFileName, preferences, stage, persistenceProtoResolver);
|
||||
}
|
||||
|
|
|
@ -56,8 +56,8 @@ import bisq.core.network.MessageState;
|
|||
import bisq.core.offer.Offer;
|
||||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.PaymentAccountUtil;
|
||||
import bisq.core.payment.payload.AssetsAccountPayload;
|
||||
import bisq.core.payment.payload.CashDepositAccountPayload;
|
||||
import bisq.core.payment.payload.CryptoCurrencyAccountPayload;
|
||||
import bisq.core.payment.payload.F2FAccountPayload;
|
||||
import bisq.core.payment.payload.FasterPaymentsAccountPayload;
|
||||
import bisq.core.payment.payload.HalCashAccountPayload;
|
||||
|
@ -206,7 +206,7 @@ public class BuyerStep2View extends TradeStepView {
|
|||
Layout.COMPACT_FIRST_ROW_AND_GROUP_DISTANCE).second;
|
||||
field.setCopyWithoutCurrencyPostFix(true);
|
||||
|
||||
if (!(paymentAccountPayload instanceof CryptoCurrencyAccountPayload) &&
|
||||
if (!(paymentAccountPayload instanceof AssetsAccountPayload) &&
|
||||
!(paymentAccountPayload instanceof F2FAccountPayload))
|
||||
addTopLabelTextFieldWithCopyIcon(gridPane, gridRow, 1,
|
||||
Res.get("shared.reasonForPayment"), model.dataModel.getReference(),
|
||||
|
@ -496,7 +496,7 @@ public class BuyerStep2View extends TradeStepView {
|
|||
String id = trade.getShortId();
|
||||
String paddedId = " " + id + " ";
|
||||
String amount = model.btcFormatter.formatVolumeWithCode(trade.getTradeVolume());
|
||||
if (paymentAccountPayload instanceof CryptoCurrencyAccountPayload) {
|
||||
if (paymentAccountPayload instanceof AssetsAccountPayload) {
|
||||
//noinspection UnusedAssignment
|
||||
message += Res.get("portfolio.pending.step2_buyer.altcoin",
|
||||
CurrencyUtil.getNameByCode(trade.getOffer().getCurrencyCode()),
|
||||
|
|
|
@ -27,9 +27,9 @@ import bisq.desktop.util.Layout;
|
|||
|
||||
import bisq.core.locale.CurrencyUtil;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.payment.payload.AssetsAccountPayload;
|
||||
import bisq.core.payment.payload.BankAccountPayload;
|
||||
import bisq.core.payment.payload.CashDepositAccountPayload;
|
||||
import bisq.core.payment.payload.CryptoCurrencyAccountPayload;
|
||||
import bisq.core.payment.payload.F2FAccountPayload;
|
||||
import bisq.core.payment.payload.HalCashAccountPayload;
|
||||
import bisq.core.payment.payload.MoneyGramAccountPayload;
|
||||
|
@ -183,9 +183,9 @@ public class SellerStep3View extends TradeStepView {
|
|||
if (contract != null) {
|
||||
PaymentAccountPayload myPaymentAccountPayload = contract.getSellerPaymentAccountPayload();
|
||||
PaymentAccountPayload peersPaymentAccountPayload = contract.getBuyerPaymentAccountPayload();
|
||||
if (myPaymentAccountPayload instanceof CryptoCurrencyAccountPayload) {
|
||||
myPaymentDetails = ((CryptoCurrencyAccountPayload) myPaymentAccountPayload).getAddress();
|
||||
peersPaymentDetails = ((CryptoCurrencyAccountPayload) peersPaymentAccountPayload).getAddress();
|
||||
if (myPaymentAccountPayload instanceof AssetsAccountPayload) {
|
||||
myPaymentDetails = ((AssetsAccountPayload) myPaymentAccountPayload).getAddress();
|
||||
peersPaymentDetails = ((AssetsAccountPayload) peersPaymentAccountPayload).getAddress();
|
||||
myTitle = Res.get("portfolio.pending.step3_seller.yourAddress", nameByCode);
|
||||
peersTitle = Res.get("portfolio.pending.step3_seller.buyersAddress", nameByCode);
|
||||
isBlockChain = true;
|
||||
|
@ -284,7 +284,7 @@ public class SellerStep3View extends TradeStepView {
|
|||
if (!DevEnv.isDevMode() && DontShowAgainLookup.showAgain(key)) {
|
||||
PaymentAccountPayload paymentAccountPayload = model.dataModel.getSellersPaymentAccountPayload();
|
||||
String message = Res.get("portfolio.pending.step3_seller.onPaymentReceived.part1", CurrencyUtil.getNameByCode(model.dataModel.getCurrencyCode()));
|
||||
if (!(paymentAccountPayload instanceof CryptoCurrencyAccountPayload)) {
|
||||
if (!(paymentAccountPayload instanceof AssetsAccountPayload)) {
|
||||
if (!(paymentAccountPayload instanceof WesternUnionAccountPayload) &&
|
||||
!(paymentAccountPayload instanceof HalCashAccountPayload) &&
|
||||
!(paymentAccountPayload instanceof F2FAccountPayload)) {
|
||||
|
@ -323,8 +323,8 @@ public class SellerStep3View extends TradeStepView {
|
|||
String currencyName = CurrencyUtil.getNameByCode(trade.getOffer().getCurrencyCode());
|
||||
String part1 = Res.get("portfolio.pending.step3_seller.part", currencyName);
|
||||
String id = trade.getShortId();
|
||||
if (paymentAccountPayload instanceof CryptoCurrencyAccountPayload) {
|
||||
String address = ((CryptoCurrencyAccountPayload) paymentAccountPayload).getAddress();
|
||||
if (paymentAccountPayload instanceof AssetsAccountPayload) {
|
||||
String address = ((AssetsAccountPayload) paymentAccountPayload).getAddress();
|
||||
String explorerOrWalletString = trade.getOffer().getCurrencyCode().equals("XMR") ?
|
||||
Res.get("portfolio.pending.step3_seller.altcoin.wallet", currencyName) :
|
||||
Res.get("portfolio.pending.step3_seller.altcoin.explorer", currencyName);
|
||||
|
|
Loading…
Add table
Reference in a new issue