@elmntl/jlpd-sdk 0.1.11 → 0.13.4

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.
Files changed (115) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +185 -404
  3. package/dist/common/ata.d.ts +26 -0
  4. package/dist/common/ata.js +48 -0
  5. package/dist/common/buffer.d.ts +15 -0
  6. package/dist/common/buffer.js +118 -0
  7. package/dist/common/connection.d.ts +13 -0
  8. package/dist/common/connection.js +2 -0
  9. package/dist/common/constants.d.ts +14 -0
  10. package/dist/common/constants.js +31 -0
  11. package/dist/common/index.d.ts +6 -0
  12. package/dist/common/index.js +28 -0
  13. package/dist/common/strategy-interface.d.ts +59 -0
  14. package/dist/common/strategy-interface.js +42 -0
  15. package/dist/elemental-lend/accounts.d.ts +103 -0
  16. package/dist/elemental-lend/accounts.js +354 -0
  17. package/dist/elemental-lend/constants.d.ts +25 -0
  18. package/dist/elemental-lend/constants.js +48 -0
  19. package/dist/elemental-lend/index.d.ts +8 -0
  20. package/dist/elemental-lend/index.js +24 -0
  21. package/dist/elemental-lend/instructions.d.ts +104 -0
  22. package/dist/elemental-lend/instructions.js +266 -0
  23. package/dist/elemental-lend/jupiter-lend.d.ts +91 -0
  24. package/dist/elemental-lend/jupiter-lend.js +189 -0
  25. package/dist/elemental-lend/kamino-vault.d.ts +173 -0
  26. package/dist/elemental-lend/kamino-vault.js +483 -0
  27. package/dist/elemental-lend/pda.d.ts +12 -0
  28. package/dist/elemental-lend/pda.js +24 -0
  29. package/dist/elemental-lend/protocol-actions.d.ts +56 -0
  30. package/dist/elemental-lend/protocol-actions.js +244 -0
  31. package/dist/elemental-lend/types.d.ts +113 -0
  32. package/dist/elemental-lend/types.js +2 -0
  33. package/dist/elemental-lend-v2/accounts.d.ts +14 -0
  34. package/dist/elemental-lend-v2/accounts.js +136 -0
  35. package/dist/elemental-lend-v2/adapters.d.ts +22 -0
  36. package/dist/elemental-lend-v2/adapters.js +50 -0
  37. package/dist/elemental-lend-v2/constants.d.ts +48 -0
  38. package/dist/elemental-lend-v2/constants.js +104 -0
  39. package/dist/elemental-lend-v2/index.d.ts +8 -0
  40. package/dist/elemental-lend-v2/index.js +24 -0
  41. package/dist/elemental-lend-v2/instructions.d.ts +96 -0
  42. package/dist/elemental-lend-v2/instructions.js +190 -0
  43. package/dist/elemental-lend-v2/lut.d.ts +20 -0
  44. package/dist/elemental-lend-v2/lut.js +65 -0
  45. package/dist/elemental-lend-v2/pda.d.ts +9 -0
  46. package/dist/elemental-lend-v2/pda.js +27 -0
  47. package/dist/elemental-lend-v2/types.d.ts +105 -0
  48. package/dist/elemental-lend-v2/types.js +2 -0
  49. package/dist/elemental-lend-v2/update-aum.d.ts +29 -0
  50. package/dist/elemental-lend-v2/update-aum.js +82 -0
  51. package/dist/index.d.ts +5 -3552
  52. package/dist/index.js +37 -4454
  53. package/dist/jlpd-strategy/accounts.d.ts +83 -0
  54. package/dist/jlpd-strategy/accounts.js +216 -0
  55. package/dist/jlpd-strategy/adapter.d.ts +81 -0
  56. package/dist/jlpd-strategy/adapter.js +118 -0
  57. package/dist/jlpd-strategy/base-to-base-swap.d.ts +74 -0
  58. package/dist/jlpd-strategy/base-to-base-swap.js +205 -0
  59. package/dist/jlpd-strategy/constants.d.ts +127 -0
  60. package/dist/jlpd-strategy/constants.js +174 -0
  61. package/dist/jlpd-strategy/fluid-view.d.ts +199 -0
  62. package/dist/jlpd-strategy/fluid-view.js +799 -0
  63. package/dist/jlpd-strategy/hedge-derived.d.ts +135 -0
  64. package/dist/jlpd-strategy/hedge-derived.js +231 -0
  65. package/dist/jlpd-strategy/hedge-instructions.d.ts +210 -0
  66. package/dist/jlpd-strategy/hedge-instructions.js +300 -0
  67. package/dist/jlpd-strategy/hedge-state.d.ts +88 -0
  68. package/dist/jlpd-strategy/hedge-state.js +110 -0
  69. package/dist/jlpd-strategy/index.d.ts +17 -0
  70. package/dist/jlpd-strategy/index.js +33 -0
  71. package/dist/jlpd-strategy/instructions.d.ts +159 -0
  72. package/dist/jlpd-strategy/instructions.js +234 -0
  73. package/dist/jlpd-strategy/jlp-borrow.d.ts +63 -0
  74. package/dist/jlpd-strategy/jlp-borrow.js +87 -0
  75. package/dist/jlpd-strategy/jlp-data.d.ts +166 -0
  76. package/dist/jlpd-strategy/jlp-data.js +611 -0
  77. package/dist/jlpd-strategy/jupusd-earn.d.ts +90 -0
  78. package/dist/jlpd-strategy/jupusd-earn.js +166 -0
  79. package/dist/jlpd-strategy/live-jlp-price.d.ts +46 -0
  80. package/dist/jlpd-strategy/live-jlp-price.js +267 -0
  81. package/dist/jlpd-strategy/pda.d.ts +13 -0
  82. package/dist/jlpd-strategy/pda.js +28 -0
  83. package/dist/jlpd-strategy/settle-yield.d.ts +45 -0
  84. package/dist/jlpd-strategy/settle-yield.js +113 -0
  85. package/dist/jlpd-strategy/swap-jlp.d.ts +198 -0
  86. package/dist/jlpd-strategy/swap-jlp.js +586 -0
  87. package/dist/jlpd-strategy/types.d.ts +101 -0
  88. package/dist/jlpd-strategy/types.js +29 -0
  89. package/dist/p-stv-core/accounts.d.ts +152 -0
  90. package/dist/p-stv-core/accounts.js +407 -0
  91. package/dist/p-stv-core/constants.d.ts +138 -0
  92. package/dist/p-stv-core/constants.js +181 -0
  93. package/dist/p-stv-core/events.d.ts +7 -0
  94. package/dist/p-stv-core/events.js +246 -0
  95. package/dist/p-stv-core/index.d.ts +11 -0
  96. package/dist/p-stv-core/index.js +27 -0
  97. package/dist/p-stv-core/instructions.d.ts +637 -0
  98. package/dist/p-stv-core/instructions.js +670 -0
  99. package/dist/p-stv-core/lut.d.ts +41 -0
  100. package/dist/p-stv-core/lut.js +81 -0
  101. package/dist/p-stv-core/pda.d.ts +30 -0
  102. package/dist/p-stv-core/pda.js +65 -0
  103. package/dist/p-stv-core/prices.d.ts +20 -0
  104. package/dist/p-stv-core/prices.js +77 -0
  105. package/dist/p-stv-core/remaining-accounts.d.ts +107 -0
  106. package/dist/p-stv-core/remaining-accounts.js +326 -0
  107. package/dist/p-stv-core/send-tx.d.ts +72 -0
  108. package/dist/p-stv-core/send-tx.js +290 -0
  109. package/dist/p-stv-core/sol-wrap.d.ts +34 -0
  110. package/dist/p-stv-core/sol-wrap.js +74 -0
  111. package/dist/p-stv-core/types.d.ts +361 -0
  112. package/dist/p-stv-core/types.js +2 -0
  113. package/package.json +56 -15
  114. package/dist/index.d.mts +0 -3552
  115. package/dist/index.mjs +0 -4363
@@ -0,0 +1,205 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createBaseToBaseSwapIx = createBaseToBaseSwapIx;
4
+ exports.buildBaseToBaseSwapTransaction = buildBaseToBaseSwapTransaction;
5
+ const web3_js_1 = require("@solana/web3.js");
6
+ const spl_token_1 = require("@solana/spl-token");
7
+ const ata_1 = require("../common/ata");
8
+ const constants_1 = require("./constants");
9
+ const pda_1 = require("./pda");
10
+ const accounts_1 = require("./accounts");
11
+ const swap_jlp_1 = require("./swap-jlp");
12
+ // ---------------------------------------------------------------------------
13
+ // Stable-asset detection (mirrors swap-jlp.ts)
14
+ // ---------------------------------------------------------------------------
15
+ // Stablecoin mints use a hardcoded $1 price on-chain — the oracle account is
16
+ // passed but ignored. We pass PublicKey.default as a safe placeholder for them
17
+ // so callers never need to supply or fetch a feed for USDC/JupUSD.
18
+ // ---------------------------------------------------------------------------
19
+ /** Mints that use a hardcoded $1 price on-chain (oracle account ignored). */
20
+ const STABLE_MINTS = new Set(constants_1.JLPD_POOLS.filter((p) => p.name === "USDC" || p.name === "JupUSD").map((p) => p.mint));
21
+ function isStableMint(mint) {
22
+ return STABLE_MINTS.has(mint.toBase58());
23
+ }
24
+ function toBigInt(v) {
25
+ if (typeof v === "bigint")
26
+ return v;
27
+ const bn = v;
28
+ if (typeof bn.toBigInt === "function")
29
+ return bn.toBigInt();
30
+ return BigInt(bn.toString());
31
+ }
32
+ // ---------------------------------------------------------------------------
33
+ // Low-level instruction builder
34
+ // ---------------------------------------------------------------------------
35
+ /**
36
+ * Build the on-chain `base_to_base_swap` instruction.
37
+ *
38
+ * Instruction data layout (Anchor Borsh):
39
+ * [8-byte disc, 8-byte amount_in (LE), 8-byte min_out (LE),
40
+ * 4-byte jupiter_data_len (LE), ...jupiter_data_bytes]
41
+ */
42
+ function createBaseToBaseSwapIx(args, programId = constants_1.PROGRAM_ID) {
43
+ const { manager, config, managerRole, strategyStateIn, strategyStateOut, baseInAta, baseOutAta, baseInMint, baseOutMint, tokenProgram, jupiterProgram, priceOracleIn, priceOracleOut, amountIn, minOut, jupiterData, remainingAccounts = [], } = args;
44
+ const amountInBi = toBigInt(amountIn);
45
+ const minOutBi = toBigInt(minOut);
46
+ const jupBytes = Buffer.from(jupiterData);
47
+ const dataLen = 8 + 8 + 8 + 4 + jupBytes.length;
48
+ const data = Buffer.alloc(dataLen);
49
+ constants_1.IX_BASE_TO_BASE_SWAP.copy(data, 0);
50
+ data.writeBigUInt64LE(amountInBi, 8);
51
+ data.writeBigUInt64LE(minOutBi, 16);
52
+ data.writeUInt32LE(jupBytes.length, 24);
53
+ jupBytes.copy(data, 28);
54
+ const keys = [
55
+ { pubkey: manager, isSigner: true, isWritable: false },
56
+ { pubkey: config, isSigner: false, isWritable: false },
57
+ { pubkey: managerRole, isSigner: false, isWritable: false },
58
+ { pubkey: strategyStateIn, isSigner: false, isWritable: true },
59
+ { pubkey: strategyStateOut, isSigner: false, isWritable: true },
60
+ { pubkey: baseInAta, isSigner: false, isWritable: true },
61
+ { pubkey: baseOutAta, isSigner: false, isWritable: true },
62
+ { pubkey: baseInMint, isSigner: false, isWritable: false },
63
+ { pubkey: baseOutMint, isSigner: false, isWritable: false },
64
+ { pubkey: tokenProgram, isSigner: false, isWritable: false },
65
+ { pubkey: jupiterProgram, isSigner: false, isWritable: false },
66
+ { pubkey: priceOracleIn, isSigner: false, isWritable: false },
67
+ { pubkey: priceOracleOut, isSigner: false, isWritable: false },
68
+ ...remainingAccounts,
69
+ ];
70
+ return new web3_js_1.TransactionInstruction({ keys, programId, data });
71
+ }
72
+ // ---------------------------------------------------------------------------
73
+ // High-level builder (Jupiter quote + ALTs + ix)
74
+ // ---------------------------------------------------------------------------
75
+ /**
76
+ * Build a complete base_to_base_swap transaction:
77
+ * 1. Derive PDAs for both strategies
78
+ * 2. Resolve oracle accounts (from strategy_state.price_oracle on-chain, or overrides)
79
+ * 3. Get Jupiter quote (base_in → base_out)
80
+ * 4. Get Jupiter swap instructions (strategy_state_in PDA signs)
81
+ * 5. Build instruction + return ALTs
82
+ *
83
+ * Oracle resolution:
84
+ * - Stablecoins (USDC/JupUSD): always PublicKey.default (program ignores oracle for $1 assets).
85
+ * - Volatile assets: use caller-supplied override, or fetch strategy_state on-chain
86
+ * to read the stored price_oracle field. To avoid two extra RPC calls, pass
87
+ * priceOracleIn/priceOracleOut when you already have the strategy states.
88
+ */
89
+ async function buildBaseToBaseSwapTransaction(args) {
90
+ const { connection, manager, baseInMint, baseOutMint, amountIn, slippageBps = 50, tokenProgram = spl_token_1.TOKEN_PROGRAM_ID, programId = constants_1.PROGRAM_ID, } = args;
91
+ if (baseInMint.equals(baseOutMint)) {
92
+ throw new Error("base_to_base_swap: baseInMint must differ from baseOutMint");
93
+ }
94
+ // 1. Derive PDAs
95
+ const [config] = (0, pda_1.findJlpdConfigPda)(programId);
96
+ const [managerRole] = (0, pda_1.findJlpdManagerRolePda)(config, manager, programId);
97
+ const [strategyStateIn] = (0, pda_1.findStrategyStatePda)(baseInMint, programId);
98
+ const [strategyStateOut] = (0, pda_1.findStrategyStatePda)(baseOutMint, programId);
99
+ const baseInAta = (0, ata_1.findAta)(baseInMint, strategyStateIn, tokenProgram);
100
+ const baseOutAta = (0, ata_1.findAta)(baseOutMint, strategyStateOut, tokenProgram);
101
+ // 2. Resolve oracle accounts.
102
+ // Stablecoins always get PublicKey.default — on-chain ignores the feed.
103
+ // Volatile assets: use caller override, or fetch strategy state to read price_oracle.
104
+ // The two fetches are issued in parallel when both are needed.
105
+ const needFetchIn = !isStableMint(baseInMint) && args.priceOracleIn === undefined;
106
+ const needFetchOut = !isStableMint(baseOutMint) && args.priceOracleOut === undefined;
107
+ const [fetchedIn, fetchedOut] = await Promise.all([
108
+ needFetchIn ? (0, accounts_1.fetchJlpStrategyState)(connection, baseInMint, programId) : Promise.resolve(null),
109
+ needFetchOut ? (0, accounts_1.fetchJlpStrategyState)(connection, baseOutMint, programId) : Promise.resolve(null),
110
+ ]);
111
+ const priceOracleIn = isStableMint(baseInMint)
112
+ ? web3_js_1.PublicKey.default
113
+ : (args.priceOracleIn ?? fetchedIn.priceOracle);
114
+ const priceOracleOut = isStableMint(baseOutMint)
115
+ ? web3_js_1.PublicKey.default
116
+ : (args.priceOracleOut ?? fetchedOut.priceOracle);
117
+ // 3. Jupiter quote
118
+ const quote = await (0, swap_jlp_1.getJupiterSwapQuote)({
119
+ inputMint: baseInMint,
120
+ outputMint: baseOutMint,
121
+ amount: amountIn,
122
+ slippageBps,
123
+ });
124
+ // 4. Jupiter swap instructions (strategy_state_in PDA signs via CPI seeds).
125
+ // We override destinationTokenAccount to baseOutAta (ATA owned by strategy_state_OUT)
126
+ // because Jupiter defaults destination to userPublicKey's ATA, which for base_to_base
127
+ // would set it to ATA(baseOutMint, strategy_state_IN) — the wrong owner.
128
+ // On-chain: base_to_base_swap validates destination == base_out_ata → InvalidOwner if wrong.
129
+ const jupSwap = await (0, swap_jlp_1.getJupiterSwapInstructions)({
130
+ quoteResponse: quote,
131
+ userPublicKey: strategyStateIn,
132
+ destinationTokenAccount: baseOutAta,
133
+ });
134
+ // Defensive guard: verify the first writable non-signer account in the Jupiter swap
135
+ // instruction's accounts list that matches baseOutAta.
136
+ //
137
+ // NOTE: Jupiter's swap-instructions route account ordering is not guaranteed to be
138
+ // stable across route variants (shared-accounts vs standard-route layout). Reliably
139
+ // identifying the destination-ATA index requires parsing the Jupiter instruction
140
+ // discriminator and routing into variant-specific offset tables — which would
141
+ // duplicate on-chain logic and drift. Instead we do a membership check: confirm
142
+ // baseOutAta appears somewhere in the account list (necessary condition), and rely
143
+ // on the destinationTokenAccount override above to ensure it is wired as destination.
144
+ const baseOutAtaStr = baseOutAta.toBase58();
145
+ const baseInAtaStr = baseInAta.toBase58();
146
+ const routeKeys = jupSwap.remainingAccounts.map((a) => a.pubkey.toBase58());
147
+ if (!routeKeys.includes(baseOutAtaStr)) {
148
+ throw new Error(`base_to_base_swap: Jupiter route does not include baseOutAta (${baseOutAtaStr}). ` +
149
+ `destinationTokenAccount override may not have been honored. ` +
150
+ `Source: ${baseInAtaStr}. Route accounts: ${routeKeys.join(", ")}`);
151
+ }
152
+ if (!routeKeys.includes(baseInAtaStr)) {
153
+ throw new Error(`base_to_base_swap: Jupiter route does not include baseInAta (${baseInAtaStr}). ` +
154
+ `Unexpected route configuration. Route accounts: ${routeKeys.join(", ")}`);
155
+ }
156
+ const minOut = BigInt(quote.otherAmountThreshold);
157
+ // 5. Build ix
158
+ const ix = createBaseToBaseSwapIx({
159
+ manager,
160
+ config,
161
+ managerRole,
162
+ strategyStateIn,
163
+ strategyStateOut,
164
+ baseInAta,
165
+ baseOutAta,
166
+ baseInMint,
167
+ baseOutMint,
168
+ tokenProgram,
169
+ jupiterProgram: constants_1.JUPITER_PROGRAM,
170
+ priceOracleIn,
171
+ priceOracleOut,
172
+ amountIn,
173
+ minOut,
174
+ jupiterData: jupSwap.swapInstructionData,
175
+ remainingAccounts: jupSwap.remainingAccounts,
176
+ }, programId);
177
+ // 6. Resolve ALTs
178
+ const altAddresses = jupSwap.addressLookupTableAddresses;
179
+ const altPubkeys = altAddresses.map((a) => new web3_js_1.PublicKey(a));
180
+ const altInfos = await connection.getMultipleAccountsInfo(altPubkeys);
181
+ const addressLookupTables = [];
182
+ for (let i = 0; i < altInfos.length; i++) {
183
+ const info = altInfos[i];
184
+ if (!info)
185
+ continue;
186
+ addressLookupTables.push(new web3_js_1.AddressLookupTableAccount({
187
+ key: altPubkeys[i],
188
+ state: web3_js_1.AddressLookupTableAccount.deserialize(info.data),
189
+ }));
190
+ }
191
+ // Prepend compute-budget instructions from Jupiter so the tx carries the correct
192
+ // CU budget. Dropping them risks simulation/execution failure on complex routes.
193
+ const instructions = [
194
+ ...jupSwap.computeBudgetInstructions,
195
+ ix,
196
+ ];
197
+ return {
198
+ instructions,
199
+ addressLookupTables,
200
+ quoteInAmount: BigInt(quote.inAmount),
201
+ quoteOutAmount: BigInt(quote.outAmount),
202
+ minOut,
203
+ quote,
204
+ };
205
+ }
@@ -0,0 +1,127 @@
1
+ import { PublicKey } from "@solana/web3.js";
2
+ export declare const PROGRAM_ID: PublicKey;
3
+ export declare const PROGRAM_ID_MAINNET: PublicKey;
4
+ export declare const PROGRAM_ID_DEVNET: PublicKey;
5
+ /** JLP token mint */
6
+ export declare const JLP_MINT: PublicKey;
7
+ /** Jupiter aggregator program (swap routing) */
8
+ export declare const JUPITER_PROGRAM: PublicKey;
9
+ /**
10
+ * Reference/backfill defaults for the Doves price oracle feeds.
11
+ * Pending Jupiter confirmation; runtime feed comes from StrategyState.priceOracle.
12
+ * These constants are NOT used at runtime — swap_jlp, base_to_base_swap, and
13
+ * settle_yield all read the feed from strategy_state.price_oracle on-chain.
14
+ * Use these for backfill scripts, LUT tooling, and admin init calls only.
15
+ */
16
+ /** Doves oracle: BTC/USD price feed (reference/backfill default only) */
17
+ export declare const DOVES_BTC_USD: PublicKey;
18
+ /** Doves oracle: ETH/USD price feed (reference/backfill default only) */
19
+ export declare const DOVES_ETH_USD: PublicKey;
20
+ /** Doves oracle: SOL/USD price feed (reference/backfill default only) */
21
+ export declare const DOVES_SOL_USD: PublicKey;
22
+ /** Jupiter Perps Pool account (stores aumUsd for JLP price calculation) */
23
+ export declare const JLP_POOL_ACCOUNT: PublicKey;
24
+ /** Jupiter Perpetuals Program ID */
25
+ export declare const JUPITER_PERPS_PROGRAM: PublicKey;
26
+ export declare const CONFIG_SEED: Buffer<ArrayBuffer>;
27
+ export declare const MANAGER_SEED: Buffer<ArrayBuffer>;
28
+ export declare const STRATEGY_STATE_SEED: Buffer<ArrayBuffer>;
29
+ export declare const POSITION_SEED: Buffer<ArrayBuffer>;
30
+ /** Seeds: ["hedge", config] — see `state::hedge_state::HEDGE_STATE_SEED`. */
31
+ export declare const HEDGE_STATE_SEED: Buffer<ArrayBuffer>;
32
+ export declare const DISC_JLPD_CONFIG: Buffer<ArrayBuffer>;
33
+ export declare const DISC_HEDGE_STATE: Buffer<ArrayBuffer>;
34
+ export { DISC_STRATEGY_STATE, DISC_STV_POSITION, DISC_MANAGER_ROLE, } from "../common/constants";
35
+ export declare const IX_INIT_OR_UPDATE_CONFIG: Buffer<ArrayBuffer>;
36
+ export declare const IX_INIT_OR_UPDATE_STRATEGY_STATE: Buffer<ArrayBuffer>;
37
+ export declare const IX_SWAP_JLP: Buffer<ArrayBuffer>;
38
+ export declare const IX_BASE_TO_BASE_SWAP: Buffer<ArrayBuffer>;
39
+ export declare const IX_SETTLE_YIELD: Buffer<ArrayBuffer>;
40
+ export declare const IX_HEDGE_SUPPLY_COLLATERAL: Buffer<ArrayBuffer>;
41
+ export declare const IX_HEDGE_BORROW: Buffer<ArrayBuffer>;
42
+ export declare const IX_HEDGE_REPAY: Buffer<ArrayBuffer>;
43
+ export declare const IX_HEDGE_WITHDRAW_COLLATERAL: Buffer<ArrayBuffer>;
44
+ export declare const IX_HEDGE_SWAP: Buffer<ArrayBuffer>;
45
+ export declare const IX_DEPOSIT_TO_ADAPTER: Buffer<ArrayBuffer>;
46
+ export declare const IX_WITHDRAW_FROM_ADAPTER: Buffer<ArrayBuffer>;
47
+ export declare const IX_ADAPTER_MANAGE: Buffer<ArrayBuffer>;
48
+ export declare const IX_ADD_MANAGER: Buffer<ArrayBuffer>;
49
+ export declare const IX_REMOVE_MANAGER: Buffer<ArrayBuffer>;
50
+ export declare const IX_CLOSE_STRATEGY_STATE: Buffer<ArrayBuffer>;
51
+ export declare const JLPD_CONFIG_SIZE = 392;
52
+ export declare const MANAGER_ROLE_SIZE = 80;
53
+ export declare const STRATEGY_STATE_SIZE = 224;
54
+ export declare const STV_POSITION_SIZE = 120;
55
+ export declare const FLAG_PAUSED = 1;
56
+ export declare const FLAG_DEPOSITS_DISABLED = 2;
57
+ export declare const FLAG_WITHDRAWALS_DISABLED = 4;
58
+ export declare const FLAG_JLP_DISABLED = 8;
59
+ export declare const FLAG_REBALANCE_DISABLED = 16;
60
+ export declare const FLAG_TEST_MODE = 32;
61
+ export declare const NUM_ASSETS = 5;
62
+ export declare const MAX_MGMT_FEE_BPS = 500;
63
+ export declare const MAX_PERF_FEE_BPS = 3000;
64
+ export { PPS_DECIMALS, BPS_DENOMINATOR } from "../common/constants";
65
+ /** Stable per-pool registry for JLPD strategy STVs.
66
+ *
67
+ * Each entry is the canonical record for a pool: short symbol, base mint
68
+ * address (base58), p-STV Core vault id, and base mint decimals. The
69
+ * `JLPD_VAULT_IDS` and `JLPD_POOL_NAMES_BY_VAULT_ID` lookups below are
70
+ * derived from this single table so consumers cannot get out of sync.
71
+ */
72
+ export declare const JLPD_POOLS: ReadonlyArray<{
73
+ readonly name: "BTC" | "ETH" | "SOL" | "USDC" | "JupUSD";
74
+ readonly mint: string;
75
+ readonly vaultId: number;
76
+ readonly decimals: number;
77
+ }>;
78
+ /** Pool symbol type derived from `JLPD_POOLS`. */
79
+ export type JlpdPoolName = (typeof JLPD_POOLS)[number]["name"];
80
+ /** Lookup: base_mint (base58) → vault_id. Derived from `JLPD_POOLS`. */
81
+ export declare const JLPD_VAULT_IDS: Record<string, number>;
82
+ /** Lookup: pool symbol → vault_id. Derived from `JLPD_POOLS`. */
83
+ export declare const JLPD_VAULT_IDS_BY_POOL: Record<JlpdPoolName, number>;
84
+ /** Lookup: pool symbol → base mint decimals. Derived from `JLPD_POOLS`. */
85
+ export declare const JLPD_POOL_DECIMALS: Record<JlpdPoolName, number>;
86
+ /** Wrapped SOL (`NATIVE_MINT`), 9-dec. Fluid vault-46 SOL-debt short leg. */
87
+ export declare const MINT_WSOL: PublicKey;
88
+ /** Wrapped ETH, 8-dec. */
89
+ export declare const MINT_WETH: PublicKey;
90
+ /** Wrapped BTC, 8-dec. */
91
+ export declare const MINT_WBTC: PublicKey;
92
+ /** USDC, 6-dec. */
93
+ export declare const MINT_USDC: PublicKey;
94
+ /** JupUSD stablecoin, 6-dec. Fluid vault-58 debt mint (the long leg). */
95
+ export declare const MINT_JUPUSD: PublicKey;
96
+ /** JupSOL (Jupiter liquid-staking token), 9-dec. The long-SOL leg's exposure token. */
97
+ export declare const MINT_JUPSOL: PublicKey;
98
+ /** Jupiter Lend Borrow (Fluid Vaults) program — the `operate()` CPI target every hedge op routes through. */
99
+ export declare const JUP_LEND_BORROW_PROGRAM_ID: PublicKey;
100
+ /** Fluid's oracle program (names + chains external price sources for each vault). */
101
+ export declare const FLUID_ORACLE_PROGRAM_ID: PublicKey;
102
+ /** Chainlink Data Feeds store program (owner of every Chainlink feed account read by the hedge). */
103
+ export declare const CHAINLINK_STORE_PROGRAM_ID: PublicKey;
104
+ /** Jupiter Lend Earn program (owner of every `lending`/fToken-rate account). */
105
+ export declare const JUP_LEND_EARN_PROGRAM_ID: PublicKey;
106
+ /** Pyth Receiver program (owner of every `PriceUpdateV2` account a 2-hop Fluid oracle reads). */
107
+ export declare const PYTH_RECEIVER_PROGRAM_ID: PublicKey;
108
+ /**
109
+ * JupSOL's Sanctum "SanctumSplMulti" stake-pool account -- the pinned live SOL/JupSOL
110
+ * redemption-rate source `hedge_swap` reads whenever either leg is `HedgeManifestRole.JupSol`
111
+ * (mirrors `utils::oracle::JUPSOL_STAKE_POOL_ACCOUNT`; chain-verified rate-source spec in that
112
+ * module's doc comment). Owned by `JUPSOL_STAKE_POOL_PROGRAM_ID`
113
+ * (`SPMBzsVUuoHA4Jm6KunbsotaahvVikZs1JyTW6iJvbn`). The on-chain handler ALSO gates this account on
114
+ * `Clock::get()?.epoch` freshness -- a stale (not-yet-cranked-this-epoch) pool reverts
115
+ * `StaleJupSolStakePool` even though the address/owner/mint pin passes.
116
+ */
117
+ export declare const JUPSOL_STAKE_POOL_ACCOUNT: PublicKey;
118
+ /** Number of independent Fluid borrow positions the hedge can hold open at once (`HedgeState.positions`). */
119
+ export declare const MAX_HEDGE_POSITIONS = 4;
120
+ /** `HedgeState.flags` bit 0 — the hedge master switch (see `is_enabled` on-chain). */
121
+ export declare const HEDGE_FLAG_ENABLED: number;
122
+ /** Upper bound for `max_ltv_bps` (100%, in basis points) — bounds an admin typo only. */
123
+ export declare const MAX_HEDGE_LTV_BPS = 10000;
124
+ /** `HedgeState` total account size including the 8-byte discriminator. */
125
+ export declare const HEDGE_STATE_SIZE = 1256;
126
+ /** Size of one `HedgePositionSlot` (five `Pubkey`s, no padding). */
127
+ export declare const HEDGE_POSITION_SLOT_SIZE = 160;
@@ -0,0 +1,174 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PPS_DECIMALS = exports.MAX_PERF_FEE_BPS = exports.MAX_MGMT_FEE_BPS = exports.NUM_ASSETS = exports.FLAG_TEST_MODE = exports.FLAG_REBALANCE_DISABLED = exports.FLAG_JLP_DISABLED = exports.FLAG_WITHDRAWALS_DISABLED = exports.FLAG_DEPOSITS_DISABLED = exports.FLAG_PAUSED = exports.STV_POSITION_SIZE = exports.STRATEGY_STATE_SIZE = exports.MANAGER_ROLE_SIZE = exports.JLPD_CONFIG_SIZE = exports.IX_CLOSE_STRATEGY_STATE = exports.IX_REMOVE_MANAGER = exports.IX_ADD_MANAGER = exports.IX_ADAPTER_MANAGE = exports.IX_WITHDRAW_FROM_ADAPTER = exports.IX_DEPOSIT_TO_ADAPTER = exports.IX_HEDGE_SWAP = exports.IX_HEDGE_WITHDRAW_COLLATERAL = exports.IX_HEDGE_REPAY = exports.IX_HEDGE_BORROW = exports.IX_HEDGE_SUPPLY_COLLATERAL = exports.IX_SETTLE_YIELD = exports.IX_BASE_TO_BASE_SWAP = exports.IX_SWAP_JLP = exports.IX_INIT_OR_UPDATE_STRATEGY_STATE = exports.IX_INIT_OR_UPDATE_CONFIG = exports.DISC_MANAGER_ROLE = exports.DISC_STV_POSITION = exports.DISC_STRATEGY_STATE = exports.DISC_HEDGE_STATE = exports.DISC_JLPD_CONFIG = exports.HEDGE_STATE_SEED = exports.POSITION_SEED = exports.STRATEGY_STATE_SEED = exports.MANAGER_SEED = exports.CONFIG_SEED = exports.JUPITER_PERPS_PROGRAM = exports.JLP_POOL_ACCOUNT = exports.DOVES_SOL_USD = exports.DOVES_ETH_USD = exports.DOVES_BTC_USD = exports.JUPITER_PROGRAM = exports.JLP_MINT = exports.PROGRAM_ID_DEVNET = exports.PROGRAM_ID_MAINNET = exports.PROGRAM_ID = void 0;
4
+ exports.HEDGE_POSITION_SLOT_SIZE = exports.HEDGE_STATE_SIZE = exports.MAX_HEDGE_LTV_BPS = exports.HEDGE_FLAG_ENABLED = exports.MAX_HEDGE_POSITIONS = exports.JUPSOL_STAKE_POOL_ACCOUNT = exports.PYTH_RECEIVER_PROGRAM_ID = exports.JUP_LEND_EARN_PROGRAM_ID = exports.CHAINLINK_STORE_PROGRAM_ID = exports.FLUID_ORACLE_PROGRAM_ID = exports.JUP_LEND_BORROW_PROGRAM_ID = exports.MINT_JUPSOL = exports.MINT_JUPUSD = exports.MINT_USDC = exports.MINT_WBTC = exports.MINT_WETH = exports.MINT_WSOL = exports.JLPD_POOL_DECIMALS = exports.JLPD_VAULT_IDS_BY_POOL = exports.JLPD_VAULT_IDS = exports.JLPD_POOLS = exports.BPS_DENOMINATOR = void 0;
5
+ const web3_js_1 = require("@solana/web3.js");
6
+ exports.PROGRAM_ID = new web3_js_1.PublicKey("GXqt4ZH2UUBsLWwMNJiZMXza3q7xEGChfW8XjVRjLxr5");
7
+ exports.PROGRAM_ID_MAINNET = exports.PROGRAM_ID;
8
+ exports.PROGRAM_ID_DEVNET = new web3_js_1.PublicKey("AcVcAihjB9Z3Lg3ZiboWxni2sTzXUrrsF3unGX4ntn6p");
9
+ // ---------------------------------------------------------------------------
10
+ // Known mainnet addresses
11
+ // ---------------------------------------------------------------------------
12
+ /** JLP token mint */
13
+ exports.JLP_MINT = new web3_js_1.PublicKey("27G8MtK7VtTcCHkpASjSDdkWWYfoqT6ggEuKidVJidD4");
14
+ /** Jupiter aggregator program (swap routing) */
15
+ exports.JUPITER_PROGRAM = new web3_js_1.PublicKey("JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4");
16
+ /**
17
+ * Reference/backfill defaults for the Doves price oracle feeds.
18
+ * Pending Jupiter confirmation; runtime feed comes from StrategyState.priceOracle.
19
+ * These constants are NOT used at runtime — swap_jlp, base_to_base_swap, and
20
+ * settle_yield all read the feed from strategy_state.price_oracle on-chain.
21
+ * Use these for backfill scripts, LUT tooling, and admin init calls only.
22
+ */
23
+ /** Doves oracle: BTC/USD price feed (reference/backfill default only) */
24
+ exports.DOVES_BTC_USD = new web3_js_1.PublicKey("FxSvTMvZS9S1jjjixHPh7QEn99WuVWaEHqvw8NqfWmB8");
25
+ /** Doves oracle: ETH/USD price feed (reference/backfill default only) */
26
+ exports.DOVES_ETH_USD = new web3_js_1.PublicKey("9QEL8K51uZrqoqTp6Zfjmr65gYqvivVrd2Yg5bo6joGV");
27
+ /** Doves oracle: SOL/USD price feed (reference/backfill default only) */
28
+ exports.DOVES_SOL_USD = new web3_js_1.PublicKey("A5d4aY4K4BYEtXdAY7WNBHTKxRMeyAA6RYHWVYEW22Fe");
29
+ /** Jupiter Perps Pool account (stores aumUsd for JLP price calculation) */
30
+ exports.JLP_POOL_ACCOUNT = new web3_js_1.PublicKey("5BUwFW4nRbftYTDMbgxykoFWqWHPzahFSNAaaaJtVKsq");
31
+ /** Jupiter Perpetuals Program ID */
32
+ exports.JUPITER_PERPS_PROGRAM = new web3_js_1.PublicKey("PERPHjGBqRHArX4DySjwM6UJHiR3sWAatqfdBS2qQJu");
33
+ // PDA Seeds
34
+ exports.CONFIG_SEED = Buffer.from("config");
35
+ exports.MANAGER_SEED = Buffer.from("manager");
36
+ exports.STRATEGY_STATE_SEED = Buffer.from("strategy_state");
37
+ exports.POSITION_SEED = Buffer.from("position");
38
+ /** Seeds: ["hedge", config] — see `state::hedge_state::HEDGE_STATE_SEED`. */
39
+ exports.HEDGE_STATE_SEED = Buffer.from("hedge");
40
+ // Account discriminators (Anchor 8-byte)
41
+ // sha256("account:JlpdConfig")[..8] — JLPD-specific
42
+ exports.DISC_JLPD_CONFIG = Buffer.from([185, 146, 185, 28, 172, 71, 122, 38]);
43
+ // sha256("account:HedgeState")[..8] — JLPD-specific
44
+ exports.DISC_HEDGE_STATE = Buffer.from([86, 90, 49, 121, 72, 118, 59, 101]);
45
+ // Shared types — defined once in common/, re-exported here
46
+ var constants_1 = require("../common/constants");
47
+ Object.defineProperty(exports, "DISC_STRATEGY_STATE", { enumerable: true, get: function () { return constants_1.DISC_STRATEGY_STATE; } });
48
+ Object.defineProperty(exports, "DISC_STV_POSITION", { enumerable: true, get: function () { return constants_1.DISC_STV_POSITION; } });
49
+ Object.defineProperty(exports, "DISC_MANAGER_ROLE", { enumerable: true, get: function () { return constants_1.DISC_MANAGER_ROLE; } });
50
+ // Instruction discriminators (Anchor 8-byte) — MANAGER-FACING ONLY
51
+ //
52
+ // CPI-internal discriminators (IX_INIT_POSITION, IX_CLOSE_POSITION, IX_DEPOSIT,
53
+ // IX_WITHDRAW, IX_UPDATE_AUM) are intentionally NOT exported here. Those five
54
+ // instructions are invoked exclusively by p-stv-core via CPI; no client-side
55
+ // builder uses them. Exporting them as public buildable surface was misleading.
56
+ // If a future cross-program integration genuinely needs these discs, add them
57
+ // to a `cpi-constants.ts` sub-module rather than the public SDK surface.
58
+ exports.IX_INIT_OR_UPDATE_CONFIG = Buffer.from([120, 208, 225, 179, 75, 21, 139, 209]);
59
+ exports.IX_INIT_OR_UPDATE_STRATEGY_STATE = Buffer.from([148, 75, 234, 144, 185, 1, 1, 111]);
60
+ exports.IX_SWAP_JLP = Buffer.from([190, 44, 224, 191, 169, 243, 146, 127]);
61
+ // sha256("global:base_to_base_swap")[..8]
62
+ exports.IX_BASE_TO_BASE_SWAP = Buffer.from([138, 14, 49, 99, 201, 152, 239, 96]);
63
+ exports.IX_SETTLE_YIELD = Buffer.from([64, 28, 44, 24, 43, 204, 58, 215]);
64
+ // sha256("global:hedge_supply_collateral")[..8] — verified against target/idl/jlpd_strategy.json
65
+ exports.IX_HEDGE_SUPPLY_COLLATERAL = Buffer.from([205, 222, 248, 57, 169, 214, 138, 137]);
66
+ // sha256("global:hedge_borrow")[..8]
67
+ exports.IX_HEDGE_BORROW = Buffer.from([149, 151, 250, 1, 238, 71, 59, 250]);
68
+ // sha256("global:hedge_repay")[..8]
69
+ exports.IX_HEDGE_REPAY = Buffer.from([253, 6, 59, 138, 117, 65, 3, 168]);
70
+ // sha256("global:hedge_withdraw_collateral")[..8]
71
+ exports.IX_HEDGE_WITHDRAW_COLLATERAL = Buffer.from([192, 239, 247, 199, 191, 168, 118, 149]);
72
+ // sha256("global:hedge_swap")[..8] — verified against target/idl/jlpd_strategy.json's
73
+ // `discriminator` field for `hedge_swap`. See hedge-instructions.ts's `createHedgeSwapIx`.
74
+ exports.IX_HEDGE_SWAP = Buffer.from([66, 173, 214, 51, 122, 214, 99, 199]);
75
+ // sha256("global:deposit_to_adapter")[..8]
76
+ exports.IX_DEPOSIT_TO_ADAPTER = Buffer.from([123, 167, 9, 180, 75, 80, 195, 219]);
77
+ // sha256("global:withdraw_from_adapter")[..8]
78
+ exports.IX_WITHDRAW_FROM_ADAPTER = Buffer.from([87, 57, 243, 113, 157, 131, 135, 83]);
79
+ // sha256("global:adapter_manage")[..8]
80
+ exports.IX_ADAPTER_MANAGE = Buffer.from([210, 30, 127, 237, 109, 210, 2, 212]);
81
+ // sha256("global:add_manager")[..8]
82
+ exports.IX_ADD_MANAGER = Buffer.from([125, 38, 192, 212, 101, 91, 179, 16]);
83
+ // sha256("global:remove_manager")[..8]
84
+ exports.IX_REMOVE_MANAGER = Buffer.from([150, 55, 157, 77, 128, 148, 7, 15]);
85
+ // sha256("global:close_strategy_state")[..8] — verified against IDL discriminator
86
+ exports.IX_CLOSE_STRATEGY_STATE = Buffer.from([126, 163, 50, 191, 191, 74, 84, 53]);
87
+ // Account sizes
88
+ exports.JLPD_CONFIG_SIZE = 392;
89
+ exports.MANAGER_ROLE_SIZE = 80;
90
+ exports.STRATEGY_STATE_SIZE = 224;
91
+ exports.STV_POSITION_SIZE = 120;
92
+ // Flags
93
+ exports.FLAG_PAUSED = 0x0001;
94
+ exports.FLAG_DEPOSITS_DISABLED = 0x0002;
95
+ exports.FLAG_WITHDRAWALS_DISABLED = 0x0004;
96
+ exports.FLAG_JLP_DISABLED = 0x0008;
97
+ exports.FLAG_REBALANCE_DISABLED = 0x0010;
98
+ exports.FLAG_TEST_MODE = 0x0020;
99
+ // Limits
100
+ exports.NUM_ASSETS = 5;
101
+ exports.MAX_MGMT_FEE_BPS = 500;
102
+ exports.MAX_PERF_FEE_BPS = 3000;
103
+ var constants_2 = require("../common/constants");
104
+ Object.defineProperty(exports, "PPS_DECIMALS", { enumerable: true, get: function () { return constants_2.PPS_DECIMALS; } });
105
+ Object.defineProperty(exports, "BPS_DENOMINATOR", { enumerable: true, get: function () { return constants_2.BPS_DENOMINATOR; } });
106
+ /** Stable per-pool registry for JLPD strategy STVs.
107
+ *
108
+ * Each entry is the canonical record for a pool: short symbol, base mint
109
+ * address (base58), p-STV Core vault id, and base mint decimals. The
110
+ * `JLPD_VAULT_IDS` and `JLPD_POOL_NAMES_BY_VAULT_ID` lookups below are
111
+ * derived from this single table so consumers cannot get out of sync.
112
+ */
113
+ exports.JLPD_POOLS = [
114
+ { name: "BTC", mint: "3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh", vaultId: 11, decimals: 8 },
115
+ { name: "ETH", mint: "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs", vaultId: 12, decimals: 8 },
116
+ { name: "SOL", mint: "So11111111111111111111111111111111111111112", vaultId: 13, decimals: 9 },
117
+ { name: "USDC", mint: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", vaultId: 14, decimals: 6 },
118
+ { name: "JupUSD", mint: "JuprjznTrTSp2UFa3ZBUFgwdAmtZCq4MQCwysN55USD", vaultId: 15, decimals: 6 },
119
+ ];
120
+ /** Lookup: base_mint (base58) → vault_id. Derived from `JLPD_POOLS`. */
121
+ exports.JLPD_VAULT_IDS = Object.fromEntries(exports.JLPD_POOLS.map((p) => [p.mint, p.vaultId]));
122
+ /** Lookup: pool symbol → vault_id. Derived from `JLPD_POOLS`. */
123
+ exports.JLPD_VAULT_IDS_BY_POOL = Object.fromEntries(exports.JLPD_POOLS.map((p) => [p.name, p.vaultId]));
124
+ /** Lookup: pool symbol → base mint decimals. Derived from `JLPD_POOLS`. */
125
+ exports.JLPD_POOL_DECIMALS = Object.fromEntries(exports.JLPD_POOLS.map((p) => [p.name, p.decimals]));
126
+ // ---------------------------------------------------------------------------
127
+ // Native Jup-Lend hedge — mint/program constants
128
+ //
129
+ // Mirrors `jlpd-strategy/programs/jlpd-strategy/src/constants.rs` (MINT_*) and
130
+ // `utils/jup_lend_view.rs`'s pinned mainnet program IDs. Verify against source
131
+ // before changing.
132
+ // ---------------------------------------------------------------------------
133
+ /** Wrapped SOL (`NATIVE_MINT`), 9-dec. Fluid vault-46 SOL-debt short leg. */
134
+ exports.MINT_WSOL = new web3_js_1.PublicKey("So11111111111111111111111111111111111111112");
135
+ /** Wrapped ETH, 8-dec. */
136
+ exports.MINT_WETH = new web3_js_1.PublicKey("7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs");
137
+ /** Wrapped BTC, 8-dec. */
138
+ exports.MINT_WBTC = new web3_js_1.PublicKey("3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh");
139
+ /** USDC, 6-dec. */
140
+ exports.MINT_USDC = new web3_js_1.PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");
141
+ /** JupUSD stablecoin, 6-dec. Fluid vault-58 debt mint (the long leg). */
142
+ exports.MINT_JUPUSD = new web3_js_1.PublicKey("JuprjznTrTSp2UFa3ZBUFgwdAmtZCq4MQCwysN55USD");
143
+ /** JupSOL (Jupiter liquid-staking token), 9-dec. The long-SOL leg's exposure token. */
144
+ exports.MINT_JUPSOL = new web3_js_1.PublicKey("jupSoLaHXQiZZTSfEWMTRRgpnyFm8f6sZdosWBjx93v");
145
+ /** Jupiter Lend Borrow (Fluid Vaults) program — the `operate()` CPI target every hedge op routes through. */
146
+ exports.JUP_LEND_BORROW_PROGRAM_ID = new web3_js_1.PublicKey("jupr81YtYssSyPt8jbnGuiWon5f6x9TcDEFxYe3Bdzi");
147
+ /** Fluid's oracle program (names + chains external price sources for each vault). */
148
+ exports.FLUID_ORACLE_PROGRAM_ID = new web3_js_1.PublicKey("jupnw4B6Eqs7ft6rxpzYLJZYSnrpRgPcr589n5Kv4oc");
149
+ /** Chainlink Data Feeds store program (owner of every Chainlink feed account read by the hedge). */
150
+ exports.CHAINLINK_STORE_PROGRAM_ID = new web3_js_1.PublicKey("HEvSKofvBgfaexv23kMabbYqxasxU3mQ4ibBMEmJWHny");
151
+ /** Jupiter Lend Earn program (owner of every `lending`/fToken-rate account). */
152
+ exports.JUP_LEND_EARN_PROGRAM_ID = new web3_js_1.PublicKey("jup3YeL8QhtSx1e253b2FDvsMNC87fDrgQZivbrndc9");
153
+ /** Pyth Receiver program (owner of every `PriceUpdateV2` account a 2-hop Fluid oracle reads). */
154
+ exports.PYTH_RECEIVER_PROGRAM_ID = new web3_js_1.PublicKey("rec5EKMGg6MxZYaMdyBfgwp4d5rB9T1VQH5pJv5LtFJ");
155
+ /**
156
+ * JupSOL's Sanctum "SanctumSplMulti" stake-pool account -- the pinned live SOL/JupSOL
157
+ * redemption-rate source `hedge_swap` reads whenever either leg is `HedgeManifestRole.JupSol`
158
+ * (mirrors `utils::oracle::JUPSOL_STAKE_POOL_ACCOUNT`; chain-verified rate-source spec in that
159
+ * module's doc comment). Owned by `JUPSOL_STAKE_POOL_PROGRAM_ID`
160
+ * (`SPMBzsVUuoHA4Jm6KunbsotaahvVikZs1JyTW6iJvbn`). The on-chain handler ALSO gates this account on
161
+ * `Clock::get()?.epoch` freshness -- a stale (not-yet-cranked-this-epoch) pool reverts
162
+ * `StaleJupSolStakePool` even though the address/owner/mint pin passes.
163
+ */
164
+ exports.JUPSOL_STAKE_POOL_ACCOUNT = new web3_js_1.PublicKey("8VpRhuxa7sUUepdY3kQiTmX9rS5vx4WgaXiAnXq4KCtr");
165
+ /** Number of independent Fluid borrow positions the hedge can hold open at once (`HedgeState.positions`). */
166
+ exports.MAX_HEDGE_POSITIONS = 4;
167
+ /** `HedgeState.flags` bit 0 — the hedge master switch (see `is_enabled` on-chain). */
168
+ exports.HEDGE_FLAG_ENABLED = 1 << 0;
169
+ /** Upper bound for `max_ltv_bps` (100%, in basis points) — bounds an admin typo only. */
170
+ exports.MAX_HEDGE_LTV_BPS = 10000;
171
+ /** `HedgeState` total account size including the 8-byte discriminator. */
172
+ exports.HEDGE_STATE_SIZE = 1256;
173
+ /** Size of one `HedgePositionSlot` (five `Pubkey`s, no padding). */
174
+ exports.HEDGE_POSITION_SLOT_SIZE = 160;