Package org.stellar.sdk
Class TrustLineAsset
java.lang.Object
org.stellar.sdk.TrustLineAsset
Represents a trustline asset in the Stellar network. A trustline is a declaration that an account
trusts an issuer of an asset up to a certain limit. This class can represent both regular assets
and liquidity pool shares.
-
Constructor Summary
ConstructorDescriptionTrustLineAsset
(@NonNull String liquidityPoolId) Creates a TrustLineAsset for a liquidity pool share.TrustLineAsset
(@NonNull Asset asset) Creates a TrustLineAsset for a regular asset. -
Method Summary
Modifier and TypeMethodDescriptionboolean
static TrustLineAsset
fromXdr
(TrustLineAsset trustLineAsset) Creates a TrustLineAsset from its XDR representation.getAsset()
The asset for which the trustline is established.@NonNull AssetType
The type of the asset.The ID of the liquidity pool for which the trustline is established.int
hashCode()
toXdr()
Converts this TrustLineAsset to its XDR representation.
-
Constructor Details
-
TrustLineAsset
Creates a TrustLineAsset for a regular asset.- Parameters:
asset
- The asset for which the trustline is created.
-
TrustLineAsset
Creates a TrustLineAsset for a liquidity pool share.- Parameters:
liquidityPoolId
- The ID of the liquidity pool.
-
-
Method Details
-
toXdr
Converts this TrustLineAsset to its XDR representation.- Returns:
- The XDR representation of this TrustLineAsset.
-
fromXdr
Creates a TrustLineAsset from its XDR representation.- Parameters:
trustLineAsset
- The XDR representation of the TrustLineAsset.- Returns:
- A new TrustLineAsset instance.
- Throws:
IllegalArgumentException
- if the asset type is unknown.
-
equals
-
hashCode
public int hashCode() -
getAssetType
The type of the asset. -
getAsset
The asset for which the trustline is established. This is null if the trustline is for a liquidity pool share.If assetType is one of
AssetType.ASSET_TYPE_NATIVE
,AssetType.ASSET_TYPE_CREDIT_ALPHANUM4
orAssetType.ASSET_TYPE_CREDIT_ALPHANUM12
then this field will be set. -
getLiquidityPoolId
The ID of the liquidity pool for which the trustline is established. This is null if the trustline is for a regular asset.If assetType is
AssetType.ASSET_TYPE_POOL_SHARE
then this field will be set.
-