Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
eb2e5a1
refactor docs to accommodate upcoming Flow protocol
smol-ninja Oct 11, 2024
3904aab
delete contracts directory
smol-ninja Oct 11, 2024
6e927e3
fix: broken links
smol-ninja Oct 12, 2024
aedac03
feat: create redirects from old site to new site
smol-ninja Oct 12, 2024
53fda2c
autogen
smol-ninja Oct 12, 2024
2ac03c2
polish docs
smol-ninja Oct 12, 2024
cb145fb
polish docs
smol-ninja Oct 12, 2024
c5cff15
refactor: add overview in lockup concepts
smol-ninja Oct 13, 2024
7d7b97c
feat: add Flow overview
smol-ninja Oct 13, 2024
3dec4a1
use stream shapes, stream curves instead of stream types
smol-ninja Oct 14, 2024
d0bbd8e
update .gitmodules
smol-ninja Oct 15, 2024
3d74983
spelling mistake
smol-ninja Oct 18, 2024
43137d5
docs: flow apps (#190)
razgraf Oct 18, 2024
540a390
refactor: sablier v2 to sablier lockup v1.x in api section
razgraf Oct 20, 2024
9c6d82a
fix: gas benchmark formatter
razgraf Oct 21, 2024
3d0f002
docs: add notes for subgraph naming convention
razgraf Oct 21, 2024
4db2773
chore: update v1 subgraph endpoint
razgraf Oct 21, 2024
89b9ef1
feat: docs for Flow protocol (#189)
smol-ninja Oct 23, 2024
5427b67
fix broken links
smol-ninja Oct 23, 2024
5e00a86
build: update bun lockfile
PaulRBerg Nov 15, 2024
9523999
refactor: reorder and restructure pages
PaulRBerg Nov 15, 2024
01acf77
feat: add flow the graph api section
gavriliumircea Nov 19, 2024
af3d1e4
chore: add docs for flow envio
gavriliumircea Nov 20, 2024
5b4b00c
Merge branch 'docs/flow-protocol' into feat/document-flow-subgraphs
razgraf Dec 2, 2024
7f6d12c
fix(api): envio queries
razgraf Dec 2, 2024
889da99
fix(static): remove pngs resulted from merge
razgraf Dec 2, 2024
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
8 changes: 4 additions & 4 deletions docs/api/drops/02-endpoints.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ deployment. The data from all of chains that Sablier is deployed on can be queri

### Endpoints

| Chain | Endpoint on the Hosted Network |
| ---------------- | --------------------------------------------------------------------- |
| All-Networks[^3] | [https://indexer.bigdevenergy.link/[...]/v1/graphql][endpoint-merkle] |
| Chain | Endpoint on the Hosted Network |
| ---------------- | ------------------------------------------------------------------ |
| All-Networks[^3] | [https://indexer.hyperindex.xyz/[...]/v1/graphql][endpoint-merkle] |

The endpoint is meant to be plugged into a query client. Use
[Hasura's online explorer](https://cloud.hasura.io/public/graphiql?) to view the entities and query API.
Expand Down Expand Up @@ -218,7 +218,7 @@ recipient's claims.

{/* --------------------------------------------------------------------------------------------------------------------------------- */}

[endpoint-merkle]: https://indexer.bigdevenergy.link/508d217/v1/graphql
[endpoint-merkle]: https://indexer.hyperindex.xyz/508d217/v1/graphql

{/* --------------------------------------------------------------------------------------------------------------------------------- */}
{/* --------------------------------------------------------------------------------------------------------------------------------- */}
Expand Down
10 changes: 5 additions & 5 deletions docs/api/flow/02-endpoints.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: "Endpoints"

import LinkPreview from "@site/src/components/LinkPreview";

# Lockup
# Flow

## The Graph

Expand Down Expand Up @@ -64,9 +64,9 @@ like creating, depositing, or voiding flow streams.

### Endpoints

| Chain | Endpoint (Hosted Network) |
| ---------------- | ------------------------------------------------------------------- |
| All-Networks[^3] | [https://indexer.bigdevenergy.link/[...]/v1/graphql][endpoint-flow] |
| Chain | Endpoint (Hosted Network) |
| ---------------- | ---------------------------------------------------------------- |
| All-Networks[^3] | [https://indexer.hyperindex.xyz/[...]/v1/graphql][endpoint-flow] |

The endpoint is meant to be plugged into a query client. Use
[Hasura's online explorer](https://cloud.hasura.io/public/graphiql?) to view the entities and query API.
Expand Down Expand Up @@ -178,7 +178,7 @@ The endpoint is meant to be plugged into a query client. Use

{/* --------------------------------------------------------------------------------------------------------------------------------- */}

[endpoint-flow]: https://indexer.bigdevenergy.link/__INSERT_ID__/v1/graphql
[endpoint-flow]: https://indexer.hyperindex.xyz/__INSERT_ID__/v1/graphql

{/* --------------------------------------------------------------------------------------------------------------------------------- */}
{/* --------------------------------------------------------------------------------------------------------------------------------- */}
Expand Down
18 changes: 18 additions & 0 deletions docs/api/flow/envio/01-similarities.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
id: "similarities"
sidebar_position: 1
title: "Similarities"
---

# Similarities

Envio indexers are designed to mirror the functionality and structure of the The Graph subgraphs.

For an introduction into the base Sablier primitives and some architectural choices, make sure to check out the
[flow subgraph](/api/flow/the-graph/entities) before reading about the `flow-envio` indexer.

The same (or similar) entities are used throughout both The Graph and Envio setups, as well as lockup and merkle
deployments.

- [Entities](/api/flow/the-graph/entities)
- [Structure](/api/flow/the-graph/structure)
8 changes: 8 additions & 0 deletions docs/api/flow/envio/02-architecture.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
id: "architecture"
sidebar_position: 3
title: "Architecture"
---

The flow-envio architecture respects the same principles with lockup-envio. You can find more information
[here](/api/lockup/envio/architecture)
158 changes: 158 additions & 0 deletions docs/api/flow/envio/03-queries.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
---
id: "queries"
sidebar_position: 4
title: "Queries"
---

Building on top of the [entity structure](/api/flow/the-graph/structure) defined earlier, here are some common GraphQL
queries for fetching data from the Sablier subgraph.

### Recent streams

```graphql title="The 10 most recent streams"
query getStreams {
Stream(limit: 10, distinct_on: [subgraphId], order_by: { subgraphId: desc }) {
id
alias
category
asset {
id
symbol
}
}
}
```

### Paginated streams

To query streams in sets/pages (and avoid edge cases where using timestamps may skip simultaneous batched streams), we
can use the unique `subgraphId`.

This query includes pagination.

```graphql title="The next streams indexed before the last seen subgraphId"
query getStreams($first: Int!, $subgraphId: numeric!) {
Stream(
limit: $first
distinct_on: [subgraphId]
order_by: { subgraphId: desc }
where: { subgraphId: { _lt: $subgraphId } }
) {
id
alias
category
asset {
id
symbol
}
}
}
```

### Streams by sender

This query includes pagination.

:::warning

Some queries, especially those using `OR` will potentially yield duplicate results. To make sure we only retrieve unique
streams/entities with a query, we make use of the `distinct_on` filter (and apply it on keys included in `order_by`).

:::

```graphql title="The next streams created by an address"
Stream(
limit: $first
offset: $skip
distinct_on: [subgraphId]
order_by: { subgraphId: desc }
where: {
_and: [{ sender: {_eq: $sender} }, { subgraphId: {_lt: $subgraphId} }]
}
) {
id
alias
category
}
```

### Streams by sender or recipient

To show all streams that have an address marked as a sender (all cases) or a recipient, extend the example above to
account for the recipient aspect.

This query includes pagination.

```graphql title="The next streams related to an address, as a sender or recipient"
Stream(
limit: $first
offset: $skip
distinct_on: [subgraphId]
order_by: { subgraphId: desc }
where: {
or: [
{ _and: [{ sender: {_eq: $sender} }, { subgraphId: {_lt: $subgraphId} }] }
{ _and: [{ recipient: {_eq: $recipient} }, { subgraphId: {_lt: $subgraphId} }] }
]
}
) {
id
alias
category
}
```

### Streams by filters

The official V2 Interfaces will provide a search interface where one may query for a list of streams using the following
filters (the conditions will be combined)

- the sender address
- the recipient address
- a list of stream identifiers

This query includes pagination.

```graphql title="The 'where' clause for a complex paginated search filter"
where: {
_or: [
{
_and: [
{ chainId: { _eq: $chainId } }
{ sender: { _eq: $sender } }
{ subgraphId: { _lt: $subgraphId } }
]
}
{
_and: [
{ chainId: { _eq: $chainId } }
{ recipient: { _eq: $recipient } }
{ subgraphId: { _lt: $subgraphId } }
]
}
]
}
```

### Actions by stream

:::tip

To avoid writing the same entity definitions over and over again, check out Fragments.

:::

```graphql title="Most recent 100 stream actions such as withdrawals or transfers"
Action(
limit: 100
distinct_on: [subgraphId]
order_by: { subgraphId: desc }
where: { stream_id: {_eq: $streamId} }
) {
id
category
stream {
...StreamFragment
}
}
```
5 changes: 5 additions & 0 deletions docs/api/flow/envio/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"collapsed": true,
"label": "Envio",
"position": 4
}
32 changes: 32 additions & 0 deletions docs/api/flow/the-graph/01-entities.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
id: "entities"
sidebar_position: 1
title: "Entities"
---

## Entity Architecture

GraphQL entities defined by the Sablier subgraphs are meant to mirror the functionality exposed by our core flow
contracts. To achieve this, events are stored as historical entries (e.g. Action) while also being used to mutate
attributes for live entities (e.g. Stream).

Inside the **flow** subgraph, the
[`schema.graphql`](https://github.com/sablier-labs/subgraphs/blob/main/apps/flow/schema.graphql) file is responsible of
defining the following Sablier entities:

### Primary

| Entity | Description |
| -------- | ------------------------------------------------------------------------------------------- |
| Contract | Instances of `SablierFlow` |
| Action | Emitted events transformed into historical entries (e.g. Create, Withdraw, Adjust, Deposit) |
| Stream | Primary entity tracking the up to date state of a stream |
| Asset | The ERC20 asset that is being streamed |

### Secondary

| Entity | Description |
| ------- | ------------------------------------------------------------------------------------------------------------------------- |
| Batch | An entity grouping a set of stream created all at once (action done through the batch interface of SablierFlow contracts) |
| Batcher | An entity resolving 1:1 to a stream sender, in charge of managing the count of "batches" of streams one creates |
| Watcher | A singleton data store for subgraph-level unique indexes such as the stream or action index |
Loading