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

Prepare 0.41.0-beta.0 for release #507

Merged
merged 4 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,27 @@ As this project is pre 1.0, breaking changes may happen for minor version bumps.

## Pending

## 0.41.0-beta.0
* Add support for Soroban Preview 10. ([#490](https://github.com/stellar/java-stellar-sdk/issues/490))
* Correct the data type of certain fields to store the expected design values. ([#497](https://github.com/stellar/java-stellar-sdk/pull/497))
* Add source account comparison to `ClawbackClaimableBalanceOperation`, `LiquidityPoolWithdrawOperation`, and `LiquidityPoolDepositOperation` for equality check. ([#484](https://github.com/stellar/java-stellar-sdk/pull/484))
* Add basic implementation of `liquidity_pools?account` ([#426](https://github.com/stellar/java-stellar-sdk/pull/426))

### Breaking changes
* `Utils.claimableBalanceIdToXDR` and `Utils.xdrToClaimableBalanceId` have been removed. ([#503](https://github.com/stellar/java-stellar-sdk/pull/503))
* The types of the following fields have changed. ([#498](https://github.com/stellar/java-stellar-sdk/pull/498))
| field | before | now |
| ----------------------------------------- | ------ | ---------- |
| LedgerBounds.minLedger | int | long |
| LedgerBounds.maxLedger | int | long |
| MemoId.id | long | BigInteger |
| TimeBounds.minTime | long | BigInteger |
| TimeBounds.maxTime | long | BigInteger |
| TransactionBuilder.baseFee | int | long |
| TransactionPreconditions.TIMEOUT_INFINITE | long | BigInteger |
| TransactionPreconditions.minSeqAge | Long | BigInteger |
| TransactionPreconditions.minSeqLedgerGap | int | long |

## 0.40.0
* Add strkey support for contract ids ([#471](https://github.com/stellar/java-stellar-sdk/pull/471))
* Fix NPE in `KeyPair.equals()` method ([#474](https://github.com/stellar/java-stellar-sdk/pull/474))
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ spotless {


sourceCompatibility = JavaVersion.VERSION_1_8.toString()
version = '0.40.0'
version = '0.41.0-beta.0'
group = 'stellar'
jar.enabled = false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ public boolean equals(Object object) {
}

ClawbackClaimableBalanceOperation other = (ClawbackClaimableBalanceOperation) object;
return Objects.equal(this.balanceId, other.balanceId);
return Objects.equal(this.balanceId, other.balanceId)
&& Objects.equal(this.getSourceAccount(), other.getSourceAccount());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ OperationBody toOperationBody(AccountConverter accountConverter) {
}

public int hashCode() {
return Objects.hashCode(liquidityPoolID, maxAmountA, maxAmountB, minPrice, maxPrice);
return Objects.hashCode(
this.getSourceAccount(), liquidityPoolID, maxAmountA, maxAmountB, minPrice, maxPrice);
}

@Override
Expand All @@ -111,6 +112,7 @@ public boolean equals(Object object) {
&& Objects.equal(this.getMaxAmountA(), o.getMaxAmountA())
&& Objects.equal(this.getMaxAmountB(), o.getMaxAmountB())
&& Objects.equal(this.getMinPrice(), o.getMinPrice())
&& Objects.equal(this.getMaxPrice(), o.getMaxPrice());
&& Objects.equal(this.getMaxPrice(), o.getMaxPrice())
&& Objects.equal(this.getSourceAccount(), o.getSourceAccount());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ OperationBody toOperationBody(AccountConverter accountConverter) {
}

public int hashCode() {
return Objects.hashCode(liquidityPoolID, amount, minAmountA, minAmountB);
return Objects.hashCode(
this.getSourceAccount(), liquidityPoolID, amount, minAmountA, minAmountB);
}

@Override
Expand All @@ -93,6 +94,7 @@ public boolean equals(Object object) {
return Objects.equal(this.getLiquidityPoolID(), o.getLiquidityPoolID())
&& Objects.equal(this.getAmount(), o.getAmount())
&& Objects.equal(this.getMinAmountA(), o.getMinAmountA())
&& Objects.equal(this.getMinAmountB(), o.getMinAmountB());
&& Objects.equal(this.getMinAmountB(), o.getMinAmountB())
&& Objects.equal(this.getSourceAccount(), o.getSourceAccount());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.google.common.base.Objects;
import org.stellar.sdk.xdr.*;

public class RevokeDataSponsorshipOperation extends org.stellar.sdk.Operation {
public class RevokeDataSponsorshipOperation extends Operation {
private final String accountId;
private final String dataName;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
/** Builds requests connected to liquidity pools. */
public class LiquidityPoolsRequestBuilder extends RequestBuilder {
private static final String RESERVES_PARAMETER_NAME = "reserves";
private static final String ACCOUNT_PARAMETER_NAME = "account";

public LiquidityPoolsRequestBuilder(OkHttpClient httpClient, HttpUrl serverURI) {
super(httpClient, serverURI, "liquidity_pools");
Expand Down Expand Up @@ -73,6 +74,19 @@ public LiquidityPoolsRequestBuilder forReserves(String... reserves) {
return this;
}

/**
* Returns all liquidity pools the specified account is participating in.
*
* @param account Account ID to filter liquidity pools
* @return current {@link LiquidityPoolsRequestBuilder} instance
* @see <a
* href="https://developers.stellar.org/api/resources/liquiditypools/list/">LiquidityPools</a>
*/
public LiquidityPoolsRequestBuilder forAccount(String account) {
uriBuilder.setQueryParameter(ACCOUNT_PARAMETER_NAME, account);
return this;
}

/**
* Requests specific <code>uri</code> and returns {@link Page} of {@link LiquidityPoolResponse}.
* This method is helpful for getting the next set of results.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,29 @@ public void testForReserves() {
"https://horizon-testnet.stellar.org/liquidity_pools?reserves=EURT%3AGAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S%2CPHP%3AGAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S",
uri.toString());
}

@Test
public void testForAccount() {
Server server = new Server("https://horizon-testnet.stellar.org");
HttpUrl uri =
server
.liquidityPools()
.forAccount("GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S")
.buildUri();
assertEquals(
"https://horizon-testnet.stellar.org/liquidity_pools?account=GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S",
uri.toString());
}

@Test
public void testForAccountClear() {
Server server = new Server("https://horizon-testnet.stellar.org");
HttpUrl uri =
server
.liquidityPools()
.forAccount("GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S")
.forAccount(null)
.buildUri();
assertEquals("https://horizon-testnet.stellar.org/liquidity_pools?account", uri.toString());
}
}