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
-
Method Summary
Modifier and TypeMethodDescriptionclassicAddressToXAddress
(Address classicAddress, boolean test) Deprecated.X-Address support will be removed in a future version.classicAddressToXAddress
(Address classicAddress, com.google.common.primitives.UnsignedInteger tag, boolean test) Deprecated.X-Address support will be removed in a future version.classicAddressToXAddress
(Address classicAddress, Optional<com.google.common.primitives.UnsignedInteger> tag, boolean test) Deprecated.X-Address support will be removed in a future version.decodeAccountId
(Address accountId) Decode a Base58Check encoded XRPL AccountID.decodeAccountPublicKey
(String publicKey) Deprecated.This will be replaced by a PublicKeyCodec or KeyCodec.decodeNodePublicKey
(String publicKey) Deprecated.This will be replaced by a PublicKeyCodec or KeyCodec.decodeSeed
(String seed) Deprecated.Prefer the variant inSeedCodec
instead.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
.encodeAccountPublicKey
(UnsignedByteArray publicKey) Deprecated.This will be replaced by a PublicKeyCodec or KeyCodec.encodeNodePublicKey
(UnsignedByteArray publicKey) Deprecated.This will be replaced by a PublicKeyCodec or KeyCodec.encodeSeed
(UnsignedByteArray entropy, VersionType type) Deprecated.Prefer the variant inSeedCodec
instead.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 AddressCodec
boolean
isValidClassicAddress
(Address address) Deprecated.Prefer the variant in AddressService instead.boolean
isValidXAddress
(XAddress xAddress) Deprecated.Prefer the variant in AddressService instead.xAddressToClassicAddress
(XAddress xAddress) Deprecated.Prefer the variant in AddressService instead.
-
Constructor Details
-
AddressCodec
public AddressCodec()
-
-
Method Details
-
getInstance
-
decodeSeed
Deprecated.Prefer the variant inSeedCodec
instead.Decodes a Base58Check encoded XRPL secret key seed value. Works for ed25519 and secp256k1 seeds.- Parameters:
seed
- A Base58Check encoded XRPL keypair seed.- Returns:
- The decoded seed, seed type, and algorithm used to encode the seed.
- Throws:
EncodingFormatException
- See Also:
-
- "https://xrpl.org/cryptographic-keys.html#seed"
-
encodeSeed
Deprecated.Prefer the variant inSeedCodec
instead.Encodes a byte array to a Base58CheckString
using the givenVersionType
.- Parameters:
entropy
- AnUnsignedByteArray
containing the seed entropy to encode.type
- The cryptographic algorithm type to be encoded in the resulting seed.- Returns:
- A Base58Check encoded XRPL keypair seed.
-
encodeAccountId
Encode an XRPL AccountID to a Base58Check encodedString
.- Parameters:
accountId
- AnUnsignedByteArray
containing 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
UnsignedByteArray
containing the decoded AccountID. - See Also:
-
- "https://xrpl.org/base58-encodings.html"
-
encodeNodePublicKey
Deprecated.This will be replaced by a PublicKeyCodec or KeyCodec.Encode an XRPL Node Public Key to a Base58Check encodedString
.- Parameters:
publicKey
- AnUnsignedByteArray
containing the public key to be encoded.- Returns:
- The Base58 representation of publicKey.
-
decodeNodePublicKey
Deprecated.This will be replaced by a PublicKeyCodec or KeyCodec.Decode a Base58Check encoded XRPL Node Public Key.- Parameters:
publicKey
- The Base58 encoded public key to be decoded.- Returns:
- An
UnsignedByteArray
containing the decoded public key. - See Also:
-
- "https://xrpl.org/base58-encodings.html"
-
encodeAccountPublicKey
Deprecated.This will be replaced by a PublicKeyCodec or KeyCodec.Encode an XRPL Account Public Key to a Base58Check encodedString
.- Parameters:
publicKey
- AnUnsignedByteArray
containing the public key to be encoded.- Returns:
- The Base58 representation of publicKey.
-
decodeAccountPublicKey
Deprecated.This will be replaced by a PublicKeyCodec or KeyCodec.Decode a Base58Check encoded XRPL Account Public Key.- Parameters:
publicKey
- The Base58 encoded public key to be decoded.- Returns:
- An
UnsignedByteArray
containing the decoded public key. - See Also:
-
- "https://xrpl.org/base58-encodings.html"
-
classicAddressToXAddress
@Deprecated public XAddress classicAddressToXAddress(Address classicAddress, com.google.common.primitives.UnsignedInteger tag, boolean test) Deprecated.X-Address support will be removed in a future version.Converts an XRPL Classic Address and Destination Tag to an X-Address.- Parameters:
classicAddress
- AString
containing the classic address.tag
- The destination tag of the address.test
-true
if the X-Address should be encoded for Testnet,false
if it should be encoded for Mainnet.- Returns:
- The X-Address representation of the classic address and destination tag.
-
classicAddressToXAddress
Deprecated.X-Address support will be removed in a future version.Converts an XRPL Classic Address with no Destination Tag to an X-Address. -
classicAddressToXAddress
@Deprecated public XAddress classicAddressToXAddress(Address classicAddress, Optional<com.google.common.primitives.UnsignedInteger> tag, boolean test) Deprecated.X-Address support will be removed in a future version.Converts an XRPL Classic Address and and optional Destination Tag to an X-Address.- Parameters:
classicAddress
- AnAddress
containing the classic address.tag
- The destination tag of the address.test
-true
if the X-Address should be encoded for Testnet,false
if 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
- AnUnsignedByteArray
containing an XRPL AccountID.tag
- (Optional) The destination tag of the account.test
-true
if the X-Address should be encoded for Testnet,false
if it should be encoded for Mainnet.- Returns:
- The X-Address representation of the AccountID and destination tag, as an
XAddress
.
-
xAddressToClassicAddress
Deprecated.Prefer the variant in AddressService instead.Decodes an X-Address to a Classic Address and Destination Tag.- Parameters:
xAddress
- TheXAddress
to be decoded.- Returns:
- The
ClassicAddress
decoded from xAddress.
-
decodeXAddress
Decodes an X-Address to an AccountID, destination tag, and a boolean for XRPL-testnet or XRPL-mainnet.- Parameters:
xAddress
- TheXAddress
to be decoded.- Returns:
- The
DecodedXAddress
decoded from xAddress.
-
isValidXAddress
Deprecated.Prefer the variant in AddressService instead.Tests if the given X-Address is a valid X-Address.- Parameters:
xAddress
- A potentially validXAddress
.- Returns:
true
if the given address is a valid X-Address,false
if not.
-
isValidClassicAddress
Deprecated.Prefer the variant in AddressService instead.Tests if the given Address is a valid Classic Address.- Parameters:
address
- A potentially valid classicAddress
.- Returns:
true
if the given address is a valid Classic Address,false
if not.
-