Package org.xrpl.xrpl4j.codec.addresses
Class AddressCodec
java.lang.Object
org.xrpl.xrpl4j.codec.addresses.AddressCodec
A Codec for encoding/decoding various address primitives.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclassicAddressToXAddress(Address classicAddress, boolean test) Converts an XRPL Classic Address with no Destination Tag to an X-Address.classicAddressToXAddress(Address classicAddress, com.google.common.primitives.UnsignedInteger tag, boolean test) Converts an XRPL Classic Address and Destination Tag to an X-Address.classicAddressToXAddress(Address classicAddress, Optional<com.google.common.primitives.UnsignedInteger> tag, boolean test) Converts an XRPL Classic Address and and optional Destination Tag to an X-Address.decodeAccountId(Address accountId) Decode a Base58Check encoded XRPL AccountID.decodeNodePublicKey(String publicKey) Deprecated.decodeXAddress(XAddress xAddress) Decodes an X-Address to an AccountID, destination tag, and a boolean for XRPL-testnet or XRPL-mainnet.encodeAccountId(UnsignedByteArray accountId) Encode an XRPL AccountID to a Base58Check encodedString.encodeNodePublicKey(UnsignedByteArray publicKey) Deprecated.encodeXAddress(UnsignedByteArray accountId, Optional<com.google.common.primitives.UnsignedInteger> tag, boolean test) Encodes and AccountID, destination tag, and the XRPL network into an X-Address.static AddressCodecbooleanisValidClassicAddress(Address address) Tests if the given Address is a valid Classic Address.booleanisValidXAddress(XAddress xAddress) Tests if the given X-Address is a valid X-Address.xAddressToClassicAddress(XAddress xAddress) Decodes an X-Address to a Classic Address and Destination Tag.
-
Constructor Details
-
AddressCodec
public AddressCodec()
-
-
Method Details
-
getInstance
-
encodeAccountId
Encode an XRPL AccountID to a Base58Check encodedString.- Parameters:
accountId- AnUnsignedByteArraycontaining the AccountID to be encoded.- Returns:
- The Base58 representation of accountId, as an
Address.
-
decodeAccountId
Decode a Base58Check encoded XRPL AccountID.- Parameters:
accountId- The Base58 encoded AccountID to be decoded, as anAddress.- Returns:
- An
UnsignedByteArraycontaining the decoded AccountID. - See Also:
-
encodeNodePublicKey
Deprecated.Encode an XRPL Node Public Key to a Base58Check encodedString.- Parameters:
publicKey- AnUnsignedByteArraycontaining the public key to be encoded.- Returns:
- The Base58 representation of publicKey.
-
decodeNodePublicKey
Deprecated.Decode a Base58Check encoded XRPL Node Public Key.- Parameters:
publicKey- The Base58 encoded public key to be decoded.- Returns:
- An
UnsignedByteArraycontaining the decoded public key. - See Also:
-
classicAddressToXAddress
public XAddress classicAddressToXAddress(Address classicAddress, com.google.common.primitives.UnsignedInteger tag, boolean test) Converts an XRPL Classic Address and Destination Tag to an X-Address.- Parameters:
classicAddress- AStringcontaining the classic address.tag- The destination tag of the address.test-trueif the X-Address should be encoded for Testnet,falseif it should be encoded for Mainnet.- Returns:
- The X-Address representation of the classic address and destination tag.
-
classicAddressToXAddress
Converts an XRPL Classic Address with no Destination Tag to an X-Address. -
classicAddressToXAddress
public XAddress classicAddressToXAddress(Address classicAddress, Optional<com.google.common.primitives.UnsignedInteger> tag, boolean test) Converts an XRPL Classic Address and and optional Destination Tag to an X-Address.- Parameters:
classicAddress- AnAddresscontaining the classic address.tag- The destination tag of the address.test-trueif the X-Address should be encoded for Testnet,falseif it should be encoded for Mainnet.- Returns:
- The X-Address representation of the classic address and destination tag, as an
XAddress.
-
encodeXAddress
public XAddress encodeXAddress(UnsignedByteArray accountId, Optional<com.google.common.primitives.UnsignedInteger> tag, boolean test) Encodes and AccountID, destination tag, and the XRPL network into an X-Address.- Parameters:
accountId- AnUnsignedByteArraycontaining an XRPL AccountID.tag- (Optional) The destination tag of the account.test-trueif the X-Address should be encoded for Testnet,falseif it should be encoded for Mainnet.- Returns:
- The X-Address representation of the AccountID and destination tag, as an
XAddress.
-
xAddressToClassicAddress
Decodes an X-Address to a Classic Address and Destination Tag.- Parameters:
xAddress- TheXAddressto be decoded.- Returns:
- The
ClassicAddressdecoded from xAddress.
-
decodeXAddress
Decodes an X-Address to an AccountID, destination tag, and a boolean for XRPL-testnet or XRPL-mainnet.- Parameters:
xAddress- TheXAddressto be decoded.- Returns:
- The
DecodedXAddressdecoded from xAddress.
-
isValidXAddress
Tests if the given X-Address is a valid X-Address.- Parameters:
xAddress- A potentially validXAddress.- Returns:
trueif the given address is a valid X-Address,falseif not.
-
isValidClassicAddress
Tests if the given Address is a valid Classic Address.- Parameters:
address- A potentially valid classicAddress.- Returns:
trueif the given address is a valid Classic Address,falseif not.
-
PublicKeyCodec.decodeNodePublicKey(String).