mirror of
https://github.com/bisq-network/bisq.git
synced 2025-01-19 05:44:05 +01:00
Append nullable withdrawalTxId field to Trade proto message
The withdrawalTxId field will be set in TradeManager#onWithdrawRequest upon successful trade completion and withdrawal of funds. Persisting withdrawalTxId will allow the api and ui to find the withdrawalTxId for a completed trade after the seller withdraws funds to an external wallet. In turn, the withdrawal tx's memo field will be accessible in a new (todo) api getTx(txID) api method. Changed: - Appended field 'string withdrawal_tx_id = 40' to pb.proto's Trade message. - Added nullable 'String withdrawalTxId' to Trade entity class. - Added trade.setWithdrawalTxId(transaction.getTxId().toString()) in TradeManager#onWithdrawRequest's callback.
This commit is contained in:
parent
150e2f6851
commit
6aa385e494
@ -317,6 +317,10 @@ public abstract class Trade implements Tradable, Model {
|
||||
@Getter
|
||||
@Setter
|
||||
private String payoutTxId;
|
||||
@Nullable
|
||||
@Getter
|
||||
@Setter
|
||||
private String withdrawalTxId;
|
||||
@Getter
|
||||
@Setter
|
||||
private long tradeAmountAsLong;
|
||||
@ -554,6 +558,7 @@ public abstract class Trade implements Tradable, Model {
|
||||
Optional.ofNullable(takerFeeTxId).ifPresent(builder::setTakerFeeTxId);
|
||||
Optional.ofNullable(depositTxId).ifPresent(builder::setDepositTxId);
|
||||
Optional.ofNullable(payoutTxId).ifPresent(builder::setPayoutTxId);
|
||||
Optional.ofNullable(withdrawalTxId).ifPresent(builder::setWithdrawalTxId);
|
||||
Optional.ofNullable(tradingPeerNodeAddress).ifPresent(e -> builder.setTradingPeerNodeAddress(tradingPeerNodeAddress.toProtoMessage()));
|
||||
Optional.ofNullable(contract).ifPresent(e -> builder.setContract(contract.toProtoMessage()));
|
||||
Optional.ofNullable(contractAsJson).ifPresent(builder::setContractAsJson);
|
||||
@ -587,6 +592,7 @@ public abstract class Trade implements Tradable, Model {
|
||||
trade.setTakerFeeTxId(ProtoUtil.stringOrNullFromProto(proto.getTakerFeeTxId()));
|
||||
trade.setDepositTxId(ProtoUtil.stringOrNullFromProto(proto.getDepositTxId()));
|
||||
trade.setPayoutTxId(ProtoUtil.stringOrNullFromProto(proto.getPayoutTxId()));
|
||||
trade.setWithdrawalTxId(ProtoUtil.stringOrNullFromProto(proto.getWithdrawalTxId()));
|
||||
trade.setContract(proto.hasContract() ? Contract.fromProto(proto.getContract(), coreProtoResolver) : null);
|
||||
trade.setContractAsJson(ProtoUtil.stringOrNullFromProto(proto.getContractAsJson()));
|
||||
trade.setContractHash(ProtoUtil.byteArrayOrNullFromProto(proto.getContractHash()));
|
||||
@ -1124,6 +1130,7 @@ public abstract class Trade implements Tradable, Model {
|
||||
",\n takerFeeTxId='" + takerFeeTxId + '\'' +
|
||||
",\n depositTxId='" + depositTxId + '\'' +
|
||||
",\n payoutTxId='" + payoutTxId + '\'' +
|
||||
",\n withdrawalTxId='" + withdrawalTxId + '\'' +
|
||||
",\n tradeAmountAsLong=" + tradeAmountAsLong +
|
||||
",\n tradePrice=" + tradePrice +
|
||||
",\n tradingPeerNodeAddress=" + tradingPeerNodeAddress +
|
||||
|
@ -497,6 +497,7 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi
|
||||
onTradeCompleted(trade);
|
||||
trade.setState(Trade.State.WITHDRAW_COMPLETED);
|
||||
getTradeProtocol(trade).onWithdrawCompleted();
|
||||
trade.setWithdrawalTxId(transaction.getTxId().toString());
|
||||
requestPersistence();
|
||||
resultHandler.handleResult();
|
||||
}
|
||||
|
@ -1450,6 +1450,7 @@ message Trade {
|
||||
string counter_currency_extra_data = 37;
|
||||
string asset_tx_proof_result = 38; // name of AssetTxProofResult enum
|
||||
string uid = 39;
|
||||
string withdrawal_tx_id = 40;
|
||||
}
|
||||
|
||||
message BuyerAsMakerTrade {
|
||||
|
Loading…
Reference in New Issue
Block a user