opentool 0.10.5 → 0.11.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.
@@ -1,4 +1,4 @@
1
- import { b as WalletFullContext } from '../../types-rAQrDrah.js';
1
+ import { h as WalletFullContext } from '../../types-BaTmu0gS.js';
2
2
  import { StoreOptions, StoreResponse } from '../../store/index.js';
3
3
  import 'viem';
4
4
  import 'viem/accounts';
@@ -0,0 +1,319 @@
1
+ import { h as WalletFullContext } from '../../types-BaTmu0gS.js';
2
+ import 'viem';
3
+ import 'viem/accounts';
4
+
5
+ type PolymarketEnvironment = "mainnet" | "testnet";
6
+ type PolymarketSide = "BUY" | "SELL";
7
+ type PolymarketOrderType = "GTC" | "FOK" | "FAK" | "GTD";
8
+ type PolymarketSignatureType = 0 | 1 | 2;
9
+ interface PolymarketApiCredentials {
10
+ apiKey: string;
11
+ secret: string;
12
+ passphrase: string;
13
+ }
14
+ interface PolymarketMarket {
15
+ id: string;
16
+ slug?: string | null;
17
+ question?: string | null;
18
+ description?: string | null;
19
+ eventId?: string | null;
20
+ eventSlug?: string | null;
21
+ conditionId?: string | null;
22
+ marketMakerAddress?: string | null;
23
+ category?: string | null;
24
+ tags?: string[];
25
+ active?: boolean;
26
+ closed?: boolean;
27
+ resolved?: boolean;
28
+ startDate?: string | null;
29
+ endDate?: string | null;
30
+ createdAt?: string | null;
31
+ updatedAt?: string | null;
32
+ closedTime?: string | null;
33
+ volume?: string | null;
34
+ liquidity?: string | null;
35
+ openInterest?: string | null;
36
+ outcomes?: string[];
37
+ outcomePrices?: number[];
38
+ clobTokenIds?: string[];
39
+ icon?: string | null;
40
+ image?: string | null;
41
+ }
42
+ interface PolymarketOrderbookLevel {
43
+ price: number;
44
+ size: number;
45
+ }
46
+ interface PolymarketOrderbook {
47
+ market: string;
48
+ bids: PolymarketOrderbookLevel[];
49
+ asks: PolymarketOrderbookLevel[];
50
+ timestamp?: string | null;
51
+ }
52
+ interface PolymarketPriceHistoryPoint {
53
+ t: number;
54
+ p: number;
55
+ }
56
+ interface PolymarketSignedOrderPayload {
57
+ salt: string;
58
+ maker: `0x${string}`;
59
+ signer: `0x${string}`;
60
+ taker: `0x${string}`;
61
+ tokenId: string;
62
+ makerAmount: string;
63
+ takerAmount: string;
64
+ expiration: string;
65
+ nonce: string;
66
+ feeRateBps: string;
67
+ side: 0 | 1;
68
+ signatureType: PolymarketSignatureType;
69
+ signature: `0x${string}`;
70
+ }
71
+ declare class PolymarketApiError extends Error {
72
+ readonly response: unknown;
73
+ constructor(message: string, response: unknown);
74
+ }
75
+ declare class PolymarketAuthError extends Error {
76
+ constructor(message: string);
77
+ }
78
+ declare const POLYMARKET_ENDPOINTS: {
79
+ readonly gamma: {
80
+ readonly mainnet: "https://gamma-api.polymarket.com";
81
+ readonly testnet: "https://gamma-api.polymarket.com";
82
+ };
83
+ readonly clob: {
84
+ readonly mainnet: "https://clob.polymarket.com";
85
+ readonly testnet: "https://clob.polymarket.com";
86
+ };
87
+ readonly data: {
88
+ readonly mainnet: "https://data-api.polymarket.com";
89
+ readonly testnet: "https://data-api.polymarket.com";
90
+ };
91
+ };
92
+ declare const POLYMARKET_CHAIN_ID: Record<PolymarketEnvironment, number>;
93
+ declare const POLYMARKET_EXCHANGE_ADDRESSES: Record<PolymarketEnvironment, {
94
+ ctf: `0x${string}`;
95
+ negRisk: `0x${string}`;
96
+ }>;
97
+ declare const POLYMARKET_CLOB_DOMAIN: {
98
+ name: string;
99
+ version: string;
100
+ };
101
+ declare const POLYMARKET_CLOB_AUTH_DOMAIN: {
102
+ name: string;
103
+ version: string;
104
+ };
105
+ declare function resolvePolymarketBaseUrl(service: keyof typeof POLYMARKET_ENDPOINTS, environment: PolymarketEnvironment): string;
106
+ declare function normalizeStringArrayish(value: unknown): string[];
107
+ declare function normalizeNumberArrayish(value: unknown): number[];
108
+ declare function buildHmacSignature(args: {
109
+ secret: string;
110
+ timestamp: number | string;
111
+ method: string;
112
+ path: string;
113
+ body?: string | Record<string, unknown> | null;
114
+ }): string;
115
+ declare function buildL2Headers(args: {
116
+ credentials: PolymarketApiCredentials;
117
+ address: `0x${string}`;
118
+ timestamp?: number;
119
+ method: string;
120
+ path: string;
121
+ body?: Record<string, unknown> | string | null;
122
+ }): Record<string, string>;
123
+ declare function buildL1Headers(args: {
124
+ wallet: WalletFullContext;
125
+ timestamp?: number;
126
+ nonce?: number;
127
+ environment?: PolymarketEnvironment;
128
+ message?: string;
129
+ }): Promise<Record<string, string>>;
130
+ declare function resolveExchangeAddress(args: {
131
+ environment: PolymarketEnvironment;
132
+ negRisk?: boolean;
133
+ exchangeAddress?: `0x${string}`;
134
+ }): `0x${string}`;
135
+ declare function buildPolymarketOrderAmounts(args: {
136
+ side: PolymarketSide;
137
+ price: string | number | bigint;
138
+ size: string | number | bigint;
139
+ tickSize?: string | number | bigint;
140
+ }): {
141
+ makerAmount: bigint;
142
+ takerAmount: bigint;
143
+ };
144
+ declare function buildSignedOrderPayload(args: {
145
+ wallet: WalletFullContext;
146
+ environment?: PolymarketEnvironment;
147
+ tokenId: string;
148
+ side: PolymarketSide;
149
+ price: string | number | bigint;
150
+ size: string | number | bigint;
151
+ expiration?: number;
152
+ nonce?: number;
153
+ feeRateBps?: number;
154
+ tickSize?: string | number | bigint;
155
+ maker?: `0x${string}`;
156
+ signer?: `0x${string}`;
157
+ taker?: `0x${string}`;
158
+ signatureType?: PolymarketSignatureType;
159
+ negRisk?: boolean;
160
+ exchangeAddress?: `0x${string}`;
161
+ }): Promise<PolymarketSignedOrderPayload>;
162
+
163
+ interface PolymarketApiKeyResponse {
164
+ apiKey: string;
165
+ secret: string;
166
+ passphrase: string;
167
+ }
168
+ interface PolymarketOrderIntent {
169
+ tokenId: string;
170
+ side: PolymarketSide;
171
+ price: string | number | bigint;
172
+ size: string | number | bigint;
173
+ expiration?: number;
174
+ nonce?: number;
175
+ feeRateBps?: number;
176
+ tickSize?: string | number | bigint;
177
+ maker?: `0x${string}`;
178
+ signer?: `0x${string}`;
179
+ taker?: `0x${string}`;
180
+ signatureType?: PolymarketSignatureType;
181
+ negRisk?: boolean;
182
+ exchangeAddress?: `0x${string}`;
183
+ }
184
+ interface PolymarketPlaceOrderResponse {
185
+ orderId?: string;
186
+ status?: string;
187
+ message?: string;
188
+ [key: string]: unknown;
189
+ }
190
+ declare function createPolymarketApiKey(args: {
191
+ wallet: WalletFullContext;
192
+ environment?: PolymarketEnvironment;
193
+ timestamp?: number;
194
+ nonce?: number;
195
+ message?: string;
196
+ }): Promise<PolymarketApiKeyResponse>;
197
+ declare function derivePolymarketApiKey(args: {
198
+ wallet: WalletFullContext;
199
+ environment?: PolymarketEnvironment;
200
+ timestamp?: number;
201
+ nonce?: number;
202
+ message?: string;
203
+ }): Promise<PolymarketApiKeyResponse>;
204
+ declare function placePolymarketOrder(args: {
205
+ wallet: WalletFullContext;
206
+ credentials?: PolymarketApiCredentials;
207
+ order: PolymarketOrderIntent;
208
+ orderType?: PolymarketOrderType;
209
+ environment?: PolymarketEnvironment;
210
+ }): Promise<PolymarketPlaceOrderResponse>;
211
+ declare function cancelPolymarketOrder(args: {
212
+ orderId: string;
213
+ wallet?: WalletFullContext;
214
+ walletAddress?: `0x${string}`;
215
+ credentials?: PolymarketApiCredentials;
216
+ environment?: PolymarketEnvironment;
217
+ }): Promise<Record<string, unknown>>;
218
+ declare function cancelPolymarketOrders(args: {
219
+ orderIds: string[];
220
+ wallet?: WalletFullContext;
221
+ walletAddress?: `0x${string}`;
222
+ credentials?: PolymarketApiCredentials;
223
+ environment?: PolymarketEnvironment;
224
+ }): Promise<Record<string, unknown>>;
225
+ declare function cancelAllPolymarketOrders(args: {
226
+ wallet?: WalletFullContext;
227
+ walletAddress?: `0x${string}`;
228
+ credentials?: PolymarketApiCredentials;
229
+ environment?: PolymarketEnvironment;
230
+ }): Promise<Record<string, unknown>>;
231
+ declare function cancelMarketPolymarketOrders(args: {
232
+ tokenId: string;
233
+ wallet?: WalletFullContext;
234
+ walletAddress?: `0x${string}`;
235
+ credentials?: PolymarketApiCredentials;
236
+ environment?: PolymarketEnvironment;
237
+ }): Promise<Record<string, unknown>>;
238
+ declare class PolymarketExchangeClient {
239
+ private readonly wallet;
240
+ private readonly credentials;
241
+ private readonly environment;
242
+ private cachedCredentials;
243
+ constructor(args: {
244
+ wallet: WalletFullContext;
245
+ credentials?: PolymarketApiCredentials;
246
+ environment?: PolymarketEnvironment;
247
+ });
248
+ private getCredentials;
249
+ placeOrder(order: PolymarketOrderIntent, orderType?: PolymarketOrderType): Promise<PolymarketPlaceOrderResponse>;
250
+ cancelOrder(orderId: string): Promise<Record<string, unknown>>;
251
+ cancelOrders(orderIds: string[]): Promise<Record<string, unknown>>;
252
+ cancelAll(): Promise<Record<string, unknown>>;
253
+ cancelMarket(tokenId: string): Promise<Record<string, unknown>>;
254
+ }
255
+
256
+ type FetchParams = {
257
+ environment?: PolymarketEnvironment;
258
+ limit?: number;
259
+ offset?: number;
260
+ order?: string;
261
+ ascending?: boolean;
262
+ tagId?: string;
263
+ relatedTags?: boolean;
264
+ excludeTagId?: string;
265
+ category?: string;
266
+ slug?: string;
267
+ active?: boolean;
268
+ closed?: boolean;
269
+ };
270
+ declare class PolymarketInfoClient {
271
+ private readonly environment;
272
+ constructor(environment?: PolymarketEnvironment);
273
+ markets(params?: FetchParams): Promise<PolymarketMarket[]>;
274
+ market(params: {
275
+ id?: string;
276
+ slug?: string;
277
+ conditionId?: string;
278
+ }): Promise<PolymarketMarket | null>;
279
+ orderbook(tokenId: string): Promise<PolymarketOrderbook>;
280
+ price(tokenId: string, side: "BUY" | "SELL"): Promise<number | null>;
281
+ midpoint(tokenId: string): Promise<number | null>;
282
+ priceHistory(params: {
283
+ tokenId: string;
284
+ startTs?: number;
285
+ endTs?: number;
286
+ interval?: string;
287
+ fidelity?: number;
288
+ }): Promise<PolymarketPriceHistoryPoint[]>;
289
+ }
290
+ declare function fetchPolymarketMarkets(params?: FetchParams): Promise<PolymarketMarket[]>;
291
+ declare function fetchPolymarketMarket(params: {
292
+ id?: string;
293
+ slug?: string;
294
+ conditionId?: string;
295
+ environment?: PolymarketEnvironment;
296
+ }): Promise<PolymarketMarket | null>;
297
+ declare function fetchPolymarketOrderbook(params: {
298
+ tokenId: string;
299
+ environment?: PolymarketEnvironment;
300
+ }): Promise<PolymarketOrderbook>;
301
+ declare function fetchPolymarketPrice(params: {
302
+ tokenId: string;
303
+ side: "BUY" | "SELL";
304
+ environment?: PolymarketEnvironment;
305
+ }): Promise<number | null>;
306
+ declare function fetchPolymarketMidpoint(params: {
307
+ tokenId: string;
308
+ environment?: PolymarketEnvironment;
309
+ }): Promise<number | null>;
310
+ declare function fetchPolymarketPriceHistory(params: {
311
+ tokenId: string;
312
+ startTs?: number;
313
+ endTs?: number;
314
+ interval?: string;
315
+ fidelity?: number;
316
+ environment?: PolymarketEnvironment;
317
+ }): Promise<PolymarketPriceHistoryPoint[]>;
318
+
319
+ export { POLYMARKET_CHAIN_ID, POLYMARKET_CLOB_AUTH_DOMAIN, POLYMARKET_CLOB_DOMAIN, POLYMARKET_ENDPOINTS, POLYMARKET_EXCHANGE_ADDRESSES, type PolymarketApiCredentials, PolymarketApiError, type PolymarketApiKeyResponse, PolymarketAuthError, type PolymarketEnvironment, PolymarketExchangeClient, PolymarketInfoClient, type PolymarketMarket, type PolymarketOrderIntent, type PolymarketOrderType, type PolymarketOrderbook, type PolymarketPlaceOrderResponse, type PolymarketPriceHistoryPoint, type PolymarketSide, type PolymarketSignatureType, type PolymarketSignedOrderPayload, buildHmacSignature, buildL1Headers, buildL2Headers, buildPolymarketOrderAmounts, buildSignedOrderPayload, cancelAllPolymarketOrders, cancelMarketPolymarketOrders, cancelPolymarketOrder, cancelPolymarketOrders, createPolymarketApiKey, derivePolymarketApiKey, fetchPolymarketMarket, fetchPolymarketMarkets, fetchPolymarketMidpoint, fetchPolymarketOrderbook, fetchPolymarketPrice, fetchPolymarketPriceHistory, normalizeNumberArrayish, normalizeStringArrayish, placePolymarketOrder, resolveExchangeAddress, resolvePolymarketBaseUrl };