Class ChangeTrustAsset

java.lang.Object
org.stellar.sdk.ChangeTrustAsset

public final class ChangeTrustAsset extends Object
Represents an asset in a change trust operation on the Stellar network. This class can represent both regular assets and liquidity pool share for change trustline operation.
See Also:
  • Constructor Details

    • ChangeTrustAsset

      public ChangeTrustAsset(@NonNull @NonNull Asset asset)
      Creates a ChangeTrustAsset for a regular asset.
      Parameters:
      asset - The asset for which the trust is being changed.
    • ChangeTrustAsset

      public ChangeTrustAsset(@NonNull @NonNull LiquidityPool liquidityPool)
      Creates a ChangeTrustAsset for a liquidity pool share.
      Parameters:
      liquidityPool - The liquidity pool for which the trust is being changed.
  • Method Details

    • toXdr

      public ChangeTrustAsset toXdr()
      Converts this ChangeTrustAsset to its XDR representation.
      Returns:
      The XDR representation of this ChangeTrustAsset.
    • fromXdr

      public static ChangeTrustAsset fromXdr(ChangeTrustAsset changeTrustAsset)
      Creates a ChangeTrustAsset from its XDR representation.
      Parameters:
      changeTrustAsset - The XDR representation of the ChangeTrustAsset.
      Returns:
      A new ChangeTrustAsset instance.
      Throws:
      IllegalArgumentException - if the asset type is unknown.
    • getAssetType

      @NonNull public @NonNull AssetType getAssetType()
      The type of the asset.
      Returns:
      the asset type
    • getAsset

      @Nullable public Asset getAsset()
      The asset for which the trustline is being changed. This is null if the change trust operation is for a liquidity pool share.

      If assetType is one of AssetType.ASSET_TYPE_NATIVE, AssetType.ASSET_TYPE_CREDIT_ALPHANUM4 or AssetType.ASSET_TYPE_CREDIT_ALPHANUM12 then this field will be set.

      Returns:
      the asset, or null for liquidity pool shares
    • getLiquidityPool

      @Nullable public LiquidityPool getLiquidityPool()
      The liquidity pool for which the trustline is being changed. This is null if the change trust operation is for a regular asset.

      If assetType is AssetType.ASSET_TYPE_POOL_SHARE then this field will be set.

      Returns:
      the liquidity pool, or null for regular assets
    • 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