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

Exposes functions to interact with LiquidityPools in Horizon.

You can:

  • Retrieve a liquidity pool.
  • List all liquidity pools.
  • List a liquidity pool's effects.
  • List a liquidity pool's trades.
  • List a liquidity pool's transactions.
  • List a liquidity pool's operations.

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

Summary

Functions

Lists all available claimable balances.

Lists the effects of a specific liquidity pool.

Lists successful operations referencing a given liquidity pool.

Lists the successful trades fulfilled by the given liquidity pool.

Lists successful transactions referencing a given liquidity pool.

Retrieves information of a specific liquidity pool.

Types

@type liquidity_pool_id() :: String.t()
@type options() :: Keyword.t()
@type response() :: {:ok, resource()} | {:error, Stellar.Horizon.Error.t()}

Functions

@spec all(options :: options()) :: response()

Lists all available claimable balances.

Options

  • reserves: Comma-separated list of assets in canonical form “Code:IssuerAccountID”.
  • account: Account ID of the destination address.
  • 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> LiquidityPools.all(limit: 2, order: :asc)
{:ok, %Collection{records: [%LiquidityPool{}, ...]}}

# list by reserves
iex> LiquidityPools.all(reserves: "TEST:GCXMW..., TEST2:GCXMW...")
{:ok, %Collection{records: [%LiquidityPool{}, ...]}}

# list by account
iex> LiquidityPools.all(account: "GCXMWUAUF37IWOOV2FRDKWEX3O2IHLM2FYH4WPI4PYUKAIFQEUU5X3TD", order: :desc)
{:ok, %Collection{records: [%LiquidityPool{}, ...]}}
Link to this function

list_effects(liquidity_pool_id, options \\ [])

View Source
@spec list_effects(liquidity_pool_id :: liquidity_pool_id(), options :: options()) ::
  response()

Lists the effects of a specific liquidity pool.

Parameters

  • liquidity_pool_id: A liquidity pool’s id encoded in a hex string representation.

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> LiquidityPools.list_effects("001365fc79ca661f31ba3ee0849ae4ba36f5c377243242d37fad5b1bb8912dbc", limit: 20)
{:ok, %Collection{records: [%Effect{}, ...]}}
Link to this function

list_operations(liquidity_pool_id, options \\ [])

View Source
@spec list_operations(liquidity_pool_id :: liquidity_pool_id(), options :: options()) ::
  response()

Lists successful operations referencing a given liquidity pool.

Parameters

  • liquidity_pool_id: A liquidity pool’s id encoded in a hex string representation.

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> LiquidityPools.list_operations("001365fc79ca661f31ba3ee0849ae4ba36f5c377243242d37fad5b1bb8912dbc", limit: 20)
{:ok, %Collection{records: [%Operation{}, ...]}}

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

list_trades(liquidity_pool_id, options \\ [])

View Source
@spec list_trades(liquidity_pool_id :: liquidity_pool_id(), options :: options()) ::
  response()

Lists the successful trades fulfilled by the given liquidity pool.

Parameters

  • liquidity_pool_id: A liquidity pool’s id encoded in a hex string representation.

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> LiquidityPools.list_trades("001365fc79ca661f31ba3ee0849ae4ba36f5c377243242d37fad5b1bb8912dbc", limit: 20)
{:ok, %Collection{records: [%Trade{}, ...]}}
Link to this function

list_transactions(liquidity_pool_id, options \\ [])

View Source
@spec list_transactions(
  liquidity_pool_id :: liquidity_pool_id(),
  options :: options()
) :: response()

Lists successful transactions referencing a given liquidity pool.

Parameters

  • liquidity_pool_id: A liquidity pool’s id encoded in a hex string representation.

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> LiquidityPools.list_transactions("001365fc79ca661f31ba3ee0849ae4ba36f5c377243242d37fad5b1bb8912dbc", limit: 20)
{:ok, %Collection{records: [%Transaction{}, ...]}}
Link to this function

retrieve(liquidity_pool_id)

View Source
@spec retrieve(liquidity_pool_id :: liquidity_pool_id()) :: response()

Retrieves information of a specific liquidity pool.

Parameters:

  • liquidity_pool_id: A liquidity pool’s id encoded in a hex string representation.

Examples

iex> LiquidityPools.retrieve("001365fc79ca661f31ba3ee0849ae4ba36f5c377243242d37fad5b1bb8912dbc")
{:ok, %LiquidityPool{}}