mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-04-11 10:49:04 -04:00
Renamed TradeService to TradeWalletService
This commit is contained in:
parent
1a5118f601
commit
9a46ef7c4d
@ -75,15 +75,15 @@ import static com.google.inject.internal.util.$Preconditions.*;
|
||||
OUT[1] Taker payout address
|
||||
|
||||
*/
|
||||
public class TradeService {
|
||||
private static final Logger log = LoggerFactory.getLogger(TradeService.class);
|
||||
public class TradeWalletService {
|
||||
private static final Logger log = LoggerFactory.getLogger(TradeWalletService.class);
|
||||
|
||||
private final NetworkParameters params;
|
||||
private final Wallet wallet;
|
||||
private final WalletAppKit walletAppKit;
|
||||
private final FeePolicy feePolicy;
|
||||
|
||||
public TradeService(NetworkParameters params, Wallet wallet, WalletAppKit walletAppKit, FeePolicy feePolicy) {
|
||||
public TradeWalletService(NetworkParameters params, Wallet wallet, WalletAppKit walletAppKit, FeePolicy feePolicy) {
|
||||
this.params = params;
|
||||
this.wallet = wallet;
|
||||
this.walletAppKit = walletAppKit;
|
@ -110,7 +110,7 @@ public class WalletService {
|
||||
private AddressEntry arbitratorDepositAddressEntry;
|
||||
private @GuardedBy(LOCK_NAME) List<AddressEntry> addressEntryList = new ArrayList<>();
|
||||
|
||||
private TradeService tradeService;
|
||||
private TradeWalletService tradeWalletService;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
@ -155,7 +155,7 @@ public class WalletService {
|
||||
walletAppKit.peerGroup().setBloomFilterFalsePositiveRate(0.00001);
|
||||
initWallet();
|
||||
|
||||
tradeService = new TradeService(params, wallet, walletAppKit, feePolicy);
|
||||
tradeWalletService = new TradeWalletService(params, wallet, walletAppKit, feePolicy);
|
||||
|
||||
status.onCompleted();
|
||||
}
|
||||
@ -475,8 +475,8 @@ public class WalletService {
|
||||
// Transactions
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public TradeService getTradeService() {
|
||||
return tradeService;
|
||||
public TradeWalletService getTradeWalletService() {
|
||||
return tradeWalletService;
|
||||
}
|
||||
|
||||
public void payRegistrationFee(String stringifiedBankAccounts, FutureCallback<Transaction> callback) throws
|
||||
|
@ -54,7 +54,7 @@ public class BroadcastCreateOfferFeeTx extends Task<PlaceOfferModel> {
|
||||
Coin balance = model.getWalletService().getBalanceForAddress(addressEntry.getAddress());
|
||||
if (balance.compareTo(totalsNeeded) >= 0) {
|
||||
|
||||
model.getWalletService().getTradeService().broadcastCreateOfferFeeTx(model.getTransaction(), new FutureCallback<Transaction>() {
|
||||
model.getWalletService().getTradeWalletService().broadcastCreateOfferFeeTx(model.getTransaction(), new FutureCallback<Transaction>() {
|
||||
@Override
|
||||
public void onSuccess(Transaction transaction) {
|
||||
log.info("Broadcast of offer fee payment succeeded: transaction = " + transaction.toString());
|
||||
|
@ -36,7 +36,7 @@ public class CreateOfferFeeTx extends Task<PlaceOfferModel> {
|
||||
@Override
|
||||
protected void doRun() {
|
||||
try {
|
||||
Transaction transaction = model.getWalletService().getTradeService().createOfferFeeTx(
|
||||
Transaction transaction = model.getWalletService().getTradeWalletService().createOfferFeeTx(
|
||||
model.getWalletService().getAddressEntry(model.getOffer().getId()));
|
||||
|
||||
// We assume there will be no tx malleability. We add a check later in case the published offer has a different hash.
|
||||
|
@ -20,7 +20,7 @@ package io.bitsquare.trade.protocol.trade;
|
||||
import io.bitsquare.bank.BankAccount;
|
||||
import io.bitsquare.btc.AddressEntry;
|
||||
import io.bitsquare.btc.BlockChainService;
|
||||
import io.bitsquare.btc.TradeService;
|
||||
import io.bitsquare.btc.TradeWalletService;
|
||||
import io.bitsquare.btc.WalletService;
|
||||
import io.bitsquare.crypto.SignatureService;
|
||||
import io.bitsquare.offer.Offer;
|
||||
@ -55,7 +55,7 @@ public class OfferSharedModel extends SharedModel {
|
||||
private final DeterministicKey registrationKeyPair;
|
||||
private final byte[] arbitratorPubKey;
|
||||
private final AddressEntry addressEntry;
|
||||
private final TradeService tradeService;
|
||||
private final TradeWalletService tradeWalletService;
|
||||
|
||||
// data written/read by tasks
|
||||
private TradeMessage tradeMessage;
|
||||
@ -74,7 +74,7 @@ public class OfferSharedModel extends SharedModel {
|
||||
this.signatureService = signatureService;
|
||||
|
||||
id = offer.getId();
|
||||
tradeService = walletService.getTradeService();
|
||||
tradeWalletService = walletService.getTradeWalletService();
|
||||
//TODO use default arbitrator for now
|
||||
arbitratorPubKey = offer.getArbitrators().get(0).getPubKey();
|
||||
registrationPubKey = walletService.getRegistrationAddressEntry().getPubKey();
|
||||
@ -91,8 +91,8 @@ public class OfferSharedModel extends SharedModel {
|
||||
return id;
|
||||
}
|
||||
|
||||
public TradeService getTradeService() {
|
||||
return tradeService;
|
||||
public TradeWalletService getTradeWalletService() {
|
||||
return tradeWalletService;
|
||||
}
|
||||
|
||||
public TradeMessage getTradeMessage() {
|
||||
|
@ -19,7 +19,7 @@ package io.bitsquare.trade.protocol.trade.offerer.tasks;
|
||||
|
||||
import io.bitsquare.btc.AddressEntry;
|
||||
import io.bitsquare.btc.FeePolicy;
|
||||
import io.bitsquare.btc.TradeService;
|
||||
import io.bitsquare.btc.TradeWalletService;
|
||||
import io.bitsquare.trade.protocol.trade.offerer.BuyerAsOffererModel;
|
||||
import io.bitsquare.util.taskrunner.Task;
|
||||
import io.bitsquare.util.taskrunner.TaskRunner;
|
||||
@ -41,7 +41,7 @@ public class GetOffererDepositTxInputs extends Task<BuyerAsOffererModel> {
|
||||
try {
|
||||
Coin offererInputAmount = model.getTrade().getSecurityDeposit().add(FeePolicy.TX_FEE);
|
||||
AddressEntry addressInfo = model.getAddressEntry();
|
||||
TradeService.TransactionDataResult result = model.getTradeService().offererCreatesDepositTxInputs(offererInputAmount, addressInfo);
|
||||
TradeWalletService.TransactionDataResult result = model.getTradeWalletService().offererCreatesDepositTxInputs(offererInputAmount, addressInfo);
|
||||
|
||||
model.setOffererConnectedOutputsForAllInputs(result.getConnectedOutputsForAllInputs());
|
||||
model.setOffererOutputs(result.getOutputs());
|
||||
|
@ -44,7 +44,7 @@ public class SignAndPublishDepositTx extends Task<BuyerAsOffererModel> {
|
||||
protected void doRun() {
|
||||
try {
|
||||
Coin offererInputAmount = model.getTrade().getSecurityDeposit().add(FeePolicy.TX_FEE);
|
||||
model.getTradeService().offererSignsAndPublishTx(
|
||||
model.getTradeWalletService().offererSignsAndPublishTx(
|
||||
model.getTakerDepositTx(),
|
||||
model.getOffererConnectedOutputsForAllInputs(),
|
||||
model.getTakerConnectedOutputsForAllInputs(),
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
package io.bitsquare.trade.protocol.trade.offerer.tasks;
|
||||
|
||||
import io.bitsquare.btc.TradeService;
|
||||
import io.bitsquare.btc.TradeWalletService;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.protocol.trade.offerer.BuyerAsOffererModel;
|
||||
import io.bitsquare.util.taskrunner.Task;
|
||||
@ -43,7 +43,7 @@ public class SignPayoutTx extends Task<BuyerAsOffererModel> {
|
||||
Coin offererPayoutAmount = trade.getTradeAmount().add(securityDeposit);
|
||||
@SuppressWarnings("UnnecessaryLocalVariable") Coin takerPayoutAmount = securityDeposit;
|
||||
|
||||
TradeService.TransactionDataResult result = model.getTradeService().offererCreatesAndSignsPayoutTx(
|
||||
TradeWalletService.TransactionDataResult result = model.getTradeWalletService().offererCreatesAndSignsPayoutTx(
|
||||
trade.getDepositTx(),
|
||||
offererPayoutAmount,
|
||||
takerPayoutAmount,
|
||||
|
@ -41,7 +41,7 @@ public class PayTakeOfferFee extends Task<SellerAsTakerModel> {
|
||||
@Override
|
||||
protected void doRun() {
|
||||
try {
|
||||
model.getTradeService().payTakeOfferFee(model.getAddressEntry(), new FutureCallback<Transaction>() {
|
||||
model.getTradeWalletService().payTakeOfferFee(model.getAddressEntry(), new FutureCallback<Transaction>() {
|
||||
@Override
|
||||
public void onSuccess(Transaction transaction) {
|
||||
log.debug("Take offer fee paid successfully. Transaction ID = " + transaction.getHashAsString());
|
||||
|
@ -41,7 +41,7 @@ public class SignAndPublishPayoutTx extends Task<SellerAsTakerModel> {
|
||||
@Override
|
||||
protected void doRun() {
|
||||
try {
|
||||
model.getTradeService().takerSignsAndPublishPayoutTx(
|
||||
model.getTradeWalletService().takerSignsAndPublishPayoutTx(
|
||||
model.getPublishedDepositTx(),
|
||||
model.getOffererSignature(),
|
||||
model.getOffererPayoutAmount(),
|
||||
|
@ -37,7 +37,7 @@ public class TakerCommitDepositTx extends Task<SellerAsTakerModel> {
|
||||
@Override
|
||||
protected void doRun() {
|
||||
try {
|
||||
Transaction transaction = model.getTradeService().takerCommitsDepositTx(model.getPublishedDepositTx());
|
||||
Transaction transaction = model.getTradeWalletService().takerCommitsDepositTx(model.getPublishedDepositTx());
|
||||
model.getTrade().setDepositTx(transaction);
|
||||
model.getTrade().setState(Trade.State.DEPOSIT_PUBLISHED);
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
package io.bitsquare.trade.protocol.trade.taker.tasks;
|
||||
|
||||
import io.bitsquare.btc.FeePolicy;
|
||||
import io.bitsquare.btc.TradeService;
|
||||
import io.bitsquare.btc.TradeWalletService;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.protocol.trade.taker.SellerAsTakerModel;
|
||||
import io.bitsquare.util.taskrunner.Task;
|
||||
@ -42,7 +42,7 @@ public class TakerCreatesAndSignsDepositTx extends Task<SellerAsTakerModel> {
|
||||
Coin takerInputAmount = model.getTrade().getTradeAmount().add(model.getTrade().getSecurityDeposit()).add(FeePolicy.TX_FEE);
|
||||
Coin msOutputAmount = takerInputAmount.add(model.getTrade().getSecurityDeposit());
|
||||
|
||||
TradeService.TransactionDataResult result = model.getTradeService().takerCreatesAndSignsDepositTx(
|
||||
TradeWalletService.TransactionDataResult result = model.getTradeWalletService().takerCreatesAndSignsDepositTx(
|
||||
takerInputAmount,
|
||||
msOutputAmount,
|
||||
model.getOffererConnectedOutputsForAllInputs(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user