Class LiquidityPool

java.lang.Object
org.stellar.sdk.LiquidityPool

public final class LiquidityPool extends Object
Represents a LiquidityPoolParameters object on the Stellar network.

See: Liquidity Pool

  • Field Details

    • FEE

      public static int FEE
  • Constructor Details

    • LiquidityPool

      public LiquidityPool(Asset assetA, Asset assetB)
      Constructs a new LiquidityPool with specified assets and default fee.
      Parameters:
      assetA - The first asset in the pool, it must respect the rule assetA < assetB.
      assetB - The second asset in the pool, it must respect the rule assetA < assetB.
      Throws:
      IllegalArgumentException - if assets are not in lexicographic order.
  • Method Details

    • toXdr

      public LiquidityPoolParameters toXdr()
      Converts this LiquidityPool to its XDR representation.
      Returns:
      The XDR object representing this LiquidityPool.
    • fromXdr

      public static LiquidityPool fromXdr(LiquidityPoolParameters xdr)
      Creates a LiquidityPool from its XDR representation.
      Parameters:
      xdr - The XDR object to convert from.
      Returns:
      A new LiquidityPool object.
      Throws:
      IllegalArgumentException - if the XDR object is not of type LIQUIDITY_POOL_CONSTANT_PRODUCT.
    • getLiquidityPoolId

      public String getLiquidityPoolId()
      Generates the LiquidityPoolID for this LiquidityPool.
      Returns:
      The LiquidityPoolID object.
    • getAssetA

      @NonNull public @NonNull Asset getAssetA()
      The first asset in the pool, it must respect the rule assetA < assetB. Check Asset.compareTo(Asset) for details.
    • getAssetB

      @NonNull public @NonNull Asset getAssetB()
      The second asset in the pool, it must respect the rule assetA < assetB. Check Asset.compareTo(Asset) for details.
    • getFee

      public int getFee()
      The liquidity pool fee. For now the only fee supported is FEE.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object