@epicentral/sos-sdk 0.5.0-alpha.8 → 0.6.1-alpha
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.
Potentially problematic release.
This version of @epicentral/sos-sdk might be problematic. Click here for more details.
- package/README.md +60 -9
- package/client/lookup-table.ts +1 -1
- package/generated/accounts/index.ts +0 -1
- package/generated/accounts/marketDataAccount.ts +4 -4
- package/generated/errors/optionProgram.ts +83 -75
- package/generated/instructions/autoExerciseAllExpired.ts +31 -28
- package/generated/instructions/autoExerciseExpired.ts +31 -28
- package/generated/instructions/buyFromPool.ts +31 -28
- package/generated/instructions/closeLongToPool.ts +31 -28
- package/generated/instructions/initializeMarketData.ts +6 -6
- package/generated/instructions/liquidateWriterPosition.ts +31 -28
- package/generated/instructions/optionExercise.ts +28 -25
- package/generated/instructions/optionMint.ts +28 -34
- package/generated/instructions/optionValidate.ts +17 -16
- package/generated/programs/optionProgram.ts +2 -301
- package/generated/types/index.ts +0 -2
- package/index.ts +6 -0
- package/long/builders.ts +103 -12
- package/long/exercise.ts +2 -2
- package/omlp/builders.ts +22 -2
- package/omlp/service.ts +41 -4
- package/oracle/switchboard.ts +56 -0
- package/package.json +1 -1
- package/short/builders.ts +40 -13
|
@@ -60,7 +60,7 @@ export type AutoExerciseExpiredInstruction<
|
|
|
60
60
|
TAccountBuyerPaymentAccount extends string | AccountMeta<string> = string,
|
|
61
61
|
TAccountBuyerOptionAccount extends string | AccountMeta<string> = string,
|
|
62
62
|
TAccountOptionMint extends string | AccountMeta<string> = string,
|
|
63
|
-
|
|
63
|
+
TAccountSwitchboardFeed extends string | AccountMeta<string> = string,
|
|
64
64
|
TAccountMarketData extends string | AccountMeta<string> = string,
|
|
65
65
|
TAccountOmlpVault extends string | AccountMeta<string> = string,
|
|
66
66
|
TAccountKeeper extends string | AccountMeta<string> = string,
|
|
@@ -100,9 +100,9 @@ export type AutoExerciseExpiredInstruction<
|
|
|
100
100
|
TAccountOptionMint extends string
|
|
101
101
|
? WritableAccount<TAccountOptionMint>
|
|
102
102
|
: TAccountOptionMint,
|
|
103
|
-
|
|
104
|
-
? ReadonlyAccount<
|
|
105
|
-
:
|
|
103
|
+
TAccountSwitchboardFeed extends string
|
|
104
|
+
? ReadonlyAccount<TAccountSwitchboardFeed>
|
|
105
|
+
: TAccountSwitchboardFeed,
|
|
106
106
|
TAccountMarketData extends string
|
|
107
107
|
? ReadonlyAccount<TAccountMarketData>
|
|
108
108
|
: TAccountMarketData,
|
|
@@ -165,7 +165,7 @@ export type AutoExerciseExpiredAsyncInput<
|
|
|
165
165
|
TAccountBuyerPaymentAccount extends string = string,
|
|
166
166
|
TAccountBuyerOptionAccount extends string = string,
|
|
167
167
|
TAccountOptionMint extends string = string,
|
|
168
|
-
|
|
168
|
+
TAccountSwitchboardFeed extends string = string,
|
|
169
169
|
TAccountMarketData extends string = string,
|
|
170
170
|
TAccountOmlpVault extends string = string,
|
|
171
171
|
TAccountKeeper extends string = string,
|
|
@@ -190,9 +190,8 @@ export type AutoExerciseExpiredAsyncInput<
|
|
|
190
190
|
buyerOptionAccount: Address<TAccountBuyerOptionAccount>;
|
|
191
191
|
/** Option mint (for burning) */
|
|
192
192
|
optionMint: Address<TAccountOptionMint>;
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
/** Market data for this underlying asset (contains pyth_feed_id) */
|
|
193
|
+
switchboardFeed: Address<TAccountSwitchboardFeed>;
|
|
194
|
+
/** Market data for this underlying asset (contains switchboard_feed_id) */
|
|
196
195
|
marketData: Address<TAccountMarketData>;
|
|
197
196
|
/** OMLP Vault token account to receive repayments */
|
|
198
197
|
omlpVault: Address<TAccountOmlpVault>;
|
|
@@ -212,7 +211,7 @@ export async function getAutoExerciseExpiredInstructionAsync<
|
|
|
212
211
|
TAccountBuyerPaymentAccount extends string,
|
|
213
212
|
TAccountBuyerOptionAccount extends string,
|
|
214
213
|
TAccountOptionMint extends string,
|
|
215
|
-
|
|
214
|
+
TAccountSwitchboardFeed extends string,
|
|
216
215
|
TAccountMarketData extends string,
|
|
217
216
|
TAccountOmlpVault extends string,
|
|
218
217
|
TAccountKeeper extends string,
|
|
@@ -230,7 +229,7 @@ export async function getAutoExerciseExpiredInstructionAsync<
|
|
|
230
229
|
TAccountBuyerPaymentAccount,
|
|
231
230
|
TAccountBuyerOptionAccount,
|
|
232
231
|
TAccountOptionMint,
|
|
233
|
-
|
|
232
|
+
TAccountSwitchboardFeed,
|
|
234
233
|
TAccountMarketData,
|
|
235
234
|
TAccountOmlpVault,
|
|
236
235
|
TAccountKeeper,
|
|
@@ -250,7 +249,7 @@ export async function getAutoExerciseExpiredInstructionAsync<
|
|
|
250
249
|
TAccountBuyerPaymentAccount,
|
|
251
250
|
TAccountBuyerOptionAccount,
|
|
252
251
|
TAccountOptionMint,
|
|
253
|
-
|
|
252
|
+
TAccountSwitchboardFeed,
|
|
254
253
|
TAccountMarketData,
|
|
255
254
|
TAccountOmlpVault,
|
|
256
255
|
TAccountKeeper,
|
|
@@ -279,7 +278,10 @@ export async function getAutoExerciseExpiredInstructionAsync<
|
|
|
279
278
|
isWritable: true,
|
|
280
279
|
},
|
|
281
280
|
optionMint: { value: input.optionMint ?? null, isWritable: true },
|
|
282
|
-
|
|
281
|
+
switchboardFeed: {
|
|
282
|
+
value: input.switchboardFeed ?? null,
|
|
283
|
+
isWritable: false,
|
|
284
|
+
},
|
|
283
285
|
marketData: { value: input.marketData ?? null, isWritable: false },
|
|
284
286
|
omlpVault: { value: input.omlpVault ?? null, isWritable: true },
|
|
285
287
|
keeper: { value: input.keeper ?? null, isWritable: true },
|
|
@@ -327,7 +329,7 @@ export async function getAutoExerciseExpiredInstructionAsync<
|
|
|
327
329
|
getAccountMeta(accounts.buyerPaymentAccount),
|
|
328
330
|
getAccountMeta(accounts.buyerOptionAccount),
|
|
329
331
|
getAccountMeta(accounts.optionMint),
|
|
330
|
-
getAccountMeta(accounts.
|
|
332
|
+
getAccountMeta(accounts.switchboardFeed),
|
|
331
333
|
getAccountMeta(accounts.marketData),
|
|
332
334
|
getAccountMeta(accounts.omlpVault),
|
|
333
335
|
getAccountMeta(accounts.keeper),
|
|
@@ -347,7 +349,7 @@ export async function getAutoExerciseExpiredInstructionAsync<
|
|
|
347
349
|
TAccountBuyerPaymentAccount,
|
|
348
350
|
TAccountBuyerOptionAccount,
|
|
349
351
|
TAccountOptionMint,
|
|
350
|
-
|
|
352
|
+
TAccountSwitchboardFeed,
|
|
351
353
|
TAccountMarketData,
|
|
352
354
|
TAccountOmlpVault,
|
|
353
355
|
TAccountKeeper,
|
|
@@ -366,7 +368,7 @@ export type AutoExerciseExpiredInput<
|
|
|
366
368
|
TAccountBuyerPaymentAccount extends string = string,
|
|
367
369
|
TAccountBuyerOptionAccount extends string = string,
|
|
368
370
|
TAccountOptionMint extends string = string,
|
|
369
|
-
|
|
371
|
+
TAccountSwitchboardFeed extends string = string,
|
|
370
372
|
TAccountMarketData extends string = string,
|
|
371
373
|
TAccountOmlpVault extends string = string,
|
|
372
374
|
TAccountKeeper extends string = string,
|
|
@@ -391,9 +393,8 @@ export type AutoExerciseExpiredInput<
|
|
|
391
393
|
buyerOptionAccount: Address<TAccountBuyerOptionAccount>;
|
|
392
394
|
/** Option mint (for burning) */
|
|
393
395
|
optionMint: Address<TAccountOptionMint>;
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
/** Market data for this underlying asset (contains pyth_feed_id) */
|
|
396
|
+
switchboardFeed: Address<TAccountSwitchboardFeed>;
|
|
397
|
+
/** Market data for this underlying asset (contains switchboard_feed_id) */
|
|
397
398
|
marketData: Address<TAccountMarketData>;
|
|
398
399
|
/** OMLP Vault token account to receive repayments */
|
|
399
400
|
omlpVault: Address<TAccountOmlpVault>;
|
|
@@ -413,7 +414,7 @@ export function getAutoExerciseExpiredInstruction<
|
|
|
413
414
|
TAccountBuyerPaymentAccount extends string,
|
|
414
415
|
TAccountBuyerOptionAccount extends string,
|
|
415
416
|
TAccountOptionMint extends string,
|
|
416
|
-
|
|
417
|
+
TAccountSwitchboardFeed extends string,
|
|
417
418
|
TAccountMarketData extends string,
|
|
418
419
|
TAccountOmlpVault extends string,
|
|
419
420
|
TAccountKeeper extends string,
|
|
@@ -431,7 +432,7 @@ export function getAutoExerciseExpiredInstruction<
|
|
|
431
432
|
TAccountBuyerPaymentAccount,
|
|
432
433
|
TAccountBuyerOptionAccount,
|
|
433
434
|
TAccountOptionMint,
|
|
434
|
-
|
|
435
|
+
TAccountSwitchboardFeed,
|
|
435
436
|
TAccountMarketData,
|
|
436
437
|
TAccountOmlpVault,
|
|
437
438
|
TAccountKeeper,
|
|
@@ -450,7 +451,7 @@ export function getAutoExerciseExpiredInstruction<
|
|
|
450
451
|
TAccountBuyerPaymentAccount,
|
|
451
452
|
TAccountBuyerOptionAccount,
|
|
452
453
|
TAccountOptionMint,
|
|
453
|
-
|
|
454
|
+
TAccountSwitchboardFeed,
|
|
454
455
|
TAccountMarketData,
|
|
455
456
|
TAccountOmlpVault,
|
|
456
457
|
TAccountKeeper,
|
|
@@ -478,7 +479,10 @@ export function getAutoExerciseExpiredInstruction<
|
|
|
478
479
|
isWritable: true,
|
|
479
480
|
},
|
|
480
481
|
optionMint: { value: input.optionMint ?? null, isWritable: true },
|
|
481
|
-
|
|
482
|
+
switchboardFeed: {
|
|
483
|
+
value: input.switchboardFeed ?? null,
|
|
484
|
+
isWritable: false,
|
|
485
|
+
},
|
|
482
486
|
marketData: { value: input.marketData ?? null, isWritable: false },
|
|
483
487
|
omlpVault: { value: input.omlpVault ?? null, isWritable: true },
|
|
484
488
|
keeper: { value: input.keeper ?? null, isWritable: true },
|
|
@@ -512,7 +516,7 @@ export function getAutoExerciseExpiredInstruction<
|
|
|
512
516
|
getAccountMeta(accounts.buyerPaymentAccount),
|
|
513
517
|
getAccountMeta(accounts.buyerOptionAccount),
|
|
514
518
|
getAccountMeta(accounts.optionMint),
|
|
515
|
-
getAccountMeta(accounts.
|
|
519
|
+
getAccountMeta(accounts.switchboardFeed),
|
|
516
520
|
getAccountMeta(accounts.marketData),
|
|
517
521
|
getAccountMeta(accounts.omlpVault),
|
|
518
522
|
getAccountMeta(accounts.keeper),
|
|
@@ -532,7 +536,7 @@ export function getAutoExerciseExpiredInstruction<
|
|
|
532
536
|
TAccountBuyerPaymentAccount,
|
|
533
537
|
TAccountBuyerOptionAccount,
|
|
534
538
|
TAccountOptionMint,
|
|
535
|
-
|
|
539
|
+
TAccountSwitchboardFeed,
|
|
536
540
|
TAccountMarketData,
|
|
537
541
|
TAccountOmlpVault,
|
|
538
542
|
TAccountKeeper,
|
|
@@ -565,9 +569,8 @@ export type ParsedAutoExerciseExpiredInstruction<
|
|
|
565
569
|
buyerOptionAccount: TAccountMetas[7];
|
|
566
570
|
/** Option mint (for burning) */
|
|
567
571
|
optionMint: TAccountMetas[8];
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
/** Market data for this underlying asset (contains pyth_feed_id) */
|
|
572
|
+
switchboardFeed: TAccountMetas[9];
|
|
573
|
+
/** Market data for this underlying asset (contains switchboard_feed_id) */
|
|
571
574
|
marketData: TAccountMetas[10];
|
|
572
575
|
/** OMLP Vault token account to receive repayments */
|
|
573
576
|
omlpVault: TAccountMetas[11];
|
|
@@ -609,7 +612,7 @@ export function parseAutoExerciseExpiredInstruction<
|
|
|
609
612
|
buyerPaymentAccount: getNextAccount(),
|
|
610
613
|
buyerOptionAccount: getNextAccount(),
|
|
611
614
|
optionMint: getNextAccount(),
|
|
612
|
-
|
|
615
|
+
switchboardFeed: getNextAccount(),
|
|
613
616
|
marketData: getNextAccount(),
|
|
614
617
|
omlpVault: getNextAccount(),
|
|
615
618
|
keeper: getNextAccount(),
|
|
@@ -58,7 +58,7 @@ export type BuyFromPoolInstruction<
|
|
|
58
58
|
TAccountLongMint extends string | AccountMeta<string> = string,
|
|
59
59
|
TAccountUnderlyingMint extends string | AccountMeta<string> = string,
|
|
60
60
|
TAccountMarketData extends string | AccountMeta<string> = string,
|
|
61
|
-
|
|
61
|
+
TAccountSwitchboardFeed extends string | AccountMeta<string> = string,
|
|
62
62
|
TAccountBuyerPosition extends string | AccountMeta<string> = string,
|
|
63
63
|
TAccountBuyerOptionAccount extends string | AccountMeta<string> = string,
|
|
64
64
|
TAccountBuyerPaymentAccount extends string | AccountMeta<string> = string,
|
|
@@ -91,9 +91,9 @@ export type BuyFromPoolInstruction<
|
|
|
91
91
|
TAccountMarketData extends string
|
|
92
92
|
? ReadonlyAccount<TAccountMarketData>
|
|
93
93
|
: TAccountMarketData,
|
|
94
|
-
|
|
95
|
-
? ReadonlyAccount<
|
|
96
|
-
:
|
|
94
|
+
TAccountSwitchboardFeed extends string
|
|
95
|
+
? ReadonlyAccount<TAccountSwitchboardFeed>
|
|
96
|
+
: TAccountSwitchboardFeed,
|
|
97
97
|
TAccountBuyerPosition extends string
|
|
98
98
|
? WritableAccount<TAccountBuyerPosition>
|
|
99
99
|
: TAccountBuyerPosition,
|
|
@@ -172,7 +172,7 @@ export type BuyFromPoolAsyncInput<
|
|
|
172
172
|
TAccountLongMint extends string = string,
|
|
173
173
|
TAccountUnderlyingMint extends string = string,
|
|
174
174
|
TAccountMarketData extends string = string,
|
|
175
|
-
|
|
175
|
+
TAccountSwitchboardFeed extends string = string,
|
|
176
176
|
TAccountBuyerPosition extends string = string,
|
|
177
177
|
TAccountBuyerOptionAccount extends string = string,
|
|
178
178
|
TAccountBuyerPaymentAccount extends string = string,
|
|
@@ -194,10 +194,9 @@ export type BuyFromPoolAsyncInput<
|
|
|
194
194
|
longMint: Address<TAccountLongMint>;
|
|
195
195
|
/** Underlying token mint (for decimal handling) */
|
|
196
196
|
underlyingMint: Address<TAccountUnderlyingMint>;
|
|
197
|
-
/** Market data account (provides risk-free rate and
|
|
197
|
+
/** Market data account (provides risk-free rate and switchboard_feed_id) */
|
|
198
198
|
marketData: Address<TAccountMarketData>;
|
|
199
|
-
|
|
200
|
-
priceUpdate: Address<TAccountPriceUpdate>;
|
|
199
|
+
switchboardFeed: Address<TAccountSwitchboardFeed>;
|
|
201
200
|
/** Buyer's position account (created for tracking) */
|
|
202
201
|
buyerPosition?: Address<TAccountBuyerPosition>;
|
|
203
202
|
/** Buyer's LONG token account (receives LONG tokens) */
|
|
@@ -222,7 +221,7 @@ export async function getBuyFromPoolInstructionAsync<
|
|
|
222
221
|
TAccountLongMint extends string,
|
|
223
222
|
TAccountUnderlyingMint extends string,
|
|
224
223
|
TAccountMarketData extends string,
|
|
225
|
-
|
|
224
|
+
TAccountSwitchboardFeed extends string,
|
|
226
225
|
TAccountBuyerPosition extends string,
|
|
227
226
|
TAccountBuyerOptionAccount extends string,
|
|
228
227
|
TAccountBuyerPaymentAccount extends string,
|
|
@@ -240,7 +239,7 @@ export async function getBuyFromPoolInstructionAsync<
|
|
|
240
239
|
TAccountLongMint,
|
|
241
240
|
TAccountUnderlyingMint,
|
|
242
241
|
TAccountMarketData,
|
|
243
|
-
|
|
242
|
+
TAccountSwitchboardFeed,
|
|
244
243
|
TAccountBuyerPosition,
|
|
245
244
|
TAccountBuyerOptionAccount,
|
|
246
245
|
TAccountBuyerPaymentAccount,
|
|
@@ -260,7 +259,7 @@ export async function getBuyFromPoolInstructionAsync<
|
|
|
260
259
|
TAccountLongMint,
|
|
261
260
|
TAccountUnderlyingMint,
|
|
262
261
|
TAccountMarketData,
|
|
263
|
-
|
|
262
|
+
TAccountSwitchboardFeed,
|
|
264
263
|
TAccountBuyerPosition,
|
|
265
264
|
TAccountBuyerOptionAccount,
|
|
266
265
|
TAccountBuyerPaymentAccount,
|
|
@@ -283,7 +282,10 @@ export async function getBuyFromPoolInstructionAsync<
|
|
|
283
282
|
longMint: { value: input.longMint ?? null, isWritable: false },
|
|
284
283
|
underlyingMint: { value: input.underlyingMint ?? null, isWritable: false },
|
|
285
284
|
marketData: { value: input.marketData ?? null, isWritable: false },
|
|
286
|
-
|
|
285
|
+
switchboardFeed: {
|
|
286
|
+
value: input.switchboardFeed ?? null,
|
|
287
|
+
isWritable: false,
|
|
288
|
+
},
|
|
287
289
|
buyerPosition: { value: input.buyerPosition ?? null, isWritable: true },
|
|
288
290
|
buyerOptionAccount: {
|
|
289
291
|
value: input.buyerOptionAccount ?? null,
|
|
@@ -365,7 +367,7 @@ export async function getBuyFromPoolInstructionAsync<
|
|
|
365
367
|
getAccountMeta(accounts.longMint),
|
|
366
368
|
getAccountMeta(accounts.underlyingMint),
|
|
367
369
|
getAccountMeta(accounts.marketData),
|
|
368
|
-
getAccountMeta(accounts.
|
|
370
|
+
getAccountMeta(accounts.switchboardFeed),
|
|
369
371
|
getAccountMeta(accounts.buyerPosition),
|
|
370
372
|
getAccountMeta(accounts.buyerOptionAccount),
|
|
371
373
|
getAccountMeta(accounts.buyerPaymentAccount),
|
|
@@ -387,7 +389,7 @@ export async function getBuyFromPoolInstructionAsync<
|
|
|
387
389
|
TAccountLongMint,
|
|
388
390
|
TAccountUnderlyingMint,
|
|
389
391
|
TAccountMarketData,
|
|
390
|
-
|
|
392
|
+
TAccountSwitchboardFeed,
|
|
391
393
|
TAccountBuyerPosition,
|
|
392
394
|
TAccountBuyerOptionAccount,
|
|
393
395
|
TAccountBuyerPaymentAccount,
|
|
@@ -406,7 +408,7 @@ export type BuyFromPoolInput<
|
|
|
406
408
|
TAccountLongMint extends string = string,
|
|
407
409
|
TAccountUnderlyingMint extends string = string,
|
|
408
410
|
TAccountMarketData extends string = string,
|
|
409
|
-
|
|
411
|
+
TAccountSwitchboardFeed extends string = string,
|
|
410
412
|
TAccountBuyerPosition extends string = string,
|
|
411
413
|
TAccountBuyerOptionAccount extends string = string,
|
|
412
414
|
TAccountBuyerPaymentAccount extends string = string,
|
|
@@ -428,10 +430,9 @@ export type BuyFromPoolInput<
|
|
|
428
430
|
longMint: Address<TAccountLongMint>;
|
|
429
431
|
/** Underlying token mint (for decimal handling) */
|
|
430
432
|
underlyingMint: Address<TAccountUnderlyingMint>;
|
|
431
|
-
/** Market data account (provides risk-free rate and
|
|
433
|
+
/** Market data account (provides risk-free rate and switchboard_feed_id) */
|
|
432
434
|
marketData: Address<TAccountMarketData>;
|
|
433
|
-
|
|
434
|
-
priceUpdate: Address<TAccountPriceUpdate>;
|
|
435
|
+
switchboardFeed: Address<TAccountSwitchboardFeed>;
|
|
435
436
|
/** Buyer's position account (created for tracking) */
|
|
436
437
|
buyerPosition: Address<TAccountBuyerPosition>;
|
|
437
438
|
/** Buyer's LONG token account (receives LONG tokens) */
|
|
@@ -456,7 +457,7 @@ export function getBuyFromPoolInstruction<
|
|
|
456
457
|
TAccountLongMint extends string,
|
|
457
458
|
TAccountUnderlyingMint extends string,
|
|
458
459
|
TAccountMarketData extends string,
|
|
459
|
-
|
|
460
|
+
TAccountSwitchboardFeed extends string,
|
|
460
461
|
TAccountBuyerPosition extends string,
|
|
461
462
|
TAccountBuyerOptionAccount extends string,
|
|
462
463
|
TAccountBuyerPaymentAccount extends string,
|
|
@@ -474,7 +475,7 @@ export function getBuyFromPoolInstruction<
|
|
|
474
475
|
TAccountLongMint,
|
|
475
476
|
TAccountUnderlyingMint,
|
|
476
477
|
TAccountMarketData,
|
|
477
|
-
|
|
478
|
+
TAccountSwitchboardFeed,
|
|
478
479
|
TAccountBuyerPosition,
|
|
479
480
|
TAccountBuyerOptionAccount,
|
|
480
481
|
TAccountBuyerPaymentAccount,
|
|
@@ -493,7 +494,7 @@ export function getBuyFromPoolInstruction<
|
|
|
493
494
|
TAccountLongMint,
|
|
494
495
|
TAccountUnderlyingMint,
|
|
495
496
|
TAccountMarketData,
|
|
496
|
-
|
|
497
|
+
TAccountSwitchboardFeed,
|
|
497
498
|
TAccountBuyerPosition,
|
|
498
499
|
TAccountBuyerOptionAccount,
|
|
499
500
|
TAccountBuyerPaymentAccount,
|
|
@@ -515,7 +516,10 @@ export function getBuyFromPoolInstruction<
|
|
|
515
516
|
longMint: { value: input.longMint ?? null, isWritable: false },
|
|
516
517
|
underlyingMint: { value: input.underlyingMint ?? null, isWritable: false },
|
|
517
518
|
marketData: { value: input.marketData ?? null, isWritable: false },
|
|
518
|
-
|
|
519
|
+
switchboardFeed: {
|
|
520
|
+
value: input.switchboardFeed ?? null,
|
|
521
|
+
isWritable: false,
|
|
522
|
+
},
|
|
519
523
|
buyerPosition: { value: input.buyerPosition ?? null, isWritable: true },
|
|
520
524
|
buyerOptionAccount: {
|
|
521
525
|
value: input.buyerOptionAccount ?? null,
|
|
@@ -568,7 +572,7 @@ export function getBuyFromPoolInstruction<
|
|
|
568
572
|
getAccountMeta(accounts.longMint),
|
|
569
573
|
getAccountMeta(accounts.underlyingMint),
|
|
570
574
|
getAccountMeta(accounts.marketData),
|
|
571
|
-
getAccountMeta(accounts.
|
|
575
|
+
getAccountMeta(accounts.switchboardFeed),
|
|
572
576
|
getAccountMeta(accounts.buyerPosition),
|
|
573
577
|
getAccountMeta(accounts.buyerOptionAccount),
|
|
574
578
|
getAccountMeta(accounts.buyerPaymentAccount),
|
|
@@ -590,7 +594,7 @@ export function getBuyFromPoolInstruction<
|
|
|
590
594
|
TAccountLongMint,
|
|
591
595
|
TAccountUnderlyingMint,
|
|
592
596
|
TAccountMarketData,
|
|
593
|
-
|
|
597
|
+
TAccountSwitchboardFeed,
|
|
594
598
|
TAccountBuyerPosition,
|
|
595
599
|
TAccountBuyerOptionAccount,
|
|
596
600
|
TAccountBuyerPaymentAccount,
|
|
@@ -620,10 +624,9 @@ export type ParsedBuyFromPoolInstruction<
|
|
|
620
624
|
longMint: TAccountMetas[2];
|
|
621
625
|
/** Underlying token mint (for decimal handling) */
|
|
622
626
|
underlyingMint: TAccountMetas[3];
|
|
623
|
-
/** Market data account (provides risk-free rate and
|
|
627
|
+
/** Market data account (provides risk-free rate and switchboard_feed_id) */
|
|
624
628
|
marketData: TAccountMetas[4];
|
|
625
|
-
|
|
626
|
-
priceUpdate: TAccountMetas[5];
|
|
629
|
+
switchboardFeed: TAccountMetas[5];
|
|
627
630
|
/** Buyer's position account (created for tracking) */
|
|
628
631
|
buyerPosition: TAccountMetas[6];
|
|
629
632
|
/** Buyer's LONG token account (receives LONG tokens) */
|
|
@@ -668,7 +671,7 @@ export function parseBuyFromPoolInstruction<
|
|
|
668
671
|
longMint: getNextAccount(),
|
|
669
672
|
underlyingMint: getNextAccount(),
|
|
670
673
|
marketData: getNextAccount(),
|
|
671
|
-
|
|
674
|
+
switchboardFeed: getNextAccount(),
|
|
672
675
|
buyerPosition: getNextAccount(),
|
|
673
676
|
buyerOptionAccount: getNextAccount(),
|
|
674
677
|
buyerPaymentAccount: getNextAccount(),
|
|
@@ -61,7 +61,7 @@ export type CloseLongToPoolInstruction<
|
|
|
61
61
|
TAccountEscrowLongAccount extends string | AccountMeta<string> = string,
|
|
62
62
|
TAccountPremiumVault extends string | AccountMeta<string> = string,
|
|
63
63
|
TAccountMarketData extends string | AccountMeta<string> = string,
|
|
64
|
-
|
|
64
|
+
TAccountSwitchboardFeed extends string | AccountMeta<string> = string,
|
|
65
65
|
TAccountBuyerPosition extends string | AccountMeta<string> = string,
|
|
66
66
|
TAccountBuyerLongAccount extends string | AccountMeta<string> = string,
|
|
67
67
|
TAccountBuyerPayoutAccount extends string | AccountMeta<string> = string,
|
|
@@ -101,9 +101,9 @@ export type CloseLongToPoolInstruction<
|
|
|
101
101
|
TAccountMarketData extends string
|
|
102
102
|
? ReadonlyAccount<TAccountMarketData>
|
|
103
103
|
: TAccountMarketData,
|
|
104
|
-
|
|
105
|
-
? ReadonlyAccount<
|
|
106
|
-
:
|
|
104
|
+
TAccountSwitchboardFeed extends string
|
|
105
|
+
? ReadonlyAccount<TAccountSwitchboardFeed>
|
|
106
|
+
: TAccountSwitchboardFeed,
|
|
107
107
|
TAccountBuyerPosition extends string
|
|
108
108
|
? WritableAccount<TAccountBuyerPosition>
|
|
109
109
|
: TAccountBuyerPosition,
|
|
@@ -182,7 +182,7 @@ export type CloseLongToPoolAsyncInput<
|
|
|
182
182
|
TAccountEscrowLongAccount extends string = string,
|
|
183
183
|
TAccountPremiumVault extends string = string,
|
|
184
184
|
TAccountMarketData extends string = string,
|
|
185
|
-
|
|
185
|
+
TAccountSwitchboardFeed extends string = string,
|
|
186
186
|
TAccountBuyerPosition extends string = string,
|
|
187
187
|
TAccountBuyerLongAccount extends string = string,
|
|
188
188
|
TAccountBuyerPayoutAccount extends string = string,
|
|
@@ -206,10 +206,9 @@ export type CloseLongToPoolAsyncInput<
|
|
|
206
206
|
escrowLongAccount: Address<TAccountEscrowLongAccount>;
|
|
207
207
|
/** Premium vault (first source of buyer payout) */
|
|
208
208
|
premiumVault: Address<TAccountPremiumVault>;
|
|
209
|
-
/** Market data account (provides risk-free rate and
|
|
209
|
+
/** Market data account (provides risk-free rate and switchboard_feed_id) */
|
|
210
210
|
marketData: Address<TAccountMarketData>;
|
|
211
|
-
|
|
212
|
-
priceUpdate: Address<TAccountPriceUpdate>;
|
|
211
|
+
switchboardFeed: Address<TAccountSwitchboardFeed>;
|
|
213
212
|
/** Buyer's position account */
|
|
214
213
|
buyerPosition?: Address<TAccountBuyerPosition>;
|
|
215
214
|
/** Buyer's LONG token account (source of tokens to return) */
|
|
@@ -236,7 +235,7 @@ export async function getCloseLongToPoolInstructionAsync<
|
|
|
236
235
|
TAccountEscrowLongAccount extends string,
|
|
237
236
|
TAccountPremiumVault extends string,
|
|
238
237
|
TAccountMarketData extends string,
|
|
239
|
-
|
|
238
|
+
TAccountSwitchboardFeed extends string,
|
|
240
239
|
TAccountBuyerPosition extends string,
|
|
241
240
|
TAccountBuyerLongAccount extends string,
|
|
242
241
|
TAccountBuyerPayoutAccount extends string,
|
|
@@ -256,7 +255,7 @@ export async function getCloseLongToPoolInstructionAsync<
|
|
|
256
255
|
TAccountEscrowLongAccount,
|
|
257
256
|
TAccountPremiumVault,
|
|
258
257
|
TAccountMarketData,
|
|
259
|
-
|
|
258
|
+
TAccountSwitchboardFeed,
|
|
260
259
|
TAccountBuyerPosition,
|
|
261
260
|
TAccountBuyerLongAccount,
|
|
262
261
|
TAccountBuyerPayoutAccount,
|
|
@@ -278,7 +277,7 @@ export async function getCloseLongToPoolInstructionAsync<
|
|
|
278
277
|
TAccountEscrowLongAccount,
|
|
279
278
|
TAccountPremiumVault,
|
|
280
279
|
TAccountMarketData,
|
|
281
|
-
|
|
280
|
+
TAccountSwitchboardFeed,
|
|
282
281
|
TAccountBuyerPosition,
|
|
283
282
|
TAccountBuyerLongAccount,
|
|
284
283
|
TAccountBuyerPayoutAccount,
|
|
@@ -306,7 +305,10 @@ export async function getCloseLongToPoolInstructionAsync<
|
|
|
306
305
|
},
|
|
307
306
|
premiumVault: { value: input.premiumVault ?? null, isWritable: true },
|
|
308
307
|
marketData: { value: input.marketData ?? null, isWritable: false },
|
|
309
|
-
|
|
308
|
+
switchboardFeed: {
|
|
309
|
+
value: input.switchboardFeed ?? null,
|
|
310
|
+
isWritable: false,
|
|
311
|
+
},
|
|
310
312
|
buyerPosition: { value: input.buyerPosition ?? null, isWritable: true },
|
|
311
313
|
buyerLongAccount: {
|
|
312
314
|
value: input.buyerLongAccount ?? null,
|
|
@@ -377,7 +379,7 @@ export async function getCloseLongToPoolInstructionAsync<
|
|
|
377
379
|
getAccountMeta(accounts.escrowLongAccount),
|
|
378
380
|
getAccountMeta(accounts.premiumVault),
|
|
379
381
|
getAccountMeta(accounts.marketData),
|
|
380
|
-
getAccountMeta(accounts.
|
|
382
|
+
getAccountMeta(accounts.switchboardFeed),
|
|
381
383
|
getAccountMeta(accounts.buyerPosition),
|
|
382
384
|
getAccountMeta(accounts.buyerLongAccount),
|
|
383
385
|
getAccountMeta(accounts.buyerPayoutAccount),
|
|
@@ -401,7 +403,7 @@ export async function getCloseLongToPoolInstructionAsync<
|
|
|
401
403
|
TAccountEscrowLongAccount,
|
|
402
404
|
TAccountPremiumVault,
|
|
403
405
|
TAccountMarketData,
|
|
404
|
-
|
|
406
|
+
TAccountSwitchboardFeed,
|
|
405
407
|
TAccountBuyerPosition,
|
|
406
408
|
TAccountBuyerLongAccount,
|
|
407
409
|
TAccountBuyerPayoutAccount,
|
|
@@ -422,7 +424,7 @@ export type CloseLongToPoolInput<
|
|
|
422
424
|
TAccountEscrowLongAccount extends string = string,
|
|
423
425
|
TAccountPremiumVault extends string = string,
|
|
424
426
|
TAccountMarketData extends string = string,
|
|
425
|
-
|
|
427
|
+
TAccountSwitchboardFeed extends string = string,
|
|
426
428
|
TAccountBuyerPosition extends string = string,
|
|
427
429
|
TAccountBuyerLongAccount extends string = string,
|
|
428
430
|
TAccountBuyerPayoutAccount extends string = string,
|
|
@@ -446,10 +448,9 @@ export type CloseLongToPoolInput<
|
|
|
446
448
|
escrowLongAccount: Address<TAccountEscrowLongAccount>;
|
|
447
449
|
/** Premium vault (first source of buyer payout) */
|
|
448
450
|
premiumVault: Address<TAccountPremiumVault>;
|
|
449
|
-
/** Market data account (provides risk-free rate and
|
|
451
|
+
/** Market data account (provides risk-free rate and switchboard_feed_id) */
|
|
450
452
|
marketData: Address<TAccountMarketData>;
|
|
451
|
-
|
|
452
|
-
priceUpdate: Address<TAccountPriceUpdate>;
|
|
453
|
+
switchboardFeed: Address<TAccountSwitchboardFeed>;
|
|
453
454
|
/** Buyer's position account */
|
|
454
455
|
buyerPosition: Address<TAccountBuyerPosition>;
|
|
455
456
|
/** Buyer's LONG token account (source of tokens to return) */
|
|
@@ -476,7 +477,7 @@ export function getCloseLongToPoolInstruction<
|
|
|
476
477
|
TAccountEscrowLongAccount extends string,
|
|
477
478
|
TAccountPremiumVault extends string,
|
|
478
479
|
TAccountMarketData extends string,
|
|
479
|
-
|
|
480
|
+
TAccountSwitchboardFeed extends string,
|
|
480
481
|
TAccountBuyerPosition extends string,
|
|
481
482
|
TAccountBuyerLongAccount extends string,
|
|
482
483
|
TAccountBuyerPayoutAccount extends string,
|
|
@@ -496,7 +497,7 @@ export function getCloseLongToPoolInstruction<
|
|
|
496
497
|
TAccountEscrowLongAccount,
|
|
497
498
|
TAccountPremiumVault,
|
|
498
499
|
TAccountMarketData,
|
|
499
|
-
|
|
500
|
+
TAccountSwitchboardFeed,
|
|
500
501
|
TAccountBuyerPosition,
|
|
501
502
|
TAccountBuyerLongAccount,
|
|
502
503
|
TAccountBuyerPayoutAccount,
|
|
@@ -517,7 +518,7 @@ export function getCloseLongToPoolInstruction<
|
|
|
517
518
|
TAccountEscrowLongAccount,
|
|
518
519
|
TAccountPremiumVault,
|
|
519
520
|
TAccountMarketData,
|
|
520
|
-
|
|
521
|
+
TAccountSwitchboardFeed,
|
|
521
522
|
TAccountBuyerPosition,
|
|
522
523
|
TAccountBuyerLongAccount,
|
|
523
524
|
TAccountBuyerPayoutAccount,
|
|
@@ -544,7 +545,10 @@ export function getCloseLongToPoolInstruction<
|
|
|
544
545
|
},
|
|
545
546
|
premiumVault: { value: input.premiumVault ?? null, isWritable: true },
|
|
546
547
|
marketData: { value: input.marketData ?? null, isWritable: false },
|
|
547
|
-
|
|
548
|
+
switchboardFeed: {
|
|
549
|
+
value: input.switchboardFeed ?? null,
|
|
550
|
+
isWritable: false,
|
|
551
|
+
},
|
|
548
552
|
buyerPosition: { value: input.buyerPosition ?? null, isWritable: true },
|
|
549
553
|
buyerLongAccount: {
|
|
550
554
|
value: input.buyerLongAccount ?? null,
|
|
@@ -589,7 +593,7 @@ export function getCloseLongToPoolInstruction<
|
|
|
589
593
|
getAccountMeta(accounts.escrowLongAccount),
|
|
590
594
|
getAccountMeta(accounts.premiumVault),
|
|
591
595
|
getAccountMeta(accounts.marketData),
|
|
592
|
-
getAccountMeta(accounts.
|
|
596
|
+
getAccountMeta(accounts.switchboardFeed),
|
|
593
597
|
getAccountMeta(accounts.buyerPosition),
|
|
594
598
|
getAccountMeta(accounts.buyerLongAccount),
|
|
595
599
|
getAccountMeta(accounts.buyerPayoutAccount),
|
|
@@ -613,7 +617,7 @@ export function getCloseLongToPoolInstruction<
|
|
|
613
617
|
TAccountEscrowLongAccount,
|
|
614
618
|
TAccountPremiumVault,
|
|
615
619
|
TAccountMarketData,
|
|
616
|
-
|
|
620
|
+
TAccountSwitchboardFeed,
|
|
617
621
|
TAccountBuyerPosition,
|
|
618
622
|
TAccountBuyerLongAccount,
|
|
619
623
|
TAccountBuyerPayoutAccount,
|
|
@@ -645,10 +649,9 @@ export type ParsedCloseLongToPoolInstruction<
|
|
|
645
649
|
escrowLongAccount: TAccountMetas[5];
|
|
646
650
|
/** Premium vault (first source of buyer payout) */
|
|
647
651
|
premiumVault: TAccountMetas[6];
|
|
648
|
-
/** Market data account (provides risk-free rate and
|
|
652
|
+
/** Market data account (provides risk-free rate and switchboard_feed_id) */
|
|
649
653
|
marketData: TAccountMetas[7];
|
|
650
|
-
|
|
651
|
-
priceUpdate: TAccountMetas[8];
|
|
654
|
+
switchboardFeed: TAccountMetas[8];
|
|
652
655
|
/** Buyer's position account */
|
|
653
656
|
buyerPosition: TAccountMetas[9];
|
|
654
657
|
/** Buyer's LONG token account (source of tokens to return) */
|
|
@@ -701,7 +704,7 @@ export function parseCloseLongToPoolInstruction<
|
|
|
701
704
|
escrowLongAccount: getNextAccount(),
|
|
702
705
|
premiumVault: getNextAccount(),
|
|
703
706
|
marketData: getNextAccount(),
|
|
704
|
-
|
|
707
|
+
switchboardFeed: getNextAccount(),
|
|
705
708
|
buyerPosition: getNextAccount(),
|
|
706
709
|
buyerLongAccount: getNextAccount(),
|
|
707
710
|
buyerPayoutAccount: getNextAccount(),
|
|
@@ -84,13 +84,13 @@ export type InitializeMarketDataInstructionData = {
|
|
|
84
84
|
discriminator: ReadonlyUint8Array;
|
|
85
85
|
riskFreeRate: number;
|
|
86
86
|
historicalVolatility: number;
|
|
87
|
-
|
|
87
|
+
switchboardFeedId: ReadonlyUint8Array;
|
|
88
88
|
};
|
|
89
89
|
|
|
90
90
|
export type InitializeMarketDataInstructionDataArgs = {
|
|
91
91
|
riskFreeRate: number;
|
|
92
92
|
historicalVolatility: number;
|
|
93
|
-
|
|
93
|
+
switchboardFeedId: ReadonlyUint8Array;
|
|
94
94
|
};
|
|
95
95
|
|
|
96
96
|
export function getInitializeMarketDataInstructionDataEncoder(): FixedSizeEncoder<InitializeMarketDataInstructionDataArgs> {
|
|
@@ -99,7 +99,7 @@ export function getInitializeMarketDataInstructionDataEncoder(): FixedSizeEncode
|
|
|
99
99
|
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
100
100
|
["riskFreeRate", getF64Encoder()],
|
|
101
101
|
["historicalVolatility", getF64Encoder()],
|
|
102
|
-
["
|
|
102
|
+
["switchboardFeedId", fixEncoderSize(getBytesEncoder(), 32)],
|
|
103
103
|
]),
|
|
104
104
|
(value) => ({
|
|
105
105
|
...value,
|
|
@@ -113,7 +113,7 @@ export function getInitializeMarketDataInstructionDataDecoder(): FixedSizeDecode
|
|
|
113
113
|
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
114
114
|
["riskFreeRate", getF64Decoder()],
|
|
115
115
|
["historicalVolatility", getF64Decoder()],
|
|
116
|
-
["
|
|
116
|
+
["switchboardFeedId", fixDecoderSize(getBytesDecoder(), 32)],
|
|
117
117
|
]);
|
|
118
118
|
}
|
|
119
119
|
|
|
@@ -139,7 +139,7 @@ export type InitializeMarketDataAsyncInput<
|
|
|
139
139
|
systemProgram?: Address<TAccountSystemProgram>;
|
|
140
140
|
riskFreeRate: InitializeMarketDataInstructionDataArgs["riskFreeRate"];
|
|
141
141
|
historicalVolatility: InitializeMarketDataInstructionDataArgs["historicalVolatility"];
|
|
142
|
-
|
|
142
|
+
switchboardFeedId: InitializeMarketDataInstructionDataArgs["switchboardFeedId"];
|
|
143
143
|
};
|
|
144
144
|
|
|
145
145
|
export async function getInitializeMarketDataInstructionAsync<
|
|
@@ -239,7 +239,7 @@ export type InitializeMarketDataInput<
|
|
|
239
239
|
systemProgram?: Address<TAccountSystemProgram>;
|
|
240
240
|
riskFreeRate: InitializeMarketDataInstructionDataArgs["riskFreeRate"];
|
|
241
241
|
historicalVolatility: InitializeMarketDataInstructionDataArgs["historicalVolatility"];
|
|
242
|
-
|
|
242
|
+
switchboardFeedId: InitializeMarketDataInstructionDataArgs["switchboardFeedId"];
|
|
243
243
|
};
|
|
244
244
|
|
|
245
245
|
export function getInitializeMarketDataInstruction<
|