Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Atomic bsq trades #5729

Closed
wants to merge 160 commits into from
Closed
Show file tree
Hide file tree
Changes from 71 commits
Commits
Show all changes
160 commits
Select commit Hold shift + click to select a range
4a99d79
Refactor direct offerPayload access
sqrrm Feb 20, 2021
170bc8a
Refactor direct offerPayload access
sqrrm Feb 20, 2021
c46906f
Add OfferPayloadI
sqrrm Feb 20, 2021
d78ed1b
Add AtomicOfferPayload
sqrrm Feb 21, 2021
100c13c
Refactor: move OfferPayload Direction protobuf methods
sqrrm Feb 22, 2021
3762962
Add atomic account type
sqrrm Aug 17, 2020
ff0c6c6
Add UI for creating atomic offers
sqrrm Jan 27, 2021
7672576
Add UI for taking atomic offers
sqrrm Mar 1, 2021
ea5bf55
Refactor: TradeManager handle Tradable
sqrrm Mar 23, 2021
72eb38d
Refactor: add class tradeModel
sqrrm Mar 29, 2021
c108841
Introduce interface ProcessModelI
sqrrm Apr 1, 2021
06352d9
Compiling old atomic trade protocol
sqrrm Apr 9, 2021
74aee8d
Refactor: TradeManager use TradeModel
sqrrm Apr 9, 2021
7dc50d2
Refactor: extract applyFilter method
sqrrm Apr 11, 2021
34e8f1d
Add AtomicApplyFilter
sqrrm Apr 11, 2021
a0e79c0
TradeTaskRunner handle AtomicTrade
sqrrm Apr 13, 2021
e57763a
Refactor: move AtomicApplyFilter
sqrrm Apr 13, 2021
7ac28dd
Take atomic offer
sqrrm Apr 13, 2021
aa22b54
Refactor: rename txFee -> txFeePerVbyte
sqrrm Apr 15, 2021
9a1d1df
Add atomic trade protocol
sqrrm Apr 28, 2021
ee18eb9
Set maker fee type in offer
sqrrm Apr 29, 2021
5da71fb
Display Atomic Trade info in transaction lists
sqrrm Apr 30, 2021
7e7327a
Refactor: extract AtomicTakeOfferModel to core
sqrrm May 3, 2021
924236a
Add ProofOfWorkPayload interface
sqrrm May 3, 2021
644aee8
Add ProofOfWorkPayload filter
sqrrm May 5, 2021
823cc64
Remove Arbitrator/Mediator requirement for atomic trades
sqrrm May 6, 2021
dce5b4c
Add atomic offer/trade grpc proto defs
ghubstan May 7, 2021
cda293f
Add grpc boilerplate for atomic offer/trade support
ghubstan May 7, 2021
6ea8b88
Add atomic offer/trade proto wrappers
ghubstan May 7, 2021
0322830
Add Optional<AtomicTrade> getAtomicTradeById(String tradeId)
ghubstan May 7, 2021
bcdcc15
Add @Getter annotation to private AtomicTxBuilder atomicTxBuilder
ghubstan May 7, 2021
4b3adfc
Add boolean isAtomicOffer() convenience
ghubstan May 7, 2021
b751f53
Implement core api's atomic offer/trade support
ghubstan May 7, 2021
83e8fd6
Support atomic payment method
ghubstan May 7, 2021
9e4c0fb
Add atomic offer/trade tests
ghubstan May 7, 2021
068a845
Use segwit validator for BSQ output address
sqrrm Jun 5, 2021
b5cee9b
Extract fee handling from AtomicTxBuilder
sqrrm Jun 5, 2021
e239425
Core: remove BTC trade fee option for atomic trades
sqrrm Jun 10, 2021
bec88fd
Desktop: remove trade fee option from UI
sqrrm Jun 10, 2021
a534b4a
Refactor: OpenOfferManager centralize add/remove
sqrrm Jun 13, 2021
7fa31d9
Atomic funding
sqrrm Sep 22, 2021
5b8dbac
AtomicOfferPayload: add hash
sqrrm Sep 27, 2021
02f980f
bitcoinj: update to better multi wallet handling
sqrrm Sep 27, 2021
ca61054
Rename OfferPayloadI to OfferPayloadBase
chimp1984 Sep 29, 2021
834d0c8
Fix var names ans strings using offerPayloadI
chimp1984 Sep 29, 2021
65aa2e7
Add BSQ_SWAP_OFFER capability
chimp1984 Sep 29, 2021
76cb61d
Rename noCapabilityRequiredOrCapabilityIsSupported to testCapability
chimp1984 Sep 29, 2021
df88ef7
Merge remote-tracking branch 'origin/master' into atomic-bsq-trades
sqrrm Sep 29, 2021
6993996
Remove handling for bundledEnvelopes in send method
chimp1984 Sep 29, 2021
c447d14
Rename AtomicOfferPayload to BsqSwapOfferPayload
chimp1984 Sep 29, 2021
5c8f46c
Add extraDataMap to BsqSwapOfferPayload
chimp1984 Sep 29, 2021
13b849f
Rename AtomicAccountPayload to BsqSwapAccountPayload
chimp1984 Sep 29, 2021
77b6508
Rename AtomicAccount to BsqSwapAccount
chimp1984 Sep 29, 2021
c89e005
Rename PaymentMethod.ATOMIC to PaymentMethod.BSQ_SWAP
chimp1984 Sep 29, 2021
13bdf2d
Rename ProcessModelI to TradeProtocolModel
chimp1984 Sep 29, 2021
a717cfc
Rename AtomicProcessModel to BsqSwapProtocolModel
chimp1984 Sep 29, 2021
1f0f616
Rename AtomicProcessModel to BsqSwapProtocolModel in protobuf
chimp1984 Sep 29, 2021
f022d70
Remove unused params
chimp1984 Sep 29, 2021
8e6a428
Rename AtomicTrade to BsqSwapTrade
chimp1984 Sep 29, 2021
914aaec
Rename AtomicTrade to BsqSwapTrade in protobuf
chimp1984 Sep 29, 2021
2d92651
Rename AtomicTradeManager to BsqSwapTradeManager
chimp1984 Sep 29, 2021
f9bbb61
Move bisq.core.trade.atomic.AtomicTxBuilder to bisq.core.btc.AtomicTx…
chimp1984 Sep 29, 2021
46b1a0f
Rename AtomicTxBuilder to BsqSwapTxHelper
chimp1984 Sep 29, 2021
b683664
Rename AtomicMakerProtocol to BsqSwapMakerProtocol
chimp1984 Sep 29, 2021
d856544
Move bisq.core.trade.protocol.BsqSwapProtocolModel to bisq.core.trade…
chimp1984 Sep 29, 2021
2388bd4
Move trade model classes to bisq.core.trade.model package
chimp1984 Sep 29, 2021
d94e633
Move protocol classes to bisq.core.trade.protocol package
chimp1984 Sep 29, 2021
39866b0
Move common classes level up
chimp1984 Sep 29, 2021
c081281
Rename ProcessModelServiceProvider to Provider
chimp1984 Sep 29, 2021
20effc7
Move common classes to misc package
chimp1984 Sep 29, 2021
e711378
Move bisq.core.trade.protocol.messages to bisq.core.trade.messages
chimp1984 Sep 29, 2021
75b1c7c
Move TradeManager, MakerTrade, TakerTrade one level up
chimp1984 Sep 29, 2021
5f65f41
Update protocol and protocol model classes
chimp1984 Sep 29, 2021
50b78b1
Remove Atomic prefixes for tasks
chimp1984 Sep 29, 2021
ceacbb7
Rename CreateAtomicTxRequest and CreateAtomicTxResponse
chimp1984 Sep 29, 2021
3b8d947
Rename methods, fields with atomic prefix
chimp1984 Sep 29, 2021
4100af0
Rename views
chimp1984 Sep 29, 2021
52a022c
Rename AtomicOfferFunding
chimp1984 Sep 29, 2021
40e4582
Refactor placeoffer packages
chimp1984 Sep 29, 2021
19b0524
Replace TransactionResultHandler with Runnable
chimp1984 Sep 29, 2021
7853f26
Replace ocurrances of atomic with bsqSwap
chimp1984 Sep 29, 2021
fea0018
Use OfferPayloadBase instead of ProtectedStoragePayload as type
chimp1984 Sep 29, 2021
a4059b4
Remove redundant OfferPayload.Direction
chimp1984 Sep 29, 2021
b390743
Move AvailabilityResult to bisq.core.offer.availability
chimp1984 Sep 29, 2021
163bcce
Small refactorings, cleanups
chimp1984 Sep 30, 2021
cb81c6f
Refactor BsqSwapWalletWatcher and OpenOfferManager
chimp1984 Sep 30, 2021
088b85b
Add counter to fee service check
chimp1984 Oct 1, 2021
7c74073
Fix copy paste error
chimp1984 Oct 1, 2021
c4e129b
Merge pull request #9 from chimp1984/Bsq-swap-3
sqrrm Oct 2, 2021
7872dbc
Add common interface for tradePeer.
chimp1984 Oct 2, 2021
0354017
Remove payment method handling
chimp1984 Oct 2, 2021
f9d384c
Add generics for TradePeer
chimp1984 Oct 2, 2021
3cc549b
Rename getTradingPeer to getTradePeer
chimp1984 Oct 2, 2021
78ddc2d
Replace TradingPeer BsqSwapTradePeer in BsqSwapProtocolModel
chimp1984 Oct 2, 2021
503a065
Add the 4 variants to trade and protocols
chimp1984 Oct 2, 2021
739811c
Trade protocol update according to other trade protocol
chimp1984 Oct 4, 2021
7022505
Use tx confidence listener in SellerSetupTxListener
chimp1984 Oct 5, 2021
d77127d
Cleanups
chimp1984 Oct 5, 2021
76982ff
Rename bsqSwapProtocolModel to protocolModel
chimp1984 Oct 5, 2021
cadef15
Rename bsqSwapTrade to trade
chimp1984 Oct 5, 2021
82d05dd
Rename TradeProtocolModel to ProtocolModel
chimp1984 Oct 5, 2021
8167d6d
Rename bsqSwapTrade to trade
chimp1984 Oct 5, 2021
063dc93
Move package bisq.core.trade.messages to bisq.core.trade.protocol.mes…
chimp1984 Oct 5, 2021
b432110
Move ClosedTradableManager and FailedTradesManager inside bisq.core.t…
chimp1984 Oct 5, 2021
011c929
Remove references from multisigbased trade domain from generic trade …
chimp1984 Oct 5, 2021
7a5ba91
Use concrete state/phase in impl classes
chimp1984 Oct 5, 2021
8a2fdb0
Move contract into trade package
chimp1984 Oct 5, 2021
853848d
Use Trade as type in tradableList
chimp1984 Oct 5, 2021
1819356
Remove offer only once trade is completed (tx visisble if maker is se…
chimp1984 Oct 5, 2021
0f8d1c9
Rename classes
chimp1984 Oct 5, 2021
030cff8
Rename trade package to bisq_v1
chimp1984 Oct 5, 2021
1f5f844
Move TradeProtocolFactory level up
chimp1984 Oct 5, 2021
6a3c3a1
Rename bsqswap package to bsq_swap
chimp1984 Oct 5, 2021
9a36329
Start work on BsqTradeDetailsWindow
chimp1984 Oct 5, 2021
b45211e
Add comment to make fee allocation in tx more clear
chimp1984 Oct 8, 2021
07cdf70
Rename BsqSwapWalletWatcher to BsqSwapOfferManager
chimp1984 Oct 8, 2021
5b51fd7
Add methods to DaoFacade and DaoStateService
chimp1984 Oct 8, 2021
63f2d25
Add fee listener
chimp1984 Oct 8, 2021
499302b
Use Singleton annotation
chimp1984 Oct 8, 2021
6700ca6
Let BsqSwapAccountPayload extend PaymentAccountPayload
chimp1984 Oct 8, 2021
aa83e5b
Add comment
chimp1984 Oct 8, 2021
fa0853a
Increase fee tolerance.
chimp1984 Oct 8, 2021
4da55ea
Rename getTradeVolume to getVolume
chimp1984 Oct 8, 2021
303b536
Add getBsqTradeAmount to BsqSwapCalculation
chimp1984 Oct 8, 2021
3e8357a
Check for witness before setting it
chimp1984 Oct 8, 2021
45b9921
Remove unnecessary check, add comment
chimp1984 Oct 8, 2021
827d603
Add todo
chimp1984 Oct 8, 2021
a2fcaa0
Add comment
chimp1984 Oct 8, 2021
725b8eb
Refactor tx creation and verification
chimp1984 Oct 8, 2021
9242ab9
Add handling for trade complete in case we have not got it set already
chimp1984 Oct 8, 2021
3592625
Extract super class for sending messages
chimp1984 Oct 8, 2021
bb64320
Cleanups
chimp1984 Oct 8, 2021
e44a431
Complete trade in case the tx broadcast got a timeout
chimp1984 Oct 9, 2021
fd56eef
Remove unused methods
chimp1984 Oct 9, 2021
9e109ce
Add scriptTypeId to RawTransactionInput
chimp1984 Oct 9, 2021
8dc34c0
Replace constructor call with fromProto
chimp1984 Oct 9, 2021
efc5d0b
Remove unused methods
chimp1984 Oct 9, 2021
095d780
Use RawTransactionInput constructor instead of getRawInputFromTransac…
chimp1984 Oct 9, 2021
4e70e5b
Move getRawInputFromTransactionInput to TradeWalletService
chimp1984 Oct 9, 2021
73b897a
Fix wrong exception, add more log details
chimp1984 Oct 9, 2021
8e308e6
Rename getTxSize to getVBytesSize
chimp1984 Oct 9, 2021
138fa2a
Fix check for segwit.
chimp1984 Oct 9, 2021
b4c1b4e
Add handling for InsufficientMoneyException
chimp1984 Oct 9, 2021
9858c26
Add verification for peers change amount
chimp1984 Oct 9, 2021
2e80f18
Add verification for peers change
chimp1984 Oct 9, 2021
0550fda
Store sellersBsqPayoutAmount in protocolModel.setPayout
chimp1984 Oct 9, 2021
b53c544
Fix checks for change with trade fees and tx fees
chimp1984 Oct 9, 2021
a266db8
Comment out balance check (temp for dev)
chimp1984 Oct 9, 2021
aec5608
Do not handle dust here. We will handle it in caller
chimp1984 Oct 9, 2021
0e54439
Fix handling for slightly overpaid BTC funds
chimp1984 Oct 9, 2021
f5e19c0
Add address validation
chimp1984 Oct 10, 2021
6b799f9
Add check for change <= expectedChange
chimp1984 Oct 10, 2021
13adb3a
Update protocol description
chimp1984 Oct 10, 2021
0a09bc0
Rename methods and params
chimp1984 Oct 10, 2021
5981863
Add getParentTxId method
chimp1984 Oct 10, 2021
4c13087
Use getParentTxId method
chimp1984 Oct 10, 2021
7c1c93e
Use isDust
chimp1984 Oct 10, 2021
f0fc08f
Add getUnspentTxOutputValue method
chimp1984 Oct 10, 2021
30d025a
Handle dust in caller
chimp1984 Oct 10, 2021
9c7bdf3
Merge pull request #16 from chimp1984/Complete-trade-protocol
sqrrm Oct 10, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
@@ -1,6 +1,6 @@
package bisq.apitest.method.trade;

import bisq.core.trade.model.trade.Trade;
import bisq.core.trade.model.bisq_v1.Trade;

/**
* A test fixture encapsulating expected trade protocol status.
Expand Down
Expand Up @@ -37,13 +37,13 @@
import static bisq.cli.TableFormat.formatBalancesTbls;
import static bisq.cli.TableFormat.formatOfferTable;
import static bisq.core.btc.wallet.Restrictions.getDefaultBuyerSecurityDepositAsPercent;
import static bisq.core.trade.model.trade.Trade.Phase.DEPOSIT_CONFIRMED;
import static bisq.core.trade.model.trade.Trade.Phase.FIAT_SENT;
import static bisq.core.trade.model.trade.Trade.Phase.PAYOUT_PUBLISHED;
import static bisq.core.trade.model.trade.Trade.State.BUYER_RECEIVED_PAYOUT_TX_PUBLISHED_MSG;
import static bisq.core.trade.model.trade.Trade.State.DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN;
import static bisq.core.trade.model.trade.Trade.State.SELLER_RECEIVED_FIAT_PAYMENT_INITIATED_MSG;
import static bisq.core.trade.model.trade.Trade.State.SELLER_SAW_ARRIVED_PAYOUT_TX_PUBLISHED_MSG;
import static bisq.core.trade.model.bisq_v1.Trade.Phase.DEPOSIT_CONFIRMED;
import static bisq.core.trade.model.bisq_v1.Trade.Phase.FIAT_SENT;
import static bisq.core.trade.model.bisq_v1.Trade.Phase.PAYOUT_PUBLISHED;
import static bisq.core.trade.model.bisq_v1.Trade.State.BUYER_RECEIVED_PAYOUT_TX_PUBLISHED_MSG;
import static bisq.core.trade.model.bisq_v1.Trade.State.DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN;
import static bisq.core.trade.model.bisq_v1.Trade.State.SELLER_RECEIVED_FIAT_PAYMENT_INITIATED_MSG;
import static bisq.core.trade.model.bisq_v1.Trade.State.SELLER_SAW_ARRIVED_PAYOUT_TX_PUBLISHED_MSG;
import static java.lang.String.format;
import static java.util.Collections.singletonList;
import static org.junit.jupiter.api.Assertions.assertEquals;
Expand Down
Expand Up @@ -37,10 +37,10 @@
import static bisq.apitest.config.ApiTestConfig.BSQ;
import static bisq.cli.TableFormat.formatBalancesTbls;
import static bisq.core.btc.wallet.Restrictions.getDefaultBuyerSecurityDepositAsPercent;
import static bisq.core.trade.model.trade.Trade.Phase.DEPOSIT_CONFIRMED;
import static bisq.core.trade.model.trade.Trade.Phase.FIAT_SENT;
import static bisq.core.trade.model.trade.Trade.Phase.PAYOUT_PUBLISHED;
import static bisq.core.trade.model.trade.Trade.State.*;
import static bisq.core.trade.model.bisq_v1.Trade.Phase.DEPOSIT_CONFIRMED;
import static bisq.core.trade.model.bisq_v1.Trade.Phase.FIAT_SENT;
import static bisq.core.trade.model.bisq_v1.Trade.Phase.PAYOUT_PUBLISHED;
import static bisq.core.trade.model.bisq_v1.Trade.State.*;
import static java.lang.String.format;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
Expand Down
Expand Up @@ -55,10 +55,10 @@
import static bisq.apitest.config.ApiTestConfig.BSQ;
import static bisq.cli.TableFormat.formatBalancesTbls;
import static bisq.core.btc.wallet.Restrictions.getDefaultBuyerSecurityDepositAsPercent;
import static bisq.core.trade.model.trade.Trade.Phase.DEPOSIT_CONFIRMED;
import static bisq.core.trade.model.trade.Trade.Phase.FIAT_SENT;
import static bisq.core.trade.model.trade.Trade.Phase.PAYOUT_PUBLISHED;
import static bisq.core.trade.model.trade.Trade.State.*;
import static bisq.core.trade.model.bisq_v1.Trade.Phase.DEPOSIT_CONFIRMED;
import static bisq.core.trade.model.bisq_v1.Trade.Phase.FIAT_SENT;
import static bisq.core.trade.model.bisq_v1.Trade.Phase.PAYOUT_PUBLISHED;
import static bisq.core.trade.model.bisq_v1.Trade.State.*;
import static java.lang.String.format;
import static org.junit.jupiter.api.Assertions.*;
import static protobuf.Offer.State.OFFER_FEE_PAID;
Expand Down
Expand Up @@ -38,14 +38,14 @@
import static bisq.cli.TableFormat.formatBalancesTbls;
import static bisq.cli.TableFormat.formatOfferTable;
import static bisq.core.btc.wallet.Restrictions.getDefaultBuyerSecurityDepositAsPercent;
import static bisq.core.trade.model.trade.Trade.Phase.DEPOSIT_CONFIRMED;
import static bisq.core.trade.model.trade.Trade.Phase.FIAT_SENT;
import static bisq.core.trade.model.trade.Trade.Phase.PAYOUT_PUBLISHED;
import static bisq.core.trade.model.trade.Trade.Phase.WITHDRAWN;
import static bisq.core.trade.model.trade.Trade.State.DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN;
import static bisq.core.trade.model.trade.Trade.State.SELLER_RECEIVED_FIAT_PAYMENT_INITIATED_MSG;
import static bisq.core.trade.model.trade.Trade.State.SELLER_SAW_ARRIVED_PAYOUT_TX_PUBLISHED_MSG;
import static bisq.core.trade.model.trade.Trade.State.WITHDRAW_COMPLETED;
import static bisq.core.trade.model.bisq_v1.Trade.Phase.DEPOSIT_CONFIRMED;
import static bisq.core.trade.model.bisq_v1.Trade.Phase.FIAT_SENT;
import static bisq.core.trade.model.bisq_v1.Trade.Phase.PAYOUT_PUBLISHED;
import static bisq.core.trade.model.bisq_v1.Trade.Phase.WITHDRAWN;
import static bisq.core.trade.model.bisq_v1.Trade.State.DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN;
import static bisq.core.trade.model.bisq_v1.Trade.State.SELLER_RECEIVED_FIAT_PAYMENT_INITIATED_MSG;
import static bisq.core.trade.model.bisq_v1.Trade.State.SELLER_SAW_ARRIVED_PAYOUT_TX_PUBLISHED_MSG;
import static bisq.core.trade.model.bisq_v1.Trade.State.WITHDRAW_COMPLETED;
import static java.lang.String.format;
import static java.util.Collections.singletonList;
import static org.junit.jupiter.api.Assertions.assertEquals;
Expand Down
Expand Up @@ -37,11 +37,11 @@
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.model.trade.Trade.Phase.DEPOSIT_CONFIRMED;
import static bisq.core.trade.model.trade.Trade.Phase.FIAT_SENT;
import static bisq.core.trade.model.trade.Trade.Phase.PAYOUT_PUBLISHED;
import static bisq.core.trade.model.trade.Trade.Phase.WITHDRAWN;
import static bisq.core.trade.model.trade.Trade.State.*;
import static bisq.core.trade.model.bisq_v1.Trade.Phase.DEPOSIT_CONFIRMED;
import static bisq.core.trade.model.bisq_v1.Trade.Phase.FIAT_SENT;
import static bisq.core.trade.model.bisq_v1.Trade.Phase.PAYOUT_PUBLISHED;
import static bisq.core.trade.model.bisq_v1.Trade.Phase.WITHDRAWN;
import static bisq.core.trade.model.bisq_v1.Trade.State.*;
import static java.lang.String.format;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
Expand Down
Expand Up @@ -33,9 +33,9 @@
import bisq.core.support.dispute.Dispute;
import bisq.core.support.dispute.DisputeResult;
import bisq.core.support.dispute.arbitration.TraderDataItem;
import bisq.core.trade.model.Contract;
import bisq.core.trade.model.trade.Trade;
import bisq.core.trade.protocol.TradingPeer;
import bisq.core.trade.model.bisq_v1.Contract;
import bisq.core.trade.model.bisq_v1.Trade;
import bisq.core.trade.protocol.bisq_v1.TradingPeer;
import bisq.core.user.User;

import bisq.network.p2p.BootstrapListener;
Expand Down Expand Up @@ -308,7 +308,7 @@ public Optional<AccountAgeWitness> findWitness(Offer offer) {
}

private Optional<AccountAgeWitness> findTradePeerWitness(Trade trade) {
TradingPeer tradingPeer = trade.getProcessModel().getTradingPeer();
TradingPeer tradingPeer = trade.getProcessModel().getTradePeer();
return (tradingPeer == null ||
tradingPeer.getPaymentAccountPayload() == null ||
tradingPeer.getPubKeyRing() == null) ?
Expand Down Expand Up @@ -731,8 +731,8 @@ public void arbitratorSignAccountAgeWitness(AccountAgeWitness accountAgeWitness,
public Optional<SignedWitness> traderSignAndPublishPeersAccountAgeWitness(Trade trade) {
AccountAgeWitness peersWitness = findTradePeerWitness(trade).orElse(null);
Coin tradeAmount = trade.getTradeAmount();
checkNotNull(trade.getProcessModel().getTradingPeer().getPubKeyRing(), "Peer must have a keyring");
PublicKey peersPubKey = trade.getProcessModel().getTradingPeer().getPubKeyRing().getSignaturePubKey();
checkNotNull(trade.getProcessModel().getTradePeer().getPubKeyRing(), "Peer must have a keyring");
PublicKey peersPubKey = trade.getProcessModel().getTradePeer().getPubKeyRing().getSignaturePubKey();
checkNotNull(peersWitness, "Not able to find peers witness, unable to sign for trade {}",
trade.toString());
checkNotNull(tradeAmount, "Trade amount must not be null");
Expand Down
Expand Up @@ -20,7 +20,7 @@
import bisq.core.account.sign.SignedWitness;
import bisq.core.account.sign.SignedWitnessService;
import bisq.core.payment.payload.PaymentAccountPayload;
import bisq.core.trade.model.trade.Trade;
import bisq.core.trade.model.bisq_v1.Trade;

import bisq.network.p2p.storage.P2PDataStorage;

Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/bisq/core/api/CoreApi.java
Expand Up @@ -26,8 +26,8 @@
import bisq.core.payment.PaymentAccount;
import bisq.core.payment.payload.PaymentMethod;
import bisq.core.trade.misc.TradeResultHandler;
import bisq.core.trade.model.bsqswap.BsqSwapTrade;
import bisq.core.trade.model.trade.Trade;
import bisq.core.trade.model.bisq_v1.Trade;
import bisq.core.trade.model.bsq_swap.BsqSwapTrade;
import bisq.core.trade.statistics.TradeStatistics3;
import bisq.core.trade.statistics.TradeStatisticsManager;

Expand Down
13 changes: 6 additions & 7 deletions core/src/main/java/bisq/core/api/CoreTradesService.java
Expand Up @@ -23,15 +23,15 @@
import bisq.core.offer.OfferUtil;
import bisq.core.offer.takeoffer.TakeBsqSwapOfferModel;
import bisq.core.offer.takeoffer.TakeOfferModel;
import bisq.core.trade.misc.ClosedTradableManager;
import bisq.core.trade.misc.TradeResultHandler;
import bisq.core.trade.misc.TradeUtil;
import bisq.core.trade.model.ClosedTradableManager;
import bisq.core.trade.model.Tradable;
import bisq.core.trade.model.TradeManager;
import bisq.core.trade.model.bsqswap.BsqSwapTrade;
import bisq.core.trade.model.trade.Trade;
import bisq.core.trade.protocol.trade.BuyerProtocol;
import bisq.core.trade.protocol.trade.SellerProtocol;
import bisq.core.trade.model.bisq_v1.Trade;
import bisq.core.trade.model.bsq_swap.BsqSwapTrade;
import bisq.core.trade.protocol.bisq_v1.BuyerProtocol;
import bisq.core.trade.protocol.bisq_v1.SellerProtocol;
import bisq.core.user.User;
import bisq.core.util.validation.BtcAddressValidator;

Expand Down Expand Up @@ -111,7 +111,6 @@ void takeBsqSwapOffer(Offer offer,
takeOfferModel);
tradeManager.onTakeBsqSwapOffer(offer,
takeBsqSwapOfferModel.getAmount().getValue(), // TODO get rid of jfx property dep?
takeBsqSwapOfferModel.getTradePrice().getValue(),
takeBsqSwapOfferModel.getBsqSwapTxHelper().getTxFeePerVbyte().getValue(),
takeBsqSwapOfferModel.getMakerFee().getValue(),
takeBsqSwapOfferModel.getTakerFee().getValue(),
Expand Down Expand Up @@ -243,7 +242,7 @@ void withdrawFunds(String tradeId, String toAddress, String memo) {
BsqSwapTrade getBsqSwapTrade(String tradeId) {
coreWalletsService.verifyWalletsAreAvailable();
coreWalletsService.verifyEncryptedWalletIsUnlocked();
return tradeManager.getBsqSwapTradeById(tradeId).orElseThrow(() ->
return tradeManager.findBsqSwapTradeById(tradeId).orElseThrow(() ->
new IllegalArgumentException(format("trade with id '%s' not found", tradeId)));
}

Expand Down
35 changes: 18 additions & 17 deletions core/src/main/java/bisq/core/api/model/BsqSwapTradeInfo.java
Expand Up @@ -17,7 +17,7 @@

package bisq.core.api.model;

import bisq.core.trade.model.bsqswap.BsqSwapTrade;
import bisq.core.trade.model.bsq_swap.BsqSwapTrade;

import bisq.common.Payload;

Expand Down Expand Up @@ -86,30 +86,31 @@ public static BsqSwapTradeInfo toBsqSwapTradeInfo(BsqSwapTrade trade) {
return toBsqSwapTradeInfo(trade, null);
}

//TODO
public static BsqSwapTradeInfo toBsqSwapTradeInfo(BsqSwapTrade trade, String role) {
return new BsqSwapTradeInfoBuilder()
.withBsqSwapOffer(toBsqSwapOfferInfo(trade.getOffer()))
.withTradeId(trade.getId())
.withTempTradingPeerNodeAddress(trade.getBsqSwapProtocolModel().getTempTradingPeerNodeAddress().getFullAddress())
.withPeerNodeAddress(trade.getPeerNodeAddress().getFullAddress())
.withTxId(trade.getTxId())
.withBsqTradeAmount(trade.getBsqSwapProtocolModel().getBsqTradeAmount())
.withBsqMaxTradeAmount(trade.getBsqSwapProtocolModel().getBsqMaxTradeAmount())
.withBsqMinTradeAmount(trade.getBsqSwapProtocolModel().getBsqMinTradeAmount())
.withBtcTradeAmount(trade.getBsqSwapProtocolModel().getBtcTradeAmount())
.withBtcMaxTradeAmount(trade.getBsqSwapProtocolModel().getBtcMaxTradeAmount())
.withBtcMinTradeAmount(trade.getBsqSwapProtocolModel().getBtcMinTradeAmount())
.withTradePrice(trade.getBsqSwapProtocolModel().getTradePrice())
.withBsqMakerTradeFee(trade.getBsqSwapProtocolModel().getBsqMakerTradeFee())
.withBsqTakerTradeFee(trade.getBsqSwapProtocolModel().getBsqTakerTradeFee())
.withTxFeePerVbyte(trade.getBsqSwapProtocolModel().getTxFeePerVbyte())
.withTxFee(trade.getBsqSwapProtocolModel().getTxFee())
.withMakerBsqAddress(trade.getBsqSwapProtocolModel().getMakerBsqAddress())
.withMakerBtcAddress(trade.getBsqSwapProtocolModel().getMakerBtcAddress())
.withTakerBsqAddress(trade.getBsqSwapProtocolModel().getTakerBsqAddress())
.withTakerBtcAddress(trade.getBsqSwapProtocolModel().getTakerBtcAddress())
/* .withBsqTradeAmount(trade.getBsqSwapProtocolModel().getBsqTradeAmount())
.withBsqMaxTradeAmount(trade.getBsqSwapProtocolModel().getBsqMaxTradeAmount())
.withBsqMinTradeAmount(trade.getBsqSwapProtocolModel().getBsqMinTradeAmount())
.withBtcTradeAmount(trade.getBsqSwapProtocolModel().getBtcTradeAmount())
.withBtcMaxTradeAmount(trade.getBsqSwapProtocolModel().getBtcMaxTradeAmount())
.withBtcMinTradeAmount(trade.getBsqSwapProtocolModel().getBtcMinTradeAmount())
.withTradePrice(trade.getBsqSwapProtocolModel().getTradePrice())
.withBsqMakerTradeFee(trade.getBsqSwapProtocolModel().getBsqMakerTradeFee())
.withBsqTakerTradeFee(trade.getBsqSwapProtocolModel().getBsqTakerTradeFee())
.withTxFeePerVbyte(trade.getBsqSwapProtocolModel().getTxFeePerVbyte())
.withTxFee(trade.getBsqSwapProtocolModel().getTxFee())
.withMakerBsqAddress(trade.getBsqSwapProtocolModel().getMakerBsqAddress())
.withMakerBtcAddress(trade.getBsqSwapProtocolModel().getMakerBtcAddress())
.withTakerBsqAddress(trade.getBsqSwapProtocolModel().getTakerBsqAddress())
.withTakerBtcAddress(trade.getBsqSwapProtocolModel().getTakerBtcAddress())*/
.withTakeOfferDate(trade.getTakeOfferDate())
.withState(trade.getState().name())
.withState(trade.getTradeState().name())
.withErrorMessage(trade.getErrorMessage())
.build();
}
Expand Down
8 changes: 4 additions & 4 deletions core/src/main/java/bisq/core/api/model/TradeInfo.java
Expand Up @@ -17,8 +17,8 @@

package bisq.core.api.model;

import bisq.core.trade.model.Contract;
import bisq.core.trade.model.trade.Trade;
import bisq.core.trade.model.bisq_v1.Contract;
import bisq.core.trade.model.bisq_v1.Trade;

import bisq.common.Payload;

Expand Down Expand Up @@ -138,8 +138,8 @@ public static TradeInfo toTradeInfo(Trade trade, String role, boolean isMyOffer)
.withTradeVolume(trade.getTradeVolume() == null ? 0 : trade.getTradeVolume().getValue())
.withTradingPeerNodeAddress(Objects.requireNonNull(
trade.getTradingPeerNodeAddress()).getHostNameWithoutPostFix())
.withState(trade.getState().name())
.withPhase(trade.getPhase().name())
.withState(trade.getTradeState().name())
.withPhase(trade.getTradePhase().name())
.withTradePeriodState(trade.getTradePeriodState().name())
.withIsDepositPublished(trade.isDepositPublished())
.withIsDepositConfirmed(trade.isDepositConfirmed())
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/bisq/core/app/BisqExecutable.java
Expand Up @@ -22,7 +22,7 @@
import bisq.core.btc.wallet.BtcWalletService;
import bisq.core.dao.DaoSetup;
import bisq.core.dao.node.full.RpcService;
import bisq.core.offer.BsqSwapWalletWatcher;
import bisq.core.offer.BsqSwapOfferManager;
import bisq.core.offer.OpenOfferManager;
import bisq.core.provider.price.PriceFeedService;
import bisq.core.setup.CorePersistedDataHost;
Expand Down Expand Up @@ -228,7 +228,7 @@ public void gracefulShutDown(ResultHandler resultHandler) {
}

try {
injector.getInstance(BsqSwapWalletWatcher.class).shutDown();
injector.getInstance(BsqSwapOfferManager.class).shutDown();
injector.getInstance(PriceFeedService.class).shutDown();
injector.getInstance(ArbitratorManager.class).shutDown();
injector.getInstance(TradeStatisticsManager.class).shutDown();
Expand Down
16 changes: 8 additions & 8 deletions core/src/main/java/bisq/core/app/DomainInitialisation.java
Expand Up @@ -33,7 +33,7 @@
import bisq.core.notifications.alerts.TradeEvents;
import bisq.core.notifications.alerts.market.MarketAlerts;
import bisq.core.notifications.alerts.price.PriceAlert;
import bisq.core.offer.BsqSwapWalletWatcher;
import bisq.core.offer.BsqSwapOfferManager;
import bisq.core.offer.OpenOfferManager;
import bisq.core.offer.TriggerPriceService;
import bisq.core.payment.AmazonGiftCardAccount;
Expand All @@ -49,10 +49,10 @@
import bisq.core.support.dispute.refund.RefundManager;
import bisq.core.support.dispute.refund.refundagent.RefundAgentManager;
import bisq.core.support.traderchat.TraderChatManager;
import bisq.core.trade.misc.ClosedTradableManager;
import bisq.core.trade.misc.FailedTradesManager;
import bisq.core.trade.model.ClosedTradableManager;
import bisq.core.trade.model.FailedTradesManager;
import bisq.core.trade.model.TradeManager;
import bisq.core.trade.model.bsqswap.BsqSwapTradeManager;
import bisq.core.trade.model.bsq_swap.BsqSwapTradeManager;
import bisq.core.trade.statistics.TradeStatisticsManager;
import bisq.core.trade.txproof.xmr.XmrTxProofService;
import bisq.core.user.User;
Expand Down Expand Up @@ -115,7 +115,7 @@ public class DomainInitialisation {
private final DaoStateSnapshotService daoStateSnapshotService;
private final TriggerPriceService triggerPriceService;
private final MempoolService mempoolService;
private final BsqSwapWalletWatcher bsqSwapWalletWatcher;
private final BsqSwapOfferManager bsqSwapOfferManager;

@Inject
public DomainInitialisation(ClockWatcher clockWatcher,
Expand Down Expand Up @@ -155,7 +155,7 @@ public DomainInitialisation(ClockWatcher clockWatcher,
DaoStateSnapshotService daoStateSnapshotService,
TriggerPriceService triggerPriceService,
MempoolService mempoolService,
BsqSwapWalletWatcher bsqSwapWalletWatcher) {
BsqSwapOfferManager bsqSwapOfferManager) {
this.clockWatcher = clockWatcher;
this.tradeLimits = tradeLimits;
this.arbitrationManager = arbitrationManager;
Expand Down Expand Up @@ -193,7 +193,7 @@ public DomainInitialisation(ClockWatcher clockWatcher,
this.daoStateSnapshotService = daoStateSnapshotService;
this.triggerPriceService = triggerPriceService;
this.mempoolService = mempoolService;
this.bsqSwapWalletWatcher = bsqSwapWalletWatcher;
this.bsqSwapOfferManager = bsqSwapOfferManager;
}

public void initDomainServices(Consumer<String> rejectedTxErrorMessageHandler,
Expand Down Expand Up @@ -223,7 +223,7 @@ public void initDomainServices(Consumer<String> rejectedTxErrorMessageHandler,
xmrTxProofService.onAllServicesInitialized();

openOfferManager.onAllServicesInitialized();
bsqSwapWalletWatcher.onAllServicesInitialized();
bsqSwapOfferManager.onAllServicesInitialized();

balances.onAllServicesInitialized();

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/bisq/core/app/WalletAppSetup.java
Expand Up @@ -26,7 +26,7 @@
import bisq.core.offer.OpenOfferManager;
import bisq.core.provider.fee.FeeService;
import bisq.core.trade.model.TradeManager;
import bisq.core.trade.model.trade.Trade;
import bisq.core.trade.model.bisq_v1.Trade;
import bisq.core.user.Preferences;
import bisq.core.util.FormattingUtils;

Expand Down