@elmntl/jlpd-sdk 0.1.9 → 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
  };
@@ -3117,19 +3010,8 @@ interface SwapJlxJlpParams$1 {
3117
3010
  expectedOut: BN;
3118
3011
  quote: SwapQuote;
3119
3012
  }
3120
- interface SwapJlxJlxParams$1 {
3121
- manager: PublicKey;
3122
- fromPool: PoolName;
3123
- toPool: PoolName;
3124
- amountIn: BN;
3125
- minOut: BN;
3126
- quote: SwapQuote;
3127
- }
3128
3013
  interface SettleYieldParams {
3129
3014
  manager: PublicKey;
3130
- /** Manager-provided JLP rate (8 decimals, e.g., 460_000_000 = $4.60)
3131
- * Use fetchJlpRate() from jupiter/price to get this value */
3132
- jlpRate: BN;
3133
3015
  }
3134
3016
  /**
3135
3017
  * Main SDK client for JLP.D program
@@ -3222,13 +3104,6 @@ declare class SwapContext {
3222
3104
  slippageBps?: number;
3223
3105
  }): Promise<SwapQuote>;
3224
3106
  swapJlxJlp(params: SwapJlxJlpParams$1): Promise<VersionedTransaction>;
3225
- quoteJlxJlx(params: {
3226
- fromPool: PoolName;
3227
- toPool: PoolName;
3228
- amountIn: BN;
3229
- slippageBps?: number;
3230
- }): Promise<SwapQuote>;
3231
- swapJlxJlx(params: SwapJlxJlxParams$1): Promise<VersionedTransaction>;
3232
3107
  }
3233
3108
  /**
3234
3109
  * Context for admin operations
@@ -3283,8 +3158,9 @@ declare const ORACLES: {
3283
3158
  readonly DOVES_BTC_USD: PublicKey;
3284
3159
  readonly DOVES_ETH_USD: PublicKey;
3285
3160
  readonly DOVES_SOL_USD: PublicKey;
3286
- readonly PYTH_JLP_USD: PublicKey;
3287
3161
  };
3162
+ declare const JLP_POOL_PUBKEY: PublicKey;
3163
+ declare const JUPITER_PERPS_PROGRAM_ID: PublicKey;
3288
3164
 
3289
3165
  /**
3290
3166
  * Derive the JLP Vault PDA address (cached)
@@ -3593,13 +3469,6 @@ interface MoveJlxParams {
3593
3469
  amountJlx: BN;
3594
3470
  direction: MoveDirection;
3595
3471
  }
3596
- interface SwapJlxJlxParams {
3597
- fromIndex: number;
3598
- toIndex: number;
3599
- amountIn: BN;
3600
- minOut: BN;
3601
- jupiterData: Buffer;
3602
- }
3603
3472
  interface SwapJlxJlpParams {
3604
3473
  stvIndex: number;
3605
3474
  direction: SwapDirection;
@@ -3626,16 +3495,6 @@ interface MoveStvAccounts {
3626
3495
  vaultStagingAta: PublicKey;
3627
3496
  tokenProgram: PublicKey;
3628
3497
  }
3629
- interface SwapJlxJlxAccounts {
3630
- manager: PublicKey;
3631
- jlpVault: PublicKey;
3632
- fromJlxMint: PublicKey;
3633
- toJlxMint: PublicKey;
3634
- fromJlxAta: PublicKey;
3635
- toJlxAta: PublicKey;
3636
- tokenProgram: PublicKey;
3637
- jupiterProgram: PublicKey;
3638
- }
3639
3498
  interface SwapJlxJlpAccounts {
3640
3499
  manager: PublicKey;
3641
3500
  jlpVault: PublicKey;
@@ -3663,15 +3522,13 @@ interface SettleYieldAccounts {
3663
3522
  oracleBtc: PublicKey;
3664
3523
  oracleEth: PublicKey;
3665
3524
  oracleSol: PublicKey;
3666
- oracleJlp: PublicKey;
3525
+ jlpPool: PublicKey;
3526
+ jlpMintAccount: PublicKey;
3667
3527
  }
3668
3528
  interface SettleYieldInstructionParams {
3669
- /** Manager-provided JLP rate (8 decimals, e.g., 460_000_000 = $4.60) */
3670
- jlpRate: BN;
3671
3529
  }
3672
3530
  declare function createJupEarnInstruction(program: Program<JlpDProgram>, params: JupEarnParams, accounts: JupEarnAccounts, remainingAccounts?: AccountMeta[]): Promise<TransactionInstruction>;
3673
3531
  declare function createMoveJlxInstruction(program: Program<JlpDProgram>, params: MoveJlxParams, accounts: MoveStvAccounts, remainingAccounts?: AccountMeta[]): Promise<TransactionInstruction>;
3674
- declare function createSwapJlxJlxInstruction(program: Program<JlpDProgram>, params: SwapJlxJlxParams, accounts: SwapJlxJlxAccounts, remainingAccounts?: AccountMeta[]): Promise<TransactionInstruction>;
3675
3532
  declare function createSwapJlxJlpInstruction(program: Program<JlpDProgram>, params: SwapJlxJlpParams, accounts: SwapJlxJlpAccounts, remainingAccounts?: AccountMeta[]): Promise<TransactionInstruction>;
3676
3533
  declare function createSettleYieldInstruction(program: Program<JlpDProgram>, params: SettleYieldInstructionParams, accounts: SettleYieldAccounts, remainingAccounts?: AccountMeta[]): Promise<TransactionInstruction>;
3677
3534
 
@@ -3692,4 +3549,4 @@ interface ClaimFeesAccounts {
3692
3549
  */
3693
3550
  declare function createClaimFeesInstruction(program: Program<JlpDProgram>, accounts: ClaimFeesAccounts, remainingAccounts?: AccountMeta[]): Promise<TransactionInstruction>;
3694
3551
 
3695
- 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 };