@elmntl/jlpd-sdk 0.1.8 → 0.1.11

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/index.d.mts CHANGED
@@ -797,17 +797,15 @@ type JlpDProgram = {
797
797
  "2. Values total base_loaned across all STVs in USD",
798
798
  "3. Distributes surplus (yield) or deficit (bad debt) proportionally",
799
799
  "",
800
- "# Parameters",
801
- "- `jlp_rate`: Manager-provided JLP price (8 decimals), cross-checked against Pyth",
802
- "",
803
800
  "# Security",
804
801
  "- BTC/ETH/SOL prices come from Doves oracles (manipulation-resistant)",
805
- "- JLP price from Pyth oracle, validated against manager rate (50 bps tolerance)",
802
+ "- JLP price computed directly from Jupiter Perps Pool account (aumUsd / jlp_supply)",
806
803
  "- Exchange rates come from Jupiter Earn (audited, TWAP-based)",
807
804
  "- Distribution is proportional to each STV's share of total loans",
808
805
  "",
809
806
  "# Accounts",
810
- "Requires all 5 STVs, 5 staging jlX ATAs, 3 Doves oracles (BTC/ETH/SOL), 1 Pyth oracle (JLP)",
807
+ "Requires all 5 STVs, 5 staging jlX ATAs, 3 Doves oracles (BTC/ETH/SOL),",
808
+ "Jupiter Perps Pool account, JLP mint account",
811
809
  "",
812
810
  "# Remaining Accounts (15 accounts)",
813
811
  "For exchange rate calculation with time-accrued rewards:",
@@ -881,7 +879,10 @@ type JlpDProgram = {
881
879
  "name": "dovesSolUsd";
882
880
  },
883
881
  {
884
- "name": "pythJlpUsd";
882
+ "name": "jlpPool";
883
+ },
884
+ {
885
+ "name": "jlpMintAccount";
885
886
  },
886
887
  {
887
888
  "name": "manager";
@@ -891,100 +892,15 @@ type JlpDProgram = {
891
892
  "signer": true;
892
893
  }
893
894
  ];
894
- "args": [
895
- {
896
- "name": "params";
897
- "type": {
898
- "defined": {
899
- "name": "settleYieldParams";
900
- };
901
- };
902
- }
903
- ];
895
+ "args": [];
904
896
  },
905
897
  {
906
- "name": "swapJlxJlx";
898
+ "name": "swapJlxToFromJlp";
907
899
  "docs": [
908
900
  "Swap between different jlX types (e.g., jlSOL -> jlUSDC) via Jupiter",
909
901
  "Manager-only operation for rebalancing vault composition",
910
902
  "",
911
- "Remaining accounts: Jupiter swap accounts from API (varies based on route)"
912
- ];
913
- "discriminator": [
914
- 24,
915
- 52,
916
- 70,
917
- 107,
918
- 160,
919
- 96,
920
- 155,
921
- 62
922
- ];
923
- "accounts": [
924
- {
925
- "name": "manager";
926
- "docs": [
927
- "Manager performing the swap"
928
- ];
929
- "signer": true;
930
- },
931
- {
932
- "name": "jlpVault";
933
- "docs": [
934
- "The JLP Vault PDA account",
935
- "Note: PDA and manager verified in handler via get_pda() to avoid multiple loads"
936
- ];
937
- },
938
- {
939
- "name": "fromJlxMint";
940
- "docs": [
941
- "Source jlX mint"
942
- ];
943
- },
944
- {
945
- "name": "toJlxMint";
946
- "docs": [
947
- "Destination jlX mint"
948
- ];
949
- },
950
- {
951
- "name": "fromJlxAta";
952
- "docs": [
953
- "Source jlX staging ATA (vault-owned)"
954
- ];
955
- "writable": true;
956
- },
957
- {
958
- "name": "toJlxAta";
959
- "docs": [
960
- "Destination jlX staging ATA (vault-owned)"
961
- ];
962
- "writable": true;
963
- },
964
- {
965
- "name": "tokenProgram";
966
- },
967
- {
968
- "name": "jupiterProgram";
969
- "docs": [
970
- "Jupiter aggregator program"
971
- ];
972
- }
973
- ];
974
- "args": [
975
- {
976
- "name": "params";
977
- "type": {
978
- "defined": {
979
- "name": "swapJlxJlxParams";
980
- };
981
- };
982
- }
983
- ];
984
- },
985
- {
986
- "name": "swapJlxToFromJlp";
987
- "docs": [
903
+ "Remaining accounts: Jupiter swap accounts from API (varies based on route)",
988
904
  "Swap between jlX and JLP tokens via Jupiter",
989
905
  "JlxToJlp: Swap jlX -> JLP (increase vault JLP balance)",
990
906
  "JlpToJlx: Swap JLP -> jlX (decrease vault JLP balance)",
@@ -1676,8 +1592,8 @@ type JlpDProgram = {
1676
1592
  },
1677
1593
  {
1678
1594
  "code": 6043;
1679
- "name": "jlpRateExceedsTolerance";
1680
- "msg": "Manager JLP rate exceeds tolerance vs Pyth oracle (>50 bps)";
1595
+ "name": "jlpPriceOutOfRange";
1596
+ "msg": "JLP price out of reasonable range ($0.50 - $50.00)";
1681
1597
  },
1682
1598
  {
1683
1599
  "code": 6044;
@@ -2542,25 +2458,6 @@ type JlpDProgram = {
2542
2458
  ];
2543
2459
  };
2544
2460
  },
2545
- {
2546
- "name": "settleYieldParams";
2547
- "docs": [
2548
- "Parameters for settle_yield instruction"
2549
- ];
2550
- "type": {
2551
- "kind": "struct";
2552
- "fields": [
2553
- {
2554
- "name": "jlpRate";
2555
- "docs": [
2556
- "Manager-provided JLP rate (8 decimals, e.g., 450000000 = $4.50)",
2557
- "Cross-checked against Pyth oracle, must be within 50 bps tolerance"
2558
- ];
2559
- "type": "u64";
2560
- }
2561
- ];
2562
- };
2563
- },
2564
2461
  {
2565
2462
  "name": "settleYieldSkipped";
2566
2463
  "docs": [
@@ -2708,6 +2605,14 @@ type JlpDProgram = {
2708
2605
  {
2709
2606
  "name": "newMinDeposit";
2710
2607
  "type": "u64";
2608
+ },
2609
+ {
2610
+ "name": "oldJlMint";
2611
+ "type": "pubkey";
2612
+ },
2613
+ {
2614
+ "name": "newJlMint";
2615
+ "type": "pubkey";
2711
2616
  }
2712
2617
  ];
2713
2618
  };
@@ -2781,54 +2686,6 @@ type JlpDProgram = {
2781
2686
  ];
2782
2687
  };
2783
2688
  },
2784
- {
2785
- "name": "swapJlxJlxParams";
2786
- "docs": [
2787
- "Parameters for swapping between different jlX types"
2788
- ];
2789
- "type": {
2790
- "kind": "struct";
2791
- "fields": [
2792
- {
2793
- "name": "fromIndex";
2794
- "docs": [
2795
- "Source jlX type index (0=BTC, 1=ETH, 2=SOL, 3=USDC, 4=JupUSD)"
2796
- ];
2797
- "type": "u8";
2798
- },
2799
- {
2800
- "name": "toIndex";
2801
- "docs": [
2802
- "Destination jlX type index"
2803
- ];
2804
- "type": "u8";
2805
- },
2806
- {
2807
- "name": "amountIn";
2808
- "docs": [
2809
- "Amount of source jlX to swap"
2810
- ];
2811
- "type": "u64";
2812
- },
2813
- {
2814
- "name": "minOut";
2815
- "docs": [
2816
- "Minimum output amount (slippage protection)"
2817
- ];
2818
- "type": "u64";
2819
- },
2820
- {
2821
- "name": "jupiterData";
2822
- "docs": [
2823
- "Jupiter swap instruction data (includes discriminator and route)",
2824
- "This is obtained from Jupiter API off-chain",
2825
- "On devnet/localnet (with feature flags), this can be empty"
2826
- ];
2827
- "type": "bytes";
2828
- }
2829
- ];
2830
- };
2831
- },
2832
2689
  {
2833
2690
  "name": "updateStvParams";
2834
2691
  "docs": [
@@ -2871,6 +2728,42 @@ type JlpDProgram = {
2871
2728
  "Minimum deposit amount in base asset (0 = no minimum)"
2872
2729
  ];
2873
2730
  "type": "u64";
2731
+ },
2732
+ {
2733
+ "name": "jlMint";
2734
+ "docs": [
2735
+ "Optional new jl_mint for migrating base-only pools to Jupiter Lend"
2736
+ ];
2737
+ "type": {
2738
+ "option": "pubkey";
2739
+ };
2740
+ },
2741
+ {
2742
+ "name": "pps";
2743
+ "docs": [
2744
+ "Override price per share (9 decimals, e.g. 1_000_000_000 = 1.0)"
2745
+ ];
2746
+ "type": {
2747
+ "option": "u64";
2748
+ };
2749
+ },
2750
+ {
2751
+ "name": "hwm";
2752
+ "docs": [
2753
+ "Override high water mark (9 decimals)"
2754
+ ];
2755
+ "type": {
2756
+ "option": "u64";
2757
+ };
2758
+ },
2759
+ {
2760
+ "name": "baseLoaned";
2761
+ "docs": [
2762
+ "Override base_loaned accounting field"
2763
+ ];
2764
+ "type": {
2765
+ "option": "u64";
2766
+ };
2874
2767
  }
2875
2768
  ];
2876
2769
  };
@@ -3025,6 +2918,9 @@ interface UpdateStvParams$1 {
3025
2918
  minDeposit?: BN;
3026
2919
  flags?: number;
3027
2920
  jlMint?: PublicKey;
2921
+ pps?: BN;
2922
+ hwm?: BN;
2923
+ baseLoaned?: BN;
3028
2924
  }
3029
2925
  interface InitializeStvParams$1 {
3030
2926
  poolName: PoolName;
@@ -3114,19 +3010,8 @@ interface SwapJlxJlpParams$1 {
3114
3010
  expectedOut: BN;
3115
3011
  quote: SwapQuote;
3116
3012
  }
3117
- interface SwapJlxJlxParams$1 {
3118
- manager: PublicKey;
3119
- fromPool: PoolName;
3120
- toPool: PoolName;
3121
- amountIn: BN;
3122
- minOut: BN;
3123
- quote: SwapQuote;
3124
- }
3125
3013
  interface SettleYieldParams {
3126
3014
  manager: PublicKey;
3127
- /** Manager-provided JLP rate (8 decimals, e.g., 460_000_000 = $4.60)
3128
- * Use fetchJlpRate() from jupiter/price to get this value */
3129
- jlpRate: BN;
3130
3015
  }
3131
3016
  /**
3132
3017
  * Main SDK client for JLP.D program
@@ -3219,13 +3104,6 @@ declare class SwapContext {
3219
3104
  slippageBps?: number;
3220
3105
  }): Promise<SwapQuote>;
3221
3106
  swapJlxJlp(params: SwapJlxJlpParams$1): Promise<VersionedTransaction>;
3222
- quoteJlxJlx(params: {
3223
- fromPool: PoolName;
3224
- toPool: PoolName;
3225
- amountIn: BN;
3226
- slippageBps?: number;
3227
- }): Promise<SwapQuote>;
3228
- swapJlxJlx(params: SwapJlxJlxParams$1): Promise<VersionedTransaction>;
3229
3107
  }
3230
3108
  /**
3231
3109
  * Context for admin operations
@@ -3280,8 +3158,9 @@ declare const ORACLES: {
3280
3158
  readonly DOVES_BTC_USD: PublicKey;
3281
3159
  readonly DOVES_ETH_USD: PublicKey;
3282
3160
  readonly DOVES_SOL_USD: PublicKey;
3283
- readonly PYTH_JLP_USD: PublicKey;
3284
3161
  };
3162
+ declare const JLP_POOL_PUBKEY: PublicKey;
3163
+ declare const JUPITER_PERPS_PROGRAM_ID: PublicKey;
3285
3164
 
3286
3165
  /**
3287
3166
  * Derive the JLP Vault PDA address (cached)
@@ -3523,6 +3402,9 @@ interface UpdateStvParams {
3523
3402
  maxDeposit: BN;
3524
3403
  minDeposit: BN;
3525
3404
  jlMint: PublicKey | null;
3405
+ pps: BN | null;
3406
+ hwm: BN | null;
3407
+ baseLoaned: BN | null;
3526
3408
  }
3527
3409
  interface InitOrUpdateJlpVaultAccounts {
3528
3410
  admin: PublicKey;
@@ -3587,13 +3469,6 @@ interface MoveJlxParams {
3587
3469
  amountJlx: BN;
3588
3470
  direction: MoveDirection;
3589
3471
  }
3590
- interface SwapJlxJlxParams {
3591
- fromIndex: number;
3592
- toIndex: number;
3593
- amountIn: BN;
3594
- minOut: BN;
3595
- jupiterData: Buffer;
3596
- }
3597
3472
  interface SwapJlxJlpParams {
3598
3473
  stvIndex: number;
3599
3474
  direction: SwapDirection;
@@ -3620,16 +3495,6 @@ interface MoveStvAccounts {
3620
3495
  vaultStagingAta: PublicKey;
3621
3496
  tokenProgram: PublicKey;
3622
3497
  }
3623
- interface SwapJlxJlxAccounts {
3624
- manager: PublicKey;
3625
- jlpVault: PublicKey;
3626
- fromJlxMint: PublicKey;
3627
- toJlxMint: PublicKey;
3628
- fromJlxAta: PublicKey;
3629
- toJlxAta: PublicKey;
3630
- tokenProgram: PublicKey;
3631
- jupiterProgram: PublicKey;
3632
- }
3633
3498
  interface SwapJlxJlpAccounts {
3634
3499
  manager: PublicKey;
3635
3500
  jlpVault: PublicKey;
@@ -3657,15 +3522,13 @@ interface SettleYieldAccounts {
3657
3522
  oracleBtc: PublicKey;
3658
3523
  oracleEth: PublicKey;
3659
3524
  oracleSol: PublicKey;
3660
- oracleJlp: PublicKey;
3525
+ jlpPool: PublicKey;
3526
+ jlpMintAccount: PublicKey;
3661
3527
  }
3662
3528
  interface SettleYieldInstructionParams {
3663
- /** Manager-provided JLP rate (8 decimals, e.g., 460_000_000 = $4.60) */
3664
- jlpRate: BN;
3665
3529
  }
3666
3530
  declare function createJupEarnInstruction(program: Program<JlpDProgram>, params: JupEarnParams, accounts: JupEarnAccounts, remainingAccounts?: AccountMeta[]): Promise<TransactionInstruction>;
3667
3531
  declare function createMoveJlxInstruction(program: Program<JlpDProgram>, params: MoveJlxParams, accounts: MoveStvAccounts, remainingAccounts?: AccountMeta[]): Promise<TransactionInstruction>;
3668
- declare function createSwapJlxJlxInstruction(program: Program<JlpDProgram>, params: SwapJlxJlxParams, accounts: SwapJlxJlxAccounts, remainingAccounts?: AccountMeta[]): Promise<TransactionInstruction>;
3669
3532
  declare function createSwapJlxJlpInstruction(program: Program<JlpDProgram>, params: SwapJlxJlpParams, accounts: SwapJlxJlpAccounts, remainingAccounts?: AccountMeta[]): Promise<TransactionInstruction>;
3670
3533
  declare function createSettleYieldInstruction(program: Program<JlpDProgram>, params: SettleYieldInstructionParams, accounts: SettleYieldAccounts, remainingAccounts?: AccountMeta[]): Promise<TransactionInstruction>;
3671
3534
 
@@ -3686,4 +3549,4 @@ interface ClaimFeesAccounts {
3686
3549
  */
3687
3550
  declare function createClaimFeesInstruction(program: Program<JlpDProgram>, accounts: ClaimFeesAccounts, remainingAccounts?: AccountMeta[]): Promise<TransactionInstruction>;
3688
3551
 
3689
- export { type AccountMeta, AdminContext, type ClaimFeesAccounts, type ClaimFeesParams, type DepositAccounts, type DepositParams, EXCHANGE_RATE_PRECISION, type ExchangeRateResult, FLAG_DEPOSITS_DISABLED, FLAG_JLP_DISABLED, FLAG_PAUSED, FLAG_REBALANCE_DISABLED, FLAG_WITHDRAWALS_DISABLED, type InitOrUpdateJlpVaultAccounts, type InitOrUpdateJlpVaultParams, type InitializeStvAccounts, type InitializeStvParams$1 as InitializeStvParams, JLPD_PROGRAM_ID, type JLPVault, JLP_VAULT_ACCOUNT_SIZE, JLP_VAULT_DATA_SIZE, JLP_VAULT_DISCRIMINATOR, JUPITER_LEND_PROGRAM_ID$1 as JUPITER_LEND_PROGRAM_ID, JUPITER_SWAP_PROGRAM_ID, JUPUSD_POOL, JUPITER_LEND_PROGRAM_ID as JUP_LEND_PROGRAM_ID, type JlpDProgram, JlpdClient, JlpdClientError, type JupEarnAccounts, type JupEarnDirection, type JupEarnParams$1 as JupEarnParams, type JupiterLendPool, type JupiterPriceData, type JupiterPriceResponse, type JupiterQuoteResponse, type JupiterSwapInstructionsResponse, LENDING_ADMIN, LIQUIDITY_PROGRAM_ID, LIQUIDITY_SINGLETON, type LendingAccountData, MINTS, type MoveDirection, type MoveJlxParams$1 as MoveJlxParams, type MoveStvAccounts, ORACLES, POOLS, PPS_DECIMALS, PoolContext, type PoolName, type RewardsRateModelData, SEED_JLP_VAULT, SEED_STV, type STV, STV_ACCOUNT_SIZE, STV_DATA_SIZE, STV_DISCRIMINATOR, STV_INDEX, type SerializedInstruction, type SettleYieldAccounts, type SettleYieldInstructionParams, type SettleYieldParams, SwapContext, type SwapDirection, type SwapJlxJlpAccounts, type SwapJlxJlpParams$1 as SwapJlxJlpParams, type SwapJlxJlxAccounts, type SwapJlxJlxParams$1 as SwapJlxJlxParams, type SwapQuote, USDC_POOL, type UpdateStvAccounts, type UpdateStvParams$1 as UpdateStvParams, type UpdateVaultParams, WBTC_POOL, WETH_POOL, WSOL_POOL, type WithdrawAccounts, type WithdrawParams, baseToJlx, baseToShares, buildExchangeRateAccounts, buildJupEarnDepositAccounts, buildJupEarnWithdrawAccounts, buildSwapData, calculateExchangeRate, calculateNav, calculatePps, clearAtaCache, clearPdaCache, createClaimFeesInstruction, createDepositInstruction, createInitOrUpdateVaultInstruction, createInitializeStvInstruction, createJupEarnInstruction, createMoveJlxInstruction, createProgram, createSettleYieldInstruction, createSwapJlxJlpInstruction, createSwapJlxJlxInstruction, createUpdateStvInstruction, createWithdrawInstruction, deriveAta, deriveStvAtas, deriveStvPda, deriveUserAtas, deriveVaultAtas, deriveVaultPda, fetchAddressLookupTables, fetchJlpRate, fetchJupiterPriceUsd, getJupiterQuote, getJupiterSwapInstructions, getPoolByMint, getPoolByName, jlxToBase, parseLendingAccount, parseRewardsRateModel, parseStv, parseSwapRemainingAccounts, parseVault, sharesToBase };
3552
+ export { type AccountMeta, AdminContext, type ClaimFeesAccounts, type ClaimFeesParams, type DepositAccounts, type DepositParams, EXCHANGE_RATE_PRECISION, type ExchangeRateResult, FLAG_DEPOSITS_DISABLED, FLAG_JLP_DISABLED, FLAG_PAUSED, FLAG_REBALANCE_DISABLED, FLAG_WITHDRAWALS_DISABLED, type InitOrUpdateJlpVaultAccounts, type InitOrUpdateJlpVaultParams, type InitializeStvAccounts, type InitializeStvParams$1 as InitializeStvParams, JLPD_PROGRAM_ID, type JLPVault, JLP_POOL_PUBKEY, JLP_VAULT_ACCOUNT_SIZE, JLP_VAULT_DATA_SIZE, JLP_VAULT_DISCRIMINATOR, JUPITER_LEND_PROGRAM_ID$1 as JUPITER_LEND_PROGRAM_ID, JUPITER_PERPS_PROGRAM_ID, JUPITER_SWAP_PROGRAM_ID, JUPUSD_POOL, JUPITER_LEND_PROGRAM_ID as JUP_LEND_PROGRAM_ID, type JlpDProgram, JlpdClient, JlpdClientError, type JupEarnAccounts, type JupEarnDirection, type JupEarnParams$1 as JupEarnParams, type JupiterLendPool, type JupiterPriceData, type JupiterPriceResponse, type JupiterQuoteResponse, type JupiterSwapInstructionsResponse, LENDING_ADMIN, LIQUIDITY_PROGRAM_ID, LIQUIDITY_SINGLETON, type LendingAccountData, MINTS, type MoveDirection, type MoveJlxParams$1 as MoveJlxParams, type MoveStvAccounts, ORACLES, POOLS, PPS_DECIMALS, PoolContext, type PoolName, type RewardsRateModelData, SEED_JLP_VAULT, SEED_STV, type STV, STV_ACCOUNT_SIZE, STV_DATA_SIZE, STV_DISCRIMINATOR, STV_INDEX, type SerializedInstruction, type SettleYieldAccounts, type SettleYieldInstructionParams, type SettleYieldParams, SwapContext, type SwapDirection, type SwapJlxJlpAccounts, type SwapJlxJlpParams$1 as SwapJlxJlpParams, type SwapQuote, USDC_POOL, type UpdateStvAccounts, type UpdateStvParams$1 as UpdateStvParams, type UpdateVaultParams, WBTC_POOL, WETH_POOL, WSOL_POOL, type WithdrawAccounts, type WithdrawParams, baseToJlx, baseToShares, buildExchangeRateAccounts, buildJupEarnDepositAccounts, buildJupEarnWithdrawAccounts, buildSwapData, calculateExchangeRate, calculateNav, calculatePps, clearAtaCache, clearPdaCache, createClaimFeesInstruction, createDepositInstruction, createInitOrUpdateVaultInstruction, createInitializeStvInstruction, createJupEarnInstruction, createMoveJlxInstruction, createProgram, createSettleYieldInstruction, createSwapJlxJlpInstruction, createUpdateStvInstruction, createWithdrawInstruction, deriveAta, deriveStvAtas, deriveStvPda, deriveUserAtas, deriveVaultAtas, deriveVaultPda, fetchAddressLookupTables, fetchJlpRate, fetchJupiterPriceUsd, getJupiterQuote, getJupiterSwapInstructions, getPoolByMint, getPoolByName, jlxToBase, parseLendingAccount, parseRewardsRateModel, parseStv, parseSwapRemainingAccounts, parseVault, sharesToBase };