Class TokenRelationship

java.lang.Object
com.hedera.hashgraph.sdk.TokenRelationship

public class TokenRelationship extends Object
Token's information related to the given Account. See Hedera Documentation
  • Field Details

    • tokenId

      public final TokenId tokenId
      A unique token id
    • symbol

      public final String symbol
      The Symbol of the token
    • balance

      public final long balance
      For token of type FUNGIBLE_COMMON - the balance that the Account holds in the smallest denomination. For token of type NON_FUNGIBLE_UNIQUE - the number of NFTs held by the account
    • kycStatus

      @Nullable public final Boolean kycStatus
      The KYC status of the account (KycNotApplicable, Granted or Revoked). If the token does not have KYC key, KycNotApplicable is returned
    • freezeStatus

      @Nullable public final Boolean freezeStatus
      The Freeze status of the account (FreezeNotApplicable, Frozen or Unfrozen). If the token does not have Freeze key, FreezeNotApplicable is returned
    • decimals

      public final int decimals
      The amount of decimal places that this token supports.
    • automaticAssociation

      public final boolean automaticAssociation
      Specifies if the relationship is created implicitly. False : explicitly associated, True : implicitly associated.
  • Constructor Details

    • TokenRelationship

      TokenRelationship(TokenId tokenId, String symbol, long balance, @Nullable Boolean kycStatus, @Nullable Boolean freezeStatus, int decimals, boolean automaticAssociation)
  • Method Details

    • freezeStatusFromProtobuf

      @Nullable static Boolean freezeStatusFromProtobuf(TokenFreezeStatus freezeStatus)
      Retrieve freeze status from a protobuf.
      Parameters:
      freezeStatus - the protobuf
      Returns:
      the freeze status
    • kycStatusFromProtobuf

      @Nullable static Boolean kycStatusFromProtobuf(TokenKycStatus kycStatus)
      Retrieve the kyc status from a protobuf.
      Parameters:
      kycStatus - the protobuf
      Returns:
      the kyc status
    • fromProtobuf

      static TokenRelationship fromProtobuf(TokenRelationship tokenRelationship)
      Create a token relationship object from a protobuf.
      Parameters:
      tokenRelationship - the protobuf
      Returns:
      the new token relationship
    • fromBytes

      public static TokenRelationship fromBytes(byte[] bytes) throws com.google.protobuf.InvalidProtocolBufferException
      Create a token relationship from a byte array.
      Parameters:
      bytes - the byte array
      Returns:
      the new token relationship
      Throws:
      com.google.protobuf.InvalidProtocolBufferException - when there is an issue with the protobuf
    • freezeStatusToProtobuf

      static TokenFreezeStatus freezeStatusToProtobuf(@Nullable Boolean freezeStatus)
      Retrieve the freeze status from a protobuf.
      Parameters:
      freezeStatus - the protobuf
      Returns:
      the freeze status
    • kycStatusToProtobuf

      static TokenKycStatus kycStatusToProtobuf(@Nullable Boolean kycStatus)
      Retrieve the kyc status from a protobuf.
      Parameters:
      kycStatus - the protobuf
      Returns:
      the kyc status
    • toProtobuf

      TokenRelationship toProtobuf()
      Create the protobuf.
      Returns:
      the protobuf representation
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toBytes

      public byte[] toBytes()
      Create the byte array.
      Returns:
      the byte array representation