@0dotxyz/p0-ts-sdk 1.0.0-alpha.2

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,1164 @@
1
+ import { BN, BorshCoder, Provider, Program } from '@coral-xyz/anchor';
2
+ import { PublicKey } from '@solana/web3.js';
3
+ import BN$1 from 'bn.js';
4
+
5
+ declare const SWITCHBOARD_ONDEMANDE_PRICE_PRECISION = 18;
6
+ interface CurrentResult {
7
+ value: BN;
8
+ std_dev: BN;
9
+ mean: BN;
10
+ range: BN;
11
+ min_value: BN;
12
+ max_vaalue: BN;
13
+ slot: BN;
14
+ min_slot: BN;
15
+ max_slot: BN;
16
+ }
17
+ interface OracleSubmission {
18
+ oracle: PublicKey;
19
+ slot: BN;
20
+ value: BN;
21
+ }
22
+ interface PullFeedAccountData {
23
+ submissions: OracleSubmission[];
24
+ authority: PublicKey;
25
+ queue: PublicKey;
26
+ feed_hash: Buffer;
27
+ initialized_at: BN;
28
+ permissions: BN;
29
+ max_variance: BN;
30
+ min_responses: number;
31
+ name: Buffer;
32
+ sample_size: number;
33
+ last_update_timestamp: BN;
34
+ lut_slot: BN;
35
+ result: CurrentResult;
36
+ max_staleness: number;
37
+ min_sample_size: number;
38
+ }
39
+ type CrossbarSimulatePayload = FeedResponse[];
40
+ interface FeedResponse {
41
+ feedHash: string;
42
+ results: number[];
43
+ }
44
+ declare const switchboardAccountCoder: BorshCoder<string, string>;
45
+ declare function getSwitchboardProgram(provider: Provider): Program;
46
+ declare function decodeSwitchboardPullFeedData(data: Buffer): PullFeedAccountData;
47
+
48
+ interface LastUpdateFields {
49
+ /** Last slot when updated */
50
+ slot: BN$1;
51
+ /** True when marked stale, false when slot updated */
52
+ stale: number;
53
+ /** Status of the prices used to calculate the last update */
54
+ priceStatus: number;
55
+ placeholder: Array<number>;
56
+ }
57
+ interface BigFractionBytesFields {
58
+ value: Array<BN$1>;
59
+ padding: Array<BN$1>;
60
+ }
61
+
62
+ interface LastUpdateJSON {
63
+ /** Last slot when updated */
64
+ slot: string;
65
+ /** True when marked stale, false when slot updated */
66
+ stale: number;
67
+ /** Status of the prices used to calculate the last update */
68
+ priceStatus: number;
69
+ placeholder: Array<number>;
70
+ }
71
+ interface BigFractionBytesJSON {
72
+ value: Array<string>;
73
+ padding: Array<string>;
74
+ }
75
+
76
+ interface ReserveRaw {
77
+ /** Version of the reserve */
78
+ version: BN$1;
79
+ /** Last slot when supply and rates updated */
80
+ lastUpdate: LastUpdateFields;
81
+ /** Lending market address */
82
+ lendingMarket: PublicKey;
83
+ farmCollateral: PublicKey;
84
+ farmDebt: PublicKey;
85
+ /** Reserve liquidity */
86
+ liquidity: ReserveLiquidityFields;
87
+ reserveLiquidityPadding: Array<BN$1>;
88
+ /** Reserve collateral */
89
+ collateral: ReserveCollateralFields;
90
+ reserveCollateralPadding: Array<BN$1>;
91
+ /** Reserve configuration values */
92
+ config: ReserveConfigFields;
93
+ configPadding: Array<BN$1>;
94
+ borrowedAmountOutsideElevationGroup: BN$1;
95
+ /**
96
+ * Amount of token borrowed in lamport of debt asset in the given
97
+ * elevation group when this reserve is part of the collaterals.
98
+ */
99
+ borrowedAmountsAgainstThisReserveInElevationGroups: Array<BN$1>;
100
+ padding: Array<BN$1>;
101
+ }
102
+ interface ReserveLiquidityFields {
103
+ /** Reserve liquidity mint address */
104
+ mintPubkey: PublicKey;
105
+ /** Reserve liquidity supply address */
106
+ supplyVault: PublicKey;
107
+ /** Reserve liquidity fee collection address */
108
+ feeVault: PublicKey;
109
+ /** Reserve liquidity available */
110
+ availableAmount: BN$1;
111
+ /** Reserve liquidity borrowed (scaled fraction) */
112
+ borrowedAmountSf: BN$1;
113
+ /** Reserve liquidity market price in quote currency (scaled fraction) */
114
+ marketPriceSf: BN$1;
115
+ /** Unix timestamp of the market price (from the oracle) */
116
+ marketPriceLastUpdatedTs: BN$1;
117
+ /** Reserve liquidity mint decimals */
118
+ mintDecimals: BN$1;
119
+ /**
120
+ * Timestamp when the last refresh reserve detected that the liquidity amount is above the deposit cap. When this threshold is crossed, then redemptions (auto-deleverage) are enabled.
121
+ * If the threshold is not crossed, then the timestamp is set to 0
122
+ */
123
+ depositLimitCrossedTimestamp: BN$1;
124
+ /**
125
+ * Timestamp when the last refresh reserve detected that the borrowed amount is above the borrow cap. When this threshold is crossed, then redemptions (auto-deleverage) are enabled.
126
+ * If the threshold is not crossed, then the timestamp is set to 0
127
+ */
128
+ borrowLimitCrossedTimestamp: BN$1;
129
+ /** Reserve liquidity cumulative borrow rate (scaled fraction) */
130
+ cumulativeBorrowRateBsf: BigFractionBytesFields;
131
+ /** Reserve cumulative protocol fees (scaled fraction) */
132
+ accumulatedProtocolFeesSf: BN$1;
133
+ /** Reserve cumulative referrer fees (scaled fraction) */
134
+ accumulatedReferrerFeesSf: BN$1;
135
+ /** Reserve pending referrer fees, to be claimed in refresh_obligation by referrer or protocol (scaled fraction) */
136
+ pendingReferrerFeesSf: BN$1;
137
+ /** Reserve referrer fee absolute rate calculated at each refresh_reserve operation (scaled fraction) */
138
+ absoluteReferralRateSf: BN$1;
139
+ /** Token program of the liquidity mint */
140
+ tokenProgram: PublicKey;
141
+ padding2: Array<BN$1>;
142
+ padding3: Array<BN$1>;
143
+ }
144
+ interface ReserveCollateralFields {
145
+ /** Reserve collateral mint address */
146
+ mintPubkey: PublicKey;
147
+ /** Reserve collateral mint supply, used for exchange rate */
148
+ mintTotalSupply: BN$1;
149
+ /** Reserve collateral supply address */
150
+ supplyVault: PublicKey;
151
+ padding1: Array<BN$1>;
152
+ padding2: Array<BN$1>;
153
+ }
154
+ interface ReserveConfigFields {
155
+ /** Status of the reserve Active/Obsolete/Hidden */
156
+ status: number;
157
+ /** Asset tier -> 0 - regular (collateral & debt), 1 - isolated collateral, 2 - isolated debt */
158
+ assetTier: number;
159
+ /** Flat rate that goes to the host */
160
+ hostFixedInterestRateBps: number;
161
+ /**
162
+ * [DEPRECATED] Space that used to hold 2 fields:
163
+ * - Boost for side (debt or collateral)
164
+ * - Reward points multiplier per obligation type
165
+ * Can be re-used after making sure all underlying production account data is zeroed.
166
+ */
167
+ reserved2: Array<number>;
168
+ /** Cut of the order execution bonus that the protocol receives, as a percentage */
169
+ protocolOrderExecutionFeePct: number;
170
+ /** Protocol take rate is the amount borrowed interest protocol receives, as a percentage */
171
+ protocolTakeRatePct: number;
172
+ /** Cut of the liquidation bonus that the protocol receives, as a percentage */
173
+ protocolLiquidationFeePct: number;
174
+ /**
175
+ * Target ratio of the value of borrows to deposits, as a percentage
176
+ * 0 if use as collateral is disabled
177
+ */
178
+ loanToValuePct: number;
179
+ /** Loan to value ratio at which an obligation can be liquidated, as percentage */
180
+ liquidationThresholdPct: number;
181
+ /** Minimum bonus a liquidator receives when repaying part of an unhealthy obligation, as bps */
182
+ minLiquidationBonusBps: number;
183
+ /** Maximum bonus a liquidator receives when repaying part of an unhealthy obligation, as bps */
184
+ maxLiquidationBonusBps: number;
185
+ /** Bad debt liquidation bonus for an undercollateralized obligation, as bps */
186
+ badDebtLiquidationBonusBps: number;
187
+ /**
188
+ * Time in seconds that must pass before redemptions are enabled after the deposit limit is
189
+ * crossed.
190
+ * Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case.
191
+ */
192
+ deleveragingMarginCallPeriodSecs: BN$1;
193
+ /**
194
+ * The rate at which the deleveraging threshold decreases, in bps per day.
195
+ * Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case.
196
+ */
197
+ deleveragingThresholdDecreaseBpsPerDay: BN$1;
198
+ /** Program owner fees assessed, separate from gains due to interest accrual */
199
+ fees: ReserveFeesFields;
200
+ /** Borrow rate curve based on utilization */
201
+ borrowRateCurve: BorrowRateCurveFields;
202
+ /** Borrow factor in percentage - used for risk adjustment */
203
+ borrowFactorPct: BN$1;
204
+ /** Maximum deposit limit of liquidity in native units, u64::MAX for inf */
205
+ depositLimit: BN$1;
206
+ /** Maximum amount borrowed, u64::MAX for inf, 0 to disable borrows (protected deposits) */
207
+ borrowLimit: BN$1;
208
+ /** Token id from TokenInfos struct */
209
+ tokenInfo: TokenInfoFields$1;
210
+ /** Deposit withdrawal caps - deposit & redeem */
211
+ depositWithdrawalCap: WithdrawalCapsFields;
212
+ /** Debt withdrawal caps - borrow & repay */
213
+ debtWithdrawalCap: WithdrawalCapsFields;
214
+ elevationGroups: Array<number>;
215
+ disableUsageAsCollOutsideEmode: number;
216
+ /** Utilization (in percentage) above which borrowing is blocked. 0 to disable. */
217
+ utilizationLimitBlockBorrowingAbovePct: number;
218
+ /**
219
+ * Whether this reserve should be subject to auto-deleveraging after deposit or borrow limit is
220
+ * crossed.
221
+ * Besides this flag, the lending market's flag also needs to be enabled (logical `AND`).
222
+ * **NOTE:** the manual "target LTV" deleveraging (enabled by the risk council for individual
223
+ * obligations) is NOT affected by this flag.
224
+ */
225
+ autodeleverageEnabled: number;
226
+ reserved1: Array<number>;
227
+ /**
228
+ * Maximum amount liquidity of this reserve borrowed outside all elevation groups
229
+ * - u64::MAX for inf
230
+ * - 0 to disable borrows outside elevation groups
231
+ */
232
+ borrowLimitOutsideElevationGroup: BN$1;
233
+ /**
234
+ * Defines the maximum amount (in lamports of elevation group debt asset)
235
+ * that can be borrowed when this reserve is used as collateral.
236
+ * - u64::MAX for inf
237
+ * - 0 to disable borrows in this elevation group (expected value for the debt asset)
238
+ */
239
+ borrowLimitAgainstThisCollateralInElevationGroup: Array<BN$1>;
240
+ /**
241
+ * The rate at which the deleveraging-related liquidation bonus increases, in bps per day.
242
+ * Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case.
243
+ */
244
+ deleveragingBonusIncreaseBpsPerDay: BN$1;
245
+ }
246
+ interface ReserveFeesFields {
247
+ /**
248
+ * Fee assessed on `BorrowObligationLiquidity`, as scaled fraction (60 bits fractional part)
249
+ * Must be between `0` and `2^60`, such that `2^60 = 1`. A few examples for
250
+ * clarity:
251
+ * 1% = (1 << 60) / 100 = 11529215046068470
252
+ * 0.01% (1 basis point) = 115292150460685
253
+ * 0.00001% (Aave borrow fee) = 115292150461
254
+ */
255
+ borrowFeeSf: BN$1;
256
+ /**
257
+ * Fee for flash loan, expressed as scaled fraction.
258
+ * 0.3% (Aave flash loan fee) = 0.003 * 2^60 = 3458764513820541
259
+ */
260
+ flashLoanFeeSf: BN$1;
261
+ /** Used for allignment */
262
+ padding: Array<number>;
263
+ }
264
+ interface BorrowRateCurveFields {
265
+ points: Array<CurvePointFields>;
266
+ }
267
+ interface CurvePointFields {
268
+ utilizationRateBps: number;
269
+ borrowRateBps: number;
270
+ }
271
+ interface TokenInfoFields$1 {
272
+ /** UTF-8 encoded name of the token (null-terminated) */
273
+ name: Array<number>;
274
+ /** Heuristics limits of acceptable price */
275
+ heuristic: PriceHeuristicFields;
276
+ /** Max divergence between twap and price in bps */
277
+ maxTwapDivergenceBps: BN$1;
278
+ maxAgePriceSeconds: BN$1;
279
+ maxAgeTwapSeconds: BN$1;
280
+ /** Scope price configuration */
281
+ scopeConfiguration: ScopeConfigurationFields;
282
+ /** Switchboard configuration */
283
+ switchboardConfiguration: SwitchboardConfigurationFields;
284
+ /** Pyth configuration */
285
+ pythConfiguration: PythConfigurationFields;
286
+ blockPriceUsage: number;
287
+ reserved: Array<number>;
288
+ padding: Array<BN$1>;
289
+ }
290
+ interface PriceHeuristicFields {
291
+ /** Lower value of acceptable price */
292
+ lower: BN$1;
293
+ /** Upper value of acceptable price */
294
+ upper: BN$1;
295
+ /** Number of decimals of the previously defined values */
296
+ exp: BN$1;
297
+ }
298
+ interface ScopeConfigurationFields {
299
+ /** Pubkey of the scope price feed (disabled if `null` or `default`) */
300
+ priceFeed: PublicKey;
301
+ /** This is the scope_id price chain that results in a price for the token */
302
+ priceChain: Array<number>;
303
+ /** This is the scope_id price chain for the twap */
304
+ twapChain: Array<number>;
305
+ }
306
+ interface SwitchboardConfigurationFields {
307
+ /** Pubkey of the base price feed (disabled if `null` or `default`) */
308
+ priceAggregator: PublicKey;
309
+ twapAggregator: PublicKey;
310
+ }
311
+ interface PythConfigurationFields {
312
+ /** Pubkey of the base price feed (disabled if `null` or `default`) */
313
+ price: PublicKey;
314
+ }
315
+ interface WithdrawalCapsFields {
316
+ configCapacity: BN$1;
317
+ currentTotal: BN$1;
318
+ lastIntervalStartTimestamp: BN$1;
319
+ configIntervalLengthSeconds: BN$1;
320
+ }
321
+
322
+ interface ReserveJSON {
323
+ /** Version of the reserve */
324
+ version: string;
325
+ /** Last slot when supply and rates updated */
326
+ lastUpdate: LastUpdateJSON;
327
+ /** Lending market address */
328
+ lendingMarket: string;
329
+ farmCollateral: string;
330
+ farmDebt: string;
331
+ /** Reserve liquidity */
332
+ liquidity: ReserveLiquidityJSON;
333
+ reserveLiquidityPadding: Array<string>;
334
+ /** Reserve collateral */
335
+ collateral: ReserveCollateralJSON;
336
+ reserveCollateralPadding: Array<string>;
337
+ /** Reserve configuration values */
338
+ config: ReserveConfigJSON;
339
+ configPadding: Array<string>;
340
+ borrowedAmountOutsideElevationGroup: string;
341
+ /**
342
+ * Amount of token borrowed in lamport of debt asset in the given
343
+ * elevation group when this reserve is part of the collaterals.
344
+ */
345
+ borrowedAmountsAgainstThisReserveInElevationGroups: Array<string>;
346
+ padding: Array<string>;
347
+ }
348
+ interface ReserveLiquidityJSON {
349
+ /** Reserve liquidity mint address */
350
+ mintPubkey: string;
351
+ /** Reserve liquidity supply address */
352
+ supplyVault: string;
353
+ /** Reserve liquidity fee collection address */
354
+ feeVault: string;
355
+ /** Reserve liquidity available */
356
+ availableAmount: string;
357
+ /** Reserve liquidity borrowed (scaled fraction) */
358
+ borrowedAmountSf: string;
359
+ /** Reserve liquidity market price in quote currency (scaled fraction) */
360
+ marketPriceSf: string;
361
+ /** Unix timestamp of the market price (from the oracle) */
362
+ marketPriceLastUpdatedTs: string;
363
+ /** Reserve liquidity mint decimals */
364
+ mintDecimals: string;
365
+ /**
366
+ * Timestamp when the last refresh reserve detected that the liquidity amount is above the deposit cap. When this threshold is crossed, then redemptions (auto-deleverage) are enabled.
367
+ * If the threshold is not crossed, then the timestamp is set to 0
368
+ */
369
+ depositLimitCrossedTimestamp: string;
370
+ /**
371
+ * Timestamp when the last refresh reserve detected that the borrowed amount is above the borrow cap. When this threshold is crossed, then redemptions (auto-deleverage) are enabled.
372
+ * If the threshold is not crossed, then the timestamp is set to 0
373
+ */
374
+ borrowLimitCrossedTimestamp: string;
375
+ /** Reserve liquidity cumulative borrow rate (scaled fraction) */
376
+ cumulativeBorrowRateBsf: BigFractionBytesJSON;
377
+ /** Reserve cumulative protocol fees (scaled fraction) */
378
+ accumulatedProtocolFeesSf: string;
379
+ /** Reserve cumulative referrer fees (scaled fraction) */
380
+ accumulatedReferrerFeesSf: string;
381
+ /** Reserve pending referrer fees, to be claimed in refresh_obligation by referrer or protocol (scaled fraction) */
382
+ pendingReferrerFeesSf: string;
383
+ /** Reserve referrer fee absolute rate calculated at each refresh_reserve operation (scaled fraction) */
384
+ absoluteReferralRateSf: string;
385
+ /** Token program of the liquidity mint */
386
+ tokenProgram: string;
387
+ padding2: Array<string>;
388
+ padding3: Array<string>;
389
+ }
390
+ interface ReserveCollateralJSON {
391
+ /** Reserve collateral mint address */
392
+ mintPubkey: string;
393
+ /** Reserve collateral mint supply, used for exchange rate */
394
+ mintTotalSupply: string;
395
+ /** Reserve collateral supply address */
396
+ supplyVault: string;
397
+ padding1: Array<string>;
398
+ padding2: Array<string>;
399
+ }
400
+ interface ReserveConfigJSON {
401
+ /** Status of the reserve Active/Obsolete/Hidden */
402
+ status: number;
403
+ /** Asset tier -> 0 - regular (collateral & debt), 1 - isolated collateral, 2 - isolated debt */
404
+ assetTier: number;
405
+ /** Flat rate that goes to the host */
406
+ hostFixedInterestRateBps: number;
407
+ /**
408
+ * [DEPRECATED] Space that used to hold 2 fields:
409
+ * - Boost for side (debt or collateral)
410
+ * - Reward points multiplier per obligation type
411
+ * Can be re-used after making sure all underlying production account data is zeroed.
412
+ */
413
+ reserved2: Array<number>;
414
+ /** Cut of the order execution bonus that the protocol receives, as a percentage */
415
+ protocolOrderExecutionFeePct: number;
416
+ /** Protocol take rate is the amount borrowed interest protocol receives, as a percentage */
417
+ protocolTakeRatePct: number;
418
+ /** Cut of the liquidation bonus that the protocol receives, as a percentage */
419
+ protocolLiquidationFeePct: number;
420
+ /**
421
+ * Target ratio of the value of borrows to deposits, as a percentage
422
+ * 0 if use as collateral is disabled
423
+ */
424
+ loanToValuePct: number;
425
+ /** Loan to value ratio at which an obligation can be liquidated, as percentage */
426
+ liquidationThresholdPct: number;
427
+ /** Minimum bonus a liquidator receives when repaying part of an unhealthy obligation, as bps */
428
+ minLiquidationBonusBps: number;
429
+ /** Maximum bonus a liquidator receives when repaying part of an unhealthy obligation, as bps */
430
+ maxLiquidationBonusBps: number;
431
+ /** Bad debt liquidation bonus for an undercollateralized obligation, as bps */
432
+ badDebtLiquidationBonusBps: number;
433
+ /**
434
+ * Time in seconds that must pass before redemptions are enabled after the deposit limit is
435
+ * crossed.
436
+ * Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case.
437
+ */
438
+ deleveragingMarginCallPeriodSecs: string;
439
+ /**
440
+ * The rate at which the deleveraging threshold decreases, in bps per day.
441
+ * Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case.
442
+ */
443
+ deleveragingThresholdDecreaseBpsPerDay: string;
444
+ /** Program owner fees assessed, separate from gains due to interest accrual */
445
+ fees: ReserveFeesJSON;
446
+ /** Borrow rate curve based on utilization */
447
+ borrowRateCurve: BorrowRateCurveJSON;
448
+ /** Borrow factor in percentage - used for risk adjustment */
449
+ borrowFactorPct: string;
450
+ /** Maximum deposit limit of liquidity in native units, u64::MAX for inf */
451
+ depositLimit: string;
452
+ /** Maximum amount borrowed, u64::MAX for inf, 0 to disable borrows (protected deposits) */
453
+ borrowLimit: string;
454
+ /** Token id from TokenInfos struct */
455
+ tokenInfo: TokenInfoJSON$1;
456
+ /** Deposit withdrawal caps - deposit & redeem */
457
+ depositWithdrawalCap: WithdrawalCapsJSON;
458
+ /** Debt withdrawal caps - borrow & repay */
459
+ debtWithdrawalCap: WithdrawalCapsJSON;
460
+ elevationGroups: Array<number>;
461
+ disableUsageAsCollOutsideEmode: number;
462
+ /** Utilization (in percentage) above which borrowing is blocked. 0 to disable. */
463
+ utilizationLimitBlockBorrowingAbovePct: number;
464
+ /**
465
+ * Whether this reserve should be subject to auto-deleveraging after deposit or borrow limit is
466
+ * crossed.
467
+ * Besides this flag, the lending market's flag also needs to be enabled (logical `AND`).
468
+ * **NOTE:** the manual "target LTV" deleveraging (enabled by the risk council for individual
469
+ * obligations) is NOT affected by this flag.
470
+ */
471
+ autodeleverageEnabled: number;
472
+ reserved1: Array<number>;
473
+ /**
474
+ * Maximum amount liquidity of this reserve borrowed outside all elevation groups
475
+ * - u64::MAX for inf
476
+ * - 0 to disable borrows outside elevation groups
477
+ */
478
+ borrowLimitOutsideElevationGroup: string;
479
+ /**
480
+ * Defines the maximum amount (in lamports of elevation group debt asset)
481
+ * that can be borrowed when this reserve is used as collateral.
482
+ * - u64::MAX for inf
483
+ * - 0 to disable borrows in this elevation group (expected value for the debt asset)
484
+ */
485
+ borrowLimitAgainstThisCollateralInElevationGroup: Array<string>;
486
+ /**
487
+ * The rate at which the deleveraging-related liquidation bonus increases, in bps per day.
488
+ * Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case.
489
+ */
490
+ deleveragingBonusIncreaseBpsPerDay: string;
491
+ }
492
+ interface ReserveFeesJSON {
493
+ /**
494
+ * Fee assessed on `BorrowObligationLiquidity`, as scaled fraction (60 bits fractional part)
495
+ * Must be between `0` and `2^60`, such that `2^60 = 1`. A few examples for
496
+ * clarity:
497
+ * 1% = (1 << 60) / 100 = 11529215046068470
498
+ * 0.01% (1 basis point) = 115292150460685
499
+ * 0.00001% (Aave borrow fee) = 115292150461
500
+ */
501
+ borrowFeeSf: string;
502
+ /**
503
+ * Fee for flash loan, expressed as scaled fraction.
504
+ * 0.3% (Aave flash loan fee) = 0.003 * 2^60 = 3458764513820541
505
+ */
506
+ flashLoanFeeSf: string;
507
+ /** Used for allignment */
508
+ padding: Array<number>;
509
+ }
510
+ interface BorrowRateCurveJSON {
511
+ points: Array<CurvePointJSON>;
512
+ }
513
+ interface CurvePointJSON {
514
+ utilizationRateBps: number;
515
+ borrowRateBps: number;
516
+ }
517
+ interface TokenInfoJSON$1 {
518
+ /** UTF-8 encoded name of the token (null-terminated) */
519
+ name: Array<number>;
520
+ /** Heuristics limits of acceptable price */
521
+ heuristic: PriceHeuristicJSON;
522
+ /** Max divergence between twap and price in bps */
523
+ maxTwapDivergenceBps: string;
524
+ maxAgePriceSeconds: string;
525
+ maxAgeTwapSeconds: string;
526
+ /** Scope price configuration */
527
+ scopeConfiguration: ScopeConfigurationJSON;
528
+ /** Switchboard configuration */
529
+ switchboardConfiguration: SwitchboardConfigurationJSON;
530
+ /** Pyth configuration */
531
+ pythConfiguration: PythConfigurationJSON;
532
+ blockPriceUsage: number;
533
+ reserved: Array<number>;
534
+ padding: Array<string>;
535
+ }
536
+ interface PriceHeuristicJSON {
537
+ /** Lower value of acceptable price */
538
+ lower: string;
539
+ /** Upper value of acceptable price */
540
+ upper: string;
541
+ /** Number of decimals of the previously defined values */
542
+ exp: string;
543
+ }
544
+ interface ScopeConfigurationJSON {
545
+ /** Pubkey of the scope price feed (disabled if `null` or `default`) */
546
+ priceFeed: string;
547
+ /** This is the scope_id price chain that results in a price for the token */
548
+ priceChain: Array<number>;
549
+ /** This is the scope_id price chain for the twap */
550
+ twapChain: Array<number>;
551
+ }
552
+ interface SwitchboardConfigurationJSON {
553
+ /** Pubkey of the base price feed (disabled if `null` or `default`) */
554
+ priceAggregator: string;
555
+ twapAggregator: string;
556
+ }
557
+ interface PythConfigurationJSON {
558
+ /** Pubkey of the base price feed (disabled if `null` or `default`) */
559
+ price: string;
560
+ }
561
+ interface WithdrawalCapsJSON {
562
+ configCapacity: string;
563
+ currentTotal: string;
564
+ lastIntervalStartTimestamp: string;
565
+ configIntervalLengthSeconds: string;
566
+ }
567
+
568
+ interface ObligationJSON {
569
+ /** Version of the struct */
570
+ tag: string;
571
+ /** Last update to collateral, liquidity, or their market values */
572
+ lastUpdate: LastUpdateJSON;
573
+ /** Lending market address */
574
+ lendingMarket: string;
575
+ /** Owner authority which can borrow liquidity */
576
+ owner: string;
577
+ /** Deposited collateral for the obligation, unique by deposit reserve address */
578
+ deposits: Array<ObligationCollateralJSON>;
579
+ /** Worst LTV for the collaterals backing the loan, represented as a percentage */
580
+ lowestReserveDepositLiquidationLtv: string;
581
+ /** Market value of deposits (scaled fraction) */
582
+ depositedValueSf: string;
583
+ /** Borrowed liquidity for the obligation, unique by borrow reserve address */
584
+ borrows: Array<ObligationLiquidityJSON>;
585
+ /** Risk adjusted market value of borrows/debt (sum of price * borrowed_amount * borrow_factor) (scaled fraction) */
586
+ borrowFactorAdjustedDebtValueSf: string;
587
+ /** Market value of borrows - used for max_liquidatable_borrowed_amount (scaled fraction) */
588
+ borrowedAssetsMarketValueSf: string;
589
+ /** The maximum borrow value at the weighted average loan to value ratio (scaled fraction) */
590
+ allowedBorrowValueSf: string;
591
+ /** The dangerous borrow value at the weighted average liquidation threshold (scaled fraction) */
592
+ unhealthyBorrowValueSf: string;
593
+ /** The asset tier of the deposits */
594
+ depositsAssetTiers: Array<number>;
595
+ /** The asset tier of the borrows */
596
+ borrowsAssetTiers: Array<number>;
597
+ /** The elevation group id the obligation opted into. */
598
+ elevationGroup: number;
599
+ /** The number of obsolete reserves the obligation has a deposit in */
600
+ numOfObsoleteDepositReserves: number;
601
+ /** Marked = 1 if borrows array is not empty, 0 = borrows empty */
602
+ hasDebt: number;
603
+ /** Wallet address of the referrer */
604
+ referrer: string;
605
+ /** Marked = 1 if borrowing disabled, 0 = borrowing enabled */
606
+ borrowingDisabled: number;
607
+ /**
608
+ * A target LTV set by the risk council when marking this obligation for deleveraging.
609
+ * Only effective when `deleveraging_margin_call_started_slot != 0`.
610
+ */
611
+ autodeleverageTargetLtvPct: number;
612
+ /** The lowest max LTV found amongst the collateral deposits */
613
+ lowestReserveDepositMaxLtvPct: number;
614
+ /** The number of obsolete reserves the obligation has a borrow in */
615
+ numOfObsoleteBorrowReserves: number;
616
+ reserved: Array<number>;
617
+ highestBorrowFactorPct: string;
618
+ /**
619
+ * A timestamp at which the risk council most-recently marked this obligation for deleveraging.
620
+ * Zero if not currently subject to deleveraging.
621
+ */
622
+ autodeleverageMarginCallStartedTimestamp: string;
623
+ /**
624
+ * Owner-defined, liquidator-executed orders applicable to this obligation.
625
+ * Typical use-cases would be a stop-loss and a take-profit (possibly co-existing).
626
+ */
627
+ orders: Array<ObligationOrderJSON>;
628
+ padding3: Array<string>;
629
+ }
630
+ interface ObligationLiquidityJSON {
631
+ /** Reserve liquidity is borrowed from */
632
+ borrowReserve: string;
633
+ /** Borrow rate used for calculating interest (big scaled fraction) */
634
+ cumulativeBorrowRateBsf: BigFractionBytesJSON;
635
+ padding: string;
636
+ /** Amount of liquidity borrowed plus interest (scaled fraction) */
637
+ borrowedAmountSf: string;
638
+ /** Liquidity market value in quote currency (scaled fraction) */
639
+ marketValueSf: string;
640
+ /** Risk adjusted liquidity market value in quote currency - DEBUG ONLY - use market_value instead */
641
+ borrowFactorAdjustedMarketValueSf: string;
642
+ /** Amount of liquidity borrowed outside of an elevation group */
643
+ borrowedAmountOutsideElevationGroups: string;
644
+ padding2: Array<string>;
645
+ }
646
+ interface ObligationCollateralJSON {
647
+ /** Reserve collateral is deposited to */
648
+ depositReserve: string;
649
+ /** Amount of collateral deposited */
650
+ depositedAmount: string;
651
+ /** Collateral market value in quote currency (scaled fraction) */
652
+ marketValueSf: string;
653
+ /**
654
+ * Debt amount (lamport) taken against this collateral.
655
+ * (only meaningful if this obligation is part of an elevation group, otherwise 0)
656
+ * This is only indicative of the debt computed on the last refresh obligation.
657
+ * If the obligation have multiple collateral this value is the same for all of them.
658
+ */
659
+ borrowedAmountAgainstThisCollateralInElevationGroup: string;
660
+ padding: Array<string>;
661
+ }
662
+ interface ObligationOrderJSON {
663
+ /**
664
+ * A threshold value used by the condition (scaled [Fraction]).
665
+ * The exact meaning depends on the specific [Self::condition_type].
666
+ *
667
+ * Examples:
668
+ * - when `condition_type == 2 (UserLtvBelow)`:
669
+ * then a value of `0.455` here means that the order is active only when the obligation's
670
+ * user LTV is less than `0.455` (i.e. < 45.5%).
671
+ * - when `condition_type == 3 (DebtCollPriceRatioAbove)`:
672
+ * assuming the obligation uses BTC collateral for SOL debt, then a value of `491.3` here
673
+ * means that the order is active only when the BTC-SOL price is greater than `491.3` (i.e.
674
+ * > 491.3 SOL per BTC).
675
+ */
676
+ conditionThresholdSf: string;
677
+ /**
678
+ * A configuration parameter used by the opportunity (scaled [Fraction]).
679
+ * The exact meaning depends on the specific [Self::opportunity_type].
680
+ *
681
+ * Examples:
682
+ * - when `opportunity_type == 0 (DeleverageSingleDebtAmount)`:
683
+ * Assuming the obligation uses BTC collateral for SOL debt, then a value of `1_234_000_000`
684
+ * here means that a liquidator may repay up to 1234000000 lamports (i.e. 1.234 SOL) on this
685
+ * obligation.
686
+ * Note: the special value of [Fraction::MAX] is *not* allowed in this case.
687
+ * - when `opportunity_type == 1 (DeleverageAllDebtAmount)`:
688
+ * The only allowed value in this case is [Fraction::MAX] (to emphasize that *all* debt
689
+ * should be repaid).
690
+ */
691
+ opportunityParameterSf: string;
692
+ /**
693
+ * A *minimum* additional fraction of collateral transferred to the liquidator, in bps.
694
+ *
695
+ * The minimum bonus is applied exactly when the [Self::condition_threshold_sf] is met, and
696
+ * grows linearly towards the [Self::max_execution_bonus_bps].
697
+ *
698
+ * Example: a value of `50` here means 50bps == 0.5% bonus for an "LTV > 65%" order, when
699
+ * executed precisely at the moment LTV exceeds 65%.
700
+ */
701
+ minExecutionBonusBps: number;
702
+ /**
703
+ * A *maximum* additional fraction of collateral transferred to the liquidator, in bps.
704
+ *
705
+ * The maximum bonus is applied at the relevant "extreme" state of the obligation, i.e.:
706
+ * - for a stop-loss condition, it is a point at which the obligation becomes liquidatable;
707
+ * - for a take-profit condition, it is a point at which obligation has 0% LTV.
708
+ *
709
+ * In non-extreme states, the actual bonus value is interpolated linearly, starting from
710
+ * [Self::min_execution_bonus_bps] (at the point specified by the order's condition).
711
+ *
712
+ * Example: a value of `300` here means 300bps == 3.0% bonus for a "debt/coll price > 140"
713
+ * order, when executed at a higher price = 200, at which the obligation's LTV happens to
714
+ * be equal to its liquidation LTV.
715
+ */
716
+ maxExecutionBonusBps: number;
717
+ /**
718
+ * Serialized [ConditionType].
719
+ * The entire order is void when this is zeroed (i.e. representing [ConditionType::Never]).
720
+ *
721
+ * Example: a value of `2` here denotes `UserLtvBelow` condition type. Of course, to
722
+ * interpret this condition, we also need to take the [Self::condition_threshold_sf] into
723
+ * account.
724
+ */
725
+ conditionType: number;
726
+ /**
727
+ * Serialized [OpportunityType].
728
+ *
729
+ * Example: a value of `0` here denotes `DeleverageSingleDebtAmount` opportunity. Of course, to
730
+ * interpret this opportunity, we also need to take the [Self::opportunity_parameter_sf] into
731
+ * account.
732
+ */
733
+ opportunityType: number;
734
+ /**
735
+ * Internal padding.
736
+ * The fields above take up 2+2+1+1 bytes = 48 bits, which means we need 80 bits = 10 bytes to
737
+ * align with `u128`s.
738
+ */
739
+ padding1: Array<number>;
740
+ /**
741
+ * End padding.
742
+ * The total size of a single instance is 8*u128 = 128 bytes.
743
+ */
744
+ padding2: Array<string>;
745
+ }
746
+
747
+ interface ObligationRaw {
748
+ /** Version of the struct */
749
+ tag: BN$1;
750
+ /** Last update to collateral, liquidity, or their market values */
751
+ lastUpdate: LastUpdateFields;
752
+ /** Lending market address */
753
+ lendingMarket: PublicKey;
754
+ /** Owner authority which can borrow liquidity */
755
+ owner: PublicKey;
756
+ /** Deposited collateral for the obligation, unique by deposit reserve address */
757
+ deposits: Array<ObligationCollateralFields>;
758
+ /** Worst LTV for the collaterals backing the loan, represented as a percentage */
759
+ lowestReserveDepositLiquidationLtv: BN$1;
760
+ /** Market value of deposits (scaled fraction) */
761
+ depositedValueSf: BN$1;
762
+ /** Borrowed liquidity for the obligation, unique by borrow reserve address */
763
+ borrows: Array<ObligationLiquidityFields>;
764
+ /** Risk adjusted market value of borrows/debt (sum of price * borrowed_amount * borrow_factor) (scaled fraction) */
765
+ borrowFactorAdjustedDebtValueSf: BN$1;
766
+ /** Market value of borrows - used for max_liquidatable_borrowed_amount (scaled fraction) */
767
+ borrowedAssetsMarketValueSf: BN$1;
768
+ /** The maximum borrow value at the weighted average loan to value ratio (scaled fraction) */
769
+ allowedBorrowValueSf: BN$1;
770
+ /** The dangerous borrow value at the weighted average liquidation threshold (scaled fraction) */
771
+ unhealthyBorrowValueSf: BN$1;
772
+ /** The asset tier of the deposits */
773
+ depositsAssetTiers: Array<number>;
774
+ /** The asset tier of the borrows */
775
+ borrowsAssetTiers: Array<number>;
776
+ /** The elevation group id the obligation opted into. */
777
+ elevationGroup: number;
778
+ /** The number of obsolete reserves the obligation has a deposit in */
779
+ numOfObsoleteDepositReserves: number;
780
+ /** Marked = 1 if borrows array is not empty, 0 = borrows empty */
781
+ hasDebt: number;
782
+ /** Wallet address of the referrer */
783
+ referrer: PublicKey;
784
+ /** Marked = 1 if borrowing disabled, 0 = borrowing enabled */
785
+ borrowingDisabled: number;
786
+ /**
787
+ * A target LTV set by the risk council when marking this obligation for deleveraging.
788
+ * Only effective when `deleveraging_margin_call_started_slot != 0`.
789
+ */
790
+ autodeleverageTargetLtvPct: number;
791
+ /** The lowest max LTV found amongst the collateral deposits */
792
+ lowestReserveDepositMaxLtvPct: number;
793
+ /** The number of obsolete reserves the obligation has a borrow in */
794
+ numOfObsoleteBorrowReserves: number;
795
+ reserved: Array<number>;
796
+ highestBorrowFactorPct: BN$1;
797
+ /**
798
+ * A timestamp at which the risk council most-recently marked this obligation for deleveraging.
799
+ * Zero if not currently subject to deleveraging.
800
+ */
801
+ autodeleverageMarginCallStartedTimestamp: BN$1;
802
+ /**
803
+ * Owner-defined, liquidator-executed orders applicable to this obligation.
804
+ * Typical use-cases would be a stop-loss and a take-profit (possibly co-existing).
805
+ */
806
+ orders: Array<ObligationOrderFields>;
807
+ padding3: Array<BN$1>;
808
+ }
809
+ interface ObligationCollateralFields {
810
+ /** Reserve collateral is deposited to */
811
+ depositReserve: PublicKey;
812
+ /** Amount of collateral deposited */
813
+ depositedAmount: BN$1;
814
+ /** Collateral market value in quote currency (scaled fraction) */
815
+ marketValueSf: BN$1;
816
+ /**
817
+ * Debt amount (lamport) taken against this collateral.
818
+ * (only meaningful if this obligation is part of an elevation group, otherwise 0)
819
+ * This is only indicative of the debt computed on the last refresh obligation.
820
+ * If the obligation have multiple collateral this value is the same for all of them.
821
+ */
822
+ borrowedAmountAgainstThisCollateralInElevationGroup: BN$1;
823
+ padding: Array<BN$1>;
824
+ }
825
+ interface ObligationLiquidityFields {
826
+ /** Reserve liquidity is borrowed from */
827
+ borrowReserve: PublicKey;
828
+ /** Borrow rate used for calculating interest (big scaled fraction) */
829
+ cumulativeBorrowRateBsf: BigFractionBytesFields;
830
+ padding: BN$1;
831
+ /** Amount of liquidity borrowed plus interest (scaled fraction) */
832
+ borrowedAmountSf: BN$1;
833
+ /** Liquidity market value in quote currency (scaled fraction) */
834
+ marketValueSf: BN$1;
835
+ /** Risk adjusted liquidity market value in quote currency - DEBUG ONLY - use market_value instead */
836
+ borrowFactorAdjustedMarketValueSf: BN$1;
837
+ /** Amount of liquidity borrowed outside of an elevation group */
838
+ borrowedAmountOutsideElevationGroups: BN$1;
839
+ padding2: Array<BN$1>;
840
+ }
841
+ interface ObligationOrderFields {
842
+ /**
843
+ * A threshold value used by the condition (scaled [Fraction]).
844
+ * The exact meaning depends on the specific [Self::condition_type].
845
+ *
846
+ * Examples:
847
+ * - when `condition_type == 2 (UserLtvBelow)`:
848
+ * then a value of `0.455` here means that the order is active only when the obligation's
849
+ * user LTV is less than `0.455` (i.e. < 45.5%).
850
+ * - when `condition_type == 3 (DebtCollPriceRatioAbove)`:
851
+ * assuming the obligation uses BTC collateral for SOL debt, then a value of `491.3` here
852
+ * means that the order is active only when the BTC-SOL price is greater than `491.3` (i.e.
853
+ * > 491.3 SOL per BTC).
854
+ */
855
+ conditionThresholdSf: BN$1;
856
+ /**
857
+ * A configuration parameter used by the opportunity (scaled [Fraction]).
858
+ * The exact meaning depends on the specific [Self::opportunity_type].
859
+ *
860
+ * Examples:
861
+ * - when `opportunity_type == 0 (DeleverageSingleDebtAmount)`:
862
+ * Assuming the obligation uses BTC collateral for SOL debt, then a value of `1_234_000_000`
863
+ * here means that a liquidator may repay up to 1234000000 lamports (i.e. 1.234 SOL) on this
864
+ * obligation.
865
+ * Note: the special value of [Fraction::MAX] is *not* allowed in this case.
866
+ * - when `opportunity_type == 1 (DeleverageAllDebtAmount)`:
867
+ * The only allowed value in this case is [Fraction::MAX] (to emphasize that *all* debt
868
+ * should be repaid).
869
+ */
870
+ opportunityParameterSf: BN$1;
871
+ /**
872
+ * A *minimum* additional fraction of collateral transferred to the liquidator, in bps.
873
+ *
874
+ * The minimum bonus is applied exactly when the [Self::condition_threshold_sf] is met, and
875
+ * grows linearly towards the [Self::max_execution_bonus_bps].
876
+ *
877
+ * Example: a value of `50` here means 50bps == 0.5% bonus for an "LTV > 65%" order, when
878
+ * executed precisely at the moment LTV exceeds 65%.
879
+ */
880
+ minExecutionBonusBps: number;
881
+ /**
882
+ * A *maximum* additional fraction of collateral transferred to the liquidator, in bps.
883
+ *
884
+ * The maximum bonus is applied at the relevant "extreme" state of the obligation, i.e.:
885
+ * - for a stop-loss condition, it is a point at which the obligation becomes liquidatable;
886
+ * - for a take-profit condition, it is a point at which obligation has 0% LTV.
887
+ *
888
+ * In non-extreme states, the actual bonus value is interpolated linearly, starting from
889
+ * [Self::min_execution_bonus_bps] (at the point specified by the order's condition).
890
+ *
891
+ * Example: a value of `300` here means 300bps == 3.0% bonus for a "debt/coll price > 140"
892
+ * order, when executed at a higher price = 200, at which the obligation's LTV happens to
893
+ * be equal to its liquidation LTV.
894
+ */
895
+ maxExecutionBonusBps: number;
896
+ /**
897
+ * Serialized [ConditionType].
898
+ * The entire order is void when this is zeroed (i.e. representing [ConditionType::Never]).
899
+ *
900
+ * Example: a value of `2` here denotes `UserLtvBelow` condition type. Of course, to
901
+ * interpret this condition, we also need to take the [Self::condition_threshold_sf] into
902
+ * account.
903
+ */
904
+ conditionType: number;
905
+ /**
906
+ * Serialized [OpportunityType].
907
+ *
908
+ * Example: a value of `0` here denotes `DeleverageSingleDebtAmount` opportunity. Of course, to
909
+ * interpret this opportunity, we also need to take the [Self::opportunity_parameter_sf] into
910
+ * account.
911
+ */
912
+ opportunityType: number;
913
+ /**
914
+ * Internal padding.
915
+ * The fields above take up 2+2+1+1 bytes = 48 bits, which means we need 80 bits = 10 bytes to
916
+ * align with `u128`s.
917
+ */
918
+ padding1: Array<number>;
919
+ /**
920
+ * End padding.
921
+ * The total size of a single instance is 8*u128 = 128 bytes.
922
+ */
923
+ padding2: Array<BN$1>;
924
+ }
925
+
926
+ interface FarmStateRaw {
927
+ farmAdmin: PublicKey;
928
+ globalConfig: PublicKey;
929
+ token: TokenInfoFields;
930
+ rewardInfos: Array<RewardInfoFields>;
931
+ numRewardTokens: BN$1;
932
+ /** Data used to calculate the rewards of the user */
933
+ numUsers: BN$1;
934
+ /**
935
+ * The number of token in the `farm_vault` staked (getting rewards and fees)
936
+ * Set such as `farm_vault.amount = total_staked_amount + total_pending_amount`
937
+ */
938
+ totalStakedAmount: BN$1;
939
+ farmVault: PublicKey;
940
+ farmVaultsAuthority: PublicKey;
941
+ farmVaultsAuthorityBump: BN$1;
942
+ /**
943
+ * Only used for delegate farms
944
+ * Set to `default()` otherwise
945
+ */
946
+ delegateAuthority: PublicKey;
947
+ /**
948
+ * Raw representation of a `TimeUnit`
949
+ * Seconds = 0, Slots = 1
950
+ */
951
+ timeUnit: number;
952
+ /**
953
+ * Automatically set to true in case of a full authority withdrawal
954
+ * If true, the farm is frozen and no more deposits are allowed
955
+ */
956
+ isFarmFrozen: number;
957
+ /**
958
+ * Indicates if the farm is a delegate farm
959
+ * If true, the farm is a delegate farm and the `delegate_authority` is set*
960
+ */
961
+ isFarmDelegated: number;
962
+ padding0: Array<number>;
963
+ /**
964
+ * Withdraw authority for the farm, allowed to lock deposited funds and withdraw them
965
+ * Set to `default()` if unused (only the depositors can withdraw their funds)
966
+ */
967
+ withdrawAuthority: PublicKey;
968
+ /**
969
+ * Delay between a user deposit and the moment it is considered as staked
970
+ * 0 if unused
971
+ */
972
+ depositWarmupPeriod: number;
973
+ /** Delay between a user unstake and the ability to withdraw his deposit. */
974
+ withdrawalCooldownPeriod: number;
975
+ /** Total active stake of tokens in the farm (scaled from `Decimal` representation). */
976
+ totalActiveStakeScaled: BN$1;
977
+ /**
978
+ * Total pending stake of tokens in the farm (scaled from `Decimal` representation).
979
+ * (can be used by `withdraw_authority` but don't get rewards or fees)
980
+ */
981
+ totalPendingStakeScaled: BN$1;
982
+ /** Total pending amount of tokens in the farm */
983
+ totalPendingAmount: BN$1;
984
+ /** Slashed amounts from early withdrawal */
985
+ slashedAmountCurrent: BN$1;
986
+ slashedAmountCumulative: BN$1;
987
+ slashedAmountSpillAddress: PublicKey;
988
+ /** Locking stake */
989
+ lockingMode: BN$1;
990
+ lockingStartTimestamp: BN$1;
991
+ lockingDuration: BN$1;
992
+ lockingEarlyWithdrawalPenaltyBps: BN$1;
993
+ depositCapAmount: BN$1;
994
+ scopePrices: PublicKey;
995
+ scopeOraclePriceId: BN$1;
996
+ scopeOracleMaxAge: BN$1;
997
+ pendingFarmAdmin: PublicKey;
998
+ strategyId: PublicKey;
999
+ delegatedRpsAdmin: PublicKey;
1000
+ vaultId: PublicKey;
1001
+ secondDelegatedAuthority: PublicKey;
1002
+ padding: Array<BN$1>;
1003
+ }
1004
+ interface TokenInfoFields {
1005
+ mint: PublicKey;
1006
+ decimals: BN$1;
1007
+ tokenProgram: PublicKey;
1008
+ padding: Array<BN$1>;
1009
+ }
1010
+ interface RewardInfoFields {
1011
+ token: TokenInfoFields;
1012
+ rewardsVault: PublicKey;
1013
+ rewardsAvailable: BN$1;
1014
+ rewardScheduleCurve: RewardScheduleCurveFields;
1015
+ minClaimDurationSeconds: BN$1;
1016
+ lastIssuanceTs: BN$1;
1017
+ rewardsIssuedUnclaimed: BN$1;
1018
+ rewardsIssuedCumulative: BN$1;
1019
+ rewardPerShareScaled: BN$1;
1020
+ placeholder0: BN$1;
1021
+ rewardType: number;
1022
+ rewardsPerSecondDecimals: number;
1023
+ padding0: Array<number>;
1024
+ padding1: Array<BN$1>;
1025
+ }
1026
+ interface RewardPerTimeUnitPointFields {
1027
+ tsStart: BN$1;
1028
+ rewardPerTimeUnit: BN$1;
1029
+ }
1030
+ interface RewardScheduleCurveFields {
1031
+ /**
1032
+ * This is a stepwise function, meaning that each point represents
1033
+ * how many rewards are issued per time unit since the beginning
1034
+ * of that point until the beginning of the next point.
1035
+ * This is not a linear curve, there is no interpolation going on.
1036
+ * A curve can be [[t0, 100], [t1, 50], [t2, 0]]
1037
+ * meaning that from t0 to t1, 100 rewards are issued per time unit,
1038
+ * from t1 to t2, 50 rewards are issued per time unit, and after t2 it stops
1039
+ * Another curve, can be [[t0, 100], [u64::max, 0]]
1040
+ * meaning that from t0 to u64::max, 100 rewards are issued per time unit
1041
+ */
1042
+ points: Array<RewardPerTimeUnitPointFields>;
1043
+ }
1044
+
1045
+ interface FarmStateJSON {
1046
+ farmAdmin: string;
1047
+ globalConfig: string;
1048
+ token: TokenInfoJSON;
1049
+ rewardInfos: Array<RewardInfoJSON>;
1050
+ numRewardTokens: string;
1051
+ /** Data used to calculate the rewards of the user */
1052
+ numUsers: string;
1053
+ /**
1054
+ * The number of token in the `farm_vault` staked (getting rewards and fees)
1055
+ * Set such as `farm_vault.amount = total_staked_amount + total_pending_amount`
1056
+ */
1057
+ totalStakedAmount: string;
1058
+ farmVault: string;
1059
+ farmVaultsAuthority: string;
1060
+ farmVaultsAuthorityBump: string;
1061
+ /**
1062
+ * Only used for delegate farms
1063
+ * Set to `default()` otherwise
1064
+ */
1065
+ delegateAuthority: string;
1066
+ /**
1067
+ * Raw representation of a `TimeUnit`
1068
+ * Seconds = 0, Slots = 1
1069
+ */
1070
+ timeUnit: number;
1071
+ /**
1072
+ * Automatically set to true in case of a full authority withdrawal
1073
+ * If true, the farm is frozen and no more deposits are allowed
1074
+ */
1075
+ isFarmFrozen: number;
1076
+ /**
1077
+ * Indicates if the farm is a delegate farm
1078
+ * If true, the farm is a delegate farm and the `delegate_authority` is set*
1079
+ */
1080
+ isFarmDelegated: number;
1081
+ padding0: Array<number>;
1082
+ /**
1083
+ * Withdraw authority for the farm, allowed to lock deposited funds and withdraw them
1084
+ * Set to `default()` if unused (only the depositors can withdraw their funds)
1085
+ */
1086
+ withdrawAuthority: string;
1087
+ /**
1088
+ * Delay between a user deposit and the moment it is considered as staked
1089
+ * 0 if unused
1090
+ */
1091
+ depositWarmupPeriod: number;
1092
+ /** Delay between a user unstake and the ability to withdraw his deposit. */
1093
+ withdrawalCooldownPeriod: number;
1094
+ /** Total active stake of tokens in the farm (scaled from `Decimal` representation). */
1095
+ totalActiveStakeScaled: string;
1096
+ /**
1097
+ * Total pending stake of tokens in the farm (scaled from `Decimal` representation).
1098
+ * (can be used by `withdraw_authority` but don't get rewards or fees)
1099
+ */
1100
+ totalPendingStakeScaled: string;
1101
+ /** Total pending amount of tokens in the farm */
1102
+ totalPendingAmount: string;
1103
+ /** Slashed amounts from early withdrawal */
1104
+ slashedAmountCurrent: string;
1105
+ slashedAmountCumulative: string;
1106
+ slashedAmountSpillAddress: string;
1107
+ /** Locking stake */
1108
+ lockingMode: string;
1109
+ lockingStartTimestamp: string;
1110
+ lockingDuration: string;
1111
+ lockingEarlyWithdrawalPenaltyBps: string;
1112
+ depositCapAmount: string;
1113
+ scopePrices: string;
1114
+ scopeOraclePriceId: string;
1115
+ scopeOracleMaxAge: string;
1116
+ pendingFarmAdmin: string;
1117
+ strategyId: string;
1118
+ delegatedRpsAdmin: string;
1119
+ vaultId: string;
1120
+ secondDelegatedAuthority: string;
1121
+ padding: Array<string>;
1122
+ }
1123
+ interface TokenInfoJSON {
1124
+ mint: string;
1125
+ decimals: string;
1126
+ tokenProgram: string;
1127
+ padding: Array<string>;
1128
+ }
1129
+ interface RewardInfoJSON {
1130
+ token: TokenInfoJSON;
1131
+ rewardsVault: string;
1132
+ rewardsAvailable: string;
1133
+ rewardScheduleCurve: RewardScheduleCurveJSON;
1134
+ minClaimDurationSeconds: string;
1135
+ lastIssuanceTs: string;
1136
+ rewardsIssuedUnclaimed: string;
1137
+ rewardsIssuedCumulative: string;
1138
+ rewardPerShareScaled: string;
1139
+ placeholder0: string;
1140
+ rewardType: number;
1141
+ rewardsPerSecondDecimals: number;
1142
+ padding0: Array<number>;
1143
+ padding1: Array<string>;
1144
+ }
1145
+ interface RewardScheduleCurveJSON {
1146
+ /**
1147
+ * This is a stepwise function, meaning that each point represents
1148
+ * how many rewards are issued per time unit since the beginning
1149
+ * of that point until the beginning of the next point.
1150
+ * This is not a linear curve, there is no interpolation going on.
1151
+ * A curve can be [[t0, 100], [t1, 50], [t2, 0]]
1152
+ * meaning that from t0 to t1, 100 rewards are issued per time unit,
1153
+ * from t1 to t2, 50 rewards are issued per time unit, and after t2 it stops
1154
+ * Another curve, can be [[t0, 100], [u64::max, 0]]
1155
+ * meaning that from t0 to u64::max, 100 rewards are issued per time unit
1156
+ */
1157
+ points: Array<RewardPerTimeUnitPointJSON>;
1158
+ }
1159
+ interface RewardPerTimeUnitPointJSON {
1160
+ tsStart: string;
1161
+ rewardPerTimeUnit: string;
1162
+ }
1163
+
1164
+ export { type RewardPerTimeUnitPointJSON as $, type PriceHeuristicJSON as A, type BorrowRateCurveFields as B, type CurvePointFields as C, type ScopeConfigurationJSON as D, type SwitchboardConfigurationJSON as E, type FeedResponse as F, type PythConfigurationJSON as G, type WithdrawalCapsJSON as H, type ObligationLiquidityJSON as I, type ObligationCollateralJSON as J, type ObligationOrderJSON as K, type ObligationCollateralFields as L, type ObligationLiquidityFields as M, type ObligationOrderFields as N, type ObligationRaw as O, type PullFeedAccountData as P, type LastUpdateFields as Q, type ReserveRaw as R, SWITCHBOARD_ONDEMANDE_PRICE_PRECISION as S, type TokenInfoFields$1 as T, type BigFractionBytesFields as U, type LastUpdateJSON as V, type WithdrawalCapsFields as W, type BigFractionBytesJSON as X, type RewardPerTimeUnitPointFields as Y, type RewardScheduleCurveFields as Z, type RewardScheduleCurveJSON as _, type FarmStateRaw as a, type ReserveJSON as b, type ObligationJSON as c, type FarmStateJSON as d, type RewardInfoFields as e, type CurrentResult as f, type OracleSubmission as g, type CrossbarSimulatePayload as h, getSwitchboardProgram as i, decodeSwitchboardPullFeedData as j, type ReserveLiquidityFields as k, type ReserveCollateralFields as l, type ReserveConfigFields as m, type ReserveFeesFields as n, type PriceHeuristicFields as o, type ScopeConfigurationFields as p, type SwitchboardConfigurationFields as q, type PythConfigurationFields as r, switchboardAccountCoder as s, type ReserveLiquidityJSON as t, type ReserveCollateralJSON as u, type ReserveConfigJSON as v, type ReserveFeesJSON as w, type BorrowRateCurveJSON as x, type CurvePointJSON as y, type TokenInfoJSON$1 as z };