Docs

account_channels

(need to enable PayChan amendment) The account_channels method returns information about the account's payment channels. This only includes channels where the specified account is the channel source, not the destination. (The "source" and "owner" of a channel are the same.) All retrieved information is associated with a specific version of the ledger. Example of request format:
{
  "id": 1,
  "command": "account_channels",
  "account": "rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH",
  "destination_account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
  "ledger_index": "validated"
}
{
    "method": "account_channels",
    "params": [{
        "account": "rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH",
        "destination_account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
        "ledger_index": "validated"
    }]
}
#Syntax: account_channels <account> [<destination_account>] [<ledger>]
rippled account_channels rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn validated
The request contains the following parameters:
Field Type Description
account String The account's unique identifier, usually the account's address. This request returns channels for which this account is the channel owner/source.
destination_account String (Optional) A unique identifier for the account, typically the account's address. If provided, results are filtered to payment channels targeting this account.
ledger_hash String (Optional) A 20-byte hex string of the ledger version to use. (See Specifying Ledgers)
ledger_index String or Unsigned Integer (Optional) The sequence number or shortcut string of the ledger to use automatically selects the ledger. (See Specifying Ledgers)
limit Integer (Optional) Limit the number of transactions to retrieve. The server does not need to respect this value. Must be in the range of 10 to 400, defaults to 200.
marker (Not Specified) (optional)The value from the previous paginated response. Continue to recover data if this response stops.
An example of a successful response:
{
  "id": 2,
  "status": "success",
  "type": "response",
  "result": {
    "account": "rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH",
    "channels": [
      {
        "account": "rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH",
        "amount": "100000000",
        "balance": "1000000",
        "channel_id": "5DB01B7FFED6B67E6B0414DED11E051D2EE2B7619CE0EAA6286D67A3A4D5BDB3",
        "destination_account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
        "destination_tag": 20170428,
        "expiration": 547073182,
        "public_key": "aB44YfzW24VDEJQ2UuLPV2PvqcPCSoLnL7y5M1EzhdW4LnK5xMS3",
        "public_key_hex": "023693F15967AE357D0327974AD46FE3C127113B1110D6044FD41E723689F81CC6",
        "settle_delay": 86400
      }
    ],
    "ledger_hash": "F168208EECDAA57DDAC32780CDD8330FA3E89F0E84D27A9052AA2F88681EBD08",
    "ledger_index": 37230642,
    "validated": true
  }
}
200 OK

{
    "result": {
        "account": "rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH",
        "channels": [{
            "account": "rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH",
            "amount": "100000000",
            "balance": "0",
            "channel_id": "5DB01B7FFED6B67E6B0414DED11E051D2EE2B7619CE0EAA6286D67A3A4D5BDB3",
            "destination_account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
            "destination_tag": 20170428,
            "public_key": "aB44YfzW24VDEJQ2UuLPV2PvqcPCSoLnL7y5M1EzhdW4LnK5xMS3",
            "public_key_hex": "023693F15967AE357D0327974AD46FE3C127113B1110D6044FD41E723689F81CC6",
            "settle_delay": 86400
        }],
        "ledger_hash": "B9D3D80EDF4083A06B2D51202E0BFB63C46FC0985E015D06767C21A62853BF6D",
        "ledger_index": 37230600,
        "status": "success",
        "validated": true
    }
}
200 OK

{
    "result": {
        "account": "rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH",
        "channels": [{
            "account": "rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH",
            "amount": "100000000",
            "balance": "0",
            "channel_id": "5DB01B7FFED6B67E6B0414DED11E051D2EE2B7619CE0EAA6286D67A3A4D5BDB3",
            "destination_account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
            "destination_tag": 20170428,
            "public_key": "aB44YfzW24VDEJQ2UuLPV2PvqcPCSoLnL7y5M1EzhdW4LnK5xMS3",
            "public_key_hex": "023693F15967AE357D0327974AD46FE3C127113B1110D6044FD41E723689F81CC6",
            "settle_delay": 86400
        }],
        "ledger_hash": "B9D3D80EDF4083A06B2D51202E0BFB63C46FC0985E015D06767C21A62853BF6D",
        "ledger_index": 37230600,
        "status": "success",
        "validated": true
    }
}
Responses follow a standard format, with successful results containing the following fields:
Field Type Description
account String The address of the source/owner of the payment channel. This corresponds to the field requested by account.
channels Array of Channel Objects The payment channel owned by this account.
ledger_hash String The identification hash of the ledger version used to generate this response.
ledger_index Number The Ledger Index used to generate the ledger version of this response.
validated Boolean (May be ignored) If true, the information in this reply comes from a verified version of the ledger. Otherwise, the information may change.
limit Number (may be omitted) Limits how many channel objects are actually returned by this request.
marker (Not Specified) (can be omitted) Server-defined value for pagination. Pass this call to the next call to continue receiving results after this call ends. Omitted if there are no additional pages after this.
Each channel object has the following fields:
Field Type Description
account String The owner of the channel, as the address.
amount String The total amount of STM allocated to this channel.
balance String The total amount of STM paid from this channel as of the ledger version used. (The amount of STM left in the channel can be calculated by subtracting balance from amount).
channel_id String The unique identifier of this channel, which is a 64-character hexadecimal string. This is also the ID of the channel object in the ledger state data.
destination_account String The channel's target account serves as the address. Only this account can receive STM while the channel is open.
public_key String (can be omitted) The public key of the payment channel, in base58 format. Claims signed for this channel must be redeemed using a matching key pair.
public_key_hex String (can be omitted) In hexadecimal format if the public key of the payment channel is specified when creating the channel. Claims signed against this channel must be redeemed using a matching key pair.
settle_delay Unsigned Integer The number of seconds a payment channel must remain open after the channel owner requests that the channel be closed.
expiration Unsigned Integer (can be omitted) The time in seconds since the Stream Epoch that this channel is set to expire. This expiration date is variable. If this is before the closing time of the last verified ledger, the channel has expired.
cancel_after Unsigned Integer (can be omitted) The number of seconds since the Stream Epoch, if this channel's immutable expiration time (in seconds ) was specified when the channel was created. If this is before the closing time of the last verified ledger, the channel has expired.
source_tag Unsigned Integer (can be omitted) A 32-bit unsigned integer used as the source tag for payments made through this payment channel (if it was specified when the channel was created). This indicates the originator of the payment channel or other purpose in the source account. Generally, if you opt out of payments from this channel, you should specify a DestinationTag value in the return payment.
destination_tag Unsigned Integer (can be omitted) A 32-bit unsigned integer used as the destination flag for payments through this channel (if it was specified when the channel was created). This indicates the beneficiary of the payment channel or other use of the destination account.
Possible errors:
  • Any common error type.
  • invalidParams - One or more fields were specified incorrectly, or one or more required fields are missing.
  • actNotFound- The address specified in the account request field does not correspond to an account in the ledger.
  • lgrNotFound - A ledger created by ledger_hash or ledger_index that does not exist, or does exist but is not found by the server.
THE NEXT CONNECTION

Your next connection starts here.

Join the Stream community. Explore a connected world of value.

Get in touch