opentool 0.14.0 → 0.15.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.
@@ -98,4 +98,4 @@ type WalletReadonlyContext = WalletBaseContext;
98
98
  type WalletFullContext = WalletBaseContext & WalletSignerContext;
99
99
  type WalletContext = WalletReadonlyContext | WalletFullContext;
100
100
 
101
- export type { ChainMetadata as C, Hex as H, NonceSource as N, RpcProviderOptions as R, TokenMetadata as T, WalletFullContext as W, ChainReference as a, ChainTokenMap as b, HexAddress as c, RpcUrlResolver as d, TurnkeyOptions as e, TurnkeySignWith as f, WalletBaseContext as g, WalletContext as h, WalletOptions as i, WalletOptionsBase as j, WalletPrivateKeyOptions as k, WalletProviderType as l, WalletReadonlyContext as m, WalletReadonlyOptions as n, WalletRegistry as o, WalletSendTransactionParams as p, WalletSignerContext as q, WalletTransferParams as r, WalletTurnkeyOptions as s };
101
+ export type { ChainMetadata as C, Hex as H, NonceSource as N, RpcProviderOptions as R, TokenMetadata as T, WalletBaseContext as W, ChainReference as a, ChainTokenMap as b, HexAddress as c, RpcUrlResolver as d, TurnkeyOptions as e, TurnkeySignWith as f, WalletContext as g, WalletFullContext as h, WalletOptions as i, WalletOptionsBase as j, WalletPrivateKeyOptions as k, WalletProviderType as l, WalletReadonlyContext as m, WalletReadonlyOptions as n, WalletRegistry as o, WalletSendTransactionParams as p, WalletSignerContext as q, WalletTransferParams as r, WalletTurnkeyOptions as s };
@@ -1,7 +1,7 @@
1
1
  import { createAccount } from '@turnkey/viem';
2
2
  import { WalletClient, Transport, Chain, PublicClient } from 'viem';
3
3
  import { Account } from 'viem/accounts';
4
- import { a as ChainReference, c as HexAddress, l as WalletProviderType, C as ChainMetadata, f as TurnkeySignWith, W as WalletFullContext } from '../types-DKohXZes.js';
4
+ import { a as ChainReference, c as HexAddress, l as WalletProviderType, C as ChainMetadata, f as TurnkeySignWith, h as WalletFullContext } from '../types-BaTmu0gS.js';
5
5
 
6
6
  type NonceSource = () => number;
7
7
  declare function createMonotonicNonceSource(start?: number): NonceSource;
@@ -1,5 +1,5 @@
1
- import { C as ChainMetadata, b as ChainTokenMap, o as WalletRegistry, R as RpcProviderOptions, k as WalletPrivateKeyOptions, W as WalletFullContext, s as WalletTurnkeyOptions, n as WalletReadonlyOptions, m as WalletReadonlyContext } from '../types-DKohXZes.js';
2
- export { a as ChainReference, H as Hex, c as HexAddress, N as NonceSource, d as RpcUrlResolver, T as TokenMetadata, e as TurnkeyOptions, f as TurnkeySignWith, g as WalletBaseContext, h as WalletContext, i as WalletOptions, j as WalletOptionsBase, l as WalletProviderType, p as WalletSendTransactionParams, q as WalletSignerContext, r as WalletTransferParams } from '../types-DKohXZes.js';
1
+ import { C as ChainMetadata, b as ChainTokenMap, o as WalletRegistry, R as RpcProviderOptions, k as WalletPrivateKeyOptions, h as WalletFullContext, s as WalletTurnkeyOptions, n as WalletReadonlyOptions, m as WalletReadonlyContext } from '../types-BaTmu0gS.js';
2
+ export { a as ChainReference, H as Hex, c as HexAddress, N as NonceSource, d as RpcUrlResolver, T as TokenMetadata, e as TurnkeyOptions, f as TurnkeySignWith, W as WalletBaseContext, g as WalletContext, i as WalletOptions, j as WalletOptionsBase, l as WalletProviderType, p as WalletSendTransactionParams, q as WalletSignerContext, r as WalletTransferParams } from '../types-BaTmu0gS.js';
3
3
  import 'viem';
4
4
  import 'viem/accounts';
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opentool",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "description": "OpenTool framework for building serverless MCP tools",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -10,7 +10,7 @@
10
10
  "validate": "opentool validate"
11
11
  },
12
12
  "dependencies": {
13
- "opentool": "^0.14.0",
13
+ "opentool": "^0.15.0",
14
14
  "zod": "^4.3.6"
15
15
  },
16
16
  "devDependencies": {
@@ -1,360 +0,0 @@
1
- import { W as WalletFullContext } from './types-DKohXZes.js';
2
-
3
- type HyperliquidEnvironment = "mainnet" | "testnet";
4
- type MarketIdentity = {
5
- market_type: "perp" | "spot" | "dex";
6
- venue: "hyperliquid";
7
- environment: HyperliquidEnvironment;
8
- base: string;
9
- quote?: string | null;
10
- dex?: string | null;
11
- chain_id?: number | null;
12
- pool_address?: string | null;
13
- token0_address?: string | null;
14
- token1_address?: string | null;
15
- fee_tier?: number | null;
16
- raw_symbol?: string | null;
17
- canonical_symbol: string;
18
- };
19
- type HyperliquidMarketIdentityInput = {
20
- environment: HyperliquidEnvironment;
21
- symbol: string;
22
- rawSymbol?: string | null;
23
- isSpot?: boolean;
24
- base?: string | null;
25
- quote?: string | null;
26
- };
27
- declare function buildHyperliquidMarketIdentity(input: HyperliquidMarketIdentityInput): MarketIdentity | null;
28
- type HyperliquidTimeInForce = "Gtc" | "Ioc" | "Alo" | "FrontendMarket" | "LiquidationMarket";
29
- type HyperliquidGrouping = "na" | "normalTpsl" | "positionTpsl";
30
- type HyperliquidTriggerType = "tp" | "sl";
31
- type HyperliquidAbstraction = "unifiedAccount" | "portfolioMargin" | "disabled";
32
- type HyperliquidAccountMode = "standard" | "unified" | "portfolio";
33
- declare function resolveHyperliquidAbstractionFromMode(mode: HyperliquidAccountMode): HyperliquidAbstraction;
34
- declare const DEFAULT_HYPERLIQUID_MARKET_SLIPPAGE_BPS = 30;
35
- declare function computeHyperliquidMarketIocLimitPrice(params: {
36
- markPrice: number;
37
- side: "buy" | "sell";
38
- slippageBps?: number;
39
- decimals?: number;
40
- }): string;
41
- interface HyperliquidTriggerOptions {
42
- triggerPx: string | number | bigint;
43
- isMarket?: boolean;
44
- tpsl: HyperliquidTriggerType;
45
- }
46
- interface HyperliquidBuilderFee {
47
- address: `0x${string}`;
48
- /**
49
- * Fee in tenths of basis points (10 = 1bp = 0.01%). Max defaults to 0.1% (100).
50
- */
51
- fee: number;
52
- }
53
- interface HyperliquidOrderIntent {
54
- symbol: string;
55
- side: "buy" | "sell";
56
- price: string | number | bigint;
57
- size: string | number | bigint;
58
- tif?: HyperliquidTimeInForce;
59
- reduceOnly?: boolean;
60
- clientId?: `0x${string}`;
61
- trigger?: HyperliquidTriggerOptions;
62
- }
63
- type ExchangeOrderAction = {
64
- type: "order";
65
- orders: Array<{
66
- a: number;
67
- b: boolean;
68
- p: string;
69
- s: string;
70
- r: boolean;
71
- t: {
72
- limit: {
73
- tif: HyperliquidTimeInForce;
74
- };
75
- } | {
76
- trigger: {
77
- isMarket: boolean;
78
- triggerPx: string;
79
- tpsl: HyperliquidTriggerType;
80
- };
81
- };
82
- c?: `0x${string}`;
83
- }>;
84
- grouping: HyperliquidGrouping;
85
- builder?: {
86
- b: `0x${string}`;
87
- f: number;
88
- };
89
- };
90
- type ExchangeSignature = {
91
- r: `0x${string}`;
92
- s: `0x${string}`;
93
- v: 27 | 28;
94
- };
95
- type HyperliquidExchangeResponse<T = unknown> = {
96
- status: string;
97
- response?: {
98
- type: string;
99
- data?: T;
100
- };
101
- error?: string;
102
- };
103
- type NonceSource = () => number;
104
- declare class HyperliquidApiError extends Error {
105
- readonly response: unknown;
106
- constructor(message: string, response: unknown);
107
- }
108
- declare class HyperliquidGuardError extends Error {
109
- constructor(message: string);
110
- }
111
- declare class HyperliquidTermsError extends HyperliquidGuardError {
112
- constructor(message?: string);
113
- }
114
- declare class HyperliquidBuilderApprovalError extends HyperliquidGuardError {
115
- constructor(message?: string);
116
- }
117
- declare function createMonotonicNonceFactory(start?: number): NonceSource;
118
- declare function toApiDecimal(value: string | number | bigint): string;
119
- declare function splitSignature(signature: `0x${string}`): ExchangeSignature;
120
- declare function createL1ActionHash(args: {
121
- action: ExchangeOrderAction | Record<string, unknown>;
122
- nonce: number;
123
- vaultAddress?: `0x${string}` | undefined;
124
- expiresAfter?: number | undefined;
125
- }): `0x${string}`;
126
-
127
- declare class HyperliquidInfoClient {
128
- private readonly environment;
129
- constructor(environment?: HyperliquidEnvironment);
130
- meta(): Promise<any>;
131
- metaAndAssetCtxs(): Promise<any>;
132
- spotMeta(): Promise<any>;
133
- spotMetaAndAssetCtxs(): Promise<any>;
134
- assetCtxs(): Promise<any>;
135
- spotAssetCtxs(): Promise<any>;
136
- openOrders(user: `0x${string}`): Promise<any>;
137
- frontendOpenOrders(user: `0x${string}`): Promise<any>;
138
- orderStatus(user: `0x${string}`, oid: number | string): Promise<any>;
139
- historicalOrders(user: `0x${string}`): Promise<any>;
140
- userFills(user: `0x${string}`): Promise<any>;
141
- userFillsByTime(user: `0x${string}`, startTime: number, endTime: number): Promise<any>;
142
- userRateLimit(user: `0x${string}`): Promise<any>;
143
- preTransferCheck(user: `0x${string}`, source: `0x${string}`): Promise<any>;
144
- spotClearinghouseState(user: `0x${string}`): Promise<any>;
145
- }
146
- declare function fetchHyperliquidMeta(environment?: HyperliquidEnvironment): Promise<any>;
147
- declare function fetchHyperliquidMetaAndAssetCtxs(environment?: HyperliquidEnvironment): Promise<any>;
148
- declare function fetchHyperliquidSpotMeta(environment?: HyperliquidEnvironment): Promise<any>;
149
- declare function fetchHyperliquidSpotMetaAndAssetCtxs(environment?: HyperliquidEnvironment): Promise<any>;
150
- declare function fetchHyperliquidAssetCtxs(environment?: HyperliquidEnvironment): Promise<any>;
151
- declare function fetchHyperliquidSpotAssetCtxs(environment?: HyperliquidEnvironment): Promise<any>;
152
- declare function fetchHyperliquidOpenOrders(params: {
153
- environment?: HyperliquidEnvironment;
154
- user: `0x${string}`;
155
- }): Promise<any>;
156
- declare function fetchHyperliquidFrontendOpenOrders(params: {
157
- environment?: HyperliquidEnvironment;
158
- user: `0x${string}`;
159
- }): Promise<any>;
160
- declare function fetchHyperliquidOrderStatus(params: {
161
- environment?: HyperliquidEnvironment;
162
- user: `0x${string}`;
163
- oid: number | string;
164
- }): Promise<any>;
165
- declare function fetchHyperliquidHistoricalOrders(params: {
166
- environment?: HyperliquidEnvironment;
167
- user: `0x${string}`;
168
- }): Promise<any>;
169
- declare function fetchHyperliquidUserFills(params: {
170
- environment?: HyperliquidEnvironment;
171
- user: `0x${string}`;
172
- }): Promise<any>;
173
- declare function fetchHyperliquidUserFillsByTime(params: {
174
- environment?: HyperliquidEnvironment;
175
- user: `0x${string}`;
176
- startTime: number;
177
- endTime: number;
178
- }): Promise<any>;
179
- declare function fetchHyperliquidUserRateLimit(params: {
180
- environment?: HyperliquidEnvironment;
181
- user: `0x${string}`;
182
- }): Promise<any>;
183
- declare function fetchHyperliquidPreTransferCheck(params: {
184
- environment?: HyperliquidEnvironment;
185
- user: `0x${string}`;
186
- source: `0x${string}`;
187
- }): Promise<any>;
188
- declare function fetchHyperliquidSpotClearinghouseState(params: {
189
- environment?: HyperliquidEnvironment;
190
- user: `0x${string}`;
191
- }): Promise<any>;
192
-
193
- type CommonActionOptions = {
194
- environment?: HyperliquidEnvironment;
195
- vaultAddress?: `0x${string}` | undefined;
196
- expiresAfter?: number | undefined;
197
- nonce?: number | undefined;
198
- nonceSource?: NonceSource | undefined;
199
- /**
200
- * Optional per-wallet nonce provider (preferred if available).
201
- */
202
- walletNonceProvider?: NonceSource | undefined;
203
- };
204
- type CancelInput = {
205
- symbol: string;
206
- oid: number | string;
207
- };
208
- type CancelByCloidInput = {
209
- symbol: string;
210
- cloid: `0x${string}`;
211
- };
212
- type ModifyOrderInput = {
213
- oid: number | `0x${string}`;
214
- order: HyperliquidOrderIntent;
215
- };
216
- type TwapOrderInput = {
217
- symbol: string;
218
- side: "buy" | "sell";
219
- size: string | number | bigint;
220
- reduceOnly?: boolean;
221
- minutes: number;
222
- randomize?: boolean;
223
- };
224
- type TwapCancelInput = {
225
- symbol: string;
226
- twapId: number;
227
- };
228
- type UpdateLeverageInput = {
229
- symbol: string;
230
- leverageMode: "cross" | "isolated";
231
- leverage: number;
232
- };
233
- type UpdateIsolatedMarginInput = {
234
- symbol: string;
235
- isBuy: boolean;
236
- ntli: number;
237
- };
238
- declare class HyperliquidExchangeClient {
239
- private readonly nonceSource;
240
- private readonly environment;
241
- private readonly vaultAddress;
242
- private readonly expiresAfter;
243
- private readonly wallet;
244
- constructor(args: {
245
- wallet: WalletFullContext;
246
- environment?: HyperliquidEnvironment;
247
- vaultAddress?: `0x${string}`;
248
- expiresAfter?: number;
249
- nonceSource?: NonceSource;
250
- walletNonceProvider?: NonceSource;
251
- });
252
- cancel(cancels: CancelInput[]): Promise<HyperliquidExchangeResponse<unknown>>;
253
- cancelByCloid(cancels: CancelByCloidInput[]): Promise<HyperliquidExchangeResponse<unknown>>;
254
- cancelAll(): Promise<HyperliquidExchangeResponse<unknown>>;
255
- scheduleCancel(time: number | null): Promise<HyperliquidExchangeResponse<unknown>>;
256
- modify(modification: ModifyOrderInput): Promise<HyperliquidExchangeResponse<unknown>>;
257
- batchModify(modifications: ModifyOrderInput[]): Promise<HyperliquidExchangeResponse<unknown>>;
258
- twapOrder(twap: TwapOrderInput): Promise<HyperliquidExchangeResponse<unknown>>;
259
- twapCancel(cancel: TwapCancelInput): Promise<HyperliquidExchangeResponse<unknown>>;
260
- updateLeverage(input: UpdateLeverageInput): Promise<HyperliquidExchangeResponse<unknown>>;
261
- updateIsolatedMargin(input: UpdateIsolatedMarginInput): Promise<HyperliquidExchangeResponse<unknown>>;
262
- reserveRequestWeight(weight: number): Promise<HyperliquidExchangeResponse<unknown>>;
263
- spotSend(params: {
264
- destination: `0x${string}`;
265
- token: string;
266
- amount: string | number | bigint;
267
- }): Promise<HyperliquidExchangeResponse<unknown>>;
268
- setDexAbstraction(params: {
269
- enabled: boolean;
270
- user?: `0x${string}`;
271
- }): Promise<HyperliquidExchangeResponse<unknown>>;
272
- setAccountAbstractionMode(params: {
273
- mode: HyperliquidAccountMode;
274
- user?: `0x${string}`;
275
- }): Promise<HyperliquidExchangeResponse<unknown>>;
276
- setPortfolioMargin(params: {
277
- enabled: boolean;
278
- user?: `0x${string}`;
279
- }): Promise<HyperliquidExchangeResponse<unknown>>;
280
- }
281
- declare function setHyperliquidPortfolioMargin(options: {
282
- wallet: WalletFullContext;
283
- enabled: boolean;
284
- user?: `0x${string}`;
285
- } & CommonActionOptions): Promise<HyperliquidExchangeResponse<unknown>>;
286
- declare function setHyperliquidDexAbstraction(options: {
287
- wallet: WalletFullContext;
288
- enabled: boolean;
289
- user?: `0x${string}`;
290
- } & CommonActionOptions): Promise<HyperliquidExchangeResponse<unknown>>;
291
- declare function setHyperliquidAccountAbstractionMode(options: {
292
- wallet: WalletFullContext;
293
- mode: HyperliquidAccountMode;
294
- user?: `0x${string}`;
295
- } & CommonActionOptions): Promise<HyperliquidExchangeResponse<unknown>>;
296
- declare function cancelHyperliquidOrders(options: {
297
- wallet: WalletFullContext;
298
- cancels: CancelInput[];
299
- } & CommonActionOptions): Promise<HyperliquidExchangeResponse<unknown>>;
300
- declare function cancelHyperliquidOrdersByCloid(options: {
301
- wallet: WalletFullContext;
302
- cancels: CancelByCloidInput[];
303
- } & CommonActionOptions): Promise<HyperliquidExchangeResponse<unknown>>;
304
- declare function cancelAllHyperliquidOrders(options: {
305
- wallet: WalletFullContext;
306
- } & CommonActionOptions): Promise<HyperliquidExchangeResponse<unknown>>;
307
- declare function scheduleHyperliquidCancel(options: {
308
- wallet: WalletFullContext;
309
- time?: number | null;
310
- } & CommonActionOptions): Promise<HyperliquidExchangeResponse<unknown>>;
311
- declare function modifyHyperliquidOrder(options: {
312
- wallet: WalletFullContext;
313
- modification: ModifyOrderInput;
314
- grouping?: HyperliquidGrouping;
315
- } & CommonActionOptions): Promise<HyperliquidExchangeResponse<unknown>>;
316
- declare function batchModifyHyperliquidOrders(options: {
317
- wallet: WalletFullContext;
318
- modifications: ModifyOrderInput[];
319
- } & CommonActionOptions): Promise<HyperliquidExchangeResponse<unknown>>;
320
- declare function placeHyperliquidTwapOrder(options: {
321
- wallet: WalletFullContext;
322
- twap: TwapOrderInput;
323
- } & CommonActionOptions): Promise<HyperliquidExchangeResponse<unknown>>;
324
- declare function cancelHyperliquidTwapOrder(options: {
325
- wallet: WalletFullContext;
326
- cancel: TwapCancelInput;
327
- } & CommonActionOptions): Promise<HyperliquidExchangeResponse<unknown>>;
328
- declare function updateHyperliquidLeverage(options: {
329
- wallet: WalletFullContext;
330
- input: UpdateLeverageInput;
331
- } & CommonActionOptions): Promise<HyperliquidExchangeResponse<unknown>>;
332
- declare function updateHyperliquidIsolatedMargin(options: {
333
- wallet: WalletFullContext;
334
- input: UpdateIsolatedMarginInput;
335
- } & CommonActionOptions): Promise<HyperliquidExchangeResponse<unknown>>;
336
- declare function reserveHyperliquidRequestWeight(options: {
337
- wallet: WalletFullContext;
338
- weight: number;
339
- } & CommonActionOptions): Promise<HyperliquidExchangeResponse<unknown>>;
340
- declare function createHyperliquidSubAccount(options: {
341
- wallet: WalletFullContext;
342
- name: string;
343
- } & CommonActionOptions): Promise<HyperliquidExchangeResponse<unknown>>;
344
- declare function transferHyperliquidSubAccount(options: {
345
- wallet: WalletFullContext;
346
- subAccountUser: `0x${string}`;
347
- isDeposit: boolean;
348
- usd: string | number | bigint;
349
- } & CommonActionOptions): Promise<HyperliquidExchangeResponse<unknown>>;
350
- declare function sendHyperliquidSpot(options: {
351
- wallet: WalletFullContext;
352
- destination: `0x${string}`;
353
- token: string;
354
- amount: string | number | bigint;
355
- environment?: HyperliquidEnvironment;
356
- nonce?: number;
357
- nonceSource?: NonceSource | undefined;
358
- }): Promise<HyperliquidExchangeResponse<unknown>>;
359
-
360
- export { setHyperliquidPortfolioMargin as $, fetchHyperliquidFrontendOpenOrders as A, fetchHyperliquidHistoricalOrders as B, fetchHyperliquidMeta as C, DEFAULT_HYPERLIQUID_MARKET_SLIPPAGE_BPS as D, type ExchangeOrderAction as E, fetchHyperliquidMetaAndAssetCtxs as F, fetchHyperliquidOpenOrders as G, type HyperliquidEnvironment as H, fetchHyperliquidOrderStatus as I, fetchHyperliquidPreTransferCheck as J, fetchHyperliquidSpotAssetCtxs as K, fetchHyperliquidSpotClearinghouseState as L, type MarketIdentity as M, type NonceSource as N, fetchHyperliquidSpotMeta as O, fetchHyperliquidSpotMetaAndAssetCtxs as P, fetchHyperliquidUserFills as Q, fetchHyperliquidUserFillsByTime as R, fetchHyperliquidUserRateLimit as S, modifyHyperliquidOrder as T, placeHyperliquidTwapOrder as U, reserveHyperliquidRequestWeight as V, resolveHyperliquidAbstractionFromMode as W, scheduleHyperliquidCancel as X, sendHyperliquidSpot as Y, setHyperliquidAccountAbstractionMode as Z, setHyperliquidDexAbstraction as _, type HyperliquidOrderIntent as a, transferHyperliquidSubAccount as a0, updateHyperliquidIsolatedMargin as a1, updateHyperliquidLeverage as a2, toApiDecimal as a3, createL1ActionHash as a4, splitSignature as a5, type HyperliquidGrouping as b, type HyperliquidAbstraction as c, type HyperliquidAccountMode as d, HyperliquidApiError as e, HyperliquidBuilderApprovalError as f, type HyperliquidBuilderFee as g, HyperliquidExchangeClient as h, type HyperliquidExchangeResponse as i, HyperliquidGuardError as j, HyperliquidInfoClient as k, type HyperliquidMarketIdentityInput as l, HyperliquidTermsError as m, type HyperliquidTimeInForce as n, type HyperliquidTriggerOptions as o, type HyperliquidTriggerType as p, batchModifyHyperliquidOrders as q, buildHyperliquidMarketIdentity as r, cancelAllHyperliquidOrders as s, cancelHyperliquidOrders as t, cancelHyperliquidOrdersByCloid as u, cancelHyperliquidTwapOrder as v, computeHyperliquidMarketIocLimitPrice as w, createHyperliquidSubAccount as x, createMonotonicNonceFactory as y, fetchHyperliquidAssetCtxs as z };