@curator-studio/sdk 0.1.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.
@@ -0,0 +1,42 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
+ }) : x)(function(x) {
10
+ if (typeof require !== "undefined") return require.apply(this, arguments);
11
+ throw Error('Dynamic require of "' + x + '" is not supported');
12
+ });
13
+ var __commonJS = (cb, mod) => function __require2() {
14
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
15
+ };
16
+ var __export = (target, all) => {
17
+ for (var name in all)
18
+ __defProp(target, name, { get: all[name], enumerable: true });
19
+ };
20
+ var __copyProps = (to, from, except, desc) => {
21
+ if (from && typeof from === "object" || typeof from === "function") {
22
+ for (let key of __getOwnPropNames(from))
23
+ if (!__hasOwnProp.call(to, key) && key !== except)
24
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
+ }
26
+ return to;
27
+ };
28
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
+ // If the importer is in node compatibility mode or this is not an ESM
30
+ // file that has been converted to a CommonJS file using a Babel-
31
+ // compatible transform (i.e. "__esModule" has not been set), then set
32
+ // "default" to the CommonJS "module.exports" for node compatibility.
33
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
+ mod
35
+ ));
36
+
37
+ export {
38
+ __require,
39
+ __commonJS,
40
+ __export,
41
+ __toESM
42
+ };
@@ -0,0 +1,14 @@
1
+ import { type PropsWithChildren } from "react";
2
+ import { CuratorSDK, type SupportedChainId } from "..";
3
+ import type { WalletClient } from "viem";
4
+ type CuratorProviderProps<T extends CuratorSDK> = PropsWithChildren<{
5
+ client?: WalletClient;
6
+ defaultChain?: SupportedChainId;
7
+ /** Tenant ENS name (e.g. "support.eth"). Scopes the SDK to this tenant's factory. */
8
+ tenant?: string;
9
+ }>;
10
+ export declare function CuratorProvider<T extends CuratorSDK = CuratorSDK>({ children, client, defaultChain, tenant, }: CuratorProviderProps<T>): React.ReactNode;
11
+ export declare function useCuratorSDK<T extends CuratorSDK = CuratorSDK>(): {
12
+ sdk: T | null;
13
+ };
14
+ export {};
@@ -0,0 +1,39 @@
1
+ export type SupportedChainId = 1 | 11155111 | 84532 | 31337;
2
+ export type ChainConfig = {
3
+ warehouse?: `0x${string}`;
4
+ indexer?: string;
5
+ nameWrapper?: `0x${string}`;
6
+ ensUniversalResolver?: `0x${string}`;
7
+ };
8
+ /**
9
+ * Per-tenant, per-chain configuration.
10
+ * Each tenant deploys its own StrategyFactory under its own ENS domain.
11
+ */
12
+ export type TenantConfig = {
13
+ ensDomain: string;
14
+ factory?: `0x${string}`;
15
+ startBlock?: number;
16
+ foreverSubnameRegistrar?: `0x${string}`;
17
+ };
18
+ /**
19
+ * All tenants across all chains.
20
+ * Add a new entry here when a new tenant deploys their StrategyFactory.
21
+ */
22
+ export declare const tenants: Record<string, Partial<Record<SupportedChainId, TenantConfig>>>;
23
+ export declare const config: Record<SupportedChainId, ChainConfig>;
24
+ /**
25
+ * Returns a map of factory address (lowercase) → tenant ID for a given chain.
26
+ * Used by the indexer to derive tenantId from factory address on each event.
27
+ */
28
+ export declare function getFactoryTenantMap(chainId: SupportedChainId): Map<string, string>;
29
+ /**
30
+ * Returns all tenant factory addresses for a given chain.
31
+ * Used by ponder.config.ts to watch all tenant factories.
32
+ */
33
+ export declare function getAllFactoryAddresses(chainId: SupportedChainId): `0x${string}`[];
34
+ /**
35
+ * Returns the tenant config for a given tenant and chain.
36
+ */
37
+ export declare function getTenantConfig(tenantId: string, chainId: SupportedChainId): TenantConfig | undefined;
38
+ export declare function getEnsDomain(chainId: SupportedChainId, tenantId?: string): string;
39
+ export declare const ENS_DOMAIN: string;
package/dist/ens.d.ts ADDED
@@ -0,0 +1,82 @@
1
+ import { type Address, type WalletClient, type PublicClient } from "viem";
2
+ import { type SupportedChainId } from "./config";
3
+ export type ENSNameData = {
4
+ owner: Address;
5
+ expiry: bigint;
6
+ };
7
+ type ChainDeployments = {
8
+ ForeverSubnameRegistrar: {
9
+ abi: unknown;
10
+ };
11
+ PublicResolver: {
12
+ abi: unknown;
13
+ address: string;
14
+ };
15
+ ReverseRegistrar: {
16
+ abi: unknown;
17
+ address: string;
18
+ };
19
+ };
20
+ export declare function createENSMethods(wallet: WalletClient | undefined, publicClient: PublicClient, chainId: SupportedChainId, deployments: ChainDeployments): {
21
+ /**
22
+ * Check if a subdomain label is available for registration
23
+ * Works on any network where ForeverSubnameRegistrar is deployed
24
+ */
25
+ available: (label: string) => Promise<boolean>;
26
+ /**
27
+ * Register a subdomain via ForeverSubnameRegistrar
28
+ * Works on any network where ForeverSubnameRegistrar is deployed
29
+ */
30
+ register: (label: string, owner?: Address) => Promise<{
31
+ label: string;
32
+ owner: Address;
33
+ node: `0x${string}`;
34
+ }>;
35
+ /**
36
+ * Get the address record for an ENS name (forward resolution)
37
+ * @param name Full ENS name (e.g., "mystrategy.support.eth" - see ENS_DOMAIN config)
38
+ * @returns The resolved address or null if not set
39
+ */
40
+ getAddress: (name: string) => Promise<Address | null>;
41
+ /**
42
+ * Set the address record for an ENS name (forward resolution)
43
+ * @param name Full ENS name (e.g., "mystrategy.support.eth" - see ENS_DOMAIN config)
44
+ * @param address The address the name should resolve to
45
+ */
46
+ setAddress: (name: string, address: Address) => Promise<{
47
+ hash: `0x${string}`;
48
+ }>;
49
+ /**
50
+ * Set the reverse name record for the caller's address
51
+ * This allows resolving your wallet address back to an ENS name
52
+ * Note: You can only set reverse records for addresses you control
53
+ * @param name The full ENS name (e.g., "mystrategy.support.eth" - see ENS_DOMAIN config)
54
+ */
55
+ setReverseRecord: (name: string) => Promise<{
56
+ hash: `0x${string}`;
57
+ }>;
58
+ /**
59
+ * Set the reverse name record for any address (requires authorization)
60
+ * This allows resolving an address back to its ENS name
61
+ * Note: Only works if you're authorized to set reverse records for the address
62
+ * @param addr The address to set the reverse record for
63
+ * @param name The full ENS name (e.g., "mystrategy.support.eth" - see ENS_DOMAIN config)
64
+ */
65
+ setReverseNameForAddr: (addr: Address, name: string) => Promise<{
66
+ hash: `0x${string}`;
67
+ }>;
68
+ /**
69
+ * Register a subdomain and set up full address resolution
70
+ * 1. Registers the subdomain
71
+ * 2. Sets forward resolution (name -> address)
72
+ * @param label The subdomain label (e.g., "mystrategy" for "mystrategy.support.eth" - see ENS_DOMAIN config)
73
+ * @param resolveToAddress The address the name should resolve to
74
+ * @param owner Optional owner of the ENS name (defaults to wallet address)
75
+ */
76
+ registerWithAddress: (label: string, resolveToAddress: Address, owner?: Address) => Promise<{
77
+ label: string;
78
+ owner: Address;
79
+ node: `0x${string}`;
80
+ }>;
81
+ };
82
+ export {};
@@ -0,0 +1,6 @@
1
+ export * from "./utils";
2
+ export * from "./use-ens";
3
+ export * from "./use-strategy";
4
+ export * from "./use-warehouse";
5
+ export * from "./use-yield";
6
+ export * from "./use-indexer";
@@ -0,0 +1,17 @@
1
+ import { type UseQueryResult } from "@tanstack/react-query";
2
+ import type { Address } from "viem";
3
+ type QueryOptions = {
4
+ enabled?: boolean;
5
+ refetchInterval?: number;
6
+ };
7
+ /**
8
+ * Resolve an ENS name to an address (forward resolution)
9
+ * Uses the SDK's configured public client with local ENS support
10
+ */
11
+ export declare function useENSGetAddress(name: string, opts?: QueryOptions): UseQueryResult<Address | null>;
12
+ /**
13
+ * Check if a subdomain label is available for registration
14
+ * Works on any network where ForeverSubnameRegistrar is deployed
15
+ */
16
+ export declare function useENSAvailable(label: string, opts?: QueryOptions): UseQueryResult<boolean | null>;
17
+ export {};
@@ -0,0 +1,21 @@
1
+ import { type UseQueryResult } from "@tanstack/react-query";
2
+ import type { Address } from "viem";
3
+ import type { Strategy, Distribution, Payout, Donor, StrategyBalance, Fork, Page, QueryVariables, StrategyFilter, DistributionFilter, PayoutFilter, DonorFilter, StrategyBalanceFilter, ForkFilter, TrendingResponse, ProtocolStats, StrategyLineage } from "../lib/indexer";
4
+ type QueryOptions = {
5
+ enabled?: boolean;
6
+ refetchInterval?: number;
7
+ };
8
+ export declare function useStrategies(variables?: QueryVariables<StrategyFilter>, opts?: QueryOptions): UseQueryResult<Page<Strategy> | null>;
9
+ export declare function useStrategyById(id: Address, opts?: QueryOptions): UseQueryResult<Strategy | null>;
10
+ export declare function useDistributions(variables?: QueryVariables<DistributionFilter>, opts?: QueryOptions): UseQueryResult<Page<Distribution> | null>;
11
+ export declare function usePayouts(variables?: QueryVariables<PayoutFilter>, opts?: QueryOptions): UseQueryResult<Page<Payout> | null>;
12
+ export declare function useDonors(variables?: QueryVariables<DonorFilter>, opts?: QueryOptions): UseQueryResult<Page<Donor> | null>;
13
+ export declare function useStrategyBalances(variables?: QueryVariables<StrategyBalanceFilter>, opts?: QueryOptions): UseQueryResult<Page<StrategyBalance> | null>;
14
+ export declare function useForks(variables?: QueryVariables<ForkFilter>, opts?: QueryOptions): UseQueryResult<Page<Fork> | null>;
15
+ export declare function useTrendingStrategies(options?: {
16
+ period?: "24h" | "7d";
17
+ limit?: number;
18
+ }, opts?: QueryOptions): UseQueryResult<TrendingResponse | null>;
19
+ export declare function useProtocolStats(opts?: QueryOptions): UseQueryResult<ProtocolStats | null>;
20
+ export declare function useStrategyLineage(strategyAddress: Address | undefined, opts?: QueryOptions): UseQueryResult<StrategyLineage | null>;
21
+ export {};
@@ -0,0 +1,55 @@
1
+ import { type UseMutationOptions, type UseQueryResult } from "@tanstack/react-query";
2
+ import type { Address } from "viem";
3
+ import type { Allocation, StrategyConfig, StrategyData } from "../strategy";
4
+ type QueryOptions = {
5
+ enabled?: boolean;
6
+ refetchInterval?: number;
7
+ };
8
+ export declare function useStrategyData(strategyAddress: Address | undefined, opts?: QueryOptions): UseQueryResult<StrategyData | null>;
9
+ export declare function useStrategyBalance(strategyAddress: Address | undefined, token: Address | undefined, opts?: QueryOptions): UseQueryResult<bigint | null>;
10
+ export declare function useCreateStrategy(opts?: UseMutationOptions<{
11
+ strategy: Address;
12
+ config: StrategyConfig;
13
+ }, Error, StrategyConfig>): import("@tanstack/react-query").UseMutationResult<{
14
+ strategy: Address;
15
+ config: StrategyConfig;
16
+ }, Error, StrategyConfig, unknown>;
17
+ export declare function useRebalanceStrategy(opts?: UseMutationOptions<{
18
+ hash: `0x${string}`;
19
+ }, Error, {
20
+ strategyAddress: Address;
21
+ allocations: Allocation[];
22
+ metadataURI: string;
23
+ }>): import("@tanstack/react-query").UseMutationResult<{
24
+ hash: `0x${string}`;
25
+ }, Error, {
26
+ strategyAddress: Address;
27
+ allocations: Allocation[];
28
+ metadataURI: string;
29
+ }, unknown>;
30
+ export declare function useDistributeStrategy(opts?: UseMutationOptions<{
31
+ hash: `0x${string}`;
32
+ }, Error, {
33
+ strategyAddress: Address;
34
+ token: Address;
35
+ }>): import("@tanstack/react-query").UseMutationResult<{
36
+ hash: `0x${string}`;
37
+ }, Error, {
38
+ strategyAddress: Address;
39
+ token: Address;
40
+ }, unknown>;
41
+ /**
42
+ * Set ENS subdomain name for an existing strategy
43
+ */
44
+ export declare function useSetENSName(opts?: UseMutationOptions<{
45
+ hash: `0x${string}`;
46
+ }, Error, {
47
+ strategyAddress: Address;
48
+ label: string;
49
+ }>): import("@tanstack/react-query").UseMutationResult<{
50
+ hash: `0x${string}`;
51
+ }, Error, {
52
+ strategyAddress: Address;
53
+ label: string;
54
+ }, unknown>;
55
+ export {};
@@ -0,0 +1,21 @@
1
+ import { type UseMutationOptions, type UseQueryResult } from "@tanstack/react-query";
2
+ import type { Address } from "viem";
3
+ import type { WarehouseBalance, Page, QueryVariables, WarehouseBalanceFilter } from "../lib/indexer";
4
+ type QueryOptions = {
5
+ enabled?: boolean;
6
+ refetchInterval?: number;
7
+ };
8
+ export declare function useWarehouseBalances(variables?: QueryVariables<WarehouseBalanceFilter>, opts?: QueryOptions): UseQueryResult<Page<WarehouseBalance> | null>;
9
+ export declare function useWarehouseBalance(user: Address | undefined, token: Address | undefined, opts?: QueryOptions): UseQueryResult<WarehouseBalance | null>;
10
+ export declare function useWithdrawFromWarehouse(opts?: UseMutationOptions<{
11
+ hash: `0x${string}`;
12
+ }, Error, {
13
+ owner: Address;
14
+ token: Address;
15
+ }>): import("@tanstack/react-query").UseMutationResult<{
16
+ hash: `0x${string}`;
17
+ }, Error, {
18
+ owner: Address;
19
+ token: Address;
20
+ }, unknown>;
21
+ export {};
@@ -0,0 +1,35 @@
1
+ import { type UseMutationOptions, type UseQueryResult } from "@tanstack/react-query";
2
+ import type { Address } from "viem";
3
+ import type { YieldRedirector, Harvest, Page, QueryVariables, YieldRedirectorFilter, HarvestFilter } from "../lib/indexer";
4
+ type QueryOptions = {
5
+ enabled?: boolean;
6
+ refetchInterval?: number;
7
+ };
8
+ export declare function useYieldRedirectors(variables?: QueryVariables<YieldRedirectorFilter>, opts?: QueryOptions): UseQueryResult<Page<YieldRedirector> | null>;
9
+ export declare function useYieldRedirectorById(id: Address | undefined, opts?: QueryOptions): UseQueryResult<YieldRedirector | null>;
10
+ export declare function useHarvests(variables?: QueryVariables<HarvestFilter>, opts?: QueryOptions): UseQueryResult<Page<Harvest> | null>;
11
+ /**
12
+ * Create a new yield redirector
13
+ */
14
+ export declare function useCreateYieldRedirector(opts?: UseMutationOptions<{
15
+ redirector: Address;
16
+ }, Error, {
17
+ sourceVault: Address;
18
+ yieldRecipient: Address;
19
+ owner: Address;
20
+ }>): import("@tanstack/react-query").UseMutationResult<{
21
+ redirector: Address;
22
+ }, Error, {
23
+ sourceVault: Address;
24
+ yieldRecipient: Address;
25
+ owner: Address;
26
+ }, unknown>;
27
+ /**
28
+ * Harvest yield from a redirector
29
+ */
30
+ export declare function useHarvestYield(opts?: UseMutationOptions<{
31
+ hash: `0x${string}`;
32
+ }, Error, Address>): import("@tanstack/react-query").UseMutationResult<{
33
+ hash: `0x${string}`;
34
+ }, Error, `0x${string}`, unknown>;
35
+ export {};
@@ -0,0 +1,7 @@
1
+ export declare const INVALIDATION_TIMEOUT_MS = 3000;
2
+ export declare const ENS_INVALIDATION_TIMEOUT_MS = 1000;
3
+ export declare function useInvalidate(): (queryKeys: unknown[][]) => void;
4
+ /**
5
+ * Invalidate all ENS-related queries (both custom and wagmi's)
6
+ */
7
+ export declare function useInvalidateENS(): () => void;