@elemental-stv-core/sdk 0.9.2 → 0.11.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.
Files changed (38) hide show
  1. package/dist/common/buffer.d.ts +3 -0
  2. package/dist/common/buffer.js +19 -0
  3. package/dist/elemental-lend/instructions.d.ts +14 -0
  4. package/dist/elemental-lend/instructions.js +18 -6
  5. package/dist/elemental-lend/protocol-actions.d.ts +6 -0
  6. package/dist/elemental-lend/protocol-actions.js +21 -10
  7. package/dist/jlpd-strategy/accounts.d.ts +4 -1
  8. package/dist/jlpd-strategy/accounts.js +6 -1
  9. package/dist/jlpd-strategy/adapter.d.ts +16 -6
  10. package/dist/jlpd-strategy/adapter.js +21 -9
  11. package/dist/jlpd-strategy/base-to-base-swap.d.ts +74 -0
  12. package/dist/jlpd-strategy/base-to-base-swap.js +199 -0
  13. package/dist/jlpd-strategy/constants.d.ts +11 -3
  14. package/dist/jlpd-strategy/constants.js +19 -10
  15. package/dist/jlpd-strategy/index.d.ts +1 -0
  16. package/dist/jlpd-strategy/index.js +1 -0
  17. package/dist/jlpd-strategy/instructions.d.ts +49 -0
  18. package/dist/jlpd-strategy/instructions.js +55 -0
  19. package/dist/jlpd-strategy/jlp-data.d.ts +11 -0
  20. package/dist/jlpd-strategy/jlp-data.js +15 -0
  21. package/dist/jlpd-strategy/settle-yield.d.ts +20 -1
  22. package/dist/jlpd-strategy/settle-yield.js +9 -6
  23. package/dist/jlpd-strategy/swap-jlp.d.ts +26 -0
  24. package/dist/jlpd-strategy/swap-jlp.js +74 -10
  25. package/dist/jlpd-strategy/types.d.ts +3 -1
  26. package/dist/p-stv-core/accounts.d.ts +40 -4
  27. package/dist/p-stv-core/accounts.js +97 -4
  28. package/dist/p-stv-core/constants.d.ts +39 -3
  29. package/dist/p-stv-core/constants.js +42 -4
  30. package/dist/p-stv-core/events.js +50 -7
  31. package/dist/p-stv-core/instructions.d.ts +245 -2
  32. package/dist/p-stv-core/instructions.js +226 -13
  33. package/dist/p-stv-core/pda.d.ts +15 -0
  34. package/dist/p-stv-core/pda.js +25 -0
  35. package/dist/p-stv-core/remaining-accounts.d.ts +4 -1
  36. package/dist/p-stv-core/remaining-accounts.js +17 -2
  37. package/dist/p-stv-core/types.d.ts +78 -1
  38. package/package.json +1 -1
@@ -56,7 +56,8 @@ function parseEventsFromLogs(logs, programId = constants_1.PROGRAM_ID) {
56
56
  * [47..55] vaultCapacity | [55..63] minDeposit |
57
57
  * [63..64] childVaultCount | [64..96] lendProgram
58
58
  * Deposited [0..1] disc | [1..9] vaultId | [9..41] user |
59
- * [41..49] amount | [49..57] sharesMinted | [57..65] pps
59
+ * [41..49] amount | [49..57] sharesMinted | [57..65] depositFeeShares |
60
+ * [65..73] pps
60
61
  * WithdrawRequested [0..1] disc | [1..9] vaultId | [9..41] user |
61
62
  * [41..49] shares | [49..53] epochId
62
63
  * WithdrawRequestIncreased [0..1] disc | [1..9] vaultId | [9..41] user |
@@ -78,6 +79,10 @@ function parseEventsFromLogs(logs, programId = constants_1.PROGRAM_ID) {
78
79
  * StvClosed [0..1] disc | [1..9] vaultId
79
80
  * ManagerAdded [0..1] disc | [1..33] stv | [33..65] manager
80
81
  * ManagerRemoved [0..1] disc | [1..33] stv | [33..65] manager
82
+ * DelayedDepositProcessed [0..1] disc | [1..9] vaultId | [9..41] user |
83
+ * [41..49] amount | [49..57] sharesMinted |
84
+ * [57..65] depositFeeShares | [65..73] pps |
85
+ * [73..77] requestEpochId
81
86
  */
82
87
  function parseEventBuffer(data) {
83
88
  if (data.length === 0)
@@ -103,9 +108,10 @@ function parseEventBuffer(data) {
103
108
  childVaultCount: data[63], lendProgram: (0, buffer_1.readPubkey)(data, 64),
104
109
  } : null;
105
110
  case constants_1.EVT_DEPOSITED:
106
- return data.length >= 65 ? {
111
+ return data.length >= 73 ? {
107
112
  name: "Deposited", vaultId: (0, buffer_1.readU64)(data, 1), user: (0, buffer_1.readPubkey)(data, 9),
108
- amount: (0, buffer_1.readU64)(data, 41), sharesMinted: (0, buffer_1.readU64)(data, 49), pps: (0, buffer_1.readU64)(data, 57),
113
+ amount: (0, buffer_1.readU64)(data, 41), sharesMinted: (0, buffer_1.readU64)(data, 49),
114
+ depositFeeShares: (0, buffer_1.readU64)(data, 57), pps: (0, buffer_1.readU64)(data, 65),
109
115
  } : null;
110
116
  case constants_1.EVT_WITHDRAW_REQUESTED:
111
117
  return data.length >= 53 ? {
@@ -118,9 +124,11 @@ function parseEventBuffer(data) {
118
124
  additionalShares: (0, buffer_1.readU64)(data, 41), totalShares: (0, buffer_1.readU64)(data, 49), epochId: (0, buffer_1.readU32)(data, 57),
119
125
  } : null;
120
126
  case constants_1.EVT_WITHDRAW_CLAIMED:
121
- return data.length >= 61 ? {
127
+ // Rust: vault_id(8), user(32), shares(8), net_base(8), withdrawal_fee_base(8), epoch_id(4)
128
+ return data.length >= 69 ? {
122
129
  name: "WithdrawClaimed", vaultId: (0, buffer_1.readU64)(data, 1), user: (0, buffer_1.readPubkey)(data, 9),
123
- shares: (0, buffer_1.readU64)(data, 41), baseAmount: (0, buffer_1.readU64)(data, 49), epochId: (0, buffer_1.readU32)(data, 57),
130
+ shares: (0, buffer_1.readU64)(data, 41), baseAmount: (0, buffer_1.readU64)(data, 49),
131
+ withdrawalFeeBase: (0, buffer_1.readU64)(data, 57), epochId: (0, buffer_1.readU32)(data, 65),
124
132
  } : null;
125
133
  case constants_1.EVT_DEPOSITED_TO_STRATEGY:
126
134
  return data.length >= 57 ? {
@@ -160,16 +168,51 @@ function parseEventBuffer(data) {
160
168
  name: "ManagerRemoved", stv: (0, buffer_1.readPubkey)(data, 1), manager: (0, buffer_1.readPubkey)(data, 33),
161
169
  } : null;
162
170
  case constants_1.EVT_WITHDRAW_OVERRIDE_CLAIMED:
163
- return data.length >= 109 ? {
171
+ // Rust: vault_id(8), manager(32), user(32), shares(8), net_base(8),
172
+ // withdrawal_fee_base(8), epoch_id(4), daily_withdrawn(8), daily_limit(8)
173
+ return data.length >= 117 ? {
164
174
  name: "WithdrawOverrideClaimed", vaultId: (0, buffer_1.readU64)(data, 1), manager: (0, buffer_1.readPubkey)(data, 9),
165
175
  user: (0, buffer_1.readPubkey)(data, 41), shares: (0, buffer_1.readU64)(data, 73), baseAmount: (0, buffer_1.readU64)(data, 81),
166
- epochId: (0, buffer_1.readU32)(data, 89), dailyWithdrawnBase: (0, buffer_1.readU64)(data, 93), dailyLimit: (0, buffer_1.readU64)(data, 101),
176
+ withdrawalFeeBase: (0, buffer_1.readU64)(data, 89), epochId: (0, buffer_1.readU32)(data, 97),
177
+ dailyWithdrawnBase: (0, buffer_1.readU64)(data, 101), dailyLimit: (0, buffer_1.readU64)(data, 109),
167
178
  } : null;
168
179
  case constants_1.EVT_LEND_MIGRATED:
169
180
  return data.length >= 89 ? {
170
181
  name: "LendMigrated", vaultId: (0, buffer_1.readU64)(data, 1), oldLendProgram: (0, buffer_1.readPubkey)(data, 9),
171
182
  newLendProgram: (0, buffer_1.readPubkey)(data, 41), sharesWithdrawn: (0, buffer_1.readU64)(data, 73), baseMigrated: (0, buffer_1.readU64)(data, 81),
172
183
  } : null;
184
+ case constants_1.EVT_MIGRATE_REQUESTED:
185
+ // Rust: src_vault_id(8), dest_vault_id(8), user(32), shares(8), epoch_id(4)
186
+ return data.length >= 61 ? {
187
+ name: "MigrateRequested", srcVaultId: (0, buffer_1.readU64)(data, 1), destVaultId: (0, buffer_1.readU64)(data, 9),
188
+ user: (0, buffer_1.readPubkey)(data, 17), shares: (0, buffer_1.readU64)(data, 49), epochId: (0, buffer_1.readU32)(data, 57),
189
+ } : null;
190
+ case constants_1.EVT_MIGRATE_EXECUTED:
191
+ // Rust: src_vault_id(8), dst_vault_id(8), user(32), shares_burned(8), base_moved(8),
192
+ // withdrawal_fee_base(8), deposit_fee_base(8), user_dest_shares(8), epoch_id(4)
193
+ return data.length >= 93 ? {
194
+ name: "MigrateExecuted", srcVaultId: (0, buffer_1.readU64)(data, 1), destVaultId: (0, buffer_1.readU64)(data, 9),
195
+ user: (0, buffer_1.readPubkey)(data, 17), sharesBurned: (0, buffer_1.readU64)(data, 49), baseMoved: (0, buffer_1.readU64)(data, 57),
196
+ withdrawalFeeBase: (0, buffer_1.readU64)(data, 65), depositFeeBase: (0, buffer_1.readU64)(data, 73),
197
+ userDestShares: (0, buffer_1.readU64)(data, 81), epochId: (0, buffer_1.readU32)(data, 89),
198
+ } : null;
199
+ case constants_1.EVT_DELAYED_DEPOSIT_PROCESSED:
200
+ return data.length >= 77 ? {
201
+ name: "DelayedDepositProcessed", vaultId: (0, buffer_1.readU64)(data, 1), user: (0, buffer_1.readPubkey)(data, 9),
202
+ amount: (0, buffer_1.readU64)(data, 41), sharesMinted: (0, buffer_1.readU64)(data, 49),
203
+ depositFeeShares: (0, buffer_1.readU64)(data, 57), pps: (0, buffer_1.readU64)(data, 65),
204
+ requestEpochId: (0, buffer_1.readU32)(data, 73),
205
+ } : null;
206
+ case constants_1.EVT_INSTANT_WITHDRAWN:
207
+ return data.length >= 65 ? {
208
+ name: "InstantWithdrawn", vaultId: (0, buffer_1.readU64)(data, 1), user: (0, buffer_1.readPubkey)(data, 9),
209
+ shares: (0, buffer_1.readU64)(data, 41), netBase: (0, buffer_1.readU64)(data, 49),
210
+ withdrawalFeeBase: (0, buffer_1.readU64)(data, 57),
211
+ } : null;
212
+ case constants_1.EVT_STV_SEEDED:
213
+ return data.length >= 17 ? {
214
+ name: "StvSeeded", vaultId: (0, buffer_1.readU64)(data, 1), amount: (0, buffer_1.readU64)(data, 9),
215
+ } : null;
173
216
  default:
174
217
  return null;
175
218
  }
@@ -18,6 +18,8 @@ export interface InitOrUpdateStvArgs {
18
18
  evMint: PublicKey;
19
19
  baseMint: PublicKey;
20
20
  vaultAta: PublicKey;
21
+ /** Canonical ATA for feeReceiver + evMint, pinned on STV. */
22
+ feeReceiverEvAta: PublicKey;
21
23
  tokenProgram: PublicKey;
22
24
  ataProgram?: PublicKey;
23
25
  systemProgram?: PublicKey;
@@ -37,6 +39,16 @@ export interface InitOrUpdateStvArgs {
37
39
  lendProgram?: PublicKey;
38
40
  /** Max % of AUM claimable per epoch window (BPS, 0 = unlimited, max 10000) */
39
41
  dailyWithdrawLimitBps?: number;
42
+ /** Migrate-in fee (BPS, max MAX_FEE_BPS=1000). Applied when FLAG_DEPOSIT_FEE_ON_MIGRATE set. */
43
+ depositFeeBps?: number;
44
+ /** Migrate-out fee (BPS, max MAX_FEE_BPS=1000). Applied when FLAG_WITHDRAWAL_FEE_ON_MIGRATE set. */
45
+ withdrawalFeeBps?: number;
46
+ /**
47
+ * Withdrawal mode: 0=instant, 1=X, 2=X+1. CREATE-ONLY — immutable after the STV
48
+ * exists (the handler rejects a change on update). Instant (0) additionally
49
+ * requires a C-1 seed floor and a non-allocator vault.
50
+ */
51
+ withdrawalMode?: number;
40
52
  remainingAccounts?: AccountMeta[];
41
53
  }
42
54
  export declare function createInitOrUpdateStvIx(args: InitOrUpdateStvArgs, programId?: PublicKey): TransactionInstruction;
@@ -58,6 +70,12 @@ export interface DepositArgs {
58
70
  protocolAumCount?: number;
59
71
  /** Number of auto-route accounts in remaining_accounts (after strategy pairs) */
60
72
  autoRouteCount?: number;
73
+ /** DelayedDepositRequest PDA. Required when the STV has FLAG_DELAYED_DEPOSIT set. */
74
+ delayedDepositRequest?: PublicKey;
75
+ /** PDA bump for delayedDepositRequest. Required when delayedDepositRequest is passed. */
76
+ delayedDepositBump?: number;
77
+ /** System program. Required for delayed deposits because the request PDA may be created. */
78
+ systemProgram?: PublicKey;
61
79
  remainingAccounts?: AccountMeta[];
62
80
  }
63
81
  export declare function createDepositIx(args: DepositArgs, programId?: PublicKey): TransactionInstruction;
@@ -84,11 +102,21 @@ export interface ClaimWithdrawArgs {
84
102
  withdrawRequest: PublicKey;
85
103
  vaultAta: PublicKey;
86
104
  userBaseAta: PublicKey;
105
+ /** Fee receiver's base-mint ATA. Required even when withdrawalFeeBps == 0. */
106
+ feeReceiverBaseAta: PublicKey;
87
107
  baseMint: PublicKey;
88
108
  tokenProgram: PublicKey;
89
109
  remainingAccounts?: AccountMeta[];
90
110
  /** Number of auto-unroute accounts appended after lend accounts (0 = no auto-unroute) */
91
111
  autoUnrouteCount?: number;
112
+ /**
113
+ * Number of protocol-AUM accounts (kVault 2 / Jupiter 3 per protocol) placed in
114
+ * remainingAccounts AFTER the 4 fixed lend accounts and BEFORE the auto-unroute
115
+ * accounts. Feeds the pre-unsweep update_aum refresh. MUST equal the lend strategy's
116
+ * live protocol set when lend has protocols (lend reverts an incomplete tail);
117
+ * pass 0 only when the lend strategy has no protocols.
118
+ */
119
+ protocolAumCount?: number;
92
120
  }
93
121
  export declare function createClaimWithdrawIx(args: ClaimWithdrawArgs, programId?: PublicKey): TransactionInstruction;
94
122
  export interface OverrideClaimWithdrawArgs {
@@ -101,10 +129,14 @@ export interface OverrideClaimWithdrawArgs {
101
129
  withdrawRequest: PublicKey;
102
130
  vaultAta: PublicKey;
103
131
  userBaseAta: PublicKey;
132
+ /** Fee receiver's base-mint ATA. Required even when withdrawalFeeBps == 0. */
133
+ feeReceiverBaseAta: PublicKey;
104
134
  baseMint: PublicKey;
105
135
  tokenProgram: PublicKey;
106
136
  remainingAccounts?: AccountMeta[];
107
137
  autoUnrouteCount?: number;
138
+ /** Protocol-AUM accounts count for the pre-unsweep refresh — see ClaimWithdrawArgs. */
139
+ protocolAumCount?: number;
108
140
  }
109
141
  export declare function createOverrideClaimWithdrawIx(args: OverrideClaimWithdrawArgs, programId?: PublicKey): TransactionInstruction;
110
142
  export interface ProcessEpochArgs {
@@ -123,6 +155,24 @@ export interface ProcessEpochArgs {
123
155
  remainingAccounts?: AccountMeta[];
124
156
  }
125
157
  export declare function createProcessEpochIx(args: ProcessEpochArgs, programId?: PublicKey): TransactionInstruction;
158
+ export interface ProcessDelayedDepositArgs {
159
+ payer: PublicKey;
160
+ /** GlobalConfig PDA — checked for CFG_FLAG_GLOBAL_PAUSED */
161
+ config: PublicKey;
162
+ stv: PublicKey;
163
+ delayedDepositRequest: PublicKey;
164
+ /** User account stored on the delayed deposit request; receives closed-account rent. */
165
+ user: PublicKey;
166
+ vaultAta: PublicKey;
167
+ userEvAta: PublicKey;
168
+ evMint: PublicKey;
169
+ feeReceiverEvAta: PublicKey;
170
+ tokenProgram: PublicKey;
171
+ /** Number of protocol AUM accounts in remaining_accounts (after 4 lend accounts) */
172
+ protocolAumCount?: number;
173
+ remainingAccounts?: AccountMeta[];
174
+ }
175
+ export declare function createProcessDelayedDepositIx(args: ProcessDelayedDepositArgs, programId?: PublicKey): TransactionInstruction;
126
176
  export interface DepositToStrategyArgs {
127
177
  manager: PublicKey;
128
178
  managerRole: PublicKey;
@@ -163,6 +213,12 @@ export interface WithdrawFromStrategyArgs {
163
213
  strategyBaseAta: PublicKey;
164
214
  tokenProgram: PublicKey;
165
215
  shares: BN | number;
216
+ /**
217
+ * remainingAccounts when lend is active: [4 fixed lend, protocolAumCount protocol-AUM
218
+ * accounts]. The protocol-AUM accounts feed the pre-sweep update_aum refresh so the
219
+ * swept base mints lend shares at a fresh pps. Pass 0 only when lend has no protocols.
220
+ */
221
+ protocolAumCount?: number;
166
222
  remainingAccounts?: AccountMeta[];
167
223
  }
168
224
  export declare function createWithdrawFromStrategyIx(args: WithdrawFromStrategyArgs, programId?: PublicKey): TransactionInstruction;
@@ -211,24 +267,211 @@ export interface MigrateLendArgs {
211
267
  protocolAumCount: number;
212
268
  /** Auto-unroute accounts for old lend withdraw. */
213
269
  autoUnrouteCount: number;
270
+ /**
271
+ * Protocol-AUM accounts for the NEW lend's pre-sweep update_aum refresh, trailing
272
+ * the 4 fixed new-lend accounts in the new section. Pass 0 when deactivating lend or
273
+ * when the new lend has no protocols (else lend reverts an incomplete tail).
274
+ */
275
+ newProtocolAumCount?: number;
214
276
  /**
215
277
  * remaining_accounts layout:
216
278
  * Old section (4 + protocolAumCount + autoUnrouteCount):
217
279
  * [oldLendProgram, oldStrategyState, oldStvPosition, oldBaseAta,
218
280
  * ...protocolAumAccounts, ...autoUnrouteAccounts]
219
- * New section (if newLendProgram != default, 4 accounts):
220
- * [newLendProgram, newStrategyState, newPositionPda, newBaseAta]
281
+ * New section (if newLendProgram != default):
282
+ * [newLendProgram, newStrategyState, newPositionPda, newBaseAta,
283
+ * ...newProtocolAumAccounts (count = newProtocolAumCount, for the pre-sweep refresh)]
221
284
  */
222
285
  remainingAccounts?: AccountMeta[];
223
286
  }
224
287
  export declare function createMigrateLendIx(args: MigrateLendArgs, programId?: PublicKey): TransactionInstruction;
288
+ export interface MigrateRequestArgs {
289
+ /** The LP migrating (signer, writable). */
290
+ user: PublicKey;
291
+ /** GlobalConfig PDA — checked for CFG_FLAG_GLOBAL_PAUSED. */
292
+ config: PublicKey;
293
+ /** STV migrating FROM (writable). */
294
+ sourceStv: PublicKey;
295
+ /** STV migrating TO (read-only; base_mint must match source). */
296
+ destStv: PublicKey;
297
+ /** Source STV's evX mint. */
298
+ evMint: PublicKey;
299
+ /** User's source evX token account (writable). */
300
+ userEvAta: PublicKey;
301
+ /** Source STV escrow evX account, owner = source_stv PDA (writable). */
302
+ escrowEvAta: PublicKey;
303
+ /** Migrate-kind WithdrawRequest PDA to initialize — use findMigrateRequestPda. */
304
+ migrateRequest: PublicKey;
305
+ tokenProgram: PublicKey;
306
+ systemProgram?: PublicKey;
307
+ /** evX shares to migrate. */
308
+ shares: BN | number;
309
+ /** Bump for the migrate_request PDA (findMigrateRequestPda[1]). */
310
+ wrBump: number;
311
+ /** Minimum dest shares accepted at execute time (slippage floor; 0 = none). */
312
+ minDestShares: BN | number;
313
+ }
314
+ /**
315
+ * Instruction data layout (17 bytes, after the 1-byte disc is stripped by the
316
+ * dispatcher): shares(u64 LE) + wr_bump(u8) + min_dest_shares(u64 LE).
317
+ * Confirmed against migrate_request.rs:53-66.
318
+ */
319
+ export declare function createMigrateRequestIx(args: MigrateRequestArgs, programId?: PublicKey): TransactionInstruction;
320
+ export interface MigrateExecuteArgs {
321
+ manager: PublicKey;
322
+ /** ManagerRole PDA for (sourceStv, manager). */
323
+ managerRole: PublicKey;
324
+ /** GlobalConfig PDA — checked for CFG_FLAG_GLOBAL_PAUSED. */
325
+ config: PublicKey;
326
+ sourceStv: PublicKey;
327
+ destStv: PublicKey;
328
+ /** Migrate-kind WithdrawRequest PDA (writable, program-owned). */
329
+ wrAccount: PublicKey;
330
+ sourceVaultAta: PublicKey;
331
+ destVaultAta: PublicKey;
332
+ destEvMint: PublicKey;
333
+ /** WR user's dest evX ATA (mint = dest ev_mint, owner = wr.user). */
334
+ userDestEvAta: PublicKey;
335
+ /** Source fee receiver's base ATA (withdrawal fee). */
336
+ sourceFeeRecvAta: PublicKey;
337
+ /** Dest fee receiver's evX ATA (deposit fee). */
338
+ destFeeRecvEvAta: PublicKey;
339
+ baseMint: PublicKey;
340
+ tokenProgram: PublicKey;
341
+ /** Account that receives the WR rent on close — must equal wr.user (slot 14). */
342
+ wrUserAccount: PublicKey;
343
+ /** Source-lend protocol AUM account count for update_aum. */
344
+ srcProtocolAumCount: number;
345
+ /** Dest-lend protocol AUM account count for update_aum. */
346
+ dstProtocolAumCount: number;
347
+ /** Source-lend auto-unroute account count (withdraw deficit). */
348
+ srcAutoUnrouteCount: number;
349
+ /** Dest-lend auto-route account count (sweep). */
350
+ dstAutoRouteCount: number;
351
+ /**
352
+ * remaining_accounts (assemble with buildMigrateRemainingAccounts):
353
+ * src lend fixed(4) + src protocol AUM(srcProtocolAumCount)
354
+ * + src auto-unroute(srcAutoUnrouteCount)
355
+ * + dst lend fixed(4) + dst protocol AUM(dstProtocolAumCount)
356
+ * + dst strategy pairs(0 or 2) + dst auto-route(dstAutoRouteCount)
357
+ * Omit a lend section entirely when that side's lend_program is unset.
358
+ */
359
+ remainingAccounts?: AccountMeta[];
360
+ }
361
+ /**
362
+ * 15 fixed accounts confirmed against migrate_execute.rs:87-91 (destructure)
363
+ * and the doc header at lines 29-52. Slot 14 = wrUserAccount (writable; must
364
+ * equal wr.user). Instruction data (4 bytes): src_protocol_aum_count,
365
+ * dst_protocol_aum_count, src_auto_unroute_count, dst_auto_route_count
366
+ * (migrate_execute.rs:94-100).
367
+ */
368
+ export declare function createMigrateExecuteIx(args: MigrateExecuteArgs, programId?: PublicKey): TransactionInstruction;
225
369
  export declare function buildLendRemainingAccounts(lend: {
226
370
  lendProgram: PublicKey;
227
371
  lendStrategyState: PublicKey;
228
372
  lendStvPosition: PublicKey;
229
373
  lendBaseAta: PublicKey;
230
374
  }): AccountMeta[];
375
+ /**
376
+ * Assemble the migrate_execute remaining_accounts in the exact order
377
+ * parse_lend_accounts expects (migrate_execute.rs:298-338):
378
+ *
379
+ * [ source-lend section ] src.lend(4 fixed) + src.protocolAum(P_src)
380
+ * [ source auto-unroute ] src.autoUnroute (U accounts)
381
+ * [ dest-lend section ] dst.lend(4 fixed) + dst.protocolAum(P_dst)
382
+ * [ dest strategy + route] dst.strategy(0 or 2) + dst.autoRoute (R accounts)
383
+ *
384
+ * Pass `undefined` for a `lend` side whose STV has no lend_program (the 4
385
+ * fixed accounts + protocol AUM are omitted, matching the early return in
386
+ * parse_lend_accounts when lend_program_key == default).
387
+ *
388
+ * The 4 fixed lend accounts mirror `buildLendRemainingAccounts`:
389
+ * [lendProgram(ro), lendStrategyState(w), lendStvPosition(w), lendBaseAta(w)]
390
+ * `protocolAum` / `autoUnroute` / `autoRoute` / `strategy` accounts are passed
391
+ * through verbatim; the caller sets their writable flags per protocol.
392
+ */
393
+ export declare function buildMigrateRemainingAccounts(opts: {
394
+ source: {
395
+ lend?: {
396
+ lendProgram: PublicKey;
397
+ lendStrategyState: PublicKey;
398
+ lendStvPosition: PublicKey;
399
+ lendBaseAta: PublicKey;
400
+ };
401
+ protocolAum?: AccountMeta[];
402
+ autoUnroute?: AccountMeta[];
403
+ };
404
+ dest: {
405
+ lend?: {
406
+ lendProgram: PublicKey;
407
+ lendStrategyState: PublicKey;
408
+ lendStvPosition: PublicKey;
409
+ lendBaseAta: PublicKey;
410
+ };
411
+ protocolAum?: AccountMeta[];
412
+ /** Dest strategy pair [strategyState(w), stvPosition(ro)] when dest has a strategy. */
413
+ strategy?: {
414
+ strategyState: PublicKey;
415
+ stvPosition: PublicKey;
416
+ };
417
+ autoRoute?: AccountMeta[];
418
+ };
419
+ }): AccountMeta[];
231
420
  export declare function buildStrategyRemainingAccounts(strategies: {
232
421
  strategyState: PublicKey;
233
422
  stvPosition: PublicKey;
234
423
  }[]): AccountMeta[];
424
+ export interface InstantWithdrawArgs {
425
+ user: PublicKey;
426
+ /** GlobalConfig PDA — checked for CFG_FLAG_GLOBAL_PAUSED */
427
+ config: PublicKey;
428
+ stv: PublicKey;
429
+ /** canonical ATA(stv, base_mint) */
430
+ vaultAta: PublicKey;
431
+ /** ATA(user, base_mint) — receives net_base */
432
+ userBaseAta: PublicKey;
433
+ /** ATA(stv.fee_receiver, base_mint) */
434
+ feeReceiverBaseAta: PublicKey;
435
+ /** pinned fee-receiver evX ATA — settle_fees mints fee shares here */
436
+ feeReceiverEvAta: PublicKey;
437
+ baseMint: PublicKey;
438
+ evMint: PublicKey;
439
+ /** source of the user-signed burn — ATA(user, ev_mint) */
440
+ userEvAta: PublicKey;
441
+ tokenProgram: PublicKey;
442
+ /** evX shares to redeem */
443
+ shares: BN | number;
444
+ /** minimum net base out (slippage floor) — must be > 0 */
445
+ minBaseOut: BN | number;
446
+ /** number of protocol AUM accounts after the 4 fixed lend accounts (0 = none) */
447
+ protocolAumCount?: number;
448
+ /** number of auto-unroute accounts appended after the lend section (0 = none) */
449
+ autoUnrouteCount?: number;
450
+ /**
451
+ * Trailing accounts after token_program, in order:
452
+ * [4 fixed lend + protocolAumCount][strategy_state, stv_position,
453
+ * strategy_program, strategy_base_ata (only if stv.strategy != 0)][auto_unroute]
454
+ */
455
+ remainingAccounts?: AccountMeta[];
456
+ }
457
+ export declare function createInstantWithdrawIx(args: InstantWithdrawArgs, programId?: PublicKey): TransactionInstruction;
458
+ export interface SeedStvArgs {
459
+ /** config.admin; pays escrow-ATA rent */
460
+ admin: PublicKey;
461
+ config: PublicKey;
462
+ stv: PublicKey;
463
+ evMint: PublicKey;
464
+ /** canonical ATA(stv_pda, ev_mint) — created idempotently */
465
+ escrowEvAta: PublicKey;
466
+ /** canonical ATA(stv_pda, base_mint) */
467
+ vaultAta: PublicKey;
468
+ /** ATA(admin, base_mint) — source of the seed base */
469
+ adminBaseAta: PublicKey;
470
+ baseMint: PublicKey;
471
+ tokenProgram: PublicKey;
472
+ ataProgram?: PublicKey;
473
+ systemProgram?: PublicKey;
474
+ /** base to seed; with any pre-donated base, sets the minted seed-share floor */
475
+ amount: BN | number;
476
+ }
477
+ export declare function createSeedStvIx(args: SeedStvArgs, programId?: PublicKey): TransactionInstruction;