@whisk/steakhouse 0.0.2
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/LICENSE +21 -0
- package/dist/client.d.ts +12 -0
- package/dist/client.js +14 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/metadata/chains.d.ts +7 -0
- package/dist/metadata/chains.js +15 -0
- package/dist/metadata/chains.js.map +1 -0
- package/dist/metadata/index.d.ts +3 -0
- package/dist/metadata/index.js +11 -0
- package/dist/metadata/index.js.map +1 -0
- package/dist/metadata/types.d.ts +17 -0
- package/dist/metadata/types.js +1 -0
- package/dist/metadata/types.js.map +1 -0
- package/dist/metadata/vaults.d.ts +7 -0
- package/dist/metadata/vaults.js +24 -0
- package/dist/metadata/vaults.js.map +1 -0
- package/dist/queries/fragments/vault.d.ts +19 -0
- package/dist/queries/fragments/vault.js +16 -0
- package/dist/queries/fragments/vault.js.map +1 -0
- package/dist/queries/getVaults.d.ts +27 -0
- package/dist/queries/getVaults.js +23 -0
- package/dist/queries/getVaults.js.map +1 -0
- package/dist/queries/index.d.ts +8 -0
- package/dist/queries/index.js +11 -0
- package/dist/queries/index.js.map +1 -0
- package/dist/queries/types.d.ts +7 -0
- package/dist/queries/types.js +1 -0
- package/dist/queries/types.js.map +1 -0
- package/dist/react/hooks/index.d.ts +10 -0
- package/dist/react/hooks/index.js +7 -0
- package/dist/react/hooks/index.js.map +1 -0
- package/dist/react/hooks/useSteakhouseQuery.d.ts +13 -0
- package/dist/react/hooks/useSteakhouseQuery.js +14 -0
- package/dist/react/hooks/useSteakhouseQuery.js.map +1 -0
- package/dist/react/hooks/useVaults.d.ts +19 -0
- package/dist/react/hooks/useVaults.js +14 -0
- package/dist/react/hooks/useVaults.js.map +1 -0
- package/dist/react/index.d.ts +12 -0
- package/dist/react/index.js +10 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/provider.d.ts +15 -0
- package/dist/react/provider.js +22 -0
- package/dist/react/provider.js.map +1 -0
- package/package.json +65 -0
- package/src/client.test.ts +27 -0
- package/src/client.ts +19 -0
- package/src/index.ts +3 -0
- package/src/metadata/chains.ts +13 -0
- package/src/metadata/index.ts +3 -0
- package/src/metadata/types.ts +19 -0
- package/src/metadata/vaults.ts +27 -0
- package/src/queries/fragments/vault.ts +15 -0
- package/src/queries/getVaults.ts +28 -0
- package/src/queries/index.ts +8 -0
- package/src/queries/types.ts +6 -0
- package/src/react/hooks/index.ts +2 -0
- package/src/react/hooks/useSteakhouseQuery.ts +17 -0
- package/src/react/hooks/useVaults.ts +12 -0
- package/src/react/index.ts +7 -0
- package/src/react/provider.tsx +30 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Office Supply Ventures LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AnyVariables, TypedDocumentNode } from '@urql/core';
|
|
2
|
+
import { WhiskClientConfig } from '@whisk/client';
|
|
3
|
+
|
|
4
|
+
interface SteakhouseClientConfig extends WhiskClientConfig {
|
|
5
|
+
}
|
|
6
|
+
declare class SteakhouseClient {
|
|
7
|
+
private readonly client;
|
|
8
|
+
constructor(config: SteakhouseClientConfig);
|
|
9
|
+
query<TValue, TVariables extends AnyVariables>(document: TypedDocumentNode<TValue, TVariables>, variables: TVariables): Promise<TValue>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { SteakhouseClient, type SteakhouseClientConfig };
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { WhiskClient } from "@whisk/client";
|
|
2
|
+
class SteakhouseClient {
|
|
3
|
+
client;
|
|
4
|
+
constructor(config) {
|
|
5
|
+
this.client = new WhiskClient(config);
|
|
6
|
+
}
|
|
7
|
+
async query(document, variables) {
|
|
8
|
+
return this.client.query(document, variables);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
SteakhouseClient
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/client.ts"],"sourcesContent":["import type { AnyVariables, TypedDocumentNode } from \"@urql/core\"\nimport { WhiskClient, type WhiskClientConfig } from \"@whisk/client\"\n\nexport interface SteakhouseClientConfig extends WhiskClientConfig {}\n\nexport class SteakhouseClient {\n private readonly client: WhiskClient\n\n constructor(config: SteakhouseClientConfig) {\n this.client = new WhiskClient(config)\n }\n\n public async query<TValue, TVariables extends AnyVariables>(\n document: TypedDocumentNode<TValue, TVariables>,\n variables: TVariables,\n ): Promise<TValue> {\n return this.client.query(document, variables)\n }\n}\n"],"mappings":"AACA,SAAS,mBAA2C;AAI7C,MAAM,iBAAiB;AAAA,EACX;AAAA,EAEjB,YAAY,QAAgC;AAC1C,SAAK,SAAS,IAAI,YAAY,MAAM;AAAA,EACtC;AAAA,EAEA,MAAa,MACX,UACA,WACiB;AACjB,WAAO,KAAK,OAAO,MAAM,UAAU,SAAS;AAAA,EAC9C;AACF;","names":[]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { SteakhouseClient, SteakhouseClientConfig } from './client.js';
|
|
2
|
+
export { Vault, vaultFragment } from './queries/fragments/vault.js';
|
|
3
|
+
export { GetVaultsResult, GetVaultsVariables, getVaults, vaultQuery } from './queries/getVaults.js';
|
|
4
|
+
export { SteakhouseQueryFn } from './queries/types.js';
|
|
5
|
+
import '@urql/core';
|
|
6
|
+
import '@whisk/client';
|
|
7
|
+
import 'gql.tada';
|
|
8
|
+
import '@whisk/graphql';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { SteakhouseClient, type SteakhouseClientConfig } from \"./client.js\"\nexport * from \"./queries/index.js\"\nexport type { SteakhouseQueryFn } from \"./queries/types.js\"\n"],"mappings":"AAAA,SAAS,wBAAqD;AAC9D,cAAc;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/metadata/chains.ts"],"sourcesContent":["import type { ChainConfig } from \"./types.js\"\n\nexport const MAINNET: ChainConfig = {\n id: 1,\n name: \"Ethereum Mainnet\",\n}\n\nexport const BASE: ChainConfig = {\n id: 8453,\n name: \"Base\",\n}\n\nexport const SUPPORTED_CHAINS = [MAINNET, BASE] as const\n"],"mappings":"AAEO,MAAM,UAAuB;AAAA,EAClC,IAAI;AAAA,EACJ,MAAM;AACR;AAEO,MAAM,OAAoB;AAAA,EAC/B,IAAI;AAAA,EACJ,MAAM;AACR;AAEO,MAAM,mBAAmB,CAAC,SAAS,IAAI;","names":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BASE, MAINNET, SUPPORTED_CHAINS } from "./chains.js";
|
|
2
|
+
import { ALL_VAULTS, BASE_VAULTS, MAINNET_VAULTS } from "./vaults.js";
|
|
3
|
+
export {
|
|
4
|
+
ALL_VAULTS,
|
|
5
|
+
BASE,
|
|
6
|
+
BASE_VAULTS,
|
|
7
|
+
MAINNET,
|
|
8
|
+
MAINNET_VAULTS,
|
|
9
|
+
SUPPORTED_CHAINS
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/metadata/index.ts"],"sourcesContent":["export { BASE, MAINNET, SUPPORTED_CHAINS } from \"./chains.js\"\nexport type { Address, ChainConfig, VaultConfig, VaultProtocol, VaultTag } from \"./types.js\"\nexport { ALL_VAULTS, BASE_VAULTS, MAINNET_VAULTS } from \"./vaults.js\"\n"],"mappings":"AAAA,SAAS,MAAM,SAAS,wBAAwB;AAEhD,SAAS,YAAY,aAAa,sBAAsB;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type Address = `0x${string}`;
|
|
2
|
+
type VaultProtocol = "morpho" | "steakhouse";
|
|
3
|
+
type VaultTag = "featured" | "new" | "deprecated";
|
|
4
|
+
interface VaultConfig {
|
|
5
|
+
readonly address: Address;
|
|
6
|
+
readonly protocol: VaultProtocol;
|
|
7
|
+
readonly name?: string;
|
|
8
|
+
readonly description?: string;
|
|
9
|
+
readonly tag?: VaultTag;
|
|
10
|
+
readonly isHidden?: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface ChainConfig {
|
|
13
|
+
readonly id: number;
|
|
14
|
+
readonly name: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type { Address, ChainConfig, VaultConfig, VaultProtocol, VaultTag };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const MAINNET_VAULTS = [
|
|
2
|
+
// Example placeholder vault
|
|
3
|
+
// {
|
|
4
|
+
// address: "0x...",
|
|
5
|
+
// protocol: "steakhouse",
|
|
6
|
+
// name: "Steakhouse USDC Vault",
|
|
7
|
+
// tag: "featured",
|
|
8
|
+
// },
|
|
9
|
+
];
|
|
10
|
+
const BASE_VAULTS = [
|
|
11
|
+
// Example placeholder vault
|
|
12
|
+
// {
|
|
13
|
+
// address: "0x...",
|
|
14
|
+
// protocol: "steakhouse",
|
|
15
|
+
// name: "Steakhouse USDC Vault",
|
|
16
|
+
// },
|
|
17
|
+
];
|
|
18
|
+
const ALL_VAULTS = [...MAINNET_VAULTS, ...BASE_VAULTS];
|
|
19
|
+
export {
|
|
20
|
+
ALL_VAULTS,
|
|
21
|
+
BASE_VAULTS,
|
|
22
|
+
MAINNET_VAULTS
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=vaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/metadata/vaults.ts"],"sourcesContent":["import type { VaultConfig } from \"./types.js\"\n\n// Mainnet vault configurations\n// TODO: Add real Steakhouse vault addresses\nexport const MAINNET_VAULTS: readonly VaultConfig[] = [\n // Example placeholder vault\n // {\n // address: \"0x...\",\n // protocol: \"steakhouse\",\n // name: \"Steakhouse USDC Vault\",\n // tag: \"featured\",\n // },\n] as const\n\n// Base vault configurations\n// TODO: Add real Steakhouse vault addresses\nexport const BASE_VAULTS: readonly VaultConfig[] = [\n // Example placeholder vault\n // {\n // address: \"0x...\",\n // protocol: \"steakhouse\",\n // name: \"Steakhouse USDC Vault\",\n // },\n] as const\n\n// All vaults across all chains\nexport const ALL_VAULTS = [...MAINNET_VAULTS, ...BASE_VAULTS] as const\n"],"mappings":"AAIO,MAAM,iBAAyC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQtD;AAIO,MAAM,cAAsC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOnD;AAGO,MAAM,aAAa,CAAC,GAAG,gBAAgB,GAAG,WAAW;","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as gql_tada from 'gql.tada';
|
|
2
|
+
import { FragmentOf } from '@whisk/graphql';
|
|
3
|
+
|
|
4
|
+
declare const vaultFragment: gql_tada.TadaDocumentNode<{
|
|
5
|
+
chain: {
|
|
6
|
+
id: number;
|
|
7
|
+
};
|
|
8
|
+
vaultAddress: `0x${string}`;
|
|
9
|
+
totalSupplied: {
|
|
10
|
+
raw: bigint;
|
|
11
|
+
};
|
|
12
|
+
}, {}, {
|
|
13
|
+
fragment: "VaultFragment";
|
|
14
|
+
on: "MorphoVault";
|
|
15
|
+
masked: false;
|
|
16
|
+
}>;
|
|
17
|
+
type Vault = FragmentOf<typeof vaultFragment>;
|
|
18
|
+
|
|
19
|
+
export { type Vault, vaultFragment };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { graphql } from "@whisk/graphql";
|
|
2
|
+
const vaultFragment = graphql(`
|
|
3
|
+
fragment VaultFragment on MorphoVault {
|
|
4
|
+
chain {
|
|
5
|
+
id
|
|
6
|
+
}
|
|
7
|
+
vaultAddress
|
|
8
|
+
totalSupplied {
|
|
9
|
+
raw
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
`);
|
|
13
|
+
export {
|
|
14
|
+
vaultFragment
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=vault.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/queries/fragments/vault.ts"],"sourcesContent":["import { type FragmentOf, graphql } from \"@whisk/graphql\"\n\nexport const vaultFragment = graphql(`\n fragment VaultFragment on MorphoVault {\n chain {\n id\n }\n vaultAddress\n totalSupplied {\n raw\n }\n }\n`)\n\nexport type Vault = FragmentOf<typeof vaultFragment>\n"],"mappings":"AAAA,SAA0B,eAAe;AAElC,MAAM,gBAAgB,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAUpC;","names":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as gql_tada from 'gql.tada';
|
|
2
|
+
import { VariablesOf } from 'gql.tada';
|
|
3
|
+
import { ResultOf } from '@whisk/graphql';
|
|
4
|
+
import { SteakhouseClient } from '../client.js';
|
|
5
|
+
import '@urql/core';
|
|
6
|
+
import '@whisk/client';
|
|
7
|
+
|
|
8
|
+
declare const vaultQuery: gql_tada.TadaDocumentNode<{
|
|
9
|
+
morphoVaults: {
|
|
10
|
+
items: ({
|
|
11
|
+
chain: {
|
|
12
|
+
id: number;
|
|
13
|
+
};
|
|
14
|
+
vaultAddress: `0x${string}`;
|
|
15
|
+
totalSupplied: {
|
|
16
|
+
raw: bigint;
|
|
17
|
+
};
|
|
18
|
+
} | null)[];
|
|
19
|
+
};
|
|
20
|
+
}, {
|
|
21
|
+
limit: number;
|
|
22
|
+
}, void>;
|
|
23
|
+
type GetVaultsVariables = VariablesOf<typeof vaultQuery>;
|
|
24
|
+
type GetVaultsResult = ResultOf<typeof vaultQuery>["morphoVaults"]["items"];
|
|
25
|
+
declare function getVaults(client: SteakhouseClient, variables: GetVaultsVariables): Promise<GetVaultsResult>;
|
|
26
|
+
|
|
27
|
+
export { type GetVaultsResult, type GetVaultsVariables, getVaults, vaultQuery };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { graphql } from "@whisk/graphql";
|
|
2
|
+
import { vaultFragment } from "./fragments/vault.js";
|
|
3
|
+
const vaultQuery = graphql(
|
|
4
|
+
`
|
|
5
|
+
query GetVaults($limit: Int!) {
|
|
6
|
+
morphoVaults(limit: $limit) {
|
|
7
|
+
items {
|
|
8
|
+
...VaultFragment
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
`,
|
|
13
|
+
[vaultFragment]
|
|
14
|
+
);
|
|
15
|
+
async function getVaults(client, variables) {
|
|
16
|
+
const result = await client.query(vaultQuery, variables);
|
|
17
|
+
return result.morphoVaults.items;
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
getVaults,
|
|
21
|
+
vaultQuery
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=getVaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/queries/getVaults.ts"],"sourcesContent":["import { graphql, type ResultOf } from \"@whisk/graphql\"\nimport type { VariablesOf } from \"gql.tada\"\nimport type { SteakhouseClient } from \"../client.js\"\nimport { vaultFragment } from \"./fragments/vault.js\"\n\nexport const vaultQuery = graphql(\n `\n query GetVaults($limit: Int!) {\n morphoVaults(limit: $limit) {\n items {\n ...VaultFragment\n }\n }\n }\n `,\n [vaultFragment],\n)\n\nexport type GetVaultsVariables = VariablesOf<typeof vaultQuery>\nexport type GetVaultsResult = ResultOf<typeof vaultQuery>[\"morphoVaults\"][\"items\"]\n\nexport async function getVaults(\n client: SteakhouseClient,\n variables: GetVaultsVariables,\n): Promise<GetVaultsResult> {\n const result = await client.query(vaultQuery, variables)\n return result.morphoVaults.items\n}\n"],"mappings":"AAAA,SAAS,eAA8B;AAGvC,SAAS,qBAAqB;AAEvB,MAAM,aAAa;AAAA,EACxB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,CAAC,aAAa;AAChB;AAKA,eAAsB,UACpB,QACA,WAC0B;AAC1B,QAAM,SAAS,MAAM,OAAO,MAAM,YAAY,SAAS;AACvD,SAAO,OAAO,aAAa;AAC7B;","names":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { Vault, vaultFragment } from './fragments/vault.js';
|
|
2
|
+
export { GetVaultsResult, GetVaultsVariables, getVaults, vaultQuery } from './getVaults.js';
|
|
3
|
+
export { SteakhouseQueryFn } from './types.js';
|
|
4
|
+
import '../client.js';
|
|
5
|
+
import 'gql.tada';
|
|
6
|
+
import '@whisk/graphql';
|
|
7
|
+
import '@urql/core';
|
|
8
|
+
import '@whisk/client';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/queries/index.ts"],"sourcesContent":["export { type Vault, vaultFragment } from \"./fragments/vault.js\"\nexport {\n type GetVaultsResult,\n type GetVaultsVariables,\n getVaults,\n vaultQuery,\n} from \"./getVaults.js\"\nexport type { SteakhouseQueryFn } from \"./types.js\"\n"],"mappings":"AAAA,SAAqB,qBAAqB;AAC1C;AAAA,EAGE;AAAA,EACA;AAAA,OACK;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { useSteakhouseQuery } from './useSteakhouseQuery.js';
|
|
2
|
+
export { useVaults } from './useVaults.js';
|
|
3
|
+
import '@tanstack/react-query';
|
|
4
|
+
import '../../queries/types.js';
|
|
5
|
+
import '../../client.js';
|
|
6
|
+
import '@urql/core';
|
|
7
|
+
import '@whisk/client';
|
|
8
|
+
import '../../queries/getVaults.js';
|
|
9
|
+
import 'gql.tada';
|
|
10
|
+
import '@whisk/graphql';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/react/hooks/index.ts"],"sourcesContent":["export { useSteakhouseQuery } from \"./useSteakhouseQuery.js\"\nexport { useVaults } from \"./useVaults.js\"\n"],"mappings":"AAAA,SAAS,0BAA0B;AACnC,SAAS,iBAAiB;","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
|
+
import { SteakhouseQueryFn } from '../../queries/types.js';
|
|
3
|
+
import '../../client.js';
|
|
4
|
+
import '@urql/core';
|
|
5
|
+
import '@whisk/client';
|
|
6
|
+
|
|
7
|
+
declare function useSteakhouseQuery<TData, TVariables>(options: {
|
|
8
|
+
queryName: string;
|
|
9
|
+
queryFn: SteakhouseQueryFn<TData, TVariables>;
|
|
10
|
+
variables: TVariables;
|
|
11
|
+
}): _tanstack_react_query.UseQueryResult<_tanstack_react_query.NoInfer<TData>, Error>;
|
|
12
|
+
|
|
13
|
+
export { useSteakhouseQuery };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useSteakhouse } from "../provider.js";
|
|
4
|
+
function useSteakhouseQuery(options) {
|
|
5
|
+
const { client } = useSteakhouse();
|
|
6
|
+
return useQuery({
|
|
7
|
+
queryKey: [options.queryName, options.variables],
|
|
8
|
+
queryFn: () => options.queryFn(client, options.variables)
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
useSteakhouseQuery
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=useSteakhouseQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/react/hooks/useSteakhouseQuery.ts"],"sourcesContent":["\"use client\"\n\nimport { useQuery } from \"@tanstack/react-query\"\nimport type { SteakhouseQueryFn } from \"../../queries/types.js\"\nimport { useSteakhouse } from \"../provider.js\"\n\nexport function useSteakhouseQuery<TData, TVariables>(options: {\n queryName: string\n queryFn: SteakhouseQueryFn<TData, TVariables>\n variables: TVariables\n}) {\n const { client } = useSteakhouse()\n return useQuery({\n queryKey: [options.queryName, options.variables],\n queryFn: () => options.queryFn(client, options.variables),\n })\n}\n"],"mappings":";AAEA,SAAS,gBAAgB;AAEzB,SAAS,qBAAqB;AAEvB,SAAS,mBAAsC,SAInD;AACD,QAAM,EAAE,OAAO,IAAI,cAAc;AACjC,SAAO,SAAS;AAAA,IACd,UAAU,CAAC,QAAQ,WAAW,QAAQ,SAAS;AAAA,IAC/C,SAAS,MAAM,QAAQ,QAAQ,QAAQ,QAAQ,SAAS;AAAA,EAC1D,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
|
+
import { GetVaultsVariables } from '../../queries/getVaults.js';
|
|
3
|
+
import 'gql.tada';
|
|
4
|
+
import '@whisk/graphql';
|
|
5
|
+
import '../../client.js';
|
|
6
|
+
import '@urql/core';
|
|
7
|
+
import '@whisk/client';
|
|
8
|
+
|
|
9
|
+
declare function useVaults(variables: GetVaultsVariables): _tanstack_react_query.UseQueryResult<({
|
|
10
|
+
chain: {
|
|
11
|
+
id: number;
|
|
12
|
+
};
|
|
13
|
+
vaultAddress: `0x${string}`;
|
|
14
|
+
totalSupplied: {
|
|
15
|
+
raw: bigint;
|
|
16
|
+
};
|
|
17
|
+
} | null)[], Error>;
|
|
18
|
+
|
|
19
|
+
export { useVaults };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { getVaults } from "../../queries/getVaults.js";
|
|
3
|
+
import { useSteakhouseQuery } from "./useSteakhouseQuery.js";
|
|
4
|
+
function useVaults(variables) {
|
|
5
|
+
return useSteakhouseQuery({
|
|
6
|
+
queryName: "vaults",
|
|
7
|
+
queryFn: getVaults,
|
|
8
|
+
variables
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
useVaults
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=useVaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/react/hooks/useVaults.ts"],"sourcesContent":["\"use client\"\n\nimport { type GetVaultsVariables, getVaults } from \"../../queries/getVaults.js\"\nimport { useSteakhouseQuery } from \"./useSteakhouseQuery.js\"\n\nexport function useVaults(variables: GetVaultsVariables) {\n return useSteakhouseQuery({\n queryName: \"vaults\",\n queryFn: getVaults,\n variables,\n })\n}\n"],"mappings":";AAEA,SAAkC,iBAAiB;AACnD,SAAS,0BAA0B;AAE5B,SAAS,UAAU,WAA+B;AACvD,SAAO,mBAAmB;AAAA,IACxB,WAAW;AAAA,IACX,SAAS;AAAA,IACT;AAAA,EACF,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { useSteakhouseQuery } from './hooks/useSteakhouseQuery.js';
|
|
2
|
+
export { useVaults } from './hooks/useVaults.js';
|
|
3
|
+
export { SteakhouseContextValue, SteakhouseProvider, SteakhouseProviderProps, useSteakhouse } from './provider.js';
|
|
4
|
+
import '@tanstack/react-query';
|
|
5
|
+
import '../queries/types.js';
|
|
6
|
+
import '../client.js';
|
|
7
|
+
import '@urql/core';
|
|
8
|
+
import '@whisk/client';
|
|
9
|
+
import '../queries/getVaults.js';
|
|
10
|
+
import 'gql.tada';
|
|
11
|
+
import '@whisk/graphql';
|
|
12
|
+
import 'react';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/react/index.ts"],"sourcesContent":["export * from \"./hooks/index.js\"\nexport {\n type SteakhouseContextValue,\n SteakhouseProvider,\n type SteakhouseProviderProps,\n useSteakhouse,\n} from \"./provider.js\"\n"],"mappings":"AAAA,cAAc;AACd;AAAA,EAEE;AAAA,EAEA;AAAA,OACK;","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
import { SteakhouseClient } from '../client.js';
|
|
3
|
+
import '@urql/core';
|
|
4
|
+
import '@whisk/client';
|
|
5
|
+
|
|
6
|
+
interface SteakhouseContextValue {
|
|
7
|
+
client: SteakhouseClient;
|
|
8
|
+
}
|
|
9
|
+
declare function useSteakhouse(): SteakhouseContextValue;
|
|
10
|
+
interface SteakhouseProviderProps extends PropsWithChildren {
|
|
11
|
+
client: SteakhouseClient;
|
|
12
|
+
}
|
|
13
|
+
declare function SteakhouseProvider({ children, client, }: SteakhouseProviderProps): React.JSX.Element;
|
|
14
|
+
|
|
15
|
+
export { type SteakhouseContextValue, SteakhouseProvider, type SteakhouseProviderProps, useSteakhouse };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext } from "react";
|
|
4
|
+
const SteakhouseContext = createContext(null);
|
|
5
|
+
function useSteakhouse() {
|
|
6
|
+
const context = useContext(SteakhouseContext);
|
|
7
|
+
if (!context) {
|
|
8
|
+
throw new Error("useSteakhouse must be used within a SteakhouseProvider");
|
|
9
|
+
}
|
|
10
|
+
return context;
|
|
11
|
+
}
|
|
12
|
+
function SteakhouseProvider({
|
|
13
|
+
children,
|
|
14
|
+
client
|
|
15
|
+
}) {
|
|
16
|
+
return /* @__PURE__ */ jsx(SteakhouseContext.Provider, { value: { client }, children });
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
SteakhouseProvider,
|
|
20
|
+
useSteakhouse
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/react/provider.tsx"],"sourcesContent":["\"use client\"\n\nimport type React from \"react\"\nimport { createContext, type PropsWithChildren, useContext } from \"react\"\nimport type { SteakhouseClient } from \"../client.js\"\n\nexport interface SteakhouseContextValue {\n client: SteakhouseClient\n}\n\nconst SteakhouseContext = createContext<SteakhouseContextValue | null>(null)\n\nexport function useSteakhouse(): SteakhouseContextValue {\n const context = useContext(SteakhouseContext)\n if (!context) {\n throw new Error(\"useSteakhouse must be used within a SteakhouseProvider\")\n }\n return context\n}\n\nexport interface SteakhouseProviderProps extends PropsWithChildren {\n client: SteakhouseClient\n}\n\nexport function SteakhouseProvider({\n children,\n client,\n}: SteakhouseProviderProps): React.JSX.Element {\n return <SteakhouseContext.Provider value={{ client }}>{children}</SteakhouseContext.Provider>\n}\n"],"mappings":";AA4BS;AAzBT,SAAS,eAAuC,kBAAkB;AAOlE,MAAM,oBAAoB,cAA6C,IAAI;AAEpE,SAAS,gBAAwC;AACtD,QAAM,UAAU,WAAW,iBAAiB;AAC5C,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,wDAAwD;AAAA,EAC1E;AACA,SAAO;AACT;AAMO,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AACF,GAA+C;AAC7C,SAAO,oBAAC,kBAAkB,UAAlB,EAA2B,OAAO,EAAE,OAAO,GAAI,UAAS;AAClE;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@whisk/steakhouse",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"src"
|
|
10
|
+
],
|
|
11
|
+
"sideEffects": false,
|
|
12
|
+
"module": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"src": "./src/index.ts",
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"default": "./dist/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./react": {
|
|
21
|
+
"src": "./src/react/index.ts",
|
|
22
|
+
"types": "./dist/react/index.d.ts",
|
|
23
|
+
"default": "./dist/react/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./metadata": {
|
|
26
|
+
"src": "./src/metadata/index.ts",
|
|
27
|
+
"types": "./dist/metadata/index.d.ts",
|
|
28
|
+
"default": "./dist/metadata/index.js"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@urql/core": "^6.0.1",
|
|
33
|
+
"gql.tada": "1.9.0",
|
|
34
|
+
"@whisk/client": "0.0.7",
|
|
35
|
+
"@whisk/graphql": "0.0.7"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"graphql": ">=16",
|
|
39
|
+
"react": ">=18",
|
|
40
|
+
"react-dom": ">=18",
|
|
41
|
+
"@tanstack/react-query": ">=5"
|
|
42
|
+
},
|
|
43
|
+
"peerDependenciesMeta": {
|
|
44
|
+
"react": {
|
|
45
|
+
"optional": true
|
|
46
|
+
},
|
|
47
|
+
"react-dom": {
|
|
48
|
+
"optional": true
|
|
49
|
+
},
|
|
50
|
+
"@tanstack/react-query": {
|
|
51
|
+
"optional": true
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@types/react": "^19.2.0",
|
|
56
|
+
"@types/react-dom": "^19.2.0",
|
|
57
|
+
"react": "19.2.0",
|
|
58
|
+
"react-dom": "19.2.0",
|
|
59
|
+
"@tanstack/react-query": "5.90.10"
|
|
60
|
+
},
|
|
61
|
+
"scripts": {
|
|
62
|
+
"build": "tsup",
|
|
63
|
+
"dev": "tsup --watch"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest"
|
|
2
|
+
import { SteakhouseClient } from "./client.js"
|
|
3
|
+
|
|
4
|
+
describe("SteakhouseClient", () => {
|
|
5
|
+
it("creates client with config", () => {
|
|
6
|
+
const client = new SteakhouseClient({
|
|
7
|
+
apiKey: "test-key",
|
|
8
|
+
})
|
|
9
|
+
expect(client).toBeDefined()
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
it("creates client with custom url", () => {
|
|
13
|
+
const client = new SteakhouseClient({
|
|
14
|
+
apiKey: "test-key",
|
|
15
|
+
url: "https://custom.api.example.com/graphql",
|
|
16
|
+
})
|
|
17
|
+
expect(client).toBeDefined()
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
it("creates client with debug mode", () => {
|
|
21
|
+
const client = new SteakhouseClient({
|
|
22
|
+
apiKey: "test-key",
|
|
23
|
+
debug: true,
|
|
24
|
+
})
|
|
25
|
+
expect(client).toBeDefined()
|
|
26
|
+
})
|
|
27
|
+
})
|
package/src/client.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AnyVariables, TypedDocumentNode } from "@urql/core"
|
|
2
|
+
import { WhiskClient, type WhiskClientConfig } from "@whisk/client"
|
|
3
|
+
|
|
4
|
+
export interface SteakhouseClientConfig extends WhiskClientConfig {}
|
|
5
|
+
|
|
6
|
+
export class SteakhouseClient {
|
|
7
|
+
private readonly client: WhiskClient
|
|
8
|
+
|
|
9
|
+
constructor(config: SteakhouseClientConfig) {
|
|
10
|
+
this.client = new WhiskClient(config)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
public async query<TValue, TVariables extends AnyVariables>(
|
|
14
|
+
document: TypedDocumentNode<TValue, TVariables>,
|
|
15
|
+
variables: TVariables,
|
|
16
|
+
): Promise<TValue> {
|
|
17
|
+
return this.client.query(document, variables)
|
|
18
|
+
}
|
|
19
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ChainConfig } from "./types.js"
|
|
2
|
+
|
|
3
|
+
export const MAINNET: ChainConfig = {
|
|
4
|
+
id: 1,
|
|
5
|
+
name: "Ethereum Mainnet",
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const BASE: ChainConfig = {
|
|
9
|
+
id: 8453,
|
|
10
|
+
name: "Base",
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const SUPPORTED_CHAINS = [MAINNET, BASE] as const
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type Address = `0x${string}`
|
|
2
|
+
|
|
3
|
+
export type VaultProtocol = "morpho" | "steakhouse"
|
|
4
|
+
|
|
5
|
+
export type VaultTag = "featured" | "new" | "deprecated"
|
|
6
|
+
|
|
7
|
+
export interface VaultConfig {
|
|
8
|
+
readonly address: Address
|
|
9
|
+
readonly protocol: VaultProtocol
|
|
10
|
+
readonly name?: string
|
|
11
|
+
readonly description?: string
|
|
12
|
+
readonly tag?: VaultTag
|
|
13
|
+
readonly isHidden?: boolean
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface ChainConfig {
|
|
17
|
+
readonly id: number
|
|
18
|
+
readonly name: string
|
|
19
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { VaultConfig } from "./types.js"
|
|
2
|
+
|
|
3
|
+
// Mainnet vault configurations
|
|
4
|
+
// TODO: Add real Steakhouse vault addresses
|
|
5
|
+
export const MAINNET_VAULTS: readonly VaultConfig[] = [
|
|
6
|
+
// Example placeholder vault
|
|
7
|
+
// {
|
|
8
|
+
// address: "0x...",
|
|
9
|
+
// protocol: "steakhouse",
|
|
10
|
+
// name: "Steakhouse USDC Vault",
|
|
11
|
+
// tag: "featured",
|
|
12
|
+
// },
|
|
13
|
+
] as const
|
|
14
|
+
|
|
15
|
+
// Base vault configurations
|
|
16
|
+
// TODO: Add real Steakhouse vault addresses
|
|
17
|
+
export const BASE_VAULTS: readonly VaultConfig[] = [
|
|
18
|
+
// Example placeholder vault
|
|
19
|
+
// {
|
|
20
|
+
// address: "0x...",
|
|
21
|
+
// protocol: "steakhouse",
|
|
22
|
+
// name: "Steakhouse USDC Vault",
|
|
23
|
+
// },
|
|
24
|
+
] as const
|
|
25
|
+
|
|
26
|
+
// All vaults across all chains
|
|
27
|
+
export const ALL_VAULTS = [...MAINNET_VAULTS, ...BASE_VAULTS] as const
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type FragmentOf, graphql } from "@whisk/graphql"
|
|
2
|
+
|
|
3
|
+
export const vaultFragment = graphql(`
|
|
4
|
+
fragment VaultFragment on MorphoVault {
|
|
5
|
+
chain {
|
|
6
|
+
id
|
|
7
|
+
}
|
|
8
|
+
vaultAddress
|
|
9
|
+
totalSupplied {
|
|
10
|
+
raw
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
`)
|
|
14
|
+
|
|
15
|
+
export type Vault = FragmentOf<typeof vaultFragment>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { graphql, type ResultOf } from "@whisk/graphql"
|
|
2
|
+
import type { VariablesOf } from "gql.tada"
|
|
3
|
+
import type { SteakhouseClient } from "../client.js"
|
|
4
|
+
import { vaultFragment } from "./fragments/vault.js"
|
|
5
|
+
|
|
6
|
+
export const vaultQuery = graphql(
|
|
7
|
+
`
|
|
8
|
+
query GetVaults($limit: Int!) {
|
|
9
|
+
morphoVaults(limit: $limit) {
|
|
10
|
+
items {
|
|
11
|
+
...VaultFragment
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
`,
|
|
16
|
+
[vaultFragment],
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
export type GetVaultsVariables = VariablesOf<typeof vaultQuery>
|
|
20
|
+
export type GetVaultsResult = ResultOf<typeof vaultQuery>["morphoVaults"]["items"]
|
|
21
|
+
|
|
22
|
+
export async function getVaults(
|
|
23
|
+
client: SteakhouseClient,
|
|
24
|
+
variables: GetVaultsVariables,
|
|
25
|
+
): Promise<GetVaultsResult> {
|
|
26
|
+
const result = await client.query(vaultQuery, variables)
|
|
27
|
+
return result.morphoVaults.items
|
|
28
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { useQuery } from "@tanstack/react-query"
|
|
4
|
+
import type { SteakhouseQueryFn } from "../../queries/types.js"
|
|
5
|
+
import { useSteakhouse } from "../provider.js"
|
|
6
|
+
|
|
7
|
+
export function useSteakhouseQuery<TData, TVariables>(options: {
|
|
8
|
+
queryName: string
|
|
9
|
+
queryFn: SteakhouseQueryFn<TData, TVariables>
|
|
10
|
+
variables: TVariables
|
|
11
|
+
}) {
|
|
12
|
+
const { client } = useSteakhouse()
|
|
13
|
+
return useQuery({
|
|
14
|
+
queryKey: [options.queryName, options.variables],
|
|
15
|
+
queryFn: () => options.queryFn(client, options.variables),
|
|
16
|
+
})
|
|
17
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { type GetVaultsVariables, getVaults } from "../../queries/getVaults.js"
|
|
4
|
+
import { useSteakhouseQuery } from "./useSteakhouseQuery.js"
|
|
5
|
+
|
|
6
|
+
export function useVaults(variables: GetVaultsVariables) {
|
|
7
|
+
return useSteakhouseQuery({
|
|
8
|
+
queryName: "vaults",
|
|
9
|
+
queryFn: getVaults,
|
|
10
|
+
variables,
|
|
11
|
+
})
|
|
12
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import type React from "react"
|
|
4
|
+
import { createContext, type PropsWithChildren, useContext } from "react"
|
|
5
|
+
import type { SteakhouseClient } from "../client.js"
|
|
6
|
+
|
|
7
|
+
export interface SteakhouseContextValue {
|
|
8
|
+
client: SteakhouseClient
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const SteakhouseContext = createContext<SteakhouseContextValue | null>(null)
|
|
12
|
+
|
|
13
|
+
export function useSteakhouse(): SteakhouseContextValue {
|
|
14
|
+
const context = useContext(SteakhouseContext)
|
|
15
|
+
if (!context) {
|
|
16
|
+
throw new Error("useSteakhouse must be used within a SteakhouseProvider")
|
|
17
|
+
}
|
|
18
|
+
return context
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface SteakhouseProviderProps extends PropsWithChildren {
|
|
22
|
+
client: SteakhouseClient
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function SteakhouseProvider({
|
|
26
|
+
children,
|
|
27
|
+
client,
|
|
28
|
+
}: SteakhouseProviderProps): React.JSX.Element {
|
|
29
|
+
return <SteakhouseContext.Provider value={{ client }}>{children}</SteakhouseContext.Provider>
|
|
30
|
+
}
|