@exponent-labs/exponent-fetcher 0.0.3

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/CHANGELOG.md ADDED
@@ -0,0 +1,16 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## [0.0.3](https://github.com/exponent-finance/exponent-core/compare/@exponent-labs/exponent-fetcher@0.0.2...@exponent-labs/exponent-fetcher@0.0.3) (2025-03-03)
7
+
8
+ **Note:** Version bump only for package @exponent-labs/exponent-fetcher
9
+
10
+
11
+
12
+
13
+
14
+ ## [0.0.2](https://github.com/exponent-finance/exponent-core/compare/@exponent-labs/exponent-fetcher@0.0.1...@exponent-labs/exponent-fetcher@0.0.2) (2025-03-03)
15
+
16
+ **Note:** Version bump only for package @exponent-labs/exponent-fetcher
@@ -0,0 +1,242 @@
1
+ /// <reference types="bn.js" />
2
+ import { BN, Program, Wallet, web3 } from "@coral-xyz/anchor";
3
+ import { ExponentCore } from "@exponent-labs/exponent-idl";
4
+ import { KaminoLendStandard } from "@exponent-labs/kamino-sy-idl";
5
+ import { MarginfiStandard } from "@exponent-labs/marginfi-sy-idl";
6
+ import { JitoRestakingStandard } from "@exponent-labs/jito-restaking-sy-idl";
7
+ import { AnchorizedPNum, AnchorizedPNumJson, MarginfiSyMeta, VaultEmission, VaultEmissionJson, CpiAccountIndexes, JitoRestakingSyMetaAccount, InterfaceType, SyEmissionRaw, GenericSyMetaAccount, PerenaSyMetaAccount } from "@exponent-labs/exponent-types";
8
+ import Decimal from "decimal.js";
9
+ import { PerenaStandard } from "@exponent-labs/perena-sy-idl";
10
+ import { GenericStandard } from "@exponent-labs/generic-sy-idl";
11
+ export declare function serializeAnchorizedPNumFromJson(pnum: AnchorizedPNum): AnchorizedPNumJson;
12
+ export declare function deserializeAnchorizedPNumFromJson(serialized: AnchorizedPNumJson): AnchorizedPNum;
13
+ export declare class MyWallet implements Wallet {
14
+ readonly payer: web3.Keypair;
15
+ constructor(payer: web3.Keypair);
16
+ signTransaction<T extends web3.Transaction | web3.VersionedTransaction>(tx: T): Promise<T>;
17
+ signAllTransactions<T extends web3.Transaction | web3.VersionedTransaction>(txs: T[]): Promise<T[]>;
18
+ get publicKey(): web3.PublicKey;
19
+ }
20
+ export declare class ExponentFetcher {
21
+ program: Program<ExponentCore>;
22
+ marginfiSyProgram: Program<MarginfiStandard>;
23
+ kaminoSyProgram: Program<KaminoLendStandard>;
24
+ jitoRestakingSyProgram: Program<JitoRestakingStandard>;
25
+ perenaSyProgram: Program<PerenaStandard>;
26
+ genericStandardProgram: Program<GenericStandard>;
27
+ connection: web3.Connection;
28
+ coreProgramId: web3.PublicKey;
29
+ marginfiSyProgramId: web3.PublicKey;
30
+ kaminoSyProgramId: web3.PublicKey;
31
+ jitoRestakingSyProgramId: web3.PublicKey;
32
+ perenaSyProgramId: web3.PublicKey;
33
+ genericStandardProgramId: web3.PublicKey;
34
+ constructor({ connection, coreProgramId, marginfiSyProgramId, kaminoSyProgramId, jitoRestakingSyProgramId, perenaSyProgramId, genericStandardProgramId, }: {
35
+ connection: web3.Connection;
36
+ coreProgramId?: web3.PublicKey;
37
+ marginfiSyProgramId?: web3.PublicKey;
38
+ kaminoSyProgramId?: web3.PublicKey;
39
+ jitoRestakingSyProgramId?: web3.PublicKey;
40
+ perenaSyProgramId?: web3.PublicKey;
41
+ genericStandardProgramId?: web3.PublicKey;
42
+ });
43
+ fetchVault(address: web3.PublicKey): Promise<Vault>;
44
+ fetchMarket(address: web3.PublicKey): Promise<MarketTwo>;
45
+ fetchMarginfiSyMeta(address: web3.PublicKey): Promise<MarginfiSyMeta>;
46
+ fetchMarginfiSyPosition(address: web3.PublicKey): Promise<SyPosition>;
47
+ fetchKaminoSyPosition(address: web3.PublicKey): Promise<SyPosition>;
48
+ fetchJitoRestakingSyPosition(address: web3.PublicKey): Promise<SyPosition>;
49
+ fetchPerenaSyPosition(address: web3.PublicKey): Promise<SyPosition>;
50
+ fetchGenericSyPosition(address: web3.PublicKey): Promise<SyPosition>;
51
+ fetchKaminoSyMeta(address: web3.PublicKey): Promise<KaminoSyMeta>;
52
+ fetchLpPosition(address: web3.PublicKey): Promise<LpPosition>;
53
+ fetchYtPosition(address: web3.PublicKey): Promise<YtPosition>;
54
+ fetchJitoRestakingSyMeta(address: web3.PublicKey): Promise<JitoRestakingSyMetaAccount>;
55
+ fetchPerenaSyMeta(address: web3.PublicKey): Promise<PerenaSyMetaAccount>;
56
+ fetchGenericSyMeta(address: web3.PublicKey): Promise<GenericSyMetaAccount>;
57
+ }
58
+ export declare function fetchKaminoReserve(address: web3.PublicKey, connection: web3.Connection): Promise<{
59
+ lendingMarket: web3.PublicKey;
60
+ baseMint: web3.PublicKey;
61
+ assetShareValue: Decimal;
62
+ }>;
63
+ export declare function serializeEmission(emission: VaultEmission): VaultEmissionJson;
64
+ export declare function deserializeEmission(emission: VaultEmissionJson): VaultEmission;
65
+ export interface MarketTwo {
66
+ ptBalance: bigint;
67
+ syBalance: bigint;
68
+ rateScalarRoot: number;
69
+ lnFeeRateRoot: number;
70
+ lastLnImpliedRate: number;
71
+ expirationTs: number;
72
+ addressLookupTable: web3.PublicKey;
73
+ mintSy: web3.PublicKey;
74
+ mintPt: web3.PublicKey;
75
+ mintLp: web3.PublicKey;
76
+ vault: web3.PublicKey;
77
+ tokenPtEscrow: web3.PublicKey;
78
+ tokenSyEscrow: web3.PublicKey;
79
+ tokenLpEscrow: web3.PublicKey;
80
+ tokenFeeTreasurySy: web3.PublicKey;
81
+ syProgram: web3.PublicKey;
82
+ selfAddress: web3.PublicKey;
83
+ statusFlags: number;
84
+ lpEscrowAmount: bigint;
85
+ maxLpSupply: bigint;
86
+ cpiAccounts: CpiAccountIndexes;
87
+ feeTreasurySyBps: number;
88
+ isCurrentFlashSwap: boolean;
89
+ lpFarm: LpFarm;
90
+ emissions: {
91
+ trackers: {
92
+ tokenEscrow: web3.PublicKey;
93
+ lpShareIndex: number;
94
+ lastSeenStaged: number;
95
+ }[];
96
+ };
97
+ liquidityNetBalanceLimits: LiquidityNetBalanceLimits;
98
+ }
99
+ export interface Vault {
100
+ syProgram: web3.PublicKey;
101
+ mintSy: web3.PublicKey;
102
+ mintYt: web3.PublicKey;
103
+ mintPt: web3.PublicKey;
104
+ escrowSy: web3.PublicKey;
105
+ startTs: number;
106
+ duration: number;
107
+ authority: web3.PublicKey;
108
+ lastSeenSyExchangeRate: number;
109
+ allTimeHighSyExchangeRate: number;
110
+ finalSyExchangeRate: number;
111
+ addressLookupTable: web3.PublicKey;
112
+ totalSyInEscrow: bigint;
113
+ ptSupply: bigint;
114
+ syForPt: bigint;
115
+ yieldPosition: web3.PublicKey;
116
+ escrowYt: web3.PublicKey;
117
+ treasurySy: BN;
118
+ treasurySyTokenAccount: web3.PublicKey;
119
+ interestBpsFee: number;
120
+ emissions: VaultEmission[];
121
+ status: number;
122
+ minOpSizeStrip: bigint;
123
+ minOpSizeMerge: bigint;
124
+ cpiAccounts: CpiAccountIndexes;
125
+ maxPySupply: bigint;
126
+ }
127
+ export interface KaminoSyMeta {
128
+ kaminoReserve: web3.PublicKey;
129
+ kaminoObligation: web3.PublicKey;
130
+ kaminoFarm: web3.PublicKey;
131
+ kaminoUserMetadata: web3.PublicKey;
132
+ mintSy: web3.PublicKey;
133
+ /** Where the SY tokens get deposited */
134
+ tokenSyEscrow: web3.PublicKey;
135
+ minMintSize: BN;
136
+ minRedeemSize: BN;
137
+ emissions: SyEmissionRaw[];
138
+ }
139
+ export interface SyPosition {
140
+ balanceSy: bigint;
141
+ owner: web3.PublicKey;
142
+ emissions: {
143
+ /** Last seen index for SY-to-emission exchange rate */
144
+ lastSeenIndex: number;
145
+ /** mint of emission token */
146
+ mint: web3.PublicKey;
147
+ /** How many emissions are staged to claim */
148
+ staged: bigint;
149
+ }[];
150
+ }
151
+ export interface LpPosition {
152
+ owner: web3.PublicKey;
153
+ market: web3.PublicKey;
154
+ lpBalance: bigint;
155
+ emissions: {
156
+ staged: bigint;
157
+ lastSeenIndex: number;
158
+ }[];
159
+ farms: {
160
+ staged: bigint;
161
+ lastSeenIndex: number;
162
+ }[];
163
+ }
164
+ export interface YtPosition {
165
+ owner: web3.PublicKey;
166
+ vault: web3.PublicKey;
167
+ ytBalance: bigint;
168
+ interest: YieldTokenTracker;
169
+ emissions: YieldTokenTracker[];
170
+ }
171
+ export interface YieldTokenTracker {
172
+ staged: bigint;
173
+ lastSeenIndex: number;
174
+ }
175
+ export interface LpFarm {
176
+ lastSeenTimestamp: number;
177
+ farmEmissions: FarmEmissionRaw[];
178
+ }
179
+ interface FarmEmissionRaw {
180
+ mint: web3.PublicKey;
181
+ tokenRate: BN;
182
+ expiryTimestamp: number;
183
+ index: AnchorizedPNum;
184
+ }
185
+ export interface LiquidityNetBalanceLimits {
186
+ windowStartTimestamp: number;
187
+ windowStartNetBalance: BN;
188
+ maxNetBalanceChangeNegativePercentage: number;
189
+ maxNetBalanceChangePositivePercentage: number;
190
+ windowDurationSeconds: number;
191
+ }
192
+ export interface MarketEmissions {
193
+ trackers: MarketEmission[];
194
+ }
195
+ interface MarketEmission {
196
+ tokenEscrow: web3.PublicKey;
197
+ lpShareIndex: AnchorizedPNum;
198
+ lastSeenStaged: BN;
199
+ }
200
+ export declare function fetchPerenaStablePoolData({ connection, perenaStablePool, }: {
201
+ connection: web3.Connection;
202
+ perenaStablePool: web3.PublicKey;
203
+ }): Promise<{
204
+ lpSupply: bigint;
205
+ invT: bigint;
206
+ exchangeRate: string;
207
+ lpMint: web3.PublicKey;
208
+ }>;
209
+ /**
210
+ * Fetch the exchange rate of a JitoRestaking vault
211
+ * @param connection
212
+ * @param accounts "remaining accounts"
213
+ * @param vaultAddress "address of the Jito Restaking vault"
214
+ * @param interfaceType "interface type of the Jito Restaking interface program that Exponent manages"
215
+ * @returns
216
+ */
217
+ export declare function fetchJitoRestaking(connection: web3.Connection, accounts: web3.PublicKey[], interfaceType: InterfaceType, vaultAddress: web3.PublicKey): Promise<{
218
+ mintBase: web3.PublicKey;
219
+ exchangeRateUnderlying: number;
220
+ exchangeRate: string;
221
+ }>;
222
+ export declare function fetchPyth(connection: web3.Connection): Promise<string>;
223
+ export declare function fetchGenericSyMetaIndex({ connection, genericSyMeta, }: {
224
+ connection: web3.Connection;
225
+ genericSyMeta: web3.PublicKey;
226
+ }): Promise<{
227
+ index: number;
228
+ }>;
229
+ export declare function fetchFragmetricIndex({ connection, fragmetricFund, }: {
230
+ connection: web3.Connection;
231
+ fragmetricFund: web3.PublicKey;
232
+ }): Promise<{
233
+ index: number;
234
+ receiptTokenMint: web3.PublicKey;
235
+ wrappedTokenMint: web3.PublicKey;
236
+ }>;
237
+ export declare function fetchMeteoraUsdcUsdtIndex({ connection, accounts, onChainTime, }: {
238
+ connection: web3.Connection;
239
+ accounts: any;
240
+ onChainTime: number;
241
+ }): Promise<number>;
242
+ export {};