@epicentral/sos-sdk 0.11.2-beta → 0.12.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 +28 -13
- package/generated/instructions/buyFromPool.ts +72 -8
- package/generated/instructions/closeLongToPool.ts +75 -18
- package/generated/instructions/optionMint.ts +4 -4
- package/generated/instructions/unwindWriterUnsold.ts +9 -9
- package/long/builders.ts +141 -69
- package/package.json +1 -1
- package/shared/amounts.ts +78 -17
- package/shared/balances.ts +42 -7
- package/short/builders.ts +10 -4
- package/short/preflight.ts +6 -5
|
@@ -57,6 +57,7 @@ export type CloseLongToPoolInstruction<
|
|
|
57
57
|
TAccountOptionAccount extends string | AccountMeta<string> = string,
|
|
58
58
|
TAccountCollateralPool extends string | AccountMeta<string> = string,
|
|
59
59
|
TAccountUnderlyingMint extends string | AccountMeta<string> = string,
|
|
60
|
+
TAccountCollateralMint extends string | AccountMeta<string> = string,
|
|
60
61
|
TAccountLongMint extends string | AccountMeta<string> = string,
|
|
61
62
|
TAccountEscrowLongAccount extends string | AccountMeta<string> = string,
|
|
62
63
|
TAccountPremiumVault extends string | AccountMeta<string> = string,
|
|
@@ -69,6 +70,8 @@ export type CloseLongToPoolInstruction<
|
|
|
69
70
|
TAccountBuyerPosition extends string | AccountMeta<string> = string,
|
|
70
71
|
TAccountBuyerLongAccount extends string | AccountMeta<string> = string,
|
|
71
72
|
TAccountBuyerPayoutAccount extends string | AccountMeta<string> = string,
|
|
73
|
+
TAccountBuyerUnderlyingPayoutAccount extends string | AccountMeta<string> =
|
|
74
|
+
string,
|
|
72
75
|
TAccountCollateralVault extends string | AccountMeta<string> = string,
|
|
73
76
|
TAccountBuyer extends string | AccountMeta<string> = string,
|
|
74
77
|
TAccountTokenProgram extends string | AccountMeta<string> =
|
|
@@ -92,6 +95,9 @@ export type CloseLongToPoolInstruction<
|
|
|
92
95
|
TAccountUnderlyingMint extends string
|
|
93
96
|
? ReadonlyAccount<TAccountUnderlyingMint>
|
|
94
97
|
: TAccountUnderlyingMint,
|
|
98
|
+
TAccountCollateralMint extends string
|
|
99
|
+
? ReadonlyAccount<TAccountCollateralMint>
|
|
100
|
+
: TAccountCollateralMint,
|
|
95
101
|
TAccountLongMint extends string
|
|
96
102
|
? WritableAccount<TAccountLongMint>
|
|
97
103
|
: TAccountLongMint,
|
|
@@ -122,6 +128,9 @@ export type CloseLongToPoolInstruction<
|
|
|
122
128
|
TAccountBuyerPayoutAccount extends string
|
|
123
129
|
? WritableAccount<TAccountBuyerPayoutAccount>
|
|
124
130
|
: TAccountBuyerPayoutAccount,
|
|
131
|
+
TAccountBuyerUnderlyingPayoutAccount extends string
|
|
132
|
+
? WritableAccount<TAccountBuyerUnderlyingPayoutAccount>
|
|
133
|
+
: TAccountBuyerUnderlyingPayoutAccount,
|
|
125
134
|
TAccountCollateralVault extends string
|
|
126
135
|
? WritableAccount<TAccountCollateralVault>
|
|
127
136
|
: TAccountCollateralVault,
|
|
@@ -184,6 +193,7 @@ export type CloseLongToPoolAsyncInput<
|
|
|
184
193
|
TAccountOptionAccount extends string = string,
|
|
185
194
|
TAccountCollateralPool extends string = string,
|
|
186
195
|
TAccountUnderlyingMint extends string = string,
|
|
196
|
+
TAccountCollateralMint extends string = string,
|
|
187
197
|
TAccountLongMint extends string = string,
|
|
188
198
|
TAccountEscrowLongAccount extends string = string,
|
|
189
199
|
TAccountPremiumVault extends string = string,
|
|
@@ -194,6 +204,7 @@ export type CloseLongToPoolAsyncInput<
|
|
|
194
204
|
TAccountBuyerPosition extends string = string,
|
|
195
205
|
TAccountBuyerLongAccount extends string = string,
|
|
196
206
|
TAccountBuyerPayoutAccount extends string = string,
|
|
207
|
+
TAccountBuyerUnderlyingPayoutAccount extends string = string,
|
|
197
208
|
TAccountCollateralVault extends string = string,
|
|
198
209
|
TAccountBuyer extends string = string,
|
|
199
210
|
TAccountTokenProgram extends string = string,
|
|
@@ -207,6 +218,8 @@ export type CloseLongToPoolAsyncInput<
|
|
|
207
218
|
collateralPool?: Address<TAccountCollateralPool>;
|
|
208
219
|
/** Underlying token mint (for decimal handling) */
|
|
209
220
|
underlyingMint: Address<TAccountUnderlyingMint>;
|
|
221
|
+
/** Collateral mint (settlement currency for collateral-vault payout leg) */
|
|
222
|
+
collateralMint: Address<TAccountCollateralMint>;
|
|
210
223
|
/** LONG token mint (for transfer validation) */
|
|
211
224
|
longMint: Address<TAccountLongMint>;
|
|
212
225
|
/** Pool LONG escrow (destination when buyer closes back to pool) */
|
|
@@ -222,8 +235,10 @@ export type CloseLongToPoolAsyncInput<
|
|
|
222
235
|
buyerPosition?: Address<TAccountBuyerPosition>;
|
|
223
236
|
/** Buyer's LONG token account (source of tokens to return) */
|
|
224
237
|
buyerLongAccount: Address<TAccountBuyerLongAccount>;
|
|
225
|
-
/** Buyer's
|
|
238
|
+
/** Buyer's settlement token account (receives collateral-vault payout leg) */
|
|
226
239
|
buyerPayoutAccount: Address<TAccountBuyerPayoutAccount>;
|
|
240
|
+
/** Buyer's underlying token account (receives premium-vault payout leg; same ATA when physical) */
|
|
241
|
+
buyerUnderlyingPayoutAccount: Address<TAccountBuyerUnderlyingPayoutAccount>;
|
|
227
242
|
/** Collateral vault (source of payout) */
|
|
228
243
|
collateralVault: Address<TAccountCollateralVault>;
|
|
229
244
|
buyer: TransactionSigner<TAccountBuyer>;
|
|
@@ -238,6 +253,7 @@ export async function getCloseLongToPoolInstructionAsync<
|
|
|
238
253
|
TAccountOptionAccount extends string,
|
|
239
254
|
TAccountCollateralPool extends string,
|
|
240
255
|
TAccountUnderlyingMint extends string,
|
|
256
|
+
TAccountCollateralMint extends string,
|
|
241
257
|
TAccountLongMint extends string,
|
|
242
258
|
TAccountEscrowLongAccount extends string,
|
|
243
259
|
TAccountPremiumVault extends string,
|
|
@@ -248,6 +264,7 @@ export async function getCloseLongToPoolInstructionAsync<
|
|
|
248
264
|
TAccountBuyerPosition extends string,
|
|
249
265
|
TAccountBuyerLongAccount extends string,
|
|
250
266
|
TAccountBuyerPayoutAccount extends string,
|
|
267
|
+
TAccountBuyerUnderlyingPayoutAccount extends string,
|
|
251
268
|
TAccountCollateralVault extends string,
|
|
252
269
|
TAccountBuyer extends string,
|
|
253
270
|
TAccountTokenProgram extends string,
|
|
@@ -259,6 +276,7 @@ export async function getCloseLongToPoolInstructionAsync<
|
|
|
259
276
|
TAccountOptionAccount,
|
|
260
277
|
TAccountCollateralPool,
|
|
261
278
|
TAccountUnderlyingMint,
|
|
279
|
+
TAccountCollateralMint,
|
|
262
280
|
TAccountLongMint,
|
|
263
281
|
TAccountEscrowLongAccount,
|
|
264
282
|
TAccountPremiumVault,
|
|
@@ -269,6 +287,7 @@ export async function getCloseLongToPoolInstructionAsync<
|
|
|
269
287
|
TAccountBuyerPosition,
|
|
270
288
|
TAccountBuyerLongAccount,
|
|
271
289
|
TAccountBuyerPayoutAccount,
|
|
290
|
+
TAccountBuyerUnderlyingPayoutAccount,
|
|
272
291
|
TAccountCollateralVault,
|
|
273
292
|
TAccountBuyer,
|
|
274
293
|
TAccountTokenProgram,
|
|
@@ -282,6 +301,7 @@ export async function getCloseLongToPoolInstructionAsync<
|
|
|
282
301
|
TAccountOptionAccount,
|
|
283
302
|
TAccountCollateralPool,
|
|
284
303
|
TAccountUnderlyingMint,
|
|
304
|
+
TAccountCollateralMint,
|
|
285
305
|
TAccountLongMint,
|
|
286
306
|
TAccountEscrowLongAccount,
|
|
287
307
|
TAccountPremiumVault,
|
|
@@ -292,6 +312,7 @@ export async function getCloseLongToPoolInstructionAsync<
|
|
|
292
312
|
TAccountBuyerPosition,
|
|
293
313
|
TAccountBuyerLongAccount,
|
|
294
314
|
TAccountBuyerPayoutAccount,
|
|
315
|
+
TAccountBuyerUnderlyingPayoutAccount,
|
|
295
316
|
TAccountCollateralVault,
|
|
296
317
|
TAccountBuyer,
|
|
297
318
|
TAccountTokenProgram,
|
|
@@ -308,6 +329,7 @@ export async function getCloseLongToPoolInstructionAsync<
|
|
|
308
329
|
optionAccount: { value: input.optionAccount ?? null, isWritable: true },
|
|
309
330
|
collateralPool: { value: input.collateralPool ?? null, isWritable: true },
|
|
310
331
|
underlyingMint: { value: input.underlyingMint ?? null, isWritable: false },
|
|
332
|
+
collateralMint: { value: input.collateralMint ?? null, isWritable: false },
|
|
311
333
|
longMint: { value: input.longMint ?? null, isWritable: true },
|
|
312
334
|
escrowLongAccount: {
|
|
313
335
|
value: input.escrowLongAccount ?? null,
|
|
@@ -336,6 +358,10 @@ export async function getCloseLongToPoolInstructionAsync<
|
|
|
336
358
|
value: input.buyerPayoutAccount ?? null,
|
|
337
359
|
isWritable: true,
|
|
338
360
|
},
|
|
361
|
+
buyerUnderlyingPayoutAccount: {
|
|
362
|
+
value: input.buyerUnderlyingPayoutAccount ?? null,
|
|
363
|
+
isWritable: true,
|
|
364
|
+
},
|
|
339
365
|
collateralVault: { value: input.collateralVault ?? null, isWritable: true },
|
|
340
366
|
buyer: { value: input.buyer ?? null, isWritable: true },
|
|
341
367
|
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
@@ -400,6 +426,7 @@ export async function getCloseLongToPoolInstructionAsync<
|
|
|
400
426
|
getAccountMeta(accounts.optionAccount),
|
|
401
427
|
getAccountMeta(accounts.collateralPool),
|
|
402
428
|
getAccountMeta(accounts.underlyingMint),
|
|
429
|
+
getAccountMeta(accounts.collateralMint),
|
|
403
430
|
getAccountMeta(accounts.longMint),
|
|
404
431
|
getAccountMeta(accounts.escrowLongAccount),
|
|
405
432
|
getAccountMeta(accounts.premiumVault),
|
|
@@ -410,6 +437,7 @@ export async function getCloseLongToPoolInstructionAsync<
|
|
|
410
437
|
getAccountMeta(accounts.buyerPosition),
|
|
411
438
|
getAccountMeta(accounts.buyerLongAccount),
|
|
412
439
|
getAccountMeta(accounts.buyerPayoutAccount),
|
|
440
|
+
getAccountMeta(accounts.buyerUnderlyingPayoutAccount),
|
|
413
441
|
getAccountMeta(accounts.collateralVault),
|
|
414
442
|
getAccountMeta(accounts.buyer),
|
|
415
443
|
getAccountMeta(accounts.tokenProgram),
|
|
@@ -425,6 +453,7 @@ export async function getCloseLongToPoolInstructionAsync<
|
|
|
425
453
|
TAccountOptionAccount,
|
|
426
454
|
TAccountCollateralPool,
|
|
427
455
|
TAccountUnderlyingMint,
|
|
456
|
+
TAccountCollateralMint,
|
|
428
457
|
TAccountLongMint,
|
|
429
458
|
TAccountEscrowLongAccount,
|
|
430
459
|
TAccountPremiumVault,
|
|
@@ -435,6 +464,7 @@ export async function getCloseLongToPoolInstructionAsync<
|
|
|
435
464
|
TAccountBuyerPosition,
|
|
436
465
|
TAccountBuyerLongAccount,
|
|
437
466
|
TAccountBuyerPayoutAccount,
|
|
467
|
+
TAccountBuyerUnderlyingPayoutAccount,
|
|
438
468
|
TAccountCollateralVault,
|
|
439
469
|
TAccountBuyer,
|
|
440
470
|
TAccountTokenProgram,
|
|
@@ -447,6 +477,7 @@ export type CloseLongToPoolInput<
|
|
|
447
477
|
TAccountOptionAccount extends string = string,
|
|
448
478
|
TAccountCollateralPool extends string = string,
|
|
449
479
|
TAccountUnderlyingMint extends string = string,
|
|
480
|
+
TAccountCollateralMint extends string = string,
|
|
450
481
|
TAccountLongMint extends string = string,
|
|
451
482
|
TAccountEscrowLongAccount extends string = string,
|
|
452
483
|
TAccountPremiumVault extends string = string,
|
|
@@ -457,6 +488,7 @@ export type CloseLongToPoolInput<
|
|
|
457
488
|
TAccountBuyerPosition extends string = string,
|
|
458
489
|
TAccountBuyerLongAccount extends string = string,
|
|
459
490
|
TAccountBuyerPayoutAccount extends string = string,
|
|
491
|
+
TAccountBuyerUnderlyingPayoutAccount extends string = string,
|
|
460
492
|
TAccountCollateralVault extends string = string,
|
|
461
493
|
TAccountBuyer extends string = string,
|
|
462
494
|
TAccountTokenProgram extends string = string,
|
|
@@ -470,6 +502,8 @@ export type CloseLongToPoolInput<
|
|
|
470
502
|
collateralPool: Address<TAccountCollateralPool>;
|
|
471
503
|
/** Underlying token mint (for decimal handling) */
|
|
472
504
|
underlyingMint: Address<TAccountUnderlyingMint>;
|
|
505
|
+
/** Collateral mint (settlement currency for collateral-vault payout leg) */
|
|
506
|
+
collateralMint: Address<TAccountCollateralMint>;
|
|
473
507
|
/** LONG token mint (for transfer validation) */
|
|
474
508
|
longMint: Address<TAccountLongMint>;
|
|
475
509
|
/** Pool LONG escrow (destination when buyer closes back to pool) */
|
|
@@ -485,8 +519,10 @@ export type CloseLongToPoolInput<
|
|
|
485
519
|
buyerPosition: Address<TAccountBuyerPosition>;
|
|
486
520
|
/** Buyer's LONG token account (source of tokens to return) */
|
|
487
521
|
buyerLongAccount: Address<TAccountBuyerLongAccount>;
|
|
488
|
-
/** Buyer's
|
|
522
|
+
/** Buyer's settlement token account (receives collateral-vault payout leg) */
|
|
489
523
|
buyerPayoutAccount: Address<TAccountBuyerPayoutAccount>;
|
|
524
|
+
/** Buyer's underlying token account (receives premium-vault payout leg; same ATA when physical) */
|
|
525
|
+
buyerUnderlyingPayoutAccount: Address<TAccountBuyerUnderlyingPayoutAccount>;
|
|
490
526
|
/** Collateral vault (source of payout) */
|
|
491
527
|
collateralVault: Address<TAccountCollateralVault>;
|
|
492
528
|
buyer: TransactionSigner<TAccountBuyer>;
|
|
@@ -501,6 +537,7 @@ export function getCloseLongToPoolInstruction<
|
|
|
501
537
|
TAccountOptionAccount extends string,
|
|
502
538
|
TAccountCollateralPool extends string,
|
|
503
539
|
TAccountUnderlyingMint extends string,
|
|
540
|
+
TAccountCollateralMint extends string,
|
|
504
541
|
TAccountLongMint extends string,
|
|
505
542
|
TAccountEscrowLongAccount extends string,
|
|
506
543
|
TAccountPremiumVault extends string,
|
|
@@ -511,6 +548,7 @@ export function getCloseLongToPoolInstruction<
|
|
|
511
548
|
TAccountBuyerPosition extends string,
|
|
512
549
|
TAccountBuyerLongAccount extends string,
|
|
513
550
|
TAccountBuyerPayoutAccount extends string,
|
|
551
|
+
TAccountBuyerUnderlyingPayoutAccount extends string,
|
|
514
552
|
TAccountCollateralVault extends string,
|
|
515
553
|
TAccountBuyer extends string,
|
|
516
554
|
TAccountTokenProgram extends string,
|
|
@@ -522,6 +560,7 @@ export function getCloseLongToPoolInstruction<
|
|
|
522
560
|
TAccountOptionAccount,
|
|
523
561
|
TAccountCollateralPool,
|
|
524
562
|
TAccountUnderlyingMint,
|
|
563
|
+
TAccountCollateralMint,
|
|
525
564
|
TAccountLongMint,
|
|
526
565
|
TAccountEscrowLongAccount,
|
|
527
566
|
TAccountPremiumVault,
|
|
@@ -532,6 +571,7 @@ export function getCloseLongToPoolInstruction<
|
|
|
532
571
|
TAccountBuyerPosition,
|
|
533
572
|
TAccountBuyerLongAccount,
|
|
534
573
|
TAccountBuyerPayoutAccount,
|
|
574
|
+
TAccountBuyerUnderlyingPayoutAccount,
|
|
535
575
|
TAccountCollateralVault,
|
|
536
576
|
TAccountBuyer,
|
|
537
577
|
TAccountTokenProgram,
|
|
@@ -544,6 +584,7 @@ export function getCloseLongToPoolInstruction<
|
|
|
544
584
|
TAccountOptionAccount,
|
|
545
585
|
TAccountCollateralPool,
|
|
546
586
|
TAccountUnderlyingMint,
|
|
587
|
+
TAccountCollateralMint,
|
|
547
588
|
TAccountLongMint,
|
|
548
589
|
TAccountEscrowLongAccount,
|
|
549
590
|
TAccountPremiumVault,
|
|
@@ -554,6 +595,7 @@ export function getCloseLongToPoolInstruction<
|
|
|
554
595
|
TAccountBuyerPosition,
|
|
555
596
|
TAccountBuyerLongAccount,
|
|
556
597
|
TAccountBuyerPayoutAccount,
|
|
598
|
+
TAccountBuyerUnderlyingPayoutAccount,
|
|
557
599
|
TAccountCollateralVault,
|
|
558
600
|
TAccountBuyer,
|
|
559
601
|
TAccountTokenProgram,
|
|
@@ -569,6 +611,7 @@ export function getCloseLongToPoolInstruction<
|
|
|
569
611
|
optionAccount: { value: input.optionAccount ?? null, isWritable: true },
|
|
570
612
|
collateralPool: { value: input.collateralPool ?? null, isWritable: true },
|
|
571
613
|
underlyingMint: { value: input.underlyingMint ?? null, isWritable: false },
|
|
614
|
+
collateralMint: { value: input.collateralMint ?? null, isWritable: false },
|
|
572
615
|
longMint: { value: input.longMint ?? null, isWritable: true },
|
|
573
616
|
escrowLongAccount: {
|
|
574
617
|
value: input.escrowLongAccount ?? null,
|
|
@@ -597,6 +640,10 @@ export function getCloseLongToPoolInstruction<
|
|
|
597
640
|
value: input.buyerPayoutAccount ?? null,
|
|
598
641
|
isWritable: true,
|
|
599
642
|
},
|
|
643
|
+
buyerUnderlyingPayoutAccount: {
|
|
644
|
+
value: input.buyerUnderlyingPayoutAccount ?? null,
|
|
645
|
+
isWritable: true,
|
|
646
|
+
},
|
|
600
647
|
collateralVault: { value: input.collateralVault ?? null, isWritable: true },
|
|
601
648
|
buyer: { value: input.buyer ?? null, isWritable: true },
|
|
602
649
|
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
@@ -635,6 +682,7 @@ export function getCloseLongToPoolInstruction<
|
|
|
635
682
|
getAccountMeta(accounts.optionAccount),
|
|
636
683
|
getAccountMeta(accounts.collateralPool),
|
|
637
684
|
getAccountMeta(accounts.underlyingMint),
|
|
685
|
+
getAccountMeta(accounts.collateralMint),
|
|
638
686
|
getAccountMeta(accounts.longMint),
|
|
639
687
|
getAccountMeta(accounts.escrowLongAccount),
|
|
640
688
|
getAccountMeta(accounts.premiumVault),
|
|
@@ -645,6 +693,7 @@ export function getCloseLongToPoolInstruction<
|
|
|
645
693
|
getAccountMeta(accounts.buyerPosition),
|
|
646
694
|
getAccountMeta(accounts.buyerLongAccount),
|
|
647
695
|
getAccountMeta(accounts.buyerPayoutAccount),
|
|
696
|
+
getAccountMeta(accounts.buyerUnderlyingPayoutAccount),
|
|
648
697
|
getAccountMeta(accounts.collateralVault),
|
|
649
698
|
getAccountMeta(accounts.buyer),
|
|
650
699
|
getAccountMeta(accounts.tokenProgram),
|
|
@@ -660,6 +709,7 @@ export function getCloseLongToPoolInstruction<
|
|
|
660
709
|
TAccountOptionAccount,
|
|
661
710
|
TAccountCollateralPool,
|
|
662
711
|
TAccountUnderlyingMint,
|
|
712
|
+
TAccountCollateralMint,
|
|
663
713
|
TAccountLongMint,
|
|
664
714
|
TAccountEscrowLongAccount,
|
|
665
715
|
TAccountPremiumVault,
|
|
@@ -670,6 +720,7 @@ export function getCloseLongToPoolInstruction<
|
|
|
670
720
|
TAccountBuyerPosition,
|
|
671
721
|
TAccountBuyerLongAccount,
|
|
672
722
|
TAccountBuyerPayoutAccount,
|
|
723
|
+
TAccountBuyerUnderlyingPayoutAccount,
|
|
673
724
|
TAccountCollateralVault,
|
|
674
725
|
TAccountBuyer,
|
|
675
726
|
TAccountTokenProgram,
|
|
@@ -691,28 +742,32 @@ export type ParsedCloseLongToPoolInstruction<
|
|
|
691
742
|
collateralPool: TAccountMetas[2];
|
|
692
743
|
/** Underlying token mint (for decimal handling) */
|
|
693
744
|
underlyingMint: TAccountMetas[3];
|
|
745
|
+
/** Collateral mint (settlement currency for collateral-vault payout leg) */
|
|
746
|
+
collateralMint: TAccountMetas[4];
|
|
694
747
|
/** LONG token mint (for transfer validation) */
|
|
695
|
-
longMint: TAccountMetas[
|
|
748
|
+
longMint: TAccountMetas[5];
|
|
696
749
|
/** Pool LONG escrow (destination when buyer closes back to pool) */
|
|
697
|
-
escrowLongAccount: TAccountMetas[
|
|
750
|
+
escrowLongAccount: TAccountMetas[6];
|
|
698
751
|
/** Premium vault (first source of buyer payout) */
|
|
699
|
-
premiumVault: TAccountMetas[
|
|
752
|
+
premiumVault: TAccountMetas[7];
|
|
700
753
|
/** Market data account (provides risk-free rate and switchboard_feed_id) */
|
|
701
|
-
marketData: TAccountMetas[
|
|
702
|
-
switchboardQueue: TAccountMetas[
|
|
703
|
-
slotHashesSysvar: TAccountMetas[
|
|
704
|
-
instructionsSysvar: TAccountMetas[
|
|
754
|
+
marketData: TAccountMetas[8];
|
|
755
|
+
switchboardQueue: TAccountMetas[9];
|
|
756
|
+
slotHashesSysvar: TAccountMetas[10];
|
|
757
|
+
instructionsSysvar: TAccountMetas[11];
|
|
705
758
|
/** Buyer's position account */
|
|
706
|
-
buyerPosition: TAccountMetas[
|
|
759
|
+
buyerPosition: TAccountMetas[12];
|
|
707
760
|
/** Buyer's LONG token account (source of tokens to return) */
|
|
708
|
-
buyerLongAccount: TAccountMetas[
|
|
709
|
-
/** Buyer's
|
|
710
|
-
buyerPayoutAccount: TAccountMetas[
|
|
761
|
+
buyerLongAccount: TAccountMetas[13];
|
|
762
|
+
/** Buyer's settlement token account (receives collateral-vault payout leg) */
|
|
763
|
+
buyerPayoutAccount: TAccountMetas[14];
|
|
764
|
+
/** Buyer's underlying token account (receives premium-vault payout leg; same ATA when physical) */
|
|
765
|
+
buyerUnderlyingPayoutAccount: TAccountMetas[15];
|
|
711
766
|
/** Collateral vault (source of payout) */
|
|
712
|
-
collateralVault: TAccountMetas[
|
|
713
|
-
buyer: TAccountMetas[
|
|
714
|
-
tokenProgram: TAccountMetas[
|
|
715
|
-
systemProgram: TAccountMetas[
|
|
767
|
+
collateralVault: TAccountMetas[16];
|
|
768
|
+
buyer: TAccountMetas[17];
|
|
769
|
+
tokenProgram: TAccountMetas[18];
|
|
770
|
+
systemProgram: TAccountMetas[19];
|
|
716
771
|
};
|
|
717
772
|
data: CloseLongToPoolInstructionData;
|
|
718
773
|
};
|
|
@@ -725,7 +780,7 @@ export function parseCloseLongToPoolInstruction<
|
|
|
725
780
|
InstructionWithAccounts<TAccountMetas> &
|
|
726
781
|
InstructionWithData<ReadonlyUint8Array>,
|
|
727
782
|
): ParsedCloseLongToPoolInstruction<TProgram, TAccountMetas> {
|
|
728
|
-
if (instruction.accounts.length <
|
|
783
|
+
if (instruction.accounts.length < 20) {
|
|
729
784
|
// TODO: Coded error.
|
|
730
785
|
throw new Error("Not enough accounts");
|
|
731
786
|
}
|
|
@@ -742,6 +797,7 @@ export function parseCloseLongToPoolInstruction<
|
|
|
742
797
|
optionAccount: getNextAccount(),
|
|
743
798
|
collateralPool: getNextAccount(),
|
|
744
799
|
underlyingMint: getNextAccount(),
|
|
800
|
+
collateralMint: getNextAccount(),
|
|
745
801
|
longMint: getNextAccount(),
|
|
746
802
|
escrowLongAccount: getNextAccount(),
|
|
747
803
|
premiumVault: getNextAccount(),
|
|
@@ -752,6 +808,7 @@ export function parseCloseLongToPoolInstruction<
|
|
|
752
808
|
buyerPosition: getNextAccount(),
|
|
753
809
|
buyerLongAccount: getNextAccount(),
|
|
754
810
|
buyerPayoutAccount: getNextAccount(),
|
|
811
|
+
buyerUnderlyingPayoutAccount: getNextAccount(),
|
|
755
812
|
collateralVault: getNextAccount(),
|
|
756
813
|
buyer: getNextAccount(),
|
|
757
814
|
tokenProgram: getNextAccount(),
|
|
@@ -350,7 +350,7 @@ export type OptionMintAsyncInput<
|
|
|
350
350
|
optionPool?: Address<TAccountOptionPool>;
|
|
351
351
|
/** Pool's escrow for holding LONG tokens (for buyers to purchase) */
|
|
352
352
|
escrowLongAccount?: Address<TAccountEscrowLongAccount>;
|
|
353
|
-
/** Pool
|
|
353
|
+
/** Pool vault for premiums (underlying when physical, collateral mint for cash) */
|
|
354
354
|
premiumVault?: Address<TAccountPremiumVault>;
|
|
355
355
|
/** Collateral pool for this option */
|
|
356
356
|
collateralPool?: Address<TAccountCollateralPool>;
|
|
@@ -707,7 +707,7 @@ export async function getOptionMintInstructionAsync<
|
|
|
707
707
|
]),
|
|
708
708
|
),
|
|
709
709
|
getAddressEncoder().encode(
|
|
710
|
-
expectAddress(accounts.
|
|
710
|
+
expectAddress(accounts.collateralMint.value),
|
|
711
711
|
),
|
|
712
712
|
],
|
|
713
713
|
});
|
|
@@ -924,7 +924,7 @@ export type OptionMintInput<
|
|
|
924
924
|
optionPool: Address<TAccountOptionPool>;
|
|
925
925
|
/** Pool's escrow for holding LONG tokens (for buyers to purchase) */
|
|
926
926
|
escrowLongAccount: Address<TAccountEscrowLongAccount>;
|
|
927
|
-
/** Pool
|
|
927
|
+
/** Pool vault for premiums (underlying when physical, collateral mint for cash) */
|
|
928
928
|
premiumVault: Address<TAccountPremiumVault>;
|
|
929
929
|
/** Collateral pool for this option */
|
|
930
930
|
collateralPool: Address<TAccountCollateralPool>;
|
|
@@ -1278,7 +1278,7 @@ export type ParsedOptionMintInstruction<
|
|
|
1278
1278
|
optionPool: TAccountMetas[11];
|
|
1279
1279
|
/** Pool's escrow for holding LONG tokens (for buyers to purchase) */
|
|
1280
1280
|
escrowLongAccount: TAccountMetas[12];
|
|
1281
|
-
/** Pool
|
|
1281
|
+
/** Pool vault for premiums (underlying when physical, collateral mint for cash) */
|
|
1282
1282
|
premiumVault: TAccountMetas[13];
|
|
1283
1283
|
/** Collateral pool for this option */
|
|
1284
1284
|
collateralPool: TAccountMetas[14];
|
|
@@ -222,9 +222,9 @@ export type UnwindWriterUnsoldAsyncInput<
|
|
|
222
222
|
*/
|
|
223
223
|
premiumVault: Address<TAccountPremiumVault>;
|
|
224
224
|
/**
|
|
225
|
-
* Writer's token account for returned collateral
|
|
226
|
-
*
|
|
227
|
-
* premium_vault.mint
|
|
225
|
+
* Writer's token account for returned collateral (collateral_pool mint).
|
|
226
|
+
* Leftover theta from premium_vault is only transferred here when
|
|
227
|
+
* premium_vault.mint matches this account (physical settlement).
|
|
228
228
|
*/
|
|
229
229
|
writerCollateralAccount: Address<TAccountWriterCollateralAccount>;
|
|
230
230
|
/** OMLP Vault state PDA (for total_loans, add_interest_to_index) - optional, required when repaying loans */
|
|
@@ -480,9 +480,9 @@ export type UnwindWriterUnsoldInput<
|
|
|
480
480
|
*/
|
|
481
481
|
premiumVault: Address<TAccountPremiumVault>;
|
|
482
482
|
/**
|
|
483
|
-
* Writer's token account for returned collateral
|
|
484
|
-
*
|
|
485
|
-
* premium_vault.mint
|
|
483
|
+
* Writer's token account for returned collateral (collateral_pool mint).
|
|
484
|
+
* Leftover theta from premium_vault is only transferred here when
|
|
485
|
+
* premium_vault.mint matches this account (physical settlement).
|
|
486
486
|
*/
|
|
487
487
|
writerCollateralAccount: Address<TAccountWriterCollateralAccount>;
|
|
488
488
|
/** OMLP Vault state PDA (for total_loans, add_interest_to_index) - optional, required when repaying loans */
|
|
@@ -693,9 +693,9 @@ export type ParsedUnwindWriterUnsoldInstruction<
|
|
|
693
693
|
*/
|
|
694
694
|
premiumVault: TAccountMetas[10];
|
|
695
695
|
/**
|
|
696
|
-
* Writer's token account for returned collateral
|
|
697
|
-
*
|
|
698
|
-
* premium_vault.mint
|
|
696
|
+
* Writer's token account for returned collateral (collateral_pool mint).
|
|
697
|
+
* Leftover theta from premium_vault is only transferred here when
|
|
698
|
+
* premium_vault.mint matches this account (physical settlement).
|
|
699
699
|
*/
|
|
700
700
|
writerCollateralAccount: TAccountMetas[11];
|
|
701
701
|
/** OMLP Vault state PDA (for total_loans, add_interest_to_index) - optional, required when repaying loans */
|