View Source Stellar.Horizon.Operations (Elixir Stellar SDK v0.22.0)
Exposes functions to interact with Operations in Horizon.
You can:
- Retrieve an operation.
- List all operations.
- List operation's effects.
- List all payments.
Horizon API reference: https://developers.stellar.org/api/resources/operations/
Summary
Functions
Lists all successful operations.
Lists the effects of a specific operation.
Lists successful payment-related operations.
Retrieves information of a specific operation.
Types
@type operation_id() :: String.t()
@type options() :: Keyword.t()
@type resource() :: Stellar.Horizon.Operation.t() | Stellar.Horizon.Collection.t()
@type response() :: {:ok, resource()} | {:error, Stellar.Horizon.Error.t()}
@type server() :: Stellar.Horizon.Server.t()
Functions
Lists all successful operations.
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 thepaging_token
value of a record.order
: A designation of the order in which records should appear. Options includeasc
(ascending) ordesc
(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 totransactions
to include the transactions which created each of the operations in the response.
Examples
iex> Operations.all(Stellar.Horizon.Server.testnet(), limit: 10, order: :asc)
{:ok, %Collection{records: [%Operation{}, ...]}}
# include failed
iex> Operations.all(Stellar.Horizon.Server.testnet(), limit: 10, include_failed: true)
{:ok, %Collection{records: [%Operation{}, ...]}}
# join transactions
iex> Operations.all(Stellar.Horizon.Server.testnet(), limit: 10, join: "transactions")
{:ok, %Collection{records: [%Operation{transaction: %Transaction{}}, ...]}}
@spec list_effects( server :: server(), operation_id :: operation_id(), options :: options() ) :: response()
Lists the effects of a specific operation.
Parameters
server
: The Horizon server to query.operation_id
: The ID number for the operation.
Options
cursor
: A number that points to a specific location in a collection of responses and is pulled from thepaging_token
value of a record.order
: A designation of the order in which records should appear. Options includeasc
(ascending) ordesc
(descending).limit
: The maximum number of records returned. The limit can range from 1 to 200. Defaults to 10.
Examples
iex> Operations.list_effects(Stellar.Horizon.Server.testnet(), 121693057904021505, limit: 20)
{:ok, %Collection{records: [%Effect{}, ...]}}
Lists successful payment-related operations.
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 thepaging_token
value of a record.order
: A designation of the order in which records should appear. Options includeasc
(ascending) ordesc
(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 totransactions
to include the transactions which created each of the operations in the response.
Examples
iex> Operations.list_payments(Stellar.Horizon.Server.testnet(), limit: 20)
{:ok, %Collection{records: [%Operation{body: %Payment{}}, ...]}}
@spec retrieve( server :: server(), operation_id :: operation_id(), options :: options() ) :: response()
Retrieves information of a specific operation.
Parameters:
server
: The Horizon server to query.operation_id
: The ID number for the operation.
Examples
iex> Operations.retrieve(Stellar.Horizon.Server.testnet(), 121693057904021505)
{:ok, %Operation{}}