The Sablier APIs
Sablier relies on specific dependencies to source data and enable off-chain features. All of these are either public or open-source, so feel free to roam around and suggest improvements or optimizations.open-source, so feel free to roam around and suggest improvements or optimizations.
Below, we will cover:
- The solutions we use to index and query data
- The interface-to-protocol links between these solutions
- The raw entities emitted by the contracts
Solutions
As an alternative to reading data from the contracts or listening to onchain events, we use a collection of subgraphs and indexers. These service act as a middleware between the chain and our interfaces and allow for caching, formatting and querying data. For more advanced features like Merkle tree generation (used in Airdrops), we've written own SDKs and open-sourced some of them.
Subgraphs
The Graph
The Graph has been the vendor of choice in the EVM space for the past few years. We've been using The Graph since we launched Sablier Legacy in 2019. For our current apps, we created a special set of feature-oriented subgraphs used internally and by third-party services (e.g., Snapshot) and integrators.
These subgraphs are hosted on The Graph Network, as well as on the The Graph Hosted Service. They can be used to query Sablier data from the official endpoints. EAch network has its own subgraph endpoints.
- Lockup endpoints
- Lockup subgraph (Vesting)
- Flow endpoints
- Flow subgraph (Payments)
- Airdrops endpoints
- Airdrops subgraph (Airdrops, Airstreams)
- The Graph docs
Endpoints / Slugs
Every subgraph deployment will have a slug
generated by The Graph. The slug is derived from the subgraph name and can
be found in the Studio Development Query URL. We use the following naming convention for subgraphs:
Subgraph | Example | Product or Concept |
---|---|---|
sablier-v2-* | sablier-v2 , sablier-v2-optimism | Lockup (Vesting) |
sablier-v2-flow-* | sablier-v2-flow-arbitrum | Flow (Payments) |
sablier-v2-ms-* | sablier-v2-ms-base | Airstreams (Airdrops) |
sablier-* | sablier-optimism | V1 (Legacy) |
There is a v2
in the subgraph name due to historical reasons. Sablier used to be versioned as v1
and v2
, and the
subgraphs were named accordingly. However, we have since dropped this versioning scheme.
Envio
Envio offers a suite of fast and flexible tools to access onchain data. Their HyperIndex service provides a similar GraphQL-driven API to access cached data and serve it into our client interfaces.
We created indexers that mimic the features and entities exposed by subgraphs and take advantage of the speed and optimized environment configured through HyperIndex.
All networks share the same indexer endpoint (for one indexer type), as Envio promotes a cross-chain indexing architecture.
- Caveats between subgraphs and indexers
- Lockup endpoints
- Lockup indexer (Vesting)
- Flow endpoints
- Flow indexer (Payments)
- Airdrops endpoints
- Airdrops indexer (Airdrops, Airstreams)
- The Graph docs
Sablier SDKs
Merkle API
To support the Merkle distribution (see Airdrops) system, we developed a backend service
called @sablier/merkle-api
. This API deals with the validation, creation, and management of Merkle trees, which are
used to define eligibility and claiming rules for Sablier's Airstream campaigns.
The service is open-source and can be used by integrators as a plug-n-play solution to support (and even deploy) similar
campaigns. Read more on the dedicated page about the merkle-api
service here.
Products
Lockup
The vesting side of the application is powered by:
- The
@sablier/subgraphs/apps/lockup
subgraph - The
@sablier/subgraphs/apps/lockup-envio
indexer
Airdrops (Airstreams)
The airdrops side of the application is powered by:
- The
@sablier/subgraphs/apps/merkle
subgraph - The
@sablier/subgraphs/apps/merkle-envio
indexer - The
@sablier/merkle-api
rust service for airdrops
These will work for both Airstreams and Instant Airdrops 🔜.
Flow
The payments side of the application is powered by:
- The
@sablier/subgraphs/apps/flow
subgraph - The
@sablier/subgraphs/apps/flow-envio
indexer