@epicentral/sos-sdk 0.10.2-beta → 0.10.4-beta
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/README.md
CHANGED
|
@@ -63,7 +63,7 @@ Additional modules:
|
|
|
63
63
|
| `buildUnwindWriterUnsoldTransactionWithDerivation` | Builds unwind unsold transaction. |
|
|
64
64
|
| `buildUnwindWriterUnsoldWithLoanRepayment` | **Unwind + repay pool loans in one tx.** Use when closing unsold shorts that borrowed from OMLP. |
|
|
65
65
|
| `buildSyncWriterPositionTransaction` | Syncs writer position with pool accumulators. |
|
|
66
|
-
| `buildSettleMakerCollateralTransaction` | Expiry Phase A:
|
|
66
|
+
| `buildSettleMakerCollateralTransaction` | Expiry Phase A: keeper-signed lender repayment and maker-share snapshot. Repays one active loan's principal + accrued interest to OMLP from collateral vault, and initializes the maker settlement share from `WriterPosition` when older mints do not yet have one. Writers with multiple loans for the expired option call it once per loan; maker residual is claimed separately. |
|
|
67
67
|
| `getClaimMakerRemainingInstructionAsync` | Expiry Phase C generated instruction: returns remaining maker collateral after Phase B buyer payouts complete. |
|
|
68
68
|
| `buildCloseOptionTransaction` | Closes option token account. |
|
|
69
69
|
| `buildClaimThetaTransaction` | Claims theta (time-decay share) for writer. |
|
|
@@ -77,6 +77,7 @@ Additional modules:
|
|
|
77
77
|
- Requires `writer` transaction signer.
|
|
78
78
|
- On-chain transfers for lender repayment and collateral return are authorized by program PDAs (`collateral_pool` / `option_pool`) where applicable.
|
|
79
79
|
- `buildSettleMakerCollateralTransaction`
|
|
80
|
+
- Requires a keeper transaction signer as payer for any missing `MakerCollateralShare` account.
|
|
80
81
|
- No maker transaction signer is required by this instruction format.
|
|
81
82
|
- On-chain repayment (`collateral_vault` -> `omlp_vault`) is signed by the `collateral_pool` PDA.
|
|
82
83
|
- Lender repayment is sourced from collateral vault funds, not maker wallet funds.
|
|
@@ -86,7 +87,7 @@ Additional modules:
|
|
|
86
87
|
|
|
87
88
|
Expiry settlement is lender-first and split across three instructions:
|
|
88
89
|
|
|
89
|
-
1. `settle_maker_collateral` (Phase A) for every non-liquidated maker. Lender repayment is paid to the loan vault's ATA for the pool collateral mint, so devnet fake SOL/USDC pools and mainnet WSOL pools use the same mint-safe path. If a writer has multiple active `PoolLoan` accounts for that expired option, keepers submit one Phase A transaction per loan; the maker share is not marked Phase A settled until all are repaid.
|
|
90
|
+
1. `settle_maker_collateral` (Phase A) for every non-liquidated maker. Lender repayment is paid to the loan vault's ATA for the pool collateral mint, so devnet fake SOL/USDC pools and mainnet WSOL pools use the same mint-safe path. The keeper pays rent to create the maker settlement share if the writer was opened through `option_mint` before that share existed. If a writer has multiple active `PoolLoan` accounts for that expired option, keepers submit one Phase A transaction per loan; the maker share is not marked Phase A settled until all are repaid.
|
|
90
91
|
2. `auto_exercise_expired` / `auto_exercise_all_expired` (Phase B) for buyers, capped by `eligible_maker_pot`; options with zero buyer positions are considered buyer-settled so maker claims do not stall. The single and batch paths take the collateral/settlement mint so cash-settled payouts use the correct token decimals; batch remaining accounts must pair each position with that buyer's token account for the same mint.
|
|
91
92
|
3. `claim_maker_remaining` (Phase C) for makers after `phase_b_complete`, returning residual collateral in the pool collateral mint.
|
|
92
93
|
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
getStructEncoder,
|
|
19
19
|
transformEncoder,
|
|
20
20
|
type AccountMeta,
|
|
21
|
+
type AccountSignerMeta,
|
|
21
22
|
type Address,
|
|
22
23
|
type FixedSizeCodec,
|
|
23
24
|
type FixedSizeDecoder,
|
|
@@ -27,7 +28,9 @@ import {
|
|
|
27
28
|
type InstructionWithData,
|
|
28
29
|
type ReadonlyAccount,
|
|
29
30
|
type ReadonlyUint8Array,
|
|
31
|
+
type TransactionSigner,
|
|
30
32
|
type WritableAccount,
|
|
33
|
+
type WritableSignerAccount,
|
|
31
34
|
} from "@solana/kit";
|
|
32
35
|
import { OPTION_PROGRAM_PROGRAM_ADDRESS } from "../programs";
|
|
33
36
|
import {
|
|
@@ -50,12 +53,13 @@ export type SettleMakerCollateralInstruction<
|
|
|
50
53
|
TProgram extends string = typeof OPTION_PROGRAM_PROGRAM_ADDRESS,
|
|
51
54
|
TAccountCollateralPool extends string | AccountMeta<string> = string,
|
|
52
55
|
TAccountOptionAccount extends string | AccountMeta<string> = string,
|
|
53
|
-
TAccountMakerCollateralShare extends string | AccountMeta<string> = string,
|
|
54
56
|
TAccountWriterPosition extends string | AccountMeta<string> = string,
|
|
57
|
+
TAccountMakerCollateralShare extends string | AccountMeta<string> = string,
|
|
55
58
|
TAccountCollateralVault extends string | AccountMeta<string> = string,
|
|
56
59
|
TAccountOmlpVault extends string | AccountMeta<string> = string,
|
|
57
60
|
TAccountOmlpVaultState extends string | AccountMeta<string> = string,
|
|
58
61
|
TAccountPoolLoan extends string | AccountMeta<string> = string,
|
|
62
|
+
TAccountKeeper extends string | AccountMeta<string> = string,
|
|
59
63
|
TAccountTokenProgram extends string | AccountMeta<string> =
|
|
60
64
|
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
|
|
61
65
|
TAccountSystemProgram extends string | AccountMeta<string> =
|
|
@@ -71,12 +75,12 @@ export type SettleMakerCollateralInstruction<
|
|
|
71
75
|
TAccountOptionAccount extends string
|
|
72
76
|
? ReadonlyAccount<TAccountOptionAccount>
|
|
73
77
|
: TAccountOptionAccount,
|
|
74
|
-
TAccountMakerCollateralShare extends string
|
|
75
|
-
? WritableAccount<TAccountMakerCollateralShare>
|
|
76
|
-
: TAccountMakerCollateralShare,
|
|
77
78
|
TAccountWriterPosition extends string
|
|
78
79
|
? WritableAccount<TAccountWriterPosition>
|
|
79
80
|
: TAccountWriterPosition,
|
|
81
|
+
TAccountMakerCollateralShare extends string
|
|
82
|
+
? WritableAccount<TAccountMakerCollateralShare>
|
|
83
|
+
: TAccountMakerCollateralShare,
|
|
80
84
|
TAccountCollateralVault extends string
|
|
81
85
|
? WritableAccount<TAccountCollateralVault>
|
|
82
86
|
: TAccountCollateralVault,
|
|
@@ -89,6 +93,10 @@ export type SettleMakerCollateralInstruction<
|
|
|
89
93
|
TAccountPoolLoan extends string
|
|
90
94
|
? WritableAccount<TAccountPoolLoan>
|
|
91
95
|
: TAccountPoolLoan,
|
|
96
|
+
TAccountKeeper extends string
|
|
97
|
+
? WritableSignerAccount<TAccountKeeper> &
|
|
98
|
+
AccountSignerMeta<TAccountKeeper>
|
|
99
|
+
: TAccountKeeper,
|
|
92
100
|
TAccountTokenProgram extends string
|
|
93
101
|
? ReadonlyAccount<TAccountTokenProgram>
|
|
94
102
|
: TAccountTokenProgram,
|
|
@@ -134,20 +142,21 @@ export function getSettleMakerCollateralInstructionDataCodec(): FixedSizeCodec<
|
|
|
134
142
|
export type SettleMakerCollateralAsyncInput<
|
|
135
143
|
TAccountCollateralPool extends string = string,
|
|
136
144
|
TAccountOptionAccount extends string = string,
|
|
137
|
-
TAccountMakerCollateralShare extends string = string,
|
|
138
145
|
TAccountWriterPosition extends string = string,
|
|
146
|
+
TAccountMakerCollateralShare extends string = string,
|
|
139
147
|
TAccountCollateralVault extends string = string,
|
|
140
148
|
TAccountOmlpVault extends string = string,
|
|
141
149
|
TAccountOmlpVaultState extends string = string,
|
|
142
150
|
TAccountPoolLoan extends string = string,
|
|
151
|
+
TAccountKeeper extends string = string,
|
|
143
152
|
TAccountTokenProgram extends string = string,
|
|
144
153
|
TAccountSystemProgram extends string = string,
|
|
145
154
|
> = {
|
|
146
155
|
collateralPool?: Address<TAccountCollateralPool>;
|
|
147
156
|
/** The option account (needed for PDA derivation) */
|
|
148
157
|
optionAccount: Address<TAccountOptionAccount>;
|
|
149
|
-
makerCollateralShare: Address<TAccountMakerCollateralShare>;
|
|
150
158
|
writerPosition: Address<TAccountWriterPosition>;
|
|
159
|
+
makerCollateralShare: Address<TAccountMakerCollateralShare>;
|
|
151
160
|
/** Pool's collateral vault */
|
|
152
161
|
collateralVault: Address<TAccountCollateralVault>;
|
|
153
162
|
/** OMLP Vault token account (receives loan repayments when the maker borrowed) */
|
|
@@ -156,6 +165,7 @@ export type SettleMakerCollateralAsyncInput<
|
|
|
156
165
|
omlpVaultState?: Address<TAccountOmlpVaultState>;
|
|
157
166
|
/** Optional OMLP Pool Loan for leveraged makers; unleveraged makers omit it. */
|
|
158
167
|
poolLoan?: Address<TAccountPoolLoan>;
|
|
168
|
+
keeper: TransactionSigner<TAccountKeeper>;
|
|
159
169
|
tokenProgram?: Address<TAccountTokenProgram>;
|
|
160
170
|
systemProgram?: Address<TAccountSystemProgram>;
|
|
161
171
|
};
|
|
@@ -163,12 +173,13 @@ export type SettleMakerCollateralAsyncInput<
|
|
|
163
173
|
export async function getSettleMakerCollateralInstructionAsync<
|
|
164
174
|
TAccountCollateralPool extends string,
|
|
165
175
|
TAccountOptionAccount extends string,
|
|
166
|
-
TAccountMakerCollateralShare extends string,
|
|
167
176
|
TAccountWriterPosition extends string,
|
|
177
|
+
TAccountMakerCollateralShare extends string,
|
|
168
178
|
TAccountCollateralVault extends string,
|
|
169
179
|
TAccountOmlpVault extends string,
|
|
170
180
|
TAccountOmlpVaultState extends string,
|
|
171
181
|
TAccountPoolLoan extends string,
|
|
182
|
+
TAccountKeeper extends string,
|
|
172
183
|
TAccountTokenProgram extends string,
|
|
173
184
|
TAccountSystemProgram extends string,
|
|
174
185
|
TProgramAddress extends Address = typeof OPTION_PROGRAM_PROGRAM_ADDRESS,
|
|
@@ -176,12 +187,13 @@ export async function getSettleMakerCollateralInstructionAsync<
|
|
|
176
187
|
input: SettleMakerCollateralAsyncInput<
|
|
177
188
|
TAccountCollateralPool,
|
|
178
189
|
TAccountOptionAccount,
|
|
179
|
-
TAccountMakerCollateralShare,
|
|
180
190
|
TAccountWriterPosition,
|
|
191
|
+
TAccountMakerCollateralShare,
|
|
181
192
|
TAccountCollateralVault,
|
|
182
193
|
TAccountOmlpVault,
|
|
183
194
|
TAccountOmlpVaultState,
|
|
184
195
|
TAccountPoolLoan,
|
|
196
|
+
TAccountKeeper,
|
|
185
197
|
TAccountTokenProgram,
|
|
186
198
|
TAccountSystemProgram
|
|
187
199
|
>,
|
|
@@ -191,12 +203,13 @@ export async function getSettleMakerCollateralInstructionAsync<
|
|
|
191
203
|
TProgramAddress,
|
|
192
204
|
TAccountCollateralPool,
|
|
193
205
|
TAccountOptionAccount,
|
|
194
|
-
TAccountMakerCollateralShare,
|
|
195
206
|
TAccountWriterPosition,
|
|
207
|
+
TAccountMakerCollateralShare,
|
|
196
208
|
TAccountCollateralVault,
|
|
197
209
|
TAccountOmlpVault,
|
|
198
210
|
TAccountOmlpVaultState,
|
|
199
211
|
TAccountPoolLoan,
|
|
212
|
+
TAccountKeeper,
|
|
200
213
|
TAccountTokenProgram,
|
|
201
214
|
TAccountSystemProgram
|
|
202
215
|
>
|
|
@@ -209,15 +222,16 @@ export async function getSettleMakerCollateralInstructionAsync<
|
|
|
209
222
|
const originalAccounts = {
|
|
210
223
|
collateralPool: { value: input.collateralPool ?? null, isWritable: true },
|
|
211
224
|
optionAccount: { value: input.optionAccount ?? null, isWritable: false },
|
|
225
|
+
writerPosition: { value: input.writerPosition ?? null, isWritable: true },
|
|
212
226
|
makerCollateralShare: {
|
|
213
227
|
value: input.makerCollateralShare ?? null,
|
|
214
228
|
isWritable: true,
|
|
215
229
|
},
|
|
216
|
-
writerPosition: { value: input.writerPosition ?? null, isWritable: true },
|
|
217
230
|
collateralVault: { value: input.collateralVault ?? null, isWritable: true },
|
|
218
231
|
omlpVault: { value: input.omlpVault ?? null, isWritable: true },
|
|
219
232
|
omlpVaultState: { value: input.omlpVaultState ?? null, isWritable: true },
|
|
220
233
|
poolLoan: { value: input.poolLoan ?? null, isWritable: true },
|
|
234
|
+
keeper: { value: input.keeper ?? null, isWritable: true },
|
|
221
235
|
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
222
236
|
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
223
237
|
};
|
|
@@ -255,12 +269,13 @@ export async function getSettleMakerCollateralInstructionAsync<
|
|
|
255
269
|
accounts: [
|
|
256
270
|
getAccountMeta(accounts.collateralPool),
|
|
257
271
|
getAccountMeta(accounts.optionAccount),
|
|
258
|
-
getAccountMeta(accounts.makerCollateralShare),
|
|
259
272
|
getAccountMeta(accounts.writerPosition),
|
|
273
|
+
getAccountMeta(accounts.makerCollateralShare),
|
|
260
274
|
getAccountMeta(accounts.collateralVault),
|
|
261
275
|
getAccountMeta(accounts.omlpVault),
|
|
262
276
|
getAccountMeta(accounts.omlpVaultState),
|
|
263
277
|
getAccountMeta(accounts.poolLoan),
|
|
278
|
+
getAccountMeta(accounts.keeper),
|
|
264
279
|
getAccountMeta(accounts.tokenProgram),
|
|
265
280
|
getAccountMeta(accounts.systemProgram),
|
|
266
281
|
],
|
|
@@ -270,12 +285,13 @@ export async function getSettleMakerCollateralInstructionAsync<
|
|
|
270
285
|
TProgramAddress,
|
|
271
286
|
TAccountCollateralPool,
|
|
272
287
|
TAccountOptionAccount,
|
|
273
|
-
TAccountMakerCollateralShare,
|
|
274
288
|
TAccountWriterPosition,
|
|
289
|
+
TAccountMakerCollateralShare,
|
|
275
290
|
TAccountCollateralVault,
|
|
276
291
|
TAccountOmlpVault,
|
|
277
292
|
TAccountOmlpVaultState,
|
|
278
293
|
TAccountPoolLoan,
|
|
294
|
+
TAccountKeeper,
|
|
279
295
|
TAccountTokenProgram,
|
|
280
296
|
TAccountSystemProgram
|
|
281
297
|
>);
|
|
@@ -284,20 +300,21 @@ export async function getSettleMakerCollateralInstructionAsync<
|
|
|
284
300
|
export type SettleMakerCollateralInput<
|
|
285
301
|
TAccountCollateralPool extends string = string,
|
|
286
302
|
TAccountOptionAccount extends string = string,
|
|
287
|
-
TAccountMakerCollateralShare extends string = string,
|
|
288
303
|
TAccountWriterPosition extends string = string,
|
|
304
|
+
TAccountMakerCollateralShare extends string = string,
|
|
289
305
|
TAccountCollateralVault extends string = string,
|
|
290
306
|
TAccountOmlpVault extends string = string,
|
|
291
307
|
TAccountOmlpVaultState extends string = string,
|
|
292
308
|
TAccountPoolLoan extends string = string,
|
|
309
|
+
TAccountKeeper extends string = string,
|
|
293
310
|
TAccountTokenProgram extends string = string,
|
|
294
311
|
TAccountSystemProgram extends string = string,
|
|
295
312
|
> = {
|
|
296
313
|
collateralPool: Address<TAccountCollateralPool>;
|
|
297
314
|
/** The option account (needed for PDA derivation) */
|
|
298
315
|
optionAccount: Address<TAccountOptionAccount>;
|
|
299
|
-
makerCollateralShare: Address<TAccountMakerCollateralShare>;
|
|
300
316
|
writerPosition: Address<TAccountWriterPosition>;
|
|
317
|
+
makerCollateralShare: Address<TAccountMakerCollateralShare>;
|
|
301
318
|
/** Pool's collateral vault */
|
|
302
319
|
collateralVault: Address<TAccountCollateralVault>;
|
|
303
320
|
/** OMLP Vault token account (receives loan repayments when the maker borrowed) */
|
|
@@ -306,6 +323,7 @@ export type SettleMakerCollateralInput<
|
|
|
306
323
|
omlpVaultState?: Address<TAccountOmlpVaultState>;
|
|
307
324
|
/** Optional OMLP Pool Loan for leveraged makers; unleveraged makers omit it. */
|
|
308
325
|
poolLoan?: Address<TAccountPoolLoan>;
|
|
326
|
+
keeper: TransactionSigner<TAccountKeeper>;
|
|
309
327
|
tokenProgram?: Address<TAccountTokenProgram>;
|
|
310
328
|
systemProgram?: Address<TAccountSystemProgram>;
|
|
311
329
|
};
|
|
@@ -313,12 +331,13 @@ export type SettleMakerCollateralInput<
|
|
|
313
331
|
export function getSettleMakerCollateralInstruction<
|
|
314
332
|
TAccountCollateralPool extends string,
|
|
315
333
|
TAccountOptionAccount extends string,
|
|
316
|
-
TAccountMakerCollateralShare extends string,
|
|
317
334
|
TAccountWriterPosition extends string,
|
|
335
|
+
TAccountMakerCollateralShare extends string,
|
|
318
336
|
TAccountCollateralVault extends string,
|
|
319
337
|
TAccountOmlpVault extends string,
|
|
320
338
|
TAccountOmlpVaultState extends string,
|
|
321
339
|
TAccountPoolLoan extends string,
|
|
340
|
+
TAccountKeeper extends string,
|
|
322
341
|
TAccountTokenProgram extends string,
|
|
323
342
|
TAccountSystemProgram extends string,
|
|
324
343
|
TProgramAddress extends Address = typeof OPTION_PROGRAM_PROGRAM_ADDRESS,
|
|
@@ -326,12 +345,13 @@ export function getSettleMakerCollateralInstruction<
|
|
|
326
345
|
input: SettleMakerCollateralInput<
|
|
327
346
|
TAccountCollateralPool,
|
|
328
347
|
TAccountOptionAccount,
|
|
329
|
-
TAccountMakerCollateralShare,
|
|
330
348
|
TAccountWriterPosition,
|
|
349
|
+
TAccountMakerCollateralShare,
|
|
331
350
|
TAccountCollateralVault,
|
|
332
351
|
TAccountOmlpVault,
|
|
333
352
|
TAccountOmlpVaultState,
|
|
334
353
|
TAccountPoolLoan,
|
|
354
|
+
TAccountKeeper,
|
|
335
355
|
TAccountTokenProgram,
|
|
336
356
|
TAccountSystemProgram
|
|
337
357
|
>,
|
|
@@ -340,12 +360,13 @@ export function getSettleMakerCollateralInstruction<
|
|
|
340
360
|
TProgramAddress,
|
|
341
361
|
TAccountCollateralPool,
|
|
342
362
|
TAccountOptionAccount,
|
|
343
|
-
TAccountMakerCollateralShare,
|
|
344
363
|
TAccountWriterPosition,
|
|
364
|
+
TAccountMakerCollateralShare,
|
|
345
365
|
TAccountCollateralVault,
|
|
346
366
|
TAccountOmlpVault,
|
|
347
367
|
TAccountOmlpVaultState,
|
|
348
368
|
TAccountPoolLoan,
|
|
369
|
+
TAccountKeeper,
|
|
349
370
|
TAccountTokenProgram,
|
|
350
371
|
TAccountSystemProgram
|
|
351
372
|
> {
|
|
@@ -357,15 +378,16 @@ export function getSettleMakerCollateralInstruction<
|
|
|
357
378
|
const originalAccounts = {
|
|
358
379
|
collateralPool: { value: input.collateralPool ?? null, isWritable: true },
|
|
359
380
|
optionAccount: { value: input.optionAccount ?? null, isWritable: false },
|
|
381
|
+
writerPosition: { value: input.writerPosition ?? null, isWritable: true },
|
|
360
382
|
makerCollateralShare: {
|
|
361
383
|
value: input.makerCollateralShare ?? null,
|
|
362
384
|
isWritable: true,
|
|
363
385
|
},
|
|
364
|
-
writerPosition: { value: input.writerPosition ?? null, isWritable: true },
|
|
365
386
|
collateralVault: { value: input.collateralVault ?? null, isWritable: true },
|
|
366
387
|
omlpVault: { value: input.omlpVault ?? null, isWritable: true },
|
|
367
388
|
omlpVaultState: { value: input.omlpVaultState ?? null, isWritable: true },
|
|
368
389
|
poolLoan: { value: input.poolLoan ?? null, isWritable: true },
|
|
390
|
+
keeper: { value: input.keeper ?? null, isWritable: true },
|
|
369
391
|
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
370
392
|
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
371
393
|
};
|
|
@@ -389,12 +411,13 @@ export function getSettleMakerCollateralInstruction<
|
|
|
389
411
|
accounts: [
|
|
390
412
|
getAccountMeta(accounts.collateralPool),
|
|
391
413
|
getAccountMeta(accounts.optionAccount),
|
|
392
|
-
getAccountMeta(accounts.makerCollateralShare),
|
|
393
414
|
getAccountMeta(accounts.writerPosition),
|
|
415
|
+
getAccountMeta(accounts.makerCollateralShare),
|
|
394
416
|
getAccountMeta(accounts.collateralVault),
|
|
395
417
|
getAccountMeta(accounts.omlpVault),
|
|
396
418
|
getAccountMeta(accounts.omlpVaultState),
|
|
397
419
|
getAccountMeta(accounts.poolLoan),
|
|
420
|
+
getAccountMeta(accounts.keeper),
|
|
398
421
|
getAccountMeta(accounts.tokenProgram),
|
|
399
422
|
getAccountMeta(accounts.systemProgram),
|
|
400
423
|
],
|
|
@@ -404,12 +427,13 @@ export function getSettleMakerCollateralInstruction<
|
|
|
404
427
|
TProgramAddress,
|
|
405
428
|
TAccountCollateralPool,
|
|
406
429
|
TAccountOptionAccount,
|
|
407
|
-
TAccountMakerCollateralShare,
|
|
408
430
|
TAccountWriterPosition,
|
|
431
|
+
TAccountMakerCollateralShare,
|
|
409
432
|
TAccountCollateralVault,
|
|
410
433
|
TAccountOmlpVault,
|
|
411
434
|
TAccountOmlpVaultState,
|
|
412
435
|
TAccountPoolLoan,
|
|
436
|
+
TAccountKeeper,
|
|
413
437
|
TAccountTokenProgram,
|
|
414
438
|
TAccountSystemProgram
|
|
415
439
|
>);
|
|
@@ -424,8 +448,8 @@ export type ParsedSettleMakerCollateralInstruction<
|
|
|
424
448
|
collateralPool: TAccountMetas[0];
|
|
425
449
|
/** The option account (needed for PDA derivation) */
|
|
426
450
|
optionAccount: TAccountMetas[1];
|
|
427
|
-
|
|
428
|
-
|
|
451
|
+
writerPosition: TAccountMetas[2];
|
|
452
|
+
makerCollateralShare: TAccountMetas[3];
|
|
429
453
|
/** Pool's collateral vault */
|
|
430
454
|
collateralVault: TAccountMetas[4];
|
|
431
455
|
/** OMLP Vault token account (receives loan repayments when the maker borrowed) */
|
|
@@ -434,8 +458,9 @@ export type ParsedSettleMakerCollateralInstruction<
|
|
|
434
458
|
omlpVaultState?: TAccountMetas[6] | undefined;
|
|
435
459
|
/** Optional OMLP Pool Loan for leveraged makers; unleveraged makers omit it. */
|
|
436
460
|
poolLoan?: TAccountMetas[7] | undefined;
|
|
437
|
-
|
|
438
|
-
|
|
461
|
+
keeper: TAccountMetas[8];
|
|
462
|
+
tokenProgram: TAccountMetas[9];
|
|
463
|
+
systemProgram: TAccountMetas[10];
|
|
439
464
|
};
|
|
440
465
|
data: SettleMakerCollateralInstructionData;
|
|
441
466
|
};
|
|
@@ -448,7 +473,7 @@ export function parseSettleMakerCollateralInstruction<
|
|
|
448
473
|
InstructionWithAccounts<TAccountMetas> &
|
|
449
474
|
InstructionWithData<ReadonlyUint8Array>,
|
|
450
475
|
): ParsedSettleMakerCollateralInstruction<TProgram, TAccountMetas> {
|
|
451
|
-
if (instruction.accounts.length <
|
|
476
|
+
if (instruction.accounts.length < 11) {
|
|
452
477
|
// TODO: Coded error.
|
|
453
478
|
throw new Error("Not enough accounts");
|
|
454
479
|
}
|
|
@@ -469,12 +494,13 @@ export function parseSettleMakerCollateralInstruction<
|
|
|
469
494
|
accounts: {
|
|
470
495
|
collateralPool: getNextAccount(),
|
|
471
496
|
optionAccount: getNextAccount(),
|
|
472
|
-
makerCollateralShare: getNextAccount(),
|
|
473
497
|
writerPosition: getNextAccount(),
|
|
498
|
+
makerCollateralShare: getNextAccount(),
|
|
474
499
|
collateralVault: getNextAccount(),
|
|
475
500
|
omlpVault: getNextOptionalAccount(),
|
|
476
501
|
omlpVaultState: getNextOptionalAccount(),
|
|
477
502
|
poolLoan: getNextOptionalAccount(),
|
|
503
|
+
keeper: getNextAccount(),
|
|
478
504
|
tokenProgram: getNextAccount(),
|
|
479
505
|
systemProgram: getNextAccount(),
|
|
480
506
|
},
|
|
@@ -7,57 +7,13 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import {
|
|
10
|
-
assertIsInstructionWithAccounts,
|
|
11
10
|
containsBytes,
|
|
12
11
|
fixEncoderSize,
|
|
13
12
|
getBytesEncoder,
|
|
14
13
|
type Address,
|
|
15
|
-
type Instruction,
|
|
16
|
-
type InstructionWithData,
|
|
17
14
|
type ReadonlyUint8Array,
|
|
18
15
|
} from "@solana/kit";
|
|
19
16
|
import {
|
|
20
|
-
parseAcceptAdminInstruction,
|
|
21
|
-
parseAutoExerciseAllExpiredInstruction,
|
|
22
|
-
parseAutoExerciseExpiredInstruction,
|
|
23
|
-
parseBorrowFromPoolInstruction,
|
|
24
|
-
parseBuyFromPoolInstruction,
|
|
25
|
-
parseClaimMakerRemainingInstruction,
|
|
26
|
-
parseCloseLongToPoolInstruction,
|
|
27
|
-
parseCloseOptionInstruction,
|
|
28
|
-
parseCreateEscrowV2Instruction,
|
|
29
|
-
parseDepositCollateralInstruction,
|
|
30
|
-
parseDepositToPositionInstruction,
|
|
31
|
-
parseInitCollateralPoolInstruction,
|
|
32
|
-
parseInitConfigInstruction,
|
|
33
|
-
parseInitializeMarketDataInstruction,
|
|
34
|
-
parseInitOptionPoolInstruction,
|
|
35
|
-
parseLiquidateWriterPositionInstruction,
|
|
36
|
-
parseLiquidateWriterPositionRescueInstruction,
|
|
37
|
-
parseMigrateCollateralPoolV1ToV2Instruction,
|
|
38
|
-
parseOmlpCreateVaultInstruction,
|
|
39
|
-
parseOmlpUpdateFeeWalletInstruction,
|
|
40
|
-
parseOmlpUpdateInterestModelInstruction,
|
|
41
|
-
parseOmlpUpdateLiquidationThresholdInstruction,
|
|
42
|
-
parseOmlpUpdateMaintenanceBufferInstruction,
|
|
43
|
-
parseOmlpUpdateMaxBorrowCapInstruction,
|
|
44
|
-
parseOmlpUpdateMaxLeverageInstruction,
|
|
45
|
-
parseOmlpUpdateProtocolFeeInstruction,
|
|
46
|
-
parseOmlpUpdateSupplyLimitInstruction,
|
|
47
|
-
parseOptionExerciseInstruction,
|
|
48
|
-
parseOptionMintInstruction,
|
|
49
|
-
parseOptionValidateInstruction,
|
|
50
|
-
parseRepayPoolLoanFromCollateralInstruction,
|
|
51
|
-
parseRepayPoolLoanFromWalletInstruction,
|
|
52
|
-
parseRepayPoolLoanInstruction,
|
|
53
|
-
parseSettleMakerCollateralInstruction,
|
|
54
|
-
parseSyncWriterPositionInstruction,
|
|
55
|
-
parseTransferAdminInstruction,
|
|
56
|
-
parseUnwindWriterUnsoldInstruction,
|
|
57
|
-
parseUpdateImpliedVolatilityInstruction,
|
|
58
|
-
parseUpdateMarketDataInstruction,
|
|
59
|
-
parseWithdrawFromPositionInstruction,
|
|
60
|
-
parseWriteToPoolInstruction,
|
|
61
17
|
type ParsedAcceptAdminInstruction,
|
|
62
18
|
type ParsedAutoExerciseAllExpiredInstruction,
|
|
63
19
|
type ParsedAutoExerciseExpiredInstruction,
|
|
@@ -890,303 +846,3 @@ export type ParsedOptionProgramInstruction<
|
|
|
890
846
|
| ({
|
|
891
847
|
instructionType: OptionProgramInstruction.WriteToPool;
|
|
892
848
|
} & ParsedWriteToPoolInstruction<TProgram>);
|
|
893
|
-
|
|
894
|
-
export function parseOptionProgramInstruction<TProgram extends string>(
|
|
895
|
-
instruction: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>,
|
|
896
|
-
): ParsedOptionProgramInstruction<TProgram> {
|
|
897
|
-
const instructionType = identifyOptionProgramInstruction(instruction);
|
|
898
|
-
switch (instructionType) {
|
|
899
|
-
case OptionProgramInstruction.AcceptAdmin: {
|
|
900
|
-
assertIsInstructionWithAccounts(instruction);
|
|
901
|
-
return {
|
|
902
|
-
instructionType: OptionProgramInstruction.AcceptAdmin,
|
|
903
|
-
...parseAcceptAdminInstruction(instruction),
|
|
904
|
-
};
|
|
905
|
-
}
|
|
906
|
-
case OptionProgramInstruction.AutoExerciseAllExpired: {
|
|
907
|
-
assertIsInstructionWithAccounts(instruction);
|
|
908
|
-
return {
|
|
909
|
-
instructionType: OptionProgramInstruction.AutoExerciseAllExpired,
|
|
910
|
-
...parseAutoExerciseAllExpiredInstruction(instruction),
|
|
911
|
-
};
|
|
912
|
-
}
|
|
913
|
-
case OptionProgramInstruction.AutoExerciseExpired: {
|
|
914
|
-
assertIsInstructionWithAccounts(instruction);
|
|
915
|
-
return {
|
|
916
|
-
instructionType: OptionProgramInstruction.AutoExerciseExpired,
|
|
917
|
-
...parseAutoExerciseExpiredInstruction(instruction),
|
|
918
|
-
};
|
|
919
|
-
}
|
|
920
|
-
case OptionProgramInstruction.BorrowFromPool: {
|
|
921
|
-
assertIsInstructionWithAccounts(instruction);
|
|
922
|
-
return {
|
|
923
|
-
instructionType: OptionProgramInstruction.BorrowFromPool,
|
|
924
|
-
...parseBorrowFromPoolInstruction(instruction),
|
|
925
|
-
};
|
|
926
|
-
}
|
|
927
|
-
case OptionProgramInstruction.BuyFromPool: {
|
|
928
|
-
assertIsInstructionWithAccounts(instruction);
|
|
929
|
-
return {
|
|
930
|
-
instructionType: OptionProgramInstruction.BuyFromPool,
|
|
931
|
-
...parseBuyFromPoolInstruction(instruction),
|
|
932
|
-
};
|
|
933
|
-
}
|
|
934
|
-
case OptionProgramInstruction.ClaimMakerRemaining: {
|
|
935
|
-
assertIsInstructionWithAccounts(instruction);
|
|
936
|
-
return {
|
|
937
|
-
instructionType: OptionProgramInstruction.ClaimMakerRemaining,
|
|
938
|
-
...parseClaimMakerRemainingInstruction(instruction),
|
|
939
|
-
};
|
|
940
|
-
}
|
|
941
|
-
case OptionProgramInstruction.CloseLongToPool: {
|
|
942
|
-
assertIsInstructionWithAccounts(instruction);
|
|
943
|
-
return {
|
|
944
|
-
instructionType: OptionProgramInstruction.CloseLongToPool,
|
|
945
|
-
...parseCloseLongToPoolInstruction(instruction),
|
|
946
|
-
};
|
|
947
|
-
}
|
|
948
|
-
case OptionProgramInstruction.CloseOption: {
|
|
949
|
-
assertIsInstructionWithAccounts(instruction);
|
|
950
|
-
return {
|
|
951
|
-
instructionType: OptionProgramInstruction.CloseOption,
|
|
952
|
-
...parseCloseOptionInstruction(instruction),
|
|
953
|
-
};
|
|
954
|
-
}
|
|
955
|
-
case OptionProgramInstruction.CreateEscrowV2: {
|
|
956
|
-
assertIsInstructionWithAccounts(instruction);
|
|
957
|
-
return {
|
|
958
|
-
instructionType: OptionProgramInstruction.CreateEscrowV2,
|
|
959
|
-
...parseCreateEscrowV2Instruction(instruction),
|
|
960
|
-
};
|
|
961
|
-
}
|
|
962
|
-
case OptionProgramInstruction.DepositCollateral: {
|
|
963
|
-
assertIsInstructionWithAccounts(instruction);
|
|
964
|
-
return {
|
|
965
|
-
instructionType: OptionProgramInstruction.DepositCollateral,
|
|
966
|
-
...parseDepositCollateralInstruction(instruction),
|
|
967
|
-
};
|
|
968
|
-
}
|
|
969
|
-
case OptionProgramInstruction.DepositToPosition: {
|
|
970
|
-
assertIsInstructionWithAccounts(instruction);
|
|
971
|
-
return {
|
|
972
|
-
instructionType: OptionProgramInstruction.DepositToPosition,
|
|
973
|
-
...parseDepositToPositionInstruction(instruction),
|
|
974
|
-
};
|
|
975
|
-
}
|
|
976
|
-
case OptionProgramInstruction.InitCollateralPool: {
|
|
977
|
-
assertIsInstructionWithAccounts(instruction);
|
|
978
|
-
return {
|
|
979
|
-
instructionType: OptionProgramInstruction.InitCollateralPool,
|
|
980
|
-
...parseInitCollateralPoolInstruction(instruction),
|
|
981
|
-
};
|
|
982
|
-
}
|
|
983
|
-
case OptionProgramInstruction.InitConfig: {
|
|
984
|
-
assertIsInstructionWithAccounts(instruction);
|
|
985
|
-
return {
|
|
986
|
-
instructionType: OptionProgramInstruction.InitConfig,
|
|
987
|
-
...parseInitConfigInstruction(instruction),
|
|
988
|
-
};
|
|
989
|
-
}
|
|
990
|
-
case OptionProgramInstruction.InitOptionPool: {
|
|
991
|
-
assertIsInstructionWithAccounts(instruction);
|
|
992
|
-
return {
|
|
993
|
-
instructionType: OptionProgramInstruction.InitOptionPool,
|
|
994
|
-
...parseInitOptionPoolInstruction(instruction),
|
|
995
|
-
};
|
|
996
|
-
}
|
|
997
|
-
case OptionProgramInstruction.InitializeMarketData: {
|
|
998
|
-
assertIsInstructionWithAccounts(instruction);
|
|
999
|
-
return {
|
|
1000
|
-
instructionType: OptionProgramInstruction.InitializeMarketData,
|
|
1001
|
-
...parseInitializeMarketDataInstruction(instruction),
|
|
1002
|
-
};
|
|
1003
|
-
}
|
|
1004
|
-
case OptionProgramInstruction.LiquidateWriterPosition: {
|
|
1005
|
-
assertIsInstructionWithAccounts(instruction);
|
|
1006
|
-
return {
|
|
1007
|
-
instructionType: OptionProgramInstruction.LiquidateWriterPosition,
|
|
1008
|
-
...parseLiquidateWriterPositionInstruction(instruction),
|
|
1009
|
-
};
|
|
1010
|
-
}
|
|
1011
|
-
case OptionProgramInstruction.LiquidateWriterPositionRescue: {
|
|
1012
|
-
assertIsInstructionWithAccounts(instruction);
|
|
1013
|
-
return {
|
|
1014
|
-
instructionType: OptionProgramInstruction.LiquidateWriterPositionRescue,
|
|
1015
|
-
...parseLiquidateWriterPositionRescueInstruction(instruction),
|
|
1016
|
-
};
|
|
1017
|
-
}
|
|
1018
|
-
case OptionProgramInstruction.MigrateCollateralPoolV1ToV2: {
|
|
1019
|
-
assertIsInstructionWithAccounts(instruction);
|
|
1020
|
-
return {
|
|
1021
|
-
instructionType: OptionProgramInstruction.MigrateCollateralPoolV1ToV2,
|
|
1022
|
-
...parseMigrateCollateralPoolV1ToV2Instruction(instruction),
|
|
1023
|
-
};
|
|
1024
|
-
}
|
|
1025
|
-
case OptionProgramInstruction.OmlpCreateVault: {
|
|
1026
|
-
assertIsInstructionWithAccounts(instruction);
|
|
1027
|
-
return {
|
|
1028
|
-
instructionType: OptionProgramInstruction.OmlpCreateVault,
|
|
1029
|
-
...parseOmlpCreateVaultInstruction(instruction),
|
|
1030
|
-
};
|
|
1031
|
-
}
|
|
1032
|
-
case OptionProgramInstruction.OmlpUpdateFeeWallet: {
|
|
1033
|
-
assertIsInstructionWithAccounts(instruction);
|
|
1034
|
-
return {
|
|
1035
|
-
instructionType: OptionProgramInstruction.OmlpUpdateFeeWallet,
|
|
1036
|
-
...parseOmlpUpdateFeeWalletInstruction(instruction),
|
|
1037
|
-
};
|
|
1038
|
-
}
|
|
1039
|
-
case OptionProgramInstruction.OmlpUpdateInterestModel: {
|
|
1040
|
-
assertIsInstructionWithAccounts(instruction);
|
|
1041
|
-
return {
|
|
1042
|
-
instructionType: OptionProgramInstruction.OmlpUpdateInterestModel,
|
|
1043
|
-
...parseOmlpUpdateInterestModelInstruction(instruction),
|
|
1044
|
-
};
|
|
1045
|
-
}
|
|
1046
|
-
case OptionProgramInstruction.OmlpUpdateLiquidationThreshold: {
|
|
1047
|
-
assertIsInstructionWithAccounts(instruction);
|
|
1048
|
-
return {
|
|
1049
|
-
instructionType:
|
|
1050
|
-
OptionProgramInstruction.OmlpUpdateLiquidationThreshold,
|
|
1051
|
-
...parseOmlpUpdateLiquidationThresholdInstruction(instruction),
|
|
1052
|
-
};
|
|
1053
|
-
}
|
|
1054
|
-
case OptionProgramInstruction.OmlpUpdateMaintenanceBuffer: {
|
|
1055
|
-
assertIsInstructionWithAccounts(instruction);
|
|
1056
|
-
return {
|
|
1057
|
-
instructionType: OptionProgramInstruction.OmlpUpdateMaintenanceBuffer,
|
|
1058
|
-
...parseOmlpUpdateMaintenanceBufferInstruction(instruction),
|
|
1059
|
-
};
|
|
1060
|
-
}
|
|
1061
|
-
case OptionProgramInstruction.OmlpUpdateMaxBorrowCap: {
|
|
1062
|
-
assertIsInstructionWithAccounts(instruction);
|
|
1063
|
-
return {
|
|
1064
|
-
instructionType: OptionProgramInstruction.OmlpUpdateMaxBorrowCap,
|
|
1065
|
-
...parseOmlpUpdateMaxBorrowCapInstruction(instruction),
|
|
1066
|
-
};
|
|
1067
|
-
}
|
|
1068
|
-
case OptionProgramInstruction.OmlpUpdateMaxLeverage: {
|
|
1069
|
-
assertIsInstructionWithAccounts(instruction);
|
|
1070
|
-
return {
|
|
1071
|
-
instructionType: OptionProgramInstruction.OmlpUpdateMaxLeverage,
|
|
1072
|
-
...parseOmlpUpdateMaxLeverageInstruction(instruction),
|
|
1073
|
-
};
|
|
1074
|
-
}
|
|
1075
|
-
case OptionProgramInstruction.OmlpUpdateProtocolFee: {
|
|
1076
|
-
assertIsInstructionWithAccounts(instruction);
|
|
1077
|
-
return {
|
|
1078
|
-
instructionType: OptionProgramInstruction.OmlpUpdateProtocolFee,
|
|
1079
|
-
...parseOmlpUpdateProtocolFeeInstruction(instruction),
|
|
1080
|
-
};
|
|
1081
|
-
}
|
|
1082
|
-
case OptionProgramInstruction.OmlpUpdateSupplyLimit: {
|
|
1083
|
-
assertIsInstructionWithAccounts(instruction);
|
|
1084
|
-
return {
|
|
1085
|
-
instructionType: OptionProgramInstruction.OmlpUpdateSupplyLimit,
|
|
1086
|
-
...parseOmlpUpdateSupplyLimitInstruction(instruction),
|
|
1087
|
-
};
|
|
1088
|
-
}
|
|
1089
|
-
case OptionProgramInstruction.OptionExercise: {
|
|
1090
|
-
assertIsInstructionWithAccounts(instruction);
|
|
1091
|
-
return {
|
|
1092
|
-
instructionType: OptionProgramInstruction.OptionExercise,
|
|
1093
|
-
...parseOptionExerciseInstruction(instruction),
|
|
1094
|
-
};
|
|
1095
|
-
}
|
|
1096
|
-
case OptionProgramInstruction.OptionMint: {
|
|
1097
|
-
assertIsInstructionWithAccounts(instruction);
|
|
1098
|
-
return {
|
|
1099
|
-
instructionType: OptionProgramInstruction.OptionMint,
|
|
1100
|
-
...parseOptionMintInstruction(instruction),
|
|
1101
|
-
};
|
|
1102
|
-
}
|
|
1103
|
-
case OptionProgramInstruction.OptionValidate: {
|
|
1104
|
-
assertIsInstructionWithAccounts(instruction);
|
|
1105
|
-
return {
|
|
1106
|
-
instructionType: OptionProgramInstruction.OptionValidate,
|
|
1107
|
-
...parseOptionValidateInstruction(instruction),
|
|
1108
|
-
};
|
|
1109
|
-
}
|
|
1110
|
-
case OptionProgramInstruction.RepayPoolLoan: {
|
|
1111
|
-
assertIsInstructionWithAccounts(instruction);
|
|
1112
|
-
return {
|
|
1113
|
-
instructionType: OptionProgramInstruction.RepayPoolLoan,
|
|
1114
|
-
...parseRepayPoolLoanInstruction(instruction),
|
|
1115
|
-
};
|
|
1116
|
-
}
|
|
1117
|
-
case OptionProgramInstruction.RepayPoolLoanFromCollateral: {
|
|
1118
|
-
assertIsInstructionWithAccounts(instruction);
|
|
1119
|
-
return {
|
|
1120
|
-
instructionType: OptionProgramInstruction.RepayPoolLoanFromCollateral,
|
|
1121
|
-
...parseRepayPoolLoanFromCollateralInstruction(instruction),
|
|
1122
|
-
};
|
|
1123
|
-
}
|
|
1124
|
-
case OptionProgramInstruction.RepayPoolLoanFromWallet: {
|
|
1125
|
-
assertIsInstructionWithAccounts(instruction);
|
|
1126
|
-
return {
|
|
1127
|
-
instructionType: OptionProgramInstruction.RepayPoolLoanFromWallet,
|
|
1128
|
-
...parseRepayPoolLoanFromWalletInstruction(instruction),
|
|
1129
|
-
};
|
|
1130
|
-
}
|
|
1131
|
-
case OptionProgramInstruction.SettleMakerCollateral: {
|
|
1132
|
-
assertIsInstructionWithAccounts(instruction);
|
|
1133
|
-
return {
|
|
1134
|
-
instructionType: OptionProgramInstruction.SettleMakerCollateral,
|
|
1135
|
-
...parseSettleMakerCollateralInstruction(instruction),
|
|
1136
|
-
};
|
|
1137
|
-
}
|
|
1138
|
-
case OptionProgramInstruction.SyncWriterPosition: {
|
|
1139
|
-
assertIsInstructionWithAccounts(instruction);
|
|
1140
|
-
return {
|
|
1141
|
-
instructionType: OptionProgramInstruction.SyncWriterPosition,
|
|
1142
|
-
...parseSyncWriterPositionInstruction(instruction),
|
|
1143
|
-
};
|
|
1144
|
-
}
|
|
1145
|
-
case OptionProgramInstruction.TransferAdmin: {
|
|
1146
|
-
assertIsInstructionWithAccounts(instruction);
|
|
1147
|
-
return {
|
|
1148
|
-
instructionType: OptionProgramInstruction.TransferAdmin,
|
|
1149
|
-
...parseTransferAdminInstruction(instruction),
|
|
1150
|
-
};
|
|
1151
|
-
}
|
|
1152
|
-
case OptionProgramInstruction.UnwindWriterUnsold: {
|
|
1153
|
-
assertIsInstructionWithAccounts(instruction);
|
|
1154
|
-
return {
|
|
1155
|
-
instructionType: OptionProgramInstruction.UnwindWriterUnsold,
|
|
1156
|
-
...parseUnwindWriterUnsoldInstruction(instruction),
|
|
1157
|
-
};
|
|
1158
|
-
}
|
|
1159
|
-
case OptionProgramInstruction.UpdateImpliedVolatility: {
|
|
1160
|
-
assertIsInstructionWithAccounts(instruction);
|
|
1161
|
-
return {
|
|
1162
|
-
instructionType: OptionProgramInstruction.UpdateImpliedVolatility,
|
|
1163
|
-
...parseUpdateImpliedVolatilityInstruction(instruction),
|
|
1164
|
-
};
|
|
1165
|
-
}
|
|
1166
|
-
case OptionProgramInstruction.UpdateMarketData: {
|
|
1167
|
-
assertIsInstructionWithAccounts(instruction);
|
|
1168
|
-
return {
|
|
1169
|
-
instructionType: OptionProgramInstruction.UpdateMarketData,
|
|
1170
|
-
...parseUpdateMarketDataInstruction(instruction),
|
|
1171
|
-
};
|
|
1172
|
-
}
|
|
1173
|
-
case OptionProgramInstruction.WithdrawFromPosition: {
|
|
1174
|
-
assertIsInstructionWithAccounts(instruction);
|
|
1175
|
-
return {
|
|
1176
|
-
instructionType: OptionProgramInstruction.WithdrawFromPosition,
|
|
1177
|
-
...parseWithdrawFromPositionInstruction(instruction),
|
|
1178
|
-
};
|
|
1179
|
-
}
|
|
1180
|
-
case OptionProgramInstruction.WriteToPool: {
|
|
1181
|
-
assertIsInstructionWithAccounts(instruction);
|
|
1182
|
-
return {
|
|
1183
|
-
instructionType: OptionProgramInstruction.WriteToPool,
|
|
1184
|
-
...parseWriteToPoolInstruction(instruction),
|
|
1185
|
-
};
|
|
1186
|
-
}
|
|
1187
|
-
default:
|
|
1188
|
-
throw new Error(
|
|
1189
|
-
`Unrecognized instruction type: ${instructionType as string}`,
|
|
1190
|
-
);
|
|
1191
|
-
}
|
|
1192
|
-
}
|
package/package.json
CHANGED
package/short/builders.ts
CHANGED
|
@@ -128,6 +128,7 @@ export interface BuildSettleMakerCollateralParams {
|
|
|
128
128
|
optionAccount: AddressLike;
|
|
129
129
|
collateralVault: AddressLike;
|
|
130
130
|
writerPosition: AddressLike;
|
|
131
|
+
keeper: TransactionSigner;
|
|
131
132
|
/** OMLP Vault token account (destination for principal+interest). */
|
|
132
133
|
omlpVault?: AddressLike;
|
|
133
134
|
/** OMLP Vault state PDA (mut: updates `total_loans`, `total_liquidity`, `acc_interest_per_share_fp`). */
|
|
@@ -807,6 +808,7 @@ export async function buildSettleMakerCollateralInstruction(
|
|
|
807
808
|
omlpVault: params.omlpVault ? toAddress(params.omlpVault) : undefined,
|
|
808
809
|
omlpVaultState: params.omlpVaultState ? toAddress(params.omlpVaultState) : undefined,
|
|
809
810
|
poolLoan: params.poolLoan ? toAddress(params.poolLoan) : undefined,
|
|
811
|
+
keeper: params.keeper,
|
|
810
812
|
});
|
|
811
813
|
return kitInstruction;
|
|
812
814
|
}
|