Package org.symbol.sdk
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classProvides utility functions for finding a network. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionNetwork(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. -
Method Summary
Modifier and TypeMethodDescriptionfromDatetime(Instant referenceDatetime) Converts a datetime to a network timestamp.booleanisValidAddress(TAddress address) Checks if an address is valid and belongs to this network.booleanisValidAddressString(String addressString) Checks if an address string is valid and belongs to this network.publicKeyToAddress(CryptoTypes.PublicKey publicKey) Converts a public key to an address.toDatetime(TNetworkTimestamp referenceNetworkTimestamp) Converts a network timestamp to a datetime.toString()
-
Field Details
-
name
Network name. -
identifier
public final byte identifierNetwork 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
- Network.publicKeyToAddress
- Converts a public key to an address.
- Parameters:
publicKey- Public key to convert.- Returns:
- Address corresponding to the public key input.
-
isValidAddressString
- Network.isValidAddressString
- Checks if an address string is valid and belongs to this network.
- Parameters:
addressString- Address to check.- Returns:
trueif address is valid and belongs to this network.
-
isValidAddress
- Network.isValidAddress
- Checks if an address is valid and belongs to this network.
- Parameters:
address- Address to check.- Returns:
trueif address is valid and belongs to this network.
-
toDatetime
- 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
- Network.fromDatetime
- Converts a datetime to a network timestamp.
- Parameters:
referenceDatetime- Reference datetime to convert.- Returns:
- Network timestamp representation of the reference datetime.
-
toString
-