Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package com.hedera.hapi.node.base.schema;
import com.hedera.pbj.runtime.FieldDefinition;
import com.hedera.pbj.runtime.FieldType;
import com.hedera.pbj.runtime.Schema;
/**
* Schema for NodeAddress model object. Generate based on protobuf schema.
*/
public final class NodeAddressSchema implements Schema {
// -- FIELD DEFINITIONS ---------------------------------------------
/**
* (1) The IP address of the Node with separator & octets encoded in UTF-8. Usage is deprecated,
* ServiceEndpoint is preferred to retrieve a node's list of IP addresses and ports
*/
public static final FieldDefinition IP_ADDRESS = new FieldDefinition("ipAddress", FieldType.BYTES, false, false, false, 1);
/**
* (2) The port number of the grpc server for the node. Usage is deprecated, ServiceEndpoint is
* preferred to retrieve a node's list of IP addresses and ports
*/
public static final FieldDefinition PORTNO = new FieldDefinition("portno", FieldType.INT32, false, false, false, 2);
/**
* (3) Usage is deprecated, nodeAccountId is preferred to retrieve a node's account ID
*/
public static final FieldDefinition MEMO = new FieldDefinition("memo", FieldType.BYTES, false, false, false, 3);
/**
* (4) The node's X509 RSA public key used to sign stream files (e.g., record stream
* files). Precisely, this field is a string of hexadecimal characters which,
* translated to binary, are the public key's DER encoding.
*/
public static final FieldDefinition RSA_PUBKEY = new FieldDefinition("RSA_PubKey", FieldType.STRING, false, false, false, 4);
/**
* (5) # A non-sequential identifier for the node
*/
public static final FieldDefinition NODE_ID = new FieldDefinition("nodeId", FieldType.INT64, false, false, false, 5);
/**
* (6) # The account to be paid for queries and transactions sent to this node
*/
public static final FieldDefinition NODE_ACCOUNT_ID = new FieldDefinition("nodeAccountId", FieldType.MESSAGE, false, false, false, 6);
/**
* (7) # Hash of the node's TLS certificate. Precisely, this field is a string of
* hexadecimal characters which, translated to binary, are the SHA-384 hash of
* the UTF-8 NFKD encoding of the node's TLS cert in PEM format. Its value can be
* used to verify the node's certificate it presents during TLS negotiations.
*/
public static final FieldDefinition NODE_CERT_HASH = new FieldDefinition("nodeCertHash", FieldType.BYTES, false, false, false, 7);
/**
* (8) # A node's service IP addresses and ports
*/
public static final FieldDefinition SERVICE_ENDPOINT = new FieldDefinition("serviceEndpoint", FieldType.MESSAGE, true, false, false, 8);
/**
* (9) A description of the node, with UTF-8 encoding up to 100 bytes
*/
public static final FieldDefinition DESCRIPTION = new FieldDefinition("description", FieldType.STRING, false, false, false, 9);
/**
* (10) [Deprecated] The amount of tinybars staked to the node
*/
public static final FieldDefinition STAKE = new FieldDefinition("stake", FieldType.INT64, false, false, false, 10);
// -- 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 -> IP_ADDRESS;
case 2 -> PORTNO;
case 3 -> MEMO;
case 4 -> RSA_PUBKEY;
case 5 -> NODE_ID;
case 6 -> NODE_ACCOUNT_ID;
case 7 -> NODE_CERT_HASH;
case 8 -> SERVICE_ENDPOINT;
case 9 -> DESCRIPTION;
case 10 -> STAKE;
default -> null;
};
}
}