Crate stellar_client[][src]

Stellar Client

A light-weight implementation to the stellar horizon api.

There are three main aspects to the client library. There is the client itself found in the client module. There are the various endpoints that can be used to fetch data. And then there are the resources themselves that are returned from the APIs.

Usage and Examples

To use, first create a client. For simplicity this example will use the synchronous client and will use it to fetch a random asset and then ask if there are any trades between that asset and lumens.

use stellar_client::{
    endpoint::{asset, trade},

// Creates a client that's connected to stellar's test net
let client = Client::horizon_test().unwrap();

// Creates a request-like struct for all assets
let assets = asset::All::default();

// Issues request for assets and grabs identifier
let assets = client.request(assets).unwrap();
let identifier = assets.records()[0].identifier();

// Form a request for trades
let trades = trade::All::default()
    .with_asset_pair(AssetIdentifier::native(), identifier.clone());
let trades = client.request(trades).unwrap();


pub use client::async;
pub use client::sync;
pub use error::Error;
pub use error::Result;



This modulbe encompasses the major clients for the stellar sdk. It's basically divided into the synchronous client and the asynchronous. The synchronous client utilitizes reqwest under the hood and will block the current thread until a response has been received and processed.


This module contains the various end point definitions for stellar's horizon API server. An endpoint is a struct that implements the IntoRequest, and TryFromUri traits. Endpoints can be given to a client for fetching into a response.


Error and result module


Defines the basic resources of stellar's horizon end points and implements their deserialization from JSON into rust types.



A resource for the stellar horizon API specific error codes. These errors adhere to the Problem Details Standard and a list of possible erros can be found on the Stellar website