@andy-liquid-labs/lighter-ts-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.
Files changed (85) hide show
  1. package/README.md +381 -0
  2. package/dist/index.d.mts +3686 -0
  3. package/dist/index.d.ts +3686 -0
  4. package/dist/index.js +6168 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/index.mjs +5939 -0
  7. package/dist/index.mjs.map +1 -0
  8. package/package.json +57 -0
  9. package/src/api/exchange/change-account-tier.ts +38 -0
  10. package/src/api/exchange/fastwithdraw.ts +38 -0
  11. package/src/api/exchange/index.ts +7 -0
  12. package/src/api/exchange/notification-ack.ts +36 -0
  13. package/src/api/exchange/send-tx-batch.ts +53 -0
  14. package/src/api/exchange/send-tx.ts +105 -0
  15. package/src/api/exchange/tokens-create.ts +50 -0
  16. package/src/api/exchange/tokens-revoke.ts +38 -0
  17. package/src/api/index.ts +3 -0
  18. package/src/api/info/account-by-l1-address.ts +23 -0
  19. package/src/api/info/account.ts +80 -0
  20. package/src/api/info/announcement.ts +24 -0
  21. package/src/api/info/api-keys.ts +32 -0
  22. package/src/api/info/asset-details.ts +42 -0
  23. package/src/api/info/candles.ts +31 -0
  24. package/src/api/info/exchange-stats.ts +16 -0
  25. package/src/api/info/fastbridge-info.ts +15 -0
  26. package/src/api/info/funding-rates.ts +22 -0
  27. package/src/api/info/fundings.ts +29 -0
  28. package/src/api/info/index.ts +20 -0
  29. package/src/api/info/next-nonce.ts +26 -0
  30. package/src/api/info/order-book-details.ts +125 -0
  31. package/src/api/info/order-books.ts +23 -0
  32. package/src/api/info/recent-trades.ts +24 -0
  33. package/src/api/info/root-info.ts +13 -0
  34. package/src/api/info/root-status.ts +13 -0
  35. package/src/api/info/tx-from-l1-hash.ts +20 -0
  36. package/src/api/info/tx.ts +45 -0
  37. package/src/api/info/txs.ts +19 -0
  38. package/src/api/info/withdrawal-delay.ts +13 -0
  39. package/src/api/info-private/account-active-orders.ts +31 -0
  40. package/src/api/info-private/account-inactive-orders.ts +83 -0
  41. package/src/api/info-private/account-limits.ts +35 -0
  42. package/src/api/info-private/account-metadata.ts +43 -0
  43. package/src/api/info-private/deposit-history.ts +49 -0
  44. package/src/api/info-private/export.ts +41 -0
  45. package/src/api/info-private/fastwithdraw-info.ts +35 -0
  46. package/src/api/info-private/index.ts +18 -0
  47. package/src/api/info-private/l1-metadata.ts +35 -0
  48. package/src/api/info-private/liquidations.ts +96 -0
  49. package/src/api/info-private/pnl.ts +52 -0
  50. package/src/api/info-private/position-funding.ts +54 -0
  51. package/src/api/info-private/public-pools-metadata.ts +46 -0
  52. package/src/api/info-private/referral-points.ts +43 -0
  53. package/src/api/info-private/tokens.ts +44 -0
  54. package/src/api/info-private/trades.ts +66 -0
  55. package/src/api/info-private/transfer-fee-info.ts +37 -0
  56. package/src/api/info-private/transfer-history.ts +54 -0
  57. package/src/api/info-private/withdraw-history.ts +49 -0
  58. package/src/client/clientManager.ts +121 -0
  59. package/src/client/exchange-client.ts +637 -0
  60. package/src/client/http/client.ts +137 -0
  61. package/src/client/http/index.ts +6 -0
  62. package/src/client/http/interface.ts +89 -0
  63. package/src/client/index.ts +11 -0
  64. package/src/client/info-client.ts +383 -0
  65. package/src/client/info-private-client.ts +444 -0
  66. package/src/client/txClient.ts +597 -0
  67. package/src/client/ws-client.ts +457 -0
  68. package/src/crypto/ecgfp5.ts +722 -0
  69. package/src/crypto/goldilocks.ts +136 -0
  70. package/src/crypto/gorand.ts +777 -0
  71. package/src/crypto/index.ts +6 -0
  72. package/src/crypto/poseidon2.ts +365 -0
  73. package/src/crypto/scalar.ts +375 -0
  74. package/src/index.ts +112 -0
  75. package/src/signer/index.ts +5 -0
  76. package/src/signer/keyManager.ts +132 -0
  77. package/src/types/bridge.ts +24 -0
  78. package/src/types/constants.ts +252 -0
  79. package/src/types/errors.ts +168 -0
  80. package/src/types/index.ts +12 -0
  81. package/src/types/requests.ts +197 -0
  82. package/src/types/txInfo.ts +1277 -0
  83. package/src/types/txInfoPools.ts +502 -0
  84. package/src/types/txInfoSerializer.ts +348 -0
  85. package/src/types/ws.ts +407 -0
@@ -0,0 +1,3686 @@
1
+ import { AxiosInstance } from 'axios';
2
+
3
+ /**
4
+ * Minimal HTTP Client interface for Lighter API
5
+ */
6
+ interface MinimalHTTPClient {
7
+ /**
8
+ * Get the next nonce for an account and API key
9
+ */
10
+ getNextNonce(accountIndex: bigint, apiKeyIndex: number): Promise<bigint>;
11
+ /**
12
+ * Get the public key for an account and API key
13
+ */
14
+ getApiKey(accountIndex: bigint, apiKeyIndex: number): Promise<string>;
15
+ /**
16
+ * Get account information by L1 address or account index
17
+ */
18
+ getAccount(by: 'l1_address' | 'account_index', value: string): Promise<LighterAccount[]>;
19
+ }
20
+ interface LighterAsset {
21
+ symbol: string;
22
+ asset_id: number;
23
+ balance: string;
24
+ locked_balance: string;
25
+ }
26
+ interface LighterPosition {
27
+ }
28
+ interface LighterShare {
29
+ }
30
+ interface LighterAccount {
31
+ code: number;
32
+ account_type: number;
33
+ index: number;
34
+ l1_address: string;
35
+ cancel_all_time: number;
36
+ total_order_count: number;
37
+ total_isolated_order_count: number;
38
+ pending_order_count: number;
39
+ available_balance: string;
40
+ status: number;
41
+ collateral: string;
42
+ transaction_time: number;
43
+ account_index: number;
44
+ name: string;
45
+ description: string;
46
+ can_invite: boolean;
47
+ referral_points_percentage: string;
48
+ positions: LighterPosition[];
49
+ assets: LighterAsset[];
50
+ total_asset_value: string;
51
+ cross_asset_value: string;
52
+ shares: LighterShare[];
53
+ }
54
+
55
+ /**
56
+ * HTTP Client implementation for Lighter API
57
+ */
58
+
59
+ /**
60
+ * HTTP Client for Lighter exchange API
61
+ */
62
+ declare class HttpClient implements MinimalHTTPClient {
63
+ private readonly endpoint;
64
+ private readonly timeout;
65
+ constructor(baseUrl: string, timeout?: number);
66
+ /**
67
+ * Make a GET request to the API
68
+ */
69
+ private get;
70
+ /**
71
+ * Get the next nonce for an account and API key
72
+ */
73
+ getNextNonce(accountIndex: bigint, apiKeyIndex: number): Promise<bigint>;
74
+ /**
75
+ * Get the public key for an account and API key
76
+ */
77
+ getApiKey(accountIndex: bigint, apiKeyIndex: number): Promise<string>;
78
+ /**
79
+ * Get account information by L1 address or account index
80
+ */
81
+ getAccount(by: 'l1_address' | 'account_index', value: string): Promise<LighterAccount[]>;
82
+ /**
83
+ * Get account information by L1 address (convenience method)
84
+ */
85
+ getAccountByL1Address(l1Address: string): Promise<LighterAccount[]>;
86
+ /**
87
+ * Get account information by account index (convenience method)
88
+ */
89
+ getAccountByIndex(accountIndex: string): Promise<LighterAccount[]>;
90
+ }
91
+ /**
92
+ * Create a new HTTP client
93
+ */
94
+ declare function newHttpClient(baseUrl: string): MinimalHTTPClient | null;
95
+
96
+ /**
97
+ * ECgFp5 Elliptic Curve Implementation
98
+ *
99
+ * This implements the ECgFp5 curve used in the Lighter protocol for Schnorr signatures.
100
+ * ECgFp5 is an elliptic curve defined over the quintic extension of the Goldilocks field.
101
+ *
102
+ * Key properties:
103
+ * - Prime order (no cofactor) - eliminates small subgroup attacks
104
+ * - Complete addition formulas
105
+ * - Canonical point encoding
106
+ *
107
+ * Reference: https://github.com/pornin/ecgfp5
108
+ */
109
+ declare const SCALAR_ORDER = 1067993516717146951041484916571792702745057740581727230159139685185762082554198619328292418486241n;
110
+ /**
111
+ * GFp5 Element - Quintic extension of Goldilocks field
112
+ * Represents elements as polynomials a0 + a1*x + a2*x^2 + a3*x^3 + a4*x^4 mod (x^5 - 3)
113
+ */
114
+ declare class GFp5Element {
115
+ readonly coeffs: bigint[];
116
+ constructor(coeffs: bigint[]);
117
+ static zero(): GFp5Element;
118
+ static one(): GFp5Element;
119
+ static two(): GFp5Element;
120
+ isZero(): boolean;
121
+ equals(other: GFp5Element): boolean;
122
+ neg(): GFp5Element;
123
+ add(other: GFp5Element): GFp5Element;
124
+ sub(other: GFp5Element): GFp5Element;
125
+ double(): GFp5Element;
126
+ /**
127
+ * Multiply two GFp5 elements
128
+ * Uses the reduction rule: x^5 = 3 (since x^5 - 3 = 0)
129
+ */
130
+ mul(other: GFp5Element): GFp5Element;
131
+ square(): GFp5Element;
132
+ /**
133
+ * Scalar multiplication
134
+ */
135
+ scalarMul(scalar: bigint): GFp5Element;
136
+ /**
137
+ * Compute self^(2^power)
138
+ */
139
+ expPowerOf2(power: number): GFp5Element;
140
+ /**
141
+ * Frobenius endomorphism: x -> x^p
142
+ */
143
+ frobenius(): GFp5Element;
144
+ repeatedFrobenius(count: number): GFp5Element;
145
+ /**
146
+ * Compute multiplicative inverse (or zero if input is zero)
147
+ */
148
+ inverseOrZero(): GFp5Element;
149
+ div(other: GFp5Element): GFp5Element;
150
+ toLittleEndianBytes(): Uint8Array;
151
+ static fromLittleEndianBytes(bytes: Uint8Array): GFp5Element;
152
+ }
153
+ /**
154
+ * ECgFp5 Scalar - Element of the scalar field (mod ORDER)
155
+ */
156
+ declare class ECgFp5Scalar {
157
+ readonly value: bigint;
158
+ constructor(value: bigint);
159
+ static zero(): ECgFp5Scalar;
160
+ static one(): ECgFp5Scalar;
161
+ isCanonical(): boolean;
162
+ equals(other: ECgFp5Scalar): boolean;
163
+ add(other: ECgFp5Scalar): ECgFp5Scalar;
164
+ sub(other: ECgFp5Scalar): ECgFp5Scalar;
165
+ mul(other: ECgFp5Scalar): ECgFp5Scalar;
166
+ toLittleEndianBytes(): Uint8Array;
167
+ static fromLittleEndianBytes(bytes: Uint8Array): ECgFp5Scalar;
168
+ /**
169
+ * Create from big integer (reduces mod ORDER)
170
+ */
171
+ static fromNonCanonicalBigInt(val: bigint): ECgFp5Scalar;
172
+ /**
173
+ * Convert from a GFp5Element to a scalar
174
+ * This is used when converting hash output to a scalar
175
+ * Note: Each coefficient is already reduced mod GOLDILOCKS_MODULUS (< 2^64),
176
+ * so the combined value fits in 320 bits and is then reduced mod SCALAR_ORDER
177
+ */
178
+ static fromGFp5(fp5: GFp5Element): ECgFp5Scalar;
179
+ }
180
+ /**
181
+ * ECgFp5 Point - A point on the ECgFp5 curve
182
+ * Uses fractional (x, z, u, t) coordinates where (x, u) = (x, x/y) = (X/Z, U/T)
183
+ */
184
+ declare class ECgFp5Point {
185
+ readonly x: GFp5Element;
186
+ readonly z: GFp5Element;
187
+ readonly u: GFp5Element;
188
+ readonly t: GFp5Element;
189
+ constructor(x: GFp5Element, z: GFp5Element, u: GFp5Element, t: GFp5Element);
190
+ static neutral(): ECgFp5Point;
191
+ static B(): GFp5Element;
192
+ static B_MUL2(): GFp5Element;
193
+ static B_MUL4(): GFp5Element;
194
+ static generator(): ECgFp5Point;
195
+ isNeutral(): boolean;
196
+ equals(other: ECgFp5Point): boolean;
197
+ /**
198
+ * Encode point to GFp5 element (w = t/u)
199
+ */
200
+ encode(): GFp5Element;
201
+ /**
202
+ * Add two points using complete addition formulas
203
+ * Cost: 10 field multiplications
204
+ */
205
+ add(other: ECgFp5Point): ECgFp5Point;
206
+ /**
207
+ * Double this point
208
+ */
209
+ double(): ECgFp5Point;
210
+ /**
211
+ * Multiply point by scalar using double-and-add
212
+ */
213
+ mul(scalar: ECgFp5Scalar): ECgFp5Point;
214
+ }
215
+ /**
216
+ * Sample a random scalar using cryptographically secure random number generator
217
+ */
218
+ declare function sampleScalar(): ECgFp5Scalar;
219
+ /**
220
+ * Generate public key from private key: pk = sk * G
221
+ */
222
+ declare function schnorrPkFromSk(sk: ECgFp5Scalar): GFp5Element;
223
+ /**
224
+ * Schnorr Signature
225
+ */
226
+ declare class SchnorrSignature {
227
+ readonly s: ECgFp5Scalar;
228
+ readonly e: ECgFp5Scalar;
229
+ constructor(s: ECgFp5Scalar, e: ECgFp5Scalar);
230
+ /**
231
+ * Serialize to bytes: s (40 bytes) || e (40 bytes)
232
+ */
233
+ toBytes(): Uint8Array;
234
+ static fromBytes(bytes: Uint8Array): SchnorrSignature;
235
+ }
236
+ /**
237
+ * Sign a pre-hashed message using Schnorr signature
238
+ * hashedMessage should be a GFp5Element (the output of HashToQuinticExtension)
239
+ *
240
+ * Algorithm:
241
+ * 1. Sample random k
242
+ * 2. Compute r = k * G (commitment)
243
+ * 3. Encode r to get r_encoded (a GFp5 element)
244
+ * 4. Compute e = H(r_encoded || hashedMessage)
245
+ * 5. Compute s = k - e * sk
246
+ * 6. Return (s, e)
247
+ */
248
+ declare function schnorrSignHashedMessage(hashedMessage: GFp5Element, sk: ECgFp5Scalar): SchnorrSignature;
249
+ /**
250
+ * Sign a pre-hashed message using Schnorr signature with deterministic k (for testing)
251
+ * WARNING: Only for testing! Using a fixed k in production is insecure.
252
+ */
253
+ declare function schnorrSignHashedMessageDeterministic(hashedMessage: GFp5Element, sk: ECgFp5Scalar, k: ECgFp5Scalar): SchnorrSignature;
254
+
255
+ /**
256
+ * Key Manager for Lighter protocol
257
+ * Handles key generation and signing using the Schnorr signature scheme over ECgFp5
258
+ */
259
+
260
+ /**
261
+ * Signer interface
262
+ */
263
+ interface Signer {
264
+ sign(hashedMessage: Uint8Array): Uint8Array;
265
+ }
266
+ /**
267
+ * Key Manager interface
268
+ */
269
+ interface KeyManager extends Signer {
270
+ pubKey(): GFp5Element;
271
+ pubKeyBytes(): Uint8Array;
272
+ prvKeyBytes(): Uint8Array;
273
+ }
274
+ /**
275
+ * Create a new KeyManager from private key bytes
276
+ */
277
+ declare function newKeyManager(privateKeyBytes: Uint8Array): KeyManager;
278
+ /**
279
+ * Generate a new API key pair
280
+ * Returns [privateKey, publicKey] as hex strings
281
+ */
282
+ declare function generateApiKey(seed?: string): Promise<[string, string]>;
283
+ /**
284
+ * Convert bytes to hex string
285
+ */
286
+ declare function bytesToHex(bytes: Uint8Array): string;
287
+ /**
288
+ * Convert hex string to bytes
289
+ */
290
+ declare function hexToBytes(hex: string): Uint8Array;
291
+
292
+ /**
293
+ * Transaction Types
294
+ */
295
+ declare const TxType: {
296
+ readonly Empty: 0;
297
+ readonly L1Deposit: 1;
298
+ readonly L1ChangePubKey: 2;
299
+ readonly L1CreateMarket: 3;
300
+ readonly L1UpdateMarket: 4;
301
+ readonly L1CancelAllOrders: 5;
302
+ readonly L1Withdraw: 6;
303
+ readonly L1CreateOrder: 7;
304
+ readonly L2ChangePubKey: 8;
305
+ readonly L2CreateSubAccount: 9;
306
+ readonly L2CreatePublicPool: 10;
307
+ readonly L2UpdatePublicPool: 11;
308
+ readonly L2Transfer: 12;
309
+ readonly L2Withdraw: 13;
310
+ readonly L2CreateOrder: 14;
311
+ readonly L2CancelOrder: 15;
312
+ readonly L2CancelAllOrders: 16;
313
+ readonly L2ModifyOrder: 17;
314
+ readonly L2MintShares: 18;
315
+ readonly L2BurnShares: 19;
316
+ readonly L2UpdateLeverage: 20;
317
+ readonly InternalClaimOrder: 21;
318
+ readonly InternalCancelOrder: 22;
319
+ readonly InternalDeleverage: 23;
320
+ readonly InternalExitPosition: 24;
321
+ readonly InternalCancelAllOrders: 25;
322
+ readonly InternalLiquidatePosition: 26;
323
+ readonly InternalCreateOrder: 27;
324
+ readonly L2CreateGroupedOrders: 28;
325
+ readonly L2UpdateMargin: 29;
326
+ readonly L1BurnShares: 30;
327
+ };
328
+ type TxTypeValue = (typeof TxType)[keyof typeof TxType];
329
+ /**
330
+ * Order Types
331
+ */
332
+ declare const OrderType: {
333
+ readonly Limit: 0;
334
+ readonly Market: 1;
335
+ readonly StopLoss: 2;
336
+ readonly StopLossLimit: 3;
337
+ readonly TakeProfit: 4;
338
+ readonly TakeProfitLimit: 5;
339
+ readonly TWAP: 6;
340
+ readonly TWAPSub: 7;
341
+ readonly Liquidation: 8;
342
+ };
343
+ type OrderTypeValue = (typeof OrderType)[keyof typeof OrderType];
344
+ declare const ApiMaxOrderType: 6;
345
+ /**
346
+ * Order Time-In-Force
347
+ */
348
+ declare const TimeInForce: {
349
+ readonly ImmediateOrCancel: 0;
350
+ readonly GoodTillTime: 1;
351
+ readonly PostOnly: 2;
352
+ };
353
+ type TimeInForceValue = (typeof TimeInForce)[keyof typeof TimeInForce];
354
+ /**
355
+ * Grouping Types
356
+ */
357
+ declare const GroupingType: {
358
+ readonly None: 0;
359
+ readonly OneTriggersTheOther: 1;
360
+ readonly OneCancelsTheOther: 2;
361
+ readonly OneTriggersAOneCancelsTheOther: 3;
362
+ };
363
+ type GroupingTypeValue = (typeof GroupingType)[keyof typeof GroupingType];
364
+ /**
365
+ * Cancel All Orders Time-In-Force
366
+ */
367
+ declare const CancelAllTimeInForce: {
368
+ readonly Immediate: 0;
369
+ readonly Scheduled: 1;
370
+ readonly AbortScheduled: 2;
371
+ };
372
+ type CancelAllTimeInForceValue = (typeof CancelAllTimeInForce)[keyof typeof CancelAllTimeInForce];
373
+ /**
374
+ * Asset Margin Mode
375
+ */
376
+ declare const AssetMarginMode: {
377
+ readonly Disabled: 0;
378
+ readonly Enabled: 1;
379
+ };
380
+ type AssetMarginModeValue = (typeof AssetMarginMode)[keyof typeof AssetMarginMode];
381
+ /**
382
+ * Asset Route Type
383
+ */
384
+ declare const AssetRouteType: {
385
+ readonly Perps: 0;
386
+ readonly Spot: 1;
387
+ };
388
+ type AssetRouteTypeValue = (typeof AssetRouteType)[keyof typeof AssetRouteType];
389
+ /**
390
+ * Position Margin Mode
391
+ */
392
+ declare const MarginMode: {
393
+ readonly Cross: 0;
394
+ readonly Isolated: 1;
395
+ };
396
+ type MarginModeValue = (typeof MarginMode)[keyof typeof MarginMode];
397
+ /**
398
+ * Margin Update Direction
399
+ */
400
+ declare const MarginDirection: {
401
+ readonly Remove: 0;
402
+ readonly Add: 1;
403
+ };
404
+ type MarginDirectionValue = (typeof MarginDirection)[keyof typeof MarginDirection];
405
+ /**
406
+ * Numeric Constants
407
+ */
408
+ declare const ONE_USDC = 1000000n;
409
+ declare const FEE_TICK = 1000000n;
410
+ declare const MARGIN_FRACTION_TICK = 10000n;
411
+ declare const SHARE_TICK = 10000;
412
+ declare const MIN_ACCOUNT_INDEX = 0n;
413
+ declare const MAX_ACCOUNT_INDEX = 281474976710654n;
414
+ declare const MAX_MASTER_ACCOUNT_INDEX = 140737488355327n;
415
+ declare const MIN_SUB_ACCOUNT_INDEX = 140737488355328n;
416
+ declare const MIN_API_KEY_INDEX = 0;
417
+ declare const MAX_API_KEY_INDEX = 254;
418
+ declare const NIL_API_KEY_INDEX = 255;
419
+ declare const MIN_MARKET_INDEX = 0;
420
+ declare const MIN_PERPS_MARKET_INDEX = 0;
421
+ declare const MAX_PERPS_MARKET_INDEX = 254;
422
+ declare const NIL_MARKET_INDEX = 255;
423
+ declare const MIN_SPOT_MARKET_INDEX = 2048;
424
+ declare const MAX_SPOT_MARKET_INDEX = 4094;
425
+ declare const NATIVE_ASSET_INDEX = 1;
426
+ declare const USDC_ASSET_INDEX = 3;
427
+ declare const MIN_ASSET_INDEX = 1;
428
+ declare const MAX_ASSET_INDEX = 62;
429
+ declare const NIL_ASSET_INDEX = 0;
430
+ declare const MAX_INVESTED_PUBLIC_POOL_COUNT = 16n;
431
+ declare const INITIAL_POOL_SHARE_VALUE = 1000n;
432
+ declare const MIN_INITIAL_TOTAL_SHARES: bigint;
433
+ declare const MAX_INITIAL_TOTAL_SHARES: bigint;
434
+ declare const MAX_POOL_SHARES: bigint;
435
+ declare const MAX_BURNT_SHARE_USDC_VALUE: bigint;
436
+ declare const MAX_POOL_ENTRY_USDC: bigint;
437
+ declare const MIN_POOL_SHARES_TO_MINT_OR_BURN = 1n;
438
+ declare const MAX_POOL_SHARES_TO_MINT_OR_BURN: bigint;
439
+ declare const MIN_NONCE = 0n;
440
+ declare const MIN_ORDER_NONCE = 0n;
441
+ declare const MAX_ORDER_NONCE: bigint;
442
+ declare const NIL_CLIENT_ORDER_INDEX = 0n;
443
+ declare const NIL_ORDER_INDEX = 0n;
444
+ declare const MIN_CLIENT_ORDER_INDEX = 1n;
445
+ declare const MAX_CLIENT_ORDER_INDEX: bigint;
446
+ declare const MIN_ORDER_INDEX: bigint;
447
+ declare const MAX_ORDER_INDEX: bigint;
448
+ declare const MIN_ORDER_BASE_AMOUNT = 1n;
449
+ declare const MAX_ORDER_BASE_AMOUNT: bigint;
450
+ declare const NIL_ORDER_BASE_AMOUNT = 0n;
451
+ declare const NIL_ORDER_PRICE = 0;
452
+ declare const MIN_ORDER_PRICE = 1;
453
+ declare const MAX_ORDER_PRICE = 4294967295;
454
+ declare const MIN_ORDER_CANCEL_ALL_PERIOD: number;
455
+ declare const MAX_ORDER_CANCEL_ALL_PERIOD: number;
456
+ declare const NIL_ORDER_EXPIRY = 0n;
457
+ declare const MIN_ORDER_EXPIRY = 1n;
458
+ declare const MAX_ORDER_EXPIRY: bigint;
459
+ declare const MIN_ORDER_EXPIRY_PERIOD: number;
460
+ declare const MAX_ORDER_EXPIRY_PERIOD: number;
461
+ declare const NIL_ORDER_TRIGGER_PRICE = 0;
462
+ declare const MIN_ORDER_TRIGGER_PRICE = 1;
463
+ declare const MAX_ORDER_TRIGGER_PRICE = 4294967295;
464
+ declare const MAX_GROUPED_ORDER_COUNT = 4;
465
+ declare const MIN_TRANSFER_AMOUNT = 0n;
466
+ declare const MAX_TRANSFER_AMOUNT: bigint;
467
+ declare const MAX_TRANSFER_FEE: bigint;
468
+ declare const MIN_WITHDRAWAL_AMOUNT = 1n;
469
+ declare const MAX_WITHDRAWAL_AMOUNT: bigint;
470
+ declare const MIN_USDC_AMOUNT = 0n;
471
+ declare const MAX_USDC_AMOUNT: bigint;
472
+ declare const MIN_TIMESTAMP = 0n;
473
+ declare const MAX_TIMESTAMP: bigint;
474
+ declare const DEFAULT_EXPIRE_TIME_MS: number;
475
+ declare const FETCH_NONCE_FROM_SERVER = -1n;
476
+
477
+ /**
478
+ * Validation errors for transactions
479
+ */
480
+ declare class ValidationError extends Error {
481
+ constructor(message: string);
482
+ }
483
+ declare const ErrAccountIndexTooLow: ValidationError;
484
+ declare const ErrAccountIndexTooHigh: ValidationError;
485
+ declare const ErrFromAccountIndexTooLow: ValidationError;
486
+ declare const ErrFromAccountIndexTooHigh: ValidationError;
487
+ declare const ErrToAccountIndexTooLow: ValidationError;
488
+ declare const ErrToAccountIndexTooHigh: ValidationError;
489
+ declare const ErrApiKeyIndexTooLow: ValidationError;
490
+ declare const ErrApiKeyIndexTooHigh: ValidationError;
491
+ declare const ErrInvalidMarketIndex: ValidationError;
492
+ declare const ErrAssetIndexTooLow: ValidationError;
493
+ declare const ErrAssetIndexTooHigh: ValidationError;
494
+ declare const ErrRouteTypeInvalid: ValidationError;
495
+ declare const ErrClientOrderIndexTooLow: ValidationError;
496
+ declare const ErrClientOrderIndexTooHigh: ValidationError;
497
+ declare const ErrOrderIndexTooLow: ValidationError;
498
+ declare const ErrOrderIndexTooHigh: ValidationError;
499
+ declare const ErrBaseAmountTooLow: ValidationError;
500
+ declare const ErrBaseAmountTooHigh: ValidationError;
501
+ declare const ErrPriceTooLow: ValidationError;
502
+ declare const ErrPriceTooHigh: ValidationError;
503
+ declare const ErrIsAskInvalid: ValidationError;
504
+ declare const ErrOrderTypeInvalid: ValidationError;
505
+ declare const ErrOrderTimeInForceInvalid: ValidationError;
506
+ declare const ErrOrderReduceOnlyInvalid: ValidationError;
507
+ declare const ErrOrderExpiryInvalid: ValidationError;
508
+ declare const ErrOrderTriggerPriceInvalid: ValidationError;
509
+ declare const ErrNonceTooLow: ValidationError;
510
+ declare const ErrExpiredAtInvalid: ValidationError;
511
+ declare const ErrTransferAmountTooLow: ValidationError;
512
+ declare const ErrTransferAmountTooHigh: ValidationError;
513
+ declare const ErrTransferFeeNegative: ValidationError;
514
+ declare const ErrTransferFeeTooHigh: ValidationError;
515
+ declare const ErrWithdrawalAmountTooLow: ValidationError;
516
+ declare const ErrWithdrawalAmountTooHigh: ValidationError;
517
+ declare const ErrUSDCAmountTooLow: ValidationError;
518
+ declare const ErrUSDCAmountTooHigh: ValidationError;
519
+ declare const ErrInvalidPublicKeyLength: ValidationError;
520
+ declare const ErrMarginModeInvalid: ValidationError;
521
+ declare const ErrMarginDirectionInvalid: ValidationError;
522
+ declare const ErrPublicPoolIndexTooLow: ValidationError;
523
+ declare const ErrShareAmountTooLow: ValidationError;
524
+ declare const ErrShareAmountTooHigh: ValidationError;
525
+ declare const ErrOperatorFeeTooLow: ValidationError;
526
+ declare const ErrOperatorFeeTooHigh: ValidationError;
527
+ declare const ErrInitialTotalSharesTooLow: ValidationError;
528
+ declare const ErrInitialTotalSharesTooHigh: ValidationError;
529
+ declare const ErrMinOperatorShareRateTooHigh: ValidationError;
530
+ declare const ErrCancelAllTimeInForceInvalid: ValidationError;
531
+ declare const ErrCancelAllTimeTooLow: ValidationError;
532
+ declare const ErrCancelAllTimeTooHigh: ValidationError;
533
+ declare const ErrGroupingTypeInvalid: ValidationError;
534
+ declare const ErrTooManyGroupedOrders: ValidationError;
535
+ declare const ErrNoOrdersInGroup: ValidationError;
536
+
537
+ /**
538
+ * Transaction options for signing transactions
539
+ */
540
+ interface TransactOpts {
541
+ /** Account index for the transaction */
542
+ fromAccountIndex?: bigint;
543
+ /** API key index */
544
+ apiKeyIndex?: number;
545
+ /** Transaction expiry timestamp in milliseconds */
546
+ expiredAt?: bigint;
547
+ /** Nonce for the transaction. If -1 or undefined, will be fetched from server */
548
+ nonce?: bigint;
549
+ /** If true, transaction won't be submitted */
550
+ dryRun?: boolean;
551
+ }
552
+ /**
553
+ * Change public key request
554
+ */
555
+ interface ChangePubKeyReq {
556
+ /** New public key (40 bytes) */
557
+ pubKey: Uint8Array;
558
+ }
559
+ /**
560
+ * Transfer request
561
+ */
562
+ interface TransferTxReq {
563
+ /** Destination account index */
564
+ toAccountIndex: bigint;
565
+ /** Asset index */
566
+ assetIndex: number;
567
+ /** Source route type (0=Perps, 1=Spot) */
568
+ fromRouteType: number;
569
+ /** Destination route type (0=Perps, 1=Spot) */
570
+ toRouteType: number;
571
+ /** Amount to transfer */
572
+ amount: bigint;
573
+ /** USDC fee */
574
+ usdcFee: bigint;
575
+ /** Memo (32 bytes) */
576
+ memo: Uint8Array;
577
+ }
578
+ /**
579
+ * Withdraw request
580
+ */
581
+ interface WithdrawTxReq {
582
+ /** Asset index */
583
+ assetIndex: number;
584
+ /** Route type (0=Perps, 1=Spot) */
585
+ routeType: number;
586
+ /** Amount to withdraw */
587
+ amount: bigint;
588
+ }
589
+ /**
590
+ * Create order request
591
+ */
592
+ interface CreateOrderTxReq {
593
+ /** Market index */
594
+ marketIndex: number;
595
+ /** Client order index */
596
+ clientOrderIndex: bigint;
597
+ /** Base amount */
598
+ baseAmount: bigint;
599
+ /** Price */
600
+ price: number;
601
+ /** Is ask order (1=ask, 0=bid) */
602
+ isAsk: number;
603
+ /** Order type */
604
+ type: number;
605
+ /** Time in force */
606
+ timeInForce: number;
607
+ /** Reduce only flag */
608
+ reduceOnly: number;
609
+ /** Trigger price for stop/take profit orders */
610
+ triggerPrice: number;
611
+ /** Order expiry timestamp */
612
+ orderExpiry: bigint;
613
+ }
614
+ /**
615
+ * Create grouped orders request
616
+ */
617
+ interface CreateGroupedOrdersTxReq {
618
+ /** Grouping type */
619
+ groupingType: number;
620
+ /** Orders to create */
621
+ orders: CreateOrderTxReq[];
622
+ }
623
+ /**
624
+ * Modify order request
625
+ */
626
+ interface ModifyOrderTxReq {
627
+ /** Market index */
628
+ marketIndex: number;
629
+ /** Order index to modify */
630
+ index: bigint;
631
+ /** New base amount */
632
+ baseAmount: bigint;
633
+ /** New price */
634
+ price: number;
635
+ /** New trigger price */
636
+ triggerPrice: number;
637
+ }
638
+ /**
639
+ * Cancel order request
640
+ */
641
+ interface CancelOrderTxReq {
642
+ /** Market index */
643
+ marketIndex: number;
644
+ /** Order index or client order index to cancel */
645
+ index: bigint;
646
+ }
647
+ /**
648
+ * Cancel all orders request
649
+ */
650
+ interface CancelAllOrdersTxReq {
651
+ /** Time in force (0=Immediate, 1=Scheduled, 2=AbortScheduled) */
652
+ timeInForce: number;
653
+ /** Time for scheduled cancel */
654
+ time: bigint;
655
+ }
656
+ /**
657
+ * Create public pool request
658
+ */
659
+ interface CreatePublicPoolTxReq {
660
+ /** Operator fee */
661
+ operatorFee: bigint;
662
+ /** Initial total shares */
663
+ initialTotalShares: bigint;
664
+ /** Minimum operator share rate */
665
+ minOperatorShareRate: number;
666
+ }
667
+ /**
668
+ * Update public pool request
669
+ */
670
+ interface UpdatePublicPoolTxReq {
671
+ /** Public pool index */
672
+ publicPoolIndex: bigint;
673
+ /** Pool status */
674
+ status: number;
675
+ /** Operator fee */
676
+ operatorFee: bigint;
677
+ /** Minimum operator share rate */
678
+ minOperatorShareRate: number;
679
+ }
680
+ /**
681
+ * Mint shares request
682
+ */
683
+ interface MintSharesTxReq {
684
+ /** Public pool index */
685
+ publicPoolIndex: bigint;
686
+ /** Share amount */
687
+ shareAmount: bigint;
688
+ }
689
+ /**
690
+ * Burn shares request
691
+ */
692
+ interface BurnSharesTxReq {
693
+ /** Public pool index */
694
+ publicPoolIndex: bigint;
695
+ /** Share amount */
696
+ shareAmount: bigint;
697
+ }
698
+ /**
699
+ * Update leverage request
700
+ */
701
+ interface UpdateLeverageTxReq {
702
+ /** Market index */
703
+ marketIndex: number;
704
+ /** Initial margin fraction */
705
+ initialMarginFraction: number;
706
+ /** Margin mode (0=Cross, 1=Isolated) */
707
+ marginMode: number;
708
+ }
709
+ /**
710
+ * Update margin request
711
+ */
712
+ interface UpdateMarginTxReq {
713
+ /** Market index */
714
+ marketIndex: number;
715
+ /** USDC amount */
716
+ usdcAmount: bigint;
717
+ /** Direction (0=Remove, 1=Add) */
718
+ direction: number;
719
+ }
720
+
721
+ /**
722
+ * Transaction Info types with validation and hashing
723
+ */
724
+ /**
725
+ * Base interface for transaction info
726
+ */
727
+ interface TxInfo {
728
+ getTxType(): number;
729
+ validate(): void;
730
+ hash(chainId: number): Uint8Array;
731
+ signature?: Uint8Array;
732
+ signedHash?: string;
733
+ }
734
+ /**
735
+ * Order Info structure
736
+ */
737
+ interface OrderInfo {
738
+ marketIndex: number;
739
+ clientOrderIndex: bigint;
740
+ baseAmount: bigint;
741
+ price: number;
742
+ isAsk: number;
743
+ type: number;
744
+ timeInForce: number;
745
+ reduceOnly: number;
746
+ triggerPrice: number;
747
+ orderExpiry: bigint;
748
+ }
749
+ /**
750
+ * L2 Create Order Transaction Info
751
+ */
752
+ declare class L2CreateOrderTxInfo implements TxInfo {
753
+ accountIndex: bigint;
754
+ apiKeyIndex: number;
755
+ orderInfo: OrderInfo;
756
+ expiredAt: bigint;
757
+ nonce: bigint;
758
+ signature?: Uint8Array;
759
+ signedHash?: string;
760
+ constructor(params: {
761
+ accountIndex: bigint;
762
+ apiKeyIndex: number;
763
+ orderInfo: OrderInfo;
764
+ expiredAt: bigint;
765
+ nonce: bigint;
766
+ });
767
+ getTxType(): number;
768
+ validate(): void;
769
+ private validateOrderType;
770
+ hash(chainId: number): Uint8Array;
771
+ }
772
+ /**
773
+ * L2 Cancel Order Transaction Info
774
+ */
775
+ declare class L2CancelOrderTxInfo implements TxInfo {
776
+ accountIndex: bigint;
777
+ apiKeyIndex: number;
778
+ marketIndex: number;
779
+ index: bigint;
780
+ expiredAt: bigint;
781
+ nonce: bigint;
782
+ signature?: Uint8Array;
783
+ signedHash?: string;
784
+ constructor(params: {
785
+ accountIndex: bigint;
786
+ apiKeyIndex: number;
787
+ marketIndex: number;
788
+ index: bigint;
789
+ expiredAt: bigint;
790
+ nonce: bigint;
791
+ });
792
+ getTxType(): number;
793
+ validate(): void;
794
+ hash(chainId: number): Uint8Array;
795
+ }
796
+ /**
797
+ * L2 Modify Order Transaction Info
798
+ */
799
+ declare class L2ModifyOrderTxInfo implements TxInfo {
800
+ accountIndex: bigint;
801
+ apiKeyIndex: number;
802
+ marketIndex: number;
803
+ index: bigint;
804
+ baseAmount: bigint;
805
+ price: number;
806
+ triggerPrice: number;
807
+ expiredAt: bigint;
808
+ nonce: bigint;
809
+ signature?: Uint8Array;
810
+ signedHash?: string;
811
+ constructor(params: {
812
+ accountIndex: bigint;
813
+ apiKeyIndex: number;
814
+ marketIndex: number;
815
+ index: bigint;
816
+ baseAmount: bigint;
817
+ price: number;
818
+ triggerPrice: number;
819
+ expiredAt: bigint;
820
+ nonce: bigint;
821
+ });
822
+ getTxType(): number;
823
+ validate(): void;
824
+ hash(chainId: number): Uint8Array;
825
+ }
826
+ /**
827
+ * L2 Cancel All Orders Transaction Info
828
+ */
829
+ declare class L2CancelAllOrdersTxInfo implements TxInfo {
830
+ accountIndex: bigint;
831
+ apiKeyIndex: number;
832
+ timeInForce: number;
833
+ time: bigint;
834
+ expiredAt: bigint;
835
+ nonce: bigint;
836
+ signature?: Uint8Array;
837
+ signedHash?: string;
838
+ constructor(params: {
839
+ accountIndex: bigint;
840
+ apiKeyIndex: number;
841
+ timeInForce: number;
842
+ time: bigint;
843
+ expiredAt: bigint;
844
+ nonce: bigint;
845
+ });
846
+ getTxType(): number;
847
+ validate(): void;
848
+ hash(chainId: number): Uint8Array;
849
+ }
850
+ /**
851
+ * L2 Withdraw Transaction Info
852
+ */
853
+ declare class L2WithdrawTxInfo implements TxInfo {
854
+ fromAccountIndex: bigint;
855
+ apiKeyIndex: number;
856
+ assetIndex: number;
857
+ routeType: number;
858
+ amount: bigint;
859
+ expiredAt: bigint;
860
+ nonce: bigint;
861
+ signature?: Uint8Array;
862
+ signedHash?: string;
863
+ constructor(params: {
864
+ fromAccountIndex: bigint;
865
+ apiKeyIndex: number;
866
+ assetIndex: number;
867
+ routeType: number;
868
+ amount: bigint;
869
+ expiredAt: bigint;
870
+ nonce: bigint;
871
+ });
872
+ getTxType(): number;
873
+ validate(): void;
874
+ hash(chainId: number): Uint8Array;
875
+ }
876
+ /**
877
+ * L2 Transfer Transaction Info
878
+ */
879
+ declare class L2TransferTxInfo implements TxInfo {
880
+ fromAccountIndex: bigint;
881
+ apiKeyIndex: number;
882
+ toAccountIndex: bigint;
883
+ assetIndex: number;
884
+ fromRouteType: number;
885
+ toRouteType: number;
886
+ amount: bigint;
887
+ usdcFee: bigint;
888
+ memo: Uint8Array;
889
+ expiredAt: bigint;
890
+ nonce: bigint;
891
+ l1Sig?: string;
892
+ signature?: Uint8Array;
893
+ signedHash?: string;
894
+ constructor(params: {
895
+ fromAccountIndex: bigint;
896
+ apiKeyIndex: number;
897
+ toAccountIndex: bigint;
898
+ assetIndex: number;
899
+ fromRouteType: number;
900
+ toRouteType: number;
901
+ amount: bigint;
902
+ usdcFee: bigint;
903
+ memo: Uint8Array;
904
+ expiredAt: bigint;
905
+ nonce: bigint;
906
+ l1Sig?: string;
907
+ });
908
+ getTxType(): number;
909
+ validate(): void;
910
+ hash(chainId: number): Uint8Array;
911
+ /**
912
+ * Get L1 signature body for this transfer transaction
913
+ * Used for calculating L1 address from signature
914
+ */
915
+ getL1SignatureBody(chainId: number): string;
916
+ }
917
+ /**
918
+ * L2 Change Pub Key Transaction Info
919
+ */
920
+ declare class L2ChangePubKeyTxInfo implements TxInfo {
921
+ accountIndex: bigint;
922
+ apiKeyIndex: number;
923
+ pubKey: Uint8Array;
924
+ expiredAt: bigint;
925
+ nonce: bigint;
926
+ l1Sig?: string;
927
+ signature?: Uint8Array;
928
+ signedHash?: string;
929
+ constructor(params: {
930
+ accountIndex: bigint;
931
+ apiKeyIndex: number;
932
+ pubKey: Uint8Array;
933
+ expiredAt: bigint;
934
+ nonce: bigint;
935
+ l1Sig?: string;
936
+ });
937
+ getTxType(): number;
938
+ validate(): void;
939
+ hash(chainId: number): Uint8Array;
940
+ /**
941
+ * Get L1 signature body for this change pub key transaction
942
+ * Used for calculating L1 address from signature
943
+ */
944
+ getL1SignatureBody(): string;
945
+ }
946
+ /**
947
+ * L2 Create Sub Account Transaction Info
948
+ */
949
+ declare class L2CreateSubAccountTxInfo implements TxInfo {
950
+ accountIndex: bigint;
951
+ apiKeyIndex: number;
952
+ expiredAt: bigint;
953
+ nonce: bigint;
954
+ signature?: Uint8Array;
955
+ signedHash?: string;
956
+ constructor(params: {
957
+ accountIndex: bigint;
958
+ apiKeyIndex: number;
959
+ expiredAt: bigint;
960
+ nonce: bigint;
961
+ });
962
+ getTxType(): number;
963
+ validate(): void;
964
+ hash(chainId: number): Uint8Array;
965
+ }
966
+ /**
967
+ * L2 Update Leverage Transaction Info
968
+ */
969
+ declare class L2UpdateLeverageTxInfo implements TxInfo {
970
+ accountIndex: bigint;
971
+ apiKeyIndex: number;
972
+ marketIndex: number;
973
+ initialMarginFraction: number;
974
+ marginMode: number;
975
+ expiredAt: bigint;
976
+ nonce: bigint;
977
+ signature?: Uint8Array;
978
+ signedHash?: string;
979
+ constructor(params: {
980
+ accountIndex: bigint;
981
+ apiKeyIndex: number;
982
+ marketIndex: number;
983
+ initialMarginFraction: number;
984
+ marginMode: number;
985
+ expiredAt: bigint;
986
+ nonce: bigint;
987
+ });
988
+ getTxType(): number;
989
+ validate(): void;
990
+ hash(chainId: number): Uint8Array;
991
+ }
992
+ /**
993
+ * L2 Update Margin Transaction Info
994
+ */
995
+ declare class L2UpdateMarginTxInfo implements TxInfo {
996
+ accountIndex: bigint;
997
+ apiKeyIndex: number;
998
+ marketIndex: number;
999
+ usdcAmount: bigint;
1000
+ direction: number;
1001
+ expiredAt: bigint;
1002
+ nonce: bigint;
1003
+ signature?: Uint8Array;
1004
+ signedHash?: string;
1005
+ constructor(params: {
1006
+ accountIndex: bigint;
1007
+ apiKeyIndex: number;
1008
+ marketIndex: number;
1009
+ usdcAmount: bigint;
1010
+ direction: number;
1011
+ expiredAt: bigint;
1012
+ nonce: bigint;
1013
+ });
1014
+ getTxType(): number;
1015
+ validate(): void;
1016
+ hash(chainId: number): Uint8Array;
1017
+ }
1018
+
1019
+ /**
1020
+ * Additional Transaction Info types for pools and grouped orders
1021
+ */
1022
+
1023
+ /**
1024
+ * L2 Create Grouped Orders Transaction Info
1025
+ */
1026
+ declare class L2CreateGroupedOrdersTxInfo implements TxInfo {
1027
+ accountIndex: bigint;
1028
+ apiKeyIndex: number;
1029
+ groupingType: number;
1030
+ orders: OrderInfo[];
1031
+ expiredAt: bigint;
1032
+ nonce: bigint;
1033
+ signature?: Uint8Array;
1034
+ signedHash?: string;
1035
+ constructor(params: {
1036
+ accountIndex: bigint;
1037
+ apiKeyIndex: number;
1038
+ groupingType: number;
1039
+ orders: OrderInfo[];
1040
+ expiredAt: bigint;
1041
+ nonce: bigint;
1042
+ });
1043
+ getTxType(): number;
1044
+ validate(): void;
1045
+ hash(chainId: number): Uint8Array;
1046
+ }
1047
+ /**
1048
+ * L2 Create Public Pool Transaction Info
1049
+ */
1050
+ declare class L2CreatePublicPoolTxInfo implements TxInfo {
1051
+ accountIndex: bigint;
1052
+ apiKeyIndex: number;
1053
+ operatorFee: bigint;
1054
+ initialTotalShares: bigint;
1055
+ minOperatorShareRate: number;
1056
+ expiredAt: bigint;
1057
+ nonce: bigint;
1058
+ signature?: Uint8Array;
1059
+ signedHash?: string;
1060
+ constructor(params: {
1061
+ accountIndex: bigint;
1062
+ apiKeyIndex: number;
1063
+ operatorFee: bigint;
1064
+ initialTotalShares: bigint;
1065
+ minOperatorShareRate: number;
1066
+ expiredAt: bigint;
1067
+ nonce: bigint;
1068
+ });
1069
+ getTxType(): number;
1070
+ validate(): void;
1071
+ hash(chainId: number): Uint8Array;
1072
+ }
1073
+ /**
1074
+ * L2 Update Public Pool Transaction Info
1075
+ */
1076
+ declare class L2UpdatePublicPoolTxInfo implements TxInfo {
1077
+ accountIndex: bigint;
1078
+ apiKeyIndex: number;
1079
+ publicPoolIndex: bigint;
1080
+ status: number;
1081
+ operatorFee: bigint;
1082
+ minOperatorShareRate: number;
1083
+ expiredAt: bigint;
1084
+ nonce: bigint;
1085
+ signature?: Uint8Array;
1086
+ signedHash?: string;
1087
+ constructor(params: {
1088
+ accountIndex: bigint;
1089
+ apiKeyIndex: number;
1090
+ publicPoolIndex: bigint;
1091
+ status: number;
1092
+ operatorFee: bigint;
1093
+ minOperatorShareRate: number;
1094
+ expiredAt: bigint;
1095
+ nonce: bigint;
1096
+ });
1097
+ getTxType(): number;
1098
+ validate(): void;
1099
+ hash(chainId: number): Uint8Array;
1100
+ }
1101
+ /**
1102
+ * L2 Mint Shares Transaction Info
1103
+ */
1104
+ declare class L2MintSharesTxInfo implements TxInfo {
1105
+ accountIndex: bigint;
1106
+ apiKeyIndex: number;
1107
+ publicPoolIndex: bigint;
1108
+ shareAmount: bigint;
1109
+ expiredAt: bigint;
1110
+ nonce: bigint;
1111
+ signature?: Uint8Array;
1112
+ signedHash?: string;
1113
+ constructor(params: {
1114
+ accountIndex: bigint;
1115
+ apiKeyIndex: number;
1116
+ publicPoolIndex: bigint;
1117
+ shareAmount: bigint;
1118
+ expiredAt: bigint;
1119
+ nonce: bigint;
1120
+ });
1121
+ getTxType(): number;
1122
+ validate(): void;
1123
+ hash(chainId: number): Uint8Array;
1124
+ }
1125
+ /**
1126
+ * L2 Burn Shares Transaction Info
1127
+ */
1128
+ declare class L2BurnSharesTxInfo implements TxInfo {
1129
+ accountIndex: bigint;
1130
+ apiKeyIndex: number;
1131
+ publicPoolIndex: bigint;
1132
+ shareAmount: bigint;
1133
+ expiredAt: bigint;
1134
+ nonce: bigint;
1135
+ signature?: Uint8Array;
1136
+ signedHash?: string;
1137
+ constructor(params: {
1138
+ accountIndex: bigint;
1139
+ apiKeyIndex: number;
1140
+ publicPoolIndex: bigint;
1141
+ shareAmount: bigint;
1142
+ expiredAt: bigint;
1143
+ nonce: bigint;
1144
+ });
1145
+ getTxType(): number;
1146
+ validate(): void;
1147
+ hash(chainId: number): Uint8Array;
1148
+ }
1149
+
1150
+ /**
1151
+ * Transaction Info Serializer
1152
+ *
1153
+ * Converts TypeScript TxInfo objects to JSON format compatible with the Lighter API.
1154
+ * The API expects PascalCase field names matching the Go struct definitions.
1155
+ */
1156
+
1157
+ /**
1158
+ * Serialize L2CreateOrderTxInfo to JSON
1159
+ */
1160
+ declare function serializeCreateOrder(txInfo: L2CreateOrderTxInfo): string;
1161
+ /**
1162
+ * Serialize L2CancelOrderTxInfo to JSON
1163
+ */
1164
+ declare function serializeCancelOrder(txInfo: L2CancelOrderTxInfo): string;
1165
+ /**
1166
+ * Serialize L2ModifyOrderTxInfo to JSON
1167
+ */
1168
+ declare function serializeModifyOrder(txInfo: L2ModifyOrderTxInfo): string;
1169
+ /**
1170
+ * Serialize L2CancelAllOrdersTxInfo to JSON
1171
+ */
1172
+ declare function serializeCancelAllOrders(txInfo: L2CancelAllOrdersTxInfo): string;
1173
+ /**
1174
+ * Serialize L2WithdrawTxInfo to JSON
1175
+ */
1176
+ declare function serializeWithdraw(txInfo: L2WithdrawTxInfo): string;
1177
+ /**
1178
+ * Serialize L2TransferTxInfo to JSON
1179
+ */
1180
+ declare function serializeTransfer(txInfo: L2TransferTxInfo): string;
1181
+ /**
1182
+ * Serialize L2ChangePubKeyTxInfo to JSON
1183
+ */
1184
+ declare function serializeChangePubKey(txInfo: L2ChangePubKeyTxInfo): string;
1185
+ /**
1186
+ * Serialize L2CreateSubAccountTxInfo to JSON
1187
+ */
1188
+ declare function serializeCreateSubAccount(txInfo: L2CreateSubAccountTxInfo): string;
1189
+ /**
1190
+ * Serialize L2UpdateLeverageTxInfo to JSON
1191
+ */
1192
+ declare function serializeUpdateLeverage(txInfo: L2UpdateLeverageTxInfo): string;
1193
+ /**
1194
+ * Serialize L2UpdateMarginTxInfo to JSON
1195
+ */
1196
+ declare function serializeUpdateMargin(txInfo: L2UpdateMarginTxInfo): string;
1197
+ /**
1198
+ * Serialize L2CreatePublicPoolTxInfo to JSON
1199
+ */
1200
+ declare function serializeCreatePublicPool(txInfo: L2CreatePublicPoolTxInfo): string;
1201
+ /**
1202
+ * Serialize L2UpdatePublicPoolTxInfo to JSON
1203
+ */
1204
+ declare function serializeUpdatePublicPool(txInfo: L2UpdatePublicPoolTxInfo): string;
1205
+ /**
1206
+ * Serialize L2MintSharesTxInfo to JSON
1207
+ */
1208
+ declare function serializeMintShares(txInfo: L2MintSharesTxInfo): string;
1209
+ /**
1210
+ * Serialize L2BurnSharesTxInfo to JSON
1211
+ */
1212
+ declare function serializeBurnShares(txInfo: L2BurnSharesTxInfo): string;
1213
+ /**
1214
+ * Serialize L2CreateGroupedOrdersTxInfo to JSON
1215
+ */
1216
+ declare function serializeCreateGroupedOrders(txInfo: L2CreateGroupedOrdersTxInfo): string;
1217
+ /**
1218
+ * Generic serializer - determines the type and calls the appropriate serializer
1219
+ */
1220
+ declare function serializeTxInfo(txInfo: TxInfo): string;
1221
+
1222
+ interface WebSocketConfig {
1223
+ url?: string;
1224
+ minReconnectionDelay?: number;
1225
+ maxReconnectionDelay?: number;
1226
+ maxReconnectAttempts?: number;
1227
+ onMessage?: (data: any) => void;
1228
+ onError?: (error: Error) => void;
1229
+ onClose?: () => void;
1230
+ onOpen?: () => void;
1231
+ }
1232
+ interface WebSocketSubscription<TPayload = any> {
1233
+ channel: string;
1234
+ auth?: string;
1235
+ params?: Record<string, any>;
1236
+ parser?: (payload: any) => TPayload;
1237
+ handler?: (payload: TPayload) => void;
1238
+ }
1239
+ interface WsPriceLevel {
1240
+ price: string;
1241
+ size: string;
1242
+ }
1243
+ interface WsOrderBookSnapshot {
1244
+ code: number;
1245
+ asks: WsPriceLevel[];
1246
+ bids: WsPriceLevel[];
1247
+ begin_nonce: number;
1248
+ nonce: number;
1249
+ offset: number;
1250
+ }
1251
+ interface WsOrderBookUpdate {
1252
+ channel: string;
1253
+ offset: number;
1254
+ order_book: WsOrderBookSnapshot;
1255
+ type: "subscribed/order_book" | "update/order_book";
1256
+ }
1257
+ interface WsMarketStats {
1258
+ market_id: number;
1259
+ index_price: string;
1260
+ mark_price: string;
1261
+ open_interest: string;
1262
+ last_trade_price: string;
1263
+ current_funding_rate: string;
1264
+ funding_rate: string;
1265
+ funding_timestamp: number;
1266
+ daily_base_token_volume: number;
1267
+ daily_quote_token_volume: number;
1268
+ daily_price_low: number;
1269
+ daily_price_high: number;
1270
+ daily_price_change: number;
1271
+ }
1272
+ interface WsMarketStatsUpdate {
1273
+ channel: string;
1274
+ market_stats: Record<number, WsMarketStats>;
1275
+ type: "update/market_stats" | "subscribed/market_stats";
1276
+ }
1277
+ interface WsSpotMarketStats {
1278
+ symbol: string;
1279
+ market_id: number;
1280
+ index_price: string;
1281
+ mid_price: string;
1282
+ last_trade_price: string;
1283
+ daily_base_token_volume: number;
1284
+ daily_quote_token_volume: number;
1285
+ daily_price_low: number;
1286
+ daily_price_high: number;
1287
+ daily_price_change: number;
1288
+ }
1289
+ interface WsSpotMarketStatsUpdate {
1290
+ channel: string;
1291
+ spot_market_stats: Record<number, WsSpotMarketStats>;
1292
+ type: "update/spot_market_stats" | "subscribed/spot_market_stats";
1293
+ }
1294
+ interface WsTrade {
1295
+ trade_id: number;
1296
+ tx_hash: string;
1297
+ type: string;
1298
+ market_id: number;
1299
+ size: string;
1300
+ price: string;
1301
+ usd_amount: string;
1302
+ ask_id: number;
1303
+ bid_id: number;
1304
+ ask_account_id: number;
1305
+ bid_account_id: number;
1306
+ is_maker_ask: boolean;
1307
+ block_height: number;
1308
+ timestamp: number;
1309
+ taker_fee?: number;
1310
+ taker_position_size_before?: string;
1311
+ taker_entry_quote_before?: string;
1312
+ taker_initial_margin_fraction_before?: number;
1313
+ taker_position_sign_changed?: boolean;
1314
+ maker_fee?: number;
1315
+ maker_position_size_before?: string;
1316
+ maker_entry_quote_before?: string;
1317
+ maker_initial_margin_fraction_before?: number;
1318
+ maker_position_sign_changed?: boolean;
1319
+ }
1320
+ interface WsTradeUpdate {
1321
+ channel: string;
1322
+ trades: WsTrade[];
1323
+ type: "subscribed/trade" | "update/trade";
1324
+ }
1325
+ interface WsOrder {
1326
+ order_index: number;
1327
+ client_order_index: number;
1328
+ order_id: string;
1329
+ client_order_id: string;
1330
+ market_index: number;
1331
+ owner_account_index: number;
1332
+ initial_base_amount: string;
1333
+ price: string;
1334
+ nonce: number;
1335
+ remaining_base_amount: string;
1336
+ is_ask: boolean;
1337
+ base_size: number;
1338
+ base_price: number;
1339
+ filled_base_amount: string;
1340
+ filled_quote_amount: string;
1341
+ side: string;
1342
+ type: string;
1343
+ time_in_force: string;
1344
+ reduce_only: boolean;
1345
+ trigger_price: string;
1346
+ order_expiry: number;
1347
+ status: string;
1348
+ trigger_status: string;
1349
+ trigger_time: number;
1350
+ parent_order_index: number;
1351
+ parent_order_id: string;
1352
+ to_trigger_order_id_0?: string;
1353
+ to_trigger_order_id_1?: string;
1354
+ to_cancel_order_id_0?: string;
1355
+ to_cancel_order_id_1?: string;
1356
+ block_height: number;
1357
+ timestamp: number;
1358
+ }
1359
+ interface WsFundingHistoryEntry {
1360
+ timestamp: number;
1361
+ market_id: number;
1362
+ funding_id: number;
1363
+ change: string;
1364
+ rate: string;
1365
+ position_size: string;
1366
+ position_side: string;
1367
+ }
1368
+ interface WsAccountPosition {
1369
+ market_id: number;
1370
+ symbol: string;
1371
+ initial_margin_fraction: string;
1372
+ open_order_count: number;
1373
+ pending_order_count: number;
1374
+ position_tied_order_count: number;
1375
+ sign: number;
1376
+ position: string;
1377
+ avg_entry_price: string;
1378
+ position_value: string;
1379
+ unrealized_pnl: string;
1380
+ realized_pnl: string;
1381
+ liquidation_price: string;
1382
+ total_funding_paid_out?: string;
1383
+ margin_mode: number;
1384
+ allocated_margin: string;
1385
+ }
1386
+ interface WsPoolShare {
1387
+ public_pool_index: number;
1388
+ shares_amount: number;
1389
+ entry_usdc: string;
1390
+ }
1391
+ interface WsAccountAllUpdate {
1392
+ account: number;
1393
+ channel: string;
1394
+ daily_trades_count: number;
1395
+ daily_volume: number;
1396
+ weekly_trades_count: number;
1397
+ weekly_volume: number;
1398
+ monthly_trades_count: number;
1399
+ monthly_volume: number;
1400
+ total_trades_count: number;
1401
+ total_volume: number;
1402
+ funding_histories: Record<string, WsFundingHistoryEntry[]>;
1403
+ positions: Record<string, WsAccountPosition>;
1404
+ shares: WsPoolShare[];
1405
+ trades: Record<string, WsTrade[]>;
1406
+ type: "subscribed/account_all" | "update/account_all";
1407
+ }
1408
+ interface WsAccountMarketUpdate {
1409
+ account: number;
1410
+ channel: string;
1411
+ funding_history?: WsFundingHistoryEntry;
1412
+ orders: WsOrder[];
1413
+ position?: WsAccountPosition;
1414
+ trades: WsTrade[];
1415
+ type: "subscribed/account_market" | "update/account_market";
1416
+ }
1417
+ interface WsStatsBreakdown {
1418
+ collateral: string;
1419
+ portfolio_value: string;
1420
+ leverage: string;
1421
+ available_balance: string;
1422
+ margin_usage: string;
1423
+ buying_power: string;
1424
+ }
1425
+ interface WsUserStats {
1426
+ collateral: string;
1427
+ portfolio_value: string;
1428
+ leverage: string;
1429
+ available_balance: string;
1430
+ margin_usage: string;
1431
+ buying_power: string;
1432
+ cross_stats: WsStatsBreakdown;
1433
+ total_stats: WsStatsBreakdown;
1434
+ }
1435
+ interface WsUserStatsUpdate {
1436
+ channel: string;
1437
+ stats: WsUserStats;
1438
+ type: "subscribed/user_stats" | "update/user_stats";
1439
+ }
1440
+ interface WsAccountAsset {
1441
+ symbol: string;
1442
+ asset_id: number;
1443
+ balance: string;
1444
+ locked_balance: string;
1445
+ }
1446
+ interface WsAccountAllAssetsUpdate {
1447
+ channel: string;
1448
+ assets: Record<string, WsAccountAsset>;
1449
+ type: "subscribed/account_all_assets" | "update/account_all_assets";
1450
+ }
1451
+ interface WsTransaction {
1452
+ hash: string;
1453
+ type: number;
1454
+ info: string;
1455
+ event_info: string;
1456
+ status: number;
1457
+ transaction_index: number;
1458
+ l1_address: string;
1459
+ account_index: number;
1460
+ nonce: number;
1461
+ expire_at: number;
1462
+ block_height: number;
1463
+ queued_at: number;
1464
+ executed_at: number;
1465
+ sequence_index: number;
1466
+ parent_hash: string;
1467
+ }
1468
+ interface WsTransactionUpdate {
1469
+ channel: string;
1470
+ txs: WsTransaction[];
1471
+ type: "subscribed/transaction" | "update/transaction";
1472
+ }
1473
+ interface WsHeightUpdate {
1474
+ channel: string;
1475
+ height: number;
1476
+ type: "subscribed/height" | "update/height";
1477
+ }
1478
+ interface WsPositionFunding {
1479
+ timestamp: number;
1480
+ market_id: number;
1481
+ funding_id: number;
1482
+ change: string;
1483
+ rate: string;
1484
+ position_size: string;
1485
+ position_side: string;
1486
+ }
1487
+ interface WsPoolDataUpdate {
1488
+ channel: string;
1489
+ account: number;
1490
+ trades: Record<string, WsTrade[]>;
1491
+ orders: Record<string, WsOrder[]>;
1492
+ positions: Record<string, WsAccountPosition>;
1493
+ shares: WsPoolShare[];
1494
+ funding_histories: Record<string, WsPositionFunding[]>;
1495
+ type: "subscribed/pool_data" | "update/pool_data";
1496
+ }
1497
+ interface WsPoolInfoDailyMetric {
1498
+ timestamp: number;
1499
+ daily_return?: number;
1500
+ share_price?: number;
1501
+ }
1502
+ interface WsPoolInfo {
1503
+ status: number;
1504
+ operator_fee: string;
1505
+ min_operator_share_rate: string;
1506
+ total_shares: number;
1507
+ operator_shares: number;
1508
+ annual_percentage_yield: number;
1509
+ daily_returns: WsPoolInfoDailyMetric[];
1510
+ share_prices: WsPoolInfoDailyMetric[];
1511
+ }
1512
+ interface WsPoolInfoUpdate {
1513
+ channel: string;
1514
+ pool_info: WsPoolInfo;
1515
+ type: "subscribed/pool_info" | "update/pool_info";
1516
+ }
1517
+ interface WsNotificationBase {
1518
+ id: string;
1519
+ created_at: string;
1520
+ updated_at: string;
1521
+ kind: string;
1522
+ account_index: number;
1523
+ ack: boolean;
1524
+ acked_at: string | null;
1525
+ }
1526
+ interface WsLiquidationNotificationContent {
1527
+ id: string;
1528
+ is_ask: boolean;
1529
+ usdc_amount: string;
1530
+ size: string;
1531
+ market_index: number;
1532
+ price: string;
1533
+ timestamp: number;
1534
+ avg_price: string;
1535
+ }
1536
+ interface WsDeleverageNotificationContent {
1537
+ id: string;
1538
+ usdc_amount: string;
1539
+ size: string;
1540
+ market_index: number;
1541
+ settlement_price: string;
1542
+ timestamp: number;
1543
+ }
1544
+ interface WsAnnouncementNotificationContent {
1545
+ title: string;
1546
+ content: string;
1547
+ created_at: number;
1548
+ }
1549
+ type WsNotificationContent = WsLiquidationNotificationContent | WsDeleverageNotificationContent | WsAnnouncementNotificationContent | Record<string, any>;
1550
+ interface WsNotification extends WsNotificationBase {
1551
+ content: WsNotificationContent;
1552
+ }
1553
+ interface WsNotificationUpdate {
1554
+ channel: string;
1555
+ notifs: WsNotification[];
1556
+ type: "subscribed/notification" | "update/notification";
1557
+ }
1558
+ interface WsAccountAllOrdersUpdate {
1559
+ channel: string;
1560
+ orders: Record<string, WsOrder[]>;
1561
+ type: "subscribed/account_all_orders" | "update/account_all_orders";
1562
+ }
1563
+ interface WsAccountOrdersUpdate {
1564
+ account: number;
1565
+ channel: string;
1566
+ nonce?: number;
1567
+ orders: Record<string, WsOrder[]>;
1568
+ type: "subscribed/account_orders" | "update/account_orders";
1569
+ }
1570
+ interface WsAccountAllTradesUpdate {
1571
+ channel: string;
1572
+ trades: Record<string, WsTrade[]>;
1573
+ total_volume: number;
1574
+ monthly_volume: number;
1575
+ weekly_volume: number;
1576
+ daily_volume: number;
1577
+ type: "subscribed/account_all_trades" | "update/account_all_trades";
1578
+ }
1579
+ interface WsAccountAllPositionsUpdate {
1580
+ channel: string;
1581
+ positions: Record<string, WsAccountPosition>;
1582
+ shares: WsPoolShare[];
1583
+ type: "subscribed/account_all_positions" | "update/account_all_positions";
1584
+ }
1585
+
1586
+ interface L1DepositParams {
1587
+ ethPrivateKey: string;
1588
+ usdcAmount: number;
1589
+ l2AccountIndex: number;
1590
+ rpcUrl?: string;
1591
+ gasPrice?: string;
1592
+ gasLimit?: number;
1593
+ }
1594
+ interface L1DepositResult {
1595
+ l1TxHash: string;
1596
+ l2AccountIndex: number;
1597
+ amount: string;
1598
+ status: "pending" | "completed" | "failed";
1599
+ blockNumber?: number;
1600
+ gasUsed?: string;
1601
+ }
1602
+ interface L1BridgeConfig {
1603
+ l1BridgeContract: string;
1604
+ usdcContract: string;
1605
+ rpcUrl: string;
1606
+ chainId: number;
1607
+ }
1608
+
1609
+ /**
1610
+ * Transaction Client for signing and managing Lighter transactions
1611
+ */
1612
+
1613
+ /**
1614
+ * Transaction Client for a specific (account, apiKey) pair
1615
+ */
1616
+ declare class TxClient {
1617
+ private readonly apiClient;
1618
+ private readonly chainId;
1619
+ private readonly keyManager;
1620
+ private readonly _accountIndex;
1621
+ private readonly _apiKeyIndex;
1622
+ constructor(apiClient: MinimalHTTPClient | null, privateKey: string, accountIndex: bigint, apiKeyIndex: number, chainId: number);
1623
+ /**
1624
+ * Fill in default transaction options
1625
+ */
1626
+ fulfillDefaultOpts(opts?: TransactOpts): Promise<TransactOpts>;
1627
+ /**
1628
+ * Get chain ID
1629
+ */
1630
+ getChainId(): number;
1631
+ /**
1632
+ * Get key manager
1633
+ */
1634
+ getKeyManager(): KeyManager;
1635
+ /**
1636
+ * Get account index
1637
+ */
1638
+ get accountIndex(): bigint;
1639
+ /**
1640
+ * Get API key index
1641
+ */
1642
+ get apiKeyIndex(): number;
1643
+ /**
1644
+ * Get HTTP client
1645
+ */
1646
+ http(): MinimalHTTPClient | null;
1647
+ /**
1648
+ * Check that the client's API key matches the one on the server
1649
+ */
1650
+ check(): Promise<void>;
1651
+ /**
1652
+ * Create an auth token
1653
+ */
1654
+ getAuthToken(deadline: Date): Promise<string>;
1655
+ /**
1656
+ * Sign a create order transaction
1657
+ */
1658
+ signCreateOrder(tx: CreateOrderTxReq, opts?: TransactOpts): Promise<L2CreateOrderTxInfo>;
1659
+ /**
1660
+ * Sign a cancel order transaction
1661
+ */
1662
+ signCancelOrder(tx: CancelOrderTxReq, opts?: TransactOpts): Promise<L2CancelOrderTxInfo>;
1663
+ /**
1664
+ * Sign a modify order transaction
1665
+ */
1666
+ signModifyOrder(tx: ModifyOrderTxReq, opts?: TransactOpts): Promise<L2ModifyOrderTxInfo>;
1667
+ /**
1668
+ * Sign a cancel all orders transaction
1669
+ */
1670
+ signCancelAllOrders(tx: CancelAllOrdersTxReq, opts?: TransactOpts): Promise<L2CancelAllOrdersTxInfo>;
1671
+ /**
1672
+ * Sign a withdraw transaction
1673
+ */
1674
+ signWithdraw(tx: WithdrawTxReq, opts?: TransactOpts): Promise<L2WithdrawTxInfo>;
1675
+ /**
1676
+ * Sign a transfer transaction
1677
+ */
1678
+ signTransfer(tx: TransferTxReq, opts?: TransactOpts): Promise<L2TransferTxInfo>;
1679
+ /**
1680
+ * Sign a change public key transaction
1681
+ */
1682
+ signChangePubKey(tx: ChangePubKeyReq, opts?: TransactOpts): Promise<L2ChangePubKeyTxInfo>;
1683
+ /**
1684
+ * Sign a create sub account transaction
1685
+ */
1686
+ signCreateSubAccount(opts?: TransactOpts): Promise<L2CreateSubAccountTxInfo>;
1687
+ /**
1688
+ * Sign an update leverage transaction
1689
+ */
1690
+ signUpdateLeverage(tx: UpdateLeverageTxReq, opts?: TransactOpts): Promise<L2UpdateLeverageTxInfo>;
1691
+ /**
1692
+ * Sign an update margin transaction
1693
+ */
1694
+ signUpdateMargin(tx: UpdateMarginTxReq, opts?: TransactOpts): Promise<L2UpdateMarginTxInfo>;
1695
+ /**
1696
+ * Sign a create grouped orders transaction
1697
+ */
1698
+ signCreateGroupedOrders(tx: CreateGroupedOrdersTxReq, opts?: TransactOpts): Promise<L2CreateGroupedOrdersTxInfo>;
1699
+ /**
1700
+ * Sign a create public pool transaction
1701
+ */
1702
+ signCreatePublicPool(tx: CreatePublicPoolTxReq, opts?: TransactOpts): Promise<L2CreatePublicPoolTxInfo>;
1703
+ /**
1704
+ * Sign an update public pool transaction
1705
+ */
1706
+ signUpdatePublicPool(tx: UpdatePublicPoolTxReq, opts?: TransactOpts): Promise<L2UpdatePublicPoolTxInfo>;
1707
+ /**
1708
+ * Sign a mint shares transaction
1709
+ */
1710
+ signMintShares(tx: MintSharesTxReq, opts?: TransactOpts): Promise<L2MintSharesTxInfo>;
1711
+ /**
1712
+ * Sign a burn shares transaction
1713
+ */
1714
+ signBurnShares(tx: BurnSharesTxReq, opts?: TransactOpts): Promise<L2BurnSharesTxInfo>;
1715
+ }
1716
+
1717
+ /**
1718
+ * Client Manager for handling multiple TxClients
1719
+ * Similar to the Go SDK's SharedClientManager
1720
+ */
1721
+
1722
+ declare const DEFAULT_API_KEY_INDEX = 255;
1723
+ declare const DEFAULT_ACCOUNT_INDEX = -1n;
1724
+ /**
1725
+ * Get a client for specific account and API key
1726
+ */
1727
+ declare function getClient(apiKeyIndex?: number, accountIndex?: bigint): TxClient;
1728
+ /**
1729
+ * Create a new TxClient and store it
1730
+ */
1731
+ declare function createClient(httpClient: MinimalHTTPClient | null, privateKey: string, chainId: number, apiKeyIndex: number, accountIndex: bigint): TxClient;
1732
+ /**
1733
+ * Check that a client exists and the API key matches the one on the server
1734
+ */
1735
+ declare function checkClient(apiKeyIndex?: number, accountIndex?: bigint): Promise<void>;
1736
+
1737
+ /**
1738
+ * Clear all stored clients (useful for testing)
1739
+ */
1740
+ declare function clearClients(): void;
1741
+ /**
1742
+ * Get the default client
1743
+ */
1744
+ declare function getDefaultClient(): TxClient | null;
1745
+
1746
+ interface AccountRequest {
1747
+ by: "index" | "l1_address";
1748
+ value: string;
1749
+ }
1750
+ interface AccountPosition {
1751
+ market_id: number;
1752
+ symbol: string;
1753
+ initial_margin_fraction: string;
1754
+ open_order_count: number;
1755
+ pending_order_count: number;
1756
+ position_tied_order_count: number;
1757
+ sign: number;
1758
+ position: string;
1759
+ avg_entry_price: string;
1760
+ position_value: string;
1761
+ unrealized_pnl: string;
1762
+ realized_pnl: string;
1763
+ liquidation_price: string;
1764
+ margin_mode: number;
1765
+ allocated_margin: string;
1766
+ }
1767
+ interface AccountAsset {
1768
+ symbol: string;
1769
+ asset_id: number;
1770
+ balance: string;
1771
+ locked_balance: string;
1772
+ }
1773
+ interface AccountShare {
1774
+ public_pool_index: number;
1775
+ shares_amount: number;
1776
+ entry_usdc: string;
1777
+ }
1778
+ interface AccountInfo {
1779
+ code: number;
1780
+ message?: string;
1781
+ account_type: number;
1782
+ index: number;
1783
+ l1_address: string;
1784
+ cancel_all_time: number;
1785
+ total_order_count: number;
1786
+ total_isolated_order_count: number;
1787
+ pending_order_count: number;
1788
+ available_balance: string;
1789
+ status: number;
1790
+ collateral: string;
1791
+ account_index: number;
1792
+ name: string;
1793
+ description: string;
1794
+ can_invite: boolean;
1795
+ referral_points_percentage: string;
1796
+ positions: AccountPosition[];
1797
+ assets: AccountAsset[];
1798
+ total_asset_value: string;
1799
+ cross_asset_value: string;
1800
+ shares: AccountShare[];
1801
+ }
1802
+ interface AccountResponse {
1803
+ code: number;
1804
+ message?: string;
1805
+ total: number;
1806
+ accounts: AccountInfo[];
1807
+ }
1808
+ declare function getAccountInfo(client: AxiosInstance, params: AccountRequest): Promise<AccountResponse>;
1809
+
1810
+ interface AccountByL1AddressRequest {
1811
+ l1_address: string;
1812
+ }
1813
+ interface AccountAccountByL1AddressResponse {
1814
+ code: number;
1815
+ message?: string;
1816
+ account_index: number;
1817
+ l1_address: string;
1818
+ }
1819
+ declare function getAccountByL1Address(client: AxiosInstance, params: AccountByL1AddressRequest): Promise<AccountAccountByL1AddressResponse>;
1820
+
1821
+ interface Announcement {
1822
+ id: number;
1823
+ title: string;
1824
+ content: string;
1825
+ created_at: number;
1826
+ updated_at: number;
1827
+ is_active: boolean;
1828
+ }
1829
+ interface AnnouncementsResponse {
1830
+ code: number;
1831
+ message?: string;
1832
+ announcements: Announcement[];
1833
+ }
1834
+ declare function getAnnouncements(client: AxiosInstance): Promise<AnnouncementsResponse>;
1835
+
1836
+ interface ApiKeysRequest {
1837
+ account_index: number;
1838
+ api_key_index: number;
1839
+ }
1840
+ interface ApiKey {
1841
+ account_index: number;
1842
+ api_key_index: number;
1843
+ nonce: number;
1844
+ public_key: string;
1845
+ transaction_time: number;
1846
+ }
1847
+ interface ApiKeysResponse {
1848
+ api_keys: ApiKey[];
1849
+ }
1850
+ declare function getApiKeys(client: AxiosInstance, params: ApiKeysRequest): Promise<ApiKeysResponse>;
1851
+
1852
+ interface AssetDetailsRequest {
1853
+ asset_id?: number;
1854
+ }
1855
+ interface AssetDetail {
1856
+ asset_id: number;
1857
+ symbol: string;
1858
+ l1_decimals: number;
1859
+ decimals: number;
1860
+ extension_multiplier: number;
1861
+ min_transfer_amount: number;
1862
+ min_withdrawal_amount: number;
1863
+ margin_mode: number;
1864
+ index_price: number;
1865
+ l1_address: string;
1866
+ tick_size: string;
1867
+ }
1868
+ interface AssetDetailsResponse {
1869
+ code: number;
1870
+ message?: string;
1871
+ asset_details: AssetDetail[];
1872
+ }
1873
+ declare function getAssetDetails(client: AxiosInstance, params?: AssetDetailsRequest): Promise<AssetDetailsResponse>;
1874
+
1875
+ interface Candlestick {
1876
+ t: number;
1877
+ o: number;
1878
+ h: number;
1879
+ l: number;
1880
+ c: number;
1881
+ v: number;
1882
+ }
1883
+ interface CandlesRequest {
1884
+ market_id: number;
1885
+ resolution: string;
1886
+ start_timestamp: number;
1887
+ end_timestamp: number;
1888
+ count_back: number;
1889
+ }
1890
+ interface CandlesResponse {
1891
+ c: Candlestick[];
1892
+ }
1893
+ declare function getCandlesticks(client: AxiosInstance, params: CandlesRequest): Promise<CandlesResponse>;
1894
+
1895
+ interface ExchangeStatsResponse {
1896
+ total_volume_24h: string;
1897
+ total_trades_24h: number;
1898
+ total_orders_24h: number;
1899
+ active_markets: number;
1900
+ }
1901
+ declare function getExchangeStats(client: AxiosInstance): Promise<ExchangeStatsResponse>;
1902
+
1903
+ interface FastBridgeInfoResponse {
1904
+ code: number;
1905
+ message?: string;
1906
+ fast_bridge_limit: string;
1907
+ }
1908
+ declare function getFastBridgeInfo(client: AxiosInstance): Promise<FastBridgeInfoResponse>;
1909
+
1910
+ interface FundingRate {
1911
+ market_id: number;
1912
+ exchange: "binance" | "bybit" | "hyperliquid" | "lighter";
1913
+ symbol: string;
1914
+ rate: number;
1915
+ }
1916
+ interface FundingRatesResponse {
1917
+ code: number;
1918
+ message?: string;
1919
+ funding_rates: FundingRate[];
1920
+ }
1921
+ declare function getFundingRates(client: AxiosInstance): Promise<FundingRatesResponse>;
1922
+
1923
+ interface Funding {
1924
+ timestamp: number;
1925
+ market_id: number;
1926
+ funding_id: number;
1927
+ rate: string;
1928
+ }
1929
+ interface FundingsRequest {
1930
+ market_id: number;
1931
+ resolution: string;
1932
+ start_timestamp?: number;
1933
+ end_timestamp?: number;
1934
+ count_back?: number;
1935
+ }
1936
+ interface FundingsResponse {
1937
+ fundings: Funding[];
1938
+ }
1939
+ declare function getFundings(client: AxiosInstance, params: FundingsRequest): Promise<FundingsResponse>;
1940
+
1941
+ interface NextNonceRequest {
1942
+ account_index: number;
1943
+ api_key_index: number;
1944
+ }
1945
+ interface NextNonceResponse {
1946
+ account_index: number;
1947
+ api_key_index: number;
1948
+ nonce: number;
1949
+ }
1950
+ declare function getNextNonce(client: AxiosInstance, params: NextNonceRequest): Promise<NextNonceResponse>;
1951
+
1952
+ interface OrderBookDetailsRequest {
1953
+ market_id?: number;
1954
+ }
1955
+ interface OrderBookDetail {
1956
+ symbol: string;
1957
+ market_id: number;
1958
+ market_type: string;
1959
+ status: string;
1960
+ taker_fee: string;
1961
+ maker_fee: string;
1962
+ liquidation_fee: string;
1963
+ min_base_amount: string;
1964
+ min_quote_amount: string;
1965
+ order_quote_limit: string;
1966
+ supported_size_decimals: number;
1967
+ supported_price_decimals: number;
1968
+ supported_quote_decimals: number;
1969
+ size_decimals: number;
1970
+ price_decimals: number;
1971
+ quote_multiplier: number;
1972
+ default_initial_margin_fraction: number;
1973
+ min_initial_margin_fraction: number;
1974
+ maintenance_margin_fraction: number;
1975
+ closeout_margin_fraction: number;
1976
+ last_trade_price: number;
1977
+ daily_trades_count: number;
1978
+ daily_base_token_volume: number;
1979
+ daily_quote_token_volume: number;
1980
+ daily_price_low: number;
1981
+ daily_price_high: number;
1982
+ daily_price_change: number;
1983
+ open_interest: number;
1984
+ daily_chart: any;
1985
+ market_config: {
1986
+ market_margin_mode: number;
1987
+ insurance_fund_account_index: number;
1988
+ };
1989
+ }
1990
+ interface SpotOrderBookDetail {
1991
+ symbol: string;
1992
+ market_id: number;
1993
+ market_type: string;
1994
+ base_asset_id: string;
1995
+ quote_asset_id: string;
1996
+ status: string;
1997
+ taker_fee: string;
1998
+ maker_fee: string;
1999
+ liquidation_fee: string;
2000
+ min_base_amount: string;
2001
+ min_quote_amount: string;
2002
+ order_quote_limit: string;
2003
+ supported_size_decimals: number;
2004
+ supported_price_decimals: number;
2005
+ supported_quote_decimals: number;
2006
+ size_decimals: number;
2007
+ price_decimals: number;
2008
+ last_trade_price: number;
2009
+ daily_trades_count: number;
2010
+ daily_base_token_volume: number;
2011
+ daily_quote_token_volume: number;
2012
+ daily_price_low: number;
2013
+ daily_price_high: number;
2014
+ daily_price_change: number;
2015
+ }
2016
+ interface OrderBookDetailsResponse {
2017
+ code: number;
2018
+ order_book_details: OrderBookDetail[];
2019
+ spot_order_book_details: SpotOrderBookDetail[];
2020
+ }
2021
+ declare function getOrderBookDetails(client: AxiosInstance, params?: OrderBookDetailsRequest): Promise<OrderBookDetailsResponse>;
2022
+ interface OrderBookOrdersRequest {
2023
+ market_id: number;
2024
+ limit?: number;
2025
+ }
2026
+ interface OrderBookOrder {
2027
+ order_index: number;
2028
+ order_id: string;
2029
+ owner_account_index: number;
2030
+ initial_base_amount: string;
2031
+ remaining_base_amount: string;
2032
+ price: string;
2033
+ order_expiry: number;
2034
+ }
2035
+ interface OrderBookOrdersResponse {
2036
+ code?: number;
2037
+ total_asks?: number;
2038
+ total_bids?: number;
2039
+ bids?: OrderBookOrder[];
2040
+ asks?: OrderBookOrder[];
2041
+ }
2042
+ declare function getOrderBookOrders(client: AxiosInstance, params: OrderBookOrdersRequest): Promise<OrderBookOrdersResponse>;
2043
+
2044
+ interface PriceLevel {
2045
+ price: string;
2046
+ size: string;
2047
+ }
2048
+ interface OrderBook {
2049
+ market_id: number;
2050
+ bids: PriceLevel[];
2051
+ asks: PriceLevel[];
2052
+ last_update_id: string;
2053
+ }
2054
+ type OrderBooksResponse = OrderBook[];
2055
+ declare function getOrderBooks(client: AxiosInstance): Promise<OrderBooksResponse>;
2056
+
2057
+ interface TradesRequest {
2058
+ auth?: string;
2059
+ market_id?: number;
2060
+ account_index?: number;
2061
+ order_index?: number;
2062
+ sort_by: "block_height" | "timestamp" | "trade_id";
2063
+ sort_dir?: "desc";
2064
+ cursor?: string;
2065
+ from?: number;
2066
+ ask_filter?: number;
2067
+ limit: number;
2068
+ }
2069
+ interface Trade {
2070
+ trade_id: number;
2071
+ tx_hash: string;
2072
+ type: "trade" | "liquidation" | "deleverage";
2073
+ market_id: number;
2074
+ size: string;
2075
+ price: string;
2076
+ usd_amount: string;
2077
+ ask_id: number;
2078
+ bid_id: number;
2079
+ ask_account_id: number;
2080
+ bid_account_id: number;
2081
+ is_maker_ask: boolean;
2082
+ block_height: number;
2083
+ timestamp: number;
2084
+ taker_fee: number;
2085
+ taker_position_size_before: string;
2086
+ taker_entry_quote_before: string;
2087
+ taker_initial_margin_fraction_before: number;
2088
+ taker_position_sign_changed: boolean;
2089
+ maker_fee: number;
2090
+ maker_position_size_before: string;
2091
+ maker_entry_quote_before: string;
2092
+ maker_initial_margin_fraction_before: number;
2093
+ maker_position_sign_changed: boolean;
2094
+ }
2095
+ interface TradesResponse {
2096
+ code: number;
2097
+ message?: string;
2098
+ next_cursor?: string;
2099
+ trades: Trade[];
2100
+ }
2101
+ declare function getTrades(client: AxiosInstance, params: TradesRequest, authorization?: string): Promise<TradesResponse>;
2102
+
2103
+ interface RecentTradesRequest {
2104
+ market_id: number;
2105
+ limit: number;
2106
+ }
2107
+ type RecentTradesResponse = Trade[];
2108
+ declare function getRecentTrades(client: AxiosInstance, params: RecentTradesRequest): Promise<RecentTradesResponse>;
2109
+
2110
+ interface RootInfoResponse {
2111
+ contract_address: string;
2112
+ }
2113
+ declare function getRootInfo(client: AxiosInstance): Promise<RootInfoResponse>;
2114
+
2115
+ interface RootStatusResponse {
2116
+ status: number;
2117
+ network_id: number;
2118
+ timestamp: string;
2119
+ }
2120
+ declare function getRootStatus(client: AxiosInstance): Promise<RootStatusResponse>;
2121
+
2122
+ interface TransactionRequest {
2123
+ by: "hash" | "index";
2124
+ value: string;
2125
+ }
2126
+ interface Transaction {
2127
+ hash: string;
2128
+ block_height: number;
2129
+ sequence_index: number;
2130
+ account_index: number;
2131
+ nonce: number;
2132
+ type: string | number;
2133
+ info?: string;
2134
+ event_info?: string;
2135
+ data?: any;
2136
+ status: number | "pending" | "confirmed" | "failed";
2137
+ transaction_index?: number;
2138
+ l1_address?: string;
2139
+ expire_at?: number;
2140
+ queued_at?: number;
2141
+ committed_at?: number;
2142
+ verified_at?: number;
2143
+ executed_at?: number;
2144
+ parent_hash?: string;
2145
+ created_at?: string;
2146
+ updated_at?: string;
2147
+ code?: number;
2148
+ message?: string;
2149
+ }
2150
+ declare function getTransaction(client: AxiosInstance, params: TransactionRequest): Promise<Transaction>;
2151
+
2152
+ interface TransactionFromL1TxHashRequest {
2153
+ l1_tx_hash: string;
2154
+ }
2155
+ declare function getTransactionFromL1TxHash(client: AxiosInstance, params: TransactionFromL1TxHashRequest): Promise<Transaction>;
2156
+
2157
+ interface TransactionsRequest {
2158
+ cursor?: string;
2159
+ limit?: number;
2160
+ }
2161
+ type TransactionsResponse = Transaction[];
2162
+ declare function getTransactions(client: AxiosInstance, params?: TransactionsRequest): Promise<TransactionsResponse>;
2163
+
2164
+ interface WithdrawalDelayResponse {
2165
+ seconds: number;
2166
+ }
2167
+ declare function getWithdrawalDelay(client: AxiosInstance): Promise<WithdrawalDelayResponse>;
2168
+
2169
+ type index$2_AccountAccountByL1AddressResponse = AccountAccountByL1AddressResponse;
2170
+ type index$2_AccountAsset = AccountAsset;
2171
+ type index$2_AccountByL1AddressRequest = AccountByL1AddressRequest;
2172
+ type index$2_AccountInfo = AccountInfo;
2173
+ type index$2_AccountPosition = AccountPosition;
2174
+ type index$2_AccountRequest = AccountRequest;
2175
+ type index$2_AccountResponse = AccountResponse;
2176
+ type index$2_AccountShare = AccountShare;
2177
+ type index$2_Announcement = Announcement;
2178
+ type index$2_AnnouncementsResponse = AnnouncementsResponse;
2179
+ type index$2_ApiKey = ApiKey;
2180
+ type index$2_ApiKeysRequest = ApiKeysRequest;
2181
+ type index$2_ApiKeysResponse = ApiKeysResponse;
2182
+ type index$2_AssetDetail = AssetDetail;
2183
+ type index$2_AssetDetailsRequest = AssetDetailsRequest;
2184
+ type index$2_AssetDetailsResponse = AssetDetailsResponse;
2185
+ type index$2_CandlesRequest = CandlesRequest;
2186
+ type index$2_CandlesResponse = CandlesResponse;
2187
+ type index$2_Candlestick = Candlestick;
2188
+ type index$2_ExchangeStatsResponse = ExchangeStatsResponse;
2189
+ type index$2_FastBridgeInfoResponse = FastBridgeInfoResponse;
2190
+ type index$2_Funding = Funding;
2191
+ type index$2_FundingRate = FundingRate;
2192
+ type index$2_FundingRatesResponse = FundingRatesResponse;
2193
+ type index$2_FundingsRequest = FundingsRequest;
2194
+ type index$2_FundingsResponse = FundingsResponse;
2195
+ type index$2_NextNonceRequest = NextNonceRequest;
2196
+ type index$2_NextNonceResponse = NextNonceResponse;
2197
+ type index$2_OrderBook = OrderBook;
2198
+ type index$2_OrderBookDetail = OrderBookDetail;
2199
+ type index$2_OrderBookDetailsRequest = OrderBookDetailsRequest;
2200
+ type index$2_OrderBookDetailsResponse = OrderBookDetailsResponse;
2201
+ type index$2_OrderBookOrder = OrderBookOrder;
2202
+ type index$2_OrderBookOrdersRequest = OrderBookOrdersRequest;
2203
+ type index$2_OrderBookOrdersResponse = OrderBookOrdersResponse;
2204
+ type index$2_OrderBooksResponse = OrderBooksResponse;
2205
+ type index$2_PriceLevel = PriceLevel;
2206
+ type index$2_RecentTradesRequest = RecentTradesRequest;
2207
+ type index$2_RecentTradesResponse = RecentTradesResponse;
2208
+ type index$2_RootInfoResponse = RootInfoResponse;
2209
+ type index$2_RootStatusResponse = RootStatusResponse;
2210
+ type index$2_SpotOrderBookDetail = SpotOrderBookDetail;
2211
+ type index$2_Transaction = Transaction;
2212
+ type index$2_TransactionFromL1TxHashRequest = TransactionFromL1TxHashRequest;
2213
+ type index$2_TransactionRequest = TransactionRequest;
2214
+ type index$2_TransactionsRequest = TransactionsRequest;
2215
+ type index$2_TransactionsResponse = TransactionsResponse;
2216
+ type index$2_WithdrawalDelayResponse = WithdrawalDelayResponse;
2217
+ declare const index$2_getAccountByL1Address: typeof getAccountByL1Address;
2218
+ declare const index$2_getAccountInfo: typeof getAccountInfo;
2219
+ declare const index$2_getAnnouncements: typeof getAnnouncements;
2220
+ declare const index$2_getApiKeys: typeof getApiKeys;
2221
+ declare const index$2_getAssetDetails: typeof getAssetDetails;
2222
+ declare const index$2_getCandlesticks: typeof getCandlesticks;
2223
+ declare const index$2_getExchangeStats: typeof getExchangeStats;
2224
+ declare const index$2_getFastBridgeInfo: typeof getFastBridgeInfo;
2225
+ declare const index$2_getFundingRates: typeof getFundingRates;
2226
+ declare const index$2_getFundings: typeof getFundings;
2227
+ declare const index$2_getNextNonce: typeof getNextNonce;
2228
+ declare const index$2_getOrderBookDetails: typeof getOrderBookDetails;
2229
+ declare const index$2_getOrderBookOrders: typeof getOrderBookOrders;
2230
+ declare const index$2_getOrderBooks: typeof getOrderBooks;
2231
+ declare const index$2_getRecentTrades: typeof getRecentTrades;
2232
+ declare const index$2_getRootInfo: typeof getRootInfo;
2233
+ declare const index$2_getRootStatus: typeof getRootStatus;
2234
+ declare const index$2_getTransaction: typeof getTransaction;
2235
+ declare const index$2_getTransactionFromL1TxHash: typeof getTransactionFromL1TxHash;
2236
+ declare const index$2_getTransactions: typeof getTransactions;
2237
+ declare const index$2_getWithdrawalDelay: typeof getWithdrawalDelay;
2238
+ declare namespace index$2 {
2239
+ export { type index$2_AccountAccountByL1AddressResponse as AccountAccountByL1AddressResponse, type index$2_AccountAsset as AccountAsset, type index$2_AccountByL1AddressRequest as AccountByL1AddressRequest, type index$2_AccountInfo as AccountInfo, type index$2_AccountPosition as AccountPosition, type index$2_AccountRequest as AccountRequest, type index$2_AccountResponse as AccountResponse, type index$2_AccountShare as AccountShare, type index$2_Announcement as Announcement, type index$2_AnnouncementsResponse as AnnouncementsResponse, type index$2_ApiKey as ApiKey, type index$2_ApiKeysRequest as ApiKeysRequest, type index$2_ApiKeysResponse as ApiKeysResponse, type index$2_AssetDetail as AssetDetail, type index$2_AssetDetailsRequest as AssetDetailsRequest, type index$2_AssetDetailsResponse as AssetDetailsResponse, type index$2_CandlesRequest as CandlesRequest, type index$2_CandlesResponse as CandlesResponse, type index$2_Candlestick as Candlestick, type index$2_ExchangeStatsResponse as ExchangeStatsResponse, type index$2_FastBridgeInfoResponse as FastBridgeInfoResponse, type index$2_Funding as Funding, type index$2_FundingRate as FundingRate, type index$2_FundingRatesResponse as FundingRatesResponse, type index$2_FundingsRequest as FundingsRequest, type index$2_FundingsResponse as FundingsResponse, type index$2_NextNonceRequest as NextNonceRequest, type index$2_NextNonceResponse as NextNonceResponse, type index$2_OrderBook as OrderBook, type index$2_OrderBookDetail as OrderBookDetail, type index$2_OrderBookDetailsRequest as OrderBookDetailsRequest, type index$2_OrderBookDetailsResponse as OrderBookDetailsResponse, type index$2_OrderBookOrder as OrderBookOrder, type index$2_OrderBookOrdersRequest as OrderBookOrdersRequest, type index$2_OrderBookOrdersResponse as OrderBookOrdersResponse, type index$2_OrderBooksResponse as OrderBooksResponse, type index$2_PriceLevel as PriceLevel, type index$2_RecentTradesRequest as RecentTradesRequest, type index$2_RecentTradesResponse as RecentTradesResponse, type index$2_RootInfoResponse as RootInfoResponse, type index$2_RootStatusResponse as RootStatusResponse, type index$2_SpotOrderBookDetail as SpotOrderBookDetail, type index$2_Transaction as Transaction, type index$2_TransactionFromL1TxHashRequest as TransactionFromL1TxHashRequest, type index$2_TransactionRequest as TransactionRequest, type index$2_TransactionsRequest as TransactionsRequest, type index$2_TransactionsResponse as TransactionsResponse, type index$2_WithdrawalDelayResponse as WithdrawalDelayResponse, index$2_getAccountByL1Address as getAccountByL1Address, index$2_getAccountInfo as getAccountInfo, index$2_getAnnouncements as getAnnouncements, index$2_getApiKeys as getApiKeys, index$2_getAssetDetails as getAssetDetails, index$2_getCandlesticks as getCandlesticks, index$2_getExchangeStats as getExchangeStats, index$2_getFastBridgeInfo as getFastBridgeInfo, index$2_getFundingRates as getFundingRates, index$2_getFundings as getFundings, index$2_getNextNonce as getNextNonce, index$2_getOrderBookDetails as getOrderBookDetails, index$2_getOrderBookOrders as getOrderBookOrders, index$2_getOrderBooks as getOrderBooks, index$2_getRecentTrades as getRecentTrades, index$2_getRootInfo as getRootInfo, index$2_getRootStatus as getRootStatus, index$2_getTransaction as getTransaction, index$2_getTransactionFromL1TxHash as getTransactionFromL1TxHash, index$2_getTransactions as getTransactions, index$2_getWithdrawalDelay as getWithdrawalDelay };
2240
+ }
2241
+
2242
+ interface InfoClientConfig {
2243
+ baseURL?: string;
2244
+ }
2245
+ /**
2246
+ * InfoClient - Client for public info endpoints
2247
+ *
2248
+ * Provides access to all public API endpoints that don't require authentication.
2249
+ *
2250
+ * @example
2251
+ * ```typescript
2252
+ * const client = new InfoClient({
2253
+ * baseURL: "https://mainnet.zklighter.elliot.ai"
2254
+ * });
2255
+ *
2256
+ * const account = await client.getAccountInfo({ by: "index", value: "0" });
2257
+ * const orderBooks = await client.getOrderBooks();
2258
+ * ```
2259
+ */
2260
+ declare class InfoClient {
2261
+ private readonly config;
2262
+ private readonly axiosInstance;
2263
+ constructor(config?: InfoClientConfig);
2264
+ private createAxiosInstance;
2265
+ /**
2266
+ * Get account information by index or L2 address
2267
+ * @param params - Account lookup parameters (by index or L2 address)
2268
+ * @returns Account information including balances and positions
2269
+ * @example
2270
+ * ```typescript
2271
+ * const account = await client.getAccountInfo({ by: "index", value: "0" });
2272
+ * ```
2273
+ */
2274
+ getAccountInfo(params: AccountRequest): Promise<AccountResponse>;
2275
+ /**
2276
+ * Get account information by L1 address
2277
+ * @param params - L1 address lookup parameters
2278
+ * @returns Account information associated with the L1 address
2279
+ * @example
2280
+ * ```typescript
2281
+ * const account = await client.getAccountByL1Address({ l1_address: "0x..." });
2282
+ * ```
2283
+ */
2284
+ getAccountByL1Address(params: AccountByL1AddressRequest): Promise<AccountAccountByL1AddressResponse>;
2285
+ /**
2286
+ * Get API keys for an account
2287
+ * @param params - Account index to retrieve API keys for
2288
+ * @returns List of API keys associated with the account
2289
+ * @example
2290
+ * ```typescript
2291
+ * const keys = await client.getApiKeys({ account_index: 0 });
2292
+ * ```
2293
+ */
2294
+ getApiKeys(params: ApiKeysRequest): Promise<ApiKeysResponse>;
2295
+ /**
2296
+ * Get system announcements
2297
+ * @returns List of active announcements
2298
+ * @example
2299
+ * ```typescript
2300
+ * const announcements = await client.getAnnouncements();
2301
+ * ```
2302
+ */
2303
+ getAnnouncements(): Promise<AnnouncementsResponse>;
2304
+ /**
2305
+ * Get asset details for a specific asset or all assets
2306
+ * @param params - Optional asset_index to get details for a specific asset
2307
+ * @returns Asset details including symbol, decimals, limits, and pricing information
2308
+ * @example
2309
+ * ```typescript
2310
+ * // Get all assets
2311
+ * const allAssets = await client.getAssetDetails();
2312
+ *
2313
+ * // Get specific asset
2314
+ * const asset = await client.getAssetDetails({ asset_index: 0 });
2315
+ * ```
2316
+ */
2317
+ getAssetDetails(params?: AssetDetailsRequest): Promise<AssetDetailsResponse>;
2318
+ /**
2319
+ * Get candlestick data for a market
2320
+ * @param params - Candlestick query parameters including market_id, resolution, and time range
2321
+ * @returns Array of candlestick data
2322
+ * @example
2323
+ * ```typescript
2324
+ * const candles = await client.getCandlesticks({
2325
+ * market_id: 1,
2326
+ * resolution: "1h",
2327
+ * start_timestamp: 1234567890,
2328
+ * end_timestamp: 1234567900
2329
+ * });
2330
+ * ```
2331
+ */
2332
+ getCandlesticks(params: CandlesRequest): Promise<CandlesResponse>;
2333
+ /**
2334
+ * Get funding history for a market
2335
+ * @param params - Funding query parameters including market_id and time range
2336
+ * @returns Array of funding data
2337
+ * @example
2338
+ * ```typescript
2339
+ * const fundings = await client.getFundings({
2340
+ * market_id: 1,
2341
+ * start_timestamp: 1234567890,
2342
+ * end_timestamp: 1234567900
2343
+ * });
2344
+ * ```
2345
+ */
2346
+ getFundings(params: FundingsRequest): Promise<FundingsResponse>;
2347
+ /**
2348
+ * Get exchange statistics
2349
+ * @returns Exchange-wide statistics including volume, fees, and markets
2350
+ * @example
2351
+ * ```typescript
2352
+ * const stats = await client.getExchangeStats();
2353
+ * ```
2354
+ */
2355
+ getExchangeStats(): Promise<ExchangeStatsResponse>;
2356
+ /**
2357
+ * Get fast bridge information
2358
+ * @returns Fast bridge configuration and status
2359
+ * @example
2360
+ * ```typescript
2361
+ * const bridgeInfo = await client.getFastBridgeInfo();
2362
+ * ```
2363
+ */
2364
+ getFastBridgeInfo(): Promise<FastBridgeInfoResponse>;
2365
+ /**
2366
+ * Get current funding rates for all markets
2367
+ * @returns Funding rates for all markets
2368
+ * @example
2369
+ * ```typescript
2370
+ * const rates = await client.getFundingRates();
2371
+ * ```
2372
+ */
2373
+ getFundingRates(): Promise<FundingRatesResponse>;
2374
+ /**
2375
+ * Get the next nonce for an account
2376
+ * @param params - Account index to get nonce for
2377
+ * @returns Next nonce value
2378
+ * @example
2379
+ * ```typescript
2380
+ * const nonce = await client.getNextNonce({ account_index: 0 });
2381
+ * ```
2382
+ */
2383
+ getNextNonce(params: NextNonceRequest): Promise<NextNonceResponse>;
2384
+ /**
2385
+ * Get all order books
2386
+ * @returns List of all order books with their configurations
2387
+ * @example
2388
+ * ```typescript
2389
+ * const orderBooks = await client.getOrderBooks();
2390
+ * ```
2391
+ */
2392
+ getOrderBooks(): Promise<OrderBooksResponse>;
2393
+ /**
2394
+ * Get detailed information about a specific order book
2395
+ * @param params - Optional market_id to get details for a specific market
2396
+ * @returns Order book details including market information
2397
+ * @example
2398
+ * ```typescript
2399
+ * const details = await client.getOrderBookDetails({ market_id: 1 });
2400
+ * ```
2401
+ */
2402
+ getOrderBookDetails(params?: OrderBookDetailsRequest): Promise<OrderBookDetailsResponse>;
2403
+ /**
2404
+ * Get orders in an order book
2405
+ * @param params - Market ID and optional depth/limit parameters
2406
+ * @returns Bids and asks in the order book
2407
+ * @example
2408
+ * ```typescript
2409
+ * const orders = await client.getOrderBookOrders({ market_id: 1, limit: 50 });
2410
+ * ```
2411
+ */
2412
+ getOrderBookOrders(params: OrderBookOrdersRequest): Promise<OrderBookOrdersResponse>;
2413
+ /**
2414
+ * Get recent trades for a market
2415
+ * @param params - Market ID and optional limit
2416
+ * @returns Recent trades for the market
2417
+ * @example
2418
+ * ```typescript
2419
+ * const trades = await client.getRecentTrades({ market_id: 1, limit: 50 });
2420
+ * ```
2421
+ */
2422
+ getRecentTrades(params: RecentTradesRequest): Promise<RecentTradesResponse>;
2423
+ /**
2424
+ * Get a specific transaction by hash
2425
+ * @param params - Transaction hash to look up
2426
+ * @returns Transaction details
2427
+ * @example
2428
+ * ```typescript
2429
+ * const tx = await client.getTransaction({ tx_hash: "0x..." });
2430
+ * ```
2431
+ */
2432
+ getTransaction(params: TransactionRequest): Promise<Transaction>;
2433
+ /**
2434
+ * Get transactions with optional filtering
2435
+ * @param params - Optional filter parameters for transaction queries
2436
+ * @returns List of transactions
2437
+ * @example
2438
+ * ```typescript
2439
+ * const txs = await client.getTransactions({ limit: 50 });
2440
+ * ```
2441
+ */
2442
+ getTransactions(params?: TransactionsRequest): Promise<TransactionsResponse>;
2443
+ /**
2444
+ * Get L2 transaction from L1 transaction hash
2445
+ * @param params - L1 transaction hash
2446
+ * @returns Corresponding L2 transaction
2447
+ * @example
2448
+ * ```typescript
2449
+ * const tx = await client.getTransactionFromL1TxHash({ l1_tx_hash: "0x..." });
2450
+ * ```
2451
+ */
2452
+ getTransactionFromL1TxHash(params: TransactionFromL1TxHashRequest): Promise<Transaction>;
2453
+ /**
2454
+ * Get withdrawal delay in seconds
2455
+ * @returns Withdrawal delay configuration
2456
+ * @example
2457
+ * ```typescript
2458
+ * const delay = await client.getWithdrawalDelay();
2459
+ * console.log(`Withdrawal delay: ${delay.seconds} seconds`);
2460
+ * ```
2461
+ */
2462
+ getWithdrawalDelay(): Promise<WithdrawalDelayResponse>;
2463
+ /**
2464
+ * Get root status information
2465
+ * @returns Root status including network status, network_id, and timestamp
2466
+ * @example
2467
+ * ```typescript
2468
+ * const status = await client.getRootStatus();
2469
+ * ```
2470
+ */
2471
+ getRootStatus(): Promise<RootStatusResponse>;
2472
+ }
2473
+
2474
+ interface Order {
2475
+ order_index: number;
2476
+ client_order_index: number;
2477
+ order_id: string;
2478
+ client_order_id: string;
2479
+ market_index: number;
2480
+ owner_account_index: number;
2481
+ initial_base_amount: string;
2482
+ price: string;
2483
+ nonce: number;
2484
+ remaining_base_amount: string;
2485
+ is_ask: boolean;
2486
+ base_size: number;
2487
+ base_price: number;
2488
+ filled_base_amount: string;
2489
+ filled_quote_amount: string;
2490
+ side: string;
2491
+ type: string;
2492
+ time_in_force: string;
2493
+ reduce_only: boolean;
2494
+ trigger_price: string;
2495
+ order_expiry: number;
2496
+ status: string;
2497
+ trigger_status: string;
2498
+ trigger_time: number;
2499
+ parent_order_index: number;
2500
+ parent_order_id: string;
2501
+ to_trigger_order_id_0?: string;
2502
+ to_trigger_order_id_1?: string;
2503
+ to_cancel_order_id_0?: string;
2504
+ to_cancel_order_id_1?: string;
2505
+ block_height: number;
2506
+ timestamp: number;
2507
+ }
2508
+ interface Orders {
2509
+ code: number;
2510
+ orders: Order[];
2511
+ }
2512
+ interface AccountInactiveOrdersRequest {
2513
+ account_index: number;
2514
+ limit: number;
2515
+ auth?: string;
2516
+ market_id?: number;
2517
+ ask_filter?: number;
2518
+ between_timestamps?: string;
2519
+ cursor?: string;
2520
+ }
2521
+ declare function getAccountInactiveOrders(client: AxiosInstance, params: AccountInactiveOrdersRequest, authorization?: string): Promise<Orders>;
2522
+
2523
+ interface AccountActiveOrdersRequest {
2524
+ account_index: number;
2525
+ market_id: number;
2526
+ auth?: string;
2527
+ }
2528
+ declare function getAccountActiveOrders(client: AxiosInstance, params: AccountActiveOrdersRequest, authorization?: string): Promise<Orders>;
2529
+
2530
+ interface AccountLimitsRequest {
2531
+ account_index: number;
2532
+ auth?: string;
2533
+ }
2534
+ interface AccountLimitsResponse {
2535
+ code: number;
2536
+ message?: string;
2537
+ max_llp_percentage: number;
2538
+ user_tier: string;
2539
+ can_create_public_pool: boolean;
2540
+ }
2541
+ declare function getAccountLimits(client: AxiosInstance, params: AccountLimitsRequest, authorization?: string): Promise<AccountLimitsResponse>;
2542
+
2543
+ interface AccountMetadataRequest {
2544
+ by: "index" | "l1_address";
2545
+ value: string;
2546
+ auth?: string;
2547
+ }
2548
+ interface AccountMetadataInfo {
2549
+ account_index: number;
2550
+ name: string;
2551
+ description: string;
2552
+ can_invite: boolean;
2553
+ referral_points_percentage: string;
2554
+ }
2555
+ interface AccountMetadataResponse {
2556
+ code: number;
2557
+ message?: string;
2558
+ account_metadatas: AccountMetadataInfo;
2559
+ }
2560
+ declare function getAccountMetadata(client: AxiosInstance, params: AccountMetadataRequest, authorization?: string): Promise<AccountMetadataResponse>;
2561
+
2562
+ interface DepositHistoryRequest {
2563
+ account_index: number;
2564
+ l1_address: string;
2565
+ cursor?: string;
2566
+ filter?: string;
2567
+ }
2568
+ interface DepositHistoryItem {
2569
+ id: string;
2570
+ account_index: number;
2571
+ l1_address: string;
2572
+ l2_address: string;
2573
+ amount: string;
2574
+ l1_tx_hash: string;
2575
+ status: string;
2576
+ timestamp: number;
2577
+ created_at: string;
2578
+ }
2579
+ interface DepositHistoryResponse {
2580
+ code: number;
2581
+ deposits: DepositHistoryItem[];
2582
+ cursor?: string;
2583
+ }
2584
+ declare function getDepositHistory(client: AxiosInstance, params: DepositHistoryRequest, authorization?: string): Promise<DepositHistoryResponse>;
2585
+
2586
+ interface ExportRequest {
2587
+ type: "funding" | "trade";
2588
+ account_index?: number;
2589
+ market_id?: number;
2590
+ auth?: string;
2591
+ }
2592
+ interface ExportResponse {
2593
+ code: number;
2594
+ message?: string;
2595
+ data_url: string;
2596
+ }
2597
+ declare function getExport(client: AxiosInstance, params: ExportRequest, authorization?: string): Promise<ExportResponse>;
2598
+
2599
+ interface FastWithdrawInfoRequest {
2600
+ account_index: number;
2601
+ auth?: string;
2602
+ }
2603
+ interface FastWithdrawInfoResponse {
2604
+ code: number;
2605
+ message?: string;
2606
+ to_account_index: number;
2607
+ withdraw_limit: string;
2608
+ max_withdrawal_amount: string;
2609
+ }
2610
+ declare function getFastWithdrawInfo(client: AxiosInstance, params: FastWithdrawInfoRequest, authorization?: string): Promise<FastWithdrawInfoResponse>;
2611
+
2612
+ interface L1MetadataRequest {
2613
+ l1_address: string;
2614
+ auth?: string;
2615
+ }
2616
+ interface L1MetadataResponse {
2617
+ code: number;
2618
+ message?: string;
2619
+ l1_address: string;
2620
+ can_invite: boolean;
2621
+ referral_points_percentage: string;
2622
+ }
2623
+ declare function getL1Metadata(client: AxiosInstance, params: L1MetadataRequest, authorization?: string): Promise<L1MetadataResponse>;
2624
+
2625
+ interface LiquidationsRequest {
2626
+ account_index: number;
2627
+ market_id?: number;
2628
+ cursor?: string;
2629
+ limit: number;
2630
+ auth?: string;
2631
+ }
2632
+ interface LiquidationTrade {
2633
+ price: string;
2634
+ size: string;
2635
+ taker_fee: string;
2636
+ maker_fee: string;
2637
+ }
2638
+ interface LiquidationPosition {
2639
+ market_id: number;
2640
+ symbol: string;
2641
+ initial_margin_fraction: string;
2642
+ open_order_count: number;
2643
+ pending_order_count: number;
2644
+ position_tied_order_count: number;
2645
+ sign: number;
2646
+ position: string;
2647
+ avg_entry_price: string;
2648
+ position_value: string;
2649
+ unrealized_pnl: string;
2650
+ realized_pnl: string;
2651
+ liquidation_price: string;
2652
+ total_funding_paid_out?: string;
2653
+ margin_mode: number;
2654
+ allocated_margin: string;
2655
+ }
2656
+ interface RiskParameters {
2657
+ market_id: number;
2658
+ collateral: string;
2659
+ total_account_value: string;
2660
+ initial_margin_req: string;
2661
+ maintenance_margin_req: string;
2662
+ close_out_margin_req: string;
2663
+ }
2664
+ interface RiskInfo {
2665
+ cross_risk_parameters: RiskParameters;
2666
+ isolated_risk_parameters: RiskParameters[];
2667
+ }
2668
+ interface LiquidationInfoObject {
2669
+ positions: LiquidationPosition[];
2670
+ risk_info_before: RiskInfo;
2671
+ risk_info_after: RiskInfo;
2672
+ mark_prices: Record<string, any>;
2673
+ }
2674
+ interface LiquidationInfo {
2675
+ id: string;
2676
+ market_id: number;
2677
+ type: "partial" | "deleverage";
2678
+ trade: LiquidationTrade;
2679
+ info: LiquidationInfoObject;
2680
+ executed_at: number;
2681
+ }
2682
+ interface LiquidationsResponse {
2683
+ code: number;
2684
+ liquidations: LiquidationInfo[];
2685
+ }
2686
+ declare function getLiquidations(client: AxiosInstance, params: LiquidationsRequest, authorization?: string): Promise<LiquidationsResponse>;
2687
+
2688
+ interface PnLRequest {
2689
+ by: string;
2690
+ value: string;
2691
+ resolution: string;
2692
+ start_timestamp: number;
2693
+ end_timestamp: number;
2694
+ count_back: number;
2695
+ auth?: string;
2696
+ ignore_transfers?: boolean;
2697
+ }
2698
+ interface PnLEntry {
2699
+ timestamp: number;
2700
+ pnl: string;
2701
+ cumulative_pnl: string;
2702
+ }
2703
+ interface PnLResponse {
2704
+ code: number;
2705
+ entries: PnLEntry[];
2706
+ }
2707
+ declare function getPnL(client: AxiosInstance, params: PnLRequest, authorization?: string): Promise<PnLResponse>;
2708
+
2709
+ interface PositionFundingRequest {
2710
+ account_index: number;
2711
+ limit: number;
2712
+ market_id?: number;
2713
+ cursor?: string;
2714
+ side?: "long" | "short" | "all";
2715
+ auth?: string;
2716
+ }
2717
+ interface PositionFundingItem {
2718
+ timestamp: number;
2719
+ market_id: number;
2720
+ funding_id: number;
2721
+ change: string;
2722
+ rate: string;
2723
+ position_size: string;
2724
+ position_side: "long" | "short";
2725
+ }
2726
+ interface PositionFundingResponse {
2727
+ code: number;
2728
+ message?: string;
2729
+ position_fundings: PositionFundingItem[];
2730
+ next_cursor?: string;
2731
+ }
2732
+ declare function getPositionFunding(client: AxiosInstance, params: PositionFundingRequest, authorization?: string): Promise<PositionFundingResponse>;
2733
+
2734
+ interface PublicPoolsRequest {
2735
+ filter?: string;
2736
+ limit?: number;
2737
+ index?: number;
2738
+ }
2739
+ interface PublicPoolShare {
2740
+ token: string;
2741
+ amount: string;
2742
+ value: string;
2743
+ }
2744
+ interface PublicPool {
2745
+ id: string;
2746
+ name: string;
2747
+ description: string;
2748
+ total_value_locked: string;
2749
+ apy: string;
2750
+ shares: PublicPoolShare[];
2751
+ }
2752
+ type PublicPoolsResponse = PublicPool[];
2753
+ declare function getPublicPools(client: AxiosInstance, params?: PublicPoolsRequest, authorization?: string): Promise<PublicPoolsResponse>;
2754
+
2755
+ interface ReferralPointsRequest {
2756
+ account_index: number;
2757
+ }
2758
+ interface ReferralPointEntry {
2759
+ l1_address: string;
2760
+ total_points: number;
2761
+ week_points: number;
2762
+ total_reward_points: number;
2763
+ week_reward_points: number;
2764
+ reward_point_multiplier: string;
2765
+ }
2766
+ interface ReferralPointsResponse {
2767
+ referrals: ReferralPointEntry[];
2768
+ user_total_points: number;
2769
+ user_last_week_points: number;
2770
+ user_total_referral_reward_points: number;
2771
+ user_last_week_referral_reward_points: number;
2772
+ reward_point_multiplier: string;
2773
+ }
2774
+ declare function getReferralPoints(client: AxiosInstance, params: ReferralPointsRequest, authorization?: string): Promise<ReferralPointsResponse>;
2775
+
2776
+ interface TokensRequest {
2777
+ account_index: number;
2778
+ auth?: string;
2779
+ }
2780
+ interface ApiToken {
2781
+ token_id: number;
2782
+ api_token: string;
2783
+ name: string;
2784
+ account_index: number;
2785
+ expiry: number;
2786
+ sub_account_access: boolean;
2787
+ revoked: boolean;
2788
+ scopes: string;
2789
+ }
2790
+ interface TokensResponse {
2791
+ code: number;
2792
+ message?: string;
2793
+ api_tokens: ApiToken[];
2794
+ }
2795
+ declare function getTokens(client: AxiosInstance, params: TokensRequest, authorization?: string): Promise<TokensResponse>;
2796
+
2797
+ interface TransferFeeInfoRequest {
2798
+ account_index: number;
2799
+ to_account_index?: number;
2800
+ auth?: string;
2801
+ }
2802
+ interface TransferFeeInfoResponse {
2803
+ code: number;
2804
+ message?: string;
2805
+ transfer_fee_usdc: number;
2806
+ }
2807
+ declare function getTransferFeeInfo(client: AxiosInstance, params: TransferFeeInfoRequest, authorization?: string): Promise<TransferFeeInfoResponse>;
2808
+
2809
+ interface TransferHistoryRequest {
2810
+ account_index: number;
2811
+ cursor?: string;
2812
+ auth?: string;
2813
+ }
2814
+ interface Transfer {
2815
+ id: string;
2816
+ amount: string;
2817
+ timestamp: number;
2818
+ type: "L2TransferInflow" | "L2TransferOutflow" | "L2BurnSharesInflow" | "L2BurnSharesOutflow" | "L2MintSharesInflow" | "L2MintSharesOutflow";
2819
+ from_l1_address: string;
2820
+ to_l1_address: string;
2821
+ from_account_index: number;
2822
+ to_account_index: number;
2823
+ tx_hash: string;
2824
+ }
2825
+ interface TransferHistoryResponse {
2826
+ code: number;
2827
+ message?: string;
2828
+ transfers: Transfer[];
2829
+ cursor: string;
2830
+ }
2831
+ declare function getTransferHistory(client: AxiosInstance, params: TransferHistoryRequest, authorization?: string): Promise<TransferHistoryResponse>;
2832
+
2833
+ interface WithdrawHistoryRequest {
2834
+ account_index: number;
2835
+ l1_address: string;
2836
+ cursor?: string;
2837
+ filter?: string;
2838
+ }
2839
+ interface WithdrawHistoryItem {
2840
+ id: string;
2841
+ account_index: number;
2842
+ l1_address: string;
2843
+ l2_address: string;
2844
+ amount: string;
2845
+ l1_tx_hash: string;
2846
+ status: string;
2847
+ timestamp: number;
2848
+ created_at: string;
2849
+ }
2850
+ interface WithdrawHistoryResponse {
2851
+ code: number;
2852
+ withdrawals: WithdrawHistoryItem[];
2853
+ cursor?: string;
2854
+ }
2855
+ declare function getWithdrawHistory(client: AxiosInstance, params: WithdrawHistoryRequest, authorization?: string): Promise<WithdrawHistoryResponse>;
2856
+
2857
+ type index$1_AccountActiveOrdersRequest = AccountActiveOrdersRequest;
2858
+ type index$1_AccountInactiveOrdersRequest = AccountInactiveOrdersRequest;
2859
+ type index$1_AccountLimitsRequest = AccountLimitsRequest;
2860
+ type index$1_AccountLimitsResponse = AccountLimitsResponse;
2861
+ type index$1_AccountMetadataInfo = AccountMetadataInfo;
2862
+ type index$1_AccountMetadataRequest = AccountMetadataRequest;
2863
+ type index$1_AccountMetadataResponse = AccountMetadataResponse;
2864
+ type index$1_ApiToken = ApiToken;
2865
+ type index$1_DepositHistoryItem = DepositHistoryItem;
2866
+ type index$1_DepositHistoryRequest = DepositHistoryRequest;
2867
+ type index$1_DepositHistoryResponse = DepositHistoryResponse;
2868
+ type index$1_ExportRequest = ExportRequest;
2869
+ type index$1_ExportResponse = ExportResponse;
2870
+ type index$1_FastWithdrawInfoRequest = FastWithdrawInfoRequest;
2871
+ type index$1_FastWithdrawInfoResponse = FastWithdrawInfoResponse;
2872
+ type index$1_L1MetadataRequest = L1MetadataRequest;
2873
+ type index$1_L1MetadataResponse = L1MetadataResponse;
2874
+ type index$1_LiquidationInfo = LiquidationInfo;
2875
+ type index$1_LiquidationInfoObject = LiquidationInfoObject;
2876
+ type index$1_LiquidationPosition = LiquidationPosition;
2877
+ type index$1_LiquidationTrade = LiquidationTrade;
2878
+ type index$1_LiquidationsRequest = LiquidationsRequest;
2879
+ type index$1_LiquidationsResponse = LiquidationsResponse;
2880
+ type index$1_Order = Order;
2881
+ type index$1_Orders = Orders;
2882
+ type index$1_PnLEntry = PnLEntry;
2883
+ type index$1_PnLRequest = PnLRequest;
2884
+ type index$1_PnLResponse = PnLResponse;
2885
+ type index$1_PositionFundingItem = PositionFundingItem;
2886
+ type index$1_PositionFundingRequest = PositionFundingRequest;
2887
+ type index$1_PositionFundingResponse = PositionFundingResponse;
2888
+ type index$1_PublicPool = PublicPool;
2889
+ type index$1_PublicPoolShare = PublicPoolShare;
2890
+ type index$1_PublicPoolsRequest = PublicPoolsRequest;
2891
+ type index$1_PublicPoolsResponse = PublicPoolsResponse;
2892
+ type index$1_ReferralPointEntry = ReferralPointEntry;
2893
+ type index$1_ReferralPointsRequest = ReferralPointsRequest;
2894
+ type index$1_ReferralPointsResponse = ReferralPointsResponse;
2895
+ type index$1_RiskInfo = RiskInfo;
2896
+ type index$1_RiskParameters = RiskParameters;
2897
+ type index$1_TokensRequest = TokensRequest;
2898
+ type index$1_TokensResponse = TokensResponse;
2899
+ type index$1_Trade = Trade;
2900
+ type index$1_TradesRequest = TradesRequest;
2901
+ type index$1_TradesResponse = TradesResponse;
2902
+ type index$1_Transfer = Transfer;
2903
+ type index$1_TransferFeeInfoRequest = TransferFeeInfoRequest;
2904
+ type index$1_TransferFeeInfoResponse = TransferFeeInfoResponse;
2905
+ type index$1_TransferHistoryRequest = TransferHistoryRequest;
2906
+ type index$1_TransferHistoryResponse = TransferHistoryResponse;
2907
+ type index$1_WithdrawHistoryItem = WithdrawHistoryItem;
2908
+ type index$1_WithdrawHistoryRequest = WithdrawHistoryRequest;
2909
+ type index$1_WithdrawHistoryResponse = WithdrawHistoryResponse;
2910
+ declare const index$1_getAccountActiveOrders: typeof getAccountActiveOrders;
2911
+ declare const index$1_getAccountInactiveOrders: typeof getAccountInactiveOrders;
2912
+ declare const index$1_getAccountLimits: typeof getAccountLimits;
2913
+ declare const index$1_getAccountMetadata: typeof getAccountMetadata;
2914
+ declare const index$1_getDepositHistory: typeof getDepositHistory;
2915
+ declare const index$1_getExport: typeof getExport;
2916
+ declare const index$1_getFastWithdrawInfo: typeof getFastWithdrawInfo;
2917
+ declare const index$1_getL1Metadata: typeof getL1Metadata;
2918
+ declare const index$1_getLiquidations: typeof getLiquidations;
2919
+ declare const index$1_getPnL: typeof getPnL;
2920
+ declare const index$1_getPositionFunding: typeof getPositionFunding;
2921
+ declare const index$1_getPublicPools: typeof getPublicPools;
2922
+ declare const index$1_getReferralPoints: typeof getReferralPoints;
2923
+ declare const index$1_getTokens: typeof getTokens;
2924
+ declare const index$1_getTrades: typeof getTrades;
2925
+ declare const index$1_getTransferFeeInfo: typeof getTransferFeeInfo;
2926
+ declare const index$1_getTransferHistory: typeof getTransferHistory;
2927
+ declare const index$1_getWithdrawHistory: typeof getWithdrawHistory;
2928
+ declare namespace index$1 {
2929
+ export { type index$1_AccountActiveOrdersRequest as AccountActiveOrdersRequest, type index$1_AccountInactiveOrdersRequest as AccountInactiveOrdersRequest, type index$1_AccountLimitsRequest as AccountLimitsRequest, type index$1_AccountLimitsResponse as AccountLimitsResponse, type index$1_AccountMetadataInfo as AccountMetadataInfo, type index$1_AccountMetadataRequest as AccountMetadataRequest, type index$1_AccountMetadataResponse as AccountMetadataResponse, type index$1_ApiToken as ApiToken, type index$1_DepositHistoryItem as DepositHistoryItem, type index$1_DepositHistoryRequest as DepositHistoryRequest, type index$1_DepositHistoryResponse as DepositHistoryResponse, type index$1_ExportRequest as ExportRequest, type index$1_ExportResponse as ExportResponse, type index$1_FastWithdrawInfoRequest as FastWithdrawInfoRequest, type index$1_FastWithdrawInfoResponse as FastWithdrawInfoResponse, type index$1_L1MetadataRequest as L1MetadataRequest, type index$1_L1MetadataResponse as L1MetadataResponse, type index$1_LiquidationInfo as LiquidationInfo, type index$1_LiquidationInfoObject as LiquidationInfoObject, type index$1_LiquidationPosition as LiquidationPosition, type index$1_LiquidationTrade as LiquidationTrade, type index$1_LiquidationsRequest as LiquidationsRequest, type index$1_LiquidationsResponse as LiquidationsResponse, type index$1_Order as Order, type index$1_Orders as Orders, type index$1_PnLEntry as PnLEntry, type index$1_PnLRequest as PnLRequest, type index$1_PnLResponse as PnLResponse, type index$1_PositionFundingItem as PositionFundingItem, type index$1_PositionFundingRequest as PositionFundingRequest, type index$1_PositionFundingResponse as PositionFundingResponse, type index$1_PublicPool as PublicPool, type index$1_PublicPoolShare as PublicPoolShare, type index$1_PublicPoolsRequest as PublicPoolsRequest, type index$1_PublicPoolsResponse as PublicPoolsResponse, type index$1_ReferralPointEntry as ReferralPointEntry, type index$1_ReferralPointsRequest as ReferralPointsRequest, type index$1_ReferralPointsResponse as ReferralPointsResponse, type index$1_RiskInfo as RiskInfo, type index$1_RiskParameters as RiskParameters, type index$1_TokensRequest as TokensRequest, type index$1_TokensResponse as TokensResponse, type index$1_Trade as Trade, type index$1_TradesRequest as TradesRequest, type index$1_TradesResponse as TradesResponse, type index$1_Transfer as Transfer, type index$1_TransferFeeInfoRequest as TransferFeeInfoRequest, type index$1_TransferFeeInfoResponse as TransferFeeInfoResponse, type index$1_TransferHistoryRequest as TransferHistoryRequest, type index$1_TransferHistoryResponse as TransferHistoryResponse, type index$1_WithdrawHistoryItem as WithdrawHistoryItem, type index$1_WithdrawHistoryRequest as WithdrawHistoryRequest, type index$1_WithdrawHistoryResponse as WithdrawHistoryResponse, index$1_getAccountActiveOrders as getAccountActiveOrders, index$1_getAccountInactiveOrders as getAccountInactiveOrders, index$1_getAccountLimits as getAccountLimits, index$1_getAccountMetadata as getAccountMetadata, index$1_getDepositHistory as getDepositHistory, index$1_getExport as getExport, index$1_getFastWithdrawInfo as getFastWithdrawInfo, index$1_getL1Metadata as getL1Metadata, index$1_getLiquidations as getLiquidations, index$1_getPnL as getPnL, index$1_getPositionFunding as getPositionFunding, index$1_getPublicPools as getPublicPools, index$1_getReferralPoints as getReferralPoints, index$1_getTokens as getTokens, index$1_getTrades as getTrades, index$1_getTransferFeeInfo as getTransferFeeInfo, index$1_getTransferHistory as getTransferHistory, index$1_getWithdrawHistory as getWithdrawHistory };
2930
+ }
2931
+
2932
+ interface InfoPrivateClientConfig {
2933
+ baseURL?: string;
2934
+ txClient: TxClient;
2935
+ }
2936
+ /**
2937
+ * InfoPrivateClient - Client for private/authenticated info endpoints
2938
+ *
2939
+ * Provides access to API endpoints that require authentication.
2940
+ * Authentication is handled automatically using the provided TxClient.
2941
+ *
2942
+ * @example
2943
+ * ```typescript
2944
+ * const txClient = createClient(httpClient, privateKey, chainId, apiKeyIndex, accountIndex);
2945
+ * const client = new InfoPrivateClient({
2946
+ * baseURL: "https://mainnet.zklighter.elliot.ai",
2947
+ * txClient
2948
+ * });
2949
+ *
2950
+ * const orders = await client.getAccountActiveOrders({
2951
+ * account_index: 0,
2952
+ * market_id: 1
2953
+ * });
2954
+ * ```
2955
+ */
2956
+ declare class InfoPrivateClient {
2957
+ private readonly baseURL;
2958
+ private readonly axiosInstance;
2959
+ private readonly txClient;
2960
+ constructor(config: InfoPrivateClientConfig);
2961
+ private createAxiosInstance;
2962
+ /**
2963
+ * Get the axios instance for custom requests
2964
+ */
2965
+ getAxiosInstance(): AxiosInstance;
2966
+ /**
2967
+ * Get active orders for an account in a specific market
2968
+ * @param params - Account index and market ID to retrieve active orders for
2969
+ * @returns List of active orders
2970
+ * @example
2971
+ * ```typescript
2972
+ * const orders = await client.getAccountActiveOrders({
2973
+ * account_index: 0,
2974
+ * market_id: 1
2975
+ * });
2976
+ * ```
2977
+ */
2978
+ getAccountActiveOrders(params: AccountActiveOrdersRequest): Promise<Orders>;
2979
+ /**
2980
+ * Get inactive orders for an account
2981
+ * @param params - Account index and optional filters for inactive orders
2982
+ * @returns List of inactive orders with pagination support
2983
+ * @example
2984
+ * ```typescript
2985
+ * const orders = await client.getAccountInactiveOrders({
2986
+ * account_index: 0,
2987
+ * limit: 50,
2988
+ * market_id: 1
2989
+ * });
2990
+ * ```
2991
+ */
2992
+ getAccountInactiveOrders(params: AccountInactiveOrdersRequest): Promise<Orders>;
2993
+ /**
2994
+ * Get account limits and tier information
2995
+ * @param params - Account index to retrieve limits for
2996
+ * @returns Account limits including max LLP percentage, user tier, and pool creation permissions
2997
+ * @example
2998
+ * ```typescript
2999
+ * const limits = await client.getAccountLimits({ account_index: 0 });
3000
+ * ```
3001
+ */
3002
+ getAccountLimits(params: AccountLimitsRequest): Promise<AccountLimitsResponse>;
3003
+ /**
3004
+ * Get account metadata by index or L1 address
3005
+ * @param params - Account index or L1 address to retrieve metadata for
3006
+ * @returns Account metadata including account index, L1 address, and public key
3007
+ * @example
3008
+ * ```typescript
3009
+ * const metadata = await client.getAccountMetadata({ account_index: 0 });
3010
+ * ```
3011
+ */
3012
+ getAccountMetadata(params: AccountMetadataRequest): Promise<AccountMetadataResponse>;
3013
+ /**
3014
+ * Get L1 metadata for an address
3015
+ * @param params - L1 address to retrieve metadata for
3016
+ * @returns L1 metadata including all account indices associated with the address
3017
+ * @example
3018
+ * ```typescript
3019
+ * const metadata = await client.getL1Metadata({ l1_address: '0x...' });
3020
+ * ```
3021
+ */
3022
+ getL1Metadata(params: L1MetadataRequest): Promise<L1MetadataResponse>;
3023
+ /**
3024
+ * Get API tokens for an account
3025
+ * @param params - Account index to retrieve tokens for
3026
+ * @returns List of API tokens with their creation dates and expiry information
3027
+ * @example
3028
+ * ```typescript
3029
+ * const tokens = await client.getTokens({ account_index: 0 });
3030
+ * ```
3031
+ */
3032
+ getTokens(params: TokensRequest): Promise<TokensResponse>;
3033
+ /**
3034
+ * Get deposit history for an account
3035
+ * @param params - Account index and optional filters
3036
+ * @returns List of deposits with pagination support
3037
+ * @example
3038
+ * ```typescript
3039
+ * const deposits = await client.getDepositHistory({
3040
+ * account_index: 0,
3041
+ * limit: 50
3042
+ * });
3043
+ * ```
3044
+ */
3045
+ getDepositHistory(params: DepositHistoryRequest): Promise<DepositHistoryResponse>;
3046
+ /**
3047
+ * Get withdrawal history for an account
3048
+ * @param params - Account index and optional filters
3049
+ * @returns List of withdrawals with pagination support
3050
+ * @example
3051
+ * ```typescript
3052
+ * const withdrawals = await client.getWithdrawHistory({
3053
+ * account_index: 0,
3054
+ * limit: 50
3055
+ * });
3056
+ * ```
3057
+ */
3058
+ getWithdrawHistory(params: WithdrawHistoryRequest): Promise<WithdrawHistoryResponse>;
3059
+ /**
3060
+ * Get fast withdraw information for an account
3061
+ * @param params - Account index to retrieve fast withdraw info for
3062
+ * @returns Fast withdraw information including available liquidity and fees
3063
+ * @example
3064
+ * ```typescript
3065
+ * const info = await client.getFastWithdrawInfo({ account_index: 0 });
3066
+ * ```
3067
+ */
3068
+ getFastWithdrawInfo(params: FastWithdrawInfoRequest): Promise<FastWithdrawInfoResponse>;
3069
+ /**
3070
+ * Get transfer fee information between accounts
3071
+ * @param params - From and to account indices and optional asset index
3072
+ * @returns Transfer fee information including fee amount and fee percentage
3073
+ * @example
3074
+ * ```typescript
3075
+ * const feeInfo = await client.getTransferFeeInfo({
3076
+ * from_account_index: 0,
3077
+ * to_account_index: 1
3078
+ * });
3079
+ * ```
3080
+ */
3081
+ getTransferFeeInfo(params: TransferFeeInfoRequest): Promise<TransferFeeInfoResponse>;
3082
+ /**
3083
+ * Get transfer history for an account
3084
+ * @param params - Account index and optional filters
3085
+ * @returns List of transfers with pagination support
3086
+ * @example
3087
+ * ```typescript
3088
+ * const transfers = await client.getTransferHistory({
3089
+ * account_index: 0,
3090
+ * limit: 50
3091
+ * });
3092
+ * ```
3093
+ */
3094
+ getTransferHistory(params: TransferHistoryRequest): Promise<TransferHistoryResponse>;
3095
+ /**
3096
+ * Get liquidation history for an account
3097
+ * @param params - Account index and optional filters
3098
+ * @returns List of liquidations with pagination support
3099
+ * @example
3100
+ * ```typescript
3101
+ * const liquidations = await client.getLiquidations({
3102
+ * account_index: 0,
3103
+ * limit: 50
3104
+ * });
3105
+ * ```
3106
+ */
3107
+ getLiquidations(params: LiquidationsRequest): Promise<LiquidationsResponse>;
3108
+ /**
3109
+ * Get profit and loss data for an account or market
3110
+ * @param params - Account index and optional market ID
3111
+ * @returns PnL data including realized and unrealized PnL
3112
+ * @example
3113
+ * ```typescript
3114
+ * const pnl = await client.getPnL({
3115
+ * account_index: 0,
3116
+ * market_id: 1
3117
+ * });
3118
+ * ```
3119
+ */
3120
+ getPnL(params: PnLRequest): Promise<PnLResponse>;
3121
+ /**
3122
+ * Get position funding history for an account
3123
+ * @param params - Account index and optional filters
3124
+ * @returns List of funding payments with pagination support
3125
+ * @example
3126
+ * ```typescript
3127
+ * const funding = await client.getPositionFunding({
3128
+ * account_index: 0,
3129
+ * limit: 50
3130
+ * });
3131
+ * ```
3132
+ */
3133
+ getPositionFunding(params: PositionFundingRequest): Promise<PositionFundingResponse>;
3134
+ /**
3135
+ * Get public liquidity pools metadata
3136
+ * @param params - Optional account index to filter by owner
3137
+ * @returns List of public pools with metadata
3138
+ * @example
3139
+ * ```typescript
3140
+ * const pools = await client.getPublicPools({ account_index: 0 });
3141
+ * ```
3142
+ */
3143
+ getPublicPools(params?: PublicPoolsRequest): Promise<PublicPoolsResponse>;
3144
+ /**
3145
+ * Get referral points for an account
3146
+ * @param params - Account index to retrieve referral points for
3147
+ * @returns Referral points data including total points and referral code
3148
+ * @example
3149
+ * ```typescript
3150
+ * const points = await client.getReferralPoints({ account_index: 0 });
3151
+ * ```
3152
+ */
3153
+ getReferralPoints(params: ReferralPointsRequest): Promise<ReferralPointsResponse>;
3154
+ /**
3155
+ * Get trades for an account or market
3156
+ * @param params - Account index and optional market ID and filters
3157
+ * @returns List of trades with pagination support
3158
+ * @example
3159
+ * ```typescript
3160
+ * const trades = await client.getTrades({
3161
+ * account_index: 0,
3162
+ * market_id: 1,
3163
+ * limit: 50
3164
+ * });
3165
+ * ```
3166
+ */
3167
+ getTrades(params: TradesRequest): Promise<TradesResponse>;
3168
+ /**
3169
+ * Export data (funding or trade data) for an account
3170
+ * @param params - Account index and export type
3171
+ * @returns Export data in CSV format
3172
+ * @example
3173
+ * ```typescript
3174
+ * const exportData = await client.getExport({
3175
+ * account_index: 0,
3176
+ * export_type: 'trades'
3177
+ * });
3178
+ * ```
3179
+ */
3180
+ getExport(params: ExportRequest): Promise<ExportResponse>;
3181
+ }
3182
+
3183
+ interface ChangeAccountTierRequest {
3184
+ account_index: number;
3185
+ new_tier: string;
3186
+ auth?: string;
3187
+ }
3188
+ interface ChangeAccountTierResponse {
3189
+ code: number;
3190
+ message?: string;
3191
+ }
3192
+ declare function changeAccountTier(client: AxiosInstance, params: ChangeAccountTierRequest, authorization?: string): Promise<ChangeAccountTierResponse>;
3193
+
3194
+ interface FastWithdrawRequest {
3195
+ tx_info: string;
3196
+ to_address: string;
3197
+ auth?: string;
3198
+ }
3199
+ interface FastWithdrawResponse {
3200
+ code: number;
3201
+ message?: string;
3202
+ }
3203
+ declare function fastWithdraw(client: AxiosInstance, params: FastWithdrawRequest, authorization?: string): Promise<FastWithdrawResponse>;
3204
+
3205
+ interface NotificationAckRequest {
3206
+ notif_id: string;
3207
+ account_index: number;
3208
+ }
3209
+ interface NotificationAckResponse {
3210
+ code: number;
3211
+ message?: string;
3212
+ }
3213
+ declare function acknowledgeNotification(client: AxiosInstance, params: NotificationAckRequest, authorization?: string): Promise<NotificationAckResponse>;
3214
+
3215
+ interface SendTransactionRequest {
3216
+ account_index: number;
3217
+ api_key_index: number;
3218
+ transaction: string;
3219
+ price_protection?: boolean;
3220
+ }
3221
+ interface SendTxFormRequest {
3222
+ tx_type: number;
3223
+ tx_info: string;
3224
+ price_protection?: boolean;
3225
+ }
3226
+ interface SendTxWithIndicesRequest {
3227
+ tx_type: number;
3228
+ tx_info: string;
3229
+ account_index: number;
3230
+ api_key_index: number;
3231
+ price_protection?: boolean;
3232
+ }
3233
+ interface TxHashResponse {
3234
+ hash?: string;
3235
+ tx_hash?: string;
3236
+ code?: number;
3237
+ message?: string;
3238
+ predicted_execution_time_ms?: number;
3239
+ }
3240
+ declare function sendTransaction(client: AxiosInstance, params: SendTransactionRequest): Promise<TxHashResponse>;
3241
+ declare function sendTx(client: AxiosInstance, params: SendTxFormRequest): Promise<TxHashResponse>;
3242
+ declare function sendTxWithIndices(client: AxiosInstance, params: SendTxWithIndicesRequest): Promise<TxHashResponse>;
3243
+ declare function sendTxJson(client: AxiosInstance, params: SendTxWithIndicesRequest): Promise<TxHashResponse>;
3244
+
3245
+ interface SendTransactionBatchFormRequest {
3246
+ tx_types: string;
3247
+ tx_infos: string;
3248
+ }
3249
+ interface SendTransactionBatchJsonRequest {
3250
+ account_index: number;
3251
+ api_key_index: number;
3252
+ transactions: string[];
3253
+ }
3254
+ type SendTransactionBatchRequest = SendTransactionBatchFormRequest | SendTransactionBatchJsonRequest;
3255
+ interface TxHashesResponse {
3256
+ hashes?: string[];
3257
+ tx_hash?: string[];
3258
+ code?: number;
3259
+ message?: string;
3260
+ predicted_execution_time_ms?: number;
3261
+ }
3262
+ declare function sendTransactionBatch(client: AxiosInstance, params: SendTransactionBatchRequest): Promise<TxHashesResponse>;
3263
+
3264
+ interface TokensCreateRequest {
3265
+ name: string;
3266
+ account_index: number;
3267
+ expiry: number;
3268
+ sub_account_access: boolean;
3269
+ scopes?: string;
3270
+ }
3271
+ interface TokensCreateResponse {
3272
+ code: number;
3273
+ message?: string;
3274
+ token_id: number;
3275
+ api_token: string;
3276
+ name: string;
3277
+ account_index: number;
3278
+ expiry: number;
3279
+ sub_account_access: boolean;
3280
+ revoked: boolean;
3281
+ scopes: string;
3282
+ }
3283
+ declare function createToken(client: AxiosInstance, params: TokensCreateRequest, authorization?: string): Promise<TokensCreateResponse>;
3284
+
3285
+ interface TokensRevokeRequest {
3286
+ token_id: number;
3287
+ account_index: number;
3288
+ }
3289
+ interface TokensRevokeResponse {
3290
+ code: number;
3291
+ message?: string;
3292
+ token_id: number;
3293
+ revoked: boolean;
3294
+ }
3295
+ declare function revokeToken(client: AxiosInstance, params: TokensRevokeRequest, authorization?: string): Promise<TokensRevokeResponse>;
3296
+
3297
+ type index_ChangeAccountTierRequest = ChangeAccountTierRequest;
3298
+ type index_ChangeAccountTierResponse = ChangeAccountTierResponse;
3299
+ type index_FastWithdrawRequest = FastWithdrawRequest;
3300
+ type index_FastWithdrawResponse = FastWithdrawResponse;
3301
+ type index_NotificationAckRequest = NotificationAckRequest;
3302
+ type index_NotificationAckResponse = NotificationAckResponse;
3303
+ type index_SendTransactionBatchFormRequest = SendTransactionBatchFormRequest;
3304
+ type index_SendTransactionBatchJsonRequest = SendTransactionBatchJsonRequest;
3305
+ type index_SendTransactionBatchRequest = SendTransactionBatchRequest;
3306
+ type index_SendTransactionRequest = SendTransactionRequest;
3307
+ type index_SendTxFormRequest = SendTxFormRequest;
3308
+ type index_SendTxWithIndicesRequest = SendTxWithIndicesRequest;
3309
+ type index_TokensCreateRequest = TokensCreateRequest;
3310
+ type index_TokensCreateResponse = TokensCreateResponse;
3311
+ type index_TokensRevokeRequest = TokensRevokeRequest;
3312
+ type index_TokensRevokeResponse = TokensRevokeResponse;
3313
+ type index_TxHashResponse = TxHashResponse;
3314
+ type index_TxHashesResponse = TxHashesResponse;
3315
+ declare const index_acknowledgeNotification: typeof acknowledgeNotification;
3316
+ declare const index_changeAccountTier: typeof changeAccountTier;
3317
+ declare const index_createToken: typeof createToken;
3318
+ declare const index_fastWithdraw: typeof fastWithdraw;
3319
+ declare const index_revokeToken: typeof revokeToken;
3320
+ declare const index_sendTransaction: typeof sendTransaction;
3321
+ declare const index_sendTransactionBatch: typeof sendTransactionBatch;
3322
+ declare const index_sendTx: typeof sendTx;
3323
+ declare const index_sendTxJson: typeof sendTxJson;
3324
+ declare const index_sendTxWithIndices: typeof sendTxWithIndices;
3325
+ declare namespace index {
3326
+ export { type index_ChangeAccountTierRequest as ChangeAccountTierRequest, type index_ChangeAccountTierResponse as ChangeAccountTierResponse, type index_FastWithdrawRequest as FastWithdrawRequest, type index_FastWithdrawResponse as FastWithdrawResponse, type index_NotificationAckRequest as NotificationAckRequest, type index_NotificationAckResponse as NotificationAckResponse, type index_SendTransactionBatchFormRequest as SendTransactionBatchFormRequest, type index_SendTransactionBatchJsonRequest as SendTransactionBatchJsonRequest, type index_SendTransactionBatchRequest as SendTransactionBatchRequest, type index_SendTransactionRequest as SendTransactionRequest, type index_SendTxFormRequest as SendTxFormRequest, type index_SendTxWithIndicesRequest as SendTxWithIndicesRequest, type index_TokensCreateRequest as TokensCreateRequest, type index_TokensCreateResponse as TokensCreateResponse, type index_TokensRevokeRequest as TokensRevokeRequest, type index_TokensRevokeResponse as TokensRevokeResponse, type index_TxHashResponse as TxHashResponse, type index_TxHashesResponse as TxHashesResponse, index_acknowledgeNotification as acknowledgeNotification, index_changeAccountTier as changeAccountTier, index_createToken as createToken, index_fastWithdraw as fastWithdraw, index_revokeToken as revokeToken, index_sendTransaction as sendTransaction, index_sendTransactionBatch as sendTransactionBatch, index_sendTx as sendTx, index_sendTxJson as sendTxJson, index_sendTxWithIndices as sendTxWithIndices };
3327
+ }
3328
+
3329
+ interface ExchangeClientConfig {
3330
+ baseURL?: string;
3331
+ txClient: TxClient;
3332
+ }
3333
+ /**
3334
+ * ExchangeClient - Client for exchange/transaction endpoints
3335
+ *
3336
+ * Provides access to transaction sending and signing endpoints.
3337
+ * Uses TypeScript-based signing via TxClient instead of WASM.
3338
+ *
3339
+ * @example
3340
+ * ```typescript
3341
+ * const txClient = createClient(httpClient, privateKey, chainId, apiKeyIndex, accountIndex);
3342
+ * const client = new ExchangeClient({
3343
+ * baseURL: "https://mainnet.zklighter.elliot.ai",
3344
+ * txClient
3345
+ * });
3346
+ *
3347
+ * const result = await client.createOrder({
3348
+ * marketIndex: 0,
3349
+ * clientOrderIndex: 1,
3350
+ * baseAmount: 1000000n,
3351
+ * price: 50000,
3352
+ * isAsk: 0,
3353
+ * orderType: 0,
3354
+ * timeInForce: 1,
3355
+ * reduceOnly: 0,
3356
+ * triggerPrice: 0,
3357
+ * orderExpiry: BigInt(Date.now() + 3600000),
3358
+ * });
3359
+ * ```
3360
+ */
3361
+ declare class ExchangeClient {
3362
+ private readonly baseURL;
3363
+ private readonly axiosInstance;
3364
+ private readonly txClient;
3365
+ constructor(config: ExchangeClientConfig);
3366
+ private createAxiosInstance;
3367
+ /**
3368
+ * Create an auth token using the TxClient
3369
+ */
3370
+ private createAuthToken;
3371
+ /**
3372
+ * Get the axios instance for custom requests
3373
+ */
3374
+ getAxiosInstance(): AxiosInstance;
3375
+ /**
3376
+ * Get the TxClient for direct signing operations
3377
+ */
3378
+ getTxClient(): TxClient;
3379
+ /**
3380
+ * Send a transaction
3381
+ */
3382
+ sendTransaction(params: SendTransactionRequest): Promise<TxHashResponse>;
3383
+ /**
3384
+ * Send a transaction with form data
3385
+ */
3386
+ sendTx(params: SendTxFormRequest): Promise<TxHashResponse>;
3387
+ /**
3388
+ * Send a transaction with account and API key indices
3389
+ */
3390
+ sendTxWithIndices(params: SendTxWithIndicesRequest): Promise<TxHashResponse>;
3391
+ /**
3392
+ * Send a transaction with JSON payload
3393
+ */
3394
+ sendTxJson(params: SendTxWithIndicesRequest): Promise<TxHashResponse>;
3395
+ /**
3396
+ * Send a batch of transactions
3397
+ */
3398
+ sendTransactionBatch(params: SendTransactionBatchRequest): Promise<TxHashesResponse>;
3399
+ /**
3400
+ * Create and send an order using TypeScript signing
3401
+ */
3402
+ createOrder(params: {
3403
+ marketIndex: number;
3404
+ clientOrderIndex: bigint;
3405
+ baseAmount: bigint;
3406
+ price: number;
3407
+ isAsk: number;
3408
+ orderType: number;
3409
+ timeInForce: number;
3410
+ reduceOnly: number;
3411
+ triggerPrice: number;
3412
+ orderExpiry: bigint;
3413
+ priceProtection?: boolean;
3414
+ }): Promise<TxHashResponse>;
3415
+ /**
3416
+ * Cancel an order using TypeScript signing
3417
+ */
3418
+ cancelOrder(params: {
3419
+ marketIndex: number;
3420
+ orderIndex: bigint;
3421
+ priceProtection?: boolean;
3422
+ }): Promise<TxHashResponse>;
3423
+ /**
3424
+ * Cancel all orders using TypeScript signing
3425
+ */
3426
+ cancelAllOrders(params: {
3427
+ timeInForce: number;
3428
+ time: bigint;
3429
+ priceProtection?: boolean;
3430
+ }): Promise<TxHashResponse>;
3431
+ /**
3432
+ * Transfer funds using TypeScript signing
3433
+ */
3434
+ transfer(params: {
3435
+ toAccountIndex: bigint;
3436
+ assetIndex: number;
3437
+ fromRouteType: number;
3438
+ toRouteType: number;
3439
+ amount: bigint;
3440
+ usdcFee: bigint;
3441
+ memo: string;
3442
+ priceProtection?: boolean;
3443
+ }): Promise<TxHashResponse>;
3444
+ /**
3445
+ * Withdraw funds using TypeScript signing
3446
+ */
3447
+ withdraw(params: {
3448
+ assetIndex: number;
3449
+ routeType: number;
3450
+ amount: bigint;
3451
+ priceProtection?: boolean;
3452
+ }): Promise<TxHashResponse>;
3453
+ /**
3454
+ * Update leverage using TypeScript signing
3455
+ */
3456
+ updateLeverage(params: {
3457
+ marketIndex: number;
3458
+ initialMarginFraction: number;
3459
+ marginMode: number;
3460
+ priceProtection?: boolean;
3461
+ }): Promise<TxHashResponse>;
3462
+ /**
3463
+ * Modify an order using TypeScript signing
3464
+ */
3465
+ modifyOrder(params: {
3466
+ marketIndex: number;
3467
+ index: bigint;
3468
+ baseAmount: bigint;
3469
+ price: number;
3470
+ triggerPrice: number;
3471
+ priceProtection?: boolean;
3472
+ }): Promise<TxHashResponse>;
3473
+ /**
3474
+ * Create a subaccount using TypeScript signing
3475
+ */
3476
+ createSubAccount(params?: {
3477
+ priceProtection?: boolean;
3478
+ }): Promise<TxHashResponse>;
3479
+ /**
3480
+ * Create a public pool using TypeScript signing
3481
+ */
3482
+ createPublicPool(params: {
3483
+ operatorFee: bigint;
3484
+ initialTotalShares: bigint;
3485
+ minOperatorShareRate: number;
3486
+ priceProtection?: boolean;
3487
+ }): Promise<TxHashResponse>;
3488
+ /**
3489
+ * Update a public pool using TypeScript signing
3490
+ */
3491
+ updatePublicPool(params: {
3492
+ publicPoolIndex: bigint;
3493
+ status: number;
3494
+ operatorFee: bigint;
3495
+ minOperatorShareRate: number;
3496
+ priceProtection?: boolean;
3497
+ }): Promise<TxHashResponse>;
3498
+ /**
3499
+ * Mint shares using TypeScript signing
3500
+ */
3501
+ mintShares(params: {
3502
+ publicPoolIndex: bigint;
3503
+ shareAmount: bigint;
3504
+ priceProtection?: boolean;
3505
+ }): Promise<TxHashResponse>;
3506
+ /**
3507
+ * Burn shares using TypeScript signing
3508
+ */
3509
+ burnShares(params: {
3510
+ publicPoolIndex: bigint;
3511
+ shareAmount: bigint;
3512
+ priceProtection?: boolean;
3513
+ }): Promise<TxHashResponse>;
3514
+ /**
3515
+ * Update margin using TypeScript signing
3516
+ */
3517
+ updateMargin(params: {
3518
+ marketIndex: number;
3519
+ usdcAmount: bigint;
3520
+ direction: number;
3521
+ priceProtection?: boolean;
3522
+ }): Promise<TxHashResponse>;
3523
+ /**
3524
+ * Create grouped orders using TypeScript signing
3525
+ */
3526
+ createGroupedOrders(params: {
3527
+ groupingType: number;
3528
+ orders: Array<{
3529
+ marketIndex: number;
3530
+ clientOrderIndex: bigint;
3531
+ baseAmount: bigint;
3532
+ price: number;
3533
+ isAsk: number;
3534
+ type: number;
3535
+ timeInForce: number;
3536
+ reduceOnly: number;
3537
+ triggerPrice: number;
3538
+ orderExpiry: bigint;
3539
+ }>;
3540
+ priceProtection?: boolean;
3541
+ }): Promise<TxHashResponse>;
3542
+ /**
3543
+ * Create multiple orders in a batch using TypeScript signing
3544
+ */
3545
+ createBatchOrders(params: {
3546
+ orders: Array<{
3547
+ marketIndex: number;
3548
+ clientOrderIndex: bigint;
3549
+ baseAmount: bigint;
3550
+ price: number;
3551
+ isAsk: number;
3552
+ orderType: number;
3553
+ timeInForce: number;
3554
+ reduceOnly: number;
3555
+ triggerPrice: number;
3556
+ orderExpiry: bigint;
3557
+ }>;
3558
+ }): Promise<TxHashesResponse>;
3559
+ /**
3560
+ * Generate change public key L1 sign message
3561
+ */
3562
+ generateChangePubKeyL1SignMessage(pubKeyHex: string, nonce: number, accountIndex: bigint, newApiKeyIndex: number): string;
3563
+ /**
3564
+ * Change public key using TypeScript signing
3565
+ */
3566
+ changePubKey(params: {
3567
+ pubKey: string;
3568
+ l1Sig: string;
3569
+ priceProtection?: boolean;
3570
+ }): Promise<TxHashResponse>;
3571
+ /**
3572
+ * Acknowledge a notification
3573
+ */
3574
+ acknowledgeNotification(params: NotificationAckRequest): Promise<NotificationAckResponse>;
3575
+ /**
3576
+ * Change account tier
3577
+ */
3578
+ changeAccountTier(params: ChangeAccountTierRequest): Promise<ChangeAccountTierResponse>;
3579
+ /**
3580
+ * Fast withdraw funds
3581
+ */
3582
+ fastWithdraw(params: FastWithdrawRequest): Promise<FastWithdrawResponse>;
3583
+ /**
3584
+ * Create API token
3585
+ */
3586
+ createToken(params: TokensCreateRequest): Promise<TokensCreateResponse>;
3587
+ /**
3588
+ * Revoke API token
3589
+ */
3590
+ revokeToken(params: TokensRevokeRequest): Promise<TokensRevokeResponse>;
3591
+ }
3592
+
3593
+ type Unsubscribe = () => void;
3594
+ declare class WsClient {
3595
+ private ws;
3596
+ private config;
3597
+ private readonly url;
3598
+ private messageHandlers;
3599
+ constructor(config?: WebSocketConfig);
3600
+ connect(): void;
3601
+ disconnect(): void;
3602
+ private subscribe;
3603
+ subscribeOrderBook(marketIndex: number, handler: (update: WsOrderBookUpdate) => void): Unsubscribe;
3604
+ subscribeMarketStats(market: number | "all", handler: (update: WsMarketStatsUpdate) => void): Unsubscribe;
3605
+ subscribeSpotMarketStats(market: number | "all", handler: (update: WsSpotMarketStatsUpdate) => void): Unsubscribe;
3606
+ subscribeTrades(marketIndex: number, handler: (update: WsTradeUpdate) => void): Unsubscribe;
3607
+ subscribeAccountAll(accountId: number, handler: (update: WsAccountAllUpdate) => void): Unsubscribe;
3608
+ subscribeAccountMarket(marketId: number, accountId: number, auth: string, handler: (update: WsAccountMarketUpdate) => void): Unsubscribe;
3609
+ subscribeUserStats(accountId: number, handler: (update: WsUserStatsUpdate) => void): Unsubscribe;
3610
+ subscribeAccountAllAssets(accountId: number, auth: string, handler: (update: WsAccountAllAssetsUpdate) => void): Unsubscribe;
3611
+ subscribeTransactions(handler: (update: WsTransactionUpdate) => void): Unsubscribe;
3612
+ subscribeExecutedTransactions(handler: (update: WsTransactionUpdate) => void): Unsubscribe;
3613
+ subscribeAccountTransactions(accountId: number, auth: string, handler: (update: WsTransactionUpdate) => void): Unsubscribe;
3614
+ subscribeAccountAllOrders(accountId: number, auth: string, handler: (update: WsAccountAllOrdersUpdate) => void): Unsubscribe;
3615
+ subscribeHeight(handler: (update: WsHeightUpdate) => void): Unsubscribe;
3616
+ subscribePoolData(accountId: number, auth: string, handler: (update: WsPoolDataUpdate) => void): Unsubscribe;
3617
+ subscribePoolInfo(accountId: number, auth: string, handler: (update: WsPoolInfoUpdate) => void): Unsubscribe;
3618
+ subscribeNotifications(accountId: number, auth: string, handler: (update: WsNotificationUpdate) => void): Unsubscribe;
3619
+ subscribeAccountOrders(marketIndex: number, accountId: number, auth: string, handler: (update: WsAccountOrdersUpdate) => void): Unsubscribe;
3620
+ subscribeAccountAllTrades(accountId: number, auth: string, handler: (update: WsAccountAllTradesUpdate) => void): Unsubscribe;
3621
+ subscribeAccountAllPositions(accountId: number, auth: string, handler: (update: WsAccountAllPositionsUpdate) => void): Unsubscribe;
3622
+ send(message: any): void;
3623
+ private normalizeChannel;
3624
+ private passthroughParser;
3625
+ private handleSubscriptionMessage;
3626
+ private resubscribeAll;
3627
+ getSubscriptions(): string[];
3628
+ }
3629
+
3630
+ /**
3631
+ * Goldilocks field element
3632
+ */
3633
+ declare class GoldilocksElement {
3634
+ readonly value: bigint;
3635
+ constructor(value: bigint);
3636
+ add(other: GoldilocksElement): GoldilocksElement;
3637
+ sub(other: GoldilocksElement): GoldilocksElement;
3638
+ mul(other: GoldilocksElement): GoldilocksElement;
3639
+ square(): GoldilocksElement;
3640
+ static fromUint32(value: number): GoldilocksElement;
3641
+ static fromInt64(value: bigint): GoldilocksElement;
3642
+ static fromUint64(value: bigint): GoldilocksElement;
3643
+ static zero(): GoldilocksElement;
3644
+ static one(): GoldilocksElement;
3645
+ toLittleEndianBytes(): Uint8Array;
3646
+ static fromLittleEndianBytes(bytes: Uint8Array): GoldilocksElement;
3647
+ }
3648
+ /**
3649
+ * Convert bytes to Goldilocks field elements
3650
+ * Each element holds up to 7 bytes of data
3651
+ */
3652
+ declare function bytesToFieldElements(bytes: Uint8Array): GoldilocksElement[];
3653
+
3654
+ /**
3655
+ * Poseidon2 hash function over Goldilocks field (Plonky2 variant)
3656
+ *
3657
+ * This is a correct implementation matching the Go poseidon_crypto library.
3658
+ * Constants are taken from the Plonky3/Plonky2 reference implementation.
3659
+ */
3660
+
3661
+ /**
3662
+ * Poseidon2 permutation
3663
+ */
3664
+ declare function permute(state: bigint[]): void;
3665
+ /**
3666
+ * Poseidon2 sponge hash function
3667
+ * Compatible with Go HashToQuinticExtension
3668
+ */
3669
+ declare function poseidon2Hash(inputs: GoldilocksElement[]): GoldilocksElement[];
3670
+ /**
3671
+ * Hash field elements to a quintic extension element (40 bytes)
3672
+ */
3673
+ declare function hashToQuinticExtension(elements: GoldilocksElement[]): Uint8Array;
3674
+
3675
+ /**
3676
+ * ECgFp5 Scalar Field
3677
+ *
3678
+ * The scalar field for ECgFp5 curve with prime order ~2^319
3679
+ * ORDER = 1067993516717146951041484916571792702745057740581727230159139685185762082554198619328292418486241
3680
+ *
3681
+ * Ported from Go poseidon_crypto/curve/ecgfp5/scalar_field.go
3682
+ */
3683
+
3684
+ declare const ORDER = 1067993516717146951041484916571792702745057740581727230159139685185762082554198619328292418486241n;
3685
+
3686
+ export { ApiMaxOrderType, AssetMarginMode, type AssetMarginModeValue, AssetRouteType, type AssetRouteTypeValue, type BurnSharesTxReq, type CancelAllOrdersTxReq, CancelAllTimeInForce, type CancelAllTimeInForceValue, type CancelOrderTxReq, type ChangePubKeyReq, type CreateGroupedOrdersTxReq, type CreateOrderTxReq, type CreatePublicPoolTxReq, DEFAULT_ACCOUNT_INDEX, DEFAULT_API_KEY_INDEX, DEFAULT_EXPIRE_TIME_MS, ECgFp5Point, ECgFp5Scalar, ErrAccountIndexTooHigh, ErrAccountIndexTooLow, ErrApiKeyIndexTooHigh, ErrApiKeyIndexTooLow, ErrAssetIndexTooHigh, ErrAssetIndexTooLow, ErrBaseAmountTooHigh, ErrBaseAmountTooLow, ErrCancelAllTimeInForceInvalid, ErrCancelAllTimeTooHigh, ErrCancelAllTimeTooLow, ErrClientOrderIndexTooHigh, ErrClientOrderIndexTooLow, ErrExpiredAtInvalid, ErrFromAccountIndexTooHigh, ErrFromAccountIndexTooLow, ErrGroupingTypeInvalid, ErrInitialTotalSharesTooHigh, ErrInitialTotalSharesTooLow, ErrInvalidMarketIndex, ErrInvalidPublicKeyLength, ErrIsAskInvalid, ErrMarginDirectionInvalid, ErrMarginModeInvalid, ErrMinOperatorShareRateTooHigh, ErrNoOrdersInGroup, ErrNonceTooLow, ErrOperatorFeeTooHigh, ErrOperatorFeeTooLow, ErrOrderExpiryInvalid, ErrOrderIndexTooHigh, ErrOrderIndexTooLow, ErrOrderReduceOnlyInvalid, ErrOrderTimeInForceInvalid, ErrOrderTriggerPriceInvalid, ErrOrderTypeInvalid, ErrPriceTooHigh, ErrPriceTooLow, ErrPublicPoolIndexTooLow, ErrRouteTypeInvalid, ErrShareAmountTooHigh, ErrShareAmountTooLow, ErrToAccountIndexTooHigh, ErrToAccountIndexTooLow, ErrTooManyGroupedOrders, ErrTransferAmountTooHigh, ErrTransferAmountTooLow, ErrTransferFeeNegative, ErrTransferFeeTooHigh, ErrUSDCAmountTooHigh, ErrUSDCAmountTooLow, ErrWithdrawalAmountTooHigh, ErrWithdrawalAmountTooLow, index as ExchangeApi, ExchangeClient, FEE_TICK, FETCH_NONCE_FROM_SERVER, GFp5Element, GoldilocksElement, GroupingType, type GroupingTypeValue, HttpClient, INITIAL_POOL_SHARE_VALUE, index$2 as InfoApi, InfoClient, index$1 as InfoPrivateApi, InfoPrivateClient, type KeyManager, type L1BridgeConfig, type L1DepositParams, type L1DepositResult, L2BurnSharesTxInfo, L2CancelAllOrdersTxInfo, L2CancelOrderTxInfo, L2ChangePubKeyTxInfo, L2CreateGroupedOrdersTxInfo, L2CreateOrderTxInfo, L2CreatePublicPoolTxInfo, L2CreateSubAccountTxInfo, L2MintSharesTxInfo, L2ModifyOrderTxInfo, L2TransferTxInfo, L2UpdateLeverageTxInfo, L2UpdateMarginTxInfo, L2UpdatePublicPoolTxInfo, L2WithdrawTxInfo, MARGIN_FRACTION_TICK, MAX_ACCOUNT_INDEX, MAX_API_KEY_INDEX, MAX_ASSET_INDEX, MAX_BURNT_SHARE_USDC_VALUE, MAX_CLIENT_ORDER_INDEX, MAX_GROUPED_ORDER_COUNT, MAX_INITIAL_TOTAL_SHARES, MAX_INVESTED_PUBLIC_POOL_COUNT, MAX_MASTER_ACCOUNT_INDEX, MAX_ORDER_BASE_AMOUNT, MAX_ORDER_CANCEL_ALL_PERIOD, MAX_ORDER_EXPIRY, MAX_ORDER_EXPIRY_PERIOD, MAX_ORDER_INDEX, MAX_ORDER_NONCE, MAX_ORDER_PRICE, MAX_ORDER_TRIGGER_PRICE, MAX_PERPS_MARKET_INDEX, MAX_POOL_ENTRY_USDC, MAX_POOL_SHARES, MAX_POOL_SHARES_TO_MINT_OR_BURN, MAX_SPOT_MARKET_INDEX, MAX_TIMESTAMP, MAX_TRANSFER_AMOUNT, MAX_TRANSFER_FEE, MAX_USDC_AMOUNT, MAX_WITHDRAWAL_AMOUNT, MIN_ACCOUNT_INDEX, MIN_API_KEY_INDEX, MIN_ASSET_INDEX, MIN_CLIENT_ORDER_INDEX, MIN_INITIAL_TOTAL_SHARES, MIN_MARKET_INDEX, MIN_NONCE, MIN_ORDER_BASE_AMOUNT, MIN_ORDER_CANCEL_ALL_PERIOD, MIN_ORDER_EXPIRY, MIN_ORDER_EXPIRY_PERIOD, MIN_ORDER_INDEX, MIN_ORDER_NONCE, MIN_ORDER_PRICE, MIN_ORDER_TRIGGER_PRICE, MIN_PERPS_MARKET_INDEX, MIN_POOL_SHARES_TO_MINT_OR_BURN, MIN_SPOT_MARKET_INDEX, MIN_SUB_ACCOUNT_INDEX, MIN_TIMESTAMP, MIN_TRANSFER_AMOUNT, MIN_USDC_AMOUNT, MIN_WITHDRAWAL_AMOUNT, MarginDirection, type MarginDirectionValue, MarginMode, type MarginModeValue, type MinimalHTTPClient, type MintSharesTxReq, type ModifyOrderTxReq, NATIVE_ASSET_INDEX, NIL_API_KEY_INDEX, NIL_ASSET_INDEX, NIL_CLIENT_ORDER_INDEX, NIL_MARKET_INDEX, NIL_ORDER_BASE_AMOUNT, NIL_ORDER_EXPIRY, NIL_ORDER_INDEX, NIL_ORDER_PRICE, NIL_ORDER_TRIGGER_PRICE, ONE_USDC, ORDER, type OrderInfo, OrderType, type OrderTypeValue, SCALAR_ORDER, SHARE_TICK, SchnorrSignature, type Signer, TimeInForce, type TimeInForceValue, type TransactOpts, type TransferTxReq, TxClient, type TxInfo, TxType, type TxTypeValue, USDC_ASSET_INDEX, type Unsubscribe, type UpdateLeverageTxReq, type UpdateMarginTxReq, type UpdatePublicPoolTxReq, ValidationError, type WebSocketConfig, type WebSocketSubscription, type WithdrawTxReq, type WsAccountAllAssetsUpdate, type WsAccountAllOrdersUpdate, type WsAccountAllPositionsUpdate, type WsAccountAllTradesUpdate, type WsAccountAllUpdate, type WsAccountAsset, type WsAccountMarketUpdate, type WsAccountOrdersUpdate, type WsAccountPosition, type WsAnnouncementNotificationContent, WsClient, type WsDeleverageNotificationContent, type WsFundingHistoryEntry, type WsHeightUpdate, type WsLiquidationNotificationContent, type WsMarketStats, type WsMarketStatsUpdate, type WsNotification, type WsNotificationBase, type WsNotificationContent, type WsNotificationUpdate, type WsOrder, type WsOrderBookSnapshot, type WsOrderBookUpdate, type WsPoolDataUpdate, type WsPoolInfo, type WsPoolInfoDailyMetric, type WsPoolInfoUpdate, type WsPoolShare, type WsPositionFunding, type WsPriceLevel, type WsSpotMarketStats, type WsSpotMarketStatsUpdate, type WsStatsBreakdown, type WsTrade, type WsTradeUpdate, type WsTransaction, type WsTransactionUpdate, type WsUserStats, type WsUserStatsUpdate, bytesToFieldElements, bytesToHex, checkClient, clearClients, createClient, generateApiKey, getClient, getDefaultClient, hashToQuinticExtension, hexToBytes, newHttpClient, newKeyManager, permute, poseidon2Hash, sampleScalar, schnorrPkFromSk, schnorrSignHashedMessage, schnorrSignHashedMessageDeterministic, serializeBurnShares, serializeCancelAllOrders, serializeCancelOrder, serializeChangePubKey, serializeCreateGroupedOrders, serializeCreateOrder, serializeCreatePublicPool, serializeCreateSubAccount, serializeMintShares, serializeModifyOrder, serializeTransfer, serializeTxInfo, serializeUpdateLeverage, serializeUpdateMargin, serializeUpdatePublicPool, serializeWithdraw };