Class LedgerId

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

public class LedgerId extends Object
Internal utility class for ledger id manipulation.
  • Field Details

    • MAINNET

      public static final LedgerId MAINNET
      The mainnet ledger id
    • TESTNET

      public static final LedgerId TESTNET
      The testnet ledger id
    • PREVIEWNET

      public static final LedgerId PREVIEWNET
      The previewnet ledger id
  • Constructor Details

    • LedgerId

      LedgerId(byte[] idBytes)
      Constructor.
      Parameters:
      idBytes - the id (0=mainnet, 1=testnet, 2=previewnet, ...)
  • Method Details

    • fromString

      public static LedgerId fromString(String string)
      Assign the ledger id via a string name or Hex encoded String.
      Parameters:
      string - the string containing the ledger id
      Returns:
      the ledger id
    • fromBytes

      public static LedgerId fromBytes(byte[] bytes)
      Create a ledger id from a byte array.
      Parameters:
      bytes - the byte array
      Returns:
      the ledger id
    • fromByteString

      static LedgerId fromByteString(com.google.protobuf.ByteString byteString)
      Create a ledger id from a string.
      Parameters:
      byteString - the string
      Returns:
      the ledger id
    • fromNetworkName

      @Deprecated public static LedgerId fromNetworkName(NetworkName networkName)
      Deprecated.
      Create a ledger id from a network name.
      Parameters:
      networkName - the network name
      Returns:
      the ledger id
    • isMainnet

      public boolean isMainnet()
      Are we on Mionnet?
      Returns:
      is it mainnet
    • isTestnet

      public boolean isTestnet()
      Are we on Testnet?
      Returns:
      is it testnet
    • isPreviewnet

      public boolean isPreviewnet()
      Are we on Previewnet?
      Returns:
      is it previewnet
    • isKnownNetwork

      boolean isKnownNetwork()
      Are we one of the three standard networks?
      Returns:
      is it one of the three standard networks
    • toString

      public String toString()
      Extract the string representation.
      Overrides:
      toString in class Object
      Returns:
      the string representation
    • toBytes

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

      com.google.protobuf.ByteString toByteString()
      Extract the byte string representation.
      Returns:
      the byte string representation
    • toNetworkName

      @Deprecated public NetworkName toNetworkName()
      Deprecated.
      Extract the network name.
      Returns:
      the network name
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object