Class Address

java.lang.Object
org.stellar.sdk.Address

public class Address extends Object
Represents a single address in the Stellar network. An address can represent an account or a contract.
  • Constructor Details

    • Address

      public Address(String address)
      Creates a new Address from a Stellar public key or contract ID.
      Parameters:
      address - the StrKey encoded format of Stellar public key or contract ID.
  • Method Details

    • fromAccount

      public static Address fromAccount(byte[] accountId)
      Creates a new Address from a Stellar public key.
      Parameters:
      accountId - the byte array of the Stellar public key.
      Returns:
      a new Address object from the given Stellar public key.
    • fromContract

      public static Address fromContract(byte[] contractId)
      Creates a new Address from a Stellar Contract ID.
      Parameters:
      contractId - the byte array of the Stellar Contract ID.
      Returns:
      a new Address object from the given Stellar Contract ID.
    • fromSCAddress

      public static Address fromSCAddress(SCAddress scAddress)
      Creates a new Address from a SCAddress XDR object.
      Parameters:
      scAddress - the SCAddress object to convert
      Returns:
      a new Address object from the given XDR object
    • fromSCVal

      public static Address fromSCVal(SCVal scVal)
      Creates a new Address from a SCVal XDR object.
      Parameters:
      scVal - the SCVal object to convert
      Returns:
      a new Address object from the given XDR object
    • toSCAddress

      public SCAddress toSCAddress()
      Converts this object to its SCAddress XDR object representation.
      Returns:
      a new SCAddress object from this object
    • toSCVal

      public SCVal toSCVal()
      Converts this object to its SCVal XDR object representation.
      Returns:
      a new SCVal object from this object
    • getBytes

      public byte[] getBytes()
      Returns the byte array of the Stellar public key or contract ID.
      Returns:
      the byte array of the Stellar public key or contract ID.
    • getAddressType

      public Address.AddressType getAddressType()
      Returns the type of this address.
      Returns:
      the type of this address.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object