diff --git a/apitest/src/test/java/bisq/apitest/method/trade/AbstractTradeTest.java b/apitest/src/test/java/bisq/apitest/method/trade/AbstractTradeTest.java index 3b8a6980..6331c339 100644 --- a/apitest/src/test/java/bisq/apitest/method/trade/AbstractTradeTest.java +++ b/apitest/src/test/java/bisq/apitest/method/trade/AbstractTradeTest.java @@ -12,12 +12,9 @@ import org.junit.jupiter.api.TestInfo; import static bisq.cli.TradeFormat.format; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.fail; - import bisq.apitest.method.offer.AbstractOfferTest; -import bisq.cli.GrpcClient; public class AbstractTradeTest extends AbstractOfferTest { @@ -52,9 +49,9 @@ public class AbstractTradeTest extends AbstractOfferTest { if (!isLongRunningTest) assertEquals(EXPECTED_PROTOCOL_STATUS.isDepositPublished, trade.getIsDepositPublished()); - assertEquals(EXPECTED_PROTOCOL_STATUS.isDepositConfirmed, trade.getIsDepositConfirmed()); - assertEquals(EXPECTED_PROTOCOL_STATUS.isFiatSent, trade.getIsFiatSent()); - assertEquals(EXPECTED_PROTOCOL_STATUS.isFiatReceived, trade.getIsFiatReceived()); + assertEquals(EXPECTED_PROTOCOL_STATUS.isDepositUnlocked, trade.getIsDepositUnlocked()); + assertEquals(EXPECTED_PROTOCOL_STATUS.isPaymentSent, trade.getIsPaymentSent()); + assertEquals(EXPECTED_PROTOCOL_STATUS.isPaymentReceived, trade.getIsPaymentReceived()); assertEquals(EXPECTED_PROTOCOL_STATUS.isPayoutPublished, trade.getIsPayoutPublished()); assertEquals(EXPECTED_PROTOCOL_STATUS.isWithdrawn, trade.getIsWithdrawn()); } diff --git a/apitest/src/test/java/bisq/apitest/method/trade/ExpectedProtocolStatus.java b/apitest/src/test/java/bisq/apitest/method/trade/ExpectedProtocolStatus.java index 63655585..4256cb21 100644 --- a/apitest/src/test/java/bisq/apitest/method/trade/ExpectedProtocolStatus.java +++ b/apitest/src/test/java/bisq/apitest/method/trade/ExpectedProtocolStatus.java @@ -10,9 +10,9 @@ public class ExpectedProtocolStatus { Trade.State state; Trade.Phase phase; boolean isDepositPublished; - boolean isDepositConfirmed; - boolean isFiatSent; - boolean isFiatReceived; + boolean isDepositUnlocked; + boolean isPaymentSent; + boolean isPaymentReceived; boolean isPayoutPublished; boolean isWithdrawn; @@ -31,18 +31,18 @@ public class ExpectedProtocolStatus { return this; } - public ExpectedProtocolStatus setDepositConfirmed(boolean depositConfirmed) { - isDepositConfirmed = depositConfirmed; + public ExpectedProtocolStatus setDepositUnlocked(boolean depositUnlocked) { + isDepositUnlocked = depositUnlocked; return this; } - public ExpectedProtocolStatus setFiatSent(boolean fiatSent) { - isFiatSent = fiatSent; + public ExpectedProtocolStatus setFiatSent(boolean paymentSent) { + isPaymentSent = paymentSent; return this; } - public ExpectedProtocolStatus setFiatReceived(boolean fiatReceived) { - isFiatReceived = fiatReceived; + public ExpectedProtocolStatus setFiatReceived(boolean paymentReceived) { + isPaymentReceived = paymentReceived; return this; } @@ -60,9 +60,9 @@ public class ExpectedProtocolStatus { state = null; phase = null; isDepositPublished = false; - isDepositConfirmed = false; - isFiatSent = false; - isFiatReceived = false; + isDepositUnlocked = false; + isPaymentSent = false; + isPaymentReceived = false; isPayoutPublished = false; isWithdrawn = false; } diff --git a/apitest/src/test/java/bisq/apitest/method/trade/TakeBuyBTCOfferTest.java b/apitest/src/test/java/bisq/apitest/method/trade/TakeBuyBTCOfferTest.java index 58ac2c8e..7e3d0b50 100644 --- a/apitest/src/test/java/bisq/apitest/method/trade/TakeBuyBTCOfferTest.java +++ b/apitest/src/test/java/bisq/apitest/method/trade/TakeBuyBTCOfferTest.java @@ -36,13 +36,12 @@ import org.junit.jupiter.api.TestMethodOrder; import static bisq.cli.TableFormat.formatBalancesTbls; import static bisq.core.btc.wallet.Restrictions.getDefaultBuyerSecurityDepositAsPercent; -import static bisq.core.trade.Trade.Phase.DEPOSIT_CONFIRMED; +import static bisq.core.trade.Trade.Phase.DEPOSIT_UNLOCKED; import static bisq.core.trade.Trade.Phase.PAYMENT_SENT; import static bisq.core.trade.Trade.Phase.PAYOUT_PUBLISHED; import static bisq.core.trade.Trade.State.*; import static java.lang.String.format; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.fail; import static protobuf.Offer.State.OFFER_FEE_PAID; @@ -92,8 +91,8 @@ public class TakeBuyBTCOfferTest extends AbstractTradeTest { for (int i = 1; i <= maxTradeStateAndPhaseChecks.get(); i++) { trade = bobClient.getTrade(trade.getTradeId()); - if (!trade.getIsDepositConfirmed()) { - log.warn("Bob still waiting on trade {} maker tx {} taker tx {}: DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN, attempt # {}", + if (!trade.getIsDepositUnlocked()) { + log.warn("Bob still waiting on trade {} maker tx {} taker tx {}: DEPOSIT_UNLOCKED_IN_BLOCK_CHAIN, attempt # {}", trade.getShortId(), trade.getMakerDepositTxId(), trade.getTakerDepositTxId(), @@ -101,18 +100,18 @@ public class TakeBuyBTCOfferTest extends AbstractTradeTest { genBtcBlocksThenWait(1, 4000); continue; } else { - EXPECTED_PROTOCOL_STATUS.setState(DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN) - .setPhase(DEPOSIT_CONFIRMED) + EXPECTED_PROTOCOL_STATUS.setState(DEPOSIT_UNLOCKED_IN_BLOCK_CHAIN) + .setPhase(DEPOSIT_UNLOCKED) .setDepositPublished(true) - .setDepositConfirmed(true); + .setDepositUnlocked(true); verifyExpectedProtocolStatus(trade); - logTrade(log, testInfo, "Bob's view after deposit is confirmed", trade, true); + logTrade(log, testInfo, "Bob's view after deposit is unlocked", trade, true); break; } } - if (!trade.getIsDepositConfirmed()) { - fail(format("INVALID_PHASE for Bob's trade %s in STATE=%s PHASE=%s, deposit tx was never confirmed.", + if (!trade.getIsDepositUnlocked()) { + fail(format("INVALID_PHASE for Bob's trade %s in STATE=%s PHASE=%s, deposit tx never unlocked.", trade.getShortId(), trade.getState(), trade.getPhase())); @@ -130,8 +129,8 @@ public class TakeBuyBTCOfferTest extends AbstractTradeTest { var trade = aliceClient.getTrade(tradeId); Predicate tradeStateAndPhaseCorrect = (t) -> - t.getState().equals(DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN.name()) - && t.getPhase().equals(DEPOSIT_CONFIRMED.name()); + t.getState().equals(DEPOSIT_UNLOCKED_IN_BLOCK_CHAIN.name()) + && t.getPhase().equals(DEPOSIT_UNLOCKED.name()); for (int i = 1; i <= maxTradeStateAndPhaseChecks.get(); i++) { @@ -162,8 +161,8 @@ public class TakeBuyBTCOfferTest extends AbstractTradeTest { for (int i = 1; i <= maxTradeStateAndPhaseChecks.get(); i++) { trade = aliceClient.getTrade(tradeId); - if (!trade.getIsFiatSent()) { - log.warn("Alice still waiting for trade {} BUYER_SAW_ARRIVED_FIAT_PAYMENT_INITIATED_MSG, attempt # {}", + if (!trade.getIsPaymentSent()) { + log.warn("Alice still waiting for trade {} BUYER_SAW_ARRIVED_PAYMENT_INITIATED_MSG, attempt # {}", trade.getShortId(), i); sleep(5000); diff --git a/apitest/src/test/java/bisq/apitest/method/trade/TakeSellBTCOfferTest.java b/apitest/src/test/java/bisq/apitest/method/trade/TakeSellBTCOfferTest.java index 15c285f7..bac4b7a8 100644 --- a/apitest/src/test/java/bisq/apitest/method/trade/TakeSellBTCOfferTest.java +++ b/apitest/src/test/java/bisq/apitest/method/trade/TakeSellBTCOfferTest.java @@ -37,7 +37,7 @@ import org.junit.jupiter.api.TestMethodOrder; import static bisq.apitest.config.ApiTestConfig.BTC; import static bisq.cli.TableFormat.formatBalancesTbls; import static bisq.core.btc.wallet.Restrictions.getDefaultBuyerSecurityDepositAsPercent; -import static bisq.core.trade.Trade.Phase.DEPOSIT_CONFIRMED; +import static bisq.core.trade.Trade.Phase.DEPOSIT_UNLOCKED; import static bisq.core.trade.Trade.Phase.PAYMENT_SENT; import static bisq.core.trade.Trade.Phase.PAYOUT_PUBLISHED; import static bisq.core.trade.Trade.Phase.WITHDRAWN; @@ -45,7 +45,6 @@ import static bisq.core.trade.Trade.State.*; import static java.lang.String.format; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; import static protobuf.Offer.State.OFFER_FEE_PAID; import static protobuf.OfferPayload.Direction.SELL; @@ -97,8 +96,8 @@ public class TakeSellBTCOfferTest extends AbstractTradeTest { for (int i = 1; i <= maxTradeStateAndPhaseChecks.get(); i++) { trade = bobClient.getTrade(trade.getTradeId()); - if (!trade.getIsDepositConfirmed()) { - log.warn("Bob still waiting on trade {} maker tx {} taker tx {}: DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN, attempt # {}", + if (!trade.getIsDepositUnlocked()) { + log.warn("Bob still waiting on trade {} maker tx {} taker tx {}: DEPOSIT_UNLOCKED_IN_BLOCK_CHAIN, attempt # {}", trade.getShortId(), trade.getMakerDepositTxId(), trade.getTakerDepositTxId(), @@ -106,18 +105,18 @@ public class TakeSellBTCOfferTest extends AbstractTradeTest { genBtcBlocksThenWait(1, 4000); continue; } else { - EXPECTED_PROTOCOL_STATUS.setState(DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN) - .setPhase(DEPOSIT_CONFIRMED) + EXPECTED_PROTOCOL_STATUS.setState(DEPOSIT_UNLOCKED_IN_BLOCK_CHAIN) + .setPhase(DEPOSIT_UNLOCKED) .setDepositPublished(true) - .setDepositConfirmed(true); + .setDepositUnlocked(true); verifyExpectedProtocolStatus(trade); logTrade(log, testInfo, "Bob's view after deposit is confirmed", trade, true); break; } } - if (!trade.getIsDepositConfirmed()) { - fail(format("INVALID_PHASE for Bob's trade %s in STATE=%s PHASE=%s, deposit tx was never confirmed.", + if (!trade.getIsDepositUnlocked()) { + fail(format("INVALID_PHASE for Bob's trade %s in STATE=%s PHASE=%s, deposit tx never unlocked.", trade.getShortId(), trade.getState(), trade.getPhase())); @@ -135,7 +134,7 @@ public class TakeSellBTCOfferTest extends AbstractTradeTest { var trade = bobClient.getTrade(tradeId); Predicate tradeStateAndPhaseCorrect = (t) -> - t.getState().equals(DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN.name()) && t.getPhase().equals(DEPOSIT_CONFIRMED.name()); + t.getState().equals(DEPOSIT_UNLOCKED_IN_BLOCK_CHAIN.name()) && t.getPhase().equals(DEPOSIT_UNLOCKED.name()); for (int i = 1; i <= maxTradeStateAndPhaseChecks.get(); i++) { if (!tradeStateAndPhaseCorrect.test(trade)) { log.warn("INVALID_PHASE for Bob's trade {} in STATE={} PHASE={}, cannot confirm payment started yet.", @@ -164,8 +163,8 @@ public class TakeSellBTCOfferTest extends AbstractTradeTest { for (int i = 1; i <= maxTradeStateAndPhaseChecks.get(); i++) { trade = bobClient.getTrade(tradeId); - if (!trade.getIsFiatSent()) { - log.warn("Bob still waiting for trade {} BUYER_SAW_ARRIVED_FIAT_PAYMENT_INITIATED_MSG, attempt # {}", + if (!trade.getIsPaymentSent()) { + log.warn("Bob still waiting for trade {} BUYER_SAW_ARRIVED_PAYMENT_INITIATED_MSG, attempt # {}", trade.getShortId(), i); sleep(5000); diff --git a/apitest/src/test/java/bisq/apitest/scenario/bot/BotClient.java b/apitest/src/test/java/bisq/apitest/scenario/bot/BotClient.java index c1b2e004..c5ad476c 100644 --- a/apitest/src/test/java/bisq/apitest/scenario/bot/BotClient.java +++ b/apitest/src/test/java/bisq/apitest/scenario/bot/BotClient.java @@ -225,12 +225,12 @@ public class BotClient { } /** - * Returns true if the trade's taker deposit fee transaction has been confirmed. + * Returns true if the trade's taker deposit fee transaction is unlocked. * @param tradeId a valid trade id * @return boolean */ - public boolean isTakerDepositFeeTxConfirmed(String tradeId) { - return grpcClient.getTrade(tradeId).getIsDepositConfirmed(); + public boolean isTakerDepositFeeTxUnlocked(String tradeId) { + return grpcClient.getTrade(tradeId).getIsDepositUnlocked(); } /** @@ -239,7 +239,7 @@ public class BotClient { * @return boolean */ public boolean isTradePaymentStartedSent(String tradeId) { - return grpcClient.getTrade(tradeId).getIsFiatSent(); + return grpcClient.getTrade(tradeId).getIsPaymentSent(); } /** @@ -248,7 +248,7 @@ public class BotClient { * @return boolean */ public boolean isTradePaymentReceivedConfirmationSent(String tradeId) { - return grpcClient.getTrade(tradeId).getIsFiatReceived(); + return grpcClient.getTrade(tradeId).getIsPaymentReceived(); } /** diff --git a/apitest/src/test/java/bisq/apitest/scenario/bot/protocol/BotProtocol.java b/apitest/src/test/java/bisq/apitest/scenario/bot/protocol/BotProtocol.java index 642ab8b8..9add6582 100644 --- a/apitest/src/test/java/bisq/apitest/scenario/bot/protocol/BotProtocol.java +++ b/apitest/src/test/java/bisq/apitest/scenario/bot/protocol/BotProtocol.java @@ -110,7 +110,7 @@ public abstract class BotProtocol { log.info("Starting protocol step {}. Bot will shutdown if step not completed within {} minutes.", currentProtocolStep.name(), MILLISECONDS.toMinutes(protocolStepTimeLimitInMs)); - if (currentProtocolStep.equals(WAIT_FOR_TAKER_DEPOSIT_TX_CONFIRMED)) { + if (currentProtocolStep.equals(WAIT_FOR_TAKER_DEPOSIT_TX_UNLOCKED)) { log.info("Generate a btc block to trigger taker's deposit fee tx confirmation."); createGenerateBtcBlockScript(); } @@ -132,7 +132,7 @@ public abstract class BotProtocol { checkIfShutdownCalled("Interrupted before checking if 'payment started' message has been sent."); try { var t = this.getBotClient().getTrade(trade.getTradeId()); - if (t.getIsFiatSent()) { + if (t.getIsPaymentSent()) { log.info("Buyer has started payment for trade:\n{}", TradeFormat.format(t)); return t; } @@ -166,7 +166,7 @@ public abstract class BotProtocol { checkIfShutdownCalled("Interrupted before checking if 'payment received confirmation' message has been sent."); try { var t = this.getBotClient().getTrade(trade.getTradeId()); - if (t.getIsFiatReceived()) { + if (t.getIsPaymentReceived()) { log.info("Seller has received payment for trade:\n{}", TradeFormat.format(t)); return t; } @@ -281,12 +281,12 @@ public abstract class BotProtocol { } private void waitForTakerFeeTxConfirmed(String tradeId) { - waitForTakerDepositFee(tradeId, WAIT_FOR_TAKER_DEPOSIT_TX_CONFIRMED); + waitForTakerDepositFee(tradeId, WAIT_FOR_TAKER_DEPOSIT_TX_UNLOCKED); } private void waitForTakerDepositFee(String tradeId, ProtocolStep depositTxProtocolStep) { initProtocolStep.accept(depositTxProtocolStep); - validateCurrentProtocolStep(WAIT_FOR_TAKER_DEPOSIT_TX_PUBLISHED, WAIT_FOR_TAKER_DEPOSIT_TX_CONFIRMED); + validateCurrentProtocolStep(WAIT_FOR_TAKER_DEPOSIT_TX_PUBLISHED, WAIT_FOR_TAKER_DEPOSIT_TX_UNLOCKED); try { log.info(waitingForDepositFeeTxMsg(tradeId)); while (isWithinProtocolStepTimeLimit()) { @@ -316,8 +316,8 @@ public abstract class BotProtocol { if (currentProtocolStep.equals(WAIT_FOR_TAKER_DEPOSIT_TX_PUBLISHED) && trade.getIsDepositPublished()) { log.info("Taker deposit fee tx {} has been published.", trade.getTakerDepositTxId()); return true; - } else if (currentProtocolStep.equals(WAIT_FOR_TAKER_DEPOSIT_TX_CONFIRMED) && trade.getIsDepositConfirmed()) { - log.info("Taker deposit fee tx {} has been confirmed.", trade.getTakerDepositTxId()); + } else if (currentProtocolStep.equals(WAIT_FOR_TAKER_DEPOSIT_TX_UNLOCKED) && trade.getIsDepositUnlocked()) { + log.info("Taker deposit fee tx {} is unlocked.", trade.getTakerDepositTxId()); return true; } else { return false; diff --git a/apitest/src/test/java/bisq/apitest/scenario/bot/protocol/ProtocolStep.java b/apitest/src/test/java/bisq/apitest/scenario/bot/protocol/ProtocolStep.java index def2a0bb..52d5235d 100644 --- a/apitest/src/test/java/bisq/apitest/scenario/bot/protocol/ProtocolStep.java +++ b/apitest/src/test/java/bisq/apitest/scenario/bot/protocol/ProtocolStep.java @@ -6,7 +6,7 @@ public enum ProtocolStep { TAKE_OFFER, WAIT_FOR_OFFER_TAKER, WAIT_FOR_TAKER_DEPOSIT_TX_PUBLISHED, - WAIT_FOR_TAKER_DEPOSIT_TX_CONFIRMED, + WAIT_FOR_TAKER_DEPOSIT_TX_UNLOCKED, SEND_PAYMENT_STARTED_MESSAGE, WAIT_FOR_PAYMENT_STARTED_MESSAGE, SEND_PAYMENT_RECEIVED_CONFIRMATION_MESSAGE, diff --git a/cli/src/main/java/bisq/cli/TradeFormat.java b/cli/src/main/java/bisq/cli/TradeFormat.java index ac0e8957..478f806b 100644 --- a/cli/src/main/java/bisq/cli/TradeFormat.java +++ b/cli/src/main/java/bisq/cli/TradeFormat.java @@ -120,10 +120,10 @@ public class TradeFormat { makerTakerMinerTxFeeFormat.apply(tradeInfo, isTaker), makerTakerFeeFormat.apply(tradeInfo, isTaker), tradeInfo.getIsDepositPublished() ? YES : NO, - tradeInfo.getIsDepositConfirmed() ? YES : NO, + tradeInfo.getIsDepositUnlocked() ? YES : NO, tradeCostFormat.apply(tradeInfo), - tradeInfo.getIsFiatSent() ? YES : NO, - tradeInfo.getIsFiatReceived() ? YES : NO, + tradeInfo.getIsPaymentSent() ? YES : NO, + tradeInfo.getIsPaymentReceived() ? YES : NO, tradeInfo.getIsPayoutPublished() ? YES : NO, tradeInfo.getIsWithdrawn() ? YES : NO); } diff --git a/core/src/main/java/bisq/core/api/CoreApi.java b/core/src/main/java/bisq/core/api/CoreApi.java index 7086f3a3..c98d309e 100644 --- a/core/src/main/java/bisq/core/api/CoreApi.java +++ b/core/src/main/java/bisq/core/api/CoreApi.java @@ -269,8 +269,8 @@ public class CoreApi { return walletsService.getBalances(currencyCode); } - public String getNewDepositSubaddress() { - return walletsService.getNewDepositSubaddress(); + public String getNewDepositAddress() { + return walletsService.getNewDepositAddress(); } public List getXmrTxs() { diff --git a/core/src/main/java/bisq/core/api/CoreWalletsService.java b/core/src/main/java/bisq/core/api/CoreWalletsService.java index 6394e7f7..d1f44c74 100644 --- a/core/src/main/java/bisq/core/api/CoreWalletsService.java +++ b/core/src/main/java/bisq/core/api/CoreWalletsService.java @@ -161,7 +161,7 @@ class CoreWalletsService { } } - String getNewDepositSubaddress() { + String getNewDepositAddress() { accountService.checkAccountOpen(); return xmrWalletService.getWallet().createSubaddress(0).getAddress(); } diff --git a/core/src/main/java/bisq/core/api/model/TradeInfo.java b/core/src/main/java/bisq/core/api/model/TradeInfo.java index 29107545..c8d2d1e7 100644 --- a/core/src/main/java/bisq/core/api/model/TradeInfo.java +++ b/core/src/main/java/bisq/core/api/model/TradeInfo.java @@ -56,9 +56,9 @@ public class TradeInfo implements Payload { private final String phase; private final String tradePeriodState; private final boolean isDepositPublished; - private final boolean isDepositConfirmed; - private final boolean isFiatSent; - private final boolean isFiatReceived; + private final boolean isDepositUnlocked; + private final boolean isPaymentSent; + private final boolean isPaymentReceived; private final boolean isPayoutPublished; private final boolean isWithdrawn; private final String contractAsJson; @@ -83,9 +83,9 @@ public class TradeInfo implements Payload { this.phase = builder.phase; this.tradePeriodState = builder.tradePeriodState; this.isDepositPublished = builder.isDepositPublished; - this.isDepositConfirmed = builder.isDepositConfirmed; - this.isFiatSent = builder.isFiatSent; - this.isFiatReceived = builder.isFiatReceived; + this.isDepositUnlocked = builder.isDepositConfirmed; + this.isPaymentSent = builder.isPaymentSent; + this.isPaymentReceived = builder.isPaymentReceived; this.isPayoutPublished = builder.isPayoutPublished; this.isWithdrawn = builder.isWithdrawn; this.contractAsJson = builder.contractAsJson; @@ -136,9 +136,9 @@ public class TradeInfo implements Payload { .withPhase(trade.getPhase().name()) .withTradePeriodState(trade.getTradePeriodState().name()) .withIsDepositPublished(trade.isDepositPublished()) - .withIsDepositConfirmed(trade.isDepositConfirmed()) - .withIsFiatSent(trade.isFiatSent()) - .withIsFiatReceived(trade.isFiatReceived()) + .withIsDepositUnlocked(trade.isDepositConfirmed()) + .withIsPaymentSent(trade.isPaymentSent()) + .withIsPaymentReceived(trade.isPaymentReceived()) .withIsPayoutPublished(trade.isPayoutPublished()) .withIsWithdrawn(trade.isWithdrawn()) .withContractAsJson(trade.getContractAsJson()) @@ -171,9 +171,9 @@ public class TradeInfo implements Payload { .setPhase(phase) .setTradePeriodState(tradePeriodState) .setIsDepositPublished(isDepositPublished) - .setIsDepositConfirmed(isDepositConfirmed) - .setIsFiatSent(isFiatSent) - .setIsFiatReceived(isFiatReceived) + .setIsDepositUnlocked(isDepositUnlocked) + .setIsPaymentSent(isPaymentSent) + .setIsPaymentReceived(isPaymentReceived) .setIsPayoutPublished(isPayoutPublished) .setIsWithdrawn(isWithdrawn) .setContractAsJson(contractAsJson == null ? "" : contractAsJson) @@ -201,9 +201,9 @@ public class TradeInfo implements Payload { .withPhase(proto.getPhase()) .withTradingPeerNodeAddress(proto.getTradingPeerNodeAddress()) .withIsDepositPublished(proto.getIsDepositPublished()) - .withIsDepositConfirmed(proto.getIsDepositConfirmed()) - .withIsFiatSent(proto.getIsFiatSent()) - .withIsFiatReceived(proto.getIsFiatReceived()) + .withIsDepositUnlocked(proto.getIsDepositUnlocked()) + .withIsPaymentSent(proto.getIsPaymentSent()) + .withIsPaymentReceived(proto.getIsPaymentReceived()) .withIsPayoutPublished(proto.getIsPayoutPublished()) .withIsWithdrawn(proto.getIsWithdrawn()) .withContractAsJson(proto.getContractAsJson()) @@ -237,8 +237,8 @@ public class TradeInfo implements Payload { private String tradePeriodState; private boolean isDepositPublished; private boolean isDepositConfirmed; - private boolean isFiatSent; - private boolean isFiatReceived; + private boolean isPaymentSent; + private boolean isPaymentReceived; private boolean isPayoutPublished; private boolean isWithdrawn; private String contractAsJson; @@ -334,18 +334,18 @@ public class TradeInfo implements Payload { return this; } - public TradeInfoBuilder withIsDepositConfirmed(boolean isDepositConfirmed) { + public TradeInfoBuilder withIsDepositUnlocked(boolean isDepositConfirmed) { this.isDepositConfirmed = isDepositConfirmed; return this; } - public TradeInfoBuilder withIsFiatSent(boolean isFiatSent) { - this.isFiatSent = isFiatSent; + public TradeInfoBuilder withIsPaymentSent(boolean isPaymentSent) { + this.isPaymentSent = isPaymentSent; return this; } - public TradeInfoBuilder withIsFiatReceived(boolean isFiatReceived) { - this.isFiatReceived = isFiatReceived; + public TradeInfoBuilder withIsPaymentReceived(boolean isPaymentReceived) { + this.isPaymentReceived = isPaymentReceived; return this; } @@ -394,9 +394,9 @@ public class TradeInfo implements Payload { ", phase='" + phase + '\'' + "\n" + ", tradePeriodState='" + tradePeriodState + '\'' + "\n" + ", isDepositPublished=" + isDepositPublished + "\n" + - ", isDepositConfirmed=" + isDepositConfirmed + "\n" + - ", isFiatSent=" + isFiatSent + "\n" + - ", isFiatReceived=" + isFiatReceived + "\n" + + ", isDepositConfirmed=" + isDepositUnlocked + "\n" + + ", isPaymentSent=" + isPaymentSent + "\n" + + ", isPaymentReceived=" + isPaymentReceived + "\n" + ", isPayoutPublished=" + isPayoutPublished + "\n" + ", isWithdrawn=" + isWithdrawn + "\n" + ", offer=" + offer + "\n" + diff --git a/core/src/main/java/bisq/core/notifications/alerts/TradeEvents.java b/core/src/main/java/bisq/core/notifications/alerts/TradeEvents.java index 377c62e6..0658bd37 100644 --- a/core/src/main/java/bisq/core/notifications/alerts/TradeEvents.java +++ b/core/src/main/java/bisq/core/notifications/alerts/TradeEvents.java @@ -72,7 +72,7 @@ public class TradeEvents { case TAKER_FEE_PUBLISHED: case DEPOSIT_PUBLISHED: break; - case DEPOSIT_CONFIRMED: + case DEPOSIT_UNLOCKED: if (trade.getContract() != null && pubKeyRingProvider.get().equals(trade.getContract().getBuyerPubKeyRing())) msg = Res.get("account.notifications.trade.message.msg.conf", shortId); break; diff --git a/core/src/main/java/bisq/core/trade/Trade.java b/core/src/main/java/bisq/core/trade/Trade.java index 772766e9..6312f028 100644 --- a/core/src/main/java/bisq/core/trade/Trade.java +++ b/core/src/main/java/bisq/core/trade/Trade.java @@ -150,7 +150,7 @@ public abstract class Trade implements Tradable, Model { // #################### Phase DEPOSIT_CONFIRMED - DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN(Phase.DEPOSIT_CONFIRMED), + DEPOSIT_UNLOCKED_IN_BLOCK_CHAIN(Phase.DEPOSIT_UNLOCKED), // #################### Phase PAYMENT_SENT @@ -217,7 +217,7 @@ public abstract class Trade implements Tradable, Model { INIT, TAKER_FEE_PUBLISHED, // TODO (woodser): remove unused phases DEPOSIT_PUBLISHED, - DEPOSIT_CONFIRMED, // TODO (woodser): rename to or add DEPOSIT_UNLOCKED + DEPOSIT_UNLOCKED, // TODO (woodser): rename to or add DEPOSIT_UNLOCKED PAYMENT_SENT, PAYMENT_RECEIVED, PAYOUT_PUBLISHED, @@ -1290,14 +1290,14 @@ public abstract class Trade implements Tradable, Model { } public boolean isDepositConfirmed() { - return getState().getPhase().ordinal() >= Phase.DEPOSIT_CONFIRMED.ordinal(); + return getState().getPhase().ordinal() >= Phase.DEPOSIT_UNLOCKED.ordinal(); } - public boolean isFiatSent() { + public boolean isPaymentSent() { return getState().getPhase().ordinal() >= Phase.PAYMENT_SENT.ordinal(); } - public boolean isFiatReceived() { + public boolean isPaymentReceived() { return getState().getPhase().ordinal() >= Phase.PAYMENT_RECEIVED.ordinal(); } @@ -1460,7 +1460,7 @@ public abstract class Trade implements Tradable, Model { // As setState is called here from the trade itself we cannot trigger a requestPersistence call. // But as we get setupConfidenceListener called at startup anyway there is no issue if it would not be // persisted in case the shutdown routine did not persist the trade. - setState(State.DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN); // TODO (woodser): for xmr this means deposit txs have unlocked after 10 confirmations + setState(State.DEPOSIT_UNLOCKED_IN_BLOCK_CHAIN); // TODO (woodser): for xmr this means deposit txs have unlocked after 10 confirmations } } diff --git a/core/src/main/java/bisq/core/trade/protocol/BuyerProtocol.java b/core/src/main/java/bisq/core/trade/protocol/BuyerProtocol.java index 25ff1e27..c5f4870c 100644 --- a/core/src/main/java/bisq/core/trade/protocol/BuyerProtocol.java +++ b/core/src/main/java/bisq/core/trade/protocol/BuyerProtocol.java @@ -129,10 +129,9 @@ public abstract class BuyerProtocol extends DisputeProtocol { public void onPaymentStarted(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) { System.out.println("BuyerProtocol.onPaymentStarted()"); synchronized (trade) { // TODO (woodser): UpdateMultisigWithTradingPeer sends UpdateMultisigRequest and waits for UpdateMultisigResponse which is new thread, so synchronized (trade) in subsequent pipeline blocks forever if we hold on with countdown latch in this function - System.out.println("BuyerProtocol.onPaymentStarted() has the lock!!!"); BuyerEvent event = BuyerEvent.PAYMENT_SENT; CountDownLatch latch = new CountDownLatch(1); - expect(phase(Trade.Phase.DEPOSIT_CONFIRMED) + expect(phase(Trade.Phase.DEPOSIT_UNLOCKED) .with(event) .preCondition(trade.confirmPermitted())) .setup(tasks(ApplyFilter.class, diff --git a/core/src/main/java/bisq/core/trade/protocol/DisputeProtocol.java b/core/src/main/java/bisq/core/trade/protocol/DisputeProtocol.java index f37435d4..eb542428 100644 --- a/core/src/main/java/bisq/core/trade/protocol/DisputeProtocol.java +++ b/core/src/main/java/bisq/core/trade/protocol/DisputeProtocol.java @@ -61,7 +61,7 @@ public abstract class DisputeProtocol extends TradeProtocol { // Trader has not yet received the peer's signature but has clicked the accept button. public void onAcceptMediationResult(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) { DisputeEvent event = DisputeEvent.MEDIATION_RESULT_ACCEPTED; - expect(anyPhase(Trade.Phase.DEPOSIT_CONFIRMED, + expect(anyPhase(Trade.Phase.DEPOSIT_UNLOCKED, Trade.Phase.PAYMENT_SENT, Trade.Phase.PAYMENT_RECEIVED) .with(event) @@ -88,7 +88,7 @@ public abstract class DisputeProtocol extends TradeProtocol { // Trader has already received the peer's signature and has clicked the accept button as well. public void onFinalizeMediationResultPayout(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) { DisputeEvent event = DisputeEvent.MEDIATION_RESULT_ACCEPTED; - expect(anyPhase(Trade.Phase.DEPOSIT_CONFIRMED, + expect(anyPhase(Trade.Phase.DEPOSIT_UNLOCKED, Trade.Phase.PAYMENT_SENT, Trade.Phase.PAYMENT_RECEIVED) .with(event) @@ -117,7 +117,7 @@ public abstract class DisputeProtocol extends TradeProtocol { /////////////////////////////////////////////////////////////////////////////////////////// protected void handle(MediatedPayoutTxSignatureMessage message, NodeAddress peer) { - expect(anyPhase(Trade.Phase.DEPOSIT_CONFIRMED, + expect(anyPhase(Trade.Phase.DEPOSIT_UNLOCKED, Trade.Phase.PAYMENT_SENT, Trade.Phase.PAYMENT_RECEIVED) .with(message) @@ -127,7 +127,7 @@ public abstract class DisputeProtocol extends TradeProtocol { } protected void handle(MediatedPayoutTxPublishedMessage message, NodeAddress peer) { - expect(anyPhase(Trade.Phase.DEPOSIT_CONFIRMED, + expect(anyPhase(Trade.Phase.DEPOSIT_UNLOCKED, Trade.Phase.PAYMENT_SENT, Trade.Phase.PAYMENT_RECEIVED) .with(message) @@ -167,7 +167,7 @@ public abstract class DisputeProtocol extends TradeProtocol { /////////////////////////////////////////////////////////////////////////////////////////// private void handle(PeerPublishedDelayedPayoutTxMessage message, NodeAddress peer) { - expect(anyPhase(Trade.Phase.DEPOSIT_CONFIRMED, + expect(anyPhase(Trade.Phase.DEPOSIT_UNLOCKED, Trade.Phase.PAYMENT_SENT, Trade.Phase.PAYMENT_RECEIVED) .with(message) diff --git a/core/src/main/java/bisq/core/trade/protocol/SellerProtocol.java b/core/src/main/java/bisq/core/trade/protocol/SellerProtocol.java index aee60f67..18fd88c4 100644 --- a/core/src/main/java/bisq/core/trade/protocol/SellerProtocol.java +++ b/core/src/main/java/bisq/core/trade/protocol/SellerProtocol.java @@ -85,7 +85,7 @@ public abstract class SellerProtocol extends DisputeProtocol { // the mailbox msg once wallet is ready and trade state set. synchronized (trade) { //CountDownLatch latch = new CountDownLatch(1); // TODO: apply latch countdown - expect(anyPhase(Trade.Phase.DEPOSIT_CONFIRMED, Trade.Phase.DEPOSIT_PUBLISHED) + expect(anyPhase(Trade.Phase.DEPOSIT_UNLOCKED, Trade.Phase.DEPOSIT_PUBLISHED) .with(message) .from(peer) .preCondition(trade.getPayoutTx() == null, diff --git a/core/src/main/java/bisq/core/trade/protocol/tasks/buyer/BuyerSendsPaymentSentMessage.java b/core/src/main/java/bisq/core/trade/protocol/tasks/buyer/BuyerSendsPaymentSentMessage.java index 9a3d8f71..d9612120 100644 --- a/core/src/main/java/bisq/core/trade/protocol/tasks/buyer/BuyerSendsPaymentSentMessage.java +++ b/core/src/main/java/bisq/core/trade/protocol/tasks/buyer/BuyerSendsPaymentSentMessage.java @@ -192,7 +192,7 @@ public class BuyerSendsPaymentSentMessage extends SendMailboxMessageTask { private void onMessageStateChange(MessageState newValue) { // Once we receive an ACK from our msg we know the peer has received the msg and we stop. if (newValue == MessageState.ACKNOWLEDGED) { - // We treat a ACK like BUYER_SAW_ARRIVED_FIAT_PAYMENT_INITIATED_MSG + // We treat a ACK like BUYER_SAW_ARRIVED_PAYMENT_INITIATED_MSG trade.setStateIfValidTransitionTo(Trade.State.BUYER_SAW_ARRIVED_PAYMENT_INITIATED_MSG); processModel.getTradeManager().requestPersistence(); diff --git a/core/src/main/java/bisq/core/trade/txproof/xmr/XmrTxProofService.java b/core/src/main/java/bisq/core/trade/txproof/xmr/XmrTxProofService.java index 82445756..454bbff2 100644 --- a/core/src/main/java/bisq/core/trade/txproof/xmr/XmrTxProofService.java +++ b/core/src/main/java/bisq/core/trade/txproof/xmr/XmrTxProofService.java @@ -197,7 +197,7 @@ public class XmrTxProofService implements AssetTxProofService { .filter(trade -> trade instanceof SellerTrade) .map(trade -> (SellerTrade) trade) .filter(this::isXmrTrade) - .filter(trade -> !trade.isFiatReceived()) // Phase name is from the time when it was fiat only. Means counter currency (XMR) received. + .filter(trade -> !trade.isPaymentReceived()) // Phase name is from the time when it was fiat only. Means counter currency (XMR) received. .forEach(this::processTradeOrAddListener); } @@ -207,7 +207,7 @@ public class XmrTxProofService implements AssetTxProofService { if (isExpectedTradeState(trade.getState())) { startRequestsIfValid(trade); } else { - // We are expecting SELLER_RECEIVED_FIAT_PAYMENT_INITIATED_MSG in the future, so listen on changes + // We are expecting SELLER_RECEIVED_PAYMENT_INITIATED_MSG in the future, so listen on changes ChangeListener tradeStateListener = (observable, oldValue, newValue) -> { if (isExpectedTradeState(newValue)) { ChangeListener listener = tradeStateListenerMap.remove(trade.getId()); diff --git a/daemon/src/main/java/bisq/daemon/grpc/GrpcWalletsService.java b/daemon/src/main/java/bisq/daemon/grpc/GrpcWalletsService.java index 74d81218..ea8e43e4 100644 --- a/daemon/src/main/java/bisq/daemon/grpc/GrpcWalletsService.java +++ b/daemon/src/main/java/bisq/daemon/grpc/GrpcWalletsService.java @@ -28,8 +28,8 @@ import bisq.proto.grpc.GetBalancesReply; import bisq.proto.grpc.GetBalancesRequest; import bisq.proto.grpc.GetFundingAddressesReply; import bisq.proto.grpc.GetFundingAddressesRequest; -import bisq.proto.grpc.GetNewDepositSubaddressRequest; -import bisq.proto.grpc.GetNewDepositSubaddressReply; +import bisq.proto.grpc.GetNewDepositAddressRequest; +import bisq.proto.grpc.GetNewDepositAddressReply; import bisq.proto.grpc.GetXmrTxsRequest; import bisq.proto.grpc.GetXmrTxsReply; import bisq.proto.grpc.CreateXmrTxRequest; @@ -118,11 +118,11 @@ class GrpcWalletsService extends WalletsImplBase { } @Override - public void getNewDepositSubaddress(GetNewDepositSubaddressRequest req, - StreamObserver responseObserver) { + public void getNewDepositAddress(GetNewDepositAddressRequest req, + StreamObserver responseObserver) { try { - String subaddress = coreApi.getNewDepositSubaddress(); - var reply = GetNewDepositSubaddressReply.newBuilder() + String subaddress = coreApi.getNewDepositAddress(); + var reply = GetNewDepositAddressReply.newBuilder() .setSubaddress(subaddress) .build(); responseObserver.onNext(reply); diff --git a/desktop/src/main/java/bisq/desktop/main/overlays/notifications/NotificationCenter.java b/desktop/src/main/java/bisq/desktop/main/overlays/notifications/NotificationCenter.java index d90214f1..a19f3482 100644 --- a/desktop/src/main/java/bisq/desktop/main/overlays/notifications/NotificationCenter.java +++ b/desktop/src/main/java/bisq/desktop/main/overlays/notifications/NotificationCenter.java @@ -192,7 +192,7 @@ public class NotificationCenter { message = Res.get("notification.trade.accepted", role); } - if (trade instanceof BuyerTrade && phase.ordinal() == Trade.Phase.DEPOSIT_CONFIRMED.ordinal()) + if (trade instanceof BuyerTrade && phase.ordinal() == Trade.Phase.DEPOSIT_UNLOCKED.ordinal()) message = Res.get("notification.trade.confirmed"); else if (trade instanceof SellerTrade && phase.ordinal() == Trade.Phase.PAYMENT_SENT.ordinal()) message = Res.get("notification.trade.paymentStarted"); diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesViewModel.java b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesViewModel.java index a773eec2..e04ec827 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesViewModel.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesViewModel.java @@ -445,29 +445,29 @@ public class PendingTradesViewModel extends ActivatableWithDataModel