@avalabs/hypercore-module 0.0.0-cp-14847-glacier-proxy-20260721195945

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,649 @@
1
+ import * as _metamask_rpc_errors from '@metamask/rpc-errors';
2
+ import * as _avalabs_vm_module_types from '@avalabs/vm-module-types';
3
+ import { Module, ConstructorParams, Network, Manifest, GetBalancesParams, GetTransactionHistory, NetworkFeeParam, NetworkFees, GetAddressParams, GetAddressResponse, BuildDerivationPathParams, DeriveAddressParams, DeriveAddressesParams, RpcRequest, HypercoreSpotToken, Transaction } from '@avalabs/vm-module-types';
4
+ export { HypercoreSpotToken } from '@avalabs/vm-module-types';
5
+ import { z } from 'zod';
6
+ import Big from 'big.js';
7
+
8
+ declare class HypercoreModule implements Module {
9
+ #private;
10
+ constructor({ environment, approvalController, runtime }: ConstructorParams);
11
+ getProvider(_network: Network): Promise<never>;
12
+ getManifest(): Manifest | undefined;
13
+ getBalances(params: GetBalancesParams): Promise<_avalabs_vm_module_types.GetBalancesResponse>;
14
+ getTransactionHistory(params: GetTransactionHistory): Promise<_avalabs_vm_module_types.TransactionHistoryResponse>;
15
+ getNetworkFee(_network: NetworkFeeParam): Promise<NetworkFees>;
16
+ getAddress(params: GetAddressParams): Promise<GetAddressResponse>;
17
+ buildDerivationPath(params: BuildDerivationPathParams): Pick<Partial<Record<_avalabs_vm_module_types.NetworkVMType, string>>, _avalabs_vm_module_types.NetworkVMType.HYPERCORE>;
18
+ deriveAddress(params: DeriveAddressParams): Promise<Partial<Record<_avalabs_vm_module_types.NetworkVMType, string>>>;
19
+ deriveAddresses(params: DeriveAddressesParams): Promise<_avalabs_vm_module_types.DeriveAddressesResponse>;
20
+ getTokens(network: Network): Promise<_avalabs_vm_module_types.HypercoreSpotToken[]>;
21
+ onRpcRequest(request: RpcRequest, _network: Network): Promise<{
22
+ error: _metamask_rpc_errors.JsonRpcError<_metamask_rpc_errors.OptionalDataWithOptionalCause>;
23
+ }>;
24
+ }
25
+
26
+ /** CAIP-2 id for HyperCore mainnet. Namespace must be 3–8 chars (CAIP-2).
27
+ * This is a synthetic CAIP-2 for the HyperCore network as HyperCore does not have a chain id.
28
+ */
29
+ declare const HYPERCORE_CAIP_ID = "hlcore:mainnet";
30
+ /**
31
+ * Synthetic numeric id used by Core network lists / storage keys.
32
+ * Not an EVM chain id — module routing uses {@link HYPERCORE_CAIP_ID}.
33
+ */
34
+ declare const HYPERCORE_CHAIN_ID = 9999;
35
+ declare const HYPERCORE_USDC_SYMBOL = "USDC";
36
+ declare const HYPERCORE_USDC_NAME = "USD Coin";
37
+ declare const HYPERCORE_USDC_DECIMALS = 8;
38
+
39
+ /** `type: "spotMeta"` — registry mapping spot token index → display metadata. */
40
+ declare const spotMetaResponseSchema: z.ZodObject<{
41
+ tokens: z.ZodArray<z.ZodObject<{
42
+ name: z.ZodString;
43
+ index: z.ZodNumber;
44
+ weiDecimals: z.ZodNumber;
45
+ fullName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
46
+ evmContract: z.ZodOptional<z.ZodNullable<z.ZodObject<{
47
+ address: z.ZodString;
48
+ }, "strip", z.ZodTypeAny, {
49
+ address: string;
50
+ }, {
51
+ address: string;
52
+ }>>>;
53
+ }, "strip", z.ZodTypeAny, {
54
+ name: string;
55
+ index: number;
56
+ weiDecimals: number;
57
+ fullName?: string | null | undefined;
58
+ evmContract?: {
59
+ address: string;
60
+ } | null | undefined;
61
+ }, {
62
+ name: string;
63
+ index: number;
64
+ weiDecimals: number;
65
+ fullName?: string | null | undefined;
66
+ evmContract?: {
67
+ address: string;
68
+ } | null | undefined;
69
+ }>, "many">;
70
+ }, "strip", z.ZodTypeAny, {
71
+ tokens: {
72
+ name: string;
73
+ index: number;
74
+ weiDecimals: number;
75
+ fullName?: string | null | undefined;
76
+ evmContract?: {
77
+ address: string;
78
+ } | null | undefined;
79
+ }[];
80
+ }, {
81
+ tokens: {
82
+ name: string;
83
+ index: number;
84
+ weiDecimals: number;
85
+ fullName?: string | null | undefined;
86
+ evmContract?: {
87
+ address: string;
88
+ } | null | undefined;
89
+ }[];
90
+ }>;
91
+ /** `type: "spotClearinghouseState"` */
92
+ declare const spotClearinghouseStateSchema: z.ZodObject<{
93
+ balances: z.ZodArray<z.ZodObject<{
94
+ coin: z.ZodString;
95
+ token: z.ZodNumber;
96
+ total: z.ZodString;
97
+ hold: z.ZodString;
98
+ entryNtl: z.ZodOptional<z.ZodString>;
99
+ }, "strip", z.ZodTypeAny, {
100
+ coin: string;
101
+ token: number;
102
+ total: string;
103
+ hold: string;
104
+ entryNtl?: string | undefined;
105
+ }, {
106
+ coin: string;
107
+ token: number;
108
+ total: string;
109
+ hold: string;
110
+ entryNtl?: string | undefined;
111
+ }>, "many">;
112
+ }, "strip", z.ZodTypeAny, {
113
+ balances: {
114
+ coin: string;
115
+ token: number;
116
+ total: string;
117
+ hold: string;
118
+ entryNtl?: string | undefined;
119
+ }[];
120
+ }, {
121
+ balances: {
122
+ coin: string;
123
+ token: number;
124
+ total: string;
125
+ hold: string;
126
+ entryNtl?: string | undefined;
127
+ }[];
128
+ }>;
129
+ /**
130
+ * `type: "clearinghouseState"` — only fields needed for PnL-excluded
131
+ * perp collateral fold-in.
132
+ */
133
+ declare const clearinghouseStateSchema: z.ZodObject<{
134
+ assetPositions: z.ZodArray<z.ZodObject<{
135
+ position: z.ZodObject<{
136
+ unrealizedPnl: z.ZodString;
137
+ }, "strip", z.ZodTypeAny, {
138
+ unrealizedPnl: string;
139
+ }, {
140
+ unrealizedPnl: string;
141
+ }>;
142
+ }, "strip", z.ZodTypeAny, {
143
+ position: {
144
+ unrealizedPnl: string;
145
+ };
146
+ }, {
147
+ position: {
148
+ unrealizedPnl: string;
149
+ };
150
+ }>, "many">;
151
+ crossMarginSummary: z.ZodObject<{
152
+ accountValue: z.ZodString;
153
+ totalMarginUsed: z.ZodOptional<z.ZodString>;
154
+ totalNtlPos: z.ZodOptional<z.ZodString>;
155
+ totalRawUsd: z.ZodOptional<z.ZodString>;
156
+ }, "strip", z.ZodTypeAny, {
157
+ accountValue: string;
158
+ totalMarginUsed?: string | undefined;
159
+ totalNtlPos?: string | undefined;
160
+ totalRawUsd?: string | undefined;
161
+ }, {
162
+ accountValue: string;
163
+ totalMarginUsed?: string | undefined;
164
+ totalNtlPos?: string | undefined;
165
+ totalRawUsd?: string | undefined;
166
+ }>;
167
+ }, "strip", z.ZodTypeAny, {
168
+ assetPositions: {
169
+ position: {
170
+ unrealizedPnl: string;
171
+ };
172
+ }[];
173
+ crossMarginSummary: {
174
+ accountValue: string;
175
+ totalMarginUsed?: string | undefined;
176
+ totalNtlPos?: string | undefined;
177
+ totalRawUsd?: string | undefined;
178
+ };
179
+ }, {
180
+ assetPositions: {
181
+ position: {
182
+ unrealizedPnl: string;
183
+ };
184
+ }[];
185
+ crossMarginSummary: {
186
+ accountValue: string;
187
+ totalMarginUsed?: string | undefined;
188
+ totalNtlPos?: string | undefined;
189
+ totalRawUsd?: string | undefined;
190
+ };
191
+ }>;
192
+ type UserAbstractionMode = 'unifiedAccount' | 'portfolioMargin' | 'dexAbstraction' | 'disabled' | 'default';
193
+ /**
194
+ * `type: "userAbstraction"` — bare JSON string. Unknown future values coerce
195
+ * to `"default"` so balance math stays conservative.
196
+ */
197
+ declare const userAbstractionSchema: z.ZodEffects<z.ZodString, "unifiedAccount" | "portfolioMargin" | "dexAbstraction" | "disabled" | "default", string>;
198
+ /** `type: "userFills"` */
199
+ declare const userFillSchema: z.ZodObject<{
200
+ closedPnl: z.ZodString;
201
+ coin: z.ZodString;
202
+ crossed: z.ZodBoolean;
203
+ dir: z.ZodString;
204
+ hash: z.ZodString;
205
+ oid: z.ZodNumber;
206
+ px: z.ZodString;
207
+ side: z.ZodString;
208
+ startPosition: z.ZodString;
209
+ sz: z.ZodString;
210
+ time: z.ZodNumber;
211
+ fee: z.ZodOptional<z.ZodString>;
212
+ tid: z.ZodOptional<z.ZodNumber>;
213
+ }, "strip", z.ZodTypeAny, {
214
+ coin: string;
215
+ closedPnl: string;
216
+ crossed: boolean;
217
+ dir: string;
218
+ hash: string;
219
+ oid: number;
220
+ px: string;
221
+ side: string;
222
+ startPosition: string;
223
+ sz: string;
224
+ time: number;
225
+ fee?: string | undefined;
226
+ tid?: number | undefined;
227
+ }, {
228
+ coin: string;
229
+ closedPnl: string;
230
+ crossed: boolean;
231
+ dir: string;
232
+ hash: string;
233
+ oid: number;
234
+ px: string;
235
+ side: string;
236
+ startPosition: string;
237
+ sz: string;
238
+ time: number;
239
+ fee?: string | undefined;
240
+ tid?: number | undefined;
241
+ }>;
242
+ declare const userFillsSchema: z.ZodArray<z.ZodObject<{
243
+ closedPnl: z.ZodString;
244
+ coin: z.ZodString;
245
+ crossed: z.ZodBoolean;
246
+ dir: z.ZodString;
247
+ hash: z.ZodString;
248
+ oid: z.ZodNumber;
249
+ px: z.ZodString;
250
+ side: z.ZodString;
251
+ startPosition: z.ZodString;
252
+ sz: z.ZodString;
253
+ time: z.ZodNumber;
254
+ fee: z.ZodOptional<z.ZodString>;
255
+ tid: z.ZodOptional<z.ZodNumber>;
256
+ }, "strip", z.ZodTypeAny, {
257
+ coin: string;
258
+ closedPnl: string;
259
+ crossed: boolean;
260
+ dir: string;
261
+ hash: string;
262
+ oid: number;
263
+ px: string;
264
+ side: string;
265
+ startPosition: string;
266
+ sz: string;
267
+ time: number;
268
+ fee?: string | undefined;
269
+ tid?: number | undefined;
270
+ }, {
271
+ coin: string;
272
+ closedPnl: string;
273
+ crossed: boolean;
274
+ dir: string;
275
+ hash: string;
276
+ oid: number;
277
+ px: string;
278
+ side: string;
279
+ startPosition: string;
280
+ sz: string;
281
+ time: number;
282
+ fee?: string | undefined;
283
+ tid?: number | undefined;
284
+ }>, "many">;
285
+ /**
286
+ * `userNonFundingLedgerUpdates` deltas — permissive so unknown delta types
287
+ * still parse and can render generically later.
288
+ */
289
+ declare const hypercoreLedgerDeltaSchema: z.ZodObject<{
290
+ type: z.ZodString;
291
+ usdc: z.ZodOptional<z.ZodString>;
292
+ amount: z.ZodOptional<z.ZodString>;
293
+ usdcValue: z.ZodOptional<z.ZodString>;
294
+ token: z.ZodOptional<z.ZodString>;
295
+ user: z.ZodOptional<z.ZodString>;
296
+ destination: z.ZodOptional<z.ZodString>;
297
+ fee: z.ZodOptional<z.ZodString>;
298
+ toPerp: z.ZodOptional<z.ZodBoolean>;
299
+ }, "strip", z.ZodTypeAny, {
300
+ type: string;
301
+ token?: string | undefined;
302
+ fee?: string | undefined;
303
+ usdc?: string | undefined;
304
+ amount?: string | undefined;
305
+ usdcValue?: string | undefined;
306
+ user?: string | undefined;
307
+ destination?: string | undefined;
308
+ toPerp?: boolean | undefined;
309
+ }, {
310
+ type: string;
311
+ token?: string | undefined;
312
+ fee?: string | undefined;
313
+ usdc?: string | undefined;
314
+ amount?: string | undefined;
315
+ usdcValue?: string | undefined;
316
+ user?: string | undefined;
317
+ destination?: string | undefined;
318
+ toPerp?: boolean | undefined;
319
+ }>;
320
+ declare const hypercoreLedgerUpdateSchema: z.ZodObject<{
321
+ time: z.ZodNumber;
322
+ hash: z.ZodString;
323
+ delta: z.ZodObject<{
324
+ type: z.ZodString;
325
+ usdc: z.ZodOptional<z.ZodString>;
326
+ amount: z.ZodOptional<z.ZodString>;
327
+ usdcValue: z.ZodOptional<z.ZodString>;
328
+ token: z.ZodOptional<z.ZodString>;
329
+ user: z.ZodOptional<z.ZodString>;
330
+ destination: z.ZodOptional<z.ZodString>;
331
+ fee: z.ZodOptional<z.ZodString>;
332
+ toPerp: z.ZodOptional<z.ZodBoolean>;
333
+ }, "strip", z.ZodTypeAny, {
334
+ type: string;
335
+ token?: string | undefined;
336
+ fee?: string | undefined;
337
+ usdc?: string | undefined;
338
+ amount?: string | undefined;
339
+ usdcValue?: string | undefined;
340
+ user?: string | undefined;
341
+ destination?: string | undefined;
342
+ toPerp?: boolean | undefined;
343
+ }, {
344
+ type: string;
345
+ token?: string | undefined;
346
+ fee?: string | undefined;
347
+ usdc?: string | undefined;
348
+ amount?: string | undefined;
349
+ usdcValue?: string | undefined;
350
+ user?: string | undefined;
351
+ destination?: string | undefined;
352
+ toPerp?: boolean | undefined;
353
+ }>;
354
+ }, "strip", z.ZodTypeAny, {
355
+ hash: string;
356
+ time: number;
357
+ delta: {
358
+ type: string;
359
+ token?: string | undefined;
360
+ fee?: string | undefined;
361
+ usdc?: string | undefined;
362
+ amount?: string | undefined;
363
+ usdcValue?: string | undefined;
364
+ user?: string | undefined;
365
+ destination?: string | undefined;
366
+ toPerp?: boolean | undefined;
367
+ };
368
+ }, {
369
+ hash: string;
370
+ time: number;
371
+ delta: {
372
+ type: string;
373
+ token?: string | undefined;
374
+ fee?: string | undefined;
375
+ usdc?: string | undefined;
376
+ amount?: string | undefined;
377
+ usdcValue?: string | undefined;
378
+ user?: string | undefined;
379
+ destination?: string | undefined;
380
+ toPerp?: boolean | undefined;
381
+ };
382
+ }>;
383
+ declare const hypercoreLedgerUpdatesSchema: z.ZodArray<z.ZodObject<{
384
+ time: z.ZodNumber;
385
+ hash: z.ZodString;
386
+ delta: z.ZodObject<{
387
+ type: z.ZodString;
388
+ usdc: z.ZodOptional<z.ZodString>;
389
+ amount: z.ZodOptional<z.ZodString>;
390
+ usdcValue: z.ZodOptional<z.ZodString>;
391
+ token: z.ZodOptional<z.ZodString>;
392
+ user: z.ZodOptional<z.ZodString>;
393
+ destination: z.ZodOptional<z.ZodString>;
394
+ fee: z.ZodOptional<z.ZodString>;
395
+ toPerp: z.ZodOptional<z.ZodBoolean>;
396
+ }, "strip", z.ZodTypeAny, {
397
+ type: string;
398
+ token?: string | undefined;
399
+ fee?: string | undefined;
400
+ usdc?: string | undefined;
401
+ amount?: string | undefined;
402
+ usdcValue?: string | undefined;
403
+ user?: string | undefined;
404
+ destination?: string | undefined;
405
+ toPerp?: boolean | undefined;
406
+ }, {
407
+ type: string;
408
+ token?: string | undefined;
409
+ fee?: string | undefined;
410
+ usdc?: string | undefined;
411
+ amount?: string | undefined;
412
+ usdcValue?: string | undefined;
413
+ user?: string | undefined;
414
+ destination?: string | undefined;
415
+ toPerp?: boolean | undefined;
416
+ }>;
417
+ }, "strip", z.ZodTypeAny, {
418
+ hash: string;
419
+ time: number;
420
+ delta: {
421
+ type: string;
422
+ token?: string | undefined;
423
+ fee?: string | undefined;
424
+ usdc?: string | undefined;
425
+ amount?: string | undefined;
426
+ usdcValue?: string | undefined;
427
+ user?: string | undefined;
428
+ destination?: string | undefined;
429
+ toPerp?: boolean | undefined;
430
+ };
431
+ }, {
432
+ hash: string;
433
+ time: number;
434
+ delta: {
435
+ type: string;
436
+ token?: string | undefined;
437
+ fee?: string | undefined;
438
+ usdc?: string | undefined;
439
+ amount?: string | undefined;
440
+ usdcValue?: string | undefined;
441
+ user?: string | undefined;
442
+ destination?: string | undefined;
443
+ toPerp?: boolean | undefined;
444
+ };
445
+ }>, "many">;
446
+ type SpotMetaResponse = z.infer<typeof spotMetaResponseSchema>;
447
+ type SpotBalance = {
448
+ coin: string;
449
+ token: number;
450
+ total: string;
451
+ hold: string;
452
+ entryNtl?: string;
453
+ };
454
+ type SpotClearinghouseState = {
455
+ balances: SpotBalance[];
456
+ };
457
+ type ClearinghouseState = z.infer<typeof clearinghouseStateSchema>;
458
+ type UserFill = z.infer<typeof userFillSchema>;
459
+ type HypercoreLedgerUpdate = z.infer<typeof hypercoreLedgerUpdateSchema>;
460
+
461
+ type HypercoreInfoRequest = {
462
+ type: 'spotMeta';
463
+ } | {
464
+ type: 'spotClearinghouseState';
465
+ user: string;
466
+ dex?: string;
467
+ } | {
468
+ type: 'clearinghouseState';
469
+ user: string;
470
+ dex?: string;
471
+ } | {
472
+ type: 'userAbstraction';
473
+ user: string;
474
+ } | {
475
+ type: 'userFills';
476
+ user: string;
477
+ } | {
478
+ type: 'userNonFundingLedgerUpdates';
479
+ user: string;
480
+ startTime: number;
481
+ };
482
+ type HypercoreInfoClientConfig = {
483
+ /** Proxy-first `/info` URL used for balances and spot meta. */
484
+ infoUrl: string;
485
+ /**
486
+ * Activity URL. Defaults to `infoUrl`; may be the public HL endpoint when
487
+ * the proxy does not yet support fills/ledger types.
488
+ */
489
+ activityInfoUrl?: string;
490
+ fetch?: typeof globalThis.fetch;
491
+ };
492
+ type PostInfoOptions = {
493
+ signal?: AbortSignal;
494
+ /** Overrides the client default URL for this call. */
495
+ url?: string;
496
+ };
497
+ declare class HypercoreInfoClient {
498
+ #private;
499
+ constructor(config: HypercoreInfoClientConfig);
500
+ postInfo<T>(body: HypercoreInfoRequest, schema: z.ZodType<T>, options?: PostInfoOptions): Promise<T>;
501
+ getSpotMeta(options?: PostInfoOptions): Promise<SpotMetaResponse>;
502
+ getSpotClearinghouseState(user: string, options?: PostInfoOptions): Promise<SpotClearinghouseState>;
503
+ getClearinghouseState(user: string, options?: PostInfoOptions): Promise<ClearinghouseState>;
504
+ getUserAbstraction(user: string, options?: PostInfoOptions): Promise<UserAbstractionMode>;
505
+ getUserFills(user: string, options?: PostInfoOptions): Promise<UserFill[]>;
506
+ getUserNonFundingLedgerUpdates(user: string, startTime: number, options?: PostInfoOptions): Promise<HypercoreLedgerUpdate[]>;
507
+ }
508
+
509
+ /**
510
+ * Maps `spotMeta` tokens to the registry used when resolving spot balances.
511
+ * Keeps every spot token (including HyperCore-only ones without an EVM contract).
512
+ */
513
+ declare const toHypercoreSpotTokens: (tokens: SpotMetaResponse["tokens"]) => HypercoreSpotToken[];
514
+
515
+ type HypercoreNativeTokenBalance = {
516
+ kind: 'native';
517
+ name: string;
518
+ symbol: typeof HYPERCORE_USDC_SYMBOL;
519
+ decimals: number;
520
+ /** Human-readable amount (decimal string). */
521
+ balance: string;
522
+ /** Integer raw amount as a decimal string (no fractional part). */
523
+ balanceRaw: string;
524
+ priceUsd: 1;
525
+ balanceUsd: string;
526
+ };
527
+ type HypercoreSpotTokenBalance = {
528
+ kind: 'spot';
529
+ name: string;
530
+ symbol: string;
531
+ decimals: number;
532
+ balance: string;
533
+ balanceRaw: string;
534
+ index: number;
535
+ evmContract?: string;
536
+ };
537
+ type HypercoreTokenBalance = HypercoreNativeTokenBalance | HypercoreSpotTokenBalance;
538
+ /**
539
+ * `true` when spot balances already back perps for this account mode
540
+ * (`unifiedAccount`). Other modes keep perp collateral on a separate ledger.
541
+ */
542
+ declare const spotCountsAsPerpCollateral: (mode: UserAbstractionMode | undefined) => mode is "unifiedAccount";
543
+ /**
544
+ * Perp collateral in USDC, excluding unrealized PnL.
545
+ * `crossMarginSummary.accountValue` is collateral ± PnL; we back PnL out.
546
+ */
547
+ declare const getPerpCollateralUsd: (perp: ClearinghouseState | undefined) => Big.Big;
548
+ /**
549
+ * USDC merges spot + (non-unified) PnL-excluded perp collateral at $1.
550
+ * Other spot inventory is `HYPERCORE_SPOT` (no synthetic ERC20 addresses).
551
+ */
552
+ declare const buildHypercoreTokens: ({ spotBalances, perpState, abstractionMode, spotTokens, }: {
553
+ spotBalances: readonly SpotBalance[];
554
+ perpState: ClearinghouseState | undefined;
555
+ abstractionMode: UserAbstractionMode | undefined;
556
+ spotTokens: HypercoreSpotToken[];
557
+ }) => HypercoreTokenBalance[];
558
+
559
+ declare const HYPERLIQUID_COIN_SVG_BASE = "https://app.hyperliquid.xyz/coins";
560
+ declare const hyperliquidCoinSvgKey: (coin: string) => string;
561
+ declare const hyperliquidCoinSvgUrl: (coin: string) => string;
562
+
563
+ type HypercoreActivityItem = {
564
+ readonly kind: 'fill';
565
+ readonly timeMs: number;
566
+ readonly hash: string;
567
+ readonly fill: UserFill;
568
+ } | {
569
+ readonly kind: 'ledger';
570
+ readonly timeMs: number;
571
+ readonly hash: string;
572
+ readonly update: HypercoreLedgerUpdate;
573
+ };
574
+ /** Normalize a Unix timestamp to milliseconds. */
575
+ declare const toTimeMs: (time: number) => number;
576
+
577
+ type HypercoreFillMeta = {
578
+ /** Fill side / action from Hyperliquid (`Open Long`, `Close Short`, …). */
579
+ readonly dir: string;
580
+ /** Fill price as a decimal string (Hyperliquid `px`). */
581
+ readonly px: string;
582
+ /** Realized PnL for the fill as a decimal string; `"0"` when none. */
583
+ readonly closedPnl: string;
584
+ /** Market coin id (`ETH`, or HIP-3 `dex:TICKER`). */
585
+ readonly coin: string;
586
+ };
587
+ type FillLabel = {
588
+ readonly text: string;
589
+ /** Long / short cue for the UI to pick an icon. */
590
+ readonly direction?: 'up' | 'down';
591
+ readonly tone?: 'profit' | 'loss';
592
+ };
593
+ /** Display ticker with any `dex:` prefix stripped (`xyz:GOLD` → `GOLD`). */
594
+ declare const tickerOfCoin: (coin: string) => string;
595
+ /** PnL tone from `closedPnl` — `dir` alone does not indicate profit vs loss. */
596
+ declare const closedPnlTone: (closedPnl: string | undefined) => "profit" | "loss" | undefined;
597
+ /**
598
+ * Map a fill's `dir` into a display label. Direction follows side
599
+ * (long → up / short → down); success/error tone comes from `closedPnl` when provided.
600
+ */
601
+ declare const fillLabel: (dir: string, closedPnl?: string) => FillLabel;
602
+ /** Compact USD price for fill rows (`$1,684.7`). */
603
+ declare const formatHypercoreFillPx: (px: string) => string;
604
+ declare const encodeHypercoreFillMethod: (meta: HypercoreFillMeta) => string;
605
+ declare const parseHypercoreFillMethod: (method: string | undefined) => HypercoreFillMeta | undefined;
606
+
607
+ /**
608
+ * Semantic label key for a ledger row.
609
+ */
610
+ type HypercoreLedgerLabel = 'deposit' | 'withdraw' | 'sent' | 'received' | 'transferToPerp' | 'transferToSpot' | 'transfer' | 'liquidation' | 'other';
611
+ type HypercoreLedgerDisplay = {
612
+ readonly label: HypercoreLedgerLabel;
613
+ /** Unsigned token amount, e.g. `0.1`. */
614
+ readonly amount: string;
615
+ readonly symbol: string;
616
+ /** Signed USD value for the fiat line; undefined when there's nothing to show. */
617
+ readonly usdValue?: number;
618
+ readonly direction: 'positive' | 'negative' | 'neutral';
619
+ readonly from?: string;
620
+ readonly to?: string;
621
+ readonly rawType: string;
622
+ };
623
+ /**
624
+ * Derives label, amount, signed USD value, and counterparties for a HyperCore
625
+ * ledger update from the owner's perspective.
626
+ */
627
+ declare const getHypercoreLedgerDisplay: (update: HypercoreLedgerUpdate, evmAddress: string) => HypercoreLedgerDisplay;
628
+
629
+ /**
630
+ * Safety cap only — ledger events are infrequent vs fills, so we normally stop
631
+ * on an empty page well before this. Hitting the cap would truncate the *newest*
632
+ * updates (pages are ascending from `startTime`).
633
+ */
634
+ declare const MAX_LEDGER_PAGES = 20;
635
+ /** Default ledger window; keep short so a capped crawl still covers recent activity. */
636
+ declare const LEDGER_LOOKBACK_MS: number;
637
+ type FetchHypercoreActivityOptions = {
638
+ signal?: AbortSignal;
639
+ };
640
+ /**
641
+ * Fetches HyperCore fills + non-funding ledger updates and sorts newest-first.
642
+ * Soft-fails individual endpoints so a flaky fills or ledger call still yields
643
+ * partial history (abort errors are rethrown).
644
+ */
645
+ declare const fetchHypercoreActivity: (client: HypercoreInfoClient, evmAddress: string, options?: FetchHypercoreActivityOptions) => Promise<HypercoreActivityItem[]>;
646
+
647
+ declare const mapHypercoreActivityToTransactions: (items: readonly HypercoreActivityItem[], evmAddress: string, network: Pick<Network, "explorerUrl" | "caipId" | "chainId">) => Transaction[];
648
+
649
+ export { ClearinghouseState, FillLabel, HYPERCORE_CAIP_ID, HYPERCORE_CHAIN_ID, HYPERCORE_USDC_DECIMALS, HYPERCORE_USDC_NAME, HYPERCORE_USDC_SYMBOL, HYPERLIQUID_COIN_SVG_BASE, HypercoreActivityItem, HypercoreFillMeta, HypercoreInfoClient, HypercoreInfoClientConfig, HypercoreInfoRequest, HypercoreLedgerDisplay, HypercoreLedgerLabel, HypercoreLedgerUpdate, HypercoreModule, HypercoreNativeTokenBalance, HypercoreSpotTokenBalance, HypercoreTokenBalance, LEDGER_LOOKBACK_MS, MAX_LEDGER_PAGES, PostInfoOptions, SpotBalance, SpotClearinghouseState, SpotMetaResponse, UserAbstractionMode, UserFill, buildHypercoreTokens, clearinghouseStateSchema, closedPnlTone, encodeHypercoreFillMethod, fetchHypercoreActivity, fillLabel, formatHypercoreFillPx, getHypercoreLedgerDisplay, getPerpCollateralUsd, hypercoreLedgerDeltaSchema, hypercoreLedgerUpdateSchema, hypercoreLedgerUpdatesSchema, hyperliquidCoinSvgKey, hyperliquidCoinSvgUrl, mapHypercoreActivityToTransactions, parseHypercoreFillMethod, spotClearinghouseStateSchema, spotCountsAsPerpCollateral, spotMetaResponseSchema, tickerOfCoin, toHypercoreSpotTokens, toTimeMs, userAbstractionSchema, userFillSchema, userFillsSchema };