Skip to content

refactor: use deployments package #308

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# directories
.docusaurus
build
node_modules
repos
src/autogen/**/*.mdx
static

# files
babel.config.js
docusaurus.config.ts
sidebars.js
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
.docusaurus
build
node_modules
src/autogen/**/*.mdx

# files
*.env
*.log
*.tsbuildinfo
.DS_Store
.eslintcache
.pnp.*
package-lock.json
pnpm-lock.yaml
yarn.lock
3 changes: 2 additions & 1 deletion .lintstagedrc.yml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
"*.{json,md,mdx,ts,tsx,yml}": "bun run fix"
"*.{md,mdx,ts,tsx}": "bun run fix"
"*.{json,yml}": "bun run prettier:write"
5 changes: 2 additions & 3 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# directories
.cache-loader
.docusaurus
build
node_modules
repos
src/autogen/**/*.mdx
static

# files
.pnp.*
package-lock.json
pnpm-lock.yaml
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"prettier.documentSelectors": ["**/*.tsx"],
"search.exclude": {
"**/.docusaurus": true,
"**/build": true,
"**/node_modules": true,
"**/repos": true
},
Expand Down
3,505 changes: 1,632 additions & 1,873 deletions bun.lock

Large diffs are not rendered by default.

112 changes: 43 additions & 69 deletions docs/api/01-overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ sidebar_position: 1
title: "Overview"
---

import LinkPreview from "@site/src/components/molecules/LinkPreview";
import { LinkPreviewIndexers, LinkPreviewMerkleAPI } from "@site/src/components/molecules/link-previews";

# 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.
open-source, so feel free to roam around and suggest improvements or optimizations.

Below, we will cover:

Expand All @@ -22,15 +21,12 @@ Below, we will cover:

![Banner Sablier APIs](/banners/docs-apis.webp)

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.
As an alternative to reading data from the contracts or listening to onchain events, we use a collection of data indexing services. These services act as a middleware between the chain and our interfaces and allow for caching, aggregating, and querying data. For more advanced features like Merkle tree generation (used in Airdrops), we've written our own SDKs and open-sourced some of them.

:::note Playground

To preview the GraphQL APIs for subgraphs and indexers, you can plug them into
[Hasura's](https://cloud.hasura.io/public/graphiql) online explorer.
To preview the GraphQL APIs for the indexers, you can plug them into
the [Hasura explorer](https://cloud.hasura.io/public/graphiql).
[Here](https://cloud.hasura.io/public/graphiql?endpoint=https://api.studio.thegraph.com/query/57079/sablier-ethereum-lockup/version/latest)'s
an example setup of a Mainnet subgraph for Sablier Lockup.

Expand All @@ -40,27 +36,20 @@ an example setup of a Mainnet subgraph for Sablier Lockup.

### The Graph

[The Graph](https://thegraph.com/) has been the vendor of choice in the EVM space for the past few years. We've been
[The Graph](https://thegraph.com/) has been the vendor of choice in the EVM space for some time. 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](/api/lockup/endpoints). Each network has its own subgraph endpoints.

- [Lockup endpoints](/api/lockup/endpoints)
- [Lockup subgraph](https://github.com/sablier-labs/subgraphs/apps/lockup) (Vesting)
- [Flow endpoints](/api/flow/endpoints)
- [Flow subgraph](https://github.com/sablier-labs/subgraphs/apps/flow) (Payments)
- [Airdrops endpoints](/api/airdrops/endpoints)
- [Airdrops subgraph](https://github.com/sablier-labs/subgraphs/apps/merkle) (Airdrops, Airstreams)
Sablier data from the official [indexers](/api/lockup/indexers). Each chain has its own subgraphs.

- [Caveats](/api/caveats) between subgraphs and indexers
- [Lockup indexers](/api/lockup/indexers)
- [Flow indexers](/api/lockup/indexers)
- [Airdrops indexers](/api/airdrops/indexers)
- [The Graph docs](https://thegraph.com/docs/en/quick-start/)

<LinkPreview
href="https://github.com/sablier-labs/subgraphs"
icon="github"
subtitle="@sablier/subgraphs"
title="Sablier Subgraphs on Github"
/>
<LinkPreviewIndexers />

#### Endpoints / Slugs

Expand All @@ -74,78 +63,63 @@ be found in the Studio Development Query URL. We use the following naming conven
| `sablier-airdrops-*` | `sablier-airdrops-base` | [Merkle](/concepts/merkle-airdrops) (Airdrops) |
| `sablier-*` | `sablier-optimism` | [V1](/api/legacy) (Legacy) |

In February 2025 we've deprecated the old lineup of `sablier-v2-*` subgraphs. They remain available (see `Deprecated`
section under each subgraph documentation) but will not track the most recent deployments nor get future updates.
In February 2025, we've deprecated the old line-up of `sablier-v2-*` subgraphs. They remain available (see `Deprecated`
section under each subgraph documentation), but they will not track the most recent deployments nor get future updates.

### Envio

[Envio](https://envio.dev/) 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.
We wrote Envio indexers that mirror the features and entities exposed by The Graph subgraphs. This enables us to take advantage of the speed and
optimized environment provided by HyperIndex.

All networks share the same indexer endpoint (for one indexer type), as Envio promotes a cross-chain indexing
architecture.
All chains share the same endpoint (for each Sablier protocol, e.g. Lockup).

- [Caveats](/api/caveats) between subgraphs and indexers
- [Lockup endpoints](/api/lockup/endpoints)
- [Lockup indexer](https://github.com/sablier-labs/subgraphs/apps/lockup-envio) (Vesting)
- [Flow endpoints](/api/lockup/endpoints)
- [Flow indexer](https://github.com/sablier-labs/subgraphs/apps/flow-envio) (Payments)
- [Airdrops endpoints](/api/airdrops/endpoints)
- [Airdrops indexer](https://github.com/sablier-labs/subgraphs/apps/merkle-envio) (Airdrops, Airstreams)
- [The Graph docs](https://thegraph.com/docs/en/quick-start/)
- [Lockup indexers](/api/lockup/indexers)
- [Flow indexers](/api/lockup/indexers)
- [Airdrops indexers](/api/airdrops/indexers)
- [Envio docs](https://docs.envio.dev)

<LinkPreview
href="https://github.com/sablier-labs/subgraphs"
icon="github"
subtitle="@sablier/subgraphs"
title="Sablier Indexers on Github"
/>
<LinkPreviewIndexers />

## Sablier SDKs
## Merkle API

### Merkle API

To support the Merkle distribution (see [Airdrops](/apps/features/airdrops)) system, we developed a backend service
To support the Merkle distributions in [Airdrops](/apps/features/airdrops), 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](/api/airdrops/merkle-api/overview).

- [Endpoints](/api/airdrops/endpoints)
- [Indexers](/api/airdrops/indexeres)

<LinkPreviewMerkleAPI />

<LinkPreview
href="https://github.com/sablier-labs/merkle-api"
icon="github"
subtitle="@sablier/merkle-api - Rust-based service for Merkle distributions"
title="Sablier Merkle API on Github"
/>
## App Products

## Products
This is how the products available in the Sablier Interface are powered by the different APIs we provide.

### Lockup
### Vesting

The [vesting](/apps/features/vesting) side of the application is powered by:
The [Vesting](/apps/features/vesting) side of the application is powered by:

- The `@sablier/subgraphs/apps/lockup` subgraph
- The `@sablier/subgraphs/apps/lockup-envio` indexer
- The Graph subgraph for Lockup
- The Envio endpoint for Lockup

### Airdrops (Airstreams)
### Airdrops

The [airdrops](/apps/features/airdrops) side of the application is powered by:
The [Airdrops](/apps/features/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
- The Graph subgraph for Airdrops
- The Envio endpoint for Airdrops

These will work for both Airstreams and Instant Airdrops.
These handle both Airstreams and Instant Airdrops.

### Flow
### Payments

The [payments](/apps/features/payments) side of the application is powered by:
The [Payments](/apps/features/payments) side of the application is powered by:

- The `@sablier/subgraphs/apps/flow` subgraph
- The `@sablier/subgraphs/apps/flow-envio` indexer
- The Graph subgraph for Flow
- The Envio endpoint for Flow
50 changes: 12 additions & 38 deletions docs/api/05-development.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,15 @@ sidebar_position: 5
title: "Development"
---

import LinkPreview from "@site/src/components/molecules/LinkPreview";
import { LinkPreviewIndexers, LinkPreviewMerkleAPI } from "@site/src/components/molecules/link-previews";

## The Graph

### Integrate

To integrate the Sablier subgraphs or indexers into your project, start from the official `@sablier/subgraphs`
repository.
To integrate the Sablier indexers into your project, start from the official Sablier Indexers repository.

<LinkPreview
href="https://github.com/sablier-labs/subgraphs"
icon="github"
subtitle="GitHub"
title="Github - sablier-labs/subgraphs: Sablier Subgraphs"
/>
<LinkPreviewIndexers />

We recommend using:

Expand All @@ -28,8 +22,8 @@ We recommend using:

### Contribute

To contribute to the subgraphs or deploy your own, head over to the GitHub
[`subgraphs`](https://github.com/sablier-labs/subgraphs) repository. Get started by reviewing the `apps/lockup`
To contribute to the indexers or deploy your own custom versions, head over to the GitHub
[`indexers`](https://github.com/sablier-labs/indexers) repository. Get started by reviewing the `apps/lockup`
directory.

To bootstrap a subgraph project, run the following commands. They will install the requisite dependencies and generate
Expand Down Expand Up @@ -70,40 +64,25 @@ To publish on the hosted service:

### Integrate

To integrate the Sablier indexers into your own product, start from the official `@sablier/subgraphs` repository. We
To integrate the Envio indexers into your own product, start from the official Sablier Indexers repository. We
recommend using:

- [GraphQL Code Generator](https://the-guild.dev/graphql/codegen/docs/getting-started) to create types from your GraphQL
fragments and queries
- [TanStack Query](https://tanstack.com/query) to fetch results from the exposed endpoints.

If you're integrated the Sablier subgraphs, we recommend using request and response wrappers/middleware to format
We recommend using request and response wrappers/middleware to format
results coming from Envio's indexer in the same shape as those from The Graph. Suggestions:

1. Write queries in both systems (based on the [querying language specifics](/api/caveats#querying-language)) using the
same `operationName` and swap query strings between vendors based on it
2. Write response middleware that converts results into similar shapes (see these [important notes](/api/caveats))

<LinkPreview
href="https://github.com/sablier-labs/subgraphs"
icon="github"
subtitle="GitHub"
title="Github - sablier-labs/subgraphs: Sablier Subgraphs"
/>
<LinkPreviewIndexers />

### Test
### Testing

To ensure Envio indexers deliver the same data as The Graph's subgraphs, we've written differential tests for our
indexer configurations.

Check them out inside the `apps/[...]/test/` folders.

<LinkPreview
href="https://github.com/sablier-labs/subgraphs"
icon="github"
subtitle="@sablier-labs/subgraphs"
title="Github - sablier-labs/subgraphs: Sablier Subgraphs"
/>
To ensure Envio delivers the same data as The Graph's subgraphs, we've written differential tests. Check them out inside the `apps/[...]/test/` folders.

#### Run

Expand All @@ -126,7 +105,7 @@ once. Alternatively, you could also try increasing the timeout of the tests.
### Contribute

To contribute to the V2 indexers (Envio x Sablier) or deploy your own, head over to the GitHub
[`subgraphs`](https://github.com/sablier-labs/subgraphs) repository. Get started by reviewing the `apps/lockup-envio`
[`indexers`](https://github.com/sablier-labs/indexers) repository. Get started by reviewing the `apps/lockup-envio`
directory.

To bootstrap an indexer project, run the following commands. They will install the requisite dependencies and generate
Expand Down Expand Up @@ -160,12 +139,7 @@ official docs at https://docs.envio.dev/.
To integrate the Sablier Merkle API into your own product, start from the official `@sablier/merkle-api` repository. We
recommend using:

<LinkPreview
href="https://github.com/sablier-labs/merkle-api"
icon="github"
subtitle="GitHub"
title="Github - sablier-labs/merkle-api: Sablier Merkle API (Airstreams)"
/>
<LinkPreviewMerkleAPI />

### Contribute

Expand Down
Loading