@contextwtf/sdk 0.2.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,693 @@
1
+ import * as viem from 'viem';
2
+ import { Address, Hex, WalletClient, Account } from 'viem';
3
+
4
+ interface HttpClient {
5
+ get<T = unknown>(path: string, params?: Record<string, string | number | undefined>): Promise<T>;
6
+ post<T = unknown>(path: string, body: unknown): Promise<T>;
7
+ delete<T = unknown>(path: string, body?: unknown): Promise<T>;
8
+ }
9
+
10
+ interface Market {
11
+ id: string;
12
+ question: string;
13
+ shortQuestion: string;
14
+ oracle: string;
15
+ outcomeTokens: string[];
16
+ outcomePrices: OutcomePrice[];
17
+ creator: string;
18
+ creatorProfile: {
19
+ username: string | null;
20
+ avatarUrl: string | null;
21
+ } | null;
22
+ volume: string;
23
+ volume24h: string;
24
+ participantCount: number;
25
+ resolutionStatus: "none" | "pending" | "resolved";
26
+ status: "active" | "pending" | "resolved" | "closed";
27
+ createdAt: string;
28
+ deadline: string;
29
+ resolutionCriteria: string;
30
+ resolvedAt: string | null;
31
+ payoutPcts: number[] | null;
32
+ metadata: MarketMetadata;
33
+ outcome: number | null;
34
+ contractAddress: string | null;
35
+ [key: string]: unknown;
36
+ }
37
+ interface OutcomePrice {
38
+ outcomeIndex: number;
39
+ bestBid: number | null;
40
+ bestAsk: number | null;
41
+ spread: number | null;
42
+ midPrice: number | null;
43
+ lastPrice: number | null;
44
+ currentPrice: number | null;
45
+ }
46
+ interface MarketMetadata {
47
+ slug: string | null;
48
+ criteria: string;
49
+ startTime: number;
50
+ endTime: number;
51
+ shortSummary: string | null;
52
+ mediaHash: string | null;
53
+ sourceAccounts: {
54
+ platform: string;
55
+ userId: string;
56
+ username: string;
57
+ displayName: string | null;
58
+ profileImageUrl: string | null;
59
+ }[];
60
+ categories: string[] | null;
61
+ [key: string]: unknown;
62
+ }
63
+ interface MarketList {
64
+ markets: Market[];
65
+ cursor: string | null;
66
+ }
67
+ interface QuoteSide {
68
+ bid: number | null;
69
+ ask: number | null;
70
+ last: number | null;
71
+ }
72
+ interface Quotes {
73
+ marketId: string;
74
+ yes: QuoteSide;
75
+ no: QuoteSide;
76
+ spread: number | null;
77
+ timestamp: string;
78
+ [key: string]: unknown;
79
+ }
80
+ interface Orderbook {
81
+ marketId: string;
82
+ bids: OrderbookLevel[];
83
+ asks: OrderbookLevel[];
84
+ timestamp: string;
85
+ [key: string]: unknown;
86
+ }
87
+ interface OrderbookLevel {
88
+ price: number;
89
+ size: number;
90
+ [key: string]: unknown;
91
+ }
92
+ interface FullOrderbook {
93
+ marketId: string;
94
+ yes: {
95
+ bids: OrderbookLevel[];
96
+ asks: OrderbookLevel[];
97
+ };
98
+ no: {
99
+ bids: OrderbookLevel[];
100
+ asks: OrderbookLevel[];
101
+ };
102
+ timestamp: string;
103
+ }
104
+ interface Order {
105
+ nonce: Hex;
106
+ marketId: string;
107
+ trader: Address;
108
+ outcomeIndex: number;
109
+ side: 0 | 1;
110
+ price: string;
111
+ size: string;
112
+ type: "limit" | "market";
113
+ status: "open" | "filled" | "cancelled" | "expired" | "voided";
114
+ insertedAt: string;
115
+ filledSize: string;
116
+ remainingSize: string;
117
+ percentFilled: number;
118
+ voidedAt: string | null;
119
+ voidReason: "UNFILLED_MARKET_ORDER" | "UNDER_COLLATERALIZED" | "MISSING_OPERATOR_APPROVAL" | null;
120
+ [key: string]: unknown;
121
+ }
122
+ /** Enriched market info returned alongside orders. Keyed by marketId. */
123
+ type OrderMarkets = Record<string, {
124
+ shortQuestion: string;
125
+ slug: string;
126
+ }>;
127
+ interface OrderList {
128
+ orders: Order[];
129
+ markets?: OrderMarkets;
130
+ cursor: string | null;
131
+ }
132
+ interface CreateOrderResult {
133
+ success: boolean;
134
+ order: Order;
135
+ }
136
+ interface Fill {
137
+ order: Order;
138
+ previousFilledSize: number;
139
+ currentFilledSize: number;
140
+ fillSize: number;
141
+ type: "partial" | "full";
142
+ }
143
+ /**
144
+ * Inventory mode constraint for limit orders.
145
+ * - 0 (ANY): Fill can mint new tokens or use existing inventory
146
+ * - 1 (REQUIRE_INVENTORY): Maker must already hold the outcome tokens
147
+ * - 2 (REQUIRE_NO_INVENTORY): Settlement mints complete sets from maker's USDC on fill.
148
+ * Use this for SELL/ASK orders when you don't hold tokens but have USDC deposited.
149
+ */
150
+ type InventoryMode = 0 | 1 | 2;
151
+ /**
152
+ * Maker role constraint for limit orders.
153
+ * - 0 (ANY): No constraint
154
+ * - 1 (MAKER_ONLY): Order can only be a maker (no immediate fills)
155
+ * - 2 (TAKER_ONLY): Order can only be a taker (must fill immediately)
156
+ */
157
+ type MakerRoleConstraint = 0 | 1 | 2;
158
+ interface PlaceOrderRequest {
159
+ marketId: string;
160
+ outcome: "yes" | "no";
161
+ side: "buy" | "sell";
162
+ priceCents: number;
163
+ size: number;
164
+ expirySeconds?: number;
165
+ /** Default: 0 (ANY). Set to 2 for SELL orders without existing token inventory. */
166
+ inventoryModeConstraint?: InventoryMode;
167
+ /** Default: 0 (ANY). Set to 1 for maker-only, 2 for taker-only. */
168
+ makerRoleConstraint?: MakerRoleConstraint;
169
+ }
170
+ interface PlaceMarketOrderRequest {
171
+ marketId: string;
172
+ outcome: "yes" | "no";
173
+ side: "buy" | "sell";
174
+ maxPriceCents: number;
175
+ maxSize: number;
176
+ expirySeconds?: number;
177
+ }
178
+ interface CancelResult {
179
+ success: boolean;
180
+ alreadyCancelled?: boolean;
181
+ [key: string]: unknown;
182
+ }
183
+ interface CancelReplaceResult {
184
+ cancel: CancelResult & {
185
+ trader: string;
186
+ nonce: string;
187
+ };
188
+ create: CreateOrderResult;
189
+ }
190
+ interface SimulateTradeParams {
191
+ side: "yes" | "no";
192
+ amount: number;
193
+ amountType?: "usd" | "contracts";
194
+ trader?: string;
195
+ }
196
+ interface SimulateResult {
197
+ marketId: string;
198
+ side: string;
199
+ amount: number;
200
+ amountType: string;
201
+ estimatedContracts: number;
202
+ estimatedAvgPrice: number;
203
+ estimatedSlippage: number;
204
+ [key: string]: unknown;
205
+ }
206
+ interface OrderSimulateParams {
207
+ marketId: string;
208
+ trader: string;
209
+ maxSize: string;
210
+ maxPrice: string;
211
+ outcomeIndex: number;
212
+ side: "bid" | "ask";
213
+ }
214
+ interface OrderSimulateResult {
215
+ levels: OrderSimulateLevel[];
216
+ summary: {
217
+ fillSize: string;
218
+ fillCost: string;
219
+ takerFee: string;
220
+ weightedAvgPrice: string;
221
+ totalLiquidityAvailable: string;
222
+ percentFillable: number;
223
+ slippageBps: number;
224
+ };
225
+ collateral: {
226
+ balance: string;
227
+ outcomeTokenBalance: string;
228
+ requiredForFill: string;
229
+ isSufficient: boolean;
230
+ };
231
+ warnings: string[];
232
+ }
233
+ interface OrderSimulateLevel {
234
+ price: string;
235
+ sizeAvailable: string;
236
+ cumulativeSize: string;
237
+ takerFee: string;
238
+ cumulativeTakerFee: string;
239
+ collateralRequired: string;
240
+ cumulativeCollateral: string;
241
+ makerCount: number;
242
+ }
243
+ interface PricePoint {
244
+ time: number;
245
+ price: number;
246
+ [key: string]: unknown;
247
+ }
248
+ interface PriceHistory {
249
+ prices: PricePoint[];
250
+ startTime: number;
251
+ endTime: number;
252
+ interval: number;
253
+ [key: string]: unknown;
254
+ }
255
+ /** @deprecated Use PricePoint instead — API returns {time, price} not OHLCV candles. */
256
+ type Candle = PricePoint;
257
+ type PriceTimeframe = "1h" | "6h" | "1d" | "1w" | "1M" | "all";
258
+ /** @deprecated Use PriceTimeframe — API param is "timeframe" with values 1h|6h|1d|1w|1M|all. */
259
+ type PriceInterval = PriceTimeframe;
260
+ interface OracleResponse {
261
+ oracle: OracleData;
262
+ }
263
+ interface OracleData {
264
+ lastCheckedAt: string | null;
265
+ confidenceLevel: string | null;
266
+ evidenceCollected: {
267
+ postsCount: number;
268
+ relevantPosts: string[];
269
+ };
270
+ sourcesMonitored: string[];
271
+ summary: {
272
+ decision: string;
273
+ shortSummary: string;
274
+ expandedSummary: string;
275
+ };
276
+ [key: string]: unknown;
277
+ }
278
+ interface OracleQuote {
279
+ id: number;
280
+ status: string;
281
+ probability: number | null;
282
+ confidence: "low" | "medium" | "high" | null;
283
+ reasoning: string | null;
284
+ referenceMarketsCount: number;
285
+ createdAt: string;
286
+ completedAt: string | null;
287
+ [key: string]: unknown;
288
+ }
289
+ interface OracleQuotesResponse {
290
+ quotes: OracleQuote[];
291
+ }
292
+ interface OracleQuoteRequestResult {
293
+ id: number;
294
+ status: string;
295
+ createdAt: string;
296
+ }
297
+ interface ActivityItem {
298
+ type: string;
299
+ timestamp: string;
300
+ marketId?: string;
301
+ data?: unknown;
302
+ [key: string]: unknown;
303
+ }
304
+ interface ActivityResponse {
305
+ marketId: string | null;
306
+ activity: ActivityItem[];
307
+ pagination?: {
308
+ cursor: string | null;
309
+ hasMore: boolean;
310
+ };
311
+ }
312
+ interface Portfolio {
313
+ portfolio: Position[];
314
+ marketIds: string[];
315
+ cursor: string | null;
316
+ }
317
+ interface Position {
318
+ tokenAddress: string;
319
+ balance: string;
320
+ settlementBalance: string;
321
+ walletBalance: string;
322
+ outcomeIndex: number;
323
+ outcomeName: string;
324
+ marketId: string;
325
+ netInvestment: string;
326
+ currentValue: string;
327
+ tokensRedeemed: string;
328
+ [key: string]: unknown;
329
+ }
330
+ interface ClaimableResponse {
331
+ positions: ClaimablePosition[];
332
+ markets: ClaimableMarket[];
333
+ totalClaimable: string;
334
+ }
335
+ interface ClaimableMarket {
336
+ id: string;
337
+ outcomeTokens: string[];
338
+ outcomeNames: string[];
339
+ payoutPcts: string[];
340
+ }
341
+ interface ClaimablePosition {
342
+ tokenAddress: string;
343
+ balance: string;
344
+ settlementBalance: string;
345
+ walletBalance: string;
346
+ outcomeIndex: number;
347
+ outcomeName: string | null;
348
+ marketId: string;
349
+ netInvestment: string;
350
+ claimableAmount: string;
351
+ [key: string]: unknown;
352
+ }
353
+ interface PortfolioStats {
354
+ currentPortfolioValue: string;
355
+ currentPortfolioPercentChange: number;
356
+ }
357
+ interface Balance {
358
+ address: Address;
359
+ usdc: UsdcBalance;
360
+ outcomeTokens: OutcomeTokenBalance[];
361
+ [key: string]: unknown;
362
+ }
363
+ interface UsdcBalance {
364
+ tokenAddress: string;
365
+ balance: string;
366
+ settlementBalance: string;
367
+ walletBalance: string;
368
+ }
369
+ interface OutcomeTokenBalance {
370
+ tokenAddress: string;
371
+ marketId: string;
372
+ outcomeIndex: number;
373
+ outcomeName: string;
374
+ balance: string;
375
+ settlementBalance: string;
376
+ walletBalance: string;
377
+ [key: string]: unknown;
378
+ }
379
+ interface TokenBalance {
380
+ balance: string;
381
+ decimals: number;
382
+ symbol: string;
383
+ }
384
+ interface WalletStatus {
385
+ address: Address;
386
+ ethBalance: bigint;
387
+ usdcAllowance: bigint;
388
+ isOperatorApproved: boolean;
389
+ needsApprovals: boolean;
390
+ }
391
+ interface WalletSetupResult {
392
+ usdcApprovalTx: Hex | null;
393
+ operatorApprovalTx: Hex | null;
394
+ }
395
+ interface SearchMarketsParams {
396
+ query?: string;
397
+ status?: "active" | "pending" | "resolved" | "closed";
398
+ sortBy?: "new" | "volume" | "trending" | "ending" | "chance";
399
+ sort?: "asc" | "desc";
400
+ limit?: number;
401
+ cursor?: string;
402
+ visibility?: "visible" | "hidden" | "all";
403
+ resolutionStatus?: string;
404
+ creator?: string;
405
+ category?: string;
406
+ createdAfter?: string;
407
+ }
408
+ type OrderStatus = "open" | "filled" | "cancelled" | "expired" | "voided";
409
+ interface GetOrdersParams {
410
+ trader?: Address;
411
+ marketId?: string;
412
+ status?: OrderStatus;
413
+ cursor?: string;
414
+ limit?: number;
415
+ }
416
+ interface GetRecentOrdersParams {
417
+ trader?: Address;
418
+ marketId?: string;
419
+ status?: OrderStatus;
420
+ limit?: number;
421
+ windowSeconds?: number;
422
+ }
423
+ interface GetOrderbookParams {
424
+ depth?: number;
425
+ outcomeIndex?: number;
426
+ }
427
+ interface GetPriceHistoryParams {
428
+ timeframe?: PriceTimeframe;
429
+ /** @deprecated Use timeframe instead. */
430
+ interval?: PriceTimeframe;
431
+ }
432
+ interface GetActivityParams {
433
+ cursor?: string;
434
+ limit?: number;
435
+ types?: string;
436
+ startTime?: string;
437
+ endTime?: string;
438
+ }
439
+ interface GetPortfolioParams {
440
+ kind?: "all" | "active" | "won" | "lost" | "claimable";
441
+ marketId?: string;
442
+ cursor?: string;
443
+ pageSize?: number;
444
+ }
445
+ interface GaslessOperatorRequest {
446
+ user: Address;
447
+ approved?: boolean;
448
+ nonce: string;
449
+ deadline: string;
450
+ signature: Hex;
451
+ }
452
+ interface GaslessOperatorResult {
453
+ success: true;
454
+ txHash: Hex;
455
+ user: Address;
456
+ operator: Address;
457
+ relayer: Address;
458
+ }
459
+ interface GaslessDepositRequest {
460
+ user: Address;
461
+ amount: string;
462
+ nonce: string;
463
+ deadline: string;
464
+ signature: Hex;
465
+ }
466
+ interface GaslessDepositResult {
467
+ success: true;
468
+ txHash: Hex;
469
+ user: Address;
470
+ token: Address;
471
+ amount: string;
472
+ relayer: Address;
473
+ }
474
+ interface BulkOperation {
475
+ type: "create" | "cancel";
476
+ order?: Record<string, unknown>;
477
+ cancel?: {
478
+ trader: string;
479
+ nonce: string;
480
+ signature: string;
481
+ };
482
+ }
483
+ interface BulkResult {
484
+ results: Array<{
485
+ type: "create";
486
+ success: boolean;
487
+ order: Order;
488
+ } | {
489
+ type: "cancel";
490
+ success: boolean;
491
+ trader: string;
492
+ nonce: string;
493
+ alreadyCancelled: boolean;
494
+ }>;
495
+ }
496
+ interface ContextClientOptions {
497
+ apiKey?: string;
498
+ baseUrl?: string;
499
+ rpcUrl?: string;
500
+ signer?: SignerInput;
501
+ }
502
+ type SignerInput = {
503
+ privateKey: Hex;
504
+ } | {
505
+ account: viem.Account;
506
+ } | {
507
+ walletClient: viem.WalletClient;
508
+ };
509
+
510
+ declare class Markets {
511
+ private readonly http;
512
+ constructor(http: HttpClient);
513
+ list(params?: SearchMarketsParams): Promise<MarketList>;
514
+ get(id: string): Promise<Market>;
515
+ quotes(marketId: string): Promise<Quotes>;
516
+ orderbook(marketId: string, params?: GetOrderbookParams): Promise<Orderbook>;
517
+ fullOrderbook(marketId: string, params?: Omit<GetOrderbookParams, "outcomeIndex">): Promise<FullOrderbook>;
518
+ simulate(marketId: string, params: SimulateTradeParams): Promise<SimulateResult>;
519
+ priceHistory(marketId: string, params?: GetPriceHistoryParams): Promise<PriceHistory>;
520
+ oracle(marketId: string): Promise<OracleResponse>;
521
+ oracleQuotes(marketId: string): Promise<OracleQuotesResponse>;
522
+ requestOracleQuote(marketId: string): Promise<OracleQuoteRequestResult>;
523
+ activity(marketId: string, params?: GetActivityParams): Promise<ActivityResponse>;
524
+ globalActivity(params?: GetActivityParams): Promise<ActivityResponse>;
525
+ }
526
+
527
+ interface SignedOrder {
528
+ type: "limit";
529
+ marketId: Hex;
530
+ trader: Address;
531
+ price: string;
532
+ size: string;
533
+ outcomeIndex: number;
534
+ side: number;
535
+ nonce: Hex;
536
+ expiry: string;
537
+ maxFee: string;
538
+ makerRoleConstraint: number;
539
+ inventoryModeConstraint: number;
540
+ signature: Hex;
541
+ }
542
+ interface SignedMarketOrder {
543
+ type: "market";
544
+ marketId: Hex;
545
+ trader: Address;
546
+ maxPrice: string;
547
+ maxSize: string;
548
+ outcomeIndex: number;
549
+ side: number;
550
+ nonce: Hex;
551
+ expiry: string;
552
+ maxFee: string;
553
+ signature: Hex;
554
+ }
555
+ declare class OrderBuilder {
556
+ private readonly walletClient;
557
+ private readonly account;
558
+ constructor(walletClient: WalletClient, account: Account);
559
+ get address(): Address;
560
+ buildAndSign(req: PlaceOrderRequest): Promise<SignedOrder>;
561
+ buildAndSignMarket(req: PlaceMarketOrderRequest): Promise<SignedMarketOrder>;
562
+ signCancel(nonce: Hex): Promise<Hex>;
563
+ }
564
+
565
+ declare class Orders {
566
+ private readonly http;
567
+ private readonly builder;
568
+ private readonly address;
569
+ constructor(http: HttpClient, builder: OrderBuilder | null, address: Address | null);
570
+ private requireSigner;
571
+ private requireAddress;
572
+ list(params?: GetOrdersParams): Promise<OrderList>;
573
+ listAll(params?: Omit<GetOrdersParams, "cursor">): Promise<Order[]>;
574
+ mine(marketId?: string): Promise<OrderList>;
575
+ allMine(marketId?: string): Promise<Order[]>;
576
+ get(id: string): Promise<Order>;
577
+ recent(params?: GetRecentOrdersParams): Promise<OrderList>;
578
+ simulate(params: OrderSimulateParams): Promise<OrderSimulateResult>;
579
+ create(req: PlaceOrderRequest): Promise<CreateOrderResult>;
580
+ createMarket(req: PlaceMarketOrderRequest): Promise<CreateOrderResult>;
581
+ cancel(nonce: Hex): Promise<CancelResult>;
582
+ cancelReplace(cancelNonce: Hex, newOrder: PlaceOrderRequest): Promise<CancelReplaceResult>;
583
+ bulkCreate(orders: PlaceOrderRequest[]): Promise<CreateOrderResult[]>;
584
+ bulkCancel(nonces: Hex[]): Promise<CancelResult[]>;
585
+ bulk(creates: PlaceOrderRequest[], cancelNonces: Hex[]): Promise<BulkResult>;
586
+ }
587
+
588
+ declare class PortfolioModule {
589
+ private readonly http;
590
+ private readonly defaultAddress;
591
+ constructor(http: HttpClient, defaultAddress: Address | null);
592
+ private resolveAddress;
593
+ get(address?: Address, params?: GetPortfolioParams): Promise<Portfolio>;
594
+ claimable(address?: Address): Promise<ClaimableResponse>;
595
+ stats(address?: Address): Promise<PortfolioStats>;
596
+ balance(address?: Address): Promise<Balance>;
597
+ tokenBalance(address: Address, tokenAddress: Address): Promise<TokenBalance>;
598
+ }
599
+
600
+ declare class AccountModule {
601
+ private readonly http;
602
+ private readonly walletClient;
603
+ private readonly account;
604
+ private readonly publicClient;
605
+ constructor(http: HttpClient, walletClient: WalletClient | null, account: Account | null, rpcUrl?: string);
606
+ private get address();
607
+ private requireWallet;
608
+ private requireAccount;
609
+ status(): Promise<WalletStatus>;
610
+ setup(): Promise<WalletSetupResult>;
611
+ mintTestUsdc(amount?: number): Promise<unknown>;
612
+ deposit(amount: number): Promise<Hex>;
613
+ withdraw(amount: number): Promise<Hex>;
614
+ mintCompleteSets(marketId: string, amount: number): Promise<Hex>;
615
+ burnCompleteSets(marketId: string, amount: number, creditInternal?: boolean): Promise<Hex>;
616
+ gaslessSetup(): Promise<GaslessOperatorResult>;
617
+ gaslessDeposit(amount: number): Promise<GaslessDepositResult>;
618
+ relayOperatorApproval(req: GaslessOperatorRequest): Promise<GaslessOperatorResult>;
619
+ relayDeposit(req: GaslessDepositRequest): Promise<GaslessDepositResult>;
620
+ }
621
+
622
+ /**
623
+ * Unified SDK client for Context prediction markets.
624
+ *
625
+ * Read-only usage (no signer):
626
+ * const ctx = new ContextClient()
627
+ * const markets = await ctx.markets.list()
628
+ *
629
+ * Trading usage (with signer):
630
+ * const ctx = new ContextClient({ apiKey, signer: { privateKey } })
631
+ * const order = await ctx.orders.create({ ... })
632
+ */
633
+ declare class ContextClient {
634
+ readonly markets: Markets;
635
+ readonly orders: Orders;
636
+ readonly portfolio: PortfolioModule;
637
+ readonly account: AccountModule;
638
+ /** The trader's on-chain address, or null if no signer was provided. */
639
+ readonly address: Address | null;
640
+ constructor(options?: ContextClientOptions);
641
+ }
642
+
643
+ declare class ContextApiError extends Error {
644
+ readonly status: number;
645
+ readonly body: unknown;
646
+ constructor(status: number, body: unknown);
647
+ }
648
+ declare class ContextSigningError extends Error {
649
+ constructor(message: string, cause?: unknown);
650
+ }
651
+ declare class ContextConfigError extends Error {
652
+ constructor(message: string);
653
+ }
654
+
655
+ /**
656
+ * Convert price in cents (1-99) to on-chain representation.
657
+ * Example: 25 cents -> 250_000n
658
+ */
659
+ declare function encodePriceCents(priceCents: number): bigint;
660
+ /**
661
+ * Convert size in shares to on-chain representation.
662
+ * Example: 10 shares -> 10_000_000n
663
+ */
664
+ declare function encodeSize(size: number): bigint;
665
+ /**
666
+ * Calculate max fee: 1% of notional, minimum 1n.
667
+ * notional = price x size (in on-chain units)
668
+ */
669
+ declare function calculateMaxFee(price: bigint, size: bigint): bigint;
670
+ /** Decode on-chain price back to cents. */
671
+ declare function decodePriceCents(raw: bigint): number;
672
+ /** Decode on-chain size back to shares. */
673
+ declare function decodeSize(raw: bigint): number;
674
+
675
+ declare const API_BASE = "https://api-testnet.context.markets/v2";
676
+ declare const SETTLEMENT_ADDRESS: Address;
677
+ declare const HOLDINGS_ADDRESS: Address;
678
+ declare const USDC_ADDRESS: Address;
679
+ declare const PERMIT2_ADDRESS: Address;
680
+ declare const CHAIN_ID = 84532;
681
+ declare const HOLDINGS_EIP712_DOMAIN: {
682
+ readonly name: "Holdings";
683
+ readonly version: "1";
684
+ readonly chainId: 84532;
685
+ readonly verifyingContract: `0x${string}`;
686
+ };
687
+ declare const PERMIT2_EIP712_DOMAIN: {
688
+ readonly name: "Permit2";
689
+ readonly chainId: 84532;
690
+ readonly verifyingContract: `0x${string}`;
691
+ };
692
+
693
+ export { API_BASE, type ActivityItem, type ActivityResponse, type Balance, type BulkOperation, type BulkResult, CHAIN_ID, type CancelReplaceResult, type CancelResult, type Candle, type ClaimableMarket, type ClaimablePosition, type ClaimableResponse, ContextApiError, ContextClient, type ContextClientOptions, ContextConfigError, ContextSigningError, type CreateOrderResult, type Fill, type FullOrderbook, type GaslessDepositRequest, type GaslessDepositResult, type GaslessOperatorRequest, type GaslessOperatorResult, type GetActivityParams, type GetOrderbookParams, type GetOrdersParams, type GetPortfolioParams, type GetPriceHistoryParams, type GetRecentOrdersParams, HOLDINGS_ADDRESS, HOLDINGS_EIP712_DOMAIN, type InventoryMode, type MakerRoleConstraint, type Market, type MarketList, type MarketMetadata, type OracleData, type OracleQuote, type OracleQuoteRequestResult, type OracleQuotesResponse, type OracleResponse, type Order, type OrderList, type OrderMarkets, type OrderSimulateLevel, type OrderSimulateParams, type OrderSimulateResult, type OrderStatus, type Orderbook, type OrderbookLevel, type OutcomePrice, type OutcomeTokenBalance, PERMIT2_ADDRESS, PERMIT2_EIP712_DOMAIN, type PlaceMarketOrderRequest, type PlaceOrderRequest, type Portfolio, type PortfolioStats, type Position, type PriceHistory, type PriceInterval, type PricePoint, type PriceTimeframe, type QuoteSide, type Quotes, SETTLEMENT_ADDRESS, type SearchMarketsParams, type SignerInput, type SimulateResult, type SimulateTradeParams, type TokenBalance, USDC_ADDRESS, type UsdcBalance, type WalletSetupResult, type WalletStatus, calculateMaxFee, decodePriceCents, decodeSize, encodePriceCents, encodeSize };