-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add missing operation responses (#373)
There were two operations missing related to liquidity pools. This PR also registers the liquidity pool id class in the operation and effect deserializers so it can be serialized / deserialized properly.
- Loading branch information
Showing
10 changed files
with
397 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
...main/java/org/stellar/sdk/responses/operations/LiquidityPoolDepositOperationResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
package org.stellar.sdk.responses.operations; | ||
|
||
import com.google.common.base.Objects; | ||
import com.google.gson.annotations.SerializedName; | ||
import org.stellar.sdk.LiquidityPoolID; | ||
import org.stellar.sdk.Price; | ||
import org.stellar.sdk.AssetAmount; | ||
|
||
import java.util.List; | ||
|
||
public class LiquidityPoolDepositOperationResponse extends OperationResponse { | ||
@SerializedName("liquidity_pool_id") | ||
private final LiquidityPoolID liquidityPoolId; | ||
@SerializedName("reserves_max") | ||
private final AssetAmount[] reservesMax; | ||
@SerializedName("min_price") | ||
private final String minPrice; | ||
@SerializedName("min_price_r") | ||
private final Price minPriceR; | ||
@SerializedName("max_price") | ||
private final String maxPrice; | ||
@SerializedName("max_price_r") | ||
private final Price maxPriceR; | ||
@SerializedName("reserves_deposited") | ||
private final AssetAmount[] reservesDeposited; | ||
@SerializedName("shares_received") | ||
private final String sharesReceived; | ||
|
||
LiquidityPoolDepositOperationResponse(LiquidityPoolID liquidityPoolId, AssetAmount[] reservesMax, String minPrice, Price minPriceR, String maxPrice, Price maxPriceR, AssetAmount[] reservesDeposited, String sharesReceived) { | ||
this.liquidityPoolId = liquidityPoolId; | ||
this.reservesMax = reservesMax; | ||
this.minPrice = minPrice; | ||
this.minPriceR = minPriceR; | ||
this.maxPrice = maxPrice; | ||
this.maxPriceR = maxPriceR; | ||
this.reservesDeposited = reservesDeposited; | ||
this.sharesReceived = sharesReceived; | ||
} | ||
|
||
public LiquidityPoolID getLiquidityPoolId() { | ||
return liquidityPoolId; | ||
} | ||
|
||
public AssetAmount[] getReservesMax() { | ||
return reservesMax; | ||
} | ||
|
||
public String getMinPrice() { | ||
return minPrice; | ||
} | ||
|
||
public Price getMinPriceR() { | ||
return minPriceR; | ||
} | ||
|
||
public String getMaxPrice() { | ||
return maxPrice; | ||
} | ||
|
||
public Price getMaxPriceR() { | ||
return maxPriceR; | ||
} | ||
|
||
public AssetAmount[] getReservesDeposited() { | ||
return reservesDeposited; | ||
} | ||
|
||
public String getSharesReceived() { | ||
return sharesReceived; | ||
} | ||
|
||
public int hashCode() { | ||
return Objects.hashCode(liquidityPoolId, reservesMax, minPrice, minPriceR, maxPrice, maxPriceR, reservesDeposited, sharesReceived); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object object) { | ||
if (!(object instanceof LiquidityPoolDepositOperationResponse)) { | ||
return false; | ||
} | ||
|
||
LiquidityPoolDepositOperationResponse o = (LiquidityPoolDepositOperationResponse) object; | ||
return Objects.equal(this.getLiquidityPoolId(), o.getLiquidityPoolId()) && | ||
Objects.equal(this.getReservesMax(), o.getReservesMax()) && | ||
Objects.equal(this.getMaxPrice(), o.getMaxPrice()) && | ||
Objects.equal(this.getMinPrice(), o.getMinPrice()) && | ||
Objects.equal(this.getMaxPriceR(), o.getMaxPriceR()) && | ||
Objects.equal(this.getMinPriceR(), o.getMinPriceR()) && | ||
Objects.equal(this.getReservesDeposited(), o.getReservesDeposited()) && | ||
Objects.equal(this.getSharesReceived(), o.getSharesReceived()); | ||
} | ||
|
||
} |
59 changes: 59 additions & 0 deletions
59
...ain/java/org/stellar/sdk/responses/operations/LiquidityPoolWithdrawOperationResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package org.stellar.sdk.responses.operations; | ||
|
||
import com.google.common.base.Objects; | ||
import com.google.gson.annotations.SerializedName; | ||
import org.stellar.sdk.LiquidityPoolID; | ||
import org.stellar.sdk.AssetAmount; | ||
|
||
import java.util.List; | ||
|
||
public class LiquidityPoolWithdrawOperationResponse extends OperationResponse { | ||
@SerializedName("liquidity_pool_id") | ||
private final LiquidityPoolID liquidityPoolId; | ||
@SerializedName("reserves_min") | ||
private final AssetAmount[] reservesMin; | ||
@SerializedName("reserves_received") | ||
private final AssetAmount[] reservesReceived; | ||
@SerializedName("shares") | ||
private final String shares; | ||
|
||
public LiquidityPoolWithdrawOperationResponse(LiquidityPoolID poolId, AssetAmount[] reservesMin, String shares, AssetAmount[] reservesReceived) { | ||
this.liquidityPoolId = poolId; | ||
this.reservesMin = reservesMin; | ||
this.shares = shares; | ||
this.reservesReceived = reservesReceived; | ||
} | ||
public LiquidityPoolID getLiquidityPoolId() { | ||
return liquidityPoolId; | ||
} | ||
|
||
public AssetAmount[] getReservesMin() { | ||
return reservesMin; | ||
} | ||
|
||
public AssetAmount[] getReservesReceived() { | ||
return reservesReceived; | ||
} | ||
|
||
public String getShares() { | ||
return shares; | ||
} | ||
|
||
public int hashCode() { | ||
return Objects.hashCode(liquidityPoolId, reservesMin, reservesReceived, shares); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object object) { | ||
if (!(object instanceof LiquidityPoolDepositOperationResponse)) { | ||
return false; | ||
} | ||
|
||
LiquidityPoolWithdrawOperationResponse o = (LiquidityPoolWithdrawOperationResponse) object; | ||
return Objects.equal(this.getLiquidityPoolId(), o.getLiquidityPoolId()) && | ||
Objects.equal(this.getReservesMin(), o.getReservesMin()) && | ||
Objects.equal(this.getReservesReceived(), o.getReservesReceived()) && | ||
Objects.equal(this.getShares(), o.getShares()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.