com.hedera.hapi.node.token.schema.TokenWipeAccountTransactionBodySchema Maven / Gradle / Ivy
package com.hedera.hapi.node.token.schema;
import com.hedera.pbj.runtime.FieldDefinition;
import com.hedera.pbj.runtime.FieldType;
import com.hedera.pbj.runtime.Schema;
/**
* Schema for TokenWipeAccountTransactionBody model object. Generate based on protobuf schema.
*/
public final class TokenWipeAccountTransactionBodySchema implements Schema {
// -- FIELD DEFINITIONS ---------------------------------------------
/**
* (1) The token for which the account will be wiped. If token does not exist, transaction results
* in INVALID_TOKEN_ID
*/
public static final FieldDefinition TOKEN = new FieldDefinition("token", FieldType.MESSAGE, false, false, false, 1);
/**
* (2) The account to be wiped
*/
public static final FieldDefinition ACCOUNT = new FieldDefinition("account", FieldType.MESSAGE, false, false, false, 2);
/**
* (3) Applicable to tokens of type FUNGIBLE_COMMON. The amount of tokens to wipe from the specified
* account. Amount must be a positive non-zero number in the lowest denomination possible, not
* bigger than the token balance of the account (0; balance]
*/
public static final FieldDefinition AMOUNT = new FieldDefinition("amount", FieldType.UINT64, false, false, false, 3);
/**
* (4) Applicable to tokens of type NON_FUNGIBLE_UNIQUE. The list of serial numbers to be wiped.
*/
public static final FieldDefinition SERIAL_NUMBERS = new FieldDefinition("serialNumbers", FieldType.INT64, true, false, false, 4);
// -- OTHER METHODS -------------------------------------------------
/**
* Check if a field definition belongs to this schema.
*
* @param f field def to check
* @return true if it belongs to this schema
*/
public static boolean valid(FieldDefinition f) {
return f != null && getField(f.number()) == f;
}
/**
* Get a field definition given a field number
*
* @param fieldNumber the fields number to get def for
* @return field def or null if field number does not exist
*/
public static FieldDefinition getField(final int fieldNumber) {
return switch(fieldNumber) {
case 1 -> TOKEN;
case 2 -> ACCOUNT;
case 3 -> AMOUNT;
case 4 -> SERIAL_NUMBERS;
default -> null;
};
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy