@epicentral/sos-sdk 0.15.2-beta → 0.16.0-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
@@ -61,6 +61,10 @@ Additional modules:
61
61
  | Function | Description |
62
62
  |----------|-------------|
63
63
  | `buildOptionMintTransactionWithDerivation` | Builds option mint (write) transaction. By default appends CloseAccount for the maker's LONG token account after mint (reclaim rent). Supports multi-collateral: use `collateralMint` to back positions with any supported asset (USDC, BTC, SOL, etc.). |
64
+ | `deriveOptionSeriesLegAddresses` | Multi-strike: derives every per-leg PDA/ATA (option account, mints, pools, vaults, maker SHORT ATA, writer position, canonical pool loan) for one strike. |
65
+ | `findLegsNeedingSeriesInit` | Multi-strike: returns the legs whose option account or writer position is missing on-chain (i.e. need `init_option_series`). |
66
+ | `buildInitOptionSeriesInstruction` | Multi-strike: one `init_option_series` instruction — creates the series (option account, mints, pools, ATAs, writer position) **without Metaplex metadata** and without an oracle quote. Idempotent; chunk `MAX_SERIES_INITS_PER_TRANSACTION` (2) per tx. |
67
+ | `buildOptionMintMultiTransactionWithDerivation` | Multi-strike: chunks legs into `option_mint_multi` transactions of ≤ `MAX_MINT_LEGS` (3, on-chain max 4), one Switchboard quote per chunk (`switchboardQuoteInstructionIndex`, OPX passes 2), per-leg account bundles in remaining accounts, and returns `lookupAddresses` for ALT extension before sending. Every leg's series must already exist (`SeriesNotInitialized` otherwise). Unlevered legs only is the typical use; leveraged legs require the canonical pool loan to exist per strike. |
64
68
  | `buildUnwindWriterUnsoldTransactionWithDerivation` | Builds unwind unsold transaction. |
65
69
  | `buildUnwindWriterUnsoldWithLoanRepayment` | **Unwind + repay pool loans in one tx.** Use when closing unsold shorts that borrowed from OMLP. |
66
70
  | `buildSyncWriterPositionTransaction` | Syncs writer position with pool accumulators. |
@@ -242,6 +242,12 @@ export const OPTION_PROGRAM_ERROR__INVALID_LOAN_REPAYMENT = 0x17df; // 6111
242
242
  export const OPTION_PROGRAM_ERROR__RESCUE_PRECONDITIONS_NOT_MET = 0x17e0; // 6112
243
243
  /** StaleCanonicalLoanRequiresCleanup: Canonical pool loan carries untracked residual principal from an abandoned borrow setup; repay/clean up the open loan before minting */
244
244
  export const OPTION_PROGRAM_ERROR__STALE_CANONICAL_LOAN_REQUIRES_CLEANUP = 0x17e1; // 6113
245
+ /** SeriesNotInitialized: Option series not initialized for this leg; call init_option_series first */
246
+ export const OPTION_PROGRAM_ERROR__SERIES_NOT_INITIALIZED = 0x17e2; // 6114
247
+ /** TooManyMintLegs: option_mint_multi received more legs than MAX_MINT_LEGS allows */
248
+ export const OPTION_PROGRAM_ERROR__TOO_MANY_MINT_LEGS = 0x17e3; // 6115
249
+ /** MintLegAccountsMismatch: option_mint_multi remaining_accounts do not match the expected per-leg layout */
250
+ export const OPTION_PROGRAM_ERROR__MINT_LEG_ACCOUNTS_MISMATCH = 0x17e4; // 6116
245
251
 
246
252
  export type OptionProgramError =
247
253
  | typeof OPTION_PROGRAM_ERROR__ACCOUNT_FROZEN
@@ -316,6 +322,7 @@ export type OptionProgramError =
316
322
  | typeof OPTION_PROGRAM_ERROR__MAXIMUM_POSITION_SIZE_EXCEEDED
317
323
  | typeof OPTION_PROGRAM_ERROR__MAX_POSITIONS_REACHED
318
324
  | typeof OPTION_PROGRAM_ERROR__MINIMUM_POSITION_SIZE_NOT_MET
325
+ | typeof OPTION_PROGRAM_ERROR__MINT_LEG_ACCOUNTS_MISMATCH
319
326
  | typeof OPTION_PROGRAM_ERROR__NO_COLLATERAL_TO_WITHDRAW
320
327
  | typeof OPTION_PROGRAM_ERROR__NO_POSITIONS_PROVIDED
321
328
  | typeof OPTION_PROGRAM_ERROR__NOT_FORECLOSABLE
@@ -341,6 +348,7 @@ export type OptionProgramError =
341
348
  | typeof OPTION_PROGRAM_ERROR__PRICE_IMPACT_TOO_HIGH
342
349
  | typeof OPTION_PROGRAM_ERROR__RESCUE_PRECONDITIONS_NOT_MET
343
350
  | typeof OPTION_PROGRAM_ERROR__RESCUE_UNAUTHORIZED
351
+ | typeof OPTION_PROGRAM_ERROR__SERIES_NOT_INITIALIZED
344
352
  | typeof OPTION_PROGRAM_ERROR__SETTLEMENT_CLAIM_ALREADY_CLAIMED
345
353
  | typeof OPTION_PROGRAM_ERROR__SETTLEMENT_CLAIM_ALREADY_PREPARED
346
354
  | typeof OPTION_PROGRAM_ERROR__SETTLEMENT_CLAIM_NOT_PREPARED
@@ -350,6 +358,7 @@ export type OptionProgramError =
350
358
  | typeof OPTION_PROGRAM_ERROR__STALE_ORACLE_PRICE
351
359
  | typeof OPTION_PROGRAM_ERROR__SUPPLY_LIMIT_EXCEEDED
352
360
  | typeof OPTION_PROGRAM_ERROR__THETA_CLAIM_DISABLED
361
+ | typeof OPTION_PROGRAM_ERROR__TOO_MANY_MINT_LEGS
353
362
  | typeof OPTION_PROGRAM_ERROR__UNAUTHORIZED_ACCESS
354
363
  | typeof OPTION_PROGRAM_ERROR__UNAUTHORIZED_EXERCISE
355
364
  | typeof OPTION_PROGRAM_ERROR__UNAUTHORIZED_OMLP
@@ -434,6 +443,7 @@ if (process.env.NODE_ENV !== "production") {
434
443
  [OPTION_PROGRAM_ERROR__MAXIMUM_POSITION_SIZE_EXCEEDED]: `Maximum position size exceeded`,
435
444
  [OPTION_PROGRAM_ERROR__MAX_POSITIONS_REACHED]: `Maximum positions limit reached`,
436
445
  [OPTION_PROGRAM_ERROR__MINIMUM_POSITION_SIZE_NOT_MET]: `Minimum position size not met`,
446
+ [OPTION_PROGRAM_ERROR__MINT_LEG_ACCOUNTS_MISMATCH]: `option_mint_multi remaining_accounts do not match the expected per-leg layout`,
437
447
  [OPTION_PROGRAM_ERROR__NO_COLLATERAL_TO_WITHDRAW]: `No collateral to withdraw`,
438
448
  [OPTION_PROGRAM_ERROR__NO_POSITIONS_PROVIDED]: `No positions provided in batch`,
439
449
  [OPTION_PROGRAM_ERROR__NOT_FORECLOSABLE]: `Loan is not eligible for foreclosure`,
@@ -459,6 +469,7 @@ if (process.env.NODE_ENV !== "production") {
459
469
  [OPTION_PROGRAM_ERROR__PRICE_IMPACT_TOO_HIGH]: `Price impact too high`,
460
470
  [OPTION_PROGRAM_ERROR__RESCUE_PRECONDITIONS_NOT_MET]: `Rescue preconditions not met: collateral_vault must be short of the remaining debt after theta forfeiture`,
461
471
  [OPTION_PROGRAM_ERROR__RESCUE_UNAUTHORIZED]: `Rescue liquidation is gated to the vault keeper`,
472
+ [OPTION_PROGRAM_ERROR__SERIES_NOT_INITIALIZED]: `Option series not initialized for this leg; call init_option_series first`,
462
473
  [OPTION_PROGRAM_ERROR__SETTLEMENT_CLAIM_ALREADY_CLAIMED]: `Settlement claim has already been claimed`,
463
474
  [OPTION_PROGRAM_ERROR__SETTLEMENT_CLAIM_ALREADY_PREPARED]: `Settlement claim has already been prepared`,
464
475
  [OPTION_PROGRAM_ERROR__SETTLEMENT_CLAIM_NOT_PREPARED]: `Settlement claim has not been prepared`,
@@ -468,6 +479,7 @@ if (process.env.NODE_ENV !== "production") {
468
479
  [OPTION_PROGRAM_ERROR__STALE_ORACLE_PRICE]: `Oracle price is too old`,
469
480
  [OPTION_PROGRAM_ERROR__SUPPLY_LIMIT_EXCEEDED]: `Deposit would exceed vault supply limit`,
470
481
  [OPTION_PROGRAM_ERROR__THETA_CLAIM_DISABLED]: `claim_theta instruction has been removed; theta is now auto-realized on unwind or forfeited on liquidation`,
482
+ [OPTION_PROGRAM_ERROR__TOO_MANY_MINT_LEGS]: `option_mint_multi received more legs than MAX_MINT_LEGS allows`,
471
483
  [OPTION_PROGRAM_ERROR__UNAUTHORIZED_ACCESS]: `Unauthorized access - you don't own this resource`,
472
484
  [OPTION_PROGRAM_ERROR__UNAUTHORIZED_EXERCISE]: `Unauthorized to exercise this option`,
473
485
  [OPTION_PROGRAM_ERROR__UNAUTHORIZED_OMLP]: `Unauthorized to perform this OMLP action`,
@@ -23,6 +23,7 @@ export * from "./initCollateralPool";
23
23
  export * from "./initConfig";
24
24
  export * from "./initializeMarketData";
25
25
  export * from "./initOptionPool";
26
+ export * from "./initOptionSeries";
26
27
  export * from "./liquidateWriterPosition";
27
28
  export * from "./liquidateWriterPositionRescue";
28
29
  export * from "./migrateCollateralPoolV1ToV2";
@@ -38,6 +39,7 @@ export * from "./omlpUpdateProtocolFee";
38
39
  export * from "./omlpUpdateSupplyLimit";
39
40
  export * from "./optionExercise";
40
41
  export * from "./optionMint";
42
+ export * from "./optionMintMulti";
41
43
  export * from "./optionValidate";
42
44
  export * from "./prepareBuyerSettlement";
43
45
  export * from "./prepareMakerSettlement";