@avalabs/hypercore-module 0.0.0-feat-add-hyperliquid-modules-20260714192934

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,640 @@
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
+ declare const HYPERCORE_CAIP_ID = "hlcore:mainnet";
28
+ /**
29
+ * Synthetic numeric id used by Core network lists / storage keys.
30
+ * Not an EVM chain id — module routing uses {@link HYPERCORE_CAIP_ID}.
31
+ */
32
+ declare const HYPERCORE_CHAIN_ID = 9999;
33
+ declare const HYPERCORE_USDC_SYMBOL = "USDC";
34
+ declare const HYPERCORE_USDC_NAME = "USD Coin";
35
+ declare const HYPERCORE_USDC_DECIMALS = 8;
36
+
37
+ /** `type: "spotMeta"` — registry mapping spot token index → display metadata. */
38
+ declare const spotMetaResponseSchema: z.ZodObject<{
39
+ tokens: z.ZodArray<z.ZodObject<{
40
+ name: z.ZodString;
41
+ index: z.ZodNumber;
42
+ weiDecimals: z.ZodNumber;
43
+ fullName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
44
+ evmContract: z.ZodOptional<z.ZodNullable<z.ZodObject<{
45
+ address: z.ZodString;
46
+ }, "strip", z.ZodTypeAny, {
47
+ address: string;
48
+ }, {
49
+ address: string;
50
+ }>>>;
51
+ }, "strip", z.ZodTypeAny, {
52
+ name: string;
53
+ index: number;
54
+ weiDecimals: number;
55
+ fullName?: string | null | undefined;
56
+ evmContract?: {
57
+ address: string;
58
+ } | null | undefined;
59
+ }, {
60
+ name: string;
61
+ index: number;
62
+ weiDecimals: number;
63
+ fullName?: string | null | undefined;
64
+ evmContract?: {
65
+ address: string;
66
+ } | null | undefined;
67
+ }>, "many">;
68
+ }, "strip", z.ZodTypeAny, {
69
+ tokens: {
70
+ name: string;
71
+ index: number;
72
+ weiDecimals: number;
73
+ fullName?: string | null | undefined;
74
+ evmContract?: {
75
+ address: string;
76
+ } | null | undefined;
77
+ }[];
78
+ }, {
79
+ tokens: {
80
+ name: string;
81
+ index: number;
82
+ weiDecimals: number;
83
+ fullName?: string | null | undefined;
84
+ evmContract?: {
85
+ address: string;
86
+ } | null | undefined;
87
+ }[];
88
+ }>;
89
+ /** `type: "spotClearinghouseState"` */
90
+ declare const spotClearinghouseStateSchema: z.ZodObject<{
91
+ balances: z.ZodArray<z.ZodObject<{
92
+ coin: z.ZodString;
93
+ token: z.ZodNumber;
94
+ total: z.ZodString;
95
+ hold: z.ZodString;
96
+ entryNtl: z.ZodOptional<z.ZodString>;
97
+ }, "strip", z.ZodTypeAny, {
98
+ coin: string;
99
+ token: number;
100
+ total: string;
101
+ hold: string;
102
+ entryNtl?: string | undefined;
103
+ }, {
104
+ coin: string;
105
+ token: number;
106
+ total: string;
107
+ hold: string;
108
+ entryNtl?: string | undefined;
109
+ }>, "many">;
110
+ }, "strip", z.ZodTypeAny, {
111
+ balances: {
112
+ coin: string;
113
+ token: number;
114
+ total: string;
115
+ hold: string;
116
+ entryNtl?: string | undefined;
117
+ }[];
118
+ }, {
119
+ balances: {
120
+ coin: string;
121
+ token: number;
122
+ total: string;
123
+ hold: string;
124
+ entryNtl?: string | undefined;
125
+ }[];
126
+ }>;
127
+ /**
128
+ * `type: "clearinghouseState"` — only fields needed for PnL-excluded
129
+ * perp collateral fold-in.
130
+ */
131
+ declare const clearinghouseStateSchema: z.ZodObject<{
132
+ assetPositions: z.ZodArray<z.ZodObject<{
133
+ position: z.ZodObject<{
134
+ unrealizedPnl: z.ZodString;
135
+ }, "strip", z.ZodTypeAny, {
136
+ unrealizedPnl: string;
137
+ }, {
138
+ unrealizedPnl: string;
139
+ }>;
140
+ }, "strip", z.ZodTypeAny, {
141
+ position: {
142
+ unrealizedPnl: string;
143
+ };
144
+ }, {
145
+ position: {
146
+ unrealizedPnl: string;
147
+ };
148
+ }>, "many">;
149
+ crossMarginSummary: z.ZodObject<{
150
+ accountValue: z.ZodString;
151
+ totalMarginUsed: z.ZodOptional<z.ZodString>;
152
+ totalNtlPos: z.ZodOptional<z.ZodString>;
153
+ totalRawUsd: z.ZodOptional<z.ZodString>;
154
+ }, "strip", z.ZodTypeAny, {
155
+ accountValue: string;
156
+ totalMarginUsed?: string | undefined;
157
+ totalNtlPos?: string | undefined;
158
+ totalRawUsd?: string | undefined;
159
+ }, {
160
+ accountValue: string;
161
+ totalMarginUsed?: string | undefined;
162
+ totalNtlPos?: string | undefined;
163
+ totalRawUsd?: string | undefined;
164
+ }>;
165
+ }, "strip", z.ZodTypeAny, {
166
+ assetPositions: {
167
+ position: {
168
+ unrealizedPnl: string;
169
+ };
170
+ }[];
171
+ crossMarginSummary: {
172
+ accountValue: string;
173
+ totalMarginUsed?: string | undefined;
174
+ totalNtlPos?: string | undefined;
175
+ totalRawUsd?: string | undefined;
176
+ };
177
+ }, {
178
+ assetPositions: {
179
+ position: {
180
+ unrealizedPnl: string;
181
+ };
182
+ }[];
183
+ crossMarginSummary: {
184
+ accountValue: string;
185
+ totalMarginUsed?: string | undefined;
186
+ totalNtlPos?: string | undefined;
187
+ totalRawUsd?: string | undefined;
188
+ };
189
+ }>;
190
+ type UserAbstractionMode = 'unifiedAccount' | 'portfolioMargin' | 'dexAbstraction' | 'disabled' | 'default';
191
+ /**
192
+ * `type: "userAbstraction"` — bare JSON string. Unknown future values coerce
193
+ * to `"default"` so balance math stays conservative.
194
+ */
195
+ declare const userAbstractionSchema: z.ZodEffects<z.ZodString, "unifiedAccount" | "portfolioMargin" | "dexAbstraction" | "disabled" | "default", string>;
196
+ /** `type: "userFills"` */
197
+ declare const userFillSchema: z.ZodObject<{
198
+ closedPnl: z.ZodString;
199
+ coin: z.ZodString;
200
+ crossed: z.ZodBoolean;
201
+ dir: z.ZodString;
202
+ hash: z.ZodString;
203
+ oid: z.ZodNumber;
204
+ px: z.ZodString;
205
+ side: z.ZodString;
206
+ startPosition: z.ZodString;
207
+ sz: z.ZodString;
208
+ time: z.ZodNumber;
209
+ fee: z.ZodOptional<z.ZodString>;
210
+ tid: z.ZodOptional<z.ZodNumber>;
211
+ }, "strip", z.ZodTypeAny, {
212
+ coin: string;
213
+ closedPnl: string;
214
+ crossed: boolean;
215
+ dir: string;
216
+ hash: string;
217
+ oid: number;
218
+ px: string;
219
+ side: string;
220
+ startPosition: string;
221
+ sz: string;
222
+ time: number;
223
+ fee?: string | undefined;
224
+ tid?: number | undefined;
225
+ }, {
226
+ coin: string;
227
+ closedPnl: string;
228
+ crossed: boolean;
229
+ dir: string;
230
+ hash: string;
231
+ oid: number;
232
+ px: string;
233
+ side: string;
234
+ startPosition: string;
235
+ sz: string;
236
+ time: number;
237
+ fee?: string | undefined;
238
+ tid?: number | undefined;
239
+ }>;
240
+ declare const userFillsSchema: z.ZodArray<z.ZodObject<{
241
+ closedPnl: z.ZodString;
242
+ coin: z.ZodString;
243
+ crossed: z.ZodBoolean;
244
+ dir: z.ZodString;
245
+ hash: z.ZodString;
246
+ oid: z.ZodNumber;
247
+ px: z.ZodString;
248
+ side: z.ZodString;
249
+ startPosition: z.ZodString;
250
+ sz: z.ZodString;
251
+ time: z.ZodNumber;
252
+ fee: z.ZodOptional<z.ZodString>;
253
+ tid: z.ZodOptional<z.ZodNumber>;
254
+ }, "strip", z.ZodTypeAny, {
255
+ coin: string;
256
+ closedPnl: string;
257
+ crossed: boolean;
258
+ dir: string;
259
+ hash: string;
260
+ oid: number;
261
+ px: string;
262
+ side: string;
263
+ startPosition: string;
264
+ sz: string;
265
+ time: number;
266
+ fee?: string | undefined;
267
+ tid?: number | undefined;
268
+ }, {
269
+ coin: string;
270
+ closedPnl: string;
271
+ crossed: boolean;
272
+ dir: string;
273
+ hash: string;
274
+ oid: number;
275
+ px: string;
276
+ side: string;
277
+ startPosition: string;
278
+ sz: string;
279
+ time: number;
280
+ fee?: string | undefined;
281
+ tid?: number | undefined;
282
+ }>, "many">;
283
+ /**
284
+ * `userNonFundingLedgerUpdates` deltas — permissive so unknown delta types
285
+ * still parse and can render generically later.
286
+ */
287
+ declare const hypercoreLedgerDeltaSchema: z.ZodObject<{
288
+ type: z.ZodString;
289
+ usdc: z.ZodOptional<z.ZodString>;
290
+ amount: z.ZodOptional<z.ZodString>;
291
+ usdcValue: z.ZodOptional<z.ZodString>;
292
+ token: z.ZodOptional<z.ZodString>;
293
+ user: z.ZodOptional<z.ZodString>;
294
+ destination: z.ZodOptional<z.ZodString>;
295
+ fee: z.ZodOptional<z.ZodString>;
296
+ toPerp: z.ZodOptional<z.ZodBoolean>;
297
+ }, "strip", z.ZodTypeAny, {
298
+ type: string;
299
+ token?: string | undefined;
300
+ fee?: string | undefined;
301
+ usdc?: string | undefined;
302
+ amount?: string | undefined;
303
+ usdcValue?: string | undefined;
304
+ user?: string | undefined;
305
+ destination?: string | undefined;
306
+ toPerp?: boolean | undefined;
307
+ }, {
308
+ type: string;
309
+ token?: string | undefined;
310
+ fee?: string | undefined;
311
+ usdc?: string | undefined;
312
+ amount?: string | undefined;
313
+ usdcValue?: string | undefined;
314
+ user?: string | undefined;
315
+ destination?: string | undefined;
316
+ toPerp?: boolean | undefined;
317
+ }>;
318
+ declare const hypercoreLedgerUpdateSchema: z.ZodObject<{
319
+ time: z.ZodNumber;
320
+ hash: z.ZodString;
321
+ delta: z.ZodObject<{
322
+ type: z.ZodString;
323
+ usdc: z.ZodOptional<z.ZodString>;
324
+ amount: z.ZodOptional<z.ZodString>;
325
+ usdcValue: z.ZodOptional<z.ZodString>;
326
+ token: z.ZodOptional<z.ZodString>;
327
+ user: z.ZodOptional<z.ZodString>;
328
+ destination: z.ZodOptional<z.ZodString>;
329
+ fee: z.ZodOptional<z.ZodString>;
330
+ toPerp: z.ZodOptional<z.ZodBoolean>;
331
+ }, "strip", z.ZodTypeAny, {
332
+ type: string;
333
+ token?: string | undefined;
334
+ fee?: string | undefined;
335
+ usdc?: string | undefined;
336
+ amount?: string | undefined;
337
+ usdcValue?: string | undefined;
338
+ user?: string | undefined;
339
+ destination?: string | undefined;
340
+ toPerp?: boolean | undefined;
341
+ }, {
342
+ type: string;
343
+ token?: string | undefined;
344
+ fee?: string | undefined;
345
+ usdc?: string | undefined;
346
+ amount?: string | undefined;
347
+ usdcValue?: string | undefined;
348
+ user?: string | undefined;
349
+ destination?: string | undefined;
350
+ toPerp?: boolean | undefined;
351
+ }>;
352
+ }, "strip", z.ZodTypeAny, {
353
+ hash: string;
354
+ time: number;
355
+ delta: {
356
+ type: string;
357
+ token?: string | undefined;
358
+ fee?: string | undefined;
359
+ usdc?: string | undefined;
360
+ amount?: string | undefined;
361
+ usdcValue?: string | undefined;
362
+ user?: string | undefined;
363
+ destination?: string | undefined;
364
+ toPerp?: boolean | undefined;
365
+ };
366
+ }, {
367
+ hash: string;
368
+ time: number;
369
+ delta: {
370
+ type: string;
371
+ token?: string | undefined;
372
+ fee?: string | undefined;
373
+ usdc?: string | undefined;
374
+ amount?: string | undefined;
375
+ usdcValue?: string | undefined;
376
+ user?: string | undefined;
377
+ destination?: string | undefined;
378
+ toPerp?: boolean | undefined;
379
+ };
380
+ }>;
381
+ declare const hypercoreLedgerUpdatesSchema: z.ZodArray<z.ZodObject<{
382
+ time: z.ZodNumber;
383
+ hash: z.ZodString;
384
+ delta: z.ZodObject<{
385
+ type: z.ZodString;
386
+ usdc: z.ZodOptional<z.ZodString>;
387
+ amount: z.ZodOptional<z.ZodString>;
388
+ usdcValue: z.ZodOptional<z.ZodString>;
389
+ token: z.ZodOptional<z.ZodString>;
390
+ user: z.ZodOptional<z.ZodString>;
391
+ destination: z.ZodOptional<z.ZodString>;
392
+ fee: z.ZodOptional<z.ZodString>;
393
+ toPerp: z.ZodOptional<z.ZodBoolean>;
394
+ }, "strip", z.ZodTypeAny, {
395
+ type: string;
396
+ token?: string | undefined;
397
+ fee?: string | undefined;
398
+ usdc?: string | undefined;
399
+ amount?: string | undefined;
400
+ usdcValue?: string | undefined;
401
+ user?: string | undefined;
402
+ destination?: string | undefined;
403
+ toPerp?: boolean | undefined;
404
+ }, {
405
+ type: string;
406
+ token?: string | undefined;
407
+ fee?: string | undefined;
408
+ usdc?: string | undefined;
409
+ amount?: string | undefined;
410
+ usdcValue?: string | undefined;
411
+ user?: string | undefined;
412
+ destination?: string | undefined;
413
+ toPerp?: boolean | undefined;
414
+ }>;
415
+ }, "strip", z.ZodTypeAny, {
416
+ hash: string;
417
+ time: number;
418
+ delta: {
419
+ type: string;
420
+ token?: string | undefined;
421
+ fee?: string | undefined;
422
+ usdc?: string | undefined;
423
+ amount?: string | undefined;
424
+ usdcValue?: string | undefined;
425
+ user?: string | undefined;
426
+ destination?: string | undefined;
427
+ toPerp?: boolean | undefined;
428
+ };
429
+ }, {
430
+ hash: string;
431
+ time: number;
432
+ delta: {
433
+ type: string;
434
+ token?: string | undefined;
435
+ fee?: string | undefined;
436
+ usdc?: string | undefined;
437
+ amount?: string | undefined;
438
+ usdcValue?: string | undefined;
439
+ user?: string | undefined;
440
+ destination?: string | undefined;
441
+ toPerp?: boolean | undefined;
442
+ };
443
+ }>, "many">;
444
+ type SpotMetaResponse = z.infer<typeof spotMetaResponseSchema>;
445
+ type SpotBalance = {
446
+ coin: string;
447
+ token: number;
448
+ total: string;
449
+ hold: string;
450
+ entryNtl?: string;
451
+ };
452
+ type SpotClearinghouseState = {
453
+ balances: SpotBalance[];
454
+ };
455
+ type ClearinghouseState = z.infer<typeof clearinghouseStateSchema>;
456
+ type UserFill = z.infer<typeof userFillSchema>;
457
+ type HypercoreLedgerUpdate = z.infer<typeof hypercoreLedgerUpdateSchema>;
458
+
459
+ type HypercoreInfoRequest = {
460
+ type: 'spotMeta';
461
+ } | {
462
+ type: 'spotClearinghouseState';
463
+ user: string;
464
+ dex?: string;
465
+ } | {
466
+ type: 'clearinghouseState';
467
+ user: string;
468
+ dex?: string;
469
+ } | {
470
+ type: 'userAbstraction';
471
+ user: string;
472
+ } | {
473
+ type: 'userFills';
474
+ user: string;
475
+ } | {
476
+ type: 'userNonFundingLedgerUpdates';
477
+ user: string;
478
+ startTime: number;
479
+ };
480
+ type HypercoreInfoClientConfig = {
481
+ /** Proxy-first `/info` URL used for balances and spot meta. */
482
+ infoUrl: string;
483
+ /**
484
+ * Activity URL. Defaults to `infoUrl`; may be the public HL endpoint when
485
+ * the proxy does not yet support fills/ledger types.
486
+ */
487
+ activityInfoUrl?: string;
488
+ fetch?: typeof globalThis.fetch;
489
+ };
490
+ type PostInfoOptions = {
491
+ signal?: AbortSignal;
492
+ /** Overrides the client default URL for this call. */
493
+ url?: string;
494
+ };
495
+ declare class HypercoreInfoClient {
496
+ #private;
497
+ constructor(config: HypercoreInfoClientConfig);
498
+ postInfo<T>(body: HypercoreInfoRequest, schema: z.ZodType<T>, options?: PostInfoOptions): Promise<T>;
499
+ getSpotMeta(options?: PostInfoOptions): Promise<SpotMetaResponse>;
500
+ getSpotClearinghouseState(user: string, options?: PostInfoOptions): Promise<SpotClearinghouseState>;
501
+ getClearinghouseState(user: string, options?: PostInfoOptions): Promise<ClearinghouseState>;
502
+ getUserAbstraction(user: string, options?: PostInfoOptions): Promise<UserAbstractionMode>;
503
+ getUserFills(user: string, options?: PostInfoOptions): Promise<UserFill[]>;
504
+ getUserNonFundingLedgerUpdates(user: string, startTime: number, options?: PostInfoOptions): Promise<HypercoreLedgerUpdate[]>;
505
+ }
506
+
507
+ /**
508
+ * Maps `spotMeta` tokens to the registry used when resolving spot balances.
509
+ * Keeps every spot token (including HyperCore-only ones without an EVM contract).
510
+ */
511
+ declare const toHypercoreSpotTokens: (tokens: SpotMetaResponse["tokens"]) => HypercoreSpotToken[];
512
+
513
+ type HypercoreNativeTokenBalance = {
514
+ kind: 'native';
515
+ name: string;
516
+ symbol: typeof HYPERCORE_USDC_SYMBOL;
517
+ decimals: number;
518
+ /** Human-readable amount (decimal string). */
519
+ balance: string;
520
+ /** Integer raw amount as a decimal string (no fractional part). */
521
+ balanceRaw: string;
522
+ priceUsd: 1;
523
+ balanceUsd: string;
524
+ };
525
+ type HypercoreSpotTokenBalance = {
526
+ kind: 'spot';
527
+ name: string;
528
+ symbol: string;
529
+ decimals: number;
530
+ balance: string;
531
+ balanceRaw: string;
532
+ index: number;
533
+ evmContract?: string;
534
+ };
535
+ type HypercoreTokenBalance = HypercoreNativeTokenBalance | HypercoreSpotTokenBalance;
536
+ /**
537
+ * `true` when spot balances already back perps for this account mode
538
+ * (`unifiedAccount`). Other modes keep perp collateral on a separate ledger.
539
+ */
540
+ declare const spotCountsAsPerpCollateral: (mode: UserAbstractionMode | undefined) => mode is "unifiedAccount";
541
+ /**
542
+ * Perp collateral in USDC, excluding unrealized PnL.
543
+ * `crossMarginSummary.accountValue` is collateral ± PnL; we back PnL out.
544
+ */
545
+ declare const getPerpCollateralUsd: (perp: ClearinghouseState | undefined) => Big.Big;
546
+ /**
547
+ * USDC merges spot + (non-unified) PnL-excluded perp collateral at $1.
548
+ * Other spot inventory is `HYPERCORE_SPOT` (no synthetic ERC20 addresses).
549
+ */
550
+ declare const buildHypercoreTokens: ({ spotBalances, perpState, abstractionMode, spotTokens, }: {
551
+ spotBalances: readonly SpotBalance[];
552
+ perpState: ClearinghouseState | undefined;
553
+ abstractionMode: UserAbstractionMode | undefined;
554
+ spotTokens: HypercoreSpotToken[];
555
+ }) => HypercoreTokenBalance[];
556
+
557
+ declare const HYPERLIQUID_COIN_SVG_BASE = "https://app.hyperliquid.xyz/coins";
558
+ declare const hyperliquidCoinSvgKey: (coin: string) => string;
559
+ declare const hyperliquidCoinSvgUrl: (coin: string) => string;
560
+
561
+ type HypercoreActivityItem = {
562
+ readonly kind: 'fill';
563
+ readonly timeMs: number;
564
+ readonly hash: string;
565
+ readonly fill: UserFill;
566
+ } | {
567
+ readonly kind: 'ledger';
568
+ readonly timeMs: number;
569
+ readonly hash: string;
570
+ readonly update: HypercoreLedgerUpdate;
571
+ };
572
+ /** Normalize a Unix timestamp to milliseconds. */
573
+ declare const toTimeMs: (time: number) => number;
574
+
575
+ declare const FILL_ARROW_UP = "\u25B2";
576
+ declare const FILL_ARROW_DOWN = "\u25BC";
577
+ type HypercoreFillMeta = {
578
+ readonly dir: string;
579
+ readonly px: string;
580
+ readonly closedPnl: string;
581
+ readonly coin: string;
582
+ };
583
+ type FillLabel = {
584
+ readonly text: string;
585
+ readonly arrow?: typeof FILL_ARROW_UP | typeof FILL_ARROW_DOWN;
586
+ readonly tone?: 'profit' | 'loss';
587
+ };
588
+ /** Display ticker with any `dex:` prefix stripped (`xyz:GOLD` → `GOLD`). */
589
+ declare const tickerOfCoin: (coin: string) => string;
590
+ /** PnL tone from `closedPnl` — `dir` alone does not indicate profit vs loss. */
591
+ declare const closedPnlTone: (closedPnl: string | undefined) => "profit" | "loss" | undefined;
592
+ /**
593
+ * Map a fill's `dir` into a display label. Arrow direction follows side
594
+ * (long ▲ / short ▼); success/error tone comes from `closedPnl` when provided.
595
+ */
596
+ declare const fillLabel: (dir: string, closedPnl?: string) => FillLabel;
597
+ /** Compact USD price for fill rows (`$1,684.7`). */
598
+ declare const formatHypercoreFillPx: (px: string) => string;
599
+ declare const encodeHypercoreFillMethod: (meta: HypercoreFillMeta) => string;
600
+ declare const parseHypercoreFillMethod: (method: string | undefined) => HypercoreFillMeta | undefined;
601
+
602
+ /**
603
+ * Semantic label key for a ledger row.
604
+ */
605
+ type HypercoreLedgerLabel = 'deposit' | 'withdraw' | 'sent' | 'received' | 'transferToPerp' | 'transferToSpot' | 'transfer' | 'liquidation' | 'other';
606
+ type HypercoreLedgerDisplay = {
607
+ readonly label: HypercoreLedgerLabel;
608
+ /** Unsigned token amount, e.g. `0.1`. */
609
+ readonly amount: string;
610
+ readonly symbol: string;
611
+ /** Signed USD value for the fiat line; undefined when there's nothing to show. */
612
+ readonly usdValue?: number;
613
+ readonly direction: 'positive' | 'negative' | 'neutral';
614
+ readonly from?: string;
615
+ readonly to?: string;
616
+ readonly rawType: string;
617
+ };
618
+ /**
619
+ * Derives label, amount, signed USD value, and counterparties for a HyperCore
620
+ * ledger update from the owner's perspective.
621
+ */
622
+ declare const getHypercoreLedgerDisplay: (update: HypercoreLedgerUpdate, evmAddress: string) => HypercoreLedgerDisplay;
623
+
624
+ /** Bound ledger pagination so busy accounts cannot trigger unbounded requests. */
625
+ declare const MAX_LEDGER_PAGES = 20;
626
+ /** Prefer recent ledger history; paging from `0` would return the oldest pages first. */
627
+ declare const LEDGER_LOOKBACK_MS: number;
628
+ type FetchHypercoreActivityOptions = {
629
+ signal?: AbortSignal;
630
+ };
631
+ /**
632
+ * Fetches HyperCore fills + non-funding ledger updates and sorts newest-first.
633
+ * Soft-fails individual endpoints so a flaky fills or ledger call still yields
634
+ * partial history (abort errors are rethrown).
635
+ */
636
+ declare const fetchHypercoreActivity: (client: HypercoreInfoClient, evmAddress: string, options?: FetchHypercoreActivityOptions) => Promise<HypercoreActivityItem[]>;
637
+
638
+ declare const mapHypercoreActivityToTransactions: (items: readonly HypercoreActivityItem[], evmAddress: string, network: Pick<Network, "explorerUrl" | "caipId" | "chainId">) => Transaction[];
639
+
640
+ export { ClearinghouseState, FILL_ARROW_DOWN, FILL_ARROW_UP, 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 };
package/dist/index.js ADDED
@@ -0,0 +1,13 @@
1
+ import { Environment, TokenType, TransactionType, WalletType, NetworkVMType, parseManifest } from '@avalabs/vm-module-types';
2
+ import { rpcErrors } from '@metamask/rpc-errors';
3
+ import { z as z$1 } from 'zod';
4
+ import C from 'big.js';
5
+ import { getEvmAddressFromPubKey, getAddressFromXPub } from '@avalabs/core-wallets-sdk';
6
+ import { computeAddress } from 'ethers';
7
+ import { init, deriveAddressesForEvm } from '@avalabs/crypto-sdk';
8
+
9
+ var we=Object.defineProperty;var n=(e,t)=>we(e,"name",{value:t,configurable:!0});var _=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var m=(e,t,r)=>(_(e,t,"read from private field"),r?r.call(e):t.get(e)),f=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r);},g=(e,t,r,o)=>(_(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var V={name:"HyperCore",description:"Read-only Hyperliquid HyperCore module (balances, tokens, activity).",version:"0.0.1",sources:{module:{checksum:"",location:{npm:{filePath:"dist/index.js",packageName:"@avalabs/hypercore-module",registry:"https://registry.npmjs.org"}}}},network:{chainIds:["hlcore:mainnet"],namespaces:["hlcore"]},cointype:"60",permissions:{rpc:{dapps:!1,methods:[],nonRestrictedMethods:[]}},manifestVersion:"0.1"};var Y="/proxy/nownodes/hype/info",$="https://api.hyperliquid.xyz/info",ke={proxyApiUrl:"https://proxy-api.avax.network",infoUrl:`https://proxy-api.avax.network${Y}`,activityInfoUrl:$},Ae={proxyApiUrl:"https://proxy-api-dev.avax.network",infoUrl:`https://proxy-api-dev.avax.network${Y}`,activityInfoUrl:$},j=n(e=>{switch(e){case Environment.PRODUCTION:return ke;case Environment.DEV:return Ae}},"getEnv");var Re=z$1.coerce.number(),q=z$1.object({tokens:z$1.array(z$1.object({name:z$1.string(),index:z$1.number(),weiDecimals:z$1.number(),fullName:z$1.string().nullish(),evmContract:z$1.object({address:z$1.string()}).nullish()}))}),Ie=z$1.object({coin:z$1.string(),token:Re,total:z$1.string(),hold:z$1.string(),entryNtl:z$1.string().optional()}),W=z$1.object({balances:z$1.array(Ie)}),Ee=z$1.object({accountValue:z$1.string(),totalMarginUsed:z$1.string().optional(),totalNtlPos:z$1.string().optional(),totalRawUsd:z$1.string().optional()}),z=z$1.object({assetPositions:z$1.array(z$1.object({position:z$1.object({unrealizedPnl:z$1.string()})})),crossMarginSummary:Ee}),K=z$1.string().transform(e=>{switch(e){case"unifiedAccount":case"portfolioMargin":case"dexAbstraction":case"disabled":case"default":return e;default:return "default"}}),De=z$1.object({closedPnl:z$1.string(),coin:z$1.string(),crossed:z$1.boolean(),dir:z$1.string(),hash:z$1.string(),oid:z$1.number(),px:z$1.string(),side:z$1.string(),startPosition:z$1.string(),sz:z$1.string(),time:z$1.number(),fee:z$1.string().optional(),tid:z$1.number().optional()}),J=z$1.array(De),Me=z$1.object({type:z$1.string(),usdc:z$1.string().optional(),amount:z$1.string().optional(),usdcValue:z$1.string().optional(),token:z$1.string().optional(),user:z$1.string().optional(),destination:z$1.string().optional(),fee:z$1.string().optional(),toPerp:z$1.boolean().optional()}),Oe=z$1.object({time:z$1.number(),hash:z$1.string(),delta:Me}),X=z$1.array(Oe);var H=n(e=>e.toLowerCase(),"lowercaseUser"),k,P,A,O=class O{constructor(t){f(this,k,void 0);f(this,P,void 0);f(this,A,void 0);g(this,k,t.infoUrl),g(this,P,t.activityInfoUrl??t.infoUrl),g(this,A,t.fetch??globalThis.fetch.bind(globalThis));}async postInfo(t,r,o){let i=await m(this,A).call(this,o?.url??m(this,k),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:o?.signal});if(!i.ok)throw new Error(`Hyperliquid /info failed: ${i.status} ${i.statusText}`);let p=await i.json();return r.parse(p)}getSpotMeta(t){return this.postInfo({type:"spotMeta"},q,t)}getSpotClearinghouseState(t,r){return this.postInfo({type:"spotClearinghouseState",user:H(t),dex:""},W,r)}getClearinghouseState(t,r){return this.postInfo({type:"clearinghouseState",user:H(t),dex:""},z,r)}getUserAbstraction(t,r){return this.postInfo({type:"userAbstraction",user:H(t)},K,r)}getUserFills(t,r){return this.postInfo({type:"userFills",user:H(t)},J,{...r,url:r?.url??m(this,P)})}getUserNonFundingLedgerUpdates(t,r,o){return this.postInfo({type:"userNonFundingLedgerUpdates",user:H(t),startTime:r},X,{...o,url:o?.url??m(this,P)})}};k=new WeakMap,P=new WeakMap,A=new WeakMap,n(O,"HypercoreInfoClient");var E=O;var N=n(e=>`HyperCore does not support ${e}: read-only module (balances, tokens, activity).`,"unsupportedHypercoreCapabilityMessage");var Z="hlcore:mainnet",vt=9999,D="USDC",Q="USD Coin",F=8;var h=new C(0),Ne=n(e=>e==="unifiedAccount","spotCountsAsPerpCollateral"),ee=n((e,t)=>e.times(new C(10).pow(t)).round(0,C.roundDown).toFixed(0),"toRawBalance"),Fe=n(e=>{if(!e)return h;let t=new C(e.crossMarginSummary.accountValue??"0"),r=e.assetPositions.reduce((i,{position:p})=>i.plus(p.unrealizedPnl),h),o=t.minus(r);return o.gt(h)?o:h},"getPerpCollateralUsd"),te=n(({spotBalances:e,perpState:t,abstractionMode:r,spotTokens:o})=>{let i=new Map(o.map(d=>[d.index,d])),p=Ne(r)?h:Fe(t),a=e.find(d=>d.coin.toUpperCase()===D),c=new C(a?.total??"0").plus(p),l=[];c.gt(h)&&l.push({kind:"native",name:Q,symbol:D,decimals:8,balance:c.toString(),balanceRaw:ee(c,8),priceUsd:1,balanceUsd:c.toString()});for(let d of e){if(d.coin.toUpperCase()===D)continue;let u=i.get(d.token),w=new C(d.total);!u||!w.gt(h)||l.push({kind:"spot",name:u.name,symbol:u.symbol,decimals:u.decimals,balance:w.toString(),balanceRaw:ee(w,u.decimals),index:u.index,evmContract:u.evmContract});}return l},"buildHypercoreTokens");var Le="https://app.hyperliquid.xyz/coins",Be=n(e=>{let t=e.trim(),r=t.indexOf(":");return r===-1?t.toUpperCase():`${t.slice(0,r)}:${t.slice(r+1).toUpperCase()}`},"hyperliquidCoinSvgKey"),y=n(e=>`${Le}/${encodeURIComponent(Be(e))}.svg`,"hyperliquidCoinSvgUrl");var Ve=n(e=>/^0x[a-fA-F0-9]{40}$/.test(e),"isValidEvmAddress"),M=n(e=>e.map(t=>{let r=t.evmContract?.address.toLowerCase();return {type:TokenType.HYPERCORE_SPOT,index:t.index,name:t.fullName??t.name,symbol:t.name,decimals:t.weiDecimals,evmContract:r&&Ve(r)?r:void 0}}),"toHypercoreSpotTokens");var Ge=n((e,t)=>{if(e.kind==="native"){let i=BigInt(e.balanceRaw),p=Number(e.balanceUsd),a={...t,name:e.name,symbol:e.symbol,decimals:e.decimals,logoUri:t.logoUri??y(e.symbol),coingeckoId:"usd-coin",type:TokenType.NATIVE,balance:i,balanceDisplayValue:e.balance,balanceInCurrency:Number.isFinite(p)?p:0,balanceCurrencyDisplayValue:e.balanceUsd,priceInCurrency:e.priceUsd};return {key:e.symbol,value:a}}let r=BigInt(e.balanceRaw),o={type:TokenType.HYPERCORE_SPOT,name:e.name,symbol:e.symbol,decimals:e.decimals,index:e.index,evmContract:e.evmContract,logoUri:y(e.symbol),reputation:null,balance:r,balanceDisplayValue:e.balance};return {key:`spot:${e.index}`,value:o}},"toTokenWithBalance"),oe=n(async({addresses:e,network:t,infoClient:r})=>{let o=await r.getSpotMeta(),i=M(o.tokens);return (await Promise.allSettled(e.map(async a=>{try{let[c,l,d]=await Promise.all([r.getSpotClearinghouseState(a),r.getClearinghouseState(a).catch(()=>{}),r.getUserAbstraction(a).catch(()=>{})]),u=te({spotBalances:c.balances,perpState:l,abstractionMode:d,spotTokens:i}),w=Object.fromEntries(u.map(Se=>{let{key:Te,value:Ue}=Ge(Se,t.networkToken);return [Te,Ue]}));return {[a]:w}}catch(c){return {[a]:{error:c.toString()}}}}))).reduce((a,c)=>c.status==="fulfilled"?{...a,...c.value}:a,{})},"getBalances");var ne=n(async({infoClient:e})=>{let t=await e.getSpotMeta();return M(t.tokens).map(r=>({...r,logoUri:r.logoUri??y(r.symbol)}))},"getTokens");var R=n(e=>e<1e10?e*1e3:e,"toTimeMs");var Ye=20,$e=365*24*60*60*1e3,je=n(e=>e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError","isAbortError"),se=n(async(e,t)=>{try{return await e}catch(r){if(je(r))throw r;return t}},"softFail"),qe=n(async(e,t,r)=>{let o=[],i=Date.now()-$e,p=0;for(;p<Ye;){if(r?.signal?.aborted)throw new DOMException("The operation was aborted.","AbortError");let a=await e.getUserNonFundingLedgerUpdates(t,i,r);if(p+=1,a.length===0)break;o.push(...a);let c=a[a.length-1];if(!c)break;let l=c.time+1;if(l<=i)break;i=l;}return o},"fetchLedgerUpdates"),ie=n(async(e,t,r)=>{let[o,i]=await Promise.all([se(e.getUserFills(t,r),[]),se(qe(e,t,r),[])]);return [...o.map(a=>({kind:"fill",timeMs:R(a.time),hash:a.hash,fill:a})),...i.map(a=>({kind:"ledger",timeMs:R(a.time),hash:a.hash,update:a}))].sort((a,c)=>c.timeMs-a.timeMs)},"fetchHypercoreActivity");var b=n(e=>{if(e===void 0||e==="")return "";let t=Number.parseFloat(e);return Number.isFinite(t)?new Intl.NumberFormat("en-US",{maximumFractionDigits:6}).format(t):e},"formatAmount"),x=n((e,t)=>{if(e===void 0||e==="")return;let r=Number.parseFloat(e);return Number.isFinite(r)?r*(t===0?1:t):void 0},"toUsd"),ae=n((e,t)=>{let{delta:r}=e,o=t.toLowerCase(),i=r.user?.toLowerCase()===o;switch(r.type){case"deposit":return {label:"deposit",amount:b(r.usdc),symbol:"USDC",usdValue:x(r.usdc,1),direction:"positive",to:t,rawType:r.type};case"withdraw":return {label:"withdraw",amount:b(r.usdc),symbol:"USDC",usdValue:x(r.usdc,-1),direction:"negative",from:t,rawType:r.type};case"send":case"spotTransfer":return {label:i?"sent":"received",amount:b(r.amount),symbol:r.token??"USDC",usdValue:x(r.usdcValue,i?-1:1),direction:i?"negative":"positive",from:r.user,to:r.destination,rawType:r.type};case"internalTransfer":return {label:"transfer",amount:b(r.usdc),symbol:"USDC",usdValue:x(r.usdc,i?-1:1),direction:i?"negative":"positive",from:r.user,to:r.destination,rawType:r.type};case"accountClassTransfer":return {label:r.toPerp?"transferToPerp":"transferToSpot",amount:b(r.usdc),symbol:"USDC",usdValue:x(r.usdc,0),direction:"neutral",rawType:r.type};case"liquidation":return {label:"liquidation",amount:b(r.usdcValue??r.usdc),symbol:"USDC",usdValue:x(r.usdcValue??r.usdc,-1),direction:"negative",rawType:r.type};default:return {label:"other",amount:b(r.usdcValue??r.usdc),symbol:"USDC",usdValue:x(r.usdcValue??r.usdc,0),direction:"neutral",rawType:r.type}}},"getHypercoreLedgerDisplay");var L="hypercoreFill:v1:",We="\u25B2",ze="\u25BC",pe=n(e=>{let t=e.indexOf(":");return t===-1?e:e.slice(t+1)},"tickerOfCoin"),Ke=n(e=>{if(e===void 0)return;let t=Number.parseFloat(e);if(!(!Number.isFinite(t)||t===0))return t>0?"profit":"loss"},"closedPnlTone"),zt=n((e,t)=>{let r=Ke(t),o=e.toLowerCase();return o.includes("close")&&o.includes("long")?{text:"Long closed",arrow:We,tone:r}:o.includes("close")&&o.includes("short")?{text:"Short closed",arrow:ze,tone:r}:o.includes("open")&&(o.includes("long")||o.includes("short"))?{text:"Order opened"}:o.includes("cancel")?{text:"Order cancelled"}:{text:e}},"fillLabel"),Kt=n(e=>{let t=Number.parseFloat(e);return Number.isFinite(t)?`$${t.toLocaleString(void 0,{maximumFractionDigits:8})}`:e},"formatHypercoreFillPx"),ce=n(e=>`${L}${encodeURIComponent(JSON.stringify(e))}`,"encodeHypercoreFillMethod"),Jt=n(e=>{if(e?.startsWith(L))try{let t=JSON.parse(decodeURIComponent(e.slice(L.length)));if(typeof t!="object"||t===null||!("dir"in t)||!("px"in t)||!("closedPnl"in t)||!("coin"in t))return;let{dir:r,px:o,closedPnl:i,coin:p}=t;return typeof r!="string"||typeof o!="string"||typeof i!="string"||typeof p!="string"?void 0:{dir:r,px:o,closedPnl:i,coin:p}}catch{return}},"parseHypercoreFillMethod");var de=n((e,t)=>{let r=(e.explorerUrl??"").replace(/\/$/,"");return r?`${r}/tx/${t}`:t},"explorerTxLink"),me=n(e=>e.caipId??Z,"chainIdForNetwork"),Je=n((e,t,r)=>{let o=e.side==="B",i=pe(e.coin),p={type:TokenType.NATIVE,name:e.coin,symbol:i,amount:e.sz,imageUri:y(e.coin)};return {isContractCall:!1,isIncoming:o,isOutgoing:!o,isSender:!o,timestamp:t,hash:e.hash,from:"",to:"",tokens:[p],gasUsed:"0",txType:TransactionType.FILL_ORDER,method:ce({dir:e.dir??"",px:e.px,closedPnl:e.closedPnl,coin:e.coin}),chainId:me(r),explorerLink:de(r,e.hash)}},"mapFillToTransaction"),Xe=n((e,t,r)=>{let o=ae(e,t),i=o.direction==="positive",p=o.direction==="negative",a=TransactionType.TRANSFER;switch(o.label){case"deposit":case"received":a=TransactionType.RECEIVE;break;case"withdraw":case"sent":a=TransactionType.SEND;break;case"liquidation":a=TransactionType.UNKNOWN;break;default:a=TransactionType.TRANSFER;}let c=o.amount||"0",l={type:TokenType.NATIVE,name:o.symbol,symbol:o.symbol,amount:c,imageUri:y(o.symbol)};return {isContractCall:!1,isIncoming:i,isOutgoing:p,isSender:p,timestamp:R(e.time),hash:e.hash,from:o.from??(p?t:""),to:o.to??(i?t:""),tokens:[l],gasUsed:"0",txType:a,chainId:me(r),explorerLink:de(r,e.hash)}},"mapLedgerToTransaction"),ue=n((e,t,r)=>e.map(o=>o.kind==="fill"?Je(o.fill,o.timeMs,r):Xe(o.update,t,r)),"mapHypercoreActivityToTransactions");var ye=n(async({address:e,network:t,infoClient:r})=>{let o=await ie(r,e);return {transactions:ue(o,e,t)}},"getTransactionHistory");var ge=n(async({accountIndex:e,xpub:t,walletType:r})=>{switch(r){case WalletType.Mnemonic:case WalletType.Ledger:case WalletType.Keystone:return {[NetworkVMType.HYPERCORE]:getAddressFromXPub(t,e)};case WalletType.LedgerLive:case WalletType.Seedless:{let o=Buffer.from(t,"hex");return {[NetworkVMType.HYPERCORE]:getEvmAddressFromPubKey(o)}}default:throw rpcErrors.invalidParams(`Unsupported wallet type: ${r}`)}},"getAddress");var he=n(e=>"derivationPathType"in e&&"accountIndex"in e&&typeof e.accountIndex=="number"&&typeof e.derivationPathType=="string","hasDerivationDetails");var T=n(({accountIndex:e,derivationPathType:t})=>{if(e<0)throw rpcErrors.invalidParams("Account index must be a non-negative integer");switch(t){case"bip44":return {[NetworkVMType.HYPERCORE]:`m/44'/60'/0'/0/${e}`};case"ledger_live":return {[NetworkVMType.HYPERCORE]:`m/44'/60'/${e}'/0/0`};default:throw rpcErrors.invalidParams(`Unsupported derivation path type: ${t}`)}},"buildDerivationPath");var ve=n(async e=>{let{secretId:t,approvalController:r}=e,o=he(e)?T({accountIndex:e.accountIndex,derivationPathType:e.derivationPathType,addressIndex:e.addressIndex}).HYPERCORE:void 0,i=await r.requestPublicKey({curve:"secp256k1",secretId:t,derivationPath:o});return {[NetworkVMType.HYPERCORE]:computeAddress(`0x${i}`)}},"deriveAddress");var Pe=n(async e=>{let{approvalController:t,secretId:r,accountIndices:o,derivationPathType:i}=e;if(o.length===0)return [];await init();let p=await Promise.all(o.map(async c=>{let l=T({accountIndex:c,derivationPathType:i}).HYPERCORE,d=await t.requestPublicKey({curve:"secp256k1",secretId:r,derivationPath:l});return Uint8Array.from(Buffer.from(d,"hex"))}));return (await deriveAddressesForEvm(p)).map(c=>({[NetworkVMType.HYPERCORE]:c}))},"deriveAddresses");var U,v,B=class B{constructor({environment:t,approvalController:r,runtime:o}){f(this,U,void 0);f(this,v,void 0);let{infoUrl:i,activityInfoUrl:p}=j(t);g(this,U,r),g(this,v,new E({infoUrl:i,activityInfoUrl:p,fetch:o?.fetch}));}getProvider(t){return Promise.reject(new Error(N("getProvider")))}getManifest(){let t=parseManifest(V);return t.success?t.data:void 0}getBalances(t){return oe({...t,infoClient:m(this,v)})}getTransactionHistory(t){return ye({...t,infoClient:m(this,v)})}getNetworkFee(t){return Promise.reject(new Error(N("getNetworkFee")))}getAddress(t){return ge(t)}buildDerivationPath(t){return T(t)}deriveAddress(t){return ve({...t,approvalController:m(this,U)})}deriveAddresses(t){return Pe({...t,approvalController:m(this,U)})}getTokens(t){return ne({network:t,infoClient:m(this,v)})}async onRpcRequest(t,r){return {error:rpcErrors.methodNotSupported(`HyperCore is read-only; method ${t.method} is not supported`)}}};U=new WeakMap,v=new WeakMap,n(B,"HypercoreModule");var Ce=B;
10
+
11
+ export { ze as FILL_ARROW_DOWN, We as FILL_ARROW_UP, Z as HYPERCORE_CAIP_ID, vt as HYPERCORE_CHAIN_ID, F as HYPERCORE_USDC_DECIMALS, Q as HYPERCORE_USDC_NAME, D as HYPERCORE_USDC_SYMBOL, Le as HYPERLIQUID_COIN_SVG_BASE, E as HypercoreInfoClient, Ce as HypercoreModule, $e as LEDGER_LOOKBACK_MS, Ye as MAX_LEDGER_PAGES, te as buildHypercoreTokens, z as clearinghouseStateSchema, Ke as closedPnlTone, ce as encodeHypercoreFillMethod, ie as fetchHypercoreActivity, zt as fillLabel, Kt as formatHypercoreFillPx, ae as getHypercoreLedgerDisplay, Fe as getPerpCollateralUsd, Me as hypercoreLedgerDeltaSchema, Oe as hypercoreLedgerUpdateSchema, X as hypercoreLedgerUpdatesSchema, Be as hyperliquidCoinSvgKey, y as hyperliquidCoinSvgUrl, ue as mapHypercoreActivityToTransactions, Jt as parseHypercoreFillMethod, W as spotClearinghouseStateSchema, Ne as spotCountsAsPerpCollateral, q as spotMetaResponseSchema, pe as tickerOfCoin, M as toHypercoreSpotTokens, R as toTimeMs, K as userAbstractionSchema, De as userFillSchema, J as userFillsSchema };
12
+ //# sourceMappingURL=out.js.map
13
+ //# sourceMappingURL=index.js.map