@exponent-labs/exponent-fetcher 0.1.8 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,26 @@
1
+ /**
2
+ * List of CLMM markets and their corresponding ticks accounts to ignore during fetching.
3
+ * These accounts cannot be deserialized due to program updates and should be skipped.
4
+ */
5
+ /**
6
+ * Set of market addresses to ignore. O(1) lookup
7
+ */
8
+ export declare const IGNORED_CLMM_MARKETS: Set<string>;
9
+ /**
10
+ * Set of ticks addresses to ignore. O(1) lookup
11
+ */
12
+ export declare const IGNORED_CLMM_TICKS: Set<string>;
13
+ /**
14
+ * Check if a market address is in the ignore list
15
+ */
16
+ export declare function isMarketIgnored(marketAddress: string): boolean;
17
+ /**
18
+ * Check if a ticks address is in the ignore list
19
+ */
20
+ export declare function isTicksIgnored(ticksAddress: string): boolean;
21
+ /**
22
+ * Error class for ignored CLMM entities
23
+ */
24
+ export declare class IgnoredClmmEntityError extends Error {
25
+ constructor(entityType: "market" | "ticks", address: string);
26
+ }
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ /**
3
+ * List of CLMM markets and their corresponding ticks accounts to ignore during fetching.
4
+ * These accounts cannot be deserialized due to program updates and should be skipped.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.IgnoredClmmEntityError = exports.isTicksIgnored = exports.isMarketIgnored = exports.IGNORED_CLMM_TICKS = exports.IGNORED_CLMM_MARKETS = void 0;
8
+ /**
9
+ * Set of market addresses to ignore. O(1) lookup
10
+ */
11
+ exports.IGNORED_CLMM_MARKETS = new Set([
12
+ "goJv5C2o9oFNVPBxb3QxPgx3FWKNBfJXyqCVovgmkNR",
13
+ "5TSUipMkXQraAik8QVGkvvDFwhLxUjgfW7WqGpsfvG1C",
14
+ "6iUDkx3Ncmapdptet2kxatZHe57cTpLaiCVRq3BGSjkt",
15
+ "AGhNjdgFn3vwmH6tQXLaHA1KW5R8a21pkhyGrzRkW3Np",
16
+ "BoFU7nTuvaMMGNU43MeEV4um1raLckA53y7V3vN4p9pg",
17
+ "BvKk6kTzH9KJ8oTE3MYb5Qw7ZQXqkmqyJJei56kChcZ1",
18
+ "ETY8jyQkVTa4E5obFSZJQmZwaKY2YuuFrzngP6T972g1",
19
+ "JEAfc9wixDjaWtE2qLGH1PhuUWpCXxB3488TR4AVqCmJ",
20
+ ]);
21
+ /**
22
+ * Set of ticks addresses to ignore. O(1) lookup
23
+ */
24
+ exports.IGNORED_CLMM_TICKS = new Set([
25
+ "CP2BPhkBNsWdLMASiZ1Rg7JbuVNzku9S3HuxtqcMG4Q",
26
+ "28CbRwX1rvCREemyT8rA3gE2hWPxbdeShsucU7qTrW7m",
27
+ "4uzyXjF937CiTEZCNjuZSdjuqDMzXt86fiCMh4vTh2yA",
28
+ "6dHjroxhXAd8CkgrJM5M66wetMGY2hHU8pvXHBSHvAFd",
29
+ "6yXTmXhDVxArt6evF1Gi7oPAALp3dU2Pr5YDavRM6n9N",
30
+ "7XEQzU8jYaQCe9wEZ82fYgdCwaZ25DcMfJfJxuHZztWT",
31
+ "FhV2DmgUMkdFA1VB7GrrFazsozUbpV6D3z5Hqv8tetaU",
32
+ "HR9gJD7NSr5jdnk27tbgFhpwjf4QPvwoJbF5ZZofJcNr",
33
+ ]);
34
+ /**
35
+ * Check if a market address is in the ignore list
36
+ */
37
+ function isMarketIgnored(marketAddress) {
38
+ return exports.IGNORED_CLMM_MARKETS.has(marketAddress);
39
+ }
40
+ exports.isMarketIgnored = isMarketIgnored;
41
+ /**
42
+ * Check if a ticks address is in the ignore list
43
+ */
44
+ function isTicksIgnored(ticksAddress) {
45
+ return exports.IGNORED_CLMM_TICKS.has(ticksAddress);
46
+ }
47
+ exports.isTicksIgnored = isTicksIgnored;
48
+ /**
49
+ * Error class for ignored CLMM entities
50
+ */
51
+ class IgnoredClmmEntityError extends Error {
52
+ constructor(entityType, address) {
53
+ super(`CLMM ${entityType} at address ${address} is in the ignore list and cannot be fetched`);
54
+ this.name = "IgnoredClmmEntityError";
55
+ }
56
+ }
57
+ exports.IgnoredClmmEntityError = IgnoredClmmEntityError;
58
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;GAEG;AACU,QAAA,oBAAoB,GAAG,IAAI,GAAG,CAAC;IAC1C,6CAA6C;IAC7C,8CAA8C;IAC9C,8CAA8C;IAC9C,8CAA8C;IAC9C,8CAA8C;IAC9C,8CAA8C;IAC9C,8CAA8C;IAC9C,8CAA8C;CAC/C,CAAC,CAAA;AAEF;;GAEG;AACU,QAAA,kBAAkB,GAAG,IAAI,GAAG,CAAC;IACxC,6CAA6C;IAC7C,8CAA8C;IAC9C,8CAA8C;IAC9C,8CAA8C;IAC9C,8CAA8C;IAC9C,8CAA8C;IAC9C,8CAA8C;IAC9C,8CAA8C;CAC/C,CAAC,CAAA;AAEF;;GAEG;AACH,SAAgB,eAAe,CAAC,aAAqB;IACnD,OAAO,4BAAoB,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;AAChD,CAAC;AAFD,0CAEC;AAED;;GAEG;AACH,SAAgB,cAAc,CAAC,YAAoB;IACjD,OAAO,0BAAkB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;AAC7C,CAAC;AAFD,wCAEC;AAED;;GAEG;AACH,MAAa,sBAAuB,SAAQ,KAAK;IAC/C,YAAY,UAA8B,EAAE,OAAe;QACzD,KAAK,CAAC,QAAQ,UAAU,eAAe,OAAO,8CAA8C,CAAC,CAAA;QAC7F,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAA;IACtC,CAAC;CACF;AALD,wDAKC"}
@@ -75,7 +75,17 @@ export declare class ExponentFetcher {
75
75
  fetchAllMarketThreeTicks(): Promise<Ticks[]>;
76
76
  fetchMarketThreeTicks(address: web3.PublicKey): Promise<Ticks>;
77
77
  }
78
+ /**
79
+ * Deserializes a CLMM Ticks account from raw buffer data.
80
+ *
81
+ * Layout matches Rust struct `Ticks` with `RedBlackTree<u32, Tick, 1000>`:
82
+ * - Discriminator: 8 bytes
83
+ * - RedBlackTree header: root(4) + padding(12) + size(8) + bump(4) + freeIdx(4) = 32 bytes
84
+ * - 1000 RBTree nodes, each: nodeHeader(16) + key(4) + padding(4) + Tick = variable bytes
85
+ * - Ticks footer: market(32) + feeGrowthPt(16) + feeGrowthSy(16) + prefixSum(8) + spotPrice(8) + currentTick(4) + padding(12) = 96 bytes
86
+ */
78
87
  export declare function deserializeMarketThreeTicks(data: Buffer): Ticks;
88
+ export declare function deserializeMarketThree(m: MarketThreeRaw): MarketThree;
79
89
  export declare function deserializeLpPosition(x: LpPositionRaw): LpPosition;
80
90
  export declare function deserializeYtPosition(x: YtPositionRaw): YtPosition;
81
91
  export interface KaminoReserveSummary {
@@ -119,6 +129,7 @@ export interface MarketThree {
119
129
  }[];
120
130
  };
121
131
  liquidityNetBalanceLimits: LiquidityNetBalanceLimits;
132
+ seedId: number[];
122
133
  }
123
134
  export interface Ticks {
124
135
  /** Current tick (left boundary of the active interval) */
@@ -151,17 +162,19 @@ export interface Tick {
151
162
  principalSy: bigint;
152
163
  apyBasePoints: number;
153
164
  principalShareSupply: bigint;
154
- /** Farm yield trackers (3 trackers) */
165
+ /** Farm yield trackers (2 trackers) */
155
166
  farms: {
156
167
  lastSeenIndex: number;
157
168
  }[];
158
- /** Emission yield trackers (3 trackers) */
169
+ /** Emission yield trackers (2 trackers) */
159
170
  emissions: {
160
171
  lastSeenIndex: number;
161
172
  lastPositionIndex: number;
162
173
  }[];
163
174
  /** Last split epoch for this tick */
164
175
  lastSplitEpoch: bigint;
176
+ /** Frozen liquidity that cannot be withdrawn */
177
+ frozenLiquidity: bigint;
165
178
  }
166
179
  export interface MarketThreeRaw {
167
180
  admin: web3.PublicKey;
@@ -324,11 +337,17 @@ export interface Orderbook {
324
337
  tokenEscrowPt: web3.PublicKey;
325
338
  cpiAccountOrderbook: web3.PublicKey;
326
339
  admin: web3.PublicKey;
340
+ /** Raw 256-bit PreciseNumber (12 decimals) for last SY exchange rate */
341
+ lastSyExchangeRate: bigint;
327
342
  configurationOptions: ConfigurationOptions;
328
343
  financials: OrderbookFinancials;
329
344
  prices: PriceTreeNode[];
330
345
  offers: OfferNode[];
331
346
  userEscrows: UserEscrowNode[];
347
+ /** Next offer index that will be allocated (from NodeAllocator free list) */
348
+ offersFreeListHead: number;
349
+ /** Bump index boundary for offers allocator */
350
+ offersBumpIndex: number;
332
351
  }
333
352
  export interface KaminoSyMeta {
334
353
  kaminoReserve: web3.PublicKey;
@@ -479,12 +498,14 @@ export interface OfferNodeRaw {
479
498
  }
480
499
  export interface UserEscrowNodeRaw {
481
500
  user: web3.PublicKey;
482
- yieldIndex: BN;
501
+ yieldIndex: number;
483
502
  ptAmount: BN;
484
503
  syAmount: BN;
485
504
  ytAmount: BN;
486
505
  staged: number;
487
506
  }
507
+ /** Convert PreciseNumber (Number type in Rust) from Anchor format to raw 256-bit bigint */
508
+ export declare function anchorizedPNumToRawBigint(pnum: AnchorizedPNum): bigint;
488
509
  export declare function fetchSplStakePoolIndex({ connection, stakePool, }: {
489
510
  connection: web3.Connection;
490
511
  stakePool: web3.PublicKey;
@@ -604,4 +625,8 @@ export declare function fetchOreExchangeRate({ connection, storeMint, stakeAccou
604
625
  stakeAccount: web3.PublicKey;
605
626
  treasury: web3.PublicKey;
606
627
  }): Promise<number>;
628
+ export declare function fetchChainlinkRate({ connection, priceFeed, }: {
629
+ connection: web3.Connection;
630
+ priceFeed: web3.PublicKey;
631
+ }): Promise<number>;
607
632
  export {};