@epicentral/sos-sdk 0.9.1-beta → 0.10.1-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 +14 -2
- package/accounts/fetchers.ts +79 -9
- package/accounts/list.ts +12 -6
- package/accounts/resolve-option.ts +60 -19
- package/generated/accounts/collateralPool.ts +29 -1
- package/generated/accounts/makerCollateralShare.ts +9 -1
- package/generated/errors/optionProgram.ts +48 -36
- package/generated/instructions/autoExerciseAllExpired.ts +32 -86
- package/generated/instructions/autoExerciseExpired.ts +38 -95
- package/generated/instructions/claimMakerRemaining.ts +452 -0
- package/generated/instructions/depositCollateral.ts +6 -6
- package/generated/instructions/index.ts +1 -0
- package/generated/instructions/initCollateralPool.ts +3 -3
- package/generated/instructions/settleMakerCollateral.ts +50 -74
- package/generated/programs/optionProgram.ts +24 -0
- package/package.json +1 -1
- package/short/builders.ts +8 -8
|
@@ -57,9 +57,8 @@ export type AutoExerciseAllExpiredInstruction<
|
|
|
57
57
|
TAccountOptionPool extends string | AccountMeta<string> = string,
|
|
58
58
|
TAccountOptionAccount extends string | AccountMeta<string> = string,
|
|
59
59
|
TAccountUnderlyingMint extends string | AccountMeta<string> = string,
|
|
60
|
+
TAccountCollateralMint extends string | AccountMeta<string> = string,
|
|
60
61
|
TAccountCollateralVault extends string | AccountMeta<string> = string,
|
|
61
|
-
TAccountOmlpVault extends string | AccountMeta<string> = string,
|
|
62
|
-
TAccountOmlpVaultState extends string | AccountMeta<string> = string,
|
|
63
62
|
TAccountOptionMint extends string | AccountMeta<string> = string,
|
|
64
63
|
TAccountSwitchboardQueue extends string | AccountMeta<string> = string,
|
|
65
64
|
TAccountSlotHashesSysvar extends string | AccountMeta<string> =
|
|
@@ -89,15 +88,12 @@ export type AutoExerciseAllExpiredInstruction<
|
|
|
89
88
|
TAccountUnderlyingMint extends string
|
|
90
89
|
? ReadonlyAccount<TAccountUnderlyingMint>
|
|
91
90
|
: TAccountUnderlyingMint,
|
|
91
|
+
TAccountCollateralMint extends string
|
|
92
|
+
? ReadonlyAccount<TAccountCollateralMint>
|
|
93
|
+
: TAccountCollateralMint,
|
|
92
94
|
TAccountCollateralVault extends string
|
|
93
95
|
? WritableAccount<TAccountCollateralVault>
|
|
94
96
|
: TAccountCollateralVault,
|
|
95
|
-
TAccountOmlpVault extends string
|
|
96
|
-
? WritableAccount<TAccountOmlpVault>
|
|
97
|
-
: TAccountOmlpVault,
|
|
98
|
-
TAccountOmlpVaultState extends string
|
|
99
|
-
? WritableAccount<TAccountOmlpVaultState>
|
|
100
|
-
: TAccountOmlpVaultState,
|
|
101
97
|
TAccountOptionMint extends string
|
|
102
98
|
? WritableAccount<TAccountOptionMint>
|
|
103
99
|
: TAccountOptionMint,
|
|
@@ -171,9 +167,8 @@ export type AutoExerciseAllExpiredAsyncInput<
|
|
|
171
167
|
TAccountOptionPool extends string = string,
|
|
172
168
|
TAccountOptionAccount extends string = string,
|
|
173
169
|
TAccountUnderlyingMint extends string = string,
|
|
170
|
+
TAccountCollateralMint extends string = string,
|
|
174
171
|
TAccountCollateralVault extends string = string,
|
|
175
|
-
TAccountOmlpVault extends string = string,
|
|
176
|
-
TAccountOmlpVaultState extends string = string,
|
|
177
172
|
TAccountOptionMint extends string = string,
|
|
178
173
|
TAccountSwitchboardQueue extends string = string,
|
|
179
174
|
TAccountSlotHashesSysvar extends string = string,
|
|
@@ -191,17 +186,9 @@ export type AutoExerciseAllExpiredAsyncInput<
|
|
|
191
186
|
* state PDA and to keep vault aggregates consistent across batches.
|
|
192
187
|
*/
|
|
193
188
|
underlyingMint: Address<TAccountUnderlyingMint>;
|
|
189
|
+
collateralMint: Address<TAccountCollateralMint>;
|
|
194
190
|
/** Pool's collateral vault (source of payout) */
|
|
195
191
|
collateralVault: Address<TAccountCollateralVault>;
|
|
196
|
-
/** OMLP Vault token account to receive repayments */
|
|
197
|
-
omlpVault: Address<TAccountOmlpVault>;
|
|
198
|
-
/**
|
|
199
|
-
* OMLP Vault state PDA (mut: `total_loans`, `total_liquidity`,
|
|
200
|
-
* `acc_interest_per_share_fp`). One vault state is used for the whole
|
|
201
|
-
* batch — batch auto-exercise only repays lenders in the underlying
|
|
202
|
-
* mint of the option.
|
|
203
|
-
*/
|
|
204
|
-
omlpVaultState?: Address<TAccountOmlpVaultState>;
|
|
205
192
|
/** Option mint (for burning) */
|
|
206
193
|
optionMint: Address<TAccountOptionMint>;
|
|
207
194
|
switchboardQueue: Address<TAccountSwitchboardQueue>;
|
|
@@ -221,9 +208,8 @@ export async function getAutoExerciseAllExpiredInstructionAsync<
|
|
|
221
208
|
TAccountOptionPool extends string,
|
|
222
209
|
TAccountOptionAccount extends string,
|
|
223
210
|
TAccountUnderlyingMint extends string,
|
|
211
|
+
TAccountCollateralMint extends string,
|
|
224
212
|
TAccountCollateralVault extends string,
|
|
225
|
-
TAccountOmlpVault extends string,
|
|
226
|
-
TAccountOmlpVaultState extends string,
|
|
227
213
|
TAccountOptionMint extends string,
|
|
228
214
|
TAccountSwitchboardQueue extends string,
|
|
229
215
|
TAccountSlotHashesSysvar extends string,
|
|
@@ -239,9 +225,8 @@ export async function getAutoExerciseAllExpiredInstructionAsync<
|
|
|
239
225
|
TAccountOptionPool,
|
|
240
226
|
TAccountOptionAccount,
|
|
241
227
|
TAccountUnderlyingMint,
|
|
228
|
+
TAccountCollateralMint,
|
|
242
229
|
TAccountCollateralVault,
|
|
243
|
-
TAccountOmlpVault,
|
|
244
|
-
TAccountOmlpVaultState,
|
|
245
230
|
TAccountOptionMint,
|
|
246
231
|
TAccountSwitchboardQueue,
|
|
247
232
|
TAccountSlotHashesSysvar,
|
|
@@ -259,9 +244,8 @@ export async function getAutoExerciseAllExpiredInstructionAsync<
|
|
|
259
244
|
TAccountOptionPool,
|
|
260
245
|
TAccountOptionAccount,
|
|
261
246
|
TAccountUnderlyingMint,
|
|
247
|
+
TAccountCollateralMint,
|
|
262
248
|
TAccountCollateralVault,
|
|
263
|
-
TAccountOmlpVault,
|
|
264
|
-
TAccountOmlpVaultState,
|
|
265
249
|
TAccountOptionMint,
|
|
266
250
|
TAccountSwitchboardQueue,
|
|
267
251
|
TAccountSlotHashesSysvar,
|
|
@@ -282,9 +266,8 @@ export async function getAutoExerciseAllExpiredInstructionAsync<
|
|
|
282
266
|
optionPool: { value: input.optionPool ?? null, isWritable: true },
|
|
283
267
|
optionAccount: { value: input.optionAccount ?? null, isWritable: true },
|
|
284
268
|
underlyingMint: { value: input.underlyingMint ?? null, isWritable: false },
|
|
269
|
+
collateralMint: { value: input.collateralMint ?? null, isWritable: false },
|
|
285
270
|
collateralVault: { value: input.collateralVault ?? null, isWritable: true },
|
|
286
|
-
omlpVault: { value: input.omlpVault ?? null, isWritable: true },
|
|
287
|
-
omlpVaultState: { value: input.omlpVaultState ?? null, isWritable: true },
|
|
288
271
|
optionMint: { value: input.optionMint ?? null, isWritable: true },
|
|
289
272
|
switchboardQueue: {
|
|
290
273
|
value: input.switchboardQueue ?? null,
|
|
@@ -326,17 +309,6 @@ export async function getAutoExerciseAllExpiredInstructionAsync<
|
|
|
326
309
|
],
|
|
327
310
|
});
|
|
328
311
|
}
|
|
329
|
-
if (!accounts.omlpVaultState.value) {
|
|
330
|
-
accounts.omlpVaultState.value = await getProgramDerivedAddress({
|
|
331
|
-
programAddress,
|
|
332
|
-
seeds: [
|
|
333
|
-
getBytesEncoder().encode(new Uint8Array([118, 97, 117, 108, 116])),
|
|
334
|
-
getAddressEncoder().encode(
|
|
335
|
-
expectAddress(accounts.underlyingMint.value),
|
|
336
|
-
),
|
|
337
|
-
],
|
|
338
|
-
});
|
|
339
|
-
}
|
|
340
312
|
if (!accounts.slotHashesSysvar.value) {
|
|
341
313
|
accounts.slotHashesSysvar.value =
|
|
342
314
|
"SysvarS1otHashes111111111111111111111111111" as Address<"SysvarS1otHashes111111111111111111111111111">;
|
|
@@ -361,9 +333,8 @@ export async function getAutoExerciseAllExpiredInstructionAsync<
|
|
|
361
333
|
getAccountMeta(accounts.optionPool),
|
|
362
334
|
getAccountMeta(accounts.optionAccount),
|
|
363
335
|
getAccountMeta(accounts.underlyingMint),
|
|
336
|
+
getAccountMeta(accounts.collateralMint),
|
|
364
337
|
getAccountMeta(accounts.collateralVault),
|
|
365
|
-
getAccountMeta(accounts.omlpVault),
|
|
366
|
-
getAccountMeta(accounts.omlpVaultState),
|
|
367
338
|
getAccountMeta(accounts.optionMint),
|
|
368
339
|
getAccountMeta(accounts.switchboardQueue),
|
|
369
340
|
getAccountMeta(accounts.slotHashesSysvar),
|
|
@@ -383,9 +354,8 @@ export async function getAutoExerciseAllExpiredInstructionAsync<
|
|
|
383
354
|
TAccountOptionPool,
|
|
384
355
|
TAccountOptionAccount,
|
|
385
356
|
TAccountUnderlyingMint,
|
|
357
|
+
TAccountCollateralMint,
|
|
386
358
|
TAccountCollateralVault,
|
|
387
|
-
TAccountOmlpVault,
|
|
388
|
-
TAccountOmlpVaultState,
|
|
389
359
|
TAccountOptionMint,
|
|
390
360
|
TAccountSwitchboardQueue,
|
|
391
361
|
TAccountSlotHashesSysvar,
|
|
@@ -402,9 +372,8 @@ export type AutoExerciseAllExpiredInput<
|
|
|
402
372
|
TAccountOptionPool extends string = string,
|
|
403
373
|
TAccountOptionAccount extends string = string,
|
|
404
374
|
TAccountUnderlyingMint extends string = string,
|
|
375
|
+
TAccountCollateralMint extends string = string,
|
|
405
376
|
TAccountCollateralVault extends string = string,
|
|
406
|
-
TAccountOmlpVault extends string = string,
|
|
407
|
-
TAccountOmlpVaultState extends string = string,
|
|
408
377
|
TAccountOptionMint extends string = string,
|
|
409
378
|
TAccountSwitchboardQueue extends string = string,
|
|
410
379
|
TAccountSlotHashesSysvar extends string = string,
|
|
@@ -422,17 +391,9 @@ export type AutoExerciseAllExpiredInput<
|
|
|
422
391
|
* state PDA and to keep vault aggregates consistent across batches.
|
|
423
392
|
*/
|
|
424
393
|
underlyingMint: Address<TAccountUnderlyingMint>;
|
|
394
|
+
collateralMint: Address<TAccountCollateralMint>;
|
|
425
395
|
/** Pool's collateral vault (source of payout) */
|
|
426
396
|
collateralVault: Address<TAccountCollateralVault>;
|
|
427
|
-
/** OMLP Vault token account to receive repayments */
|
|
428
|
-
omlpVault: Address<TAccountOmlpVault>;
|
|
429
|
-
/**
|
|
430
|
-
* OMLP Vault state PDA (mut: `total_loans`, `total_liquidity`,
|
|
431
|
-
* `acc_interest_per_share_fp`). One vault state is used for the whole
|
|
432
|
-
* batch — batch auto-exercise only repays lenders in the underlying
|
|
433
|
-
* mint of the option.
|
|
434
|
-
*/
|
|
435
|
-
omlpVaultState: Address<TAccountOmlpVaultState>;
|
|
436
397
|
/** Option mint (for burning) */
|
|
437
398
|
optionMint: Address<TAccountOptionMint>;
|
|
438
399
|
switchboardQueue: Address<TAccountSwitchboardQueue>;
|
|
@@ -452,9 +413,8 @@ export function getAutoExerciseAllExpiredInstruction<
|
|
|
452
413
|
TAccountOptionPool extends string,
|
|
453
414
|
TAccountOptionAccount extends string,
|
|
454
415
|
TAccountUnderlyingMint extends string,
|
|
416
|
+
TAccountCollateralMint extends string,
|
|
455
417
|
TAccountCollateralVault extends string,
|
|
456
|
-
TAccountOmlpVault extends string,
|
|
457
|
-
TAccountOmlpVaultState extends string,
|
|
458
418
|
TAccountOptionMint extends string,
|
|
459
419
|
TAccountSwitchboardQueue extends string,
|
|
460
420
|
TAccountSlotHashesSysvar extends string,
|
|
@@ -470,9 +430,8 @@ export function getAutoExerciseAllExpiredInstruction<
|
|
|
470
430
|
TAccountOptionPool,
|
|
471
431
|
TAccountOptionAccount,
|
|
472
432
|
TAccountUnderlyingMint,
|
|
433
|
+
TAccountCollateralMint,
|
|
473
434
|
TAccountCollateralVault,
|
|
474
|
-
TAccountOmlpVault,
|
|
475
|
-
TAccountOmlpVaultState,
|
|
476
435
|
TAccountOptionMint,
|
|
477
436
|
TAccountSwitchboardQueue,
|
|
478
437
|
TAccountSlotHashesSysvar,
|
|
@@ -489,9 +448,8 @@ export function getAutoExerciseAllExpiredInstruction<
|
|
|
489
448
|
TAccountOptionPool,
|
|
490
449
|
TAccountOptionAccount,
|
|
491
450
|
TAccountUnderlyingMint,
|
|
451
|
+
TAccountCollateralMint,
|
|
492
452
|
TAccountCollateralVault,
|
|
493
|
-
TAccountOmlpVault,
|
|
494
|
-
TAccountOmlpVaultState,
|
|
495
453
|
TAccountOptionMint,
|
|
496
454
|
TAccountSwitchboardQueue,
|
|
497
455
|
TAccountSlotHashesSysvar,
|
|
@@ -511,9 +469,8 @@ export function getAutoExerciseAllExpiredInstruction<
|
|
|
511
469
|
optionPool: { value: input.optionPool ?? null, isWritable: true },
|
|
512
470
|
optionAccount: { value: input.optionAccount ?? null, isWritable: true },
|
|
513
471
|
underlyingMint: { value: input.underlyingMint ?? null, isWritable: false },
|
|
472
|
+
collateralMint: { value: input.collateralMint ?? null, isWritable: false },
|
|
514
473
|
collateralVault: { value: input.collateralVault ?? null, isWritable: true },
|
|
515
|
-
omlpVault: { value: input.omlpVault ?? null, isWritable: true },
|
|
516
|
-
omlpVaultState: { value: input.omlpVaultState ?? null, isWritable: true },
|
|
517
474
|
optionMint: { value: input.optionMint ?? null, isWritable: true },
|
|
518
475
|
switchboardQueue: {
|
|
519
476
|
value: input.switchboardQueue ?? null,
|
|
@@ -565,9 +522,8 @@ export function getAutoExerciseAllExpiredInstruction<
|
|
|
565
522
|
getAccountMeta(accounts.optionPool),
|
|
566
523
|
getAccountMeta(accounts.optionAccount),
|
|
567
524
|
getAccountMeta(accounts.underlyingMint),
|
|
525
|
+
getAccountMeta(accounts.collateralMint),
|
|
568
526
|
getAccountMeta(accounts.collateralVault),
|
|
569
|
-
getAccountMeta(accounts.omlpVault),
|
|
570
|
-
getAccountMeta(accounts.omlpVaultState),
|
|
571
527
|
getAccountMeta(accounts.optionMint),
|
|
572
528
|
getAccountMeta(accounts.switchboardQueue),
|
|
573
529
|
getAccountMeta(accounts.slotHashesSysvar),
|
|
@@ -587,9 +543,8 @@ export function getAutoExerciseAllExpiredInstruction<
|
|
|
587
543
|
TAccountOptionPool,
|
|
588
544
|
TAccountOptionAccount,
|
|
589
545
|
TAccountUnderlyingMint,
|
|
546
|
+
TAccountCollateralMint,
|
|
590
547
|
TAccountCollateralVault,
|
|
591
|
-
TAccountOmlpVault,
|
|
592
|
-
TAccountOmlpVaultState,
|
|
593
548
|
TAccountOptionMint,
|
|
594
549
|
TAccountSwitchboardQueue,
|
|
595
550
|
TAccountSlotHashesSysvar,
|
|
@@ -615,28 +570,20 @@ export type ParsedAutoExerciseAllExpiredInstruction<
|
|
|
615
570
|
* state PDA and to keep vault aggregates consistent across batches.
|
|
616
571
|
*/
|
|
617
572
|
underlyingMint: TAccountMetas[3];
|
|
573
|
+
collateralMint: TAccountMetas[4];
|
|
618
574
|
/** Pool's collateral vault (source of payout) */
|
|
619
|
-
collateralVault: TAccountMetas[
|
|
620
|
-
/** OMLP Vault token account to receive repayments */
|
|
621
|
-
omlpVault: TAccountMetas[5];
|
|
622
|
-
/**
|
|
623
|
-
* OMLP Vault state PDA (mut: `total_loans`, `total_liquidity`,
|
|
624
|
-
* `acc_interest_per_share_fp`). One vault state is used for the whole
|
|
625
|
-
* batch — batch auto-exercise only repays lenders in the underlying
|
|
626
|
-
* mint of the option.
|
|
627
|
-
*/
|
|
628
|
-
omlpVaultState: TAccountMetas[6];
|
|
575
|
+
collateralVault: TAccountMetas[5];
|
|
629
576
|
/** Option mint (for burning) */
|
|
630
|
-
optionMint: TAccountMetas[
|
|
631
|
-
switchboardQueue: TAccountMetas[
|
|
632
|
-
slotHashesSysvar: TAccountMetas[
|
|
633
|
-
instructionsSysvar: TAccountMetas[
|
|
577
|
+
optionMint: TAccountMetas[6];
|
|
578
|
+
switchboardQueue: TAccountMetas[7];
|
|
579
|
+
slotHashesSysvar: TAccountMetas[8];
|
|
580
|
+
instructionsSysvar: TAccountMetas[9];
|
|
634
581
|
/** Market data for this underlying asset (contains switchboard_feed_id) */
|
|
635
|
-
marketData: TAccountMetas[
|
|
582
|
+
marketData: TAccountMetas[10];
|
|
636
583
|
/** Keeper who pays for gas - anyone can call this after expiration */
|
|
637
|
-
keeper: TAccountMetas[
|
|
638
|
-
tokenProgram: TAccountMetas[
|
|
639
|
-
systemProgram: TAccountMetas[
|
|
584
|
+
keeper: TAccountMetas[11];
|
|
585
|
+
tokenProgram: TAccountMetas[12];
|
|
586
|
+
systemProgram: TAccountMetas[13];
|
|
640
587
|
};
|
|
641
588
|
data: AutoExerciseAllExpiredInstructionData;
|
|
642
589
|
};
|
|
@@ -649,7 +596,7 @@ export function parseAutoExerciseAllExpiredInstruction<
|
|
|
649
596
|
InstructionWithAccounts<TAccountMetas> &
|
|
650
597
|
InstructionWithData<ReadonlyUint8Array>,
|
|
651
598
|
): ParsedAutoExerciseAllExpiredInstruction<TProgram, TAccountMetas> {
|
|
652
|
-
if (instruction.accounts.length <
|
|
599
|
+
if (instruction.accounts.length < 14) {
|
|
653
600
|
// TODO: Coded error.
|
|
654
601
|
throw new Error("Not enough accounts");
|
|
655
602
|
}
|
|
@@ -666,9 +613,8 @@ export function parseAutoExerciseAllExpiredInstruction<
|
|
|
666
613
|
optionPool: getNextAccount(),
|
|
667
614
|
optionAccount: getNextAccount(),
|
|
668
615
|
underlyingMint: getNextAccount(),
|
|
616
|
+
collateralMint: getNextAccount(),
|
|
669
617
|
collateralVault: getNextAccount(),
|
|
670
|
-
omlpVault: getNextAccount(),
|
|
671
|
-
omlpVaultState: getNextAccount(),
|
|
672
618
|
optionMint: getNextAccount(),
|
|
673
619
|
switchboardQueue: getNextAccount(),
|
|
674
620
|
slotHashesSysvar: getNextAccount(),
|