Class EntityIdHelper

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

public class EntityIdHelper extends Object
Utility class used internally by the sdk.
  • Field Details

    • SOLIDITY_ADDRESS_LEN

      static final int SOLIDITY_ADDRESS_LEN
      The length of a Solidity address in bytes.
      See Also:
    • SOLIDITY_ADDRESS_LEN_HEX

      static final int SOLIDITY_ADDRESS_LEN_HEX
      The length of a hexadecimal-encoded Solidity address, in ASCII characters (bytes).
      See Also:
    • MIRROR_NODE_CONNECTION_TIMEOUT

      static final Duration MIRROR_NODE_CONNECTION_TIMEOUT
  • Method Details

    • fromString

      static <R> R fromString(String idString, EntityIdHelper.WithIdNums<R> constructObjectWithIdNums)
      Generate an R object from a string.
      Type Parameters:
      R -
      Parameters:
      idString - the id string
      constructObjectWithIdNums - the R object generator
      Returns:
      the R type object
    • fromSolidityAddress

      static <R> R fromSolidityAddress(String address, EntityIdHelper.WithIdNums<R> withAddress)
      Generate an R object from a solidity address.
      Type Parameters:
      R -
      Parameters:
      address - the string representation
      withAddress - the R object generator
      Returns:
      the R type object
    • decodeEvmAddress

      static byte[] decodeEvmAddress(String address)
      Decode the solidity address from a string.
      Parameters:
      address - the string representation
      Returns:
      the decoded address
    • toSolidityAddress

      static String toSolidityAddress(long shard, long realm, long num)
      Generate a solidity address.
      Parameters:
      shard - the shard part
      realm - the realm part
      num - the num part
      Returns:
      the solidity address
    • checksum

      static String checksum(LedgerId ledgerId, String addr)
      Generate a checksum.
      Parameters:
      ledgerId - the ledger id
      addr - the address
      Returns:
      the checksum
    • validate

      static void validate(long shard, long realm, long num, Client client, @Nullable String checksum) throws BadEntityIdException
      Validate the configured client.
      Parameters:
      shard - the shard part
      realm - the realm part
      num - the num part
      client - the configured client
      checksum - the checksum
      Throws:
      BadEntityIdException
    • toString

      static String toString(long shard, long realm, long num)
      Generate a string representation.
      Parameters:
      shard - the shard part
      realm - the realm part
      num - the num part
      Returns:
      the string representation
    • toStringWithChecksum

      static String toStringWithChecksum(long shard, long realm, long num, Client client, @Nullable String checksum)
      Generate a string representation with a checksum.
      Parameters:
      shard - the shard part
      realm - the realm part
      num - the num part
      client - the configured client
      checksum - the checksum
      Returns:
      the string representation with checksum
    • isLongZeroAddress

      static boolean isLongZeroAddress(byte[] address)
      Takes an address as `byte[]` and returns whether this is a long-zero address
      Parameters:
      address -
      Returns:
    • getAccountNumFromMirrorNodeAsync

      static CompletableFuture<Long> getAccountNumFromMirrorNodeAsync(Client client, String evmAddress)
      Get AccountId num from mirror node using evm address.

      Note: This method requires API level 33 or higher. It will not work on devices running API versions below 33 because it uses features introduced in API level 33 (Android 13).

      *
      Parameters:
      client -
      evmAddress -
    • getEvmAddressFromMirrorNodeAsync

      public static CompletableFuture<EvmAddress> getEvmAddressFromMirrorNodeAsync(Client client, long num)
      Get EvmAddress from mirror node using account num.

      Note: This method requires API level 33 or higher. It will not work on devices running API versions below 33 because it uses features introduced in API level 33 (Android 13).

      *
      Parameters:
      client -
      num -
    • getContractNumFromMirrorNodeAsync

      public static CompletableFuture<Long> getContractNumFromMirrorNodeAsync(Client client, String evmAddress)
      Get ContractId num from mirror node using evm address.

      Note: This method requires API level 33 or higher. It will not work on devices running API versions below 33 because it uses features introduced in API level 33 (Android 13).

      *
      Parameters:
      client -
      evmAddress -
    • performQueryToMirrorNodeAsync

      static CompletableFuture<String> performQueryToMirrorNodeAsync(Client client, String apiEndpoint, String jsonBody)
    • performQueryToMirrorNodeAsync

      static CompletableFuture<String> performQueryToMirrorNodeAsync(String baseUrl, String apiEndpoint, String jsonBody)