@exponent-labs/exponent-vaults-fetcher 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,9 @@
1
+ /** Seed used for withdrawal PDA derivation on-chain. */
2
+ export declare const WITHDRAWAL_ACCOUNT_SEED: "withdrawal";
3
+ /**
4
+ * Set of vault addresses to ignore during fetching.
5
+ * These accounts cannot be deserialized due to program updates and should be skipped.
6
+ */
7
+ export declare const IGNORED_VAULTS: Set<string>;
8
+ /** Singleton ExponentPrices account address */
9
+ export declare const EXPONENT_PRICES_ADDRESS: string;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EXPONENT_PRICES_ADDRESS = exports.IGNORED_VAULTS = exports.WITHDRAWAL_ACCOUNT_SEED = void 0;
4
+ const anchor_1 = require("@coral-xyz/anchor");
5
+ const exponent_vaults_idl_1 = require("@exponent-labs/exponent-vaults-idl");
6
+ const EXPONENT_PRICES_SEED = new TextEncoder().encode("exponent_prices");
7
+ /** Seed used for withdrawal PDA derivation on-chain. */
8
+ exports.WITHDRAWAL_ACCOUNT_SEED = "withdrawal";
9
+ /**
10
+ * Set of vault addresses to ignore during fetching.
11
+ * These accounts cannot be deserialized due to program updates and should be skipped.
12
+ */
13
+ exports.IGNORED_VAULTS = new Set([
14
+ "Fo7vvPsSqNAYy2S7CpQoVFP8Ygnr22xB3fJVhde9GjcB",
15
+ "7apbV7QJHFhh5Ueczg35n6StyNdqeMmDdRwKDNCSRm7i",
16
+ "GsT257ZWjLboYAbWE1qDX2irHSyvCviQatyu3g2DSqmb",
17
+ "3KUQ8H5v4pLthqCsdPZuMnwjHVJcdkiFeWZGdX3Mr7MX",
18
+ "79aYbxCzLNFiF3tibivW6kva8B5qcFUAPAGweDuAyfMY",
19
+ "99RpUEbUMe1chVgpJNV16iXaJqdfvm459siFX9SA75nq",
20
+ "E957xxdpgsCbmqHo9AyHkLRTvgppxgQbZ9V8QXpQegg5",
21
+ "F9Tv2qBbS1YnsR4hYyaq6ztPUcTpht1ZT5Gb22DFwyg1",
22
+ "FKif7QNqt6cSaFj9cGL8eCz9cuSncKvbVNHxzd92r2hY",
23
+ "GfT6RcToh5mmkJ5DpPSBsBSJzun2WyVcsWXzNCtEfVUa",
24
+ "HUXvqaGbjX8kZ65ZhMhJgzfrjEX5By2gA8x9Z9mEFfQH",
25
+ "Hyi6LoTzcHpaQueSz4qqFdWeBydihpkRR8CqFvLWspqH",
26
+ ]);
27
+ /** Singleton ExponentPrices account address */
28
+ exports.EXPONENT_PRICES_ADDRESS = anchor_1.web3.PublicKey.findProgramAddressSync([EXPONENT_PRICES_SEED], new anchor_1.web3.PublicKey(exponent_vaults_idl_1.PROGRAM_ID))[0].toBase58();
29
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAA,8CAAwC;AAExC,4EAA+D;AAE/D,MAAM,oBAAoB,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAA;AAExE,wDAAwD;AAC3C,QAAA,uBAAuB,GAAG,YAAqB,CAAA;AAE5D;;;GAGG;AACU,QAAA,cAAc,GAAG,IAAI,GAAG,CAAC;IACpC,8CAA8C;IAC9C,8CAA8C;IAC9C,8CAA8C;IAC9C,8CAA8C;IAC9C,8CAA8C;IAC9C,8CAA8C;IAC9C,8CAA8C;IAC9C,8CAA8C;IAC9C,8CAA8C;IAC9C,8CAA8C;IAC9C,8CAA8C;IAC9C,8CAA8C;CAC/C,CAAC,CAAA;AAEF,+CAA+C;AAClC,QAAA,uBAAuB,GAAG,aAAI,CAAC,SAAS,CAAC,sBAAsB,CAC1E,CAAC,oBAAoB,CAAC,EACtB,IAAI,aAAI,CAAC,SAAS,CAAC,gCAAU,CAAC,CAC/B,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA"}
@@ -0,0 +1,441 @@
1
+ /// <reference types="bn.js" />
2
+ /// <reference types="node" />
3
+ /// <reference types="node" />
4
+ import { Program, web3 } from "@coral-xyz/anchor";
5
+ import { ExponentVaults } from "@exponent-labs/exponent-vaults-idl";
6
+ import { ActionProposal, ExponentPrices, ExponentVault, WithdrawalAccount } from "./types";
7
+ export declare class ExponentVaultsFetcher {
8
+ readonly program: Program<ExponentVaults>;
9
+ readonly programId: web3.PublicKey;
10
+ constructor(connection: web3.Connection, programId?: web3.PublicKey | string);
11
+ fetchVault(address: web3.PublicKey): Promise<{
12
+ addressLookupTable: web3.PublicKey;
13
+ squadsSettings: web3.PublicKey;
14
+ squadsVault: web3.PublicKey;
15
+ tokenEntries: {
16
+ mint: web3.PublicKey;
17
+ priceId: ({
18
+ multiply?: never;
19
+ } & {
20
+ simple: {
21
+ priceId: import("bn.js");
22
+ };
23
+ }) | ({
24
+ simple?: never;
25
+ } & {
26
+ multiply: {
27
+ priceIds: import("bn.js")[];
28
+ };
29
+ });
30
+ tokenSquadsAccount: web3.PublicKey;
31
+ tokenAccountVault: web3.PublicKey;
32
+ forceDeallocatePolicyIds: import("bn.js")[];
33
+ }[];
34
+ underlyingMint: web3.PublicKey;
35
+ mintLp: web3.PublicKey;
36
+ tokenLpEscrow: web3.PublicKey;
37
+ normalWithdrawalCutBp: number;
38
+ feeTreasury: web3.PublicKey;
39
+ selfAddress: web3.PublicKey;
40
+ signerBump: number[];
41
+ statusFlags: number;
42
+ financials: {
43
+ lpBalance: import("bn.js");
44
+ aumInBase: import("bn.js");
45
+ aumInBaseInPositions: import("bn.js");
46
+ lpLockedForWithdrawal: import("bn.js");
47
+ pendingManagementFeeLp: import("bn.js");
48
+ lastManagementFeeAccruedAt: import("bn.js");
49
+ pendingWithdrawalBacklogDueAt: number;
50
+ instantWithdrawalWindowEnd: number;
51
+ instantWithdrawalWindowCapAum: import("bn.js");
52
+ instantWithdrawnAumInWindow: import("bn.js");
53
+ reserved1: number[];
54
+ totalLpStakedInVotes: import("bn.js");
55
+ totalLpPendingWithdrawals: import("bn.js");
56
+ };
57
+ strategyPositions: (({
58
+ orderbook?: never;
59
+ tokenAccount?: never;
60
+ yieldPosition?: never;
61
+ clmmPosition?: never;
62
+ loopscaleLoan?: never;
63
+ loopscaleStrategy?: never;
64
+ } & {
65
+ obligation: {
66
+ 0: {} & {
67
+ kaminoObligation: {
68
+ 0: {
69
+ obligation: web3.PublicKey;
70
+ lendingProgramId: web3.PublicKey;
71
+ quotePriceId: ({
72
+ multiply?: never;
73
+ } & {
74
+ simple: {
75
+ priceId: import("bn.js");
76
+ };
77
+ }) | ({
78
+ simple?: never;
79
+ } & {
80
+ multiply: {
81
+ priceIds: import("bn.js")[];
82
+ };
83
+ });
84
+ reservePriceMappings: {
85
+ reserve: web3.PublicKey;
86
+ reservePriceId: unknown;
87
+ }[];
88
+ remainingAccountsAmount: import("bn.js");
89
+ minPriceStatusFlags: number;
90
+ };
91
+ };
92
+ };
93
+ };
94
+ }) | ({
95
+ obligation?: never;
96
+ tokenAccount?: never;
97
+ yieldPosition?: never;
98
+ clmmPosition?: never;
99
+ loopscaleLoan?: never;
100
+ loopscaleStrategy?: never;
101
+ } & {
102
+ orderbook: {
103
+ 0: {
104
+ orderbook: web3.PublicKey;
105
+ userEscrowIdx: number;
106
+ mint: web3.PublicKey;
107
+ offerIdxVec: number[];
108
+ priceIdPt: ({
109
+ multiply?: never;
110
+ } & {
111
+ simple: {
112
+ priceId: import("bn.js");
113
+ };
114
+ }) | ({
115
+ simple?: never;
116
+ } & {
117
+ multiply: {
118
+ priceIds: import("bn.js")[];
119
+ };
120
+ });
121
+ baseMint: web3.PublicKey;
122
+ };
123
+ };
124
+ }) | ({
125
+ obligation?: never;
126
+ orderbook?: never;
127
+ yieldPosition?: never;
128
+ clmmPosition?: never;
129
+ loopscaleLoan?: never;
130
+ loopscaleStrategy?: never;
131
+ } & {
132
+ tokenAccount: {
133
+ 0: {
134
+ tokenMint: web3.PublicKey;
135
+ balances: {
136
+ tokenAccount: web3.PublicKey;
137
+ mint: web3.PublicKey;
138
+ priceId: ({
139
+ multiply?: never;
140
+ } & {
141
+ simple: {
142
+ priceId: import("bn.js");
143
+ };
144
+ }) | ({
145
+ simple?: never;
146
+ } & {
147
+ multiply: {
148
+ priceIds: import("bn.js")[];
149
+ };
150
+ });
151
+ }[];
152
+ };
153
+ };
154
+ }) | ({
155
+ obligation?: never;
156
+ orderbook?: never;
157
+ tokenAccount?: never;
158
+ clmmPosition?: never;
159
+ loopscaleLoan?: never;
160
+ loopscaleStrategy?: never;
161
+ } & {
162
+ yieldPosition: {
163
+ 0: {
164
+ yieldPosition: web3.PublicKey;
165
+ vault: web3.PublicKey;
166
+ priceIdPt: ({
167
+ multiply?: never;
168
+ } & {
169
+ simple: {
170
+ priceId: import("bn.js");
171
+ };
172
+ }) | ({
173
+ simple?: never;
174
+ } & {
175
+ multiply: {
176
+ priceIds: import("bn.js")[];
177
+ };
178
+ });
179
+ };
180
+ };
181
+ }) | ({
182
+ obligation?: never;
183
+ orderbook?: never;
184
+ tokenAccount?: never;
185
+ yieldPosition?: never;
186
+ loopscaleLoan?: never;
187
+ loopscaleStrategy?: never;
188
+ } & {
189
+ clmmPosition: {
190
+ 0: {
191
+ lpPosition: web3.PublicKey;
192
+ market: web3.PublicKey;
193
+ priceIdPt: ({
194
+ multiply?: never;
195
+ } & {
196
+ simple: {
197
+ priceId: import("bn.js");
198
+ };
199
+ }) | ({
200
+ simple?: never;
201
+ } & {
202
+ multiply: {
203
+ priceIds: import("bn.js")[];
204
+ };
205
+ });
206
+ priceIdSy: ({
207
+ multiply?: never;
208
+ } & {
209
+ simple: {
210
+ priceId: import("bn.js");
211
+ };
212
+ }) | ({
213
+ simple?: never;
214
+ } & {
215
+ multiply: {
216
+ priceIds: import("bn.js")[];
217
+ };
218
+ });
219
+ };
220
+ };
221
+ }) | ({
222
+ obligation?: never;
223
+ orderbook?: never;
224
+ tokenAccount?: never;
225
+ yieldPosition?: never;
226
+ clmmPosition?: never;
227
+ loopscaleStrategy?: never;
228
+ } & {
229
+ loopscaleLoan: {
230
+ 0: {
231
+ loan: web3.PublicKey;
232
+ };
233
+ };
234
+ }) | ({
235
+ obligation?: never;
236
+ orderbook?: never;
237
+ tokenAccount?: never;
238
+ yieldPosition?: never;
239
+ clmmPosition?: never;
240
+ loopscaleLoan?: never;
241
+ } & {
242
+ loopscaleStrategy: {
243
+ 0: {
244
+ strategy: web3.PublicKey;
245
+ };
246
+ };
247
+ }))[];
248
+ maxAumSupply: import("bn.js");
249
+ seedId: number[];
250
+ roles: {
251
+ manager: web3.PublicKey[];
252
+ curator: web3.PublicKey[];
253
+ allocator: web3.PublicKey[];
254
+ sentinel: web3.PublicKey[];
255
+ };
256
+ proposalVoteConfig: {
257
+ minVotingPeriodSeconds: number;
258
+ maxVotingPeriodSeconds: number;
259
+ defaultVotingPeriodSeconds: number;
260
+ defaultTimelockSeconds: number;
261
+ rejectionThresholdBps: import("bn.js");
262
+ nextProposalId: import("bn.js");
263
+ votingEnabled: boolean;
264
+ liveProposalsCount: number;
265
+ maxConcurrentLiveProposals: number;
266
+ reserved: number[];
267
+ };
268
+ reservesConfig: {
269
+ reservesShareBp: number;
270
+ withdrawalPeriod: ({
271
+ weeklySchedule?: never;
272
+ } & {
273
+ interval: {
274
+ lockTimeSeconds: number;
275
+ };
276
+ }) | ({
277
+ interval?: never;
278
+ } & {
279
+ weeklySchedule: {
280
+ daysOfWeek: number;
281
+ weekInterval: number;
282
+ referenceTimestamp: number;
283
+ };
284
+ });
285
+ fastWithdrawalCutBp: number;
286
+ instantWithdrawalWindowLimitBp: number;
287
+ managementFeeBps: import("bn.js");
288
+ withdrawalCancelCooldownSeconds: number;
289
+ padding: number[];
290
+ padding1: number[];
291
+ padding2: number[];
292
+ padding3: number[];
293
+ };
294
+ }>;
295
+ fetchWithdrawalAccount(address: web3.PublicKey): Promise<{
296
+ vault: web3.PublicKey;
297
+ owner: web3.PublicKey;
298
+ lpAmountRequested: import("bn.js");
299
+ lpAmountRemaining: import("bn.js");
300
+ fills: {
301
+ mint: web3.PublicKey;
302
+ sourceTokenAccount: web3.PublicKey;
303
+ tokenAmount: import("bn.js");
304
+ }[];
305
+ createdAt: number;
306
+ updatedAt: number;
307
+ reserved: number[];
308
+ }>;
309
+ fetchActionProposal(address: web3.PublicKey): Promise<{
310
+ vault: web3.PublicKey;
311
+ proposalId: import("bn.js");
312
+ proposer: web3.PublicKey;
313
+ actionData: Buffer;
314
+ createdAt: import("bn.js");
315
+ votingEndsAt: import("bn.js");
316
+ timelockSeconds: number;
317
+ executableAt: import("bn.js");
318
+ status: ({
319
+ approved?: never;
320
+ rejected?: never;
321
+ executed?: never;
322
+ cancelled?: never;
323
+ draft?: never;
324
+ } & {
325
+ active: Record<string, never>;
326
+ }) | ({
327
+ active?: never;
328
+ rejected?: never;
329
+ executed?: never;
330
+ cancelled?: never;
331
+ draft?: never;
332
+ } & {
333
+ approved: Record<string, never>;
334
+ }) | ({
335
+ active?: never;
336
+ approved?: never;
337
+ executed?: never;
338
+ cancelled?: never;
339
+ draft?: never;
340
+ } & {
341
+ rejected: Record<string, never>;
342
+ }) | ({
343
+ active?: never;
344
+ approved?: never;
345
+ rejected?: never;
346
+ cancelled?: never;
347
+ draft?: never;
348
+ } & {
349
+ executed: Record<string, never>;
350
+ }) | ({
351
+ active?: never;
352
+ approved?: never;
353
+ rejected?: never;
354
+ executed?: never;
355
+ draft?: never;
356
+ } & {
357
+ cancelled: Record<string, never>;
358
+ }) | ({
359
+ active?: never;
360
+ approved?: never;
361
+ rejected?: never;
362
+ executed?: never;
363
+ cancelled?: never;
364
+ } & {
365
+ draft: Record<string, never>;
366
+ });
367
+ rejectVotes: import("bn.js");
368
+ optOutVotes: import("bn.js");
369
+ bump: number;
370
+ lpSupplySnapshot: import("bn.js");
371
+ rejectionRequiredSnapshot: import("bn.js");
372
+ reserved: number[];
373
+ }>;
374
+ fetchAllVaults(filters?: web3.GetProgramAccountsFilter[]): Promise<{
375
+ publicKey: web3.PublicKey;
376
+ account: any;
377
+ }[]>;
378
+ fetchAllActionProposals(filters?: web3.GetProgramAccountsFilter[]): Promise<{
379
+ publicKey: web3.PublicKey;
380
+ account: any;
381
+ }[]>;
382
+ fetchAllWithdrawalAccounts(filters?: web3.GetProgramAccountsFilter[]): Promise<import("@coral-xyz/anchor").ProgramAccount<{
383
+ vault: web3.PublicKey;
384
+ owner: web3.PublicKey;
385
+ lpAmountRequested: import("bn.js");
386
+ lpAmountRemaining: import("bn.js");
387
+ fills: {
388
+ mint: web3.PublicKey;
389
+ sourceTokenAccount: web3.PublicKey;
390
+ tokenAmount: import("bn.js");
391
+ }[];
392
+ createdAt: number;
393
+ updatedAt: number;
394
+ reserved: number[];
395
+ }>[]>;
396
+ fetchAllActionProposalsForVault(vaultAddress: web3.PublicKey, filters?: web3.GetProgramAccountsFilter[]): Promise<{
397
+ publicKey: web3.PublicKey;
398
+ account: any;
399
+ }[]>;
400
+ fetchVaultDeserialized(address: web3.PublicKey): Promise<ExponentVault>;
401
+ fetchActionProposalDeserialized(address: web3.PublicKey): Promise<ActionProposal>;
402
+ fetchWithdrawalAccountDeserialized(address: web3.PublicKey): Promise<WithdrawalAccount>;
403
+ fetchAllVaultsDeserialized(filters?: web3.GetProgramAccountsFilter[]): Promise<{
404
+ publicKey: web3.PublicKey;
405
+ account: ExponentVault;
406
+ }[]>;
407
+ fetchAllActionProposalsDeserialized(filters?: web3.GetProgramAccountsFilter[]): Promise<{
408
+ publicKey: web3.PublicKey;
409
+ account: ActionProposal;
410
+ }[]>;
411
+ fetchAllActionProposalsForVaultDeserialized(vaultAddress: web3.PublicKey, filters?: web3.GetProgramAccountsFilter[]): Promise<{
412
+ publicKey: web3.PublicKey;
413
+ account: ActionProposal;
414
+ }[]>;
415
+ fetchAllWithdrawalAccountsDeserialized(filters?: web3.GetProgramAccountsFilter[]): Promise<{
416
+ publicKey: web3.PublicKey;
417
+ account: {
418
+ vault: web3.PublicKey;
419
+ owner: web3.PublicKey;
420
+ lpAmountRequested: bigint;
421
+ lpAmountRemaining: bigint;
422
+ fills: {
423
+ mint: web3.PublicKey;
424
+ sourceTokenAccount: web3.PublicKey;
425
+ tokenAmount: bigint;
426
+ }[];
427
+ createdAt: number;
428
+ updatedAt: number;
429
+ reserved: number[];
430
+ };
431
+ }[]>;
432
+ /**
433
+ * Fetch the singleton ExponentPrices account.
434
+ */
435
+ fetchExponentPrices(): Promise<ExponentPrices>;
436
+ /**
437
+ * Get all unique price IDs required by a vault's token account positions.
438
+ * Returns a set of price IDs that should exist in an ExponentPrices account.
439
+ */
440
+ getRequiredPriceIds(vault: ExponentVault): Set<bigint>;
441
+ }