@whisk/steakhouse 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export { WhiskClient as SteakhouseClient, WhiskClientConfig as SteakhouseClientConfig } from '@whisk/client';
2
- export { GetTvlResult, getTvl } from './queries/tvl/getTvl.js';
3
- export { GetTvlHistoricalResult, getTvlHistorical } from './queries/tvl/getTvlHistorical.js';
2
+ export { GetStatsResultWithHistorical, GetStatsResultWithoutHistorical, getStats } from './queries/getStats.js';
4
3
  import 'gql.tada';
5
4
  import '@whisk/graphql';
@@ -0,0 +1,74 @@
1
+ import { WhiskClient } from '@whisk/client';
2
+ import * as gql_tada from 'gql.tada';
3
+ import { ResultOf } from '@whisk/graphql';
4
+
5
+ declare const statsQuery: gql_tada.TadaDocumentNode<{
6
+ steakhouseStats: {
7
+ uniqueDepositors: number | null;
8
+ tvl: {
9
+ current: {
10
+ timestamp: number;
11
+ totalUsd: number;
12
+ byChain: {
13
+ chain: {
14
+ id: number;
15
+ name: string;
16
+ icon: string;
17
+ };
18
+ tvlUsd: number;
19
+ }[];
20
+ byProtocol: {
21
+ protocol: "generic" | "morpho_v1" | "morpho_v2" | "box";
22
+ tvlUsd: number;
23
+ }[];
24
+ byAssetCategory: {
25
+ category: "Stable" | "Eth" | "Btc" | null;
26
+ tvlUsd: number;
27
+ }[];
28
+ };
29
+ historical?: {
30
+ timestamp: number;
31
+ totalUsd: number;
32
+ byChain: {
33
+ chain: {
34
+ id: number;
35
+ name: string;
36
+ icon: string;
37
+ };
38
+ tvlUsd: number;
39
+ }[];
40
+ byProtocol: {
41
+ protocol: "generic" | "morpho_v1" | "morpho_v2" | "box";
42
+ tvlUsd: number;
43
+ }[];
44
+ byAssetCategory: {
45
+ category: "Stable" | "Eth" | "Btc" | null;
46
+ tvlUsd: number;
47
+ }[];
48
+ }[];
49
+ };
50
+ };
51
+ }, {
52
+ includeHistorical: boolean;
53
+ }, void>;
54
+ type GetStatsResult = ResultOf<typeof statsQuery>["steakhouseStats"];
55
+ type GetStatsResultWithHistorical = GetStatsResult & {
56
+ tvl: GetStatsResult["tvl"] & {
57
+ historical: NonNullable<GetStatsResult["tvl"]["historical"]>;
58
+ };
59
+ };
60
+ type GetStatsResultWithoutHistorical = Omit<GetStatsResult, "tvl"> & {
61
+ tvl: Pick<GetStatsResult["tvl"], "current">;
62
+ };
63
+ /**
64
+ * Get Steakhouse stats: unique depositor count and current TVL breakdown.
65
+ * Pass `{ includeHistorical: true }` to also fetch daily historical TVL snapshots (last 365 days).
66
+ */
67
+ declare function getStats(client: WhiskClient, options: {
68
+ includeHistorical: true;
69
+ }): Promise<GetStatsResultWithHistorical>;
70
+ declare function getStats(client: WhiskClient, options?: {
71
+ includeHistorical?: false;
72
+ }): Promise<GetStatsResultWithoutHistorical>;
73
+
74
+ export { type GetStatsResultWithHistorical, type GetStatsResultWithoutHistorical, getStats };
@@ -0,0 +1,52 @@
1
+ import { graphql } from "@whisk/graphql";
2
+ const tvlSnapshotFragment = graphql(`
3
+ fragment TvlSnapshot on SteakhouseTvlSnapshot {
4
+ timestamp
5
+ totalUsd
6
+ byChain {
7
+ chain {
8
+ id
9
+ name
10
+ icon
11
+ }
12
+ tvlUsd
13
+ }
14
+ byProtocol {
15
+ protocol
16
+ tvlUsd
17
+ }
18
+ byAssetCategory {
19
+ category
20
+ tvlUsd
21
+ }
22
+ }
23
+ `);
24
+ const statsQuery = graphql(
25
+ `
26
+ query GetSteakhouseStats($includeHistorical: Boolean!) {
27
+ steakhouseStats {
28
+ uniqueDepositors
29
+
30
+ tvl {
31
+ current {
32
+ ...TvlSnapshot
33
+ }
34
+ historical @include(if: $includeHistorical) {
35
+ ...TvlSnapshot
36
+ }
37
+ }
38
+ }
39
+ }
40
+ `,
41
+ [tvlSnapshotFragment]
42
+ );
43
+ async function getStats(client, options) {
44
+ const result = await client.query(statsQuery, {
45
+ includeHistorical: options?.includeHistorical ?? false
46
+ });
47
+ return result.steakhouseStats;
48
+ }
49
+ export {
50
+ getStats
51
+ };
52
+ //# sourceMappingURL=getStats.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/queries/getStats.ts"],"sourcesContent":["import { graphql, type ResultOf } from \"@whisk/graphql\"\nimport type { SteakhouseClient } from \"../client.js\"\n\nconst tvlSnapshotFragment = graphql(`\n fragment TvlSnapshot on SteakhouseTvlSnapshot {\n timestamp\n totalUsd\n byChain {\n chain {\n id\n name\n icon\n }\n tvlUsd\n }\n byProtocol {\n protocol\n tvlUsd\n }\n byAssetCategory {\n category\n tvlUsd\n }\n }\n`)\n\nconst statsQuery = graphql(\n `\n query GetSteakhouseStats($includeHistorical: Boolean!) {\n steakhouseStats {\n uniqueDepositors\n\n tvl {\n current {\n ...TvlSnapshot\n }\n historical @include(if: $includeHistorical) {\n ...TvlSnapshot\n }\n }\n }\n }\n`,\n [tvlSnapshotFragment],\n)\n\ntype GetStatsResult = ResultOf<typeof statsQuery>[\"steakhouseStats\"]\n\nexport type GetStatsResultWithHistorical = GetStatsResult & {\n tvl: GetStatsResult[\"tvl\"] & {\n historical: NonNullable<GetStatsResult[\"tvl\"][\"historical\"]>\n }\n}\n\nexport type GetStatsResultWithoutHistorical = Omit<GetStatsResult, \"tvl\"> & {\n tvl: Pick<GetStatsResult[\"tvl\"], \"current\">\n}\n\n/**\n * Get Steakhouse stats: unique depositor count and current TVL breakdown.\n * Pass `{ includeHistorical: true }` to also fetch daily historical TVL snapshots (last 365 days).\n */\nexport async function getStats(\n client: SteakhouseClient,\n options: { includeHistorical: true },\n): Promise<GetStatsResultWithHistorical>\nexport async function getStats(\n client: SteakhouseClient,\n options?: { includeHistorical?: false },\n): Promise<GetStatsResultWithoutHistorical>\nexport async function getStats(\n client: SteakhouseClient,\n options?: { includeHistorical?: boolean },\n) {\n const result = await client.query(statsQuery, {\n includeHistorical: options?.includeHistorical ?? false,\n })\n return result.steakhouseStats\n}\n"],"mappings":"AAAA,SAAS,eAA8B;AAGvC,MAAM,sBAAsB,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAqBnC;AAED,MAAM,aAAa;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBA,CAAC,mBAAmB;AACtB;AA0BA,eAAsB,SACpB,QACA,SACA;AACA,QAAM,SAAS,MAAM,OAAO,MAAM,YAAY;AAAA,IAC5C,mBAAmB,SAAS,qBAAqB;AAAA,EACnD,CAAC;AACD,SAAO,OAAO;AAChB;","names":[]}
@@ -1,5 +1,4 @@
1
- export { GetTvlResult, getTvl } from './tvl/getTvl.js';
2
- export { GetTvlHistoricalResult, getTvlHistorical } from './tvl/getTvlHistorical.js';
1
+ export { GetStatsResultWithHistorical, GetStatsResultWithoutHistorical, getStats } from './getStats.js';
3
2
  import '@whisk/client';
4
3
  import 'gql.tada';
5
4
  import '@whisk/graphql';
@@ -1,3 +1,2 @@
1
- export * from "./tvl/getTvl.js";
2
- export * from "./tvl/getTvlHistorical.js";
1
+ export * from "./getStats.js";
3
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/queries/index.ts"],"sourcesContent":["export * from \"./tvl/getTvl.js\"\nexport * from \"./tvl/getTvlHistorical.js\"\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../src/queries/index.ts"],"sourcesContent":["export * from \"./getStats.js\"\n"],"mappings":"AAAA,cAAc;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whisk/steakhouse",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/office-supply-ventures/whisk-sdk.git",
@@ -36,8 +36,8 @@
36
36
  "dependencies": {
37
37
  "@urql/core": "6.0.1",
38
38
  "gql.tada": "1.9.0",
39
- "@whisk/client": "0.0.16",
40
- "@whisk/graphql": "0.0.16"
39
+ "@whisk/client": "0.0.17",
40
+ "@whisk/graphql": "0.0.17"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "@tanstack/react-query": ">=5",
@@ -0,0 +1,79 @@
1
+ import { graphql, type ResultOf } from "@whisk/graphql"
2
+ import type { SteakhouseClient } from "../client.js"
3
+
4
+ const tvlSnapshotFragment = graphql(`
5
+ fragment TvlSnapshot on SteakhouseTvlSnapshot {
6
+ timestamp
7
+ totalUsd
8
+ byChain {
9
+ chain {
10
+ id
11
+ name
12
+ icon
13
+ }
14
+ tvlUsd
15
+ }
16
+ byProtocol {
17
+ protocol
18
+ tvlUsd
19
+ }
20
+ byAssetCategory {
21
+ category
22
+ tvlUsd
23
+ }
24
+ }
25
+ `)
26
+
27
+ const statsQuery = graphql(
28
+ `
29
+ query GetSteakhouseStats($includeHistorical: Boolean!) {
30
+ steakhouseStats {
31
+ uniqueDepositors
32
+
33
+ tvl {
34
+ current {
35
+ ...TvlSnapshot
36
+ }
37
+ historical @include(if: $includeHistorical) {
38
+ ...TvlSnapshot
39
+ }
40
+ }
41
+ }
42
+ }
43
+ `,
44
+ [tvlSnapshotFragment],
45
+ )
46
+
47
+ type GetStatsResult = ResultOf<typeof statsQuery>["steakhouseStats"]
48
+
49
+ export type GetStatsResultWithHistorical = GetStatsResult & {
50
+ tvl: GetStatsResult["tvl"] & {
51
+ historical: NonNullable<GetStatsResult["tvl"]["historical"]>
52
+ }
53
+ }
54
+
55
+ export type GetStatsResultWithoutHistorical = Omit<GetStatsResult, "tvl"> & {
56
+ tvl: Pick<GetStatsResult["tvl"], "current">
57
+ }
58
+
59
+ /**
60
+ * Get Steakhouse stats: unique depositor count and current TVL breakdown.
61
+ * Pass `{ includeHistorical: true }` to also fetch daily historical TVL snapshots (last 365 days).
62
+ */
63
+ export async function getStats(
64
+ client: SteakhouseClient,
65
+ options: { includeHistorical: true },
66
+ ): Promise<GetStatsResultWithHistorical>
67
+ export async function getStats(
68
+ client: SteakhouseClient,
69
+ options?: { includeHistorical?: false },
70
+ ): Promise<GetStatsResultWithoutHistorical>
71
+ export async function getStats(
72
+ client: SteakhouseClient,
73
+ options?: { includeHistorical?: boolean },
74
+ ) {
75
+ const result = await client.query(statsQuery, {
76
+ includeHistorical: options?.includeHistorical ?? false,
77
+ })
78
+ return result.steakhouseStats
79
+ }
@@ -1,2 +1 @@
1
- export * from "./tvl/getTvl.js"
2
- export * from "./tvl/getTvlHistorical.js"
1
+ export * from "./getStats.js"
@@ -1,3 +0,0 @@
1
- // Removed hooks for now until we have a use case for client side fetching.
2
- // This patten is good, and we have added domain based key limitting, but prefer not to release this yet (less breaking interface possiblity)
3
- // export { useTvl } from "./useTvl.js"
@@ -1,28 +0,0 @@
1
- import * as gql_tada from 'gql.tada';
2
-
3
- declare const tvlSnapshotFragment: gql_tada.TadaDocumentNode<{
4
- timestamp: number;
5
- totalUsd: number;
6
- byChain: {
7
- chain: {
8
- id: number;
9
- name: string;
10
- icon: string;
11
- };
12
- tvlUsd: number;
13
- }[];
14
- byProtocol: {
15
- protocol: "generic" | "morpho_v1" | "morpho_v2" | "box";
16
- tvlUsd: number;
17
- }[];
18
- byAssetCategory: {
19
- category: "Stable" | "Eth" | "Btc" | null;
20
- tvlUsd: number;
21
- }[];
22
- }, {}, {
23
- fragment: "TvlSnapshot";
24
- on: "SteakhouseTvlSnapshot";
25
- masked: false;
26
- }>;
27
-
28
- export { tvlSnapshotFragment };
@@ -1,27 +0,0 @@
1
- import { graphql } from "@whisk/graphql";
2
- const tvlSnapshotFragment = graphql(`
3
- fragment TvlSnapshot on SteakhouseTvlSnapshot {
4
- timestamp
5
- totalUsd
6
- byChain {
7
- chain {
8
- id
9
- name
10
- icon
11
- }
12
- tvlUsd
13
- }
14
- byProtocol {
15
- protocol
16
- tvlUsd
17
- }
18
- byAssetCategory {
19
- category
20
- tvlUsd
21
- }
22
- }
23
- `);
24
- export {
25
- tvlSnapshotFragment
26
- };
27
- //# sourceMappingURL=fragments.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/queries/tvl/fragments.ts"],"sourcesContent":["import { graphql } from \"@whisk/graphql\"\n\nexport const tvlSnapshotFragment = graphql(`\n fragment TvlSnapshot on SteakhouseTvlSnapshot {\n timestamp\n totalUsd\n byChain {\n chain {\n id\n name\n icon\n }\n tvlUsd\n }\n byProtocol {\n protocol\n tvlUsd\n }\n byAssetCategory {\n category\n tvlUsd\n }\n }\n`)\n"],"mappings":"AAAA,SAAS,eAAe;AAEjB,MAAM,sBAAsB,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAqB1C;","names":[]}
@@ -1,35 +0,0 @@
1
- import * as gql_tada from 'gql.tada';
2
- import { ResultOf } from '@whisk/graphql';
3
- import { WhiskClient } from '@whisk/client';
4
-
5
- declare const tvlQuery: gql_tada.TadaDocumentNode<{
6
- steakhouseTvl: {
7
- current: {
8
- timestamp: number;
9
- totalUsd: number;
10
- byChain: {
11
- chain: {
12
- id: number;
13
- name: string;
14
- icon: string;
15
- };
16
- tvlUsd: number;
17
- }[];
18
- byProtocol: {
19
- protocol: "generic" | "morpho_v1" | "morpho_v2" | "box";
20
- tvlUsd: number;
21
- }[];
22
- byAssetCategory: {
23
- category: "Stable" | "Eth" | "Btc" | null;
24
- tvlUsd: number;
25
- }[];
26
- };
27
- };
28
- }, {}, void>;
29
- type GetTvlResult = ResultOf<typeof tvlQuery>["steakhouseTvl"]["current"];
30
- /**
31
- * Get current Steakhouse TVL breakdown by chain, protocol, and asset category.
32
- */
33
- declare function getTvl(client: WhiskClient): Promise<GetTvlResult>;
34
-
35
- export { type GetTvlResult, getTvl };
@@ -1,22 +0,0 @@
1
- import { graphql } from "@whisk/graphql";
2
- import { tvlSnapshotFragment } from "./fragments.js";
3
- const tvlQuery = graphql(
4
- `
5
- query GetSteakhouseTvl {
6
- steakhouseTvl {
7
- current {
8
- ...TvlSnapshot
9
- }
10
- }
11
- }
12
- `,
13
- [tvlSnapshotFragment]
14
- );
15
- async function getTvl(client) {
16
- const result = await client.query(tvlQuery, {});
17
- return result.steakhouseTvl.current;
18
- }
19
- export {
20
- getTvl
21
- };
22
- //# sourceMappingURL=getTvl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/queries/tvl/getTvl.ts"],"sourcesContent":["import { graphql, type ResultOf } from \"@whisk/graphql\"\nimport type { SteakhouseClient } from \"../../client.js\"\nimport { tvlSnapshotFragment } from \"./fragments.js\"\n\nconst tvlQuery = graphql(\n `\n query GetSteakhouseTvl {\n steakhouseTvl {\n current {\n ...TvlSnapshot\n }\n }\n }\n `,\n [tvlSnapshotFragment],\n)\n\nexport type GetTvlResult = ResultOf<typeof tvlQuery>[\"steakhouseTvl\"][\"current\"]\n\n/**\n * Get current Steakhouse TVL breakdown by chain, protocol, and asset category.\n */\nexport async function getTvl(client: SteakhouseClient): Promise<GetTvlResult> {\n const result = await client.query(tvlQuery, {})\n return result.steakhouseTvl.current\n}\n"],"mappings":"AAAA,SAAS,eAA8B;AAEvC,SAAS,2BAA2B;AAEpC,MAAM,WAAW;AAAA,EACf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,CAAC,mBAAmB;AACtB;AAOA,eAAsB,OAAO,QAAiD;AAC5E,QAAM,SAAS,MAAM,OAAO,MAAM,UAAU,CAAC,CAAC;AAC9C,SAAO,OAAO,cAAc;AAC9B;","names":[]}
@@ -1,36 +0,0 @@
1
- import * as gql_tada from 'gql.tada';
2
- import { ResultOf } from '@whisk/graphql';
3
- import { WhiskClient } from '@whisk/client';
4
-
5
- /** GraphQL query for fetching historical Steakhouse TVL */
6
- declare const tvlHistoricalQuery: gql_tada.TadaDocumentNode<{
7
- steakhouseTvl: {
8
- historical: {
9
- timestamp: number;
10
- totalUsd: number;
11
- byChain: {
12
- chain: {
13
- id: number;
14
- name: string;
15
- icon: string;
16
- };
17
- tvlUsd: number;
18
- }[];
19
- byProtocol: {
20
- protocol: "generic" | "morpho_v1" | "morpho_v2" | "box";
21
- tvlUsd: number;
22
- }[];
23
- byAssetCategory: {
24
- category: "Stable" | "Eth" | "Btc" | null;
25
- tvlUsd: number;
26
- }[];
27
- }[];
28
- };
29
- }, {}, void>;
30
- type GetTvlHistoricalResult = ResultOf<typeof tvlHistoricalQuery>["steakhouseTvl"]["historical"];
31
- /**
32
- * Get daily historical TVL snapshots (last 365 days, oldest first).
33
- */
34
- declare function getTvlHistorical(client: WhiskClient): Promise<GetTvlHistoricalResult>;
35
-
36
- export { type GetTvlHistoricalResult, getTvlHistorical };
@@ -1,22 +0,0 @@
1
- import { graphql } from "@whisk/graphql";
2
- import { tvlSnapshotFragment } from "./fragments.js";
3
- const tvlHistoricalQuery = graphql(
4
- `
5
- query GetSteakhouseTvlHistorical {
6
- steakhouseTvl {
7
- historical {
8
- ...TvlSnapshot
9
- }
10
- }
11
- }
12
- `,
13
- [tvlSnapshotFragment]
14
- );
15
- async function getTvlHistorical(client) {
16
- const result = await client.query(tvlHistoricalQuery, {});
17
- return result.steakhouseTvl.historical;
18
- }
19
- export {
20
- getTvlHistorical
21
- };
22
- //# sourceMappingURL=getTvlHistorical.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/queries/tvl/getTvlHistorical.ts"],"sourcesContent":["import { graphql, type ResultOf } from \"@whisk/graphql\"\nimport type { SteakhouseClient } from \"../../client.js\"\nimport { tvlSnapshotFragment } from \"./fragments.js\"\n\n/** GraphQL query for fetching historical Steakhouse TVL */\nconst tvlHistoricalQuery = graphql(\n `\n query GetSteakhouseTvlHistorical {\n steakhouseTvl {\n historical {\n ...TvlSnapshot\n }\n }\n }\n `,\n [tvlSnapshotFragment],\n)\n\nexport type GetTvlHistoricalResult = ResultOf<\n typeof tvlHistoricalQuery\n>[\"steakhouseTvl\"][\"historical\"]\n\n/**\n * Get daily historical TVL snapshots (last 365 days, oldest first).\n */\nexport async function getTvlHistorical(client: SteakhouseClient): Promise<GetTvlHistoricalResult> {\n const result = await client.query(tvlHistoricalQuery, {})\n return result.steakhouseTvl.historical\n}\n"],"mappings":"AAAA,SAAS,eAA8B;AAEvC,SAAS,2BAA2B;AAGpC,MAAM,qBAAqB;AAAA,EACzB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,CAAC,mBAAmB;AACtB;AASA,eAAsB,iBAAiB,QAA2D;AAChG,QAAM,SAAS,MAAM,OAAO,MAAM,oBAAoB,CAAC,CAAC;AACxD,SAAO,OAAO,cAAc;AAC9B;","names":[]}
@@ -1,9 +0,0 @@
1
- import { UseQueryResult } from '@tanstack/react-query';
2
- import { GetTvlResult } from '../../queries/tvl/getTvl.js';
3
- import 'gql.tada';
4
- import '@whisk/graphql';
5
- import '@whisk/client';
6
-
7
- declare function useTvl(): UseQueryResult<GetTvlResult, Error>;
8
-
9
- export { useTvl };
@@ -1,15 +0,0 @@
1
- "use client";
2
- import { useQuery } from "@tanstack/react-query";
3
- import { getTvl } from "../../queries/index.js";
4
- import { useSteakhouse } from "../provider.js";
5
- function useTvl() {
6
- const { client } = useSteakhouse();
7
- return useQuery({
8
- queryKey: ["steakhouse", "tvl"],
9
- queryFn: () => getTvl(client)
10
- });
11
- }
12
- export {
13
- useTvl
14
- };
15
- //# sourceMappingURL=useTvl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/react/hooks/useTvl.ts"],"sourcesContent":["\"use client\"\n\nimport type { UseQueryResult } from \"@tanstack/react-query\"\nimport { useQuery } from \"@tanstack/react-query\"\nimport { type GetTvlResult, getTvl } from \"../../queries/index.js\"\nimport { useSteakhouse } from \"../provider.js\"\n\nexport function useTvl(): UseQueryResult<GetTvlResult, Error> {\n const { client } = useSteakhouse()\n return useQuery({\n queryKey: [\"steakhouse\", \"tvl\"],\n queryFn: () => getTvl(client),\n })\n}\n"],"mappings":";AAGA,SAAS,gBAAgB;AACzB,SAA4B,cAAc;AAC1C,SAAS,qBAAqB;AAEvB,SAAS,SAA8C;AAC5D,QAAM,EAAE,OAAO,IAAI,cAAc;AACjC,SAAO,SAAS;AAAA,IACd,UAAU,CAAC,cAAc,KAAK;AAAA,IAC9B,SAAS,MAAM,OAAO,MAAM;AAAA,EAC9B,CAAC;AACH;","names":[]}
@@ -1,24 +0,0 @@
1
- import { graphql } from "@whisk/graphql"
2
-
3
- export const tvlSnapshotFragment = graphql(`
4
- fragment TvlSnapshot on SteakhouseTvlSnapshot {
5
- timestamp
6
- totalUsd
7
- byChain {
8
- chain {
9
- id
10
- name
11
- icon
12
- }
13
- tvlUsd
14
- }
15
- byProtocol {
16
- protocol
17
- tvlUsd
18
- }
19
- byAssetCategory {
20
- category
21
- tvlUsd
22
- }
23
- }
24
- `)
@@ -1,26 +0,0 @@
1
- import { graphql, type ResultOf } from "@whisk/graphql"
2
- import type { SteakhouseClient } from "../../client.js"
3
- import { tvlSnapshotFragment } from "./fragments.js"
4
-
5
- const tvlQuery = graphql(
6
- `
7
- query GetSteakhouseTvl {
8
- steakhouseTvl {
9
- current {
10
- ...TvlSnapshot
11
- }
12
- }
13
- }
14
- `,
15
- [tvlSnapshotFragment],
16
- )
17
-
18
- export type GetTvlResult = ResultOf<typeof tvlQuery>["steakhouseTvl"]["current"]
19
-
20
- /**
21
- * Get current Steakhouse TVL breakdown by chain, protocol, and asset category.
22
- */
23
- export async function getTvl(client: SteakhouseClient): Promise<GetTvlResult> {
24
- const result = await client.query(tvlQuery, {})
25
- return result.steakhouseTvl.current
26
- }
@@ -1,29 +0,0 @@
1
- import { graphql, type ResultOf } from "@whisk/graphql"
2
- import type { SteakhouseClient } from "../../client.js"
3
- import { tvlSnapshotFragment } from "./fragments.js"
4
-
5
- /** GraphQL query for fetching historical Steakhouse TVL */
6
- const tvlHistoricalQuery = graphql(
7
- `
8
- query GetSteakhouseTvlHistorical {
9
- steakhouseTvl {
10
- historical {
11
- ...TvlSnapshot
12
- }
13
- }
14
- }
15
- `,
16
- [tvlSnapshotFragment],
17
- )
18
-
19
- export type GetTvlHistoricalResult = ResultOf<
20
- typeof tvlHistoricalQuery
21
- >["steakhouseTvl"]["historical"]
22
-
23
- /**
24
- * Get daily historical TVL snapshots (last 365 days, oldest first).
25
- */
26
- export async function getTvlHistorical(client: SteakhouseClient): Promise<GetTvlHistoricalResult> {
27
- const result = await client.query(tvlHistoricalQuery, {})
28
- return result.steakhouseTvl.historical
29
- }
@@ -1,14 +0,0 @@
1
- "use client"
2
-
3
- import type { UseQueryResult } from "@tanstack/react-query"
4
- import { useQuery } from "@tanstack/react-query"
5
- import { type GetTvlResult, getTvl } from "../../queries/index.js"
6
- import { useSteakhouse } from "../provider.js"
7
-
8
- export function useTvl(): UseQueryResult<GetTvlResult, Error> {
9
- const { client } = useSteakhouse()
10
- return useQuery({
11
- queryKey: ["steakhouse", "tvl"],
12
- queryFn: () => getTvl(client),
13
- })
14
- }