View Source Stellar.Horizon.Ledgers (Elixir Stellar SDK v0.17.1)

Exposes functions to interact with Ledgers in Horizon.

You can:

  • Retrieve a ledger.
  • List all ledgers.
  • List a ledger's effects.
  • List a ledger's transactions.
  • List a ledger's operations.

Horizon API reference: https://developers.stellar.org/api/resources/ledgers/

Summary

Functions

Lists all ledgers.

Lists the effects of a specific ledger.

Lists successful operations in a specific ledger.

Lists successful payments in a specific ledger.

Lists successful transactions in a specific ledger.

Retrieves information of a specific ledger.

Types

Functions

@spec all(params :: params()) :: response()

Lists all ledgers.

Options

  • cursor: A number that points to a specific location in a collection of responses and is pulled from the paging_token value of a record.
  • order: A designation of the order in which records should appear. Options include asc (ascending) or desc (descending).
  • limit: The maximum number of records returned. The limit can range from 1 to 200. Defaults to 10.

Examples

iex> Ledgers.all(limit: 10, order: :asc)
{:ok, %Collection{records: [%Ledger{}, ...]}}
Link to this function

list_effects(sequence, params \\ [])

View Source
@spec list_effects(sequence :: sequence(), params :: params()) :: response()

Lists the effects of a specific ledger.

Parameters

  • sequence: The sequence number of a specific ledger.

Options

  • cursor: A number that points to a specific location in a collection of responses and is pulled from the paging_token value of a record.
  • order: A designation of the order in which records should appear. Options include asc (ascending) or desc (descending).
  • limit: The maximum number of records returned. The limit can range from 1 to 200. Defaults to 10.

Examples

iex> Ledgers.list_effects(27147222, limit: 20)
{:ok, %Collection{records: [%Effect{}, ...]}}
Link to this function

list_operations(sequence, params \\ [])

View Source
@spec list_operations(sequence :: sequence(), params :: params()) :: response()

Lists successful operations in a specific ledger.

Parameters

  • sequence: The sequence number of a specific ledger.

Options

  • cursor: A number that points to a specific location in a collection of responses and is pulled from the paging_token value of a record.
  • order: A designation of the order in which records should appear. Options include asc (ascending) or desc (descending).
  • limit: The maximum number of records returned. The limit can range from 1 to 200. Defaults to 10.
  • include_failed: Set to true to include failed operations in results.
  • join: Set to transactions to include the transactions which created each of the operations in the response.

Examples

iex> Ledgers.list_operations(27147222, limit: 20)
{:ok, %Collection{records: [%Operation{}, ...]}}

# join transactions
iex> Ledgers.list_operations(27147222, join: "transactions")
{:ok, %Collection{records: [%Operation{transaction: %Transaction{}}, ...]}}
Link to this function

list_payments(sequence, params \\ [])

View Source
@spec list_payments(sequence :: sequence(), params :: params()) :: response()

Lists successful payments in a specific ledger.

Parameters

  • sequence: The sequence number of a specific ledger.

Options

  • cursor: A number that points to a specific location in a collection of responses and is pulled from the paging_token value of a record.
  • order: A designation of the order in which records should appear. Options include asc (ascending) or desc (descending).
  • limit: The maximum number of records returned. The limit can range from 1 to 200. Defaults to 10.
  • include_failed: Set to true to include failed operations in results.
  • join: Set to transactions to include the transactions which created each of the operations in the response.

Examples

iex> Ledgers.list_payments(27147222, limit: 20)
{:ok, %Collection{records: [%Operation{body: %Payment{}}, ...]}}

# include failed
iex> Ledgers.list_payments(27147222, include_failed: true)
{:ok, %Collection{records: [%Operation{body: %Payment{}}, ...]}}
Link to this function

list_transactions(sequence, params \\ [])

View Source
@spec list_transactions(sequence :: sequence(), params :: params()) :: response()

Lists successful transactions in a specific ledger.

Parameters

  • sequence: The sequence number of a specific ledger.

Options

  • cursor: A number that points to a specific location in a collection of responses and is pulled from the paging_token value of a record.
  • order: A designation of the order in which records should appear. Options include asc (ascending) or desc (descending).
  • limit: The maximum number of records returned. The limit can range from 1 to 200. Defaults to 10.
  • include_failed: Set to true to include failed operations in results.

Examples

iex> Ledgers.list_transactions(27147222, limit: 20)
{:ok, %Collection{records: [%Transaction{}, ...]}}
@spec retrieve(sequence :: sequence()) :: response()

Retrieves information of a specific ledger.

Parameters:

  • sequence: The sequence number of a specific ledger.

Examples

iex> Ledgers.retrieve(27147222)
{:ok, %Ledger{}}