Skip to content

Commit 1bf9cb0

Browse files
committed
feat: identifiers page in APIs
refactor: delete stale GraphQL entity docs
1 parent 183fcc4 commit 1bf9cb0

35 files changed

+110
-1496
lines changed

bun.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"@emotion/styled": "^11.14",
1717
"@heroicons/react": "^2.2",
1818
"@mdx-js/mdx": "~3.1",
19-
"@sablier/indexers": "1.0.0-alpha.6",
19+
"@sablier/indexers": "1.0.0-alpha.7",
2020
"@vercel/analytics": "^1.5",
2121
"axios": "^1.9",
2222
"docusaurus-theme-github-codeblock": "^2.0",
@@ -770,7 +770,7 @@
770770

771771
"@sablier/devkit": ["@sablier/devkit@github:sablier-labs/devkit#bbcb704", {}, "sablier-labs-devkit-bbcb704"],
772772

773-
"@sablier/indexers": ["@sablier/[email protected].6", "", { "dependencies": { "lodash": "^4.17", "sablier": "1.0.0-beta.2" } }, "sha512-2YpYCyyFJnuTrsPcY+v4CDW+R/e/+qzxzxIFZmNq2wjFA2l5EFBI+bgKSWzd/+P2lgMI2rAjaKe4GhxbGXjKXw=="],
773+
"@sablier/indexers": ["@sablier/[email protected].7", "", { "dependencies": { "lodash": "^4.17", "sablier": "1.0.0-beta.2" } }, "sha512-+hbup8zVzXK17Wx5NYUZt6li7UWTW1e56qgp98FmS6Exi0shwCgZ6hTWN4LbLv89cOjOQbLO7XyEMMz9Z0D2Eg=="],
774774

775775
"@scure/base": ["@scure/[email protected]", "", {}, "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg=="],
776776

cli/commands/autogen/indexers.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function generateGraphTable(indexers: Indexer[]): string {
4545
const chain = sablier.chains.getOrThrow(indexer.chainId);
4646

4747
const productionURL = indexer.endpoint.url;
48-
const testingURL = indexer.playgroundURL;
48+
const testingURL = indexer.testingURL;
4949
const explorerURL = indexer.explorerURL;
5050

5151
const productionCell = `[${indexer.name}](${productionURL})`;
@@ -59,8 +59,8 @@ function generateGraphTable(indexers: Indexer[]): string {
5959
}
6060

6161
function generateEnvioTable(indexers: Indexer[]): string {
62-
let markdown = `| Chain | Production URL | Testing URL |\n`;
63-
markdown += `| -------- | -------------- | ----------- |\n`;
62+
let markdown = `| Chain | Production URL | Testing URL | Explorer URL |\n`;
63+
markdown += `| -------- | -------------- | ----------- | ------------ |\n`;
6464

6565
for (const indexer of indexers) {
6666
const chain = sablier.chains.get(indexer.chainId);
@@ -69,11 +69,14 @@ function generateEnvioTable(indexers: Indexer[]): string {
6969
}
7070

7171
const productionURL = indexer.endpoint.url;
72-
const testingURL = `https://cloud.hasura.io/public/graphiql?endpoint=${encodeURIComponent(productionURL)}`;
72+
const testingURL = indexer.testingURL;
73+
const explorerURL = indexer.explorerURL;
7374

7475
const productionCell = `${productionURL}`;
7576
const testingCell = `[Testing](${testingURL})`;
76-
markdown += `| ${chain.name} | ${productionCell} | ${testingCell} |\n`;
77+
const explorerCell = explorerURL ? `[Explorer](${explorerURL})` : "N/A";
78+
79+
markdown += `| ${chain.name} | ${productionCell} | ${testingCell} | ${explorerCell} |\n`;
7780
}
7881

7982
return markdown;

docs/api/03-identifiers.mdx

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
id: "ids"
3+
sidebar_position: 3
4+
title: "Identifiers"
5+
---
6+
7+
## Stream IDs
8+
9+
### Contracts
10+
11+
Onchain, each Lockup and Flow contract assigns a [`streamId`](/reference/lockup/contracts/abstracts/abstract.SablierLockupBase#nextstreamid) to each stream, which is the same as the ERC-721 [`tokenId`](https://docs.openzeppelin.com/contracts/5.x/api/token/erc721) (each stream is tokenized as an ERC-721).
12+
13+
The `streamId`/ `tokenId` in the contract is a simple numerical value (a `uint256`). For example, number `42` is a valid `streamId`/ `tokenId`.
14+
15+
You will always need this value when interacting with Sablier via a JSON-RPC endpoint because it is required by every contract method associated with a stream, e.g. [`streamedAmountOf`](/reference/lockup/contracts/interfaces/interface.ISablierLockupBase#streamedamountof).
16+
17+
### Indexers
18+
19+
Offchain, in the GraphQL schema, we need to be able to identify streams across different EVM chains and different contract versions. Additionally, it would be nice to have short, easily readable aliases. Thus, we have come up with the following identifiers:
20+
21+
| Identifier | Format | Example |
22+
| ------------ | --------------------------------------- | ---------------------------------------------------------------- |
23+
| Stream ID | `{contractAddress}-{chainId}-{tokenId}` | <nobr>`0xe0bfe071da104e571298f8b6e0fce44c512c1ff4-137-21`</nobr> |
24+
| Stream Alias | `{contractAlias}-{chainId}-{tokenId}` | <nobr>`LK-137-21`</nobr> |
25+
26+
Both examples from the table above translate to: \*\*a stream on Polygon (chain ID `137`) created via the Lockup v2.0
27+
contract at address `0xe0bfe071da104e571298f8b6e0fce44c512c1ff4`, with the token ID `21`.
28+
29+
#### Contract Aliases
30+
31+
Here's a table with the full list of contract aliases.
32+
33+
| Alias | Contract Name | Release |
34+
| ----- | ------------------------------ | ------------- |
35+
| FL | SablierFlow | Flow v1.0 |
36+
| FL2 | SablierFlow | Flow v1.1 |
37+
| LD | SablierV2LockupDynamic | Lockup v1.0 |
38+
| LD2 | SablierV2LockupDynamic | Lockup v1.1 |
39+
| LD3 | SablierV2LockupDynamic | Lockup v1.2 |
40+
| LK | SablierLockup | Lockup v2.0 |
41+
| LL | SablierV2LockupLinear | Lockup v1.0 |
42+
| LL2 | SablierV2LockupLinear | Lockup v1.1 |
43+
| LL3 | SablierV2LockupLinear | Lockup v1.2 |
44+
| LT3 | SablierV2LockupTranched | Lockup v1.2 |
45+
| MSF2 | SablierV2MerkleStreamerFactory | Airdrops v1.1 |
46+
| MSF3 | SablierV2MerkleLockupFactory | Airdrops v1.2 |
47+
| MSF4 | SablierMerkleFactory | Airdrops v1.3 |
48+
49+
## Airdrop IDs
50+
51+
### Contracts
52+
53+
Airdrops do not have any onchain IDs because every airdrop is a separate contract deployed by one of the Merkle Factory contracts.
54+
55+
### Indexers
56+
57+
The ID for an airdrop is the chain ID concatenated with the contract address of the airdrop contract:
58+
59+
| Identifier | Format | Example |
60+
| ---------- | ----------------------------- | ------------------------------------------------------------- |
61+
| Airdrop ID | `{contractAddress}-{chainId}` | <nobr>`0xf50760d8ead9ff322631a1f3ebf26cc7891b3708-137`</nobr> |
62+
63+
The example from the table above translates to: **_an airdrop on Polygon (chain ID `137`), with the contract
64+
address `0xf50760d8ead9ff322631a1f3ebf26cc7891b3708`_**.
65+
66+
:::info
67+
68+
We have decided not to generate aliases for Airdrops, but this may change in the future.
69+
70+
:::

docs/api/03-lockup/02-the-graph/01-entities.mdx

Lines changed: 0 additions & 32 deletions
This file was deleted.

docs/api/03-lockup/02-the-graph/02-structure.mdx

Lines changed: 0 additions & 179 deletions
This file was deleted.

0 commit comments

Comments
 (0)