Class TokenAllowance

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

public class TokenAllowance extends Object
An approved allowance of token transfers for a spender. See Hedera Documentation
  • Field Details

    • tokenId

      @Nullable public final TokenId tokenId
      The token that the allowance pertains to
    • ownerAccountId

      @Nullable public final AccountId ownerAccountId
      The account ID of the hbar owner (ie. the grantor of the allowance)
    • spenderAccountId

      @Nullable public final AccountId spenderAccountId
      The account ID of the spender of the hbar allowance
    • amount

      public final long amount
      The amount of the spender's token allowance
  • Constructor Details

    • TokenAllowance

      TokenAllowance(@Nullable TokenId tokenId, @Nullable AccountId ownerAccountId, @Nullable AccountId spenderAccountId, long amount)
      Constructor.
      Parameters:
      tokenId - the token id
      ownerAccountId - the grantor account id
      spenderAccountId - the spender account id
      amount - the token allowance
  • Method Details

    • fromProtobuf

      static TokenAllowance fromProtobuf(TokenAllowance allowanceProto)
      Create a token allowance from a protobuf.
      Parameters:
      allowanceProto - the protobuf
      Returns:
      the new token allowance
    • fromProtobuf

      static TokenAllowance fromProtobuf(GrantedTokenAllowance allowanceProto)
      Create a token allowance from a protobuf.
      Parameters:
      allowanceProto - the protobuf
      Returns:
      the new token allowance
    • fromBytes

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

      void validateChecksums(Client client) throws BadEntityIdException
      Validate the configured client.
      Parameters:
      client - the configured client
      Throws:
      BadEntityIdException - if entity ID is formatted poorly
    • toProtobuf

      TokenAllowance toProtobuf()
      Create the protobuf.
      Returns:
      the protobuf representation
    • toGrantedProtobuf

      GrantedTokenAllowance toGrantedProtobuf()
      Create the byte array.
      Returns:
      the protobuf representation
    • toBytes

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

      public String toString()
      Overrides:
      toString in class Object