mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-01 19:26:09 -04:00
renames in proto and api (#277)
rename to getNewDepositAddress() rename trade phase DEPOSIT_CONFIRMED to DEPOSIT_UNLOCKED rename fiat sent/received to payment sent/received
This commit is contained in:
parent
f1b3ff6f08
commit
730bee3e71
26 changed files with 127 additions and 133 deletions
|
@ -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<MoneroTxWallet> getXmrTxs() {
|
||||
|
|
|
@ -161,7 +161,7 @@ class CoreWalletsService {
|
|||
}
|
||||
}
|
||||
|
||||
String getNewDepositSubaddress() {
|
||||
String getNewDepositAddress() {
|
||||
accountService.checkAccountOpen();
|
||||
return xmrWalletService.getWallet().createSubaddress(0).getAddress();
|
||||
}
|
||||
|
|
|
@ -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" +
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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<Trade.State> tradeStateListener = (observable, oldValue, newValue) -> {
|
||||
if (isExpectedTradeState(newValue)) {
|
||||
ChangeListener<Trade.State> listener = tradeStateListenerMap.remove(trade.getId());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue