@0dotxyz/p0-ts-sdk 2.0.2 → 2.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{rewards.types-2ooCYOAZ.d.cts → dto-rate-model.types-gN82ZYyC.d.cts} +164 -1
- package/dist/{rewards.types-2ooCYOAZ.d.ts → dto-rate-model.types-gN82ZYyC.d.ts} +164 -1
- package/dist/index.cjs +4163 -414
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2924 -311
- package/dist/index.d.ts +2924 -311
- package/dist/index.js +4156 -418
- package/dist/index.js.map +1 -1
- package/dist/vendor.cjs +929 -0
- package/dist/vendor.cjs.map +1 -1
- package/dist/vendor.d.cts +923 -3
- package/dist/vendor.d.ts +923 -3
- package/dist/vendor.js +878 -1
- package/dist/vendor.js.map +1 -1
- package/package.json +27 -23
package/dist/vendor.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as _solana_web3_js from '@solana/web3.js';
|
|
2
2
|
import { PublicKey, TransactionInstruction, Connection, Transaction, Commitment, AccountInfo, AccountMeta, Signer } from '@solana/web3.js';
|
|
3
3
|
import BigNumber from 'bignumber.js';
|
|
4
|
-
import { R as ReserveRaw, d as ObligationRaw, O as ObligationJSON, b as ReserveJSON, C as CurvePointFields,
|
|
5
|
-
export {
|
|
4
|
+
import { R as ReserveRaw, d as ObligationRaw, O as ObligationJSON, b as ReserveJSON, C as CurvePointFields, s as RewardInfoFields, e as FarmStateRaw, c as FarmStateJSON, H as HistoricalOracleData, t as HistoricalIndexData, P as PoolBalance, I as InsuranceFund, u as FeeStructureJSON, v as OracleGuardRailsJSON, w as FeeStructure, x as OracleGuardRails, S as SpotPosition, k as DriftUserStats, i as DriftUserStatsJSON, j as DriftUser, g as DriftUserJSON, D as DriftSpotMarket, f as DriftSpotMarketJSON, a as DriftRewards, h as DriftRewardsJSON, y as DriftSpotBalanceType, J as JupLendingState, l as JupLendingStateJSON, p as JupTokenReserve, m as JupTokenReserveJSON, q as JupLendingRewardsRateModel, n as JupLendingRewardsRateModelJSON, r as JupRateModel, o as JupRateModelJSON } from './dto-rate-model.types-gN82ZYyC.cjs';
|
|
5
|
+
export { aj as BigFractionBytesFields, al as BigFractionBytesJSON, V as BorrowRateCurveFields, a4 as BorrowRateCurveJSON, G as CrossbarSimulatePayload, A as CurrentResult, a5 as CurvePointJSON, at as FeeTier, au as FeeTierJSON, F as FeedResponse, aC as HistoricalIndexDataJSON, aB as HistoricalOracleDataJSON, aE as InsuranceFundJSON, ai as LastUpdateFields, ak as LastUpdateJSON, af as ObligationCollateralFields, ad as ObligationCollateralJSON, ag as ObligationLiquidityFields, ac as ObligationLiquidityJSON, ah as ObligationOrderFields, ae as ObligationOrderJSON, B as OracleSubmission, av as OrderFillerRewardStructure, aw as OrderFillerRewardStructureJSON, aD as PoolBalanceJSON, ax as PriceDivergenceGuardRails, ay as PriceDivergenceGuardRailsJSON, X as PriceHeuristicFields, a7 as PriceHeuristicJSON, E as PullFeedAccountData, _ as PythConfigurationFields, aa as PythConfigurationJSON, Q as ReserveCollateralFields, a1 as ReserveCollateralJSON, T as ReserveConfigFields, a2 as ReserveConfigJSON, U as ReserveFeesFields, a3 as ReserveFeesJSON, N as ReserveLiquidityFields, a0 as ReserveLiquidityJSON, am as RewardPerTimeUnitPointFields, ap as RewardPerTimeUnitPointJSON, an as RewardScheduleCurveFields, ao as RewardScheduleCurveJSON, z as SWITCHBOARD_ONDEMANDE_PRICE_PRECISION, Y as ScopeConfigurationFields, a8 as ScopeConfigurationJSON, aF as SpotBalanceType, aG as SpotPositionJSON, Z as SwitchboardConfigurationFields, a9 as SwitchboardConfigurationJSON, W as TokenInfoFields, a6 as TokenInfoJSON, ar as UserFeesFields, aq as UserFeesJSON, az as ValidityGuardRails, aA as ValidityGuardRailsJSON, $ as WithdrawalCapsFields, ab as WithdrawalCapsJSON, M as decodeSwitchboardPullFeedData, L as getSwitchboardProgram, as as isSpotBalanceTypeVariant, K as switchboardAccountCoder } from './dto-rate-model.types-gN82ZYyC.cjs';
|
|
6
6
|
import { Program, BorshCoder, Address } from '@coral-xyz/anchor';
|
|
7
7
|
import Decimal from 'decimal.js';
|
|
8
8
|
import * as _solana_buffer_layout from '@solana/buffer-layout';
|
|
@@ -22566,6 +22566,926 @@ type MakeUpdateSpotMarketIxParams = {
|
|
|
22566
22566
|
};
|
|
22567
22567
|
declare function makeUpdateSpotMarketIx({ spotMarket }: MakeUpdateSpotMarketIxParams): _solana_web3_js.TransactionInstruction;
|
|
22568
22568
|
|
|
22569
|
+
/**
|
|
22570
|
+
* Raw on-chain Lending account (integration_acc_1).
|
|
22571
|
+
*
|
|
22572
|
+
* This is the primary state account for a jup-lend market.
|
|
22573
|
+
* It holds the cToken (fToken) and underlying asset exchange rates
|
|
22574
|
+
* and is analogous to a Kamino Reserve or Drift SpotMarket.
|
|
22575
|
+
*/
|
|
22576
|
+
interface JupLendingStateRaw {
|
|
22577
|
+
pubkey: PublicKey;
|
|
22578
|
+
mint: PublicKey;
|
|
22579
|
+
fTokenMint: PublicKey;
|
|
22580
|
+
lendingId: number;
|
|
22581
|
+
/** Number of decimals for the fToken, same as underlying asset */
|
|
22582
|
+
decimals: number;
|
|
22583
|
+
/** PDA of the rewards rate model used by get_rate instruction */
|
|
22584
|
+
rewardsRateModel: PublicKey;
|
|
22585
|
+
/** Exchange price for the underlying asset in the liquidity protocol (without rewards) */
|
|
22586
|
+
liquidityExchangePrice: BN;
|
|
22587
|
+
/** Exchange price between fToken and the underlying asset (with rewards) */
|
|
22588
|
+
tokenExchangePrice: BN;
|
|
22589
|
+
/** Timestamp when exchange prices were last updated */
|
|
22590
|
+
lastUpdateTimestamp: BN;
|
|
22591
|
+
tokenReservesLiquidity: PublicKey;
|
|
22592
|
+
supplyPositionOnLiquidity: PublicKey;
|
|
22593
|
+
bump: number;
|
|
22594
|
+
}
|
|
22595
|
+
|
|
22596
|
+
/**
|
|
22597
|
+
* Raw on-chain TokenReserve account (bytemuck / packed C repr).
|
|
22598
|
+
*
|
|
22599
|
+
* This lives on the jup liquidity layer and contains supply/borrow
|
|
22600
|
+
* exchange prices, utilization, and totals for a given token.
|
|
22601
|
+
*/
|
|
22602
|
+
interface JupTokenReserveRaw {
|
|
22603
|
+
pubkey: PublicKey;
|
|
22604
|
+
mint: PublicKey;
|
|
22605
|
+
vault: PublicKey;
|
|
22606
|
+
borrowRate: number;
|
|
22607
|
+
feeOnInterest: number;
|
|
22608
|
+
lastUtilization: number;
|
|
22609
|
+
lastUpdateTimestamp: BN;
|
|
22610
|
+
supplyExchangePrice: BN;
|
|
22611
|
+
borrowExchangePrice: BN;
|
|
22612
|
+
maxUtilization: number;
|
|
22613
|
+
totalSupplyWithInterest: BN;
|
|
22614
|
+
totalSupplyInterestFree: BN;
|
|
22615
|
+
totalBorrowWithInterest: BN;
|
|
22616
|
+
totalBorrowInterestFree: BN;
|
|
22617
|
+
totalClaimAmount: BN;
|
|
22618
|
+
interactingProtocol: PublicKey;
|
|
22619
|
+
interactingTimestamp: BN;
|
|
22620
|
+
interactingBalance: BN;
|
|
22621
|
+
}
|
|
22622
|
+
|
|
22623
|
+
/**
|
|
22624
|
+
* Raw on-chain LendingRewardsRateModel account.
|
|
22625
|
+
*
|
|
22626
|
+
* Controls the rewards distribution parameters for a jup-lend market.
|
|
22627
|
+
*/
|
|
22628
|
+
interface JupLendingRewardsRateModelRaw {
|
|
22629
|
+
pubkey: PublicKey;
|
|
22630
|
+
/** Mint address */
|
|
22631
|
+
mint: PublicKey;
|
|
22632
|
+
/** TVL below which rewards rate is 0 */
|
|
22633
|
+
startTvl: BN;
|
|
22634
|
+
/** Duration for which current rewards should run */
|
|
22635
|
+
duration: BN;
|
|
22636
|
+
/** Timestamp when current rewards got started */
|
|
22637
|
+
startTime: BN;
|
|
22638
|
+
/** Annualized reward based on input params (duration, rewardAmount) */
|
|
22639
|
+
yearlyReward: BN;
|
|
22640
|
+
/** Duration for the next rewards phase */
|
|
22641
|
+
nextDuration: BN;
|
|
22642
|
+
/** Amount of rewards for the next phase */
|
|
22643
|
+
nextRewardAmount: BN;
|
|
22644
|
+
bump: number;
|
|
22645
|
+
}
|
|
22646
|
+
|
|
22647
|
+
/**
|
|
22648
|
+
* Raw on-chain RateModel account (bytemuck / packed C repr).
|
|
22649
|
+
*
|
|
22650
|
+
* This lives on the jup liquidity layer and contains the piecewise
|
|
22651
|
+
* linear interest rate curve parameters for a given token.
|
|
22652
|
+
*
|
|
22653
|
+
* V1 (version=1): single kink — rateAtZero → rateAtKink1 → rateAtMax
|
|
22654
|
+
* V2 (version=2): dual kink — rateAtZero → rateAtKink1 → rateAtKink2 → rateAtMax
|
|
22655
|
+
*
|
|
22656
|
+
* All rate/utilization values are in bps (100% = 10,000).
|
|
22657
|
+
*/
|
|
22658
|
+
interface JupRateModelRaw {
|
|
22659
|
+
pubkey: PublicKey;
|
|
22660
|
+
mint: PublicKey;
|
|
22661
|
+
version: number;
|
|
22662
|
+
rateAtZero: number;
|
|
22663
|
+
kink1Utilization: number;
|
|
22664
|
+
rateAtKink1: number;
|
|
22665
|
+
rateAtMax: number;
|
|
22666
|
+
kink2Utilization: number;
|
|
22667
|
+
rateAtKink2: number;
|
|
22668
|
+
}
|
|
22669
|
+
|
|
22670
|
+
declare const JUP_LEND_PROGRAM_ID: PublicKey;
|
|
22671
|
+
declare const JUP_LIQUIDITY_PROGRAM_ID: PublicKey;
|
|
22672
|
+
declare const JUP_REWARDS_PROGRAM_ID: PublicKey;
|
|
22673
|
+
|
|
22674
|
+
/**
|
|
22675
|
+
* Program IDL in camelCase format in order to be used in JS/TS.
|
|
22676
|
+
*
|
|
22677
|
+
* Note that this is only a type helper and is not the actual IDL. The original
|
|
22678
|
+
* IDL was extracted from the compiled @jup-ag/lend SDK.
|
|
22679
|
+
*/
|
|
22680
|
+
type JupLend = {
|
|
22681
|
+
address: "jup3YeL8QhtSx1e253b2FDvsMNC87fDrgQZivbrndc9";
|
|
22682
|
+
metadata: {
|
|
22683
|
+
name: "lending";
|
|
22684
|
+
version: "0.1.0";
|
|
22685
|
+
spec: "0.1.0";
|
|
22686
|
+
description: "Created with Anchor";
|
|
22687
|
+
};
|
|
22688
|
+
instructions: [
|
|
22689
|
+
{
|
|
22690
|
+
name: "deposit";
|
|
22691
|
+
discriminator: [242, 35, 198, 137, 82, 225, 242, 182];
|
|
22692
|
+
accounts: [
|
|
22693
|
+
{
|
|
22694
|
+
name: "signer";
|
|
22695
|
+
writable: true;
|
|
22696
|
+
signer: true;
|
|
22697
|
+
},
|
|
22698
|
+
{
|
|
22699
|
+
name: "depositor_token_account";
|
|
22700
|
+
writable: true;
|
|
22701
|
+
},
|
|
22702
|
+
{
|
|
22703
|
+
name: "recipient_token_account";
|
|
22704
|
+
writable: true;
|
|
22705
|
+
},
|
|
22706
|
+
{
|
|
22707
|
+
name: "mint";
|
|
22708
|
+
},
|
|
22709
|
+
{
|
|
22710
|
+
name: "lending_admin";
|
|
22711
|
+
},
|
|
22712
|
+
{
|
|
22713
|
+
name: "lending";
|
|
22714
|
+
writable: true;
|
|
22715
|
+
},
|
|
22716
|
+
{
|
|
22717
|
+
name: "f_token_mint";
|
|
22718
|
+
writable: true;
|
|
22719
|
+
},
|
|
22720
|
+
{
|
|
22721
|
+
name: "supply_token_reserves_liquidity";
|
|
22722
|
+
writable: true;
|
|
22723
|
+
},
|
|
22724
|
+
{
|
|
22725
|
+
name: "lending_supply_position_on_liquidity";
|
|
22726
|
+
writable: true;
|
|
22727
|
+
},
|
|
22728
|
+
{
|
|
22729
|
+
name: "rate_model";
|
|
22730
|
+
},
|
|
22731
|
+
{
|
|
22732
|
+
name: "vault";
|
|
22733
|
+
writable: true;
|
|
22734
|
+
},
|
|
22735
|
+
{
|
|
22736
|
+
name: "liquidity";
|
|
22737
|
+
writable: true;
|
|
22738
|
+
},
|
|
22739
|
+
{
|
|
22740
|
+
name: "liquidity_program";
|
|
22741
|
+
writable: true;
|
|
22742
|
+
},
|
|
22743
|
+
{
|
|
22744
|
+
name: "rewards_rate_model";
|
|
22745
|
+
},
|
|
22746
|
+
{
|
|
22747
|
+
name: "token_program";
|
|
22748
|
+
},
|
|
22749
|
+
{
|
|
22750
|
+
name: "associated_token_program";
|
|
22751
|
+
},
|
|
22752
|
+
{
|
|
22753
|
+
name: "system_program";
|
|
22754
|
+
}
|
|
22755
|
+
];
|
|
22756
|
+
args: [{
|
|
22757
|
+
name: "assets";
|
|
22758
|
+
type: "u64";
|
|
22759
|
+
}];
|
|
22760
|
+
returns: "u64";
|
|
22761
|
+
},
|
|
22762
|
+
{
|
|
22763
|
+
name: "mint";
|
|
22764
|
+
discriminator: [51, 57, 225, 47, 182, 146, 137, 166];
|
|
22765
|
+
accounts: [
|
|
22766
|
+
{
|
|
22767
|
+
name: "signer";
|
|
22768
|
+
writable: true;
|
|
22769
|
+
signer: true;
|
|
22770
|
+
},
|
|
22771
|
+
{
|
|
22772
|
+
name: "depositor_token_account";
|
|
22773
|
+
writable: true;
|
|
22774
|
+
},
|
|
22775
|
+
{
|
|
22776
|
+
name: "recipient_token_account";
|
|
22777
|
+
writable: true;
|
|
22778
|
+
},
|
|
22779
|
+
{
|
|
22780
|
+
name: "mint";
|
|
22781
|
+
},
|
|
22782
|
+
{
|
|
22783
|
+
name: "lending_admin";
|
|
22784
|
+
},
|
|
22785
|
+
{
|
|
22786
|
+
name: "lending";
|
|
22787
|
+
writable: true;
|
|
22788
|
+
},
|
|
22789
|
+
{
|
|
22790
|
+
name: "f_token_mint";
|
|
22791
|
+
writable: true;
|
|
22792
|
+
},
|
|
22793
|
+
{
|
|
22794
|
+
name: "supply_token_reserves_liquidity";
|
|
22795
|
+
writable: true;
|
|
22796
|
+
},
|
|
22797
|
+
{
|
|
22798
|
+
name: "lending_supply_position_on_liquidity";
|
|
22799
|
+
writable: true;
|
|
22800
|
+
},
|
|
22801
|
+
{
|
|
22802
|
+
name: "rate_model";
|
|
22803
|
+
},
|
|
22804
|
+
{
|
|
22805
|
+
name: "vault";
|
|
22806
|
+
writable: true;
|
|
22807
|
+
},
|
|
22808
|
+
{
|
|
22809
|
+
name: "liquidity";
|
|
22810
|
+
writable: true;
|
|
22811
|
+
},
|
|
22812
|
+
{
|
|
22813
|
+
name: "liquidity_program";
|
|
22814
|
+
writable: true;
|
|
22815
|
+
},
|
|
22816
|
+
{
|
|
22817
|
+
name: "rewards_rate_model";
|
|
22818
|
+
},
|
|
22819
|
+
{
|
|
22820
|
+
name: "token_program";
|
|
22821
|
+
},
|
|
22822
|
+
{
|
|
22823
|
+
name: "associated_token_program";
|
|
22824
|
+
},
|
|
22825
|
+
{
|
|
22826
|
+
name: "system_program";
|
|
22827
|
+
}
|
|
22828
|
+
];
|
|
22829
|
+
args: [{
|
|
22830
|
+
name: "shares";
|
|
22831
|
+
type: "u64";
|
|
22832
|
+
}];
|
|
22833
|
+
returns: "u64";
|
|
22834
|
+
},
|
|
22835
|
+
{
|
|
22836
|
+
name: "withdraw";
|
|
22837
|
+
discriminator: [183, 18, 70, 156, 148, 109, 161, 34];
|
|
22838
|
+
accounts: [
|
|
22839
|
+
{
|
|
22840
|
+
name: "signer";
|
|
22841
|
+
writable: true;
|
|
22842
|
+
signer: true;
|
|
22843
|
+
},
|
|
22844
|
+
{
|
|
22845
|
+
name: "owner_token_account";
|
|
22846
|
+
writable: true;
|
|
22847
|
+
},
|
|
22848
|
+
{
|
|
22849
|
+
name: "recipient_token_account";
|
|
22850
|
+
writable: true;
|
|
22851
|
+
},
|
|
22852
|
+
{
|
|
22853
|
+
name: "lending_admin";
|
|
22854
|
+
},
|
|
22855
|
+
{
|
|
22856
|
+
name: "lending";
|
|
22857
|
+
writable: true;
|
|
22858
|
+
},
|
|
22859
|
+
{
|
|
22860
|
+
name: "mint";
|
|
22861
|
+
},
|
|
22862
|
+
{
|
|
22863
|
+
name: "f_token_mint";
|
|
22864
|
+
writable: true;
|
|
22865
|
+
},
|
|
22866
|
+
{
|
|
22867
|
+
name: "supply_token_reserves_liquidity";
|
|
22868
|
+
writable: true;
|
|
22869
|
+
},
|
|
22870
|
+
{
|
|
22871
|
+
name: "lending_supply_position_on_liquidity";
|
|
22872
|
+
writable: true;
|
|
22873
|
+
},
|
|
22874
|
+
{
|
|
22875
|
+
name: "rate_model";
|
|
22876
|
+
},
|
|
22877
|
+
{
|
|
22878
|
+
name: "vault";
|
|
22879
|
+
writable: true;
|
|
22880
|
+
},
|
|
22881
|
+
{
|
|
22882
|
+
name: "claim_account";
|
|
22883
|
+
writable: true;
|
|
22884
|
+
},
|
|
22885
|
+
{
|
|
22886
|
+
name: "liquidity";
|
|
22887
|
+
writable: true;
|
|
22888
|
+
},
|
|
22889
|
+
{
|
|
22890
|
+
name: "liquidity_program";
|
|
22891
|
+
writable: true;
|
|
22892
|
+
},
|
|
22893
|
+
{
|
|
22894
|
+
name: "rewards_rate_model";
|
|
22895
|
+
},
|
|
22896
|
+
{
|
|
22897
|
+
name: "token_program";
|
|
22898
|
+
},
|
|
22899
|
+
{
|
|
22900
|
+
name: "associated_token_program";
|
|
22901
|
+
},
|
|
22902
|
+
{
|
|
22903
|
+
name: "system_program";
|
|
22904
|
+
}
|
|
22905
|
+
];
|
|
22906
|
+
args: [{
|
|
22907
|
+
name: "amount";
|
|
22908
|
+
type: "u64";
|
|
22909
|
+
}];
|
|
22910
|
+
returns: "u64";
|
|
22911
|
+
},
|
|
22912
|
+
{
|
|
22913
|
+
name: "redeem";
|
|
22914
|
+
discriminator: [184, 12, 86, 149, 70, 196, 97, 225];
|
|
22915
|
+
accounts: [
|
|
22916
|
+
{
|
|
22917
|
+
name: "signer";
|
|
22918
|
+
writable: true;
|
|
22919
|
+
signer: true;
|
|
22920
|
+
},
|
|
22921
|
+
{
|
|
22922
|
+
name: "owner_token_account";
|
|
22923
|
+
writable: true;
|
|
22924
|
+
},
|
|
22925
|
+
{
|
|
22926
|
+
name: "recipient_token_account";
|
|
22927
|
+
writable: true;
|
|
22928
|
+
},
|
|
22929
|
+
{
|
|
22930
|
+
name: "lending_admin";
|
|
22931
|
+
},
|
|
22932
|
+
{
|
|
22933
|
+
name: "lending";
|
|
22934
|
+
writable: true;
|
|
22935
|
+
},
|
|
22936
|
+
{
|
|
22937
|
+
name: "mint";
|
|
22938
|
+
},
|
|
22939
|
+
{
|
|
22940
|
+
name: "f_token_mint";
|
|
22941
|
+
writable: true;
|
|
22942
|
+
},
|
|
22943
|
+
{
|
|
22944
|
+
name: "supply_token_reserves_liquidity";
|
|
22945
|
+
writable: true;
|
|
22946
|
+
},
|
|
22947
|
+
{
|
|
22948
|
+
name: "lending_supply_position_on_liquidity";
|
|
22949
|
+
writable: true;
|
|
22950
|
+
},
|
|
22951
|
+
{
|
|
22952
|
+
name: "rate_model";
|
|
22953
|
+
},
|
|
22954
|
+
{
|
|
22955
|
+
name: "vault";
|
|
22956
|
+
writable: true;
|
|
22957
|
+
},
|
|
22958
|
+
{
|
|
22959
|
+
name: "claim_account";
|
|
22960
|
+
writable: true;
|
|
22961
|
+
},
|
|
22962
|
+
{
|
|
22963
|
+
name: "liquidity";
|
|
22964
|
+
writable: true;
|
|
22965
|
+
},
|
|
22966
|
+
{
|
|
22967
|
+
name: "liquidity_program";
|
|
22968
|
+
writable: true;
|
|
22969
|
+
},
|
|
22970
|
+
{
|
|
22971
|
+
name: "rewards_rate_model";
|
|
22972
|
+
},
|
|
22973
|
+
{
|
|
22974
|
+
name: "token_program";
|
|
22975
|
+
},
|
|
22976
|
+
{
|
|
22977
|
+
name: "associated_token_program";
|
|
22978
|
+
},
|
|
22979
|
+
{
|
|
22980
|
+
name: "system_program";
|
|
22981
|
+
}
|
|
22982
|
+
];
|
|
22983
|
+
args: [{
|
|
22984
|
+
name: "shares";
|
|
22985
|
+
type: "u64";
|
|
22986
|
+
}];
|
|
22987
|
+
returns: "u64";
|
|
22988
|
+
},
|
|
22989
|
+
{
|
|
22990
|
+
name: "rebalance";
|
|
22991
|
+
discriminator: [108, 158, 77, 9, 210, 52, 88, 62];
|
|
22992
|
+
accounts: [
|
|
22993
|
+
{
|
|
22994
|
+
name: "signer";
|
|
22995
|
+
writable: true;
|
|
22996
|
+
signer: true;
|
|
22997
|
+
},
|
|
22998
|
+
{
|
|
22999
|
+
name: "depositor_token_account";
|
|
23000
|
+
writable: true;
|
|
23001
|
+
},
|
|
23002
|
+
{
|
|
23003
|
+
name: "lending_admin";
|
|
23004
|
+
},
|
|
23005
|
+
{
|
|
23006
|
+
name: "lending";
|
|
23007
|
+
writable: true;
|
|
23008
|
+
},
|
|
23009
|
+
{
|
|
23010
|
+
name: "mint";
|
|
23011
|
+
},
|
|
23012
|
+
{
|
|
23013
|
+
name: "f_token_mint";
|
|
23014
|
+
writable: true;
|
|
23015
|
+
},
|
|
23016
|
+
{
|
|
23017
|
+
name: "supply_token_reserves_liquidity";
|
|
23018
|
+
writable: true;
|
|
23019
|
+
},
|
|
23020
|
+
{
|
|
23021
|
+
name: "lending_supply_position_on_liquidity";
|
|
23022
|
+
writable: true;
|
|
23023
|
+
},
|
|
23024
|
+
{
|
|
23025
|
+
name: "rate_model";
|
|
23026
|
+
writable: true;
|
|
23027
|
+
},
|
|
23028
|
+
{
|
|
23029
|
+
name: "vault";
|
|
23030
|
+
writable: true;
|
|
23031
|
+
},
|
|
23032
|
+
{
|
|
23033
|
+
name: "liquidity";
|
|
23034
|
+
writable: true;
|
|
23035
|
+
},
|
|
23036
|
+
{
|
|
23037
|
+
name: "liquidity_program";
|
|
23038
|
+
writable: true;
|
|
23039
|
+
},
|
|
23040
|
+
{
|
|
23041
|
+
name: "rewards_rate_model";
|
|
23042
|
+
},
|
|
23043
|
+
{
|
|
23044
|
+
name: "token_program";
|
|
23045
|
+
},
|
|
23046
|
+
{
|
|
23047
|
+
name: "associated_token_program";
|
|
23048
|
+
},
|
|
23049
|
+
{
|
|
23050
|
+
name: "system_program";
|
|
23051
|
+
}
|
|
23052
|
+
];
|
|
23053
|
+
args: [];
|
|
23054
|
+
},
|
|
23055
|
+
{
|
|
23056
|
+
name: "update_rate";
|
|
23057
|
+
discriminator: [24, 225, 53, 189, 72, 212, 225, 178];
|
|
23058
|
+
accounts: [
|
|
23059
|
+
{
|
|
23060
|
+
name: "lending";
|
|
23061
|
+
writable: true;
|
|
23062
|
+
},
|
|
23063
|
+
{
|
|
23064
|
+
name: "mint";
|
|
23065
|
+
},
|
|
23066
|
+
{
|
|
23067
|
+
name: "f_token_mint";
|
|
23068
|
+
},
|
|
23069
|
+
{
|
|
23070
|
+
name: "supply_token_reserves_liquidity";
|
|
23071
|
+
},
|
|
23072
|
+
{
|
|
23073
|
+
name: "rewards_rate_model";
|
|
23074
|
+
}
|
|
23075
|
+
];
|
|
23076
|
+
args: [];
|
|
23077
|
+
}
|
|
23078
|
+
];
|
|
23079
|
+
accounts: [
|
|
23080
|
+
{
|
|
23081
|
+
name: "Lending";
|
|
23082
|
+
discriminator: [135, 199, 82, 16, 249, 131, 182, 241];
|
|
23083
|
+
},
|
|
23084
|
+
{
|
|
23085
|
+
name: "LendingAdmin";
|
|
23086
|
+
discriminator: [42, 8, 33, 220, 163, 40, 210, 5];
|
|
23087
|
+
},
|
|
23088
|
+
{
|
|
23089
|
+
name: "LendingRewardsRateModel";
|
|
23090
|
+
discriminator: [166, 72, 71, 131, 172, 74, 166, 181];
|
|
23091
|
+
},
|
|
23092
|
+
{
|
|
23093
|
+
name: "TokenReserve";
|
|
23094
|
+
discriminator: [21, 18, 59, 135, 120, 20, 31, 12];
|
|
23095
|
+
},
|
|
23096
|
+
{
|
|
23097
|
+
name: "UserSupplyPosition";
|
|
23098
|
+
discriminator: [202, 219, 136, 118, 61, 177, 21, 146];
|
|
23099
|
+
}
|
|
23100
|
+
];
|
|
23101
|
+
types: [
|
|
23102
|
+
{
|
|
23103
|
+
name: "Lending";
|
|
23104
|
+
type: {
|
|
23105
|
+
kind: "struct";
|
|
23106
|
+
fields: [
|
|
23107
|
+
{
|
|
23108
|
+
name: "mint";
|
|
23109
|
+
type: "pubkey";
|
|
23110
|
+
},
|
|
23111
|
+
{
|
|
23112
|
+
name: "f_token_mint";
|
|
23113
|
+
type: "pubkey";
|
|
23114
|
+
},
|
|
23115
|
+
{
|
|
23116
|
+
name: "lending_id";
|
|
23117
|
+
type: "u16";
|
|
23118
|
+
},
|
|
23119
|
+
{
|
|
23120
|
+
name: "decimals";
|
|
23121
|
+
type: "u8";
|
|
23122
|
+
},
|
|
23123
|
+
{
|
|
23124
|
+
name: "rewards_rate_model";
|
|
23125
|
+
type: "pubkey";
|
|
23126
|
+
},
|
|
23127
|
+
{
|
|
23128
|
+
name: "liquidity_exchange_price";
|
|
23129
|
+
type: "u64";
|
|
23130
|
+
},
|
|
23131
|
+
{
|
|
23132
|
+
name: "token_exchange_price";
|
|
23133
|
+
type: "u64";
|
|
23134
|
+
},
|
|
23135
|
+
{
|
|
23136
|
+
name: "last_update_timestamp";
|
|
23137
|
+
type: "u64";
|
|
23138
|
+
},
|
|
23139
|
+
{
|
|
23140
|
+
name: "token_reserves_liquidity";
|
|
23141
|
+
type: "pubkey";
|
|
23142
|
+
},
|
|
23143
|
+
{
|
|
23144
|
+
name: "supply_position_on_liquidity";
|
|
23145
|
+
type: "pubkey";
|
|
23146
|
+
},
|
|
23147
|
+
{
|
|
23148
|
+
name: "bump";
|
|
23149
|
+
type: "u8";
|
|
23150
|
+
}
|
|
23151
|
+
];
|
|
23152
|
+
};
|
|
23153
|
+
},
|
|
23154
|
+
{
|
|
23155
|
+
name: "LendingAdmin";
|
|
23156
|
+
type: {
|
|
23157
|
+
kind: "struct";
|
|
23158
|
+
fields: [
|
|
23159
|
+
{
|
|
23160
|
+
name: "authority";
|
|
23161
|
+
type: "pubkey";
|
|
23162
|
+
},
|
|
23163
|
+
{
|
|
23164
|
+
name: "liquidity_program";
|
|
23165
|
+
type: "pubkey";
|
|
23166
|
+
},
|
|
23167
|
+
{
|
|
23168
|
+
name: "rebalancer";
|
|
23169
|
+
type: "pubkey";
|
|
23170
|
+
},
|
|
23171
|
+
{
|
|
23172
|
+
name: "next_lending_id";
|
|
23173
|
+
type: "u16";
|
|
23174
|
+
},
|
|
23175
|
+
{
|
|
23176
|
+
name: "auths";
|
|
23177
|
+
type: {
|
|
23178
|
+
vec: "pubkey";
|
|
23179
|
+
};
|
|
23180
|
+
},
|
|
23181
|
+
{
|
|
23182
|
+
name: "bump";
|
|
23183
|
+
type: "u8";
|
|
23184
|
+
}
|
|
23185
|
+
];
|
|
23186
|
+
};
|
|
23187
|
+
},
|
|
23188
|
+
{
|
|
23189
|
+
name: "LendingRewardsRateModel";
|
|
23190
|
+
type: {
|
|
23191
|
+
kind: "struct";
|
|
23192
|
+
fields: [
|
|
23193
|
+
{
|
|
23194
|
+
name: "mint";
|
|
23195
|
+
type: "pubkey";
|
|
23196
|
+
},
|
|
23197
|
+
{
|
|
23198
|
+
name: "start_tvl";
|
|
23199
|
+
type: "u64";
|
|
23200
|
+
},
|
|
23201
|
+
{
|
|
23202
|
+
name: "duration";
|
|
23203
|
+
type: "u64";
|
|
23204
|
+
},
|
|
23205
|
+
{
|
|
23206
|
+
name: "start_time";
|
|
23207
|
+
type: "u64";
|
|
23208
|
+
},
|
|
23209
|
+
{
|
|
23210
|
+
name: "yearly_reward";
|
|
23211
|
+
type: "u64";
|
|
23212
|
+
},
|
|
23213
|
+
{
|
|
23214
|
+
name: "next_duration";
|
|
23215
|
+
type: "u64";
|
|
23216
|
+
},
|
|
23217
|
+
{
|
|
23218
|
+
name: "next_reward_amount";
|
|
23219
|
+
type: "u64";
|
|
23220
|
+
},
|
|
23221
|
+
{
|
|
23222
|
+
name: "bump";
|
|
23223
|
+
type: "u8";
|
|
23224
|
+
}
|
|
23225
|
+
];
|
|
23226
|
+
};
|
|
23227
|
+
}
|
|
23228
|
+
];
|
|
23229
|
+
};
|
|
23230
|
+
|
|
23231
|
+
declare const JUP_LEND_IDL: JupLend;
|
|
23232
|
+
type JupLendIdlType = JupLend;
|
|
23233
|
+
|
|
23234
|
+
declare function jupLendingStateRawToDto(raw: JupLendingState): JupLendingStateJSON;
|
|
23235
|
+
declare function jupTokenReserveRawToDto(raw: JupTokenReserve): JupTokenReserveJSON;
|
|
23236
|
+
declare function jupLendingRewardsRateModelRawToDto(raw: JupLendingRewardsRateModel): JupLendingRewardsRateModelJSON;
|
|
23237
|
+
declare function jupRateModelRawToDto(raw: JupRateModel): JupRateModelJSON;
|
|
23238
|
+
|
|
23239
|
+
declare function decodeJupLendingStateData(data: Buffer, pubkey: PublicKey): JupLendingStateRaw;
|
|
23240
|
+
declare function decodeJupLendingRewardsRateModelData(data: Buffer, pubkey: PublicKey): JupLendingRewardsRateModelRaw;
|
|
23241
|
+
/**
|
|
23242
|
+
* Decode a TokenReserve account from raw buffer data.
|
|
23243
|
+
* TokenReserve uses bytemuck (packed C repr) — manual fixed-offset reads.
|
|
23244
|
+
* Layout (after 8-byte discriminator):
|
|
23245
|
+
* mint[32] vault[32] borrow_rate[2] fee_on_interest[2] last_utilization[2]
|
|
23246
|
+
* last_update_timestamp[8] supply_exchange_price[8] borrow_exchange_price[8]
|
|
23247
|
+
* max_utilization[2] total_supply_with_interest[8] total_supply_interest_free[8]
|
|
23248
|
+
* total_borrow_with_interest[8] total_borrow_interest_free[8] total_claim_amount[8]
|
|
23249
|
+
* interacting_protocol[32] interacting_timestamp[8] interacting_balance[8]
|
|
23250
|
+
*/
|
|
23251
|
+
declare function decodeJupTokenReserveData(data: Buffer, pubkey: PublicKey): JupTokenReserveRaw;
|
|
23252
|
+
/**
|
|
23253
|
+
* Decode a RateModel account from raw buffer data.
|
|
23254
|
+
* RateModel uses bytemuck (packed C repr) — manual fixed-offset reads.
|
|
23255
|
+
* Layout (after 8-byte discriminator):
|
|
23256
|
+
* mint[32] version[1] rate_at_zero[2] kink1_utilization[2]
|
|
23257
|
+
* rate_at_kink1[2] rate_at_max[2] kink2_utilization[2] rate_at_kink2[2]
|
|
23258
|
+
*/
|
|
23259
|
+
declare function decodeJupRateModelData(data: Buffer, pubkey: PublicKey): JupRateModelRaw;
|
|
23260
|
+
declare function dtoToJupLendingStateRaw(dto: JupLendingStateJSON): JupLendingState;
|
|
23261
|
+
declare function dtoToJupTokenReserveRaw(dto: JupTokenReserveJSON): JupTokenReserve;
|
|
23262
|
+
declare function dtoToJupLendingRewardsRateModelRaw(dto: JupLendingRewardsRateModelJSON): JupLendingRewardsRateModel;
|
|
23263
|
+
declare function dtoToJupRateModelRaw(dto: JupRateModelJSON): JupRateModel;
|
|
23264
|
+
|
|
23265
|
+
declare const SEED_LENDING_ADMIN = "lending_admin";
|
|
23266
|
+
declare const SEED_F_TOKEN_MINT = "f_token_mint";
|
|
23267
|
+
declare const SEED_LENDING = "lending";
|
|
23268
|
+
declare const SEED_LIQUIDITY = "liquidity";
|
|
23269
|
+
declare const SEED_RESERVE = "reserve";
|
|
23270
|
+
declare const SEED_RATE_MODEL = "rate_model";
|
|
23271
|
+
declare const SEED_USER_SUPPLY_POSITION = "user_supply_position";
|
|
23272
|
+
declare const SEED_USER_CLAIM = "user_claim";
|
|
23273
|
+
declare const SEED_LENDING_REWARDS_RATE_MODEL = "lending_rewards_rate_model";
|
|
23274
|
+
declare function getAllDerivedJupLendAccounts(mint: PublicKey): {
|
|
23275
|
+
fTokenMint: PublicKey;
|
|
23276
|
+
lendingAdmin: PublicKey;
|
|
23277
|
+
supplyTokenReservesLiquidity: PublicKey;
|
|
23278
|
+
lendingSupplyPositionOnLiquidity: PublicKey;
|
|
23279
|
+
rateModel: PublicKey;
|
|
23280
|
+
vault: PublicKey;
|
|
23281
|
+
liquidity: PublicKey;
|
|
23282
|
+
rewardsRateModel: PublicKey;
|
|
23283
|
+
};
|
|
23284
|
+
declare function deriveJupLendLendingPdas(underlyingMint: PublicKey, lendingProgramId?: PublicKey): {
|
|
23285
|
+
lendingAdmin: PublicKey;
|
|
23286
|
+
lendingAdminBump: number;
|
|
23287
|
+
fTokenMint: PublicKey;
|
|
23288
|
+
fTokenMintBump: number;
|
|
23289
|
+
lending: PublicKey;
|
|
23290
|
+
lendingBump: number;
|
|
23291
|
+
};
|
|
23292
|
+
/**
|
|
23293
|
+
* Derive the fToken mint PDA for a given asset.
|
|
23294
|
+
* Seeds: ["f_token_mint", asset]
|
|
23295
|
+
*/
|
|
23296
|
+
declare function deriveJupLendFTokenMint(asset: PublicKey, lendingProgramId?: PublicKey): [PublicKey, number];
|
|
23297
|
+
/**
|
|
23298
|
+
* Derive the Lending state PDA for a given asset.
|
|
23299
|
+
* Seeds: ["lending", asset, fTokenMint]
|
|
23300
|
+
*/
|
|
23301
|
+
declare function deriveJupLendLending(asset: PublicKey, fTokenMint?: PublicKey, lendingProgramId?: PublicKey): [PublicKey, number];
|
|
23302
|
+
/**
|
|
23303
|
+
* Derive the LendingAdmin PDA (singleton).
|
|
23304
|
+
* Seeds: ["lending_admin"]
|
|
23305
|
+
*/
|
|
23306
|
+
declare function deriveJupLendLendingAdmin(lendingProgramId?: PublicKey): [PublicKey, number];
|
|
23307
|
+
/**
|
|
23308
|
+
* Derive the LendingRewardsRateModel PDA for a given asset.
|
|
23309
|
+
* Seeds: ["lending_rewards_rate_model", asset]
|
|
23310
|
+
* Note: This PDA lives on the rewards program, not the lending program.
|
|
23311
|
+
*/
|
|
23312
|
+
declare function deriveJupLendLendingRewardsRateModel(asset: PublicKey, rewardsProgramId?: PublicKey): [PublicKey, number];
|
|
23313
|
+
/**
|
|
23314
|
+
* Derive the TokenReserve PDA for a given asset on the liquidity layer.
|
|
23315
|
+
* Seeds: ["reserve", asset]
|
|
23316
|
+
*/
|
|
23317
|
+
declare function deriveJupLendTokenReserve(asset: PublicKey, liquidityProgramId?: PublicKey): [PublicKey, number];
|
|
23318
|
+
declare function deriveJupLendLiquidityVaultAta(underlyingMint: PublicKey, liquidityPda: PublicKey, tokenProgramId?: PublicKey): PublicKey;
|
|
23319
|
+
/**
|
|
23320
|
+
* Derive the interest rate model PDA for a given asset on the liquidity layer.
|
|
23321
|
+
* Seeds: ["rate_model", asset]
|
|
23322
|
+
*/
|
|
23323
|
+
declare function deriveJupLendRateModel(asset: PublicKey, liquidityProgramId?: PublicKey): [PublicKey, number];
|
|
23324
|
+
/**
|
|
23325
|
+
* Derive the global Liquidity state PDA (singleton).
|
|
23326
|
+
* Seeds: ["liquidity"]
|
|
23327
|
+
*/
|
|
23328
|
+
declare function deriveJupLendLiquidity(liquidityProgramId?: PublicKey): [PublicKey, number];
|
|
23329
|
+
/**
|
|
23330
|
+
* Derive the claim account PDA for a given owner and mint on the liquidity program.
|
|
23331
|
+
* Seeds: ["user_claim", owner, mint]
|
|
23332
|
+
*/
|
|
23333
|
+
declare function deriveJupLendClaimAccount(owner: PublicKey, mint: PublicKey, liquidityProgramId?: PublicKey): [PublicKey, number];
|
|
23334
|
+
declare function deriveJupLendLiquiditySupplyPositionPda(underlyingMint: PublicKey, lendingPda: PublicKey, liquidityProgramId?: PublicKey): [PublicKey, number];
|
|
23335
|
+
|
|
23336
|
+
/**
|
|
23337
|
+
* Jup-Lend Interest Rate & Exchange Price Utilities
|
|
23338
|
+
*
|
|
23339
|
+
* Extracted from the compiled @jup-ag/lend SDK (earn/index.mjs).
|
|
23340
|
+
* All functions work on pre-fetched state — no RPC calls.
|
|
23341
|
+
*/
|
|
23342
|
+
declare const JUP_EXCHANGE_PRICES_PRECISION: BN;
|
|
23343
|
+
declare const JUP_SECONDS_PER_YEAR: BN;
|
|
23344
|
+
declare const JUP_MAX_REWARDS_RATE: BN;
|
|
23345
|
+
/**
|
|
23346
|
+
* Calculate total assets for a jup-lend market.
|
|
23347
|
+
* Formula: tokenExchangePrice * fTokenTotalSupply / EXCHANGE_PRICES_PRECISION
|
|
23348
|
+
*
|
|
23349
|
+
* @param lendingState - The on-chain Lending account
|
|
23350
|
+
* @param fTokenTotalSupply - Total supply of the fToken (from getTokenSupply)
|
|
23351
|
+
* @returns Total assets as BN in underlying token lamports
|
|
23352
|
+
*/
|
|
23353
|
+
declare function calculateJupLendTotalAssets(lendingState: JupLendingState, fTokenTotalSupply: BN): BN;
|
|
23354
|
+
interface JupLendRewardsResult {
|
|
23355
|
+
rewardsRate: BN;
|
|
23356
|
+
rewardsEnded: boolean;
|
|
23357
|
+
rewardsStartTime: BN;
|
|
23358
|
+
}
|
|
23359
|
+
/**
|
|
23360
|
+
* Calculate the rewards rate from a LendingRewardsRateModel.
|
|
23361
|
+
* Extracted from compiled SDK's `calculateRewardsRate`.
|
|
23362
|
+
*
|
|
23363
|
+
* @param rewardsModel - The on-chain LendingRewardsRateModel account
|
|
23364
|
+
* @param totalAssets - Total assets in the market (from calculateJupLendTotalAssets)
|
|
23365
|
+
* @param currentTimestamp - Current unix timestamp (seconds)
|
|
23366
|
+
* @returns Rewards rate, whether rewards ended, and start time
|
|
23367
|
+
*/
|
|
23368
|
+
declare function calculateJupLendRewardsRate(rewardsModel: JupLendingRewardsRateModel, totalAssets: BN, currentTimestamp: BN): JupLendRewardsResult;
|
|
23369
|
+
/**
|
|
23370
|
+
* Calculate the rewards rate at 1e12 precision for use in exchange price projection.
|
|
23371
|
+
* Mirrors SDK's `getRewardsRate` (earn/index.mjs line 261), NOT `calculateRewardsRate`.
|
|
23372
|
+
*
|
|
23373
|
+
* This is distinct from `calculateJupLendRewardsRate` which uses 1e4 precision for APR display.
|
|
23374
|
+
*
|
|
23375
|
+
* @param rewardsModel - The on-chain LendingRewardsRateModel account
|
|
23376
|
+
* @param totalAssets - Total assets in the market (from calculateJupLendTotalAssets)
|
|
23377
|
+
* @param currentTimestamp - Current unix timestamp (seconds)
|
|
23378
|
+
* @returns Rate at 1e12 precision and rewards start time
|
|
23379
|
+
*/
|
|
23380
|
+
declare function calculateJupLendRewardsRateForExchangePrice(rewardsModel: JupLendingRewardsRateModel, totalAssets: BN, currentTimestamp: BN): {
|
|
23381
|
+
rate: BN;
|
|
23382
|
+
rewardsStartTime: BN;
|
|
23383
|
+
};
|
|
23384
|
+
/**
|
|
23385
|
+
* Project the new token exchange price offline (no RPC calls).
|
|
23386
|
+
* Extracted from compiled SDK's `getNewExchangePrice` (earn/index.mjs line 316).
|
|
23387
|
+
*
|
|
23388
|
+
* This combines:
|
|
23389
|
+
* 1. Rewards rate contribution (time-weighted, 1e12 precision via getRewardsRate)
|
|
23390
|
+
* 2. Liquidity exchange price delta (scaled to 1e14)
|
|
23391
|
+
*
|
|
23392
|
+
* Both components are accumulated in 1e14 space before being applied.
|
|
23393
|
+
*
|
|
23394
|
+
* @param lendingState - The on-chain Lending account
|
|
23395
|
+
* @param tokenReserve - The on-chain TokenReserve account (provides current supplyExchangePrice)
|
|
23396
|
+
* @param rewardsModel - The on-chain LendingRewardsRateModel (or null if no rewards)
|
|
23397
|
+
* @param fTokenTotalSupply - Total supply of the fToken (for totalAssets calculation)
|
|
23398
|
+
* @param currentTimestamp - Current unix timestamp (seconds)
|
|
23399
|
+
* @returns Projected token exchange price as BN (1e12 precision)
|
|
23400
|
+
*/
|
|
23401
|
+
declare function calculateJupLendNewExchangePrice(lendingState: JupLendingState, tokenReserve: JupTokenReserve, rewardsModel: JupLendingRewardsRateModel | null, fTokenTotalSupply: BN, currentTimestamp: BN): BN;
|
|
23402
|
+
/**
|
|
23403
|
+
* Calculate the liquidity layer supply rate for an asset.
|
|
23404
|
+
* Extracted from compiled SDK's `getLiquidityAssetSupplyRate`.
|
|
23405
|
+
*
|
|
23406
|
+
* Formula: borrowRate * (1 - fee) * borrowWithInterest / supplyWithInterest
|
|
23407
|
+
*
|
|
23408
|
+
* @param tokenReserve - The on-chain TokenReserve account
|
|
23409
|
+
* @returns Supply rate as BN (in bps-like precision from the liquidity layer)
|
|
23410
|
+
*/
|
|
23411
|
+
declare function calculateJupLendLiquiditySupplyRate(tokenReserve: JupTokenReserve): BN;
|
|
23412
|
+
/**
|
|
23413
|
+
* Calculate the total supply rate (APR) for a jup-lend market,
|
|
23414
|
+
* combining both base liquidity supply rate and rewards rate.
|
|
23415
|
+
*
|
|
23416
|
+
* Returns a number as a decimal (e.g. 0.05 = 5% APR).
|
|
23417
|
+
*
|
|
23418
|
+
* @param lendingState - The on-chain Lending account
|
|
23419
|
+
* @param tokenReserve - The on-chain TokenReserve account
|
|
23420
|
+
* @param rewardsModel - The on-chain LendingRewardsRateModel account (or null if no rewards)
|
|
23421
|
+
* @param fTokenTotalSupply - Total supply of the fToken
|
|
23422
|
+
* @returns Supply rate as decimal number
|
|
23423
|
+
*/
|
|
23424
|
+
declare function calculateJupLendSupplyRate(lendingState: JupLendingState, tokenReserve: JupTokenReserve, rewardsModel: JupLendingRewardsRateModel | null, fTokenTotalSupply: BN): number;
|
|
23425
|
+
/**
|
|
23426
|
+
* Calculate the supply APY for a jup-lend market (base rate only, no rewards).
|
|
23427
|
+
*
|
|
23428
|
+
* Uses hourly compounding: (1 + apr/HOURS_PER_YEAR)^HOURS_PER_YEAR - 1
|
|
23429
|
+
*
|
|
23430
|
+
* @param tokenReserve - The on-chain TokenReserve account
|
|
23431
|
+
* @returns Supply APY as decimal (e.g. 0.0512 = 5.12% APY)
|
|
23432
|
+
*/
|
|
23433
|
+
declare function calculateJupLendSupplyAPY(tokenReserve: JupTokenReserve): number;
|
|
23434
|
+
/**
|
|
23435
|
+
* Calculate the borrow rate at a given utilization using the on-chain RateModel.
|
|
23436
|
+
*
|
|
23437
|
+
* V1 (version=1, single kink):
|
|
23438
|
+
* [0, kink1] → linear rateAtZero → rateAtKink1
|
|
23439
|
+
* [kink1, 10000] → linear rateAtKink1 → rateAtMax
|
|
23440
|
+
*
|
|
23441
|
+
* V2 (version=2, dual kink):
|
|
23442
|
+
* [0, kink1] → linear rateAtZero → rateAtKink1
|
|
23443
|
+
* [kink1, kink2] → linear rateAtKink1 → rateAtKink2
|
|
23444
|
+
* [kink2, 10000] → linear rateAtKink2 → rateAtMax
|
|
23445
|
+
*
|
|
23446
|
+
* @param rateModel - The on-chain RateModel account
|
|
23447
|
+
* @param utilizationBps - Utilization in bps (0–10000)
|
|
23448
|
+
* @returns Borrow rate in bps
|
|
23449
|
+
*/
|
|
23450
|
+
declare function calculateJupLendBorrowRate(rateModel: JupRateModel, utilizationBps: number): number;
|
|
23451
|
+
/**
|
|
23452
|
+
* Interest rate curve point for visualization (supply only).
|
|
23453
|
+
*/
|
|
23454
|
+
interface JupLendInterestRateCurvePoint {
|
|
23455
|
+
utilization: number;
|
|
23456
|
+
supplyAPY: number;
|
|
23457
|
+
}
|
|
23458
|
+
/**
|
|
23459
|
+
* Generate a supply interest rate curve for a JupLend reserve using the on-chain RateModel.
|
|
23460
|
+
*
|
|
23461
|
+
* Uses the piecewise linear borrow rate curve from the RateModel account:
|
|
23462
|
+
* borrowAPR(U) = calculateJupLendBorrowRate(rateModel, U * 10000)
|
|
23463
|
+
* supplyAPR(U) = borrowAPR(U) * (1 - feeOnInterest / 1e4) * U
|
|
23464
|
+
* supplyAPY(U) = aprToApy(supplyAPR(U))
|
|
23465
|
+
*
|
|
23466
|
+
* @param rateModel - The on-chain RateModel account (from liquidity program)
|
|
23467
|
+
* @param feeOnInterest - Fee on interest in bps (from TokenReserve.feeOnInterest)
|
|
23468
|
+
* @returns 101 curve points (utilization 0–100%)
|
|
23469
|
+
*/
|
|
23470
|
+
declare function generateJupLendSupplyCurve(rateModel: JupRateModel, feeOnInterest: number): JupLendInterestRateCurvePoint[];
|
|
23471
|
+
|
|
23472
|
+
/**
|
|
23473
|
+
* Calculate the rewards info for a jup-lend market from pre-fetched state.
|
|
23474
|
+
*
|
|
23475
|
+
* @param lendingState - The on-chain Lending account
|
|
23476
|
+
* @param rewardsModel - The on-chain LendingRewardsRateModel account
|
|
23477
|
+
* @param fTokenTotalSupply - Total supply of the fToken
|
|
23478
|
+
* @returns Rewards result with rate, ended flag, and start time
|
|
23479
|
+
*/
|
|
23480
|
+
declare function getJupLendRewards(lendingState: JupLendingState, rewardsModel: JupLendingRewardsRateModel, fTokenTotalSupply: BN): JupLendRewardsResult;
|
|
23481
|
+
|
|
23482
|
+
declare const makeUpdateJupLendRateIx: (lending: PublicKey, mint: PublicKey, fTokenMint: PublicKey, supplyTokenReservesLiquidity: PublicKey, rewardsRateModel: PublicKey) => TransactionInstruction;
|
|
23483
|
+
|
|
23484
|
+
type MakeUpdateJupLendRateParams = {
|
|
23485
|
+
lendingState: JupLendingState;
|
|
23486
|
+
};
|
|
23487
|
+
declare function makeUpdateJupLendRate({ lendingState }: MakeUpdateJupLendRateParams): _solana_web3_js.TransactionInstruction;
|
|
23488
|
+
|
|
22569
23489
|
/** Number of slots that can pass before a publisher's price is no longer included in the aggregate. */
|
|
22570
23490
|
declare const MAX_SLOT_DIFFERENCE = 25;
|
|
22571
23491
|
interface Price {
|
|
@@ -23128,4 +24048,4 @@ declare const transferCheckedInstructionData: _solana_buffer_layout.Structure<Tr
|
|
|
23128
24048
|
*/
|
|
23129
24049
|
declare function createTransferCheckedInstruction(source: PublicKey, mint: PublicKey, destination: PublicKey, owner: PublicKey, amount: number | bigint, decimals: number, multiSigners?: Signer[], programId?: PublicKey): TransactionInstruction;
|
|
23130
24050
|
|
|
23131
|
-
export { ACCOUNT_SIZE, ACCOUNT_TYPE_SIZE, ASSOCIATED_TOKEN_PROGRAM_ID, type Account, AccountLayout, AccountState, AccountType, type Base, type CloseAccountInstructionData, CorpAction, CurvePointFields, DEFAULT_RECENT_SLOT_DURATION_MS, DRIFT_IDL, DRIFT_PROGRAM_ID, type DriftIdlType, type DriftInterestRateCurvePoint, DriftRewards, DriftRewardsJSON, DriftSpotBalanceType, DriftSpotMarket, DriftSpotMarketJSON, type DriftSpotMarketRaw, type DriftState, type DriftStateJSON, DriftUser, DriftUserJSON, type DriftUserRaw, DriftUserStats, DriftUserStatsJSON, type Ema, ExtensionType, FARMS_PROGRAM_ID, FarmStateJSON, FarmStateRaw, FeeStructure, FeeStructureJSON, HistoricalIndexData, HistoricalOracleData, type InitializeAccountInstructionData, InsuranceFund, KFARMS_IDL, KLEND_ACCOUNT_CODER, KLEND_IDL, KLEND_PROGRAM_ID, type KaminoReserveCurveData, type KfarmsIdlType, type KlendIdlType, type KlendInterestRateCurvePoint, LENGTH_SIZE, MAX_SLOT_DIFFERENCE, MEMO_PROGRAM_ID, MINT_SIZE, MULTISIG_SIZE, type Mint, MintLayout, type Multisig, MultisigLayout, NATIVE_MINT, ONE, ONE_HUNDRED_PCT_IN_BPS, ONE_YEAR, ObligationJSON, ObligationRaw, OracleGuardRails, OracleGuardRailsJSON, PERCENTAGE_PRECISION, PERCENTAGE_PRECISION_EXP, PoolBalance, type Price, type PriceComponent, type PriceData, PriceStatus, PriceType, REFRESH_OBLIGATION_DISCRIMINATOR, type RawAccount, type RawMint, type RawMultisig, type RefreshObligationAccounts, ReserveJSON, ReserveRaw, RewardInfoFields, SEED_BASE_REFERRER_STATE, SEED_BASE_REFERRER_TOKEN_STATE, SEED_BASE_SHORT_URL, SEED_BASE_USER_METADATA, SEED_DRIFT_SIGNER, SEED_DRIFT_STATE, SEED_FEE_RECEIVER, SEED_LENDING_MARKET_AUTH, SEED_RESERVE_COLL_MINT, SEED_RESERVE_COLL_SUPPLY, SEED_RESERVE_LIQ_SUPPLY, SEED_SPOT_MARKET, SEED_SPOT_MARKET_VAULT, SEED_USER, SEED_USER_STATE, SEED_USER_STATS, SLOTS_PER_DAY, SLOTS_PER_HOUR, SLOTS_PER_MINUTE, SLOTS_PER_SECOND, SLOTS_PER_YEAR, SPOT_MARKET_RATE_PRECISION, SPOT_MARKET_RATE_PRECISION_EXP, SPOT_MARKET_UTILIZATION_PRECISION, SPOT_MARKET_UTILIZATION_PRECISION_EXP, SinglePoolInstruction, SplAccountType, SpotPosition, type StakeAccount, type SyncNativeInstructionData, TEN, TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID, TYPE_SIZE, TokenAccountNotFoundError, TokenError, TokenInstruction, TokenInvalidAccountError, TokenInvalidAccountOwnerError, TokenInvalidAccountSizeError, TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, TokenInvalidMintError, TokenInvalidOwnerError, TokenOwnerOffCurveError, TokenUnsupportedInstructionError, type TransferCheckedInstructionData, ZERO, addSigners, calculateAPYFromAPR, calculateDriftBorrowAPR, calculateDriftBorrowAPY, calculateDriftBorrowRate, calculateDriftDepositRate, calculateDriftInterestRate, calculateDriftLendingAPR, calculateDriftLendingAPY, calculateDriftUtilization, calculateKaminoEstimatedBorrowRate, calculateKaminoEstimatedSupplyRate, calculateKaminoSupplyAPY, calculateRewardApy, calculateSlotAdjustmentFactor, calculateUtilizationRatio, closeAccountInstructionData, createAccountIx, createAssociatedTokenAccountIdempotentInstruction, createAssociatedTokenAccountInstruction, createCloseAccountInstruction, createInitializeAccountInstruction, createMemoInstruction, createPoolOnrampIx, createSyncNativeInstruction, createTransferCheckedInstruction, decodeDriftSpotMarketData, decodeDriftStateData, decodeDriftUserData, decodeDriftUserStatsData, decodeFarmDataRaw, decodeKlendObligationData, decodeKlendReserveData, deriveBaseObligation, deriveDriftSigner, deriveDriftSpotMarket, deriveDriftSpotMarketVault, deriveDriftState, deriveDriftUser, deriveDriftUserStats, deriveFeeReceiver, deriveLendingMarketAuthority, deriveObligation, deriveReferrerState, deriveReferrerTokenState, deriveReserveCollateralMint, deriveReserveCollateralSupply, deriveReserveLiquiditySupply, deriveShortUrl, deriveUserMetadata, deriveUserState, driftRewardsRawToDto, driftSpotMarketRawToDto, driftStateRawToDto, driftUserRawToDto, driftUserStatsRawToDto, dtoToDriftRewardsRaw, dtoToDriftSpotMarketRaw, dtoToDriftStateRaw, dtoToDriftUserRaw, dtoToDriftUserStatsRaw, dtoToFarmRaw, dtoToObligationRaw, dtoToReserveRaw, farmRawToDto, findMplMetadataAddress, findPoolAddress, findPoolMintAddress, findPoolMintAddressByVoteAccount, findPoolMintAuthorityAddress, findPoolMplAuthorityAddress, findPoolOnRampAddress, findPoolStakeAddress, findPoolStakeAuthorityAddress, generateDriftReserveCurve, generateKaminoReserveCurve, getAccount, getAccountLen, getAllDerivedDriftAccounts, getAllDerivedKaminoAccounts, getAllRequiredMarkets, getAssociatedTokenAddressSync, getDriftRewards, getDriftTokenAmount, getFixedHostInterestRate, getKaminoBorrowRate, getKaminoTotalSupply, getMinimumBalanceForRentExemptAccount, getMinimumBalanceForRentExemptAccountWithExtensions, getMint, getMultipleAccounts, getProtocolTakeRatePct, getReserveRewardsApy, getRewardPerTimeUnitSecond, getStakeAccount, initializeAccountInstructionData, initializeStakedPoolIxs, initializeStakedPoolTx, interpolateLinear, layout, makeRefreshObligationIx, makeRefreshReservesBatchIx, makeRefreshingIxs, makeUpdateSpotMarketCumulativeInterestIx, makeUpdateSpotMarketIx, obligationRawToDto, parsePriceData, parsePriceInfo, replenishPoolIx, reserveRawToDto, scaledSupplies, slotAdjustmentFactor, syncNativeInstructionData, transferCheckedInstructionData, truncateBorrowCurve, unpackAccount };
|
|
24051
|
+
export { ACCOUNT_SIZE, ACCOUNT_TYPE_SIZE, ASSOCIATED_TOKEN_PROGRAM_ID, type Account, AccountLayout, AccountState, AccountType, type Base, type CloseAccountInstructionData, CorpAction, CurvePointFields, DEFAULT_RECENT_SLOT_DURATION_MS, DRIFT_IDL, DRIFT_PROGRAM_ID, type DriftIdlType, type DriftInterestRateCurvePoint, DriftRewards, DriftRewardsJSON, DriftSpotBalanceType, DriftSpotMarket, DriftSpotMarketJSON, type DriftSpotMarketRaw, type DriftState, type DriftStateJSON, DriftUser, DriftUserJSON, type DriftUserRaw, DriftUserStats, DriftUserStatsJSON, type Ema, ExtensionType, FARMS_PROGRAM_ID, FarmStateJSON, FarmStateRaw, FeeStructure, FeeStructureJSON, HistoricalIndexData, HistoricalOracleData, type InitializeAccountInstructionData, InsuranceFund, JUP_EXCHANGE_PRICES_PRECISION, JUP_LEND_IDL, JUP_LEND_PROGRAM_ID, JUP_LIQUIDITY_PROGRAM_ID, JUP_MAX_REWARDS_RATE, JUP_REWARDS_PROGRAM_ID, JUP_SECONDS_PER_YEAR, type JupLendIdlType, type JupLendInterestRateCurvePoint, type JupLendRewardsResult, JupLendingRewardsRateModel, JupLendingRewardsRateModelJSON, type JupLendingRewardsRateModelRaw, JupLendingState, JupLendingStateJSON, type JupLendingStateRaw, JupRateModel, JupRateModelJSON, type JupRateModelRaw, JupTokenReserve, JupTokenReserveJSON, type JupTokenReserveRaw, KFARMS_IDL, KLEND_ACCOUNT_CODER, KLEND_IDL, KLEND_PROGRAM_ID, type KaminoReserveCurveData, type KfarmsIdlType, type KlendIdlType, type KlendInterestRateCurvePoint, LENGTH_SIZE, MAX_SLOT_DIFFERENCE, MEMO_PROGRAM_ID, MINT_SIZE, MULTISIG_SIZE, type Mint, MintLayout, type Multisig, MultisigLayout, NATIVE_MINT, ONE, ONE_HUNDRED_PCT_IN_BPS, ONE_YEAR, ObligationJSON, ObligationRaw, OracleGuardRails, OracleGuardRailsJSON, PERCENTAGE_PRECISION, PERCENTAGE_PRECISION_EXP, PoolBalance, type Price, type PriceComponent, type PriceData, PriceStatus, PriceType, REFRESH_OBLIGATION_DISCRIMINATOR, type RawAccount, type RawMint, type RawMultisig, type RefreshObligationAccounts, ReserveJSON, ReserveRaw, RewardInfoFields, SEED_BASE_REFERRER_STATE, SEED_BASE_REFERRER_TOKEN_STATE, SEED_BASE_SHORT_URL, SEED_BASE_USER_METADATA, SEED_DRIFT_SIGNER, SEED_DRIFT_STATE, SEED_FEE_RECEIVER, SEED_F_TOKEN_MINT, SEED_LENDING, SEED_LENDING_ADMIN, SEED_LENDING_MARKET_AUTH, SEED_LENDING_REWARDS_RATE_MODEL, SEED_LIQUIDITY, SEED_RATE_MODEL, SEED_RESERVE, SEED_RESERVE_COLL_MINT, SEED_RESERVE_COLL_SUPPLY, SEED_RESERVE_LIQ_SUPPLY, SEED_SPOT_MARKET, SEED_SPOT_MARKET_VAULT, SEED_USER, SEED_USER_CLAIM, SEED_USER_STATE, SEED_USER_STATS, SEED_USER_SUPPLY_POSITION, SLOTS_PER_DAY, SLOTS_PER_HOUR, SLOTS_PER_MINUTE, SLOTS_PER_SECOND, SLOTS_PER_YEAR, SPOT_MARKET_RATE_PRECISION, SPOT_MARKET_RATE_PRECISION_EXP, SPOT_MARKET_UTILIZATION_PRECISION, SPOT_MARKET_UTILIZATION_PRECISION_EXP, SinglePoolInstruction, SplAccountType, SpotPosition, type StakeAccount, type SyncNativeInstructionData, TEN, TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID, TYPE_SIZE, TokenAccountNotFoundError, TokenError, TokenInstruction, TokenInvalidAccountError, TokenInvalidAccountOwnerError, TokenInvalidAccountSizeError, TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, TokenInvalidMintError, TokenInvalidOwnerError, TokenOwnerOffCurveError, TokenUnsupportedInstructionError, type TransferCheckedInstructionData, ZERO, addSigners, calculateAPYFromAPR, calculateDriftBorrowAPR, calculateDriftBorrowAPY, calculateDriftBorrowRate, calculateDriftDepositRate, calculateDriftInterestRate, calculateDriftLendingAPR, calculateDriftLendingAPY, calculateDriftUtilization, calculateJupLendBorrowRate, calculateJupLendLiquiditySupplyRate, calculateJupLendNewExchangePrice, calculateJupLendRewardsRate, calculateJupLendRewardsRateForExchangePrice, calculateJupLendSupplyAPY, calculateJupLendSupplyRate, calculateJupLendTotalAssets, calculateKaminoEstimatedBorrowRate, calculateKaminoEstimatedSupplyRate, calculateKaminoSupplyAPY, calculateRewardApy, calculateSlotAdjustmentFactor, calculateUtilizationRatio, closeAccountInstructionData, createAccountIx, createAssociatedTokenAccountIdempotentInstruction, createAssociatedTokenAccountInstruction, createCloseAccountInstruction, createInitializeAccountInstruction, createMemoInstruction, createPoolOnrampIx, createSyncNativeInstruction, createTransferCheckedInstruction, decodeDriftSpotMarketData, decodeDriftStateData, decodeDriftUserData, decodeDriftUserStatsData, decodeFarmDataRaw, decodeJupLendingRewardsRateModelData, decodeJupLendingStateData, decodeJupRateModelData, decodeJupTokenReserveData, decodeKlendObligationData, decodeKlendReserveData, deriveBaseObligation, deriveDriftSigner, deriveDriftSpotMarket, deriveDriftSpotMarketVault, deriveDriftState, deriveDriftUser, deriveDriftUserStats, deriveFeeReceiver, deriveJupLendClaimAccount, deriveJupLendFTokenMint, deriveJupLendLending, deriveJupLendLendingAdmin, deriveJupLendLendingPdas, deriveJupLendLendingRewardsRateModel, deriveJupLendLiquidity, deriveJupLendLiquiditySupplyPositionPda, deriveJupLendLiquidityVaultAta, deriveJupLendRateModel, deriveJupLendTokenReserve, deriveLendingMarketAuthority, deriveObligation, deriveReferrerState, deriveReferrerTokenState, deriveReserveCollateralMint, deriveReserveCollateralSupply, deriveReserveLiquiditySupply, deriveShortUrl, deriveUserMetadata, deriveUserState, driftRewardsRawToDto, driftSpotMarketRawToDto, driftStateRawToDto, driftUserRawToDto, driftUserStatsRawToDto, dtoToDriftRewardsRaw, dtoToDriftSpotMarketRaw, dtoToDriftStateRaw, dtoToDriftUserRaw, dtoToDriftUserStatsRaw, dtoToFarmRaw, dtoToJupLendingRewardsRateModelRaw, dtoToJupLendingStateRaw, dtoToJupRateModelRaw, dtoToJupTokenReserveRaw, dtoToObligationRaw, dtoToReserveRaw, farmRawToDto, findMplMetadataAddress, findPoolAddress, findPoolMintAddress, findPoolMintAddressByVoteAccount, findPoolMintAuthorityAddress, findPoolMplAuthorityAddress, findPoolOnRampAddress, findPoolStakeAddress, findPoolStakeAuthorityAddress, generateDriftReserveCurve, generateJupLendSupplyCurve, generateKaminoReserveCurve, getAccount, getAccountLen, getAllDerivedDriftAccounts, getAllDerivedJupLendAccounts, getAllDerivedKaminoAccounts, getAllRequiredMarkets, getAssociatedTokenAddressSync, getDriftRewards, getDriftTokenAmount, getFixedHostInterestRate, getJupLendRewards, getKaminoBorrowRate, getKaminoTotalSupply, getMinimumBalanceForRentExemptAccount, getMinimumBalanceForRentExemptAccountWithExtensions, getMint, getMultipleAccounts, getProtocolTakeRatePct, getReserveRewardsApy, getRewardPerTimeUnitSecond, getStakeAccount, initializeAccountInstructionData, initializeStakedPoolIxs, initializeStakedPoolTx, interpolateLinear, jupLendingRewardsRateModelRawToDto, jupLendingStateRawToDto, jupRateModelRawToDto, jupTokenReserveRawToDto, layout, makeRefreshObligationIx, makeRefreshReservesBatchIx, makeRefreshingIxs, makeUpdateJupLendRate, makeUpdateJupLendRateIx, makeUpdateSpotMarketCumulativeInterestIx, makeUpdateSpotMarketIx, obligationRawToDto, parsePriceData, parsePriceInfo, replenishPoolIx, reserveRawToDto, scaledSupplies, slotAdjustmentFactor, syncNativeInstructionData, transferCheckedInstructionData, truncateBorrowCurve, unpackAccount };
|