Class ImmutableWallet

java.lang.Object
org.xrpl.xrpl4j.crypto.core.wallet.ImmutableWallet
All Implemented Interfaces:
Wallet

@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableWallet extends Object implements Wallet
Immutable implementation of Wallet.

Use the builder to create immutable instances: ImmutableWallet.builder().

  • Method Details

    • privateKey

      public PrivateKey privateKey()
      The private key of the wallet, encoded in hexadecimal. Non-optional because wallets are only used when private keys are in-memory. For delegated key environments, wallet will not be used (instead just a PublicKey will be used).
      Specified by:
      privateKey in interface Wallet
      Returns:
      An optionally present PrivateKey containing a private key.
    • publicKey

      public PublicKey publicKey()
      The public key of this Wallet.
      Specified by:
      publicKey in interface Wallet
      Returns:
      A PublicKey containing the public key.
    • address

      public Address address()
      The XRPL address of this wallet, in the Classic Address form.
      Specified by:
      address in interface Wallet
      Returns:
      The classic Address of this wallet.
    • withPrivateKey

      public final ImmutableWallet withPrivateKey(PrivateKey value)
      Copy the current immutable object by setting a value for the privateKey attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for privateKey
      Returns:
      A modified copy of the this object
    • withPublicKey

      public final ImmutableWallet withPublicKey(PublicKey value)
      Copy the current immutable object by setting a value for the publicKey attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for publicKey
      Returns:
      A modified copy of the this object
    • withAddress

      public final ImmutableWallet withAddress(Address value)
      Copy the current immutable object by setting a value for the address attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for address
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ImmutableWallet that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: privateKey, publicKey, address.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value Wallet with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • copyOf

      public static ImmutableWallet copyOf(Wallet instance)
      Creates an immutable copy of a Wallet value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable Wallet instance
    • builder

      public static ImmutableWallet.Builder builder()
      Creates a builder for ImmutableWallet.
       ImmutableWallet.builder()
          .privateKey(org.xrpl.xrpl4j.crypto.core.keys.PrivateKey) // required privateKey
          .publicKey(org.xrpl.xrpl4j.crypto.core.keys.PublicKey) // required publicKey
          .address(org.xrpl.xrpl4j.model.transactions.Address) // required address
          .build();
       
      Returns:
      A new ImmutableWallet builder