java.lang.Object
com.hedera.hashgraph.sdk.TokenAllowance
An approved allowance of token transfers for a spender.
See Hedera Documentation
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTokenAllowance(TokenId tokenId, AccountId ownerAccountId, AccountId spenderAccountId, long amount) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic TokenAllowancefromBytes(byte[] bytes) Create a token allowance from a byte array.(package private) static TokenAllowancefromProtobuf(GrantedTokenAllowance allowanceProto) Create a token allowance from a protobuf.(package private) static TokenAllowancefromProtobuf(TokenAllowance allowanceProto) Create a token allowance from a protobuf.byte[]toBytes()Create the byte array.(package private) GrantedTokenAllowanceCreate the byte array.(package private) TokenAllowanceCreate the protobuf.toString()(package private) voidvalidateChecksums(Client client) Validate the configured client.
-
Field Details
-
tokenId
The token that the allowance pertains to -
ownerAccountId
The account ID of the hbar owner (ie. the grantor of the allowance) -
spenderAccountId
The account ID of the spender of the hbar allowance -
amount
public final long amountThe 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 idownerAccountId- the grantor account idspenderAccountId- the spender account idamount- the token allowance
-
-
Method Details
-
fromProtobuf
Create a token allowance from a protobuf.- Parameters:
allowanceProto- the protobuf- Returns:
- the new token allowance
-
fromProtobuf
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
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
-