View Source Stellar.Horizon.Ledgers (Elixir Stellar SDK v0.21.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

Link to this function

all(server, params \\ [])

View Source
@spec all(server :: server(), params :: params()) :: response()

Lists all ledgers.

Parameters:

  • server: The Horizon server to query.

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(Stellar.Horizon.Server.testnet(), limit: 10, order: :asc)
{:ok, %Collection{records: [%Ledger{}, ...]}}
Link to this function

list_effects(server, sequence, params \\ [])

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

Lists the effects of a specific ledger.

Parameters

  • server: The Horizon server to query.
  • 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(Stellar.Horizon.Server.testnet(), 27147222, limit: 20)
{:ok, %Collection{records: [%Effect{}, ...]}}
Link to this function

list_operations(server, sequence, params \\ [])

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

Lists successful operations in a specific ledger.

Parameters

  • server: The Horizon server to query.
  • 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(Stellar.Horizon.Server.testnet(), 27147222, limit: 20)
{:ok, %Collection{records: [%Operation{}, ...]}}

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

list_payments(server, sequence, params \\ [])

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

Lists successful payments in a specific ledger.

Parameters

  • server: The Horizon server to query.
  • 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(Stellar.Horizon.Server.testnet(), 27147222, limit: 20)
{:ok, %Collection{records: [%Operation{body: %Payment{}}, ...]}}

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

list_transactions(server, sequence, params \\ [])

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

Lists successful transactions in a specific ledger.

Parameters

  • server: The Horizon server to query.
  • 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(Stellar.Horizon.Server.testnet(), 27147222, limit: 20)
{:ok, %Collection{records: [%Transaction{}, ...]}}
Link to this function

retrieve(server, sequence)

View Source
@spec retrieve(server :: server(), sequence :: sequence()) :: response()

Retrieves information of a specific ledger.

Parameters:

  • server: The Horizon server to query.
  • sequence: The sequence number of a specific ledger.

Examples

iex> Ledgers.retrieve(Stellar.Horizon.Server.testnet(), 27147222)
{:ok, %Ledger{}}