diff --git a/xchange-bibox/pom.xml b/xchange-bibox/pom.xml index 1a5a12604d3..4e490409e48 100644 --- a/xchange-bibox/pom.xml +++ b/xchange-bibox/pom.xml @@ -29,6 +29,5 @@ xchange-core ${project.version} - - + diff --git a/xchange-btcmarkets/src/main/java/org/knowm/xchange/btcmarkets/service/BTCMarketsAccountService.java b/xchange-btcmarkets/src/main/java/org/knowm/xchange/btcmarkets/service/BTCMarketsAccountService.java index f5b34fc22ac..a9859d67407 100644 --- a/xchange-btcmarkets/src/main/java/org/knowm/xchange/btcmarkets/service/BTCMarketsAccountService.java +++ b/xchange-btcmarkets/src/main/java/org/knowm/xchange/btcmarkets/service/BTCMarketsAccountService.java @@ -39,9 +39,9 @@ public AccountInfo getAccountInfo() throws IOException { public String withdrawFunds(WithdrawFundsParams params) throws IOException { if (params instanceof DefaultWithdrawFundsParams) { DefaultWithdrawFundsParams defaultWithdrawFundsParams = (DefaultWithdrawFundsParams) params; - String address = defaultWithdrawFundsParams.address; + String address = defaultWithdrawFundsParams.getAddress(); if (params instanceof RippleWithdrawFundsParams) { - address = address + "?dt=" + ((RippleWithdrawFundsParams) params).tag; + address = address + "?dt=" + ((RippleWithdrawFundsParams) params).getTag(); } return withdrawCrypto( address, diff --git a/xchange-coingi/src/main/java/org/knowm/xchange/coingi/service/CoingiAccountService.java b/xchange-coingi/src/main/java/org/knowm/xchange/coingi/service/CoingiAccountService.java index cf12d790e75..0da2e4ac571 100644 --- a/xchange-coingi/src/main/java/org/knowm/xchange/coingi/service/CoingiAccountService.java +++ b/xchange-coingi/src/main/java/org/knowm/xchange/coingi/service/CoingiAccountService.java @@ -56,9 +56,9 @@ public String withdrawFunds(WithdrawFundsParams p) DefaultWithdrawFundsParams params = (DefaultWithdrawFundsParams) p; CoingiWithdrawalRequest request = new CoingiWithdrawalRequest() - .setAddress(params.address) - .setAmount(params.amount) - .setCurrency(params.currency.getCurrencyCode().toUpperCase()); + .setAddress(params.getAddress()) + .setAmount(params.getAmount()) + .setCurrency(params.getCurrency().getCurrencyCode().toUpperCase()); return withdraw(request).toString(); } diff --git a/xchange-core/lombok.config b/xchange-core/lombok.config new file mode 100644 index 00000000000..e572d96336a --- /dev/null +++ b/xchange-core/lombok.config @@ -0,0 +1 @@ +lombok.equalsAndHashCode.callSuper = call \ No newline at end of file diff --git a/xchange-core/src/main/java/org/knowm/xchange/dto/account/AddressWithTag.java b/xchange-core/src/main/java/org/knowm/xchange/dto/account/AddressWithTag.java index 8ec1a4afb3c..a04f831987a 100644 --- a/xchange-core/src/main/java/org/knowm/xchange/dto/account/AddressWithTag.java +++ b/xchange-core/src/main/java/org/knowm/xchange/dto/account/AddressWithTag.java @@ -1,48 +1,16 @@ package org.knowm.xchange.dto.account; -import java.io.Serializable; -import java.util.Objects; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Value; -public final class AddressWithTag implements Serializable { +@Value +@Builder +@AllArgsConstructor +public class AddressWithTag { - private final String address; - private final String addressTag; + String address; - public AddressWithTag(String address, String addressTag) { - this.address = address; - this.addressTag = addressTag; - } + String addressTag; - public String getAddress() { - return address; - } - - public String getAddressTag() { - return addressTag; - } - - @Override - public String toString() { - return "AddressWithTag{" - + "address='" - + address - + '\'' - + ", addressTag='" - + addressTag - + '\'' - + '}'; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - AddressWithTag that = (AddressWithTag) o; - return Objects.equals(address, that.address) && Objects.equals(addressTag, that.addressTag); - } - - @Override - public int hashCode() { - return Objects.hash(address, addressTag); - } } diff --git a/xchange-core/src/main/java/org/knowm/xchange/service/trade/params/DefaultWithdrawFundsParams.java b/xchange-core/src/main/java/org/knowm/xchange/service/trade/params/DefaultWithdrawFundsParams.java index d1f8329e00e..566b18af5cc 100644 --- a/xchange-core/src/main/java/org/knowm/xchange/service/trade/params/DefaultWithdrawFundsParams.java +++ b/xchange-core/src/main/java/org/knowm/xchange/service/trade/params/DefaultWithdrawFundsParams.java @@ -1,20 +1,24 @@ package org.knowm.xchange.service.trade.params; import java.math.BigDecimal; -import javax.annotation.Nullable; +import lombok.Value; +import lombok.experimental.NonFinal; import org.knowm.xchange.currency.Currency; import org.knowm.xchange.dto.account.AddressWithTag; +@Value +@NonFinal public class DefaultWithdrawFundsParams implements WithdrawFundsParams { - public final String address; - private final String addressTag; + String address; - public final Currency currency; + String addressTag; - public final BigDecimal amount; + Currency currency; - @Nullable public final BigDecimal commission; + BigDecimal amount; + + BigDecimal commission; public DefaultWithdrawFundsParams(String address, Currency currency, BigDecimal amount) { this(address, currency, amount, null); @@ -24,8 +28,8 @@ public DefaultWithdrawFundsParams(AddressWithTag address, Currency currency, Big this(address, currency, amount, null); } - public DefaultWithdrawFundsParams( - String address, Currency currency, BigDecimal amount, BigDecimal commission) { + public DefaultWithdrawFundsParams(String address, Currency currency, BigDecimal amount, + BigDecimal commission) { this.address = address; this.addressTag = null; this.currency = currency; @@ -33,8 +37,8 @@ public DefaultWithdrawFundsParams( this.commission = commission; } - public DefaultWithdrawFundsParams( - AddressWithTag address, Currency currency, BigDecimal amount, BigDecimal commission) { + public DefaultWithdrawFundsParams(AddressWithTag address, Currency currency, BigDecimal amount, + BigDecimal commission) { this.address = address.getAddress(); this.addressTag = address.getAddressTag(); this.currency = currency; @@ -42,12 +46,8 @@ public DefaultWithdrawFundsParams( this.commission = commission; } - public DefaultWithdrawFundsParams( - String address, - String addressTag, - Currency currency, - BigDecimal amount, - BigDecimal commission) { + public DefaultWithdrawFundsParams(String address, String addressTag, Currency currency, + BigDecimal amount, BigDecimal commission) { this.address = address; this.addressTag = addressTag; this.currency = currency; @@ -55,41 +55,4 @@ public DefaultWithdrawFundsParams( this.commission = commission; } - public String getAddress() { - return address; - } - - public String getAddressTag() { - return addressTag; - } - - public Currency getCurrency() { - return currency; - } - - public BigDecimal getAmount() { - return amount; - } - - @Nullable - public BigDecimal getCommission() { - return commission; - } - - @Override - public String toString() { - return "DefaultWithdrawFundsParams{" - + "address='" - + getAddress() - + ", addressTag=" - + getAddressTag() - + '\'' - + ", currency=" - + getCurrency() - + ", amount=" - + getAmount() - + ", commission=" - + getCommission() - + '}'; - } } diff --git a/xchange-kucoin/lombok.config b/xchange-kucoin/lombok.config new file mode 100644 index 00000000000..e572d96336a --- /dev/null +++ b/xchange-kucoin/lombok.config @@ -0,0 +1 @@ +lombok.equalsAndHashCode.callSuper = call \ No newline at end of file diff --git a/xchange-kucoin/src/main/java/org/knowm/xchange/kucoin/dto/request/ApplyWithdrawApiRequest.java b/xchange-kucoin/src/main/java/org/knowm/xchange/kucoin/dto/request/ApplyWithdrawApiRequest.java index 8f14826b1e3..21d68ff7c46 100644 --- a/xchange-kucoin/src/main/java/org/knowm/xchange/kucoin/dto/request/ApplyWithdrawApiRequest.java +++ b/xchange-kucoin/src/main/java/org/knowm/xchange/kucoin/dto/request/ApplyWithdrawApiRequest.java @@ -4,38 +4,42 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import java.math.BigDecimal; import lombok.Builder; -import lombok.Getter; -import lombok.ToString; +import lombok.Value; -@Getter -@ToString +@Value @Builder @JsonInclude(value = Include.NON_EMPTY, content = Include.NON_NULL) public class ApplyWithdrawApiRequest { /** Currency */ - private final String currency; + String currency; + /** Withdrawal address */ - private final String address; + String address; + /** * Withdrawal amount, a positive number which is a multiple of the amount precision (fees * excluded) */ - private final BigDecimal amount; + BigDecimal amount; + /** * [optional] The note that is left on the withdrawal address. When you withdraw from KuCoin to * other platforms, you need to fill in memo(tag). If you don't fill in memo(tag), your withdrawal * may not be available. */ - private final String memo; + String memo; + /** [optional] Internal withdrawal or not. Default setup: false */ - @Builder.Default private final boolean isInner = false; + boolean isInner; + /** [optional] Remark */ - private final String remark; + String remark; + /** * [optional] The chain name of currency, e.g. The available value for USDT are OMNI, ERC20, * TRC20, default is OMNI. This only apply for multi-chain currency, and there is no need for * single chain currency. */ - private final String chain; + String chain; } diff --git a/xchange-okcoin/src/main/java/org/knowm/xchange/okcoin/service/OkCoinAccountService.java b/xchange-okcoin/src/main/java/org/knowm/xchange/okcoin/service/OkCoinAccountService.java index c8dbfef314e..f47459e6bc3 100644 --- a/xchange-okcoin/src/main/java/org/knowm/xchange/okcoin/service/OkCoinAccountService.java +++ b/xchange-okcoin/src/main/java/org/knowm/xchange/okcoin/service/OkCoinAccountService.java @@ -80,7 +80,7 @@ public String withdrawFunds(Currency currency, BigDecimal amount, String address public String withdrawFunds(WithdrawFundsParams params) throws IOException { if (params instanceof DefaultWithdrawFundsParams) { DefaultWithdrawFundsParams defaultParams = (DefaultWithdrawFundsParams) params; - return withdrawFunds(defaultParams.currency, defaultParams.amount, defaultParams.address); + return withdrawFunds(defaultParams.getCurrency(), defaultParams.getAmount(), defaultParams.getAddress()); } throw new IllegalStateException("Don't know how to withdraw: " + params); } diff --git a/xchange-okcoin/src/main/java/org/knowm/xchange/okcoin/v3/service/OkexAccountService.java b/xchange-okcoin/src/main/java/org/knowm/xchange/okcoin/v3/service/OkexAccountService.java index 2e3fd709e9c..804fded23d9 100644 --- a/xchange-okcoin/src/main/java/org/knowm/xchange/okcoin/v3/service/OkexAccountService.java +++ b/xchange-okcoin/src/main/java/org/knowm/xchange/okcoin/v3/service/OkexAccountService.java @@ -68,7 +68,7 @@ public AccountInfo getAccountInfo() throws IOException { public String withdrawFunds(WithdrawFundsParams params) throws IOException { if (params instanceof DefaultWithdrawFundsParams) { DefaultWithdrawFundsParams p = (DefaultWithdrawFundsParams) params; - return withdrawFunds0(p.currency, p.amount, p.address, p.commission); + return withdrawFunds0(p.getCurrency(), p.getAmount(), p.getAddress(), p.getCommission()); } throw new IllegalStateException("Don't know how to withdraw: " + params); }