Last updated
Edit

account_channels

[Source]

(Added by the PayChan amendment.)

The account_channels method returns information about an account's Payment Channels. This includes only channels where the specified account is the channel's source, not the destination. (A channel's "source" and "owner" are the same.) All information retrieved is relative to a particular version of the ledger.

Request Format

An example of the request format:

{
  "id": 1,
  "command": "account_channels",
  "account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
  "destination_account": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
  "ledger_index": "validated"
}

The request includes the following parameters:

FieldTypeRequired?Description
accountString - AddressYesLook up channels where this account is the channel's owner/source.
destination_accountString - AddressNoA second account; if provided, filter results to payment channels whose destination is this account.
ledger_hashStringNoA 20-byte hex string for the ledger version to use. (See Specifying Ledgers)
ledger_indexNumber or StringNoThe ledger index of the ledger to use, or a shortcut string to choose a ledger automatically. (See Specifying Ledgers)
limitNumberNoLimit the number of transactions to retrieve. Cannot be less than 10 or more than 400. Positive values outside this range are replaced with the closest valid option. The default is 200.
markerMarkerNoValue from a previous paginated response. Resume retrieving data where that response left off.

Response Format

An example of a successful response:

{
  "id": 1,
  "result": {
    "account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
    "channels": [
      {
        "account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
        "amount": "1000",
        "balance": "0",
        "channel_id": "C7F634794B79DB40E87179A9D1BF05D05797AE7E92DF8E93FD6656E8C4BE3AE7",
        "destination_account": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
        "public_key": "aBR7mdD75Ycs8DRhMgQ4EMUEmBArF8SEh1hfjrT2V9DQTLNbJVqw",
        "public_key_hex": "03CFD18E689434F032A4E84C63E2A3A6472D684EAF4FD52CA67742F3E24BAE81B2",
        "settle_delay": 60
      }
    ],
    "ledger_hash": "1EDBBA3C793863366DF5B31C2174B6B5E6DF6DB89A7212B86838489148E2A581",
    "ledger_index": 71766314,
    "validated": true
  },
  "status": "success",
  "type": "response"
}

The response follows the standard format, with a successful result containing the following fields:

FieldTypeDescription
accountStringThe address of the source/owner of the payment channels. This corresponds to the account field of the request.
channelsArray of Channel ObjectsPayment channels owned by this account. Updated in: rippled 1.5.0
ledger_hashString(May be omitted) The identifying Hash of the ledger version used to generate this response.
ledger_indexNumberThe Ledger Index of the ledger version used to generate this response.
validatedBoolean(May be omitted) If true, the information in this response comes from a validated ledger version. Otherwise, the information is subject to change.
limitNumber(May be omitted) The limit to how many channel objects were actually returned by this request.
markerMarker(May be omitted) Server-defined value for pagination. Pass this to the next call to resume getting results where this call left off. Omitted when there are no additional pages after this one.

Each Channel Object has the following fields:

FieldTypeDescription
accountStringThe owner of the channel, as an Address.
amountStringThe total amount of XRP, in drops allocated to this channel.
balanceStringThe total amount of XRP, in drops, paid out from this channel, as of the ledger version used. (You can calculate the amount of XRP left in the channel by subtracting balance from amount.)
channel_idStringA unique ID for this channel, as a 64-character hexadecimal string. This is also the ID of the channel object in the ledger's state data.
destination_accountStringThe destination account of the channel, as an Address. Only this account can receive the XRP in the channel while it is open.
settle_delayUnsigned IntegerThe number of seconds the payment channel must stay open after the owner of the channel requests to close it.
public_keyString(May be omitted) The public key for the payment channel in the XRP Ledger's base58 format. Signed claims against this channel must be redeemed with the matching key pair.
public_key_hexString(May be omitted) The public key for the payment channel in hexadecimal format, if one was specified at channel creation. Signed claims against this channel must be redeemed with the matching key pair.
expirationUnsigned Integer(May be omitted) Time, in seconds since the Ripple Epoch, when this channel is set to expire. This expiration date is mutable. If this is before the close time of the most recent validated ledger, the channel is expired.
cancel_afterUnsigned Integer(May be omitted) Time, in seconds since the Ripple Epoch, of this channel's immutable expiration, if one was specified at channel creation. If this is before the close time of the most recent validated ledger, the channel is expired.
source_tagUnsigned Integer(May be omitted) A 32-bit unsigned integer to use as a source tag for payments through this payment channel, if one was specified at channel creation. This indicates the payment channel's originator or other purpose at the source account. Conventionally, if you bounce payments from this channel, you should specify this value in the DestinationTag of the return payment.
destination_tagUnsigned Integer(May be omitted) A 32-bit unsigned integer to use as a destination tag for payments through this channel, if one was specified at channel creation. This indicates the payment channel's beneficiary or other purpose at the destination account.

Possible Errors

  • Any of the universal error types.
  • invalidParams - One or more fields are specified incorrectly, or one or more required fields are missing.
  • actNotFound - The address specified in the account field of the request does not correspond to an account in the ledger.
  • lgrNotFound - The ledger specified by the ledger_hash or ledger_index does not exist, or it does exist but the server does not have it.