@exponent-labs/exponent-fetcher 0.1.7 → 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.
- package/build/constants.d.ts +26 -0
- package/build/constants.js +58 -0
- package/build/constants.js.map +1 -0
- package/build/exponentFetcher.d.ts +328 -31
- package/build/exponentFetcher.js +779 -168
- package/build/exponentFetcher.js.map +1 -1
- package/build/index.d.ts +11 -0
- package/build/index.js +11 -0
- package/build/index.js.map +1 -1
- package/build/utils/adrena.d.ts +13 -0
- package/build/utils/adrena.js +29 -0
- package/build/utils/adrena.js.map +1 -0
- package/build/utils/fragmetric.d.ts +17 -0
- package/build/utils/fragmetric.js +23 -0
- package/build/utils/fragmetric.js.map +1 -0
- package/build/utils/jito.d.ts +7 -0
- package/build/utils/jito.js +29 -0
- package/build/utils/jito.js.map +1 -0
- package/build/utils/jupiter.d.ts +30 -0
- package/build/utils/jupiter.js +63 -0
- package/build/utils/jupiter.js.map +1 -0
- package/build/utils/kamino.d.ts +5 -0
- package/build/utils/kamino.js +10 -0
- package/build/utils/kamino.js.map +1 -0
- package/build/utils/meteora.d.ts +19 -0
- package/build/utils/meteora.js +36 -1
- package/build/utils/meteora.js.map +1 -1
- package/build/utils/ore.d.ts +74 -0
- package/build/utils/ore.js +217 -0
- package/build/utils/ore.js.map +1 -0
- package/build/utils/perena.d.ts +12 -0
- package/build/utils/perena.js +27 -0
- package/build/utils/perena.js.map +1 -0
- package/build/utils/sanctum.d.ts +6 -0
- package/build/utils/sanctum.js +26 -0
- package/build/utils/sanctum.js.map +1 -0
- package/build/utils/solstice.d.ts +12 -0
- package/build/utils/solstice.js +45 -0
- package/build/utils/solstice.js.map +1 -0
- package/package.json +21 -18
- package/src/constants.ts +56 -0
- package/src/exponentFetcher.ts +1238 -222
- package/src/index.ts +11 -0
- package/src/utils/adrena.ts +44 -0
- package/src/utils/fragmetric.ts +34 -0
- package/src/utils/jito.ts +30 -0
- package/src/utils/jupiter.ts +98 -0
- package/src/utils/kamino.ts +6 -0
- package/src/utils/meteora.ts +73 -1
- package/src/utils/ore.ts +322 -0
- package/src/utils/perena.ts +28 -0
- package/src/utils/sanctum.ts +24 -0
- package/src/utils/solstice.ts +51 -0
- package/tsconfig.json +4 -1
|
@@ -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"}
|
|
@@ -1,14 +1,22 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
1
3
|
/// <reference types="bn.js" />
|
|
2
4
|
import { BN, Program, Wallet, web3 } from "@coral-xyz/anchor";
|
|
3
5
|
import Decimal from "decimal.js";
|
|
6
|
+
import { ExponentClmm } from "@exponent-labs/exponent-clmm-idl";
|
|
4
7
|
import { ExponentCore } from "@exponent-labs/exponent-idl";
|
|
5
|
-
import {
|
|
8
|
+
import { ExponentOrderbook } from "@exponent-labs/exponent-orderbook-idl";
|
|
9
|
+
import { AnchorizedPNum, AnchorizedPNumJson, CpiAccountIndexes, ExponentCoreCpiIndexes, GenericSyMetaAccount, InterfaceType, JitoRestakingSyMetaAccount, MarginfiSyMeta, MarketCpiCoreIndexes, PerenaSyMetaAccount, SyEmissionRaw, VaultEmission, VaultEmissionJson } from "@exponent-labs/exponent-types";
|
|
10
|
+
import { OfferNode, PriceTreeNode, UserEscrowNode } from "@exponent-labs/exponent-types";
|
|
6
11
|
import { GenericStandard } from "@exponent-labs/generic-sy-idl";
|
|
7
12
|
import { JitoRestakingStandard } from "@exponent-labs/jito-restaking-sy-idl";
|
|
8
13
|
import { Obligation } from "@exponent-labs/kamino-reserve-deserializer";
|
|
9
14
|
import { KaminoLendStandard } from "@exponent-labs/kamino-sy-idl";
|
|
10
15
|
import { MarginfiStandard } from "@exponent-labs/marginfi-sy-idl";
|
|
11
16
|
import { PerenaStandard } from "@exponent-labs/perena-sy-idl";
|
|
17
|
+
import { calculateFragmetricSupportedTokenIndex } from "./utils/fragmetric";
|
|
18
|
+
import { calculateJupiterLendIndex, calculateJupiterPerpsIndex } from "./utils/jupiter";
|
|
19
|
+
import { calculateSolsticeRedemptionRate } from "./utils/solstice";
|
|
12
20
|
export declare function serializeAnchorizedPNumFromJson(pnum: AnchorizedPNum): AnchorizedPNumJson;
|
|
13
21
|
export declare function deserializeAnchorizedPNumFromJson(serialized: AnchorizedPNumJson): AnchorizedPNum;
|
|
14
22
|
export declare class MyWallet implements Wallet {
|
|
@@ -25,6 +33,8 @@ export declare class ExponentFetcher {
|
|
|
25
33
|
jitoRestakingSyProgram: Program<JitoRestakingStandard>;
|
|
26
34
|
perenaSyProgram: Program<PerenaStandard>;
|
|
27
35
|
genericStandardProgram: Program<GenericStandard>;
|
|
36
|
+
exponentClmmProgram: Program<ExponentClmm>;
|
|
37
|
+
orderbookProgram: Program<ExponentOrderbook>;
|
|
28
38
|
connection: web3.Connection;
|
|
29
39
|
coreProgramId: web3.PublicKey;
|
|
30
40
|
marginfiSyProgramId: web3.PublicKey;
|
|
@@ -43,6 +53,8 @@ export declare class ExponentFetcher {
|
|
|
43
53
|
});
|
|
44
54
|
fetchVault(address: web3.PublicKey): Promise<Vault>;
|
|
45
55
|
fetchMarket(address: web3.PublicKey): Promise<MarketTwo>;
|
|
56
|
+
fetchOrderbook(address: web3.PublicKey): Promise<Orderbook>;
|
|
57
|
+
fetchOrderbookCpiAccounts(address: web3.PublicKey): Promise<OrderbookCpiAccountsRaw>;
|
|
46
58
|
fetchMarginfiSyMeta(address: web3.PublicKey): Promise<MarginfiSyMeta>;
|
|
47
59
|
fetchMarginfiSyPosition(address: web3.PublicKey): Promise<SyPosition>;
|
|
48
60
|
fetchKaminoSyPosition(address: web3.PublicKey): Promise<SyPosition>;
|
|
@@ -51,19 +63,190 @@ export declare class ExponentFetcher {
|
|
|
51
63
|
fetchGenericSyPosition(address: web3.PublicKey): Promise<SyPosition>;
|
|
52
64
|
fetchKaminoSyMeta(address: web3.PublicKey): Promise<KaminoSyMeta>;
|
|
53
65
|
fetchLpPosition(address: web3.PublicKey): Promise<LpPosition>;
|
|
66
|
+
fetchLpPositionCLMM(address: web3.PublicKey): Promise<LpPositionCLMM>;
|
|
54
67
|
fetchYtPosition(address: web3.PublicKey): Promise<YtPosition>;
|
|
68
|
+
/** Batch fetch multiple YT positions in a single RPC call */
|
|
69
|
+
fetchYtPositions(addresses: web3.PublicKey[]): Promise<(YtPosition | null)[]>;
|
|
55
70
|
fetchJitoRestakingSyMeta(address: web3.PublicKey): Promise<JitoRestakingSyMetaAccount>;
|
|
56
71
|
fetchPerenaSyMeta(address: web3.PublicKey): Promise<PerenaSyMetaAccount>;
|
|
57
72
|
fetchGenericSyMeta(address: web3.PublicKey): Promise<GenericSyMetaAccount>;
|
|
73
|
+
fetchAllMarketThree(): Promise<MarketThree[]>;
|
|
74
|
+
fetchMarketThree(address: web3.PublicKey): Promise<MarketThree>;
|
|
75
|
+
fetchAllMarketThreeTicks(): Promise<Ticks[]>;
|
|
76
|
+
fetchMarketThreeTicks(address: web3.PublicKey): Promise<Ticks>;
|
|
58
77
|
}
|
|
59
|
-
|
|
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
|
+
*/
|
|
87
|
+
export declare function deserializeMarketThreeTicks(data: Buffer): Ticks;
|
|
88
|
+
export declare function deserializeMarketThree(m: MarketThreeRaw): MarketThree;
|
|
89
|
+
export declare function deserializeLpPosition(x: LpPositionRaw): LpPosition;
|
|
90
|
+
export declare function deserializeYtPosition(x: YtPositionRaw): YtPosition;
|
|
91
|
+
export interface KaminoReserveSummary {
|
|
60
92
|
lendingMarket: web3.PublicKey;
|
|
61
93
|
baseMint: web3.PublicKey;
|
|
62
94
|
assetShareValue: Decimal;
|
|
63
|
-
|
|
95
|
+
scopePriceFeed?: web3.PublicKey;
|
|
96
|
+
}
|
|
97
|
+
export declare function fetchKaminoReserve(address: web3.PublicKey, connection: web3.Connection): Promise<KaminoReserveSummary>;
|
|
64
98
|
export declare function fetchAllKaminoObligationsByKaminoReserve(reserve: web3.PublicKey, connection: web3.Connection): Promise<Obligation[]>;
|
|
65
99
|
export declare function serializeEmission(emission: VaultEmission): VaultEmissionJson;
|
|
66
100
|
export declare function deserializeEmission(emission: VaultEmissionJson): VaultEmission;
|
|
101
|
+
export interface MarketThree {
|
|
102
|
+
admin: web3.PublicKey;
|
|
103
|
+
addressLookupTable: web3.PublicKey;
|
|
104
|
+
mintPt: web3.PublicKey;
|
|
105
|
+
mintSy: web3.PublicKey;
|
|
106
|
+
mintYt: web3.PublicKey;
|
|
107
|
+
vault: web3.PublicKey;
|
|
108
|
+
tokenPtEscrow: web3.PublicKey;
|
|
109
|
+
tokenSyEscrow: web3.PublicKey;
|
|
110
|
+
tokenYtEscrow: web3.PublicKey;
|
|
111
|
+
tokenFeeTreasurySy: web3.PublicKey;
|
|
112
|
+
tokenFeeTreasuryPt: web3.PublicKey;
|
|
113
|
+
syProgram: web3.PublicKey;
|
|
114
|
+
exponentCoreProgram: web3.PublicKey;
|
|
115
|
+
selfAddress: web3.PublicKey;
|
|
116
|
+
ticks: web3.PublicKey;
|
|
117
|
+
statusFlags: number;
|
|
118
|
+
configurationOptions: MarketConfigurationOptions;
|
|
119
|
+
financials: MarketThreeFinancials;
|
|
120
|
+
cpiSyAccounts: CpiAccountIndexes;
|
|
121
|
+
cpiCoreAccounts: MarketCpiCoreIndexes;
|
|
122
|
+
isCurrentFlashSwap: boolean;
|
|
123
|
+
lpFarm: LpFarm;
|
|
124
|
+
emissions: {
|
|
125
|
+
trackers: {
|
|
126
|
+
tokenEscrow: web3.PublicKey;
|
|
127
|
+
lpShareIndex: number;
|
|
128
|
+
lastSeenStaged: number;
|
|
129
|
+
}[];
|
|
130
|
+
};
|
|
131
|
+
liquidityNetBalanceLimits: LiquidityNetBalanceLimits;
|
|
132
|
+
seedId: number[];
|
|
133
|
+
}
|
|
134
|
+
export interface Ticks {
|
|
135
|
+
/** Current tick (left boundary of the active interval) */
|
|
136
|
+
currentTick: number;
|
|
137
|
+
/** Array of ticks (simplified from RBTree for TypeScript) */
|
|
138
|
+
ticksTree: Tick[];
|
|
139
|
+
/** Market address this ticks account belongs to */
|
|
140
|
+
market: web3.PublicKey;
|
|
141
|
+
/** Fee growth index global for PT */
|
|
142
|
+
feeGrowthIndexGlobalPt: bigint;
|
|
143
|
+
/** Fee growth index global for SY */
|
|
144
|
+
feeGrowthIndexGlobalSy: bigint;
|
|
145
|
+
/** Current prefix sum - the active liquidity at the current tick */
|
|
146
|
+
currentPrefixSum: bigint;
|
|
147
|
+
/** Current spot price (ln implied rate) */
|
|
148
|
+
currentSpotPrice: number;
|
|
149
|
+
}
|
|
150
|
+
export interface Tick {
|
|
151
|
+
liquidityNet: bigint;
|
|
152
|
+
/** Total liquidity referencing this tick as a boundary */
|
|
153
|
+
liquidityGross: bigint;
|
|
154
|
+
/** Fee growth index outside this tick for PT */
|
|
155
|
+
feeGrowthOutsidePt: bigint;
|
|
156
|
+
/** Fee growth index outside this tick for SY */
|
|
157
|
+
feeGrowthOutsideSy: bigint;
|
|
158
|
+
/** Principal PT accrued in the interval starting at this tick */
|
|
159
|
+
impliedRate: number;
|
|
160
|
+
principalPt: bigint;
|
|
161
|
+
/** Principal SY accrued in the interval starting at this tick */
|
|
162
|
+
principalSy: bigint;
|
|
163
|
+
apyBasePoints: number;
|
|
164
|
+
principalShareSupply: bigint;
|
|
165
|
+
/** Farm yield trackers (2 trackers) */
|
|
166
|
+
farms: {
|
|
167
|
+
lastSeenIndex: number;
|
|
168
|
+
}[];
|
|
169
|
+
/** Emission yield trackers (2 trackers) */
|
|
170
|
+
emissions: {
|
|
171
|
+
lastSeenIndex: number;
|
|
172
|
+
lastPositionIndex: number;
|
|
173
|
+
}[];
|
|
174
|
+
/** Last split epoch for this tick */
|
|
175
|
+
lastSplitEpoch: bigint;
|
|
176
|
+
/** Frozen liquidity that cannot be withdrawn */
|
|
177
|
+
frozenLiquidity: bigint;
|
|
178
|
+
}
|
|
179
|
+
export interface MarketThreeRaw {
|
|
180
|
+
admin: web3.PublicKey;
|
|
181
|
+
addressLookupTable: web3.PublicKey;
|
|
182
|
+
mintPt: web3.PublicKey;
|
|
183
|
+
mintSy: web3.PublicKey;
|
|
184
|
+
mintYt: web3.PublicKey;
|
|
185
|
+
vault: web3.PublicKey;
|
|
186
|
+
tokenPtEscrow: web3.PublicKey;
|
|
187
|
+
tokenSyEscrow: web3.PublicKey;
|
|
188
|
+
tokenYtEscrow: web3.PublicKey;
|
|
189
|
+
tokenFeeTreasurySy: web3.PublicKey;
|
|
190
|
+
tokenFeeTreasuryPt: web3.PublicKey;
|
|
191
|
+
syProgram: web3.PublicKey;
|
|
192
|
+
exponentCoreProgram: web3.PublicKey;
|
|
193
|
+
selfAddress: web3.PublicKey;
|
|
194
|
+
ticks: web3.PublicKey;
|
|
195
|
+
statusFlags: number;
|
|
196
|
+
configurationOptions: MarketConfigurationOptionsRaw;
|
|
197
|
+
financials: MarketThreeFinancialsRaw;
|
|
198
|
+
cpiSyAccounts: CpiAccountIndexes;
|
|
199
|
+
cpiCoreAccounts: MarketCpiCoreIndexes;
|
|
200
|
+
isCurrentFlashSwap: boolean;
|
|
201
|
+
lpFarm: LpFarm;
|
|
202
|
+
emissions: MarketEmissions;
|
|
203
|
+
liquidityNetBalanceLimits: LiquidityNetBalanceLimits;
|
|
204
|
+
seedId: number[];
|
|
205
|
+
}
|
|
206
|
+
export interface MarketConfigurationOptions {
|
|
207
|
+
/** ln of fee rate root */
|
|
208
|
+
lnFeeRateRoot: number;
|
|
209
|
+
/** Treasury fee in basis points */
|
|
210
|
+
treasuryFeeBps: number;
|
|
211
|
+
/** Minimum LP amount per tick */
|
|
212
|
+
minLpTickAmount: bigint;
|
|
213
|
+
/** Epsilon clamp for numerical stability */
|
|
214
|
+
epsilonClamp: number;
|
|
215
|
+
/** Maximum LP supply */
|
|
216
|
+
maxLpSupply: bigint;
|
|
217
|
+
/** Tick space */
|
|
218
|
+
tickSpace: number;
|
|
219
|
+
}
|
|
220
|
+
export interface MarketThreeFinancials {
|
|
221
|
+
expirationTs: bigint;
|
|
222
|
+
ptBalance: bigint;
|
|
223
|
+
syBalance: bigint;
|
|
224
|
+
liquidityBalance: bigint;
|
|
225
|
+
}
|
|
226
|
+
export interface MarketConfigurationOptionsRaw {
|
|
227
|
+
lnFeeRateRoot: number;
|
|
228
|
+
treasuryFeeBps: number;
|
|
229
|
+
minLpTickAmount: BN;
|
|
230
|
+
epsilonClamp: number;
|
|
231
|
+
maxLpSupply: BN;
|
|
232
|
+
tickSpace: number;
|
|
233
|
+
}
|
|
234
|
+
export interface OrderbookConfigurationOptionsRaw {
|
|
235
|
+
thresholdAmount: BN;
|
|
236
|
+
lnMakerFeeRate: number;
|
|
237
|
+
lnTakerFeeRate: number;
|
|
238
|
+
priceDecimals: number;
|
|
239
|
+
}
|
|
240
|
+
export interface MarketThreeFinancialsRaw {
|
|
241
|
+
/** Expiration timestamp */
|
|
242
|
+
expirationTs: number;
|
|
243
|
+
/** PT balance in the market */
|
|
244
|
+
ptBalance: BN;
|
|
245
|
+
/** SY balance in the market */
|
|
246
|
+
syBalance: BN;
|
|
247
|
+
/** Total liquidity balance */
|
|
248
|
+
liquidityBalance: BN;
|
|
249
|
+
}
|
|
67
250
|
export interface MarketTwo {
|
|
68
251
|
ptBalance: bigint;
|
|
69
252
|
syBalance: bigint;
|
|
@@ -127,6 +310,45 @@ export interface Vault {
|
|
|
127
310
|
cpiAccounts: CpiAccountIndexes;
|
|
128
311
|
maxPySupply: bigint;
|
|
129
312
|
}
|
|
313
|
+
interface OrderbookFinancials {
|
|
314
|
+
expirationTs: number;
|
|
315
|
+
ytBalance: bigint;
|
|
316
|
+
syBalance: bigint;
|
|
317
|
+
ptBalance: bigint;
|
|
318
|
+
ytFeeBalance: bigint;
|
|
319
|
+
syFeeBalance: bigint;
|
|
320
|
+
ptFeeBalance: bigint;
|
|
321
|
+
stagedSy: bigint;
|
|
322
|
+
}
|
|
323
|
+
export interface ConfigurationOptions {
|
|
324
|
+
priceDecimals: number;
|
|
325
|
+
thresholdAmount: bigint;
|
|
326
|
+
lnMakerFeeRate: number;
|
|
327
|
+
lnTakerFeeRate: number;
|
|
328
|
+
}
|
|
329
|
+
export interface Orderbook {
|
|
330
|
+
vault: web3.PublicKey;
|
|
331
|
+
yieldPosition: web3.PublicKey;
|
|
332
|
+
addressLookupTable: web3.PublicKey;
|
|
333
|
+
exponentCoreProgram: web3.PublicKey;
|
|
334
|
+
syProgram: web3.PublicKey;
|
|
335
|
+
tokenEscrowSy: web3.PublicKey;
|
|
336
|
+
tokenEscrowYt: web3.PublicKey;
|
|
337
|
+
tokenEscrowPt: web3.PublicKey;
|
|
338
|
+
cpiAccountOrderbook: web3.PublicKey;
|
|
339
|
+
admin: web3.PublicKey;
|
|
340
|
+
/** Raw 256-bit PreciseNumber (12 decimals) for last SY exchange rate */
|
|
341
|
+
lastSyExchangeRate: bigint;
|
|
342
|
+
configurationOptions: ConfigurationOptions;
|
|
343
|
+
financials: OrderbookFinancials;
|
|
344
|
+
prices: PriceTreeNode[];
|
|
345
|
+
offers: OfferNode[];
|
|
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;
|
|
351
|
+
}
|
|
130
352
|
export interface KaminoSyMeta {
|
|
131
353
|
kaminoReserve: web3.PublicKey;
|
|
132
354
|
kaminoObligation: web3.PublicKey;
|
|
@@ -175,6 +397,48 @@ export interface YieldTokenTracker {
|
|
|
175
397
|
staged: bigint;
|
|
176
398
|
lastSeenIndex: number;
|
|
177
399
|
}
|
|
400
|
+
export interface LpPositionRaw {
|
|
401
|
+
owner: web3.PublicKey;
|
|
402
|
+
market: web3.PublicKey;
|
|
403
|
+
lpBalance: BN;
|
|
404
|
+
emissions: {
|
|
405
|
+
trackers: {
|
|
406
|
+
staged: BN;
|
|
407
|
+
lastSeenIndex: AnchorizedPNum;
|
|
408
|
+
}[];
|
|
409
|
+
};
|
|
410
|
+
farms: {
|
|
411
|
+
trackers: {
|
|
412
|
+
staged: BN;
|
|
413
|
+
lastSeenIndex: AnchorizedPNum;
|
|
414
|
+
}[];
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
export interface LpPositionCLMM {
|
|
418
|
+
owner: web3.PublicKey;
|
|
419
|
+
market: web3.PublicKey;
|
|
420
|
+
feeInsideLastPt: bigint;
|
|
421
|
+
feeInsideLastSy: bigint;
|
|
422
|
+
lpBalance: bigint;
|
|
423
|
+
tokensOwedSy: bigint;
|
|
424
|
+
tokensOwedPt: bigint;
|
|
425
|
+
lowerTickIdx: number;
|
|
426
|
+
upperTickIdx: number;
|
|
427
|
+
farms: {
|
|
428
|
+
staged: bigint;
|
|
429
|
+
lastSeenIndex: number;
|
|
430
|
+
}[];
|
|
431
|
+
shareTrackers: {
|
|
432
|
+
tickIdx: number;
|
|
433
|
+
rightTickIdx: number;
|
|
434
|
+
splitEpoch: bigint;
|
|
435
|
+
lpShare: bigint;
|
|
436
|
+
emissions: {
|
|
437
|
+
staged: bigint;
|
|
438
|
+
lastSeenIndex: number;
|
|
439
|
+
}[];
|
|
440
|
+
}[];
|
|
441
|
+
}
|
|
178
442
|
export interface LpFarm {
|
|
179
443
|
lastSeenTimestamp: number;
|
|
180
444
|
farmEmissions: FarmEmissionRaw[];
|
|
@@ -195,11 +459,53 @@ export interface LiquidityNetBalanceLimits {
|
|
|
195
459
|
export interface MarketEmissions {
|
|
196
460
|
trackers: MarketEmission[];
|
|
197
461
|
}
|
|
198
|
-
interface MarketEmission {
|
|
462
|
+
export interface MarketEmission {
|
|
199
463
|
tokenEscrow: web3.PublicKey;
|
|
200
464
|
lpShareIndex: AnchorizedPNum;
|
|
201
465
|
lastSeenStaged: BN;
|
|
202
466
|
}
|
|
467
|
+
export interface YtPositionRaw {
|
|
468
|
+
owner: web3.PublicKey;
|
|
469
|
+
vault: web3.PublicKey;
|
|
470
|
+
ytBalance: BN;
|
|
471
|
+
interest: YieldTokenTrackerRaw;
|
|
472
|
+
emissions: YieldTokenTrackerRaw[];
|
|
473
|
+
}
|
|
474
|
+
interface YieldTokenTrackerRaw {
|
|
475
|
+
staged: BN;
|
|
476
|
+
lastSeenIndex: AnchorizedPNum;
|
|
477
|
+
}
|
|
478
|
+
export interface OrderbookCpiAccountsRaw {
|
|
479
|
+
syCpiAccounts: CpiAccountIndexes;
|
|
480
|
+
exponentCoreCpiAccounts: ExponentCoreCpiIndexes;
|
|
481
|
+
}
|
|
482
|
+
export interface PriceTreeNodeRaw {
|
|
483
|
+
key: number;
|
|
484
|
+
firstOffer: number;
|
|
485
|
+
parent: number;
|
|
486
|
+
left: number;
|
|
487
|
+
right: number;
|
|
488
|
+
}
|
|
489
|
+
export interface OfferNodeRaw {
|
|
490
|
+
register: number;
|
|
491
|
+
amount: BN;
|
|
492
|
+
userVaultPointer: number;
|
|
493
|
+
expiryAt: number;
|
|
494
|
+
createdAt: number;
|
|
495
|
+
virtualOffer: boolean;
|
|
496
|
+
orderTypeFlag: number;
|
|
497
|
+
fillOrKill: boolean;
|
|
498
|
+
}
|
|
499
|
+
export interface UserEscrowNodeRaw {
|
|
500
|
+
user: web3.PublicKey;
|
|
501
|
+
yieldIndex: number;
|
|
502
|
+
ptAmount: BN;
|
|
503
|
+
syAmount: BN;
|
|
504
|
+
ytAmount: BN;
|
|
505
|
+
staged: number;
|
|
506
|
+
}
|
|
507
|
+
/** Convert PreciseNumber (Number type in Rust) from Anchor format to raw 256-bit bigint */
|
|
508
|
+
export declare function anchorizedPNumToRawBigint(pnum: AnchorizedPNum): bigint;
|
|
203
509
|
export declare function fetchSplStakePoolIndex({ connection, stakePool, }: {
|
|
204
510
|
connection: web3.Connection;
|
|
205
511
|
stakePool: web3.PublicKey;
|
|
@@ -239,15 +545,7 @@ export declare function fetchJupiterPerpsIndex({ connection, pool, lastFeeUsdRes
|
|
|
239
545
|
lastAumUsd: BN;
|
|
240
546
|
currentIndex: AnchorizedPNum;
|
|
241
547
|
lastRealizedFeeUsdUpdateUnixTimestamp: number;
|
|
242
|
-
}): Promise<
|
|
243
|
-
index: number;
|
|
244
|
-
newState: {
|
|
245
|
-
lastAumUsd: BN;
|
|
246
|
-
lastRealizedFeeUsd: BN;
|
|
247
|
-
lastFeeUsdResetUnixTimestamp: number;
|
|
248
|
-
lastRealizedFeeUsdUpdateUnixTimestamp: number;
|
|
249
|
-
};
|
|
250
|
-
}>;
|
|
548
|
+
}): Promise<ReturnType<typeof calculateJupiterPerpsIndex>>;
|
|
251
549
|
export declare function fetchPyth(connection: web3.Connection): Promise<string>;
|
|
252
550
|
export declare function fetchGenericSyMetaIndex({ connection, genericSyMeta, }: {
|
|
253
551
|
connection: web3.Connection;
|
|
@@ -266,12 +564,7 @@ export declare function fetchFragmetricIndex({ connection, fragmetricFund, }: {
|
|
|
266
564
|
export declare function fetchJupiterLendIndex({ connection, jupiterLendAccount, }: {
|
|
267
565
|
connection: web3.Connection;
|
|
268
566
|
jupiterLendAccount: web3.PublicKey;
|
|
269
|
-
}): Promise<{
|
|
270
|
-
index: number;
|
|
271
|
-
baseTokenMint: any;
|
|
272
|
-
tokenReservesLiquidity: any;
|
|
273
|
-
lendingSupplyPosition: any;
|
|
274
|
-
rewardsRateModel: any;
|
|
567
|
+
}): Promise<ReturnType<typeof calculateJupiterLendIndex> & {
|
|
275
568
|
rateModel: web3.PublicKey;
|
|
276
569
|
}>;
|
|
277
570
|
export declare function fetchKaminoVaultIndex({ connection, kaminoVaultAccount, }: {
|
|
@@ -289,11 +582,7 @@ export declare function fetchFragmetricSupportedTokenIndex({ connection, fragmet
|
|
|
289
582
|
connection: web3.Connection;
|
|
290
583
|
fragmetricFund: web3.PublicKey;
|
|
291
584
|
index: number;
|
|
292
|
-
}): Promise<
|
|
293
|
-
index: number;
|
|
294
|
-
receiptTokenMint: web3.PublicKey;
|
|
295
|
-
wrappedTokenMint: web3.PublicKey;
|
|
296
|
-
}>;
|
|
585
|
+
}): Promise<ReturnType<typeof calculateFragmetricSupportedTokenIndex>>;
|
|
297
586
|
interface AccountsInterface {
|
|
298
587
|
[k: string]: web3.PublicKey;
|
|
299
588
|
}
|
|
@@ -325,11 +614,19 @@ export declare function fetchSolsticeRedemptionRate({ connection, yieldPool, ves
|
|
|
325
614
|
connection: web3.Connection;
|
|
326
615
|
yieldPool: web3.PublicKey;
|
|
327
616
|
vestingSchedule: web3.PublicKey;
|
|
328
|
-
}): Promise<
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
617
|
+
}): Promise<ReturnType<typeof calculateSolsticeRedemptionRate>>;
|
|
618
|
+
export declare function fetchReflectRedemptionRate({ connection, oracle, }: {
|
|
619
|
+
connection: web3.Connection;
|
|
620
|
+
oracle: web3.PublicKey;
|
|
621
|
+
}): Promise<number>;
|
|
622
|
+
export declare function fetchOreExchangeRate({ connection, storeMint, stakeAccount, treasury, }: {
|
|
623
|
+
connection: web3.Connection;
|
|
624
|
+
storeMint: web3.PublicKey;
|
|
625
|
+
stakeAccount: web3.PublicKey;
|
|
626
|
+
treasury: web3.PublicKey;
|
|
627
|
+
}): Promise<number>;
|
|
628
|
+
export declare function fetchChainlinkRate({ connection, priceFeed, }: {
|
|
629
|
+
connection: web3.Connection;
|
|
630
|
+
priceFeed: web3.PublicKey;
|
|
631
|
+
}): Promise<number>;
|
|
335
632
|
export {};
|