Class Network<TAddress extends ByteArray,TNetworkTimestamp extends NetworkTimestamp.Base>

java.lang.Object
org.symbol.sdk.Network<TAddress,TNetworkTimestamp>
Type Parameters:
TAddress - Address type.
TNetworkTimestamp - Network timestamp type.
Direct Known Subclasses:
Network

public class Network<TAddress extends ByteArray,TNetworkTimestamp extends NetworkTimestamp.Base> extends Object
Network
Represents a network.
  • Field Details

    • name

      public final String name
      Network name.
    • identifier

      public final byte identifier
      Network identifier byte.
  • Constructor Details

    • Network

      public Network(String name, byte identifier, NetworkTimestamp.NetworkTimestampDatetimeConverter datetimeConverter, Supplier<org.bouncycastle.crypto.Digest> addressHasher, BiFunction<byte[],byte[],TAddress> createAddress, int addressEncodedSize, Function<String,TAddress> addressFromString, Function<Long,TNetworkTimestamp> networkTimestampFactory)
      Creates a new network with the specified name and identifier byte.
      Parameters:
      name - Network name.
      identifier - Network identifier byte.
      datetimeConverter - Network timestamp datetime converter associated with this network.
      addressHasher - Factory of the primary hasher to use in the public-key-to-address conversion.
      createAddress - Creates an encoded address from an address-without-checksum and checksum bytes.
      addressEncodedSize - Encoded address size of the address class.
      addressFromString - Constructs an address instance from an encoded base32 string.
      networkTimestampFactory - Constructs a network timestamp from a raw value.
  • Method Details

    • publicKeyToAddress

      public TAddress publicKeyToAddress(CryptoTypes.PublicKey publicKey)
      Network.publicKeyToAddress
      Converts a public key to an address.
      Parameters:
      publicKey - Public key to convert.
      Returns:
      Address corresponding to the public key input.
    • isValidAddressString

      public boolean isValidAddressString(String addressString)
      Network.isValidAddressString
      Checks if an address string is valid and belongs to this network.
      Parameters:
      addressString - Address to check.
      Returns:
      true if address is valid and belongs to this network.
    • isValidAddress

      public boolean isValidAddress(TAddress address)
      Network.isValidAddress
      Checks if an address is valid and belongs to this network.
      Parameters:
      address - Address to check.
      Returns:
      true if address is valid and belongs to this network.
    • toDatetime

      public Instant toDatetime(TNetworkTimestamp referenceNetworkTimestamp)
      Network.toDatetime
      Converts a network timestamp to a datetime.
      Parameters:
      referenceNetworkTimestamp - Reference network timestamp to convert.
      Returns:
      Datetime representation of the reference network timestamp.
    • fromDatetime

      public TNetworkTimestamp fromDatetime(Instant referenceDatetime)
      Network.fromDatetime
      Converts a datetime to a network timestamp.
      Parameters:
      referenceDatetime - Reference datetime to convert.
      Returns:
      Network timestamp representation of the reference datetime.
    • toString

      public String toString()
      Overrides:
      toString in class Object