@dimes-dot-fi/sdk 1.0.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/chunk-BRANC7OH.mjs +283 -0
- package/dist/chunk-BRANC7OH.mjs.map +1 -0
- package/dist/chunk-JGK55KDX.cjs +283 -0
- package/dist/chunk-JGK55KDX.cjs.map +1 -0
- package/dist/chunk-LQ5LLBR6.mjs +312 -0
- package/dist/chunk-LQ5LLBR6.mjs.map +1 -0
- package/dist/chunk-XXTTXLCT.cjs +312 -0
- package/dist/chunk-XXTTXLCT.cjs.map +1 -0
- package/dist/contract/index.cjs +670 -0
- package/dist/contract/index.cjs.map +1 -0
- package/dist/contract/index.d.cts +83 -0
- package/dist/contract/index.d.ts +83 -0
- package/dist/contract/index.mjs +670 -0
- package/dist/contract/index.mjs.map +1 -0
- package/dist/dimes-client-BLIAuK4M.d.cts +1241 -0
- package/dist/dimes-client-BLIAuK4M.d.ts +1241 -0
- package/dist/dimes-error-BtDMi3Kv.d.ts +26 -0
- package/dist/dimes-error-DxzsfQo6.d.cts +26 -0
- package/dist/index.cjs +275 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +21 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.mjs +275 -0
- package/dist/index.mjs.map +1 -0
- package/dist/quote-ByZJRoPf.d.cts +29 -0
- package/dist/quote-CgmTKnIZ.d.ts +29 -0
- package/dist/react/index.cjs +166 -0
- package/dist/react/index.cjs.map +1 -0
- package/dist/react/index.d.cts +41 -0
- package/dist/react/index.d.ts +41 -0
- package/dist/react/index.mjs +166 -0
- package/dist/react/index.mjs.map +1 -0
- package/package.json +111 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import {
|
|
2
|
+
executeQuote
|
|
3
|
+
} from "../chunk-BRANC7OH.mjs";
|
|
4
|
+
import {
|
|
5
|
+
DimesError
|
|
6
|
+
} from "../chunk-LQ5LLBR6.mjs";
|
|
7
|
+
|
|
8
|
+
// src/react/provider.tsx
|
|
9
|
+
import { createContext, useContext } from "react";
|
|
10
|
+
import { jsx } from "react/jsx-runtime";
|
|
11
|
+
var DimesContext = createContext(null);
|
|
12
|
+
function DimesProvider({ client, children }) {
|
|
13
|
+
return /* @__PURE__ */ jsx(DimesContext.Provider, { value: client, children });
|
|
14
|
+
}
|
|
15
|
+
function useDimesClient() {
|
|
16
|
+
const client = useContext(DimesContext);
|
|
17
|
+
if (!client) {
|
|
18
|
+
throw new DimesError("missing_provider", "useDimesClient must be used within a <DimesProvider>");
|
|
19
|
+
}
|
|
20
|
+
return client;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// src/react/use-quote.ts
|
|
24
|
+
import { useCallback, useReducer } from "react";
|
|
25
|
+
function reducer(state, action) {
|
|
26
|
+
switch (action.type) {
|
|
27
|
+
case "loading":
|
|
28
|
+
return { phase: "loading-draft", corrections: [], retries: 0 };
|
|
29
|
+
case "draftReady":
|
|
30
|
+
return { ...state, phase: "draft-ready", draft: action.draft };
|
|
31
|
+
case "promoting":
|
|
32
|
+
return { ...state, phase: "promoting" };
|
|
33
|
+
case "marketMoved":
|
|
34
|
+
return { ...state, phase: "market-moved" };
|
|
35
|
+
case "done":
|
|
36
|
+
return {
|
|
37
|
+
phase: "promoted",
|
|
38
|
+
offer: action.result.offer,
|
|
39
|
+
corrections: action.result.corrections,
|
|
40
|
+
retries: action.result.retries,
|
|
41
|
+
draft: state.draft
|
|
42
|
+
};
|
|
43
|
+
case "error":
|
|
44
|
+
return { ...state, phase: "error", error: action.error };
|
|
45
|
+
case "reset":
|
|
46
|
+
return { phase: "idle", corrections: [], retries: 0 };
|
|
47
|
+
default:
|
|
48
|
+
return state;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function useQuote() {
|
|
52
|
+
const client = useDimesClient();
|
|
53
|
+
const [state, dispatch] = useReducer(reducer, {
|
|
54
|
+
phase: "idle",
|
|
55
|
+
corrections: [],
|
|
56
|
+
retries: 0
|
|
57
|
+
});
|
|
58
|
+
const execute = useCallback(
|
|
59
|
+
async (params, options) => {
|
|
60
|
+
dispatch({ type: "loading" });
|
|
61
|
+
try {
|
|
62
|
+
const result = await executeQuote(client, params, {
|
|
63
|
+
...options,
|
|
64
|
+
onDraftReady: (draft) => {
|
|
65
|
+
dispatch({ type: "draftReady", draft });
|
|
66
|
+
dispatch({ type: "promoting" });
|
|
67
|
+
options?.onDraftReady?.(draft);
|
|
68
|
+
},
|
|
69
|
+
onMarketMoved: (event) => {
|
|
70
|
+
dispatch({ type: "marketMoved" });
|
|
71
|
+
return options?.onMarketMoved?.(event);
|
|
72
|
+
},
|
|
73
|
+
onCorrection: (adj) => {
|
|
74
|
+
return options?.onCorrection?.(adj);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
dispatch({ type: "done", result });
|
|
78
|
+
return result;
|
|
79
|
+
} catch (err) {
|
|
80
|
+
dispatch({ type: "error", error: err });
|
|
81
|
+
throw err;
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
[client]
|
|
85
|
+
);
|
|
86
|
+
const reset = useCallback(() => {
|
|
87
|
+
dispatch({ type: "reset" });
|
|
88
|
+
}, []);
|
|
89
|
+
return { state, execute, reset };
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// src/react/use-markets.ts
|
|
93
|
+
import { useQuery } from "@tanstack/react-query";
|
|
94
|
+
function useMarkets(params, queryOptions) {
|
|
95
|
+
const client = useDimesClient();
|
|
96
|
+
return useQuery({
|
|
97
|
+
queryKey: ["dimes", "markets", params],
|
|
98
|
+
queryFn: () => client.getMarkets(params),
|
|
99
|
+
...queryOptions
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function useMarket(ticker, queryOptions) {
|
|
103
|
+
const client = useDimesClient();
|
|
104
|
+
return useQuery({
|
|
105
|
+
queryKey: ["dimes", "market", ticker],
|
|
106
|
+
queryFn: () => client.getMarket(ticker),
|
|
107
|
+
enabled: !!ticker,
|
|
108
|
+
...queryOptions
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// src/react/use-positions.ts
|
|
113
|
+
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
114
|
+
function usePositions(params, queryOptions) {
|
|
115
|
+
const client = useDimesClient();
|
|
116
|
+
return useQuery2({
|
|
117
|
+
queryKey: ["dimes", "positions", params],
|
|
118
|
+
queryFn: () => client.getPositions(params),
|
|
119
|
+
...queryOptions
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// src/react/use-contract-info.ts
|
|
124
|
+
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
125
|
+
function useContractInfo(queryOptions) {
|
|
126
|
+
const client = useDimesClient();
|
|
127
|
+
return useQuery3({
|
|
128
|
+
queryKey: ["dimes", "contractInfo"],
|
|
129
|
+
queryFn: () => client.getContractInfo(),
|
|
130
|
+
staleTime: Infinity,
|
|
131
|
+
...queryOptions
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// src/react/use-limits.ts
|
|
136
|
+
import { useQuery as useQuery4 } from "@tanstack/react-query";
|
|
137
|
+
function useLimits(queryOptions) {
|
|
138
|
+
const client = useDimesClient();
|
|
139
|
+
return useQuery4({
|
|
140
|
+
queryKey: ["dimes", "limits"],
|
|
141
|
+
queryFn: () => client.getLimits(),
|
|
142
|
+
...queryOptions
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// src/react/use-cancel-position.ts
|
|
147
|
+
import { useMutation } from "@tanstack/react-query";
|
|
148
|
+
function useCancelPosition(mutationOptions) {
|
|
149
|
+
const client = useDimesClient();
|
|
150
|
+
return useMutation({
|
|
151
|
+
mutationFn: (positionId) => client.cancelPosition(positionId),
|
|
152
|
+
...mutationOptions
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
export {
|
|
156
|
+
DimesProvider,
|
|
157
|
+
useCancelPosition,
|
|
158
|
+
useContractInfo,
|
|
159
|
+
useDimesClient,
|
|
160
|
+
useLimits,
|
|
161
|
+
useMarket,
|
|
162
|
+
useMarkets,
|
|
163
|
+
usePositions,
|
|
164
|
+
useQuote
|
|
165
|
+
};
|
|
166
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/react/provider.tsx","../../src/react/use-quote.ts","../../src/react/use-markets.ts","../../src/react/use-positions.ts","../../src/react/use-contract-info.ts","../../src/react/use-limits.ts","../../src/react/use-cancel-position.ts"],"sourcesContent":["import { createContext, useContext, type ReactNode } from \"react\";\nimport type { DimesClient } from \"../client/dimes-client\";\nimport { DimesError } from \"../errors/dimes-error\";\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst DimesContext = createContext<DimesClient | null>(null);\n\nexport interface DimesProviderProps {\n client: DimesClient;\n children: ReactNode;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/explicit-function-return-type\nexport function DimesProvider({ client, children }: DimesProviderProps) {\n return <DimesContext.Provider value={client}>{children}</DimesContext.Provider>;\n}\n\nexport function useDimesClient(): DimesClient {\n const client = useContext(DimesContext);\n if (!client) {\n throw new DimesError(\"missing_provider\", \"useDimesClient must be used within a <DimesProvider>\");\n }\n return client;\n}\n","import { useCallback, useReducer } from \"react\";\nimport { executeQuote } from \"../quote/quote\";\nimport type { HintAdjustment } from \"../quote/quote-error-hints\";\nimport type { Offer } from \"../types\";\nimport type { QuoteOptions, QuoteParams, QuoteResult } from \"../types/quote\";\nimport { useDimesClient } from \"./provider\";\n\nexport type QuotePhase = \"idle\" | \"loading-draft\" | \"draft-ready\" | \"promoting\" | \"promoted\" | \"market-moved\" | \"error\";\n\nexport interface QuoteState {\n phase: QuotePhase;\n draft?: Offer;\n offer?: Offer;\n corrections: HintAdjustment[];\n retries: number;\n error?: unknown;\n}\n\ntype Action =\n | { type: \"loading\" }\n | { type: \"draftReady\"; draft: Offer }\n | { type: \"promoting\" }\n | { type: \"marketMoved\" }\n | { type: \"done\"; result: QuoteResult }\n | { type: \"error\"; error: unknown }\n | { type: \"reset\" };\n\nfunction reducer(state: QuoteState, action: Action): QuoteState {\n switch (action.type) {\n case \"loading\":\n return { phase: \"loading-draft\", corrections: [], retries: 0 };\n case \"draftReady\":\n return { ...state, phase: \"draft-ready\", draft: action.draft };\n case \"promoting\":\n return { ...state, phase: \"promoting\" };\n case \"marketMoved\":\n return { ...state, phase: \"market-moved\" };\n case \"done\":\n return {\n phase: \"promoted\",\n offer: action.result.offer,\n corrections: action.result.corrections,\n retries: action.result.retries,\n draft: state.draft,\n };\n case \"error\":\n return { ...state, phase: \"error\", error: action.error };\n case \"reset\":\n return { phase: \"idle\", corrections: [], retries: 0 };\n default:\n return state;\n }\n}\n\nexport interface UseQuoteReturn {\n state: QuoteState;\n execute: (params: QuoteParams, options?: QuoteOptions) => Promise<QuoteResult>;\n reset: () => void;\n}\n\nexport function useQuote(): UseQuoteReturn {\n const client = useDimesClient();\n const [state, dispatch] = useReducer(reducer, {\n phase: \"idle\",\n corrections: [],\n retries: 0,\n });\n\n const execute = useCallback(\n async (params: QuoteParams, options?: QuoteOptions): Promise<QuoteResult> => {\n dispatch({ type: \"loading\" });\n\n try {\n const result = await executeQuote(client, params, {\n ...options,\n onDraftReady: (draft) => {\n dispatch({ type: \"draftReady\", draft });\n dispatch({ type: \"promoting\" });\n options?.onDraftReady?.(draft);\n },\n onMarketMoved: (event) => {\n dispatch({ type: \"marketMoved\" });\n return options?.onMarketMoved?.(event);\n },\n onCorrection: (adj) => {\n return options?.onCorrection?.(adj);\n },\n });\n\n dispatch({ type: \"done\", result });\n return result;\n } catch (err) {\n dispatch({ type: \"error\", error: err });\n throw err;\n }\n },\n [client],\n );\n\n const reset = useCallback(() => {\n dispatch({ type: \"reset\" });\n }, []);\n\n return { state, execute, reset };\n}\n","import { useQuery, type UseQueryOptions, type UseQueryResult } from \"@tanstack/react-query\";\nimport type { GetMarketsParams } from \"../client/dimes-client\";\nimport type { Market, Paginated } from \"../types\";\nimport { useDimesClient } from \"./provider\";\n\nexport function useMarkets(\n params?: GetMarketsParams,\n queryOptions?: Partial<UseQueryOptions<Paginated<Market>>>,\n): UseQueryResult<Paginated<Market>> {\n const client = useDimesClient();\n\n return useQuery({\n queryKey: [\"dimes\", \"markets\", params],\n queryFn: () => client.getMarkets(params),\n ...queryOptions,\n });\n}\n\nexport function useMarket(ticker: string, queryOptions?: Partial<UseQueryOptions<Market>>): UseQueryResult<Market> {\n const client = useDimesClient();\n\n return useQuery({\n queryKey: [\"dimes\", \"market\", ticker],\n queryFn: () => client.getMarket(ticker),\n enabled: !!ticker,\n ...queryOptions,\n });\n}\n","import { useQuery, type UseQueryOptions, type UseQueryResult } from \"@tanstack/react-query\";\nimport type { GetPositionsParams } from \"../client/dimes-client\";\nimport type { Position } from \"../types\";\nimport { useDimesClient } from \"./provider\";\n\nexport function usePositions(\n params?: GetPositionsParams,\n queryOptions?: Partial<UseQueryOptions<Position[]>>,\n): UseQueryResult<Position[]> {\n const client = useDimesClient();\n\n return useQuery({\n queryKey: [\"dimes\", \"positions\", params],\n queryFn: () => client.getPositions(params),\n ...queryOptions,\n });\n}\n","import { useQuery, type UseQueryOptions, type UseQueryResult } from \"@tanstack/react-query\";\nimport type { ContractInfo } from \"../types\";\nimport { useDimesClient } from \"./provider\";\n\nexport function useContractInfo(queryOptions?: Partial<UseQueryOptions<ContractInfo>>): UseQueryResult<ContractInfo> {\n const client = useDimesClient();\n\n return useQuery({\n queryKey: [\"dimes\", \"contractInfo\"],\n queryFn: () => client.getContractInfo(),\n staleTime: Infinity,\n ...queryOptions,\n });\n}\n","import { useQuery, type UseQueryOptions, type UseQueryResult } from \"@tanstack/react-query\";\nimport type { CustomerLimit } from \"../types\";\nimport { useDimesClient } from \"./provider\";\n\nexport function useLimits(queryOptions?: Partial<UseQueryOptions<CustomerLimit>>): UseQueryResult<CustomerLimit> {\n const client = useDimesClient();\n\n return useQuery({\n queryKey: [\"dimes\", \"limits\"],\n queryFn: () => client.getLimits(),\n ...queryOptions,\n });\n}\n","import { useMutation, type UseMutationOptions, type UseMutationResult } from \"@tanstack/react-query\";\nimport { useDimesClient } from \"./provider\";\n\nexport function useCancelPosition(\n mutationOptions?: Partial<UseMutationOptions<void, Error, string>>,\n): UseMutationResult<void, Error, string> {\n const client = useDimesClient();\n\n return useMutation({\n mutationFn: (positionId: string) => client.cancelPosition(positionId),\n ...mutationOptions,\n });\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,eAAe,kBAAkC;AAcjD;AATT,IAAM,eAAe,cAAkC,IAAI;AAQpD,SAAS,cAAc,EAAE,QAAQ,SAAS,GAAuB;AACtE,SAAO,oBAAC,aAAa,UAAb,EAAsB,OAAO,QAAS,UAAS;AACzD;AAEO,SAAS,iBAA8B;AAC5C,QAAM,SAAS,WAAW,YAAY;AACtC,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI,WAAW,oBAAoB,sDAAsD;AAAA,EACjG;AACA,SAAO;AACT;;;ACvBA,SAAS,aAAa,kBAAkB;AA2BxC,SAAS,QAAQ,OAAmB,QAA4B;AAC9D,UAAQ,OAAO,MAAM;AAAA,IACnB,KAAK;AACH,aAAO,EAAE,OAAO,iBAAiB,aAAa,CAAC,GAAG,SAAS,EAAE;AAAA,IAC/D,KAAK;AACH,aAAO,EAAE,GAAG,OAAO,OAAO,eAAe,OAAO,OAAO,MAAM;AAAA,IAC/D,KAAK;AACH,aAAO,EAAE,GAAG,OAAO,OAAO,YAAY;AAAA,IACxC,KAAK;AACH,aAAO,EAAE,GAAG,OAAO,OAAO,eAAe;AAAA,IAC3C,KAAK;AACH,aAAO;AAAA,QACL,OAAO;AAAA,QACP,OAAO,OAAO,OAAO;AAAA,QACrB,aAAa,OAAO,OAAO;AAAA,QAC3B,SAAS,OAAO,OAAO;AAAA,QACvB,OAAO,MAAM;AAAA,MACf;AAAA,IACF,KAAK;AACH,aAAO,EAAE,GAAG,OAAO,OAAO,SAA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names":["useQuery","useQuery","useQuery","useQuery","useQuery","useQuery"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dimes-dot-fi/sdk",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "TypeScript SDK for the Dimes prediction market API",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": {
|
|
13
|
+
"types": "./dist/index.d.mts",
|
|
14
|
+
"default": "./dist/index.mjs"
|
|
15
|
+
},
|
|
16
|
+
"require": {
|
|
17
|
+
"types": "./dist/index.d.cts",
|
|
18
|
+
"default": "./dist/index.cjs"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"./react": {
|
|
22
|
+
"import": {
|
|
23
|
+
"types": "./dist/react/index.d.mts",
|
|
24
|
+
"default": "./dist/react/index.mjs"
|
|
25
|
+
},
|
|
26
|
+
"require": {
|
|
27
|
+
"types": "./dist/react/index.d.cts",
|
|
28
|
+
"default": "./dist/react/index.cjs"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"./contract": {
|
|
32
|
+
"import": {
|
|
33
|
+
"types": "./dist/contract/index.d.mts",
|
|
34
|
+
"default": "./dist/contract/index.mjs"
|
|
35
|
+
},
|
|
36
|
+
"require": {
|
|
37
|
+
"types": "./dist/contract/index.d.cts",
|
|
38
|
+
"default": "./dist/contract/index.cjs"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "tsup",
|
|
44
|
+
"generate:types": "tsx scripts/generate-types.ts",
|
|
45
|
+
"typecheck": "tsc --noEmit",
|
|
46
|
+
"test": "vitest run",
|
|
47
|
+
"test:watch": "vitest",
|
|
48
|
+
"test:coverage": "vitest run --coverage",
|
|
49
|
+
"lint": "eslint src tests && prettier --check src tests scripts",
|
|
50
|
+
"lint:fix": "eslint --fix src tests && prettier --write src tests scripts",
|
|
51
|
+
"format": "prettier --write src tests scripts",
|
|
52
|
+
"format:check": "prettier --check src tests scripts",
|
|
53
|
+
"knip": "knip",
|
|
54
|
+
"prepublishOnly": "pnpm lint && pnpm typecheck && pnpm test && pnpm build",
|
|
55
|
+
"release": "pnpm version patch && npm publish --access public",
|
|
56
|
+
"release:minor": "pnpm version minor && npm publish --access public",
|
|
57
|
+
"release:major": "pnpm version major && npm publish --access public"
|
|
58
|
+
},
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"@tanstack/react-query": ">=5",
|
|
61
|
+
"react": ">=19",
|
|
62
|
+
"viem": ">=2"
|
|
63
|
+
},
|
|
64
|
+
"peerDependenciesMeta": {
|
|
65
|
+
"@tanstack/react-query": {
|
|
66
|
+
"optional": true
|
|
67
|
+
},
|
|
68
|
+
"react": {
|
|
69
|
+
"optional": true
|
|
70
|
+
},
|
|
71
|
+
"viem": {
|
|
72
|
+
"optional": true
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"devDependencies": {
|
|
76
|
+
"@eslint/compat": "^2.0.0",
|
|
77
|
+
"@eslint/eslintrc": "^3.3.0",
|
|
78
|
+
"@eslint/js": "^10.0.0",
|
|
79
|
+
"@tanstack/react-query": "^5.0.0",
|
|
80
|
+
"@types/humps": "^2.0.6",
|
|
81
|
+
"@types/react": "^19.0.0",
|
|
82
|
+
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
83
|
+
"@typescript-eslint/parser": "^8.0.0",
|
|
84
|
+
"eslint": "^9.0.0",
|
|
85
|
+
"eslint-config-prettier": "^10.0.0",
|
|
86
|
+
"eslint-import-resolver-typescript": "^4.4.4",
|
|
87
|
+
"eslint-plugin-better-max-params": "^1.0.0",
|
|
88
|
+
"eslint-plugin-check-file": "^2.0.0",
|
|
89
|
+
"eslint-plugin-import-x": "^4.0.0",
|
|
90
|
+
"eslint-plugin-simple-import-sort": "^12.0.0",
|
|
91
|
+
"globals": "^17.0.0",
|
|
92
|
+
"knip": "^6.4.0",
|
|
93
|
+
"openapi-typescript": "^7.0.0",
|
|
94
|
+
"prettier": "^3.8.0",
|
|
95
|
+
"react": "^19.0.0",
|
|
96
|
+
"tsup": "^8.0.0",
|
|
97
|
+
"tsx": "^4.0.0",
|
|
98
|
+
"typescript": "^5.8.0",
|
|
99
|
+
"viem": "^2.0.0",
|
|
100
|
+
"vitest": "^4.1.5"
|
|
101
|
+
},
|
|
102
|
+
"dependencies": {
|
|
103
|
+
"humps": "^2.0.1"
|
|
104
|
+
},
|
|
105
|
+
"publishConfig": {
|
|
106
|
+
"access": "public"
|
|
107
|
+
},
|
|
108
|
+
"pnpm": {
|
|
109
|
+
"onlyBuiltDependencies": ["esbuild", "unrs-resolver"]
|
|
110
|
+
}
|
|
111
|
+
}
|