Class AddressCodec

java.lang.Object
org.xrpl.xrpl4j.codec.addresses.AddressCodec

public class AddressCodec extends Object
A Codec for encoding/decoding various address primitives.
  • Constructor Details

    • AddressCodec

      public AddressCodec()
  • Method Details

    • getInstance

      public static AddressCodec getInstance()
    • decodeSeed

      @Deprecated public Decoded decodeSeed(String seed) throws EncodingFormatException
      Deprecated.
      Prefer the variant in SeedCodec 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 public String encodeSeed(UnsignedByteArray entropy, VersionType type)
      Deprecated.
      Prefer the variant in SeedCodec instead.
      Encodes a byte array to a Base58Check String using the given VersionType.
      Parameters:
      entropy - An UnsignedByteArray 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

      public Address encodeAccountId(UnsignedByteArray accountId)
      Encode an XRPL AccountID to a Base58Check encoded String.
      Parameters:
      accountId - An UnsignedByteArray containing the AccountID to be encoded.
      Returns:
      The Base58 representation of accountId, as an Address.
    • decodeAccountId

      public UnsignedByteArray decodeAccountId(Address accountId)
      Decode a Base58Check encoded XRPL AccountID.
      Parameters:
      accountId - The Base58 encoded AccountID to be decoded, as an Address.
      Returns:
      An UnsignedByteArray containing the decoded AccountID.
      See Also:
      • "https://xrpl.org/base58-encodings.html"
    • encodeNodePublicKey

      @Deprecated public String encodeNodePublicKey(UnsignedByteArray publicKey)
      Deprecated.
      This will be replaced by a PublicKeyCodec or KeyCodec.
      Encode an XRPL Node Public Key to a Base58Check encoded String.
      Parameters:
      publicKey - An UnsignedByteArray containing the public key to be encoded.
      Returns:
      The Base58 representation of publicKey.
    • decodeNodePublicKey

      @Deprecated public UnsignedByteArray decodeNodePublicKey(String publicKey)
      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 public String encodeAccountPublicKey(UnsignedByteArray publicKey)
      Deprecated.
      This will be replaced by a PublicKeyCodec or KeyCodec.
      Encode an XRPL Account Public Key to a Base58Check encoded String.
      Parameters:
      publicKey - An UnsignedByteArray containing the public key to be encoded.
      Returns:
      The Base58 representation of publicKey.
    • decodeAccountPublicKey

      @Deprecated public UnsignedByteArray decodeAccountPublicKey(String publicKey)
      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 - A String 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 public XAddress classicAddressToXAddress(Address classicAddress, boolean test)
      Deprecated.
      X-Address support will be removed in a future version.
      Converts an XRPL Classic Address with no Destination Tag to an X-Address.
      Parameters:
      classicAddress - An Address containing the classic 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, as an XAddress.
    • 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 - An Address 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 - An UnsignedByteArray 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 public ClassicAddress xAddressToClassicAddress(XAddress xAddress)
      Deprecated.
      Prefer the variant in AddressService instead.
      Decodes an X-Address to a Classic Address and Destination Tag.
      Parameters:
      xAddress - The XAddress to be decoded.
      Returns:
      The ClassicAddress decoded from xAddress.
    • decodeXAddress

      public DecodedXAddress decodeXAddress(XAddress xAddress)
      Decodes an X-Address to an AccountID, destination tag, and a boolean for XRPL-testnet or XRPL-mainnet.
      Parameters:
      xAddress - The XAddress to be decoded.
      Returns:
      The DecodedXAddress decoded from xAddress.
    • isValidXAddress

      @Deprecated public boolean isValidXAddress(XAddress xAddress)
      Deprecated.
      Prefer the variant in AddressService instead.
      Tests if the given X-Address is a valid X-Address.
      Parameters:
      xAddress - A potentially valid XAddress.
      Returns:
      true if the given address is a valid X-Address, false if not.
    • isValidClassicAddress

      @Deprecated public boolean isValidClassicAddress(Address address)
      Deprecated.
      Prefer the variant in AddressService instead.
      Tests if the given Address is a valid Classic Address.
      Parameters:
      address - A potentially valid classic Address.
      Returns:
      true if the given address is a valid Classic Address, false if not.