@0dotxyz/p0-ts-sdk 1.0.0 → 1.1.0-alpha.1

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.
@@ -1,6 +1,6 @@
1
- import { BN, BorshCoder, Provider, Program } from '@coral-xyz/anchor';
1
+ import { BorshCoder, Provider, Program } from '@coral-xyz/anchor';
2
+ import BN from 'bn.js';
2
3
  import { PublicKey } from '@solana/web3.js';
3
- import BN$1 from 'bn.js';
4
4
 
5
5
  declare const SWITCHBOARD_ONDEMANDE_PRICE_PRECISION = 18;
6
6
  interface CurrentResult {
@@ -47,7 +47,7 @@ declare function decodeSwitchboardPullFeedData(data: Buffer): PullFeedAccountDat
47
47
 
48
48
  interface LastUpdateFields {
49
49
  /** Last slot when updated */
50
- slot: BN$1;
50
+ slot: BN;
51
51
  /** True when marked stale, false when slot updated */
52
52
  stale: number;
53
53
  /** Status of the prices used to calculate the last update */
@@ -55,8 +55,8 @@ interface LastUpdateFields {
55
55
  placeholder: Array<number>;
56
56
  }
57
57
  interface BigFractionBytesFields {
58
- value: Array<BN$1>;
59
- padding: Array<BN$1>;
58
+ value: Array<BN>;
59
+ padding: Array<BN>;
60
60
  }
61
61
 
62
62
  interface LastUpdateJSON {
@@ -75,7 +75,7 @@ interface BigFractionBytesJSON {
75
75
 
76
76
  interface ReserveRaw {
77
77
  /** Version of the reserve */
78
- version: BN$1;
78
+ version: BN;
79
79
  /** Last slot when supply and rates updated */
80
80
  lastUpdate: LastUpdateFields;
81
81
  /** Lending market address */
@@ -84,20 +84,20 @@ interface ReserveRaw {
84
84
  farmDebt: PublicKey;
85
85
  /** Reserve liquidity */
86
86
  liquidity: ReserveLiquidityFields;
87
- reserveLiquidityPadding: Array<BN$1>;
87
+ reserveLiquidityPadding: Array<BN>;
88
88
  /** Reserve collateral */
89
89
  collateral: ReserveCollateralFields;
90
- reserveCollateralPadding: Array<BN$1>;
90
+ reserveCollateralPadding: Array<BN>;
91
91
  /** Reserve configuration values */
92
92
  config: ReserveConfigFields;
93
- configPadding: Array<BN$1>;
94
- borrowedAmountOutsideElevationGroup: BN$1;
93
+ configPadding: Array<BN>;
94
+ borrowedAmountOutsideElevationGroup: BN;
95
95
  /**
96
96
  * Amount of token borrowed in lamport of debt asset in the given
97
97
  * elevation group when this reserve is part of the collaterals.
98
98
  */
99
- borrowedAmountsAgainstThisReserveInElevationGroups: Array<BN$1>;
100
- padding: Array<BN$1>;
99
+ borrowedAmountsAgainstThisReserveInElevationGroups: Array<BN>;
100
+ padding: Array<BN>;
101
101
  }
102
102
  interface ReserveLiquidityFields {
103
103
  /** Reserve liquidity mint address */
@@ -107,49 +107,49 @@ interface ReserveLiquidityFields {
107
107
  /** Reserve liquidity fee collection address */
108
108
  feeVault: PublicKey;
109
109
  /** Reserve liquidity available */
110
- availableAmount: BN$1;
110
+ availableAmount: BN;
111
111
  /** Reserve liquidity borrowed (scaled fraction) */
112
- borrowedAmountSf: BN$1;
112
+ borrowedAmountSf: BN;
113
113
  /** Reserve liquidity market price in quote currency (scaled fraction) */
114
- marketPriceSf: BN$1;
114
+ marketPriceSf: BN;
115
115
  /** Unix timestamp of the market price (from the oracle) */
116
- marketPriceLastUpdatedTs: BN$1;
116
+ marketPriceLastUpdatedTs: BN;
117
117
  /** Reserve liquidity mint decimals */
118
- mintDecimals: BN$1;
118
+ mintDecimals: BN;
119
119
  /**
120
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
121
  * If the threshold is not crossed, then the timestamp is set to 0
122
122
  */
123
- depositLimitCrossedTimestamp: BN$1;
123
+ depositLimitCrossedTimestamp: BN;
124
124
  /**
125
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
126
  * If the threshold is not crossed, then the timestamp is set to 0
127
127
  */
128
- borrowLimitCrossedTimestamp: BN$1;
128
+ borrowLimitCrossedTimestamp: BN;
129
129
  /** Reserve liquidity cumulative borrow rate (scaled fraction) */
130
130
  cumulativeBorrowRateBsf: BigFractionBytesFields;
131
131
  /** Reserve cumulative protocol fees (scaled fraction) */
132
- accumulatedProtocolFeesSf: BN$1;
132
+ accumulatedProtocolFeesSf: BN;
133
133
  /** Reserve cumulative referrer fees (scaled fraction) */
134
- accumulatedReferrerFeesSf: BN$1;
134
+ accumulatedReferrerFeesSf: BN;
135
135
  /** Reserve pending referrer fees, to be claimed in refresh_obligation by referrer or protocol (scaled fraction) */
136
- pendingReferrerFeesSf: BN$1;
136
+ pendingReferrerFeesSf: BN;
137
137
  /** Reserve referrer fee absolute rate calculated at each refresh_reserve operation (scaled fraction) */
138
- absoluteReferralRateSf: BN$1;
138
+ absoluteReferralRateSf: BN;
139
139
  /** Token program of the liquidity mint */
140
140
  tokenProgram: PublicKey;
141
- padding2: Array<BN$1>;
142
- padding3: Array<BN$1>;
141
+ padding2: Array<BN>;
142
+ padding3: Array<BN>;
143
143
  }
144
144
  interface ReserveCollateralFields {
145
145
  /** Reserve collateral mint address */
146
146
  mintPubkey: PublicKey;
147
147
  /** Reserve collateral mint supply, used for exchange rate */
148
- mintTotalSupply: BN$1;
148
+ mintTotalSupply: BN;
149
149
  /** Reserve collateral supply address */
150
150
  supplyVault: PublicKey;
151
- padding1: Array<BN$1>;
152
- padding2: Array<BN$1>;
151
+ padding1: Array<BN>;
152
+ padding2: Array<BN>;
153
153
  }
154
154
  interface ReserveConfigFields {
155
155
  /** Status of the reserve Active/Obsolete/Hidden */
@@ -189,22 +189,22 @@ interface ReserveConfigFields {
189
189
  * crossed.
190
190
  * Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case.
191
191
  */
192
- deleveragingMarginCallPeriodSecs: BN$1;
192
+ deleveragingMarginCallPeriodSecs: BN;
193
193
  /**
194
194
  * The rate at which the deleveraging threshold decreases, in bps per day.
195
195
  * Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case.
196
196
  */
197
- deleveragingThresholdDecreaseBpsPerDay: BN$1;
197
+ deleveragingThresholdDecreaseBpsPerDay: BN;
198
198
  /** Program owner fees assessed, separate from gains due to interest accrual */
199
199
  fees: ReserveFeesFields;
200
200
  /** Borrow rate curve based on utilization */
201
201
  borrowRateCurve: BorrowRateCurveFields;
202
202
  /** Borrow factor in percentage - used for risk adjustment */
203
- borrowFactorPct: BN$1;
203
+ borrowFactorPct: BN;
204
204
  /** Maximum deposit limit of liquidity in native units, u64::MAX for inf */
205
- depositLimit: BN$1;
205
+ depositLimit: BN;
206
206
  /** Maximum amount borrowed, u64::MAX for inf, 0 to disable borrows (protected deposits) */
207
- borrowLimit: BN$1;
207
+ borrowLimit: BN;
208
208
  /** Token id from TokenInfos struct */
209
209
  tokenInfo: TokenInfoFields$1;
210
210
  /** Deposit withdrawal caps - deposit & redeem */
@@ -229,19 +229,19 @@ interface ReserveConfigFields {
229
229
  * - u64::MAX for inf
230
230
  * - 0 to disable borrows outside elevation groups
231
231
  */
232
- borrowLimitOutsideElevationGroup: BN$1;
232
+ borrowLimitOutsideElevationGroup: BN;
233
233
  /**
234
234
  * Defines the maximum amount (in lamports of elevation group debt asset)
235
235
  * that can be borrowed when this reserve is used as collateral.
236
236
  * - u64::MAX for inf
237
237
  * - 0 to disable borrows in this elevation group (expected value for the debt asset)
238
238
  */
239
- borrowLimitAgainstThisCollateralInElevationGroup: Array<BN$1>;
239
+ borrowLimitAgainstThisCollateralInElevationGroup: Array<BN>;
240
240
  /**
241
241
  * The rate at which the deleveraging-related liquidation bonus increases, in bps per day.
242
242
  * Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case.
243
243
  */
244
- deleveragingBonusIncreaseBpsPerDay: BN$1;
244
+ deleveragingBonusIncreaseBpsPerDay: BN;
245
245
  }
246
246
  interface ReserveFeesFields {
247
247
  /**
@@ -252,12 +252,12 @@ interface ReserveFeesFields {
252
252
  * 0.01% (1 basis point) = 115292150460685
253
253
  * 0.00001% (Aave borrow fee) = 115292150461
254
254
  */
255
- borrowFeeSf: BN$1;
255
+ borrowFeeSf: BN;
256
256
  /**
257
257
  * Fee for flash loan, expressed as scaled fraction.
258
258
  * 0.3% (Aave flash loan fee) = 0.003 * 2^60 = 3458764513820541
259
259
  */
260
- flashLoanFeeSf: BN$1;
260
+ flashLoanFeeSf: BN;
261
261
  /** Used for allignment */
262
262
  padding: Array<number>;
263
263
  }
@@ -274,9 +274,9 @@ interface TokenInfoFields$1 {
274
274
  /** Heuristics limits of acceptable price */
275
275
  heuristic: PriceHeuristicFields;
276
276
  /** Max divergence between twap and price in bps */
277
- maxTwapDivergenceBps: BN$1;
278
- maxAgePriceSeconds: BN$1;
279
- maxAgeTwapSeconds: BN$1;
277
+ maxTwapDivergenceBps: BN;
278
+ maxAgePriceSeconds: BN;
279
+ maxAgeTwapSeconds: BN;
280
280
  /** Scope price configuration */
281
281
  scopeConfiguration: ScopeConfigurationFields;
282
282
  /** Switchboard configuration */
@@ -285,15 +285,15 @@ interface TokenInfoFields$1 {
285
285
  pythConfiguration: PythConfigurationFields;
286
286
  blockPriceUsage: number;
287
287
  reserved: Array<number>;
288
- padding: Array<BN$1>;
288
+ padding: Array<BN>;
289
289
  }
290
290
  interface PriceHeuristicFields {
291
291
  /** Lower value of acceptable price */
292
- lower: BN$1;
292
+ lower: BN;
293
293
  /** Upper value of acceptable price */
294
- upper: BN$1;
294
+ upper: BN;
295
295
  /** Number of decimals of the previously defined values */
296
- exp: BN$1;
296
+ exp: BN;
297
297
  }
298
298
  interface ScopeConfigurationFields {
299
299
  /** Pubkey of the scope price feed (disabled if `null` or `default`) */
@@ -313,10 +313,10 @@ interface PythConfigurationFields {
313
313
  price: PublicKey;
314
314
  }
315
315
  interface WithdrawalCapsFields {
316
- configCapacity: BN$1;
317
- currentTotal: BN$1;
318
- lastIntervalStartTimestamp: BN$1;
319
- configIntervalLengthSeconds: BN$1;
316
+ configCapacity: BN;
317
+ currentTotal: BN;
318
+ lastIntervalStartTimestamp: BN;
319
+ configIntervalLengthSeconds: BN;
320
320
  }
321
321
 
322
322
  interface ReserveJSON {
@@ -746,7 +746,7 @@ interface ObligationOrderJSON {
746
746
 
747
747
  interface ObligationRaw {
748
748
  /** Version of the struct */
749
- tag: BN$1;
749
+ tag: BN;
750
750
  /** Last update to collateral, liquidity, or their market values */
751
751
  lastUpdate: LastUpdateFields;
752
752
  /** Lending market address */
@@ -756,19 +756,19 @@ interface ObligationRaw {
756
756
  /** Deposited collateral for the obligation, unique by deposit reserve address */
757
757
  deposits: Array<ObligationCollateralFields>;
758
758
  /** Worst LTV for the collaterals backing the loan, represented as a percentage */
759
- lowestReserveDepositLiquidationLtv: BN$1;
759
+ lowestReserveDepositLiquidationLtv: BN;
760
760
  /** Market value of deposits (scaled fraction) */
761
- depositedValueSf: BN$1;
761
+ depositedValueSf: BN;
762
762
  /** Borrowed liquidity for the obligation, unique by borrow reserve address */
763
763
  borrows: Array<ObligationLiquidityFields>;
764
764
  /** Risk adjusted market value of borrows/debt (sum of price * borrowed_amount * borrow_factor) (scaled fraction) */
765
- borrowFactorAdjustedDebtValueSf: BN$1;
765
+ borrowFactorAdjustedDebtValueSf: BN;
766
766
  /** Market value of borrows - used for max_liquidatable_borrowed_amount (scaled fraction) */
767
- borrowedAssetsMarketValueSf: BN$1;
767
+ borrowedAssetsMarketValueSf: BN;
768
768
  /** The maximum borrow value at the weighted average loan to value ratio (scaled fraction) */
769
- allowedBorrowValueSf: BN$1;
769
+ allowedBorrowValueSf: BN;
770
770
  /** The dangerous borrow value at the weighted average liquidation threshold (scaled fraction) */
771
- unhealthyBorrowValueSf: BN$1;
771
+ unhealthyBorrowValueSf: BN;
772
772
  /** The asset tier of the deposits */
773
773
  depositsAssetTiers: Array<number>;
774
774
  /** The asset tier of the borrows */
@@ -793,50 +793,50 @@ interface ObligationRaw {
793
793
  /** The number of obsolete reserves the obligation has a borrow in */
794
794
  numOfObsoleteBorrowReserves: number;
795
795
  reserved: Array<number>;
796
- highestBorrowFactorPct: BN$1;
796
+ highestBorrowFactorPct: BN;
797
797
  /**
798
798
  * A timestamp at which the risk council most-recently marked this obligation for deleveraging.
799
799
  * Zero if not currently subject to deleveraging.
800
800
  */
801
- autodeleverageMarginCallStartedTimestamp: BN$1;
801
+ autodeleverageMarginCallStartedTimestamp: BN;
802
802
  /**
803
803
  * Owner-defined, liquidator-executed orders applicable to this obligation.
804
804
  * Typical use-cases would be a stop-loss and a take-profit (possibly co-existing).
805
805
  */
806
806
  orders: Array<ObligationOrderFields>;
807
- padding3: Array<BN$1>;
807
+ padding3: Array<BN>;
808
808
  }
809
809
  interface ObligationCollateralFields {
810
810
  /** Reserve collateral is deposited to */
811
811
  depositReserve: PublicKey;
812
812
  /** Amount of collateral deposited */
813
- depositedAmount: BN$1;
813
+ depositedAmount: BN;
814
814
  /** Collateral market value in quote currency (scaled fraction) */
815
- marketValueSf: BN$1;
815
+ marketValueSf: BN;
816
816
  /**
817
817
  * Debt amount (lamport) taken against this collateral.
818
818
  * (only meaningful if this obligation is part of an elevation group, otherwise 0)
819
819
  * This is only indicative of the debt computed on the last refresh obligation.
820
820
  * If the obligation have multiple collateral this value is the same for all of them.
821
821
  */
822
- borrowedAmountAgainstThisCollateralInElevationGroup: BN$1;
823
- padding: Array<BN$1>;
822
+ borrowedAmountAgainstThisCollateralInElevationGroup: BN;
823
+ padding: Array<BN>;
824
824
  }
825
825
  interface ObligationLiquidityFields {
826
826
  /** Reserve liquidity is borrowed from */
827
827
  borrowReserve: PublicKey;
828
828
  /** Borrow rate used for calculating interest (big scaled fraction) */
829
829
  cumulativeBorrowRateBsf: BigFractionBytesFields;
830
- padding: BN$1;
830
+ padding: BN;
831
831
  /** Amount of liquidity borrowed plus interest (scaled fraction) */
832
- borrowedAmountSf: BN$1;
832
+ borrowedAmountSf: BN;
833
833
  /** Liquidity market value in quote currency (scaled fraction) */
834
- marketValueSf: BN$1;
834
+ marketValueSf: BN;
835
835
  /** Risk adjusted liquidity market value in quote currency - DEBUG ONLY - use market_value instead */
836
- borrowFactorAdjustedMarketValueSf: BN$1;
836
+ borrowFactorAdjustedMarketValueSf: BN;
837
837
  /** Amount of liquidity borrowed outside of an elevation group */
838
- borrowedAmountOutsideElevationGroups: BN$1;
839
- padding2: Array<BN$1>;
838
+ borrowedAmountOutsideElevationGroups: BN;
839
+ padding2: Array<BN>;
840
840
  }
841
841
  interface ObligationOrderFields {
842
842
  /**
@@ -852,7 +852,7 @@ interface ObligationOrderFields {
852
852
  * means that the order is active only when the BTC-SOL price is greater than `491.3` (i.e.
853
853
  * > 491.3 SOL per BTC).
854
854
  */
855
- conditionThresholdSf: BN$1;
855
+ conditionThresholdSf: BN;
856
856
  /**
857
857
  * A configuration parameter used by the opportunity (scaled [Fraction]).
858
858
  * The exact meaning depends on the specific [Self::opportunity_type].
@@ -867,7 +867,7 @@ interface ObligationOrderFields {
867
867
  * The only allowed value in this case is [Fraction::MAX] (to emphasize that *all* debt
868
868
  * should be repaid).
869
869
  */
870
- opportunityParameterSf: BN$1;
870
+ opportunityParameterSf: BN;
871
871
  /**
872
872
  * A *minimum* additional fraction of collateral transferred to the liquidator, in bps.
873
873
  *
@@ -920,7 +920,7 @@ interface ObligationOrderFields {
920
920
  * End padding.
921
921
  * The total size of a single instance is 8*u128 = 128 bytes.
922
922
  */
923
- padding2: Array<BN$1>;
923
+ padding2: Array<BN>;
924
924
  }
925
925
 
926
926
  interface FarmStateRaw {
@@ -928,17 +928,17 @@ interface FarmStateRaw {
928
928
  globalConfig: PublicKey;
929
929
  token: TokenInfoFields;
930
930
  rewardInfos: Array<RewardInfoFields>;
931
- numRewardTokens: BN$1;
931
+ numRewardTokens: BN;
932
932
  /** Data used to calculate the rewards of the user */
933
- numUsers: BN$1;
933
+ numUsers: BN;
934
934
  /**
935
935
  * The number of token in the `farm_vault` staked (getting rewards and fees)
936
936
  * Set such as `farm_vault.amount = total_staked_amount + total_pending_amount`
937
937
  */
938
- totalStakedAmount: BN$1;
938
+ totalStakedAmount: BN;
939
939
  farmVault: PublicKey;
940
940
  farmVaultsAuthority: PublicKey;
941
- farmVaultsAuthorityBump: BN$1;
941
+ farmVaultsAuthorityBump: BN;
942
942
  /**
943
943
  * Only used for delegate farms
944
944
  * Set to `default()` otherwise
@@ -973,59 +973,59 @@ interface FarmStateRaw {
973
973
  /** Delay between a user unstake and the ability to withdraw his deposit. */
974
974
  withdrawalCooldownPeriod: number;
975
975
  /** Total active stake of tokens in the farm (scaled from `Decimal` representation). */
976
- totalActiveStakeScaled: BN$1;
976
+ totalActiveStakeScaled: BN;
977
977
  /**
978
978
  * Total pending stake of tokens in the farm (scaled from `Decimal` representation).
979
979
  * (can be used by `withdraw_authority` but don't get rewards or fees)
980
980
  */
981
- totalPendingStakeScaled: BN$1;
981
+ totalPendingStakeScaled: BN;
982
982
  /** Total pending amount of tokens in the farm */
983
- totalPendingAmount: BN$1;
983
+ totalPendingAmount: BN;
984
984
  /** Slashed amounts from early withdrawal */
985
- slashedAmountCurrent: BN$1;
986
- slashedAmountCumulative: BN$1;
985
+ slashedAmountCurrent: BN;
986
+ slashedAmountCumulative: BN;
987
987
  slashedAmountSpillAddress: PublicKey;
988
988
  /** Locking stake */
989
- lockingMode: BN$1;
990
- lockingStartTimestamp: BN$1;
991
- lockingDuration: BN$1;
992
- lockingEarlyWithdrawalPenaltyBps: BN$1;
993
- depositCapAmount: BN$1;
989
+ lockingMode: BN;
990
+ lockingStartTimestamp: BN;
991
+ lockingDuration: BN;
992
+ lockingEarlyWithdrawalPenaltyBps: BN;
993
+ depositCapAmount: BN;
994
994
  scopePrices: PublicKey;
995
- scopeOraclePriceId: BN$1;
996
- scopeOracleMaxAge: BN$1;
995
+ scopeOraclePriceId: BN;
996
+ scopeOracleMaxAge: BN;
997
997
  pendingFarmAdmin: PublicKey;
998
998
  strategyId: PublicKey;
999
999
  delegatedRpsAdmin: PublicKey;
1000
1000
  vaultId: PublicKey;
1001
1001
  secondDelegatedAuthority: PublicKey;
1002
- padding: Array<BN$1>;
1002
+ padding: Array<BN>;
1003
1003
  }
1004
1004
  interface TokenInfoFields {
1005
1005
  mint: PublicKey;
1006
- decimals: BN$1;
1006
+ decimals: BN;
1007
1007
  tokenProgram: PublicKey;
1008
- padding: Array<BN$1>;
1008
+ padding: Array<BN>;
1009
1009
  }
1010
1010
  interface RewardInfoFields {
1011
1011
  token: TokenInfoFields;
1012
1012
  rewardsVault: PublicKey;
1013
- rewardsAvailable: BN$1;
1013
+ rewardsAvailable: BN;
1014
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;
1015
+ minClaimDurationSeconds: BN;
1016
+ lastIssuanceTs: BN;
1017
+ rewardsIssuedUnclaimed: BN;
1018
+ rewardsIssuedCumulative: BN;
1019
+ rewardPerShareScaled: BN;
1020
+ placeholder0: BN;
1021
1021
  rewardType: number;
1022
1022
  rewardsPerSecondDecimals: number;
1023
1023
  padding0: Array<number>;
1024
- padding1: Array<BN$1>;
1024
+ padding1: Array<BN>;
1025
1025
  }
1026
1026
  interface RewardPerTimeUnitPointFields {
1027
- tsStart: BN$1;
1028
- rewardPerTimeUnit: BN$1;
1027
+ tsStart: BN;
1028
+ rewardPerTimeUnit: BN;
1029
1029
  }
1030
1030
  interface RewardScheduleCurveFields {
1031
1031
  /**
@@ -1161,4 +1161,445 @@ interface RewardPerTimeUnitPointJSON {
1161
1161
  rewardPerTimeUnit: string;
1162
1162
  }
1163
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 };
1164
+ interface DriftUserStatsJSON {
1165
+ /** The authority for all of a users sub accounts */
1166
+ authority: string;
1167
+ /** The address that referred this user */
1168
+ referrer: string;
1169
+ /** Stats on the fees paid by the user */
1170
+ fees: UserFeesJSON;
1171
+ /**
1172
+ * The timestamp of the next epoch
1173
+ * Epoch is used to limit referrer rewards earned in single epoch
1174
+ */
1175
+ nextEpochTs: string;
1176
+ /**
1177
+ * Rolling 30day maker volume for user
1178
+ * precision: QUOTE_PRECISION
1179
+ */
1180
+ makerVolume30d: string;
1181
+ /**
1182
+ * Rolling 30day taker volume for user
1183
+ * precision: QUOTE_PRECISION
1184
+ */
1185
+ takerVolume30d: string;
1186
+ /**
1187
+ * Rolling 30day filler volume for user
1188
+ * precision: QUOTE_PRECISION
1189
+ */
1190
+ fillerVolume30d: string;
1191
+ /** last time the maker volume was updated */
1192
+ lastMakerVolume30dTs: string;
1193
+ /** last time the taker volume was updated */
1194
+ lastTakerVolume30dTs: string;
1195
+ /** last time the filler volume was updated */
1196
+ lastFillerVolume30dTs: string;
1197
+ /** The amount of tokens staked in the quote spot markets if */
1198
+ ifStakedQuoteAssetAmount: string;
1199
+ /** The current number of sub accounts */
1200
+ numberOfSubAccounts: number;
1201
+ /**
1202
+ * The number of sub accounts created. Can be greater than the number of sub accounts if user
1203
+ * has deleted sub accounts
1204
+ */
1205
+ numberOfSubAccountsCreated: number;
1206
+ /**
1207
+ * Flags for referrer status:
1208
+ * First bit (LSB): 1 if user is a referrer, 0 otherwise
1209
+ * Second bit: 1 if user was referred, 0 otherwise
1210
+ */
1211
+ referrerStatus: number;
1212
+ disableUpdatePerpBidAskTwap: boolean;
1213
+ padding1: Array<number>;
1214
+ /** whether the user has a FuelOverflow account */
1215
+ fuelOverflowStatus: number;
1216
+ /** accumulated fuel for token amounts of insurance */
1217
+ fuelInsurance: number;
1218
+ /** accumulated fuel for notional of deposits */
1219
+ fuelDeposits: number;
1220
+ /** accumulate fuel bonus for notional of borrows */
1221
+ fuelBorrows: number;
1222
+ /** accumulated fuel for perp open interest */
1223
+ fuelPositions: number;
1224
+ /** accumulate fuel bonus for taker volume */
1225
+ fuelTaker: number;
1226
+ /** accumulate fuel bonus for maker volume */
1227
+ fuelMaker: number;
1228
+ /** The amount of tokens staked in the governance spot markets if */
1229
+ ifStakedGovTokenAmount: string;
1230
+ /**
1231
+ * last unix ts user stats data was used to update if fuel (u32 to save space)
1232
+ */
1233
+ lastFuelIfBonusUpdateTs: number;
1234
+ padding: Array<number>;
1235
+ }
1236
+ interface UserFeesJSON {
1237
+ /**
1238
+ * Total taker fee paid
1239
+ * precision: QUOTE_PRECISION
1240
+ */
1241
+ totalFeePaid: string;
1242
+ /**
1243
+ * Total maker fee rebate
1244
+ * precision: QUOTE_PRECISION
1245
+ */
1246
+ totalFeeRebate: string;
1247
+ /**
1248
+ * Total discount from holding token
1249
+ * precision: QUOTE_PRECISION
1250
+ */
1251
+ totalTokenDiscount: string;
1252
+ /**
1253
+ * Total discount from being referred
1254
+ * precision: QUOTE_PRECISION
1255
+ */
1256
+ totalRefereeDiscount: string;
1257
+ /**
1258
+ * Total reward to referrer
1259
+ * precision: QUOTE_PRECISION
1260
+ */
1261
+ totalReferrerReward: string;
1262
+ /**
1263
+ * Total reward to referrer this epoch
1264
+ * precision: QUOTE_PRECISION
1265
+ */
1266
+ currentEpochReferrerReward: string;
1267
+ }
1268
+
1269
+ interface DriftUserStats {
1270
+ authority: PublicKey;
1271
+ referrer: PublicKey;
1272
+ fees: UserFeesFields;
1273
+ nextEpochTs: BN;
1274
+ makerVolume30d: BN;
1275
+ takerVolume30d: BN;
1276
+ fillerVolume30d: BN;
1277
+ lastMakerVolume30dTs: BN;
1278
+ lastTakerVolume30dTs: BN;
1279
+ lastFillerVolume30dTs: BN;
1280
+ ifStakedQuoteAssetAmount: BN;
1281
+ numberOfSubAccounts: number;
1282
+ numberOfSubAccountsCreated: number;
1283
+ referrerStatus: number;
1284
+ disableUpdatePerpBidAskTwap: boolean;
1285
+ padding1: Array<number>;
1286
+ fuelOverflowStatus: number;
1287
+ fuelInsurance: number;
1288
+ fuelDeposits: number;
1289
+ fuelBorrows: number;
1290
+ fuelPositions: number;
1291
+ fuelTaker: number;
1292
+ fuelMaker: number;
1293
+ ifStakedGovTokenAmount: BN;
1294
+ lastFuelIfBonusUpdateTs: number;
1295
+ padding: Array<number>;
1296
+ }
1297
+ interface UserFeesFields {
1298
+ totalFeePaid: BN;
1299
+ totalFeeRebate: BN;
1300
+ totalTokenDiscount: BN;
1301
+ totalRefereeDiscount: BN;
1302
+ totalReferrerReward: BN;
1303
+ currentEpochReferrerReward: BN;
1304
+ }
1305
+
1306
+ interface DriftSpotMarketJSON {
1307
+ pubkey: string;
1308
+ oracle: string;
1309
+ mint: string;
1310
+ decimals: number;
1311
+ cumulativeDepositInterest: string;
1312
+ marketIndex: number;
1313
+ depositBalance: string;
1314
+ borrowBalance: string;
1315
+ cumulativeBorrowInterest: string;
1316
+ optimalUtilization: number;
1317
+ optimalBorrowRate: number;
1318
+ maxBorrowRate: number;
1319
+ minBorrowRate: number;
1320
+ insuranceFund: {
1321
+ totalFactor: number;
1322
+ };
1323
+ }
1324
+
1325
+ interface FeeStructure {
1326
+ feeTiers: Array<FeeTier>;
1327
+ fillerRewardStructure: OrderFillerRewardStructure;
1328
+ referrerRewardEpochUpperBound: BN;
1329
+ flatFillerFee: BN;
1330
+ }
1331
+ interface FeeStructureJSON {
1332
+ feeTiers: Array<FeeTierJSON>;
1333
+ fillerRewardStructure: OrderFillerRewardStructureJSON;
1334
+ referrerRewardEpochUpperBound: string;
1335
+ flatFillerFee: string;
1336
+ }
1337
+ interface FeeTier {
1338
+ feeNumerator: number;
1339
+ feeDenominator: number;
1340
+ makerRebateNumerator: number;
1341
+ makerRebateDenominator: number;
1342
+ referrerRewardNumerator: number;
1343
+ referrerRewardDenominator: number;
1344
+ refereeFeeNumerator: number;
1345
+ refereeFeeDenominator: number;
1346
+ }
1347
+ interface FeeTierJSON {
1348
+ feeNumerator: number;
1349
+ feeDenominator: number;
1350
+ makerRebateNumerator: number;
1351
+ makerRebateDenominator: number;
1352
+ referrerRewardNumerator: number;
1353
+ referrerRewardDenominator: number;
1354
+ refereeFeeNumerator: number;
1355
+ refereeFeeDenominator: number;
1356
+ }
1357
+ interface OrderFillerRewardStructure {
1358
+ rewardNumerator: number;
1359
+ rewardDenominator: number;
1360
+ timeBasedRewardLowerBound: BN;
1361
+ }
1362
+ interface OrderFillerRewardStructureJSON {
1363
+ rewardNumerator: number;
1364
+ rewardDenominator: number;
1365
+ timeBasedRewardLowerBound: string;
1366
+ }
1367
+ interface OracleGuardRails {
1368
+ priceDivergence: PriceDivergenceGuardRails;
1369
+ validity: ValidityGuardRails;
1370
+ }
1371
+ interface OracleGuardRailsJSON {
1372
+ priceDivergence: PriceDivergenceGuardRailsJSON;
1373
+ validity: ValidityGuardRailsJSON;
1374
+ }
1375
+ interface PriceDivergenceGuardRails {
1376
+ markOraclePercentDivergence: BN;
1377
+ oracleTwap5minPercentDivergence: BN;
1378
+ }
1379
+ interface PriceDivergenceGuardRailsJSON {
1380
+ markOraclePercentDivergence: string;
1381
+ oracleTwap5minPercentDivergence: string;
1382
+ }
1383
+ interface ValidityGuardRails {
1384
+ slotsBeforeStaleForAmm: BN;
1385
+ slotsBeforeStaleForMargin: BN;
1386
+ confidenceIntervalMaxSize: BN;
1387
+ tooVolatileRatio: BN;
1388
+ }
1389
+ interface ValidityGuardRailsJSON {
1390
+ slotsBeforeStaleForAmm: string;
1391
+ slotsBeforeStaleForMargin: string;
1392
+ confidenceIntervalMaxSize: string;
1393
+ tooVolatileRatio: string;
1394
+ }
1395
+ interface HistoricalOracleData {
1396
+ /** precision: PRICE_PRECISION */
1397
+ lastOraclePrice: BN;
1398
+ /** precision: PRICE_PRECISION */
1399
+ lastOracleConf: BN;
1400
+ /** number of slots since last update */
1401
+ lastOracleDelay: BN;
1402
+ /** precision: PRICE_PRECISION */
1403
+ lastOraclePriceTwap: BN;
1404
+ /** precision: PRICE_PRECISION */
1405
+ lastOraclePriceTwap5min: BN;
1406
+ /** unix_timestamp of last snapshot */
1407
+ lastOraclePriceTwapTs: BN;
1408
+ }
1409
+ interface HistoricalOracleDataJSON {
1410
+ /** precision: PRICE_PRECISION */
1411
+ lastOraclePrice: string;
1412
+ /** precision: PRICE_PRECISION */
1413
+ lastOracleConf: string;
1414
+ /** number of slots since last update */
1415
+ lastOracleDelay: string;
1416
+ /** precision: PRICE_PRECISION */
1417
+ lastOraclePriceTwap: string;
1418
+ /** precision: PRICE_PRECISION */
1419
+ lastOraclePriceTwap5min: string;
1420
+ /** unix_timestamp of last snapshot */
1421
+ lastOraclePriceTwapTs: string;
1422
+ }
1423
+ interface HistoricalIndexData {
1424
+ /** precision: PRICE_PRECISION */
1425
+ lastIndexBidPrice: BN;
1426
+ /** precision: PRICE_PRECISION */
1427
+ lastIndexAskPrice: BN;
1428
+ /** precision: PRICE_PRECISION */
1429
+ lastIndexPriceTwap: BN;
1430
+ /** precision: PRICE_PRECISION */
1431
+ lastIndexPriceTwap5min: BN;
1432
+ /** unix_timestamp of last snapshot */
1433
+ lastIndexPriceTwapTs: BN;
1434
+ }
1435
+ interface HistoricalIndexDataJSON {
1436
+ /** precision: PRICE_PRECISION */
1437
+ lastIndexBidPrice: string;
1438
+ /** precision: PRICE_PRECISION */
1439
+ lastIndexAskPrice: string;
1440
+ /** precision: PRICE_PRECISION */
1441
+ lastIndexPriceTwap: string;
1442
+ /** precision: PRICE_PRECISION */
1443
+ lastIndexPriceTwap5min: string;
1444
+ /** unix_timestamp of last snapshot */
1445
+ lastIndexPriceTwapTs: string;
1446
+ }
1447
+ interface PoolBalance {
1448
+ /**
1449
+ * To get the pool's token amount, you must multiply the scaled balance by the market's cumulative
1450
+ * deposit interest
1451
+ * precision: SPOT_BALANCE_PRECISION
1452
+ */
1453
+ scaledBalance: BN;
1454
+ /** The spot market the pool is for */
1455
+ marketIndex: number;
1456
+ padding: Array<number>;
1457
+ }
1458
+ interface PoolBalanceJSON {
1459
+ /**
1460
+ * To get the pool's token amount, you must multiply the scaled balance by the market's cumulative
1461
+ * deposit interest
1462
+ * precision: SPOT_BALANCE_PRECISION
1463
+ */
1464
+ scaledBalance: string;
1465
+ /** The spot market the pool is for */
1466
+ marketIndex: number;
1467
+ padding: Array<number>;
1468
+ }
1469
+ interface InsuranceFund {
1470
+ vault: PublicKey;
1471
+ totalShares: BN;
1472
+ userShares: BN;
1473
+ sharesBase: BN;
1474
+ unstakingPeriod: BN;
1475
+ lastRevenueSettleTs: BN;
1476
+ revenueSettlePeriod: BN;
1477
+ totalFactor: number;
1478
+ userFactor: number;
1479
+ }
1480
+ interface InsuranceFundJSON {
1481
+ vault: string;
1482
+ totalShares: string;
1483
+ userShares: string;
1484
+ sharesBase: string;
1485
+ unstakingPeriod: string;
1486
+ lastRevenueSettleTs: string;
1487
+ revenueSettlePeriod: string;
1488
+ totalFactor: number;
1489
+ userFactor: number;
1490
+ }
1491
+ declare enum SpotBalanceType {
1492
+ Deposit = "Deposit",
1493
+ Borrow = "Borrow"
1494
+ }
1495
+ interface SpotPosition {
1496
+ /**
1497
+ * The scaled balance of the position. To get the token amount, multiply by the cumulative deposit/borrow
1498
+ * interest of corresponding market.
1499
+ * precision: SPOT_BALANCE_PRECISION
1500
+ */
1501
+ scaledBalance: BN;
1502
+ /**
1503
+ * How many spot bids the user has open
1504
+ * precision: token mint precision
1505
+ */
1506
+ openBids: BN;
1507
+ /**
1508
+ * How many spot asks the user has open
1509
+ * precision: token mint precision
1510
+ */
1511
+ openAsks: BN;
1512
+ /**
1513
+ * The cumulative deposits/borrows a user has made into a market
1514
+ * precision: token mint precision
1515
+ */
1516
+ cumulativeDeposits: BN;
1517
+ /** The market index of the corresponding spot market */
1518
+ marketIndex: number;
1519
+ /** Whether the position is deposit or borrow */
1520
+ balanceType: SpotBalanceType;
1521
+ /** Number of open orders */
1522
+ openOrders: number;
1523
+ padding: Array<number>;
1524
+ }
1525
+ interface SpotPositionJSON {
1526
+ /**
1527
+ * The scaled balance of the position. To get the token amount, multiply by the cumulative deposit/borrow
1528
+ * interest of corresponding market.
1529
+ * precision: SPOT_BALANCE_PRECISION
1530
+ */
1531
+ scaledBalance: string;
1532
+ /**
1533
+ * How many spot bids the user has open
1534
+ * precision: token mint precision
1535
+ */
1536
+ openBids: string;
1537
+ /**
1538
+ * How many spot asks the user has open
1539
+ * precision: token mint precision
1540
+ */
1541
+ openAsks: string;
1542
+ /**
1543
+ * The cumulative deposits/borrows a user has made into a market
1544
+ * precision: token mint precision
1545
+ */
1546
+ cumulativeDeposits: string;
1547
+ /** The market index of the corresponding spot market */
1548
+ marketIndex: number;
1549
+ /** Whether the position is deposit or borrow */
1550
+ balanceType: SpotBalanceType;
1551
+ /** Number of open orders */
1552
+ openOrders: number;
1553
+ padding: Array<number>;
1554
+ }
1555
+
1556
+ interface DriftSpotMarket {
1557
+ pubkey: PublicKey;
1558
+ oracle: PublicKey;
1559
+ mint: PublicKey;
1560
+ decimals: number;
1561
+ cumulativeDepositInterest: BN;
1562
+ marketIndex: number;
1563
+ depositBalance: BN;
1564
+ borrowBalance: BN;
1565
+ cumulativeBorrowInterest: BN;
1566
+ optimalUtilization: number;
1567
+ optimalBorrowRate: number;
1568
+ maxBorrowRate: number;
1569
+ minBorrowRate: number;
1570
+ insuranceFund: {
1571
+ totalFactor: number;
1572
+ };
1573
+ }
1574
+ declare enum DriftSpotBalanceType {
1575
+ DEPOSIT = "deposit",
1576
+ BORROW = "borrow"
1577
+ }
1578
+ declare function isSpotBalanceTypeVariant(value: DriftSpotBalanceType, variant: "deposit" | "borrow"): boolean;
1579
+
1580
+ interface DriftUserJSON {
1581
+ authority: string;
1582
+ spotPositions: Array<SpotPositionJSON>;
1583
+ }
1584
+
1585
+ interface DriftUser {
1586
+ authority: PublicKey;
1587
+ spotPositions: Array<SpotPosition>;
1588
+ }
1589
+
1590
+ type DriftRewards = {
1591
+ oracle: PublicKey;
1592
+ marketIndex: number;
1593
+ spotMarket: PublicKey;
1594
+ mint: PublicKey;
1595
+ spotPosition: SpotPosition;
1596
+ };
1597
+ type DriftRewardsJSON = {
1598
+ oracle: string;
1599
+ marketIndex: number;
1600
+ spotMarket: string;
1601
+ mint: string;
1602
+ spotPosition: SpotPositionJSON;
1603
+ };
1604
+
1605
+ export { type PriceHeuristicJSON as $, type ReserveLiquidityFields as A, type ReserveCollateralFields as B, type CurvePointFields as C, type DriftSpotMarket as D, type ReserveConfigFields as E, type FeedResponse as F, type ReserveFeesFields as G, type HistoricalOracleData as H, type InsuranceFund as I, type BorrowRateCurveFields as J, type PriceHeuristicFields as K, type ScopeConfigurationFields as L, type SwitchboardConfigurationFields as M, type PythConfigurationFields as N, type ObligationRaw as O, type PoolBalance as P, type ReserveLiquidityJSON as Q, type ReserveRaw as R, type SpotPosition as S, type TokenInfoFields$1 as T, type ReserveCollateralJSON as U, type ReserveConfigJSON as V, type WithdrawalCapsFields as W, type ReserveFeesJSON as X, type BorrowRateCurveJSON as Y, type CurvePointJSON as Z, type TokenInfoJSON$1 as _, type DriftRewards as a, type ScopeConfigurationJSON as a0, type SwitchboardConfigurationJSON as a1, type PythConfigurationJSON as a2, type WithdrawalCapsJSON as a3, type ObligationLiquidityJSON as a4, type ObligationCollateralJSON as a5, type ObligationOrderJSON as a6, type ObligationCollateralFields as a7, type ObligationLiquidityFields as a8, type ObligationOrderFields as a9, type LastUpdateFields as aa, type BigFractionBytesFields as ab, type LastUpdateJSON as ac, type BigFractionBytesJSON as ad, type RewardPerTimeUnitPointFields as ae, type RewardScheduleCurveFields as af, type RewardScheduleCurveJSON as ag, type RewardPerTimeUnitPointJSON as ah, type UserFeesJSON as ai, type UserFeesFields as aj, isSpotBalanceTypeVariant as ak, type FeeTier as al, type FeeTierJSON as am, type OrderFillerRewardStructure as an, type OrderFillerRewardStructureJSON as ao, type PriceDivergenceGuardRails as ap, type PriceDivergenceGuardRailsJSON as aq, type ValidityGuardRails as ar, type ValidityGuardRailsJSON as as, type HistoricalOracleDataJSON as at, type HistoricalIndexDataJSON as au, type PoolBalanceJSON as av, type InsuranceFundJSON as aw, SpotBalanceType as ax, type SpotPositionJSON as ay, type FarmStateRaw as b, type DriftUser as c, type DriftUserStats as d, type ReserveJSON as e, type ObligationJSON as f, type FarmStateJSON as g, type DriftSpotMarketJSON as h, type DriftUserJSON as i, type DriftUserStatsJSON as j, type RewardInfoFields as k, type HistoricalIndexData as l, type FeeStructureJSON as m, type OracleGuardRailsJSON as n, type FeeStructure as o, type OracleGuardRails as p, type DriftRewardsJSON as q, DriftSpotBalanceType as r, SWITCHBOARD_ONDEMANDE_PRICE_PRECISION as s, type CurrentResult as t, type OracleSubmission as u, type PullFeedAccountData as v, type CrossbarSimulatePayload as w, switchboardAccountCoder as x, getSwitchboardProgram as y, decodeSwitchboardPullFeedData as z };