Class ImmutablePayChannelObject

java.lang.Object
org.xrpl.xrpl4j.model.ledger.ImmutablePayChannelObject
All Implemented Interfaces:
LedgerObject, PayChannelObject

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

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

  • Method Details

    • ledgerEntryType

      public LedgerObject.LedgerEntryType ledgerEntryType()
      The type of ledger object, which is always "PayChannel".
      Specified by:
      ledgerEntryType in interface PayChannelObject
      Returns:
      Always LedgerObject.LedgerEntryType.PAY_CHANNEL.
    • flags

      public Flags flags()
      A bit-map of boolean flags enabled for this payment channel. Currently, the protocol defines no flags for PayChannel objects.
      Specified by:
      flags in interface PayChannelObject
      Returns:
      Always Flags.UNSET.
    • account

      public Address account()
      The source Address that owns this payment channel. This comes from the sending Address of the PaymentChannelCreate transaction that created the channel.
      Specified by:
      account in interface PayChannelObject
      Returns:
      The Address of the source account.
    • destination

      public Address destination()
      The destination Address for this payment channel. While the payment channel is open, this Address is the only one that can receive XRP from the channel. This comes from the PaymentChannelCreate.destination() field of the transaction that created the channel.
      Specified by:
      destination in interface PayChannelObject
      Returns:
      The Address of the destination account.
    • amount

      public XrpCurrencyAmount amount()
      Total XRP, in drops, that has been allocated to this channel. This includes XRP that has been paid to the destination() address. This is initially set by the PaymentChannelCreate transaction that created the channel and can be increased if the source address sends a PaymentChannelFund transaction.
      Specified by:
      amount in interface PayChannelObject
      Returns:
      An XrpCurrencyAmount representing the total amount allocated to this channel.
    • balance

      public XrpCurrencyAmount balance()
      Total XRP, in drops, already paid out by the channel. The difference between this value and the amount() field is how much XRP can still be paid to the destination() address with PaymentChannelClaim transactions. If the channel closes, the remaining difference is returned to the account() address.
      Specified by:
      balance in interface PayChannelObject
      Returns:
      An XrpCurrencyAmount representing the total amount paid out by this channel.
    • publicKey

      public String publicKey()
      Public key, in hexadecimal, of the key pair that can be used to sign claims against this channel. This can be any valid secp256k1 or Ed25519 public key. This is set by the PaymentChannelCreate transaction that created the channel and must match the public key used in claims against the channel. The channel account() can also send XRP from this channel to the destination() without signed claims.
      Specified by:
      publicKey in interface PayChannelObject
      Returns:
      A String containing the payment channel's public key.
    • settleDelay

      public com.google.common.primitives.UnsignedLong settleDelay()
      Number of seconds the source address must wait to close the channel if it still has any XRP in it. Smaller values mean that the destination() has less time to redeem any outstanding claims after the source address requests to close the channel.
      Specified by:
      settleDelay in interface PayChannelObject
      Returns:
      An UnsignedLong representing the settlement delay.
    • ownerNode

      public String ownerNode()
      A hint indicating which page of the source address's owner directory links to this object, in case the directory consists of multiple pages.
      Specified by:
      ownerNode in interface PayChannelObject
      Returns:
      A String containing the hint.
    • previousTransactionId

      public Hash256 previousTransactionId()
      The identifying hash of the transaction that most recently modified this object.
      Specified by:
      previousTransactionId in interface PayChannelObject
      Returns:
      A Hash256 containing the previous transaction hash.
    • previousTransactionLedgerSequence

      public com.google.common.primitives.UnsignedInteger previousTransactionLedgerSequence()
      The index of the ledger that contains the transaction that most recently modified this object.
      Specified by:
      previousTransactionLedgerSequence in interface PayChannelObject
      Returns:
      An UnsignedInteger representing the previous transaction ledger sequence.
    • expiration

      public Optional<com.google.common.primitives.UnsignedLong> expiration()
      The mutable expiration time for this payment channel, in seconds since the Ripple Epoch. The channel is expired if this value is present and smaller than the previous LedgerHeader.closeTime() field.
      Specified by:
      expiration in interface PayChannelObject
      Returns:
      An Optional of type UnsignedLong representing the expiration time.
    • cancelAfter

      public Optional<com.google.common.primitives.UnsignedLong> cancelAfter()
      The immutable expiration time for this payment channel, in seconds since the Ripple Epoch. This channel is expired if this value is present and smaller than the previous LedgerHeader.closeTime() field.
      Specified by:
      cancelAfter in interface PayChannelObject
      Returns:
      An Optional of type UnsignedLong representing the cancel after time.
    • sourceTag

      public Optional<com.google.common.primitives.UnsignedInteger> sourceTag()
      An arbitrary tag to further specify the account() for this payment channel, such as a hosted recipient at the owner's address.
      Specified by:
      sourceTag in interface PayChannelObject
      Returns:
      An Optional of type UnsignedInteger representing the tag of the source account.
    • destinationTag

      public Optional<com.google.common.primitives.UnsignedInteger> destinationTag()
      An arbitrary tag to further specify the destination() for this payment channel, such as a hosted recipient at the destination address.
      Specified by:
      destinationTag in interface PayChannelObject
      Returns:
      An Optional of type UnsignedInteger representing the tag of the destination account.
    • index

      public Hash256 index()
      Unique ID for this channel.
      Specified by:
      index in interface PayChannelObject
      Returns:
      A Hash256 containing the ID.
    • withAccount

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

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

      public final ImmutablePayChannelObject withAmount(XrpCurrencyAmount value)
      Copy the current immutable object by setting a value for the amount attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for amount
      Returns:
      A modified copy of the this object
    • withBalance

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

      public final ImmutablePayChannelObject 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
    • withSettleDelay

      public final ImmutablePayChannelObject withSettleDelay(com.google.common.primitives.UnsignedLong value)
      Copy the current immutable object by setting a value for the settleDelay attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for settleDelay
      Returns:
      A modified copy of the this object
    • withOwnerNode

      public final ImmutablePayChannelObject withOwnerNode(String value)
      Copy the current immutable object by setting a value for the ownerNode attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for ownerNode
      Returns:
      A modified copy of the this object
    • withPreviousTransactionId

      public final ImmutablePayChannelObject withPreviousTransactionId(Hash256 value)
      Copy the current immutable object by setting a value for the previousTransactionId attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for previousTransactionId
      Returns:
      A modified copy of the this object
    • withPreviousTransactionLedgerSequence

      public final ImmutablePayChannelObject withPreviousTransactionLedgerSequence(com.google.common.primitives.UnsignedInteger value)
      Copy the current immutable object by setting a value for the previousTransactionLedgerSequence attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for previousTransactionLedgerSequence
      Returns:
      A modified copy of the this object
    • withExpiration

      public final ImmutablePayChannelObject withExpiration(com.google.common.primitives.UnsignedLong value)
      Copy the current immutable object by setting a present value for the optional expiration attribute.
      Parameters:
      value - The value for expiration
      Returns:
      A modified copy of this object
    • withExpiration

      public final ImmutablePayChannelObject withExpiration(Optional<? extends com.google.common.primitives.UnsignedLong> optional)
      Copy the current immutable object by setting an optional value for the expiration 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 expiration
      Returns:
      A modified copy of this object
    • withCancelAfter

      public final ImmutablePayChannelObject withCancelAfter(com.google.common.primitives.UnsignedLong value)
      Copy the current immutable object by setting a present value for the optional cancelAfter attribute.
      Parameters:
      value - The value for cancelAfter
      Returns:
      A modified copy of this object
    • withCancelAfter

      public final ImmutablePayChannelObject withCancelAfter(Optional<? extends com.google.common.primitives.UnsignedLong> optional)
      Copy the current immutable object by setting an optional value for the cancelAfter 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 cancelAfter
      Returns:
      A modified copy of this object
    • withSourceTag

      public final ImmutablePayChannelObject withSourceTag(com.google.common.primitives.UnsignedInteger value)
      Copy the current immutable object by setting a present value for the optional sourceTag attribute.
      Parameters:
      value - The value for sourceTag
      Returns:
      A modified copy of this object
    • withSourceTag

      public final ImmutablePayChannelObject withSourceTag(Optional<? extends com.google.common.primitives.UnsignedInteger> optional)
      Copy the current immutable object by setting an optional value for the sourceTag 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 sourceTag
      Returns:
      A modified copy of this object
    • withDestinationTag

      public final ImmutablePayChannelObject withDestinationTag(com.google.common.primitives.UnsignedInteger value)
      Copy the current immutable object by setting a present value for the optional destinationTag attribute.
      Parameters:
      value - The value for destinationTag
      Returns:
      A modified copy of this object
    • withDestinationTag

      public final ImmutablePayChannelObject withDestinationTag(Optional<? extends com.google.common.primitives.UnsignedInteger> optional)
      Copy the current immutable object by setting an optional value for the destinationTag 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 destinationTag
      Returns:
      A modified copy of this object
    • withIndex

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

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ImmutablePayChannelObject 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: ledgerEntryType, flags, account, destination, amount, balance, publicKey, settleDelay, ownerNode, previousTransactionId, previousTransactionLedgerSequence, expiration, cancelAfter, sourceTag, destinationTag, index.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

      public static ImmutablePayChannelObject copyOf(PayChannelObject instance)
      Creates an immutable copy of a PayChannelObject 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 PayChannelObject instance
    • builder

      public static ImmutablePayChannelObject.Builder builder()
      Creates a builder for ImmutablePayChannelObject.
       ImmutablePayChannelObject.builder()
          .account(org.xrpl.xrpl4j.model.transactions.Address) // required account
          .destination(org.xrpl.xrpl4j.model.transactions.Address) // required destination
          .amount(org.xrpl.xrpl4j.model.transactions.XrpCurrencyAmount) // required amount
          .balance(org.xrpl.xrpl4j.model.transactions.XrpCurrencyAmount) // required balance
          .publicKey(String) // required publicKey
          .settleDelay(com.google.common.primitives.UnsignedLong) // required settleDelay
          .ownerNode(String) // required ownerNode
          .previousTransactionId(org.xrpl.xrpl4j.model.transactions.Hash256) // required previousTransactionId
          .previousTransactionLedgerSequence(com.google.common.primitives.UnsignedInteger) // required previousTransactionLedgerSequence
          .expiration(com.google.common.primitives.UnsignedLong) // optional expiration
          .cancelAfter(com.google.common.primitives.UnsignedLong) // optional cancelAfter
          .sourceTag(com.google.common.primitives.UnsignedInteger) // optional sourceTag
          .destinationTag(com.google.common.primitives.UnsignedInteger) // optional destinationTag
          .index(org.xrpl.xrpl4j.model.transactions.Hash256) // required index
          .build();
       
      Returns:
      A new ImmutablePayChannelObject builder