Package org.xrpl.xrpl4j.model.ledger
Interface PayChannelObject
- All Superinterfaces:
LedgerObject
- All Known Implementing Classes:
ImmutablePayChannelObject
The PayChannel object type represents a payment channel. Payment channels enable small, rapid off-ledger payments of
XRP that can be later reconciled with the consensus ledger. A payment channel holds a balance of XRP that can only
be paid out to a specific destination address until the channel is closed. Any unspent XRP is returned to the
channel's owner (the source address that created and funded it) when the channel closes.
The PaymentChannelCreate transaction type creates a PayChannel object.
The PaymentChannelFund and
PaymentChannelClaim transaction types modify existing PayChannel objects.
When a payment channel expires, at first it remains on the ledger, because only new transactions can modify
ledger contents. Transaction processing automatically closes a payment channel when any transaction accesses it
after the expiration. To close an expired channel and return the unspent XRP to the owner, some address must send
a new PaymentChannelClaim or
PaymentChannelFund transaction accessing the channel.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.xrpl.xrpl4j.model.ledger.LedgerObject
LedgerObject.LedgerEntryType -
Method Summary
Modifier and TypeMethodDescriptionaccount()The sourceAddressthat owns this payment channel.amount()Total XRP, in drops, that has been allocated to this channel.balance()Total XRP, in drops, already paid out by the channel.builder()Construct a builder for this class.Optional<com.google.common.primitives.UnsignedLong> The immutable expiration time for this payment channel, in seconds since the Ripple Epoch.The destinationAddressfor this payment channel.Optional<com.google.common.primitives.UnsignedInteger> An arbitrary tag to further specify thedestination()for this payment channel, such as a hosted recipient at the destination address.Optional<com.google.common.primitives.UnsignedLong> The mutable expiration time for this payment channel, in seconds since the Ripple Epoch.default Flagsflags()A bit-map of boolean flags enabled for this payment channel.index()Unique ID for this channel.default LedgerObject.LedgerEntryTypeThe type of ledger object, which is always "PayChannel".A hint indicating which page of the source address's owner directory links to this object, in case the directory consists of multiple pages.The identifying hash of the transaction that most recently modified this object.com.google.common.primitives.UnsignedIntegerThe index of the ledger that contains the transaction that most recently modified this object.Public key, in hexadecimal, of the key pair that can be used to sign claims against this channel.com.google.common.primitives.UnsignedLongNumber of seconds the source address must wait to close the channel if it still has any XRP in it.Optional<com.google.common.primitives.UnsignedInteger> An arbitrary tag to further specify theaccount()for this payment channel, such as a hosted recipient at the owner's address.
-
Method Details
-
builder
Construct a builder for this class.- Returns:
- An
ImmutablePayChannelObject.Builder.
-
ledgerEntryType
The type of ledger object, which is always "PayChannel".- Returns:
- Always
LedgerObject.LedgerEntryType.PAY_CHANNEL.
-
flags
A bit-map of boolean flags enabled for this payment channel. Currently, the protocol defines no flags for PayChannel objects.- Returns:
- Always
Flags.UNSET.
-
account
Address account()The sourceAddressthat owns this payment channel. This comes from the sendingAddressof thePaymentChannelCreatetransaction that created the channel.- Returns:
- The
Addressof the source account.
-
destination
Address destination()The destinationAddressfor this payment channel. While the payment channel is open, thisAddressis the only one that can receive XRP from the channel. This comes from thePaymentChannelCreate.destination()field of the transaction that created the channel.- Returns:
- The
Addressof the destination account.
-
amount
XrpCurrencyAmount amount()Total XRP, in drops, that has been allocated to this channel. This includes XRP that has been paid to thedestination()address. This is initially set by thePaymentChannelCreatetransaction that created the channel and can be increased if the source address sends aPaymentChannelFundtransaction.- Returns:
- An
XrpCurrencyAmountrepresenting the total amount allocated to this channel.
-
balance
XrpCurrencyAmount balance()Total XRP, in drops, already paid out by the channel. The difference between this value and theamount()field is how much XRP can still be paid to thedestination()address withPaymentChannelClaimtransactions. If the channel closes, the remaining difference is returned to theaccount()address.- Returns:
- An
XrpCurrencyAmountrepresenting the total amount paid out by this channel.
-
publicKey
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 thePaymentChannelCreatetransaction that created the channel and must match the public key used in claims against the channel. The channelaccount()can also send XRP from this channel to thedestination()without signed claims.- Returns:
- A
Stringcontaining the payment channel's public key.
-
settleDelay
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 thedestination()has less time to redeem any outstanding claims after the source address requests to close the channel.- Returns:
- An
UnsignedLongrepresenting the settlement delay.
-
ownerNode
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.- Returns:
- A
Stringcontaining the hint.
-
previousTransactionId
Hash256 previousTransactionId()The identifying hash of the transaction that most recently modified this object.- Returns:
- A
Hash256containing the previous transaction hash.
-
previousTransactionLedgerSequence
com.google.common.primitives.UnsignedInteger previousTransactionLedgerSequence()The index of the ledger that contains the transaction that most recently modified this object.- Returns:
- An
UnsignedIntegerrepresenting the previous transaction ledger sequence.
-
expiration
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 previousLedgerHeader.closeTime()field.- Returns:
- An
Optionalof typeUnsignedLongrepresenting the expiration time.
-
cancelAfter
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 previousLedgerHeader.closeTime()field.- Returns:
- An
Optionalof typeUnsignedLongrepresenting the cancel after time.
-
sourceTag
Optional<com.google.common.primitives.UnsignedInteger> sourceTag()An arbitrary tag to further specify theaccount()for this payment channel, such as a hosted recipient at the owner's address.- Returns:
- An
Optionalof typeUnsignedIntegerrepresenting the tag of the source account.
-
destinationTag
Optional<com.google.common.primitives.UnsignedInteger> destinationTag()An arbitrary tag to further specify thedestination()for this payment channel, such as a hosted recipient at the destination address.- Returns:
- An
Optionalof typeUnsignedIntegerrepresenting the tag of the destination account.
-
index
Hash256 index()Unique ID for this channel.- Returns:
- A
Hash256containing the ID.
-