@whisk/steakhouse 0.0.10 → 0.1.1

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.
Files changed (39) hide show
  1. package/dist/index.d.ts +2 -1
  2. package/dist/metadata/address-registry.d.ts +9 -0
  3. package/dist/metadata/address-registry.js +20 -0
  4. package/dist/metadata/address-registry.js.map +1 -0
  5. package/dist/metadata/index.d.ts +1 -0
  6. package/dist/metadata/index.js +3 -1
  7. package/dist/metadata/index.js.map +1 -1
  8. package/dist/queries/index.d.ts +2 -1
  9. package/dist/queries/index.js +2 -1
  10. package/dist/queries/index.js.map +1 -1
  11. package/dist/queries/tvl/fragments.d.ts +28 -0
  12. package/dist/queries/tvl/fragments.js +27 -0
  13. package/dist/queries/tvl/fragments.js.map +1 -0
  14. package/dist/queries/tvl/getTvl.d.ts +35 -0
  15. package/dist/queries/tvl/getTvl.js +22 -0
  16. package/dist/queries/tvl/getTvl.js.map +1 -0
  17. package/dist/queries/tvl/getTvlHistorical.d.ts +36 -0
  18. package/dist/queries/tvl/getTvlHistorical.js +22 -0
  19. package/dist/queries/tvl/getTvlHistorical.js.map +1 -0
  20. package/dist/react/hooks/index.d.ts +2 -6
  21. package/dist/react/hooks/index.js +0 -4
  22. package/dist/react/hooks/index.js.map +1 -1
  23. package/dist/react/hooks/useTvl.d.ts +2 -2
  24. package/dist/react/hooks/useTvl.js +1 -1
  25. package/dist/react/hooks/useTvl.js.map +1 -1
  26. package/dist/react/index.d.ts +1 -6
  27. package/package.json +6 -5
  28. package/src/metadata/address-registry.ts +23 -0
  29. package/src/metadata/index.ts +1 -0
  30. package/src/queries/index.ts +2 -1
  31. package/src/queries/tvl/fragments.ts +24 -0
  32. package/src/queries/tvl/getTvl.ts +26 -0
  33. package/src/queries/tvl/getTvlHistorical.ts +29 -0
  34. package/src/react/hooks/index.ts +3 -1
  35. package/src/react/hooks/useTvl.ts +1 -1
  36. package/dist/queries/getTvl.d.ts +0 -34
  37. package/dist/queries/getTvl.js +0 -34
  38. package/dist/queries/getTvl.js.map +0 -1
  39. package/src/queries/getTvl.ts +0 -38
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { WhiskClient as SteakhouseClient, WhiskClientConfig as SteakhouseClientConfig } from '@whisk/client';
2
- export { GetTvlResult, getTvl, tvlQuery } from './queries/getTvl.js';
2
+ export { GetTvlResult, getTvl } from './queries/tvl/getTvl.js';
3
+ export { GetTvlHistoricalResult, getTvlHistorical } from './queries/tvl/getTvlHistorical.js';
3
4
  import 'gql.tada';
4
5
  import '@whisk/graphql';
@@ -0,0 +1,9 @@
1
+ import { Address } from './types.js';
2
+ import '@whisk/graphql';
3
+
4
+ interface ChainAddresses {
5
+ readonly boxFactory?: Address;
6
+ }
7
+ declare function getChainAddresses(chainId: number): ChainAddresses;
8
+
9
+ export { type ChainAddresses, getChainAddresses };
@@ -0,0 +1,20 @@
1
+ import { getAddress } from "viem";
2
+ import { arbitrum, base, mainnet } from "viem/chains";
3
+ const addressesRegistry = {
4
+ [mainnet.id]: {
5
+ boxFactory: getAddress("0xcF23d316e7C415a70836Ec9E68568C3cD82EBFc4")
6
+ },
7
+ [base.id]: {
8
+ boxFactory: getAddress("0x846365F9A09aeB7005127C6060876C82F7F70c0b")
9
+ },
10
+ [arbitrum.id]: {
11
+ boxFactory: getAddress("0x72576c537e25AeCb3026E5c8EF4B90436E22A333")
12
+ }
13
+ };
14
+ function getChainAddresses(chainId) {
15
+ return addressesRegistry[chainId] ?? {};
16
+ }
17
+ export {
18
+ getChainAddresses
19
+ };
20
+ //# sourceMappingURL=address-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/metadata/address-registry.ts"],"sourcesContent":["import { getAddress } from \"viem\"\nimport { arbitrum, base, mainnet } from \"viem/chains\"\nimport type { Address } from \"./types.js\"\n\nexport interface ChainAddresses {\n readonly boxFactory?: Address\n}\n\nconst addressesRegistry: Record<number, ChainAddresses> = {\n [mainnet.id]: {\n boxFactory: getAddress(\"0xcF23d316e7C415a70836Ec9E68568C3cD82EBFc4\"),\n },\n [base.id]: {\n boxFactory: getAddress(\"0x846365F9A09aeB7005127C6060876C82F7F70c0b\"),\n },\n [arbitrum.id]: {\n boxFactory: getAddress(\"0x72576c537e25AeCb3026E5c8EF4B90436E22A333\"),\n },\n}\n\nexport function getChainAddresses(chainId: number): ChainAddresses {\n return addressesRegistry[chainId] ?? {}\n}\n"],"mappings":"AAAA,SAAS,kBAAkB;AAC3B,SAAS,UAAU,MAAM,eAAe;AAOxC,MAAM,oBAAoD;AAAA,EACxD,CAAC,QAAQ,EAAE,GAAG;AAAA,IACZ,YAAY,WAAW,4CAA4C;AAAA,EACrE;AAAA,EACA,CAAC,KAAK,EAAE,GAAG;AAAA,IACT,YAAY,WAAW,4CAA4C;AAAA,EACrE;AAAA,EACA,CAAC,SAAS,EAAE,GAAG;AAAA,IACb,YAAY,WAAW,4CAA4C;AAAA,EACrE;AACF;AAEO,SAAS,kBAAkB,SAAiC;AACjE,SAAO,kBAAkB,OAAO,KAAK,CAAC;AACxC;","names":[]}
@@ -1,3 +1,4 @@
1
+ export { ChainAddresses, getChainAddresses } from './address-registry.js';
1
2
  export { STEAKHOUSE_VAULTS } from './generated/vaults.js';
2
3
  export { VaultConfig } from './types.js';
3
4
  import '@whisk/graphql';
@@ -1,5 +1,7 @@
1
+ import { getChainAddresses } from "./address-registry.js";
1
2
  import { STEAKHOUSE_VAULTS } from "./generated/vaults.js";
2
3
  export {
3
- STEAKHOUSE_VAULTS
4
+ STEAKHOUSE_VAULTS,
5
+ getChainAddresses
4
6
  };
5
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/metadata/index.ts"],"sourcesContent":["export { STEAKHOUSE_VAULTS } from \"./generated/vaults.js\"\nexport type { VaultConfig } from \"./types.js\"\n"],"mappings":"AAAA,SAAS,yBAAyB;","names":[]}
1
+ {"version":3,"sources":["../../src/metadata/index.ts"],"sourcesContent":["export { type ChainAddresses, getChainAddresses } from \"./address-registry.js\"\nexport { STEAKHOUSE_VAULTS } from \"./generated/vaults.js\"\nexport type { VaultConfig } from \"./types.js\"\n"],"mappings":"AAAA,SAA8B,yBAAyB;AACvD,SAAS,yBAAyB;","names":[]}
@@ -1,4 +1,5 @@
1
- export { GetTvlResult, getTvl, tvlQuery } from './getTvl.js';
1
+ export { GetTvlResult, getTvl } from './tvl/getTvl.js';
2
+ export { GetTvlHistoricalResult, getTvlHistorical } from './tvl/getTvlHistorical.js';
2
3
  import '@whisk/client';
3
4
  import 'gql.tada';
4
5
  import '@whisk/graphql';
@@ -1,2 +1,3 @@
1
- export * from "./getTvl.js";
1
+ export * from "./tvl/getTvl.js";
2
+ export * from "./tvl/getTvlHistorical.js";
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/queries/index.ts"],"sourcesContent":["export * from \"./getTvl.js\"\n"],"mappings":"AAAA,cAAc;","names":[]}
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":[]}
@@ -0,0 +1,28 @@
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 };
@@ -0,0 +1,27 @@
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
@@ -0,0 +1 @@
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":[]}
@@ -0,0 +1,35 @@
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 };
@@ -0,0 +1,22 @@
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
@@ -0,0 +1 @@
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":[]}
@@ -0,0 +1,36 @@
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 };
@@ -0,0 +1,22 @@
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
@@ -0,0 +1 @@
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,6 +1,2 @@
1
- export { useTvl } from './useTvl.js';
2
- import '@tanstack/react-query';
3
- import '../../queries/getTvl.js';
4
- import '@whisk/client';
5
- import 'gql.tada';
6
- import '@whisk/graphql';
1
+
2
+ export { }
@@ -1,5 +1 @@
1
- import { useTvl } from "./useTvl.js";
2
- export {
3
- useTvl
4
- };
5
1
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/react/hooks/index.ts"],"sourcesContent":["export { useTvl } from \"./useTvl.js\"\n"],"mappings":"AAAA,SAAS,cAAc;","names":[]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,8 +1,8 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
- import { GetTvlResult } from '../../queries/getTvl.js';
3
- import '@whisk/client';
2
+ import { GetTvlResult } from '../../queries/tvl/getTvl.js';
4
3
  import 'gql.tada';
5
4
  import '@whisk/graphql';
5
+ import '@whisk/client';
6
6
 
7
7
  declare function useTvl(): UseQueryResult<GetTvlResult, Error>;
8
8
 
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { useQuery } from "@tanstack/react-query";
3
- import { getTvl } from "../../queries/getTvl.js";
3
+ import { getTvl } from "../../queries/index.js";
4
4
  import { useSteakhouse } from "../provider.js";
5
5
  function useTvl() {
6
6
  const { client } = useSteakhouse();
@@ -1 +1 @@
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/getTvl.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
+ {"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,8 +1,3 @@
1
- export { useTvl } from './hooks/useTvl.js';
2
1
  export { SteakhouseContextValue, SteakhouseProvider, SteakhouseProviderProps, useSteakhouse } from './provider.js';
3
- import '@tanstack/react-query';
4
- import '../queries/getTvl.js';
5
- import '@whisk/client';
6
- import 'gql.tada';
7
- import '@whisk/graphql';
8
2
  import 'react';
3
+ import '@whisk/client';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whisk/steakhouse",
3
- "version": "0.0.10",
3
+ "version": "0.1.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/office-supply-ventures/whisk-sdk.git",
@@ -36,14 +36,15 @@
36
36
  "dependencies": {
37
37
  "@urql/core": "6.0.1",
38
38
  "gql.tada": "1.9.0",
39
- "@whisk/client": "0.0.13",
40
- "@whisk/graphql": "0.0.13"
39
+ "@whisk/client": "0.0.14",
40
+ "@whisk/graphql": "0.0.14"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "@tanstack/react-query": ">=5",
44
44
  "graphql": ">=16",
45
45
  "react": ">=18",
46
- "react-dom": ">=18"
46
+ "react-dom": ">=18",
47
+ "viem": ">=2"
47
48
  },
48
49
  "peerDependenciesMeta": {
49
50
  "react": {
@@ -76,6 +77,6 @@
76
77
  "generate:vaults:watch": "chokidar \"src/metadata/vaults/**/*.md\" --initial -c \"pnpm generate:vaults\"",
77
78
  "build": "pnpm generate:vaults && tsup",
78
79
  "dev": "concurrently -n vaults,tsup -c blue,green \"pnpm generate:vaults:watch\" \"tsup --watch\"",
79
- "check:types": "tsc --noEmit"
80
+ "check:types": "tsgo --noEmit"
80
81
  }
81
82
  }
@@ -0,0 +1,23 @@
1
+ import { getAddress } from "viem"
2
+ import { arbitrum, base, mainnet } from "viem/chains"
3
+ import type { Address } from "./types.js"
4
+
5
+ export interface ChainAddresses {
6
+ readonly boxFactory?: Address
7
+ }
8
+
9
+ const addressesRegistry: Record<number, ChainAddresses> = {
10
+ [mainnet.id]: {
11
+ boxFactory: getAddress("0xcF23d316e7C415a70836Ec9E68568C3cD82EBFc4"),
12
+ },
13
+ [base.id]: {
14
+ boxFactory: getAddress("0x846365F9A09aeB7005127C6060876C82F7F70c0b"),
15
+ },
16
+ [arbitrum.id]: {
17
+ boxFactory: getAddress("0x72576c537e25AeCb3026E5c8EF4B90436E22A333"),
18
+ },
19
+ }
20
+
21
+ export function getChainAddresses(chainId: number): ChainAddresses {
22
+ return addressesRegistry[chainId] ?? {}
23
+ }
@@ -1,2 +1,3 @@
1
+ export { type ChainAddresses, getChainAddresses } from "./address-registry.js"
1
2
  export { STEAKHOUSE_VAULTS } from "./generated/vaults.js"
2
3
  export type { VaultConfig } from "./types.js"
@@ -1 +1,2 @@
1
- export * from "./getTvl.js"
1
+ export * from "./tvl/getTvl.js"
2
+ export * from "./tvl/getTvlHistorical.js"
@@ -0,0 +1,24 @@
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
+ `)
@@ -0,0 +1,26 @@
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
+ }
@@ -0,0 +1,29 @@
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 +1,3 @@
1
- export { useTvl } from "./useTvl.js"
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"
@@ -2,7 +2,7 @@
2
2
 
3
3
  import type { UseQueryResult } from "@tanstack/react-query"
4
4
  import { useQuery } from "@tanstack/react-query"
5
- import { type GetTvlResult, getTvl } from "../../queries/getTvl.js"
5
+ import { type GetTvlResult, getTvl } from "../../queries/index.js"
6
6
  import { useSteakhouse } from "../provider.js"
7
7
 
8
8
  export function useTvl(): UseQueryResult<GetTvlResult, Error> {
@@ -1,34 +0,0 @@
1
- import { WhiskClient } from '@whisk/client';
2
- import * as gql_tada from 'gql.tada';
3
- import { ResultOf } from '@whisk/graphql';
4
-
5
- /** GraphQL query for fetching Steakhouse TVL */
6
- declare const tvlQuery: gql_tada.TadaDocumentNode<{
7
- steakhouseTvl: {
8
- totalUsd: number;
9
- computedAt: 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";
24
- tvlUsd: number;
25
- }[];
26
- };
27
- }, {}, void>;
28
- type GetTvlResult = ResultOf<typeof tvlQuery>["steakhouseTvl"];
29
- /**
30
- * Get Steakhouse TVL breakdown by chain, protocol, and asset category.
31
- */
32
- declare function getTvl(client: WhiskClient): Promise<GetTvlResult>;
33
-
34
- export { type GetTvlResult, getTvl, tvlQuery };
@@ -1,34 +0,0 @@
1
- import { graphql } from "@whisk/graphql";
2
- const tvlQuery = graphql(`
3
- query GetSteakhouseTvl {
4
- steakhouseTvl {
5
- totalUsd
6
- computedAt
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
- }
25
- `);
26
- async function getTvl(client) {
27
- const result = await client.query(tvlQuery, {});
28
- return result.steakhouseTvl;
29
- }
30
- export {
31
- getTvl,
32
- tvlQuery
33
- };
34
- //# sourceMappingURL=getTvl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/queries/getTvl.ts"],"sourcesContent":["import { graphql, type ResultOf } from \"@whisk/graphql\"\nimport type { SteakhouseClient } from \"../client.js\"\n\n/** GraphQL query for fetching Steakhouse TVL */\nexport const tvlQuery = graphql(`\n query GetSteakhouseTvl {\n steakhouseTvl {\n totalUsd\n computedAt\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`)\n\nexport type GetTvlResult = ResultOf<typeof tvlQuery>[\"steakhouseTvl\"]\n\n/**\n * Get 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\n}\n"],"mappings":"AAAA,SAAS,eAA8B;AAIhC,MAAM,WAAW,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAuB/B;AAOD,eAAsB,OAAO,QAAiD;AAC5E,QAAM,SAAS,MAAM,OAAO,MAAM,UAAU,CAAC,CAAC;AAC9C,SAAO,OAAO;AAChB;","names":[]}
@@ -1,38 +0,0 @@
1
- import { graphql, type ResultOf } from "@whisk/graphql"
2
- import type { SteakhouseClient } from "../client.js"
3
-
4
- /** GraphQL query for fetching Steakhouse TVL */
5
- export const tvlQuery = graphql(`
6
- query GetSteakhouseTvl {
7
- steakhouseTvl {
8
- totalUsd
9
- computedAt
10
- byChain {
11
- chain {
12
- id
13
- name
14
- icon
15
- }
16
- tvlUsd
17
- }
18
- byProtocol {
19
- protocol
20
- tvlUsd
21
- }
22
- byAssetCategory {
23
- category
24
- tvlUsd
25
- }
26
- }
27
- }
28
- `)
29
-
30
- export type GetTvlResult = ResultOf<typeof tvlQuery>["steakhouseTvl"]
31
-
32
- /**
33
- * Get Steakhouse TVL breakdown by chain, protocol, and asset category.
34
- */
35
- export async function getTvl(client: SteakhouseClient): Promise<GetTvlResult> {
36
- const result = await client.query(tvlQuery, {})
37
- return result.steakhouseTvl
38
- }