Skip to content

Commit b6b778f

Browse files
committed
feat: field "kind" for TheGraph
feat: getLatestRelease
1 parent 83b98b3 commit b6b778f

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@sablier/deployments",
33
"description": "Keeping track of Sablier deployments",
4-
"version": "1.0.0-alpha.17",
4+
"version": "1.0.0-alpha.18",
55
"author": {
66
"name": "Sablier Labs Ltd",
77
"url": "https://sablier.com"

src/indexers/thegraph.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ export function getTheGraph(protocol: Sablier.Protocol, chainId: number): Sablie
200200
if (officialSubgraph) {
201201
return {
202202
explorer: `https://thegraph.com/explorer/subgraphs/${officialSubgraph.id}`,
203+
kind: "official",
203204
studio: `https://api.studio.thegraph.com/query/${THEGRAPH_ORG_ID}/${officialSubgraph.name}/version/latest`,
204205
subgraph: {
205206
id: officialSubgraph.id,
@@ -213,6 +214,7 @@ export function getTheGraph(protocol: Sablier.Protocol, chainId: number): Sablie
213214
return {
214215
customURL: customSubgraph.url,
215216
explorer: customSubgraph.explorer,
217+
kind: "custom",
216218
};
217219
}
218220

src/releases/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ export function getAllContractsFor(release: Sablier.Release): Sablier.Contract[]
2727
return release.deployments.flatMap((deployment) => deployment.contracts);
2828
}
2929

30+
export function getLatestRelease(protocol: Sablier.Protocol): Sablier.Release | undefined {
31+
return _.find(releasesByProtocol[protocol], { isLatest: true });
32+
}
33+
3034
export function getRelease(protocol: Sablier.Protocol, version: Sablier.Version): Sablier.Release | undefined {
3135
const versionMap: Record<Sablier.Protocol, (v: Sablier.Version) => boolean> = {
3236
airdrops: isValidAirdropsVersion,

src/types.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export declare namespace Sablier {
138138
url: `https://github.com/sablier-labs/${string}`;
139139
};
140140

141-
/** Shared explorer + studio fields (docs written only once) */
141+
/** Shared "explorer" + "studio" fields (docs written only once) */
142142
interface TheGraphCommon {
143143
/** @description URL to The Graph explorer. */
144144
explorer?: string;
@@ -148,11 +148,13 @@ export declare namespace Sablier {
148148
interface TheGraphCustom extends TheGraphCommon {
149149
/** @description URL to a custom subgraph. */
150150
customURL: string;
151+
kind: "custom";
151152
subgraph?: never;
152153
}
153154

154155
interface TheGraphOfficial extends TheGraphCommon {
155156
customURL?: never;
157+
kind: "official";
156158
subgraph: {
157159
/** @description ID of the subgraph. */
158160
id: string;

0 commit comments

Comments
 (0)