Class HbarAllowance

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

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

    • 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

      @Nullable public final Hbar amount
      The amount of the spender's allowance in tinybars
  • Constructor Details

    • HbarAllowance

      HbarAllowance(@Nullable AccountId ownerAccountId, @Nullable AccountId spenderAccountId, @Nullable Hbar amount)
      Constructor.
      Parameters:
      ownerAccountId - the owner granting the allowance
      spenderAccountId - the spender
      amount - the amount of hbar
  • Method Details

    • fromProtobuf

      static HbarAllowance fromProtobuf(CryptoAllowance allowanceProto)
      Create a hbar allowance from a crypto allowance protobuf.
      Parameters:
      allowanceProto - the crypto allowance protobuf
      Returns:
      the new hbar allowance
    • fromProtobuf

      static HbarAllowance fromProtobuf(GrantedCryptoAllowance allowanceProto)
      Create a hbar allowance from a granted crypto allowance protobuf.
      Parameters:
      allowanceProto - the granted crypto allowance protobuf
      Returns:
      the new hbar allowance
    • fromBytes

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

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

      CryptoAllowance toProtobuf()
      Convert a crypto allowance into a protobuf.
      Returns:
      the protobuf
    • toGrantedProtobuf

      GrantedCryptoAllowance toGrantedProtobuf()
      Convert a crypto allowance into a granted crypto allowance protobuf.
      Returns:
      the granted crypto allowance
    • toBytes

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

      public String toString()
      Overrides:
      toString in class Object