Class ImmutableWallet

java.lang.Object
org.xrpl.xrpl4j.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

      @Deprecated public Optional<String> privateKey()
      Deprecated.
      This method will be removed in a future version. Consider storing private keys in an associated instance of TransactionSigner.
      The private key of the wallet, encoded in hexadecimal.
      Specified by:
      privateKey in interface Wallet
      Returns:
      An optionally present String containing a private key.
    • publicKey

      public String publicKey()
      The public key of the wallet, encoded in hexadecimal.
      Specified by:
      publicKey in interface Wallet
      Returns:
      A String containing a public key.
    • classicAddress

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

      public XAddress xAddress()
      The XRPL address of this wallet, in the X-Address form.
      Specified by:
      xAddress in interface Wallet
      Returns:
      An XAddress containing the X-Address of this wallet.
    • isTest

      public boolean isTest()
      Whether or not this wallet is on XRPL testnet or mainnet.
      Specified by:
      isTest in interface Wallet
      Returns:
      A boolean indicating if this is a testnet or mainnet wallet.
    • withPrivateKey

      @Deprecated public final ImmutableWallet withPrivateKey(String value)
      Deprecated.
      Copy the current immutable object by setting a present value for the optional privateKey attribute.
      Parameters:
      value - The value for privateKey
      Returns:
      A modified copy of this object
    • withPrivateKey

      @Deprecated public final ImmutableWallet withPrivateKey(Optional<String> optional)
      Deprecated.
      Copy the current immutable object by setting an optional value for the privateKey attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for privateKey
      Returns:
      A modified copy of this object
    • withPublicKey

      public final ImmutableWallet withPublicKey(String value)
      Copy the current immutable object by setting a value for the publicKey attribute. An equals check 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
    • withClassicAddress

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

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

      public final ImmutableWallet withIsTest(boolean value)
      Copy the current immutable object by setting a value for the isTest attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for isTest
      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, classicAddress, xAddress, isTest.
      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(String) // optional privateKey
          .publicKey(String) // required publicKey
          .classicAddress(org.xrpl.xrpl4j.model.transactions.Address) // required classicAddress
          .xAddress(org.xrpl.xrpl4j.model.transactions.XAddress) // required xAddress
          .isTest(boolean) // required isTest
          .build();
       
      Returns:
      A new ImmutableWallet builder