Skip to content

Commit

Permalink
Merge branch 'master' into 0.40.0-beta.0
Browse files Browse the repository at this point in the history
  • Loading branch information
overcat committed Aug 11, 2023
2 parents 0dc9b4b + 09b8007 commit 8b718b7
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 6 deletions.
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());
}
}

0 comments on commit 8b718b7

Please sign in to comment.