@epicentral/sos-sdk 0.5.0-alpha.7 → 0.6.0-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.
- package/README.md +51 -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 +1 -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
package/README.md
CHANGED
|
@@ -50,35 +50,62 @@ Additional modules:
|
|
|
50
50
|
| `buildBuyFromPoolMarketOrderTransactionWithDerivation` | High-level market-order buy builder (refetches pool + remaining accounts, applies premium cap buffer). |
|
|
51
51
|
| `buildBuyFromPoolTransactionWithDerivation` | Builds buy-from-pool transaction; resolves accounts from option identity. |
|
|
52
52
|
| `preflightBuyFromPoolMarketOrder` | Buy preflight helper for liquidity + remaining-account coverage checks. |
|
|
53
|
-
| `buildCloseLongToPoolTransactionWithDerivation` | Builds close-long-to-pool transaction. |
|
|
53
|
+
| `buildCloseLongToPoolTransactionWithDerivation` | Builds close-long-to-pool transaction; by default appends CloseAccount for buyer LONG ATA and unwraps WSOL payout when underlying is SOL. |
|
|
54
54
|
| `getBuyFromPoolRemainingAccounts` | Builds remaining_accounts for buy (writer positions, etc.). |
|
|
55
55
|
|
|
56
56
|
### Short (Writer) Flows
|
|
57
57
|
|
|
58
58
|
| Function | Description |
|
|
59
59
|
|----------|-------------|
|
|
60
|
-
| `buildOptionMintTransactionWithDerivation` | Builds option mint (write) transaction. Supports multi-collateral: use `collateralMint` to back positions with any supported asset (USDC, BTC, SOL, etc.). |
|
|
60
|
+
| `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.). |
|
|
61
61
|
| `buildUnwindWriterUnsoldTransactionWithDerivation` | Builds unwind unsold transaction. |
|
|
62
62
|
| `buildUnwindWriterUnsoldWithLoanRepayment` | **Unwind + repay pool loans in one tx.** Use when closing unsold shorts that borrowed from OMLP. |
|
|
63
63
|
| `buildSyncWriterPositionTransaction` | Syncs writer position with pool accumulators. |
|
|
64
|
-
| `buildSettleMakerCollateralTransaction` | Settles maker collateral after buyer closes. |
|
|
64
|
+
| `buildSettleMakerCollateralTransaction` | Settles maker collateral after buyer closes (repays principal + accrued interest to OMLP from collateral vault first, then returns remainder to maker). |
|
|
65
65
|
| `buildCloseOptionTransaction` | Closes option token account. |
|
|
66
66
|
| `buildClaimThetaTransaction` | Claims theta (time-decay share) for writer. |
|
|
67
67
|
| `buildRepayPoolLoanFromCollateralInstruction` | Repays pool loan from collateral (short/pool). |
|
|
68
68
|
| `buildRepayPoolLoanInstruction` | Repays pool loan with external funds (short/pool). |
|
|
69
69
|
| `buildRepayPoolLoanFromWalletInstruction` | Repays pool loan from maker's wallet (stuck loan recovery). |
|
|
70
70
|
|
|
71
|
+
### Seller Close Signers
|
|
72
|
+
|
|
73
|
+
- `buildUnwindWriterUnsoldWithLoanRepayment` / `buildUnwindWriterUnsoldTransactionWithDerivation`
|
|
74
|
+
- Requires `writer` transaction signer.
|
|
75
|
+
- On-chain transfers for lender repayment and collateral return are authorized by program PDAs (`collateral_pool` / `option_pool`) where applicable.
|
|
76
|
+
- `buildSettleMakerCollateralTransaction`
|
|
77
|
+
- No maker transaction signer is required by this instruction format.
|
|
78
|
+
- On-chain repayment (`collateral_vault` -> `omlp_vault`) and maker return are signed by the `collateral_pool` PDA.
|
|
79
|
+
- Lender repayment is sourced from collateral vault funds, not maker wallet funds.
|
|
80
|
+
|
|
71
81
|
### OMLP (Lending)
|
|
72
82
|
|
|
73
83
|
| Function | Description |
|
|
74
84
|
|----------|-------------|
|
|
75
85
|
| `buildDepositToPositionTransaction` | Deposits liquidity to OMLP. |
|
|
76
|
-
| `buildWithdrawFromPositionTransaction` | Withdraws liquidity
|
|
77
|
-
| `withdrawAllFromPosition` | Withdraws full position (
|
|
78
|
-
| `withdrawInterestFromPosition` | Withdraws
|
|
86
|
+
| `buildWithdrawFromPositionTransaction` | Withdraws liquidity; supports optional same-tx WSOL unwrap via `unwrapSol` + `vaultMint`. |
|
|
87
|
+
| `withdrawAllFromPosition` | Withdraws full position (principal + proportional interest, including pending index accrual, capped by pool liquidity). |
|
|
88
|
+
| `withdrawInterestFromPosition` | Withdraws interest only (realized + pending index accrual, capped by pool liquidity). |
|
|
79
89
|
|
|
80
90
|
Borrow/repay for writers: use `buildOptionMintTransactionWithDerivation` (with vault/poolLoan) and `buildRepayPoolLoanFromCollateralInstruction` or `buildUnwindWriterUnsoldWithLoanRepayment`.
|
|
81
91
|
|
|
92
|
+
### Token account closing (option mint and close long)
|
|
93
|
+
|
|
94
|
+
- **Option mint (seller/writer):** After `option_mint`, all LONG tokens go to the pool escrow; the maker's LONG ATA is left with zero balance. The SDK **automatically appends an SPL CloseAccount instruction** (when `closeMakerLongAccount` is not set to `false`) so the maker reclaims rent. Use `buildOptionMintTransaction` or `buildOptionMintTransactionWithDerivation`; pass `closeMakerLongAccount: false` to skip closing the LONG ATA.
|
|
95
|
+
- **Close long (buyer):** When the buyer closes or exercises early via `close_long_to_pool`, LONG tokens are returned to the pool and payout is sent to the buyer's payout ATA. The SDK can:
|
|
96
|
+
- **Close the buyer's LONG token account** after the close instruction so rent is reclaimed. Use `closeLongTokenAccount: true` (default for `buildCloseLongToPoolTransactionWithDerivation`); set to `false` for **partial** closes (the LONG ATA still holds remaining tokens).
|
|
97
|
+
- **Unwrap WSOL payout** when the option underlying is SOL: append CloseAccount on the payout ATA so the buyer receives native SOL. Use `unwrapPayoutSol: true` (default for WSOL in the derivation builder); set to `false` to keep payout as WSOL.
|
|
98
|
+
|
|
99
|
+
### OMLP withdraw behavior
|
|
100
|
+
|
|
101
|
+
- Interest is allocated proportionally via the vault interest-per-share index.
|
|
102
|
+
- On-chain `withdraw_from_position` syncs pending interest before transferring funds, so a lender withdrawal automatically includes their proportional earned interest when available.
|
|
103
|
+
- `withdrawAllFromPosition` and `withdrawInterestFromPosition` compute pending interest from `accInterestPerShareFp` and `interestIndexSnapshotFp`, then cap by `poolAvailable = totalLiquidity - totalLoans`.
|
|
104
|
+
- Optional WSOL unwrap in the same transaction:
|
|
105
|
+
- Set `unwrapSol: true` and provide `vaultMint`.
|
|
106
|
+
- If `vaultMint === NATIVE_MINT`, SDK appends a `CloseAccount` after withdraw to unwrap WSOL ATA to native SOL.
|
|
107
|
+
- For non-WSOL mints, the same builder remains token-agnostic and does not append unwrap instructions.
|
|
108
|
+
|
|
82
109
|
### WSOL / Token Helpers
|
|
83
110
|
|
|
84
111
|
| Function | Description |
|
|
@@ -256,7 +283,8 @@ const tx = await buildBuyFromPoolMarketOrderTransactionWithDerivation({
|
|
|
256
283
|
expirationDate: BigInt(1735689600),
|
|
257
284
|
buyer: walletAddress,
|
|
258
285
|
buyerPaymentAccount: buyerUsdcAta,
|
|
259
|
-
|
|
286
|
+
// optional: override feed account if you do not want SDK derivation from market data
|
|
287
|
+
switchboardFeed: switchboardFeedAddress,
|
|
260
288
|
quantity: 1_000_000,
|
|
261
289
|
quotedPremiumTotal: 50_000,
|
|
262
290
|
slippageBufferBaseUnits: 500_000n,
|
|
@@ -294,7 +322,7 @@ Check these first:
|
|
|
294
322
|
|
|
295
323
|
- `buyer_position` account shape/size (`146` bytes expected).
|
|
296
324
|
- `market_data` account shape/size (`128` bytes expected).
|
|
297
|
-
- `
|
|
325
|
+
- `switchboardFeed` points to the configured Switchboard pull feed account for the market (or omit it and let derivation builders resolve from `market_data.switchboard_feed_id`).
|
|
298
326
|
- Account list/order matches the generated instruction layout.
|
|
299
327
|
|
|
300
328
|
This is different from liquidity failures (`6042/6043`) and should be debugged as an account wiring/layout issue.
|
|
@@ -302,9 +330,23 @@ This is different from liquidity failures (`6042/6043`) and should be debugged a
|
|
|
302
330
|
### Oracle inputs (asset-agnostic)
|
|
303
331
|
|
|
304
332
|
- Keep oracle handling universal across assets.
|
|
305
|
-
-
|
|
333
|
+
- Use the market-configured `switchboard_feed_id` as source-of-truth and pass `switchboardFeed` when using low-level builders.
|
|
306
334
|
- Avoid hardcoding a single feed/account address in shared SDK integration flows.
|
|
307
335
|
|
|
336
|
+
### Price update freshness (required for accurate payouts)
|
|
337
|
+
|
|
338
|
+
The program uses the **Switchboard pull feed account** you pass in (or that the SDK derives) to read the current underlying price for:
|
|
339
|
+
|
|
340
|
+
- **Buy:** Premium computation (Black-Scholes).
|
|
341
|
+
- **Close:** Payout computation (mark-to-market). If the price is stale, the close payout will not reflect the current option value; the buyer may receive back only their premium instead of profit.
|
|
342
|
+
|
|
343
|
+
**You must ensure the Switchboard feed is recently updated** when building buy and close transactions. The SDK does not post oracle updates by default; use the Switchboard helper exports and your update pipeline before trading instructions.
|
|
344
|
+
|
|
345
|
+
- **Mainnet:** keep feed updates fresh enough to satisfy the feed's configured `max_staleness`.
|
|
346
|
+
- **Devnet:** ensure your keeper/update pipeline runs before user trade flows; payouts reflect the feed's staleness config.
|
|
347
|
+
|
|
348
|
+
**Fallback policy:** Switchboard-configured markets are strict Switchboard reads. Legacy Pyth helpers remain in the codebase for compatibility, but primary trade paths use Switchboard feed accounts.
|
|
349
|
+
|
|
308
350
|
### Unwind with loan repayment
|
|
309
351
|
|
|
310
352
|
```ts
|
package/client/lookup-table.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { PROGRAM_ID } from "./program";
|
|
|
4
4
|
import type { KitRpc } from "./types";
|
|
5
5
|
|
|
6
6
|
export const LOOKUP_TABLE_ADDRESSES: Record<"devnet" | "mainnet", Address | null> = {
|
|
7
|
-
devnet: address("
|
|
7
|
+
devnet: address("FTLPczoQpTmND126pMiJpnPudsDxfGuCNUQAPk4SUcJd"),
|
|
8
8
|
mainnet: null,
|
|
9
9
|
};
|
|
10
10
|
|
|
@@ -56,7 +56,7 @@ export type MarketDataAccount = {
|
|
|
56
56
|
historicalVolatility: number;
|
|
57
57
|
lastUpdated: bigint;
|
|
58
58
|
authority: Address;
|
|
59
|
-
|
|
59
|
+
switchboardFeedId: ReadonlyUint8Array;
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
export type MarketDataAccountArgs = {
|
|
@@ -65,7 +65,7 @@ export type MarketDataAccountArgs = {
|
|
|
65
65
|
historicalVolatility: number;
|
|
66
66
|
lastUpdated: number | bigint;
|
|
67
67
|
authority: Address;
|
|
68
|
-
|
|
68
|
+
switchboardFeedId: ReadonlyUint8Array;
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
/** Gets the encoder for {@link MarketDataAccountArgs} account data. */
|
|
@@ -78,7 +78,7 @@ export function getMarketDataAccountEncoder(): FixedSizeEncoder<MarketDataAccoun
|
|
|
78
78
|
["historicalVolatility", getF64Encoder()],
|
|
79
79
|
["lastUpdated", getI64Encoder()],
|
|
80
80
|
["authority", getAddressEncoder()],
|
|
81
|
-
["
|
|
81
|
+
["switchboardFeedId", fixEncoderSize(getBytesEncoder(), 32)],
|
|
82
82
|
]),
|
|
83
83
|
(value) => ({ ...value, discriminator: MARKET_DATA_ACCOUNT_DISCRIMINATOR }),
|
|
84
84
|
);
|
|
@@ -93,7 +93,7 @@ export function getMarketDataAccountDecoder(): FixedSizeDecoder<MarketDataAccoun
|
|
|
93
93
|
["historicalVolatility", getF64Decoder()],
|
|
94
94
|
["lastUpdated", getI64Decoder()],
|
|
95
95
|
["authority", getAddressDecoder()],
|
|
96
|
-
["
|
|
96
|
+
["switchboardFeedId", fixDecoderSize(getBytesDecoder(), 32)],
|
|
97
97
|
]);
|
|
98
98
|
}
|
|
99
99
|
|
|
@@ -52,156 +52,160 @@ export const OPTION_PROGRAM_ERROR__STALE_ORACLE_PRICE = 0x1780; // 6016
|
|
|
52
52
|
export const OPTION_PROGRAM_ERROR__LOW_ORACLE_PRICE_CONFIDENCE = 0x1781; // 6017
|
|
53
53
|
/** InvalidOracleAccount: Invalid oracle account - cannot parse price feed */
|
|
54
54
|
export const OPTION_PROGRAM_ERROR__INVALID_ORACLE_ACCOUNT = 0x1782; // 6018
|
|
55
|
+
/** InvalidSwitchboardQuoteAccount: Invalid Switchboard quote account */
|
|
56
|
+
export const OPTION_PROGRAM_ERROR__INVALID_SWITCHBOARD_QUOTE_ACCOUNT = 0x1783; // 6019
|
|
57
|
+
/** InvalidSwitchboardUpdateProof: Switchboard quote update proof missing or invalid */
|
|
58
|
+
export const OPTION_PROGRAM_ERROR__INVALID_SWITCHBOARD_UPDATE_PROOF = 0x1784; // 6020
|
|
55
59
|
/** OraclePriceUnavailable: Oracle price is unavailable */
|
|
56
|
-
export const OPTION_PROGRAM_ERROR__ORACLE_PRICE_UNAVAILABLE =
|
|
60
|
+
export const OPTION_PROGRAM_ERROR__ORACLE_PRICE_UNAVAILABLE = 0x1785; // 6021
|
|
57
61
|
/** InvalidOraclePrice: Invalid oracle price - must be positive */
|
|
58
|
-
export const OPTION_PROGRAM_ERROR__INVALID_ORACLE_PRICE =
|
|
62
|
+
export const OPTION_PROGRAM_ERROR__INVALID_ORACLE_PRICE = 0x1786; // 6022
|
|
59
63
|
/** InsufficientBalance: Insufficient balance for premium payment */
|
|
60
|
-
export const OPTION_PROGRAM_ERROR__INSUFFICIENT_BALANCE =
|
|
64
|
+
export const OPTION_PROGRAM_ERROR__INSUFFICIENT_BALANCE = 0x1787; // 6023
|
|
61
65
|
/** PositionNotFound: Position not found */
|
|
62
|
-
export const OPTION_PROGRAM_ERROR__POSITION_NOT_FOUND =
|
|
66
|
+
export const OPTION_PROGRAM_ERROR__POSITION_NOT_FOUND = 0x1788; // 6024
|
|
63
67
|
/** OptionAccountMismatch: Option account mismatch */
|
|
64
|
-
export const OPTION_PROGRAM_ERROR__OPTION_ACCOUNT_MISMATCH =
|
|
68
|
+
export const OPTION_PROGRAM_ERROR__OPTION_ACCOUNT_MISMATCH = 0x1789; // 6025
|
|
65
69
|
/** ArithmeticOverflow: Arithmetic overflow occurred */
|
|
66
|
-
export const OPTION_PROGRAM_ERROR__ARITHMETIC_OVERFLOW =
|
|
70
|
+
export const OPTION_PROGRAM_ERROR__ARITHMETIC_OVERFLOW = 0x178a; // 6026
|
|
67
71
|
/** ArithmeticUnderflow: Arithmetic underflow occurred */
|
|
68
|
-
export const OPTION_PROGRAM_ERROR__ARITHMETIC_UNDERFLOW =
|
|
72
|
+
export const OPTION_PROGRAM_ERROR__ARITHMETIC_UNDERFLOW = 0x178b; // 6027
|
|
69
73
|
/** DivisionByZero: Division by zero */
|
|
70
|
-
export const OPTION_PROGRAM_ERROR__DIVISION_BY_ZERO =
|
|
74
|
+
export const OPTION_PROGRAM_ERROR__DIVISION_BY_ZERO = 0x178c; // 6028
|
|
71
75
|
/** PremiumCalculationFailed: Premium calculation failed */
|
|
72
|
-
export const OPTION_PROGRAM_ERROR__PREMIUM_CALCULATION_FAILED =
|
|
76
|
+
export const OPTION_PROGRAM_ERROR__PREMIUM_CALCULATION_FAILED = 0x178d; // 6029
|
|
73
77
|
/** GreeksCalculationFailed: Greeks calculation failed */
|
|
74
|
-
export const OPTION_PROGRAM_ERROR__GREEKS_CALCULATION_FAILED =
|
|
78
|
+
export const OPTION_PROGRAM_ERROR__GREEKS_CALCULATION_FAILED = 0x178e; // 6030
|
|
75
79
|
/** InvalidEscrowAuthority: Invalid escrow authority */
|
|
76
|
-
export const OPTION_PROGRAM_ERROR__INVALID_ESCROW_AUTHORITY =
|
|
80
|
+
export const OPTION_PROGRAM_ERROR__INVALID_ESCROW_AUTHORITY = 0x178f; // 6031
|
|
77
81
|
/** EscrowAccountFrozen: Escrow account is frozen */
|
|
78
|
-
export const OPTION_PROGRAM_ERROR__ESCROW_ACCOUNT_FROZEN =
|
|
82
|
+
export const OPTION_PROGRAM_ERROR__ESCROW_ACCOUNT_FROZEN = 0x1790; // 6032
|
|
79
83
|
/** MarketClosed: Market is closed */
|
|
80
|
-
export const OPTION_PROGRAM_ERROR__MARKET_CLOSED =
|
|
84
|
+
export const OPTION_PROGRAM_ERROR__MARKET_CLOSED = 0x1791; // 6033
|
|
81
85
|
/** MaxPositionsReached: Maximum positions limit reached */
|
|
82
|
-
export const OPTION_PROGRAM_ERROR__MAX_POSITIONS_REACHED =
|
|
86
|
+
export const OPTION_PROGRAM_ERROR__MAX_POSITIONS_REACHED = 0x1792; // 6034
|
|
83
87
|
/** MinimumPositionSizeNotMet: Minimum position size not met */
|
|
84
|
-
export const OPTION_PROGRAM_ERROR__MINIMUM_POSITION_SIZE_NOT_MET =
|
|
88
|
+
export const OPTION_PROGRAM_ERROR__MINIMUM_POSITION_SIZE_NOT_MET = 0x1793; // 6035
|
|
85
89
|
/** MaximumPositionSizeExceeded: Maximum position size exceeded */
|
|
86
|
-
export const OPTION_PROGRAM_ERROR__MAXIMUM_POSITION_SIZE_EXCEEDED =
|
|
90
|
+
export const OPTION_PROGRAM_ERROR__MAXIMUM_POSITION_SIZE_EXCEEDED = 0x1794; // 6036
|
|
87
91
|
/** InvalidMakerAuthority: Invalid maker authority */
|
|
88
|
-
export const OPTION_PROGRAM_ERROR__INVALID_MAKER_AUTHORITY =
|
|
92
|
+
export const OPTION_PROGRAM_ERROR__INVALID_MAKER_AUTHORITY = 0x1795; // 6037
|
|
89
93
|
/** InvalidBuyerAuthority: Invalid buyer authority */
|
|
90
|
-
export const OPTION_PROGRAM_ERROR__INVALID_BUYER_AUTHORITY =
|
|
94
|
+
export const OPTION_PROGRAM_ERROR__INVALID_BUYER_AUTHORITY = 0x1796; // 6038
|
|
91
95
|
/** OptionChainFull: Option chain is full */
|
|
92
|
-
export const OPTION_PROGRAM_ERROR__OPTION_CHAIN_FULL =
|
|
96
|
+
export const OPTION_PROGRAM_ERROR__OPTION_CHAIN_FULL = 0x1797; // 6039
|
|
93
97
|
/** DuplicateOption: Duplicate option exists */
|
|
94
|
-
export const OPTION_PROGRAM_ERROR__DUPLICATE_OPTION =
|
|
98
|
+
export const OPTION_PROGRAM_ERROR__DUPLICATE_OPTION = 0x1798; // 6040
|
|
95
99
|
/** PriceImpactTooHigh: Price impact too high */
|
|
96
|
-
export const OPTION_PROGRAM_ERROR__PRICE_IMPACT_TOO_HIGH =
|
|
100
|
+
export const OPTION_PROGRAM_ERROR__PRICE_IMPACT_TOO_HIGH = 0x1799; // 6041
|
|
97
101
|
/** SlippageToleranceExceeded: Slippage tolerance exceeded */
|
|
98
|
-
export const OPTION_PROGRAM_ERROR__SLIPPAGE_TOLERANCE_EXCEEDED =
|
|
102
|
+
export const OPTION_PROGRAM_ERROR__SLIPPAGE_TOLERANCE_EXCEEDED = 0x179a; // 6042
|
|
99
103
|
/** InsufficientPoolLiquidity: Insufficient pool liquidity available */
|
|
100
|
-
export const OPTION_PROGRAM_ERROR__INSUFFICIENT_POOL_LIQUIDITY =
|
|
104
|
+
export const OPTION_PROGRAM_ERROR__INSUFFICIENT_POOL_LIQUIDITY = 0x179b; // 6043
|
|
101
105
|
/** InsufficientPoolAggregateLiquidity: Insufficient aggregate pool liquidity for requested quantity */
|
|
102
|
-
export const OPTION_PROGRAM_ERROR__INSUFFICIENT_POOL_AGGREGATE_LIQUIDITY =
|
|
106
|
+
export const OPTION_PROGRAM_ERROR__INSUFFICIENT_POOL_AGGREGATE_LIQUIDITY = 0x179c; // 6044
|
|
103
107
|
/** InsufficientWriterPositionLiquidity: Insufficient active writer liquidity to fill requested quantity */
|
|
104
|
-
export const OPTION_PROGRAM_ERROR__INSUFFICIENT_WRITER_POSITION_LIQUIDITY =
|
|
108
|
+
export const OPTION_PROGRAM_ERROR__INSUFFICIENT_WRITER_POSITION_LIQUIDITY = 0x179d; // 6045
|
|
105
109
|
/** InsufficientUserBalance: Insufficient user balance for withdrawal */
|
|
106
|
-
export const OPTION_PROGRAM_ERROR__INSUFFICIENT_USER_BALANCE =
|
|
110
|
+
export const OPTION_PROGRAM_ERROR__INSUFFICIENT_USER_BALANCE = 0x179e; // 6046
|
|
107
111
|
/** UnhealthyPosition: Health ratio below liquidation threshold */
|
|
108
|
-
export const OPTION_PROGRAM_ERROR__UNHEALTHY_POSITION =
|
|
112
|
+
export const OPTION_PROGRAM_ERROR__UNHEALTHY_POSITION = 0x179f; // 6047
|
|
109
113
|
/** UnauthorizedOmlp: Unauthorized to perform this OMLP action */
|
|
110
|
-
export const OPTION_PROGRAM_ERROR__UNAUTHORIZED_OMLP =
|
|
114
|
+
export const OPTION_PROGRAM_ERROR__UNAUTHORIZED_OMLP = 0x17a0; // 6048
|
|
111
115
|
/** InvalidTenor: Invalid loan tenor */
|
|
112
|
-
export const OPTION_PROGRAM_ERROR__INVALID_TENOR =
|
|
116
|
+
export const OPTION_PROGRAM_ERROR__INVALID_TENOR = 0x17a1; // 6049
|
|
113
117
|
/** InvalidRate: Invalid interest rate */
|
|
114
|
-
export const OPTION_PROGRAM_ERROR__INVALID_RATE =
|
|
118
|
+
export const OPTION_PROGRAM_ERROR__INVALID_RATE = 0x17a2; // 6050
|
|
115
119
|
/** NotForeclosable: Loan is not eligible for foreclosure */
|
|
116
|
-
export const OPTION_PROGRAM_ERROR__NOT_FORECLOSABLE =
|
|
120
|
+
export const OPTION_PROGRAM_ERROR__NOT_FORECLOSABLE = 0x17a3; // 6051
|
|
117
121
|
/** InsufficientVaultLiquidity: Vault has insufficient liquidity */
|
|
118
|
-
export const OPTION_PROGRAM_ERROR__INSUFFICIENT_VAULT_LIQUIDITY =
|
|
122
|
+
export const OPTION_PROGRAM_ERROR__INSUFFICIENT_VAULT_LIQUIDITY = 0x17a4; // 6052
|
|
119
123
|
/** InsufficientLoanCollateral: Collateral insufficient for loan */
|
|
120
|
-
export const OPTION_PROGRAM_ERROR__INSUFFICIENT_LOAN_COLLATERAL =
|
|
124
|
+
export const OPTION_PROGRAM_ERROR__INSUFFICIENT_LOAN_COLLATERAL = 0x17a5; // 6053
|
|
121
125
|
/** OracleTooStale: Oracle price is stale - cannot validate */
|
|
122
|
-
export const OPTION_PROGRAM_ERROR__ORACLE_TOO_STALE =
|
|
126
|
+
export const OPTION_PROGRAM_ERROR__ORACLE_TOO_STALE = 0x17a6; // 6054
|
|
123
127
|
/** ValidationRequired: Must call option_validate before borrow/settlement */
|
|
124
|
-
export const OPTION_PROGRAM_ERROR__VALIDATION_REQUIRED =
|
|
128
|
+
export const OPTION_PROGRAM_ERROR__VALIDATION_REQUIRED = 0x17a7; // 6055
|
|
125
129
|
/** HealthCalculationFailed: Health ratio calculation failed */
|
|
126
|
-
export const OPTION_PROGRAM_ERROR__HEALTH_CALCULATION_FAILED =
|
|
130
|
+
export const OPTION_PROGRAM_ERROR__HEALTH_CALCULATION_FAILED = 0x17a8; // 6056
|
|
127
131
|
/** ContractAlreadySettled: Contract already settled */
|
|
128
|
-
export const OPTION_PROGRAM_ERROR__CONTRACT_ALREADY_SETTLED =
|
|
132
|
+
export const OPTION_PROGRAM_ERROR__CONTRACT_ALREADY_SETTLED = 0x17a9; // 6057
|
|
129
133
|
/** NoYieldAvailable: No yield available to claim */
|
|
130
|
-
export const OPTION_PROGRAM_ERROR__NO_YIELD_AVAILABLE =
|
|
134
|
+
export const OPTION_PROGRAM_ERROR__NO_YIELD_AVAILABLE = 0x17aa; // 6058
|
|
131
135
|
/** UnauthorizedAccess: Unauthorized access - you don't own this resource */
|
|
132
|
-
export const OPTION_PROGRAM_ERROR__UNAUTHORIZED_ACCESS =
|
|
136
|
+
export const OPTION_PROGRAM_ERROR__UNAUTHORIZED_ACCESS = 0x17ab; // 6059
|
|
133
137
|
/** InsufficientQuantity: Insufficient quantity available in ask position */
|
|
134
|
-
export const OPTION_PROGRAM_ERROR__INSUFFICIENT_QUANTITY =
|
|
138
|
+
export const OPTION_PROGRAM_ERROR__INSUFFICIENT_QUANTITY = 0x17ac; // 6060
|
|
135
139
|
/** NothingToClaim: Nothing to claim - no unclaimed premium */
|
|
136
|
-
export const OPTION_PROGRAM_ERROR__NOTHING_TO_CLAIM =
|
|
140
|
+
export const OPTION_PROGRAM_ERROR__NOTHING_TO_CLAIM = 0x17ad; // 6061
|
|
137
141
|
/** PoolNotActive: Pool is not active */
|
|
138
|
-
export const OPTION_PROGRAM_ERROR__POOL_NOT_ACTIVE =
|
|
142
|
+
export const OPTION_PROGRAM_ERROR__POOL_NOT_ACTIVE = 0x17ae; // 6062
|
|
139
143
|
/** PoolAlreadyExists: Pool already exists for this option */
|
|
140
|
-
export const OPTION_PROGRAM_ERROR__POOL_ALREADY_EXISTS =
|
|
144
|
+
export const OPTION_PROGRAM_ERROR__POOL_ALREADY_EXISTS = 0x17af; // 6063
|
|
141
145
|
/** PoolNotExercised: Pool has not been exercised yet */
|
|
142
|
-
export const OPTION_PROGRAM_ERROR__POOL_NOT_EXERCISED =
|
|
146
|
+
export const OPTION_PROGRAM_ERROR__POOL_NOT_EXERCISED = 0x17b0; // 6064
|
|
143
147
|
/** AlreadySettled: Maker's collateral share has already been settled */
|
|
144
|
-
export const OPTION_PROGRAM_ERROR__ALREADY_SETTLED =
|
|
148
|
+
export const OPTION_PROGRAM_ERROR__ALREADY_SETTLED = 0x17b1; // 6065
|
|
145
149
|
/** InsufficientPoolCollateral: Insufficient collateral in pool for exercise */
|
|
146
|
-
export const OPTION_PROGRAM_ERROR__INSUFFICIENT_POOL_COLLATERAL =
|
|
150
|
+
export const OPTION_PROGRAM_ERROR__INSUFFICIENT_POOL_COLLATERAL = 0x17b2; // 6066
|
|
147
151
|
/** CollateralPoolNotFound: Collateral pool does not exist */
|
|
148
|
-
export const OPTION_PROGRAM_ERROR__COLLATERAL_POOL_NOT_FOUND =
|
|
152
|
+
export const OPTION_PROGRAM_ERROR__COLLATERAL_POOL_NOT_FOUND = 0x17b3; // 6067
|
|
149
153
|
/** NoCollateralToWithdraw: No collateral to withdraw */
|
|
150
|
-
export const OPTION_PROGRAM_ERROR__NO_COLLATERAL_TO_WITHDRAW =
|
|
154
|
+
export const OPTION_PROGRAM_ERROR__NO_COLLATERAL_TO_WITHDRAW = 0x17b4; // 6068
|
|
151
155
|
/** OptionNotExpired: Option has not expired yet - cannot settle */
|
|
152
|
-
export const OPTION_PROGRAM_ERROR__OPTION_NOT_EXPIRED =
|
|
156
|
+
export const OPTION_PROGRAM_ERROR__OPTION_NOT_EXPIRED = 0x17b5; // 6069
|
|
153
157
|
/** SupplyLimitExceeded: Deposit would exceed vault supply limit */
|
|
154
|
-
export const OPTION_PROGRAM_ERROR__SUPPLY_LIMIT_EXCEEDED =
|
|
158
|
+
export const OPTION_PROGRAM_ERROR__SUPPLY_LIMIT_EXCEEDED = 0x17b6; // 6070
|
|
155
159
|
/** InvalidFeeWallet: Invalid fee wallet - must match protocol constant */
|
|
156
|
-
export const OPTION_PROGRAM_ERROR__INVALID_FEE_WALLET =
|
|
160
|
+
export const OPTION_PROGRAM_ERROR__INVALID_FEE_WALLET = 0x17b7; // 6071
|
|
157
161
|
/** InvalidProtocolFee: Invalid protocol fee rate */
|
|
158
|
-
export const OPTION_PROGRAM_ERROR__INVALID_PROTOCOL_FEE =
|
|
162
|
+
export const OPTION_PROGRAM_ERROR__INVALID_PROTOCOL_FEE = 0x17b8; // 6072
|
|
159
163
|
/** UnderlyingAssetMismatch: Underlying asset mismatch - market data or mint does not match option */
|
|
160
|
-
export const OPTION_PROGRAM_ERROR__UNDERLYING_ASSET_MISMATCH =
|
|
164
|
+
export const OPTION_PROGRAM_ERROR__UNDERLYING_ASSET_MISMATCH = 0x17b9; // 6073
|
|
161
165
|
/** InvalidMint: Invalid token mint - does not match expected underlying asset */
|
|
162
|
-
export const OPTION_PROGRAM_ERROR__INVALID_MINT =
|
|
166
|
+
export const OPTION_PROGRAM_ERROR__INVALID_MINT = 0x17ba; // 6074
|
|
163
167
|
/** BatchSizeExceeded: Batch size exceeds maximum allowed (10 positions) */
|
|
164
|
-
export const OPTION_PROGRAM_ERROR__BATCH_SIZE_EXCEEDED =
|
|
168
|
+
export const OPTION_PROGRAM_ERROR__BATCH_SIZE_EXCEEDED = 0x17bb; // 6075
|
|
165
169
|
/** NoPositionsProvided: No positions provided in batch */
|
|
166
|
-
export const OPTION_PROGRAM_ERROR__NO_POSITIONS_PROVIDED =
|
|
170
|
+
export const OPTION_PROGRAM_ERROR__NO_POSITIONS_PROVIDED = 0x17bc; // 6076
|
|
167
171
|
/** PositionOptionMismatch: Position account does not belong to this option */
|
|
168
|
-
export const OPTION_PROGRAM_ERROR__POSITION_OPTION_MISMATCH =
|
|
172
|
+
export const OPTION_PROGRAM_ERROR__POSITION_OPTION_MISMATCH = 0x17bd; // 6077
|
|
169
173
|
/** OptionPoolMismatch: Option account does not match the option pool's option account */
|
|
170
|
-
export const OPTION_PROGRAM_ERROR__OPTION_POOL_MISMATCH =
|
|
174
|
+
export const OPTION_PROGRAM_ERROR__OPTION_POOL_MISMATCH = 0x17be; // 6078
|
|
171
175
|
/** InvalidSeed: Invalid seed - must be exactly 32 bytes */
|
|
172
|
-
export const OPTION_PROGRAM_ERROR__INVALID_SEED =
|
|
176
|
+
export const OPTION_PROGRAM_ERROR__INVALID_SEED = 0x17bf; // 6079
|
|
173
177
|
/** InvalidAuthority: Invalid authority - does not match escrow authority */
|
|
174
|
-
export const OPTION_PROGRAM_ERROR__INVALID_AUTHORITY =
|
|
178
|
+
export const OPTION_PROGRAM_ERROR__INVALID_AUTHORITY = 0x17c0; // 6080
|
|
175
179
|
/** EscrowAccountRequired: Escrow accounts required when borrowed_amount > 0 */
|
|
176
|
-
export const OPTION_PROGRAM_ERROR__ESCROW_ACCOUNT_REQUIRED =
|
|
180
|
+
export const OPTION_PROGRAM_ERROR__ESCROW_ACCOUNT_REQUIRED = 0x17c1; // 6081
|
|
177
181
|
/** InvalidEscrowMaker: Escrow state maker does not match instruction maker */
|
|
178
|
-
export const OPTION_PROGRAM_ERROR__INVALID_ESCROW_MAKER =
|
|
182
|
+
export const OPTION_PROGRAM_ERROR__INVALID_ESCROW_MAKER = 0x17c2; // 6082
|
|
179
183
|
/** EscrowMintMismatch: Escrow collateral mint does not match collateral pool mint */
|
|
180
|
-
export const OPTION_PROGRAM_ERROR__ESCROW_MINT_MISMATCH =
|
|
184
|
+
export const OPTION_PROGRAM_ERROR__ESCROW_MINT_MISMATCH = 0x17c3; // 6083
|
|
181
185
|
/** InsufficientEscrowBalance: Insufficient balance in escrow token account */
|
|
182
|
-
export const OPTION_PROGRAM_ERROR__INSUFFICIENT_ESCROW_BALANCE =
|
|
186
|
+
export const OPTION_PROGRAM_ERROR__INSUFFICIENT_ESCROW_BALANCE = 0x17c4; // 6084
|
|
183
187
|
/** InvalidEscrowOwner: Escrow token account owner mismatch */
|
|
184
|
-
export const OPTION_PROGRAM_ERROR__INVALID_ESCROW_OWNER =
|
|
188
|
+
export const OPTION_PROGRAM_ERROR__INVALID_ESCROW_OWNER = 0x17c5; // 6085
|
|
185
189
|
/** InvalidEscrowMint: Escrow token account mint mismatch */
|
|
186
|
-
export const OPTION_PROGRAM_ERROR__INVALID_ESCROW_MINT =
|
|
190
|
+
export const OPTION_PROGRAM_ERROR__INVALID_ESCROW_MINT = 0x17c6; // 6086
|
|
187
191
|
/** AccountFrozen: Token account is frozen and cannot be burned */
|
|
188
|
-
export const OPTION_PROGRAM_ERROR__ACCOUNT_FROZEN =
|
|
192
|
+
export const OPTION_PROGRAM_ERROR__ACCOUNT_FROZEN = 0x17c7; // 6087
|
|
189
193
|
/** InvalidAccount: Invalid account - does not match expected account */
|
|
190
|
-
export const OPTION_PROGRAM_ERROR__INVALID_ACCOUNT =
|
|
194
|
+
export const OPTION_PROGRAM_ERROR__INVALID_ACCOUNT = 0x17c8; // 6088
|
|
191
195
|
/** UnwindRepayAccountsMissing: Unwind repayment accounts are required when active pool loans exist */
|
|
192
|
-
export const OPTION_PROGRAM_ERROR__UNWIND_REPAY_ACCOUNTS_MISSING =
|
|
196
|
+
export const OPTION_PROGRAM_ERROR__UNWIND_REPAY_ACCOUNTS_MISSING = 0x17c9; // 6089
|
|
193
197
|
/** UnwindRepayWalletSourceMissing: Writer repayment account is required for unwind shortfall fallback */
|
|
194
|
-
export const OPTION_PROGRAM_ERROR__UNWIND_REPAY_WALLET_SOURCE_MISSING =
|
|
198
|
+
export const OPTION_PROGRAM_ERROR__UNWIND_REPAY_WALLET_SOURCE_MISSING = 0x17ca; // 6090
|
|
195
199
|
/** UnwindRepayInsufficientTotalFunds: Insufficient total funds to fully repay unwind loans (principal + interest + protocol fees) */
|
|
196
|
-
export const OPTION_PROGRAM_ERROR__UNWIND_REPAY_INSUFFICIENT_TOTAL_FUNDS =
|
|
200
|
+
export const OPTION_PROGRAM_ERROR__UNWIND_REPAY_INSUFFICIENT_TOTAL_FUNDS = 0x17cb; // 6091
|
|
197
201
|
/** InsufficientCollateralVault: Collateral vault has insufficient funds for unwind collateral return */
|
|
198
|
-
export const OPTION_PROGRAM_ERROR__INSUFFICIENT_COLLATERAL_VAULT =
|
|
202
|
+
export const OPTION_PROGRAM_ERROR__INSUFFICIENT_COLLATERAL_VAULT = 0x17cc; // 6092
|
|
199
203
|
/** InvalidVaultMint: Invalid vault mint - does not match expected collateral mint */
|
|
200
|
-
export const OPTION_PROGRAM_ERROR__INVALID_VAULT_MINT =
|
|
204
|
+
export const OPTION_PROGRAM_ERROR__INVALID_VAULT_MINT = 0x17cd; // 6093
|
|
201
205
|
/** InvalidCollateralMint: Invalid collateral mint - not supported or no vault exists */
|
|
202
|
-
export const OPTION_PROGRAM_ERROR__INVALID_COLLATERAL_MINT =
|
|
206
|
+
export const OPTION_PROGRAM_ERROR__INVALID_COLLATERAL_MINT = 0x17ce; // 6094
|
|
203
207
|
/** CollateralMismatch: Collateral mint mismatch - position uses different collateral type */
|
|
204
|
-
export const OPTION_PROGRAM_ERROR__COLLATERAL_MISMATCH =
|
|
208
|
+
export const OPTION_PROGRAM_ERROR__COLLATERAL_MISMATCH = 0x17cf; // 6095
|
|
205
209
|
|
|
206
210
|
export type OptionProgramError =
|
|
207
211
|
| typeof OPTION_PROGRAM_ERROR__ACCOUNT_FROZEN
|
|
@@ -253,6 +257,8 @@ export type OptionProgramError =
|
|
|
253
257
|
| typeof OPTION_PROGRAM_ERROR__INVALID_RISK_FREE_RATE
|
|
254
258
|
| typeof OPTION_PROGRAM_ERROR__INVALID_SEED
|
|
255
259
|
| typeof OPTION_PROGRAM_ERROR__INVALID_STRIKE_PRICE
|
|
260
|
+
| typeof OPTION_PROGRAM_ERROR__INVALID_SWITCHBOARD_QUOTE_ACCOUNT
|
|
261
|
+
| typeof OPTION_PROGRAM_ERROR__INVALID_SWITCHBOARD_UPDATE_PROOF
|
|
256
262
|
| typeof OPTION_PROGRAM_ERROR__INVALID_TENOR
|
|
257
263
|
| typeof OPTION_PROGRAM_ERROR__INVALID_TIME_TO_EXPIRATION
|
|
258
264
|
| typeof OPTION_PROGRAM_ERROR__INVALID_UNDERLYING_PRICE
|
|
@@ -351,6 +357,8 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
351
357
|
[OPTION_PROGRAM_ERROR__INVALID_RISK_FREE_RATE]: `Risk-free rate must be non-negative`,
|
|
352
358
|
[OPTION_PROGRAM_ERROR__INVALID_SEED]: `Invalid seed - must be exactly 32 bytes`,
|
|
353
359
|
[OPTION_PROGRAM_ERROR__INVALID_STRIKE_PRICE]: `Strike price must be greater than zero`,
|
|
360
|
+
[OPTION_PROGRAM_ERROR__INVALID_SWITCHBOARD_QUOTE_ACCOUNT]: `Invalid Switchboard quote account`,
|
|
361
|
+
[OPTION_PROGRAM_ERROR__INVALID_SWITCHBOARD_UPDATE_PROOF]: `Switchboard quote update proof missing or invalid`,
|
|
354
362
|
[OPTION_PROGRAM_ERROR__INVALID_TENOR]: `Invalid loan tenor`,
|
|
355
363
|
[OPTION_PROGRAM_ERROR__INVALID_TIME_TO_EXPIRATION]: `Time to expiration must be positive`,
|
|
356
364
|
[OPTION_PROGRAM_ERROR__INVALID_UNDERLYING_PRICE]: `Underlying price is invalid`,
|
|
@@ -59,7 +59,7 @@ export type AutoExerciseAllExpiredInstruction<
|
|
|
59
59
|
TAccountCollateralVault extends string | AccountMeta<string> = string,
|
|
60
60
|
TAccountOmlpVault extends string | AccountMeta<string> = string,
|
|
61
61
|
TAccountOptionMint extends string | AccountMeta<string> = string,
|
|
62
|
-
|
|
62
|
+
TAccountSwitchboardFeed extends string | AccountMeta<string> = string,
|
|
63
63
|
TAccountMarketData extends string | AccountMeta<string> = string,
|
|
64
64
|
TAccountKeeper extends string | AccountMeta<string> = string,
|
|
65
65
|
TAccountTokenProgram extends string | AccountMeta<string> =
|
|
@@ -89,9 +89,9 @@ export type AutoExerciseAllExpiredInstruction<
|
|
|
89
89
|
TAccountOptionMint extends string
|
|
90
90
|
? WritableAccount<TAccountOptionMint>
|
|
91
91
|
: TAccountOptionMint,
|
|
92
|
-
|
|
93
|
-
? ReadonlyAccount<
|
|
94
|
-
:
|
|
92
|
+
TAccountSwitchboardFeed extends string
|
|
93
|
+
? ReadonlyAccount<TAccountSwitchboardFeed>
|
|
94
|
+
: TAccountSwitchboardFeed,
|
|
95
95
|
TAccountMarketData extends string
|
|
96
96
|
? ReadonlyAccount<TAccountMarketData>
|
|
97
97
|
: TAccountMarketData,
|
|
@@ -155,7 +155,7 @@ export type AutoExerciseAllExpiredAsyncInput<
|
|
|
155
155
|
TAccountCollateralVault extends string = string,
|
|
156
156
|
TAccountOmlpVault extends string = string,
|
|
157
157
|
TAccountOptionMint extends string = string,
|
|
158
|
-
|
|
158
|
+
TAccountSwitchboardFeed extends string = string,
|
|
159
159
|
TAccountMarketData extends string = string,
|
|
160
160
|
TAccountKeeper extends string = string,
|
|
161
161
|
TAccountTokenProgram extends string = string,
|
|
@@ -170,9 +170,8 @@ export type AutoExerciseAllExpiredAsyncInput<
|
|
|
170
170
|
omlpVault: Address<TAccountOmlpVault>;
|
|
171
171
|
/** Option mint (for burning) */
|
|
172
172
|
optionMint: Address<TAccountOptionMint>;
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
/** Market data for this underlying asset (contains pyth_feed_id) */
|
|
173
|
+
switchboardFeed: Address<TAccountSwitchboardFeed>;
|
|
174
|
+
/** Market data for this underlying asset (contains switchboard_feed_id) */
|
|
176
175
|
marketData: Address<TAccountMarketData>;
|
|
177
176
|
/** Keeper who pays for gas - anyone can call this after expiration */
|
|
178
177
|
keeper: TransactionSigner<TAccountKeeper>;
|
|
@@ -188,7 +187,7 @@ export async function getAutoExerciseAllExpiredInstructionAsync<
|
|
|
188
187
|
TAccountCollateralVault extends string,
|
|
189
188
|
TAccountOmlpVault extends string,
|
|
190
189
|
TAccountOptionMint extends string,
|
|
191
|
-
|
|
190
|
+
TAccountSwitchboardFeed extends string,
|
|
192
191
|
TAccountMarketData extends string,
|
|
193
192
|
TAccountKeeper extends string,
|
|
194
193
|
TAccountTokenProgram extends string,
|
|
@@ -202,7 +201,7 @@ export async function getAutoExerciseAllExpiredInstructionAsync<
|
|
|
202
201
|
TAccountCollateralVault,
|
|
203
202
|
TAccountOmlpVault,
|
|
204
203
|
TAccountOptionMint,
|
|
205
|
-
|
|
204
|
+
TAccountSwitchboardFeed,
|
|
206
205
|
TAccountMarketData,
|
|
207
206
|
TAccountKeeper,
|
|
208
207
|
TAccountTokenProgram,
|
|
@@ -218,7 +217,7 @@ export async function getAutoExerciseAllExpiredInstructionAsync<
|
|
|
218
217
|
TAccountCollateralVault,
|
|
219
218
|
TAccountOmlpVault,
|
|
220
219
|
TAccountOptionMint,
|
|
221
|
-
|
|
220
|
+
TAccountSwitchboardFeed,
|
|
222
221
|
TAccountMarketData,
|
|
223
222
|
TAccountKeeper,
|
|
224
223
|
TAccountTokenProgram,
|
|
@@ -237,7 +236,10 @@ export async function getAutoExerciseAllExpiredInstructionAsync<
|
|
|
237
236
|
collateralVault: { value: input.collateralVault ?? null, isWritable: true },
|
|
238
237
|
omlpVault: { value: input.omlpVault ?? null, isWritable: true },
|
|
239
238
|
optionMint: { value: input.optionMint ?? null, isWritable: true },
|
|
240
|
-
|
|
239
|
+
switchboardFeed: {
|
|
240
|
+
value: input.switchboardFeed ?? null,
|
|
241
|
+
isWritable: false,
|
|
242
|
+
},
|
|
241
243
|
marketData: { value: input.marketData ?? null, isWritable: false },
|
|
242
244
|
keeper: { value: input.keeper ?? null, isWritable: true },
|
|
243
245
|
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
@@ -284,7 +286,7 @@ export async function getAutoExerciseAllExpiredInstructionAsync<
|
|
|
284
286
|
getAccountMeta(accounts.collateralVault),
|
|
285
287
|
getAccountMeta(accounts.omlpVault),
|
|
286
288
|
getAccountMeta(accounts.optionMint),
|
|
287
|
-
getAccountMeta(accounts.
|
|
289
|
+
getAccountMeta(accounts.switchboardFeed),
|
|
288
290
|
getAccountMeta(accounts.marketData),
|
|
289
291
|
getAccountMeta(accounts.keeper),
|
|
290
292
|
getAccountMeta(accounts.tokenProgram),
|
|
@@ -302,7 +304,7 @@ export async function getAutoExerciseAllExpiredInstructionAsync<
|
|
|
302
304
|
TAccountCollateralVault,
|
|
303
305
|
TAccountOmlpVault,
|
|
304
306
|
TAccountOptionMint,
|
|
305
|
-
|
|
307
|
+
TAccountSwitchboardFeed,
|
|
306
308
|
TAccountMarketData,
|
|
307
309
|
TAccountKeeper,
|
|
308
310
|
TAccountTokenProgram,
|
|
@@ -317,7 +319,7 @@ export type AutoExerciseAllExpiredInput<
|
|
|
317
319
|
TAccountCollateralVault extends string = string,
|
|
318
320
|
TAccountOmlpVault extends string = string,
|
|
319
321
|
TAccountOptionMint extends string = string,
|
|
320
|
-
|
|
322
|
+
TAccountSwitchboardFeed extends string = string,
|
|
321
323
|
TAccountMarketData extends string = string,
|
|
322
324
|
TAccountKeeper extends string = string,
|
|
323
325
|
TAccountTokenProgram extends string = string,
|
|
@@ -332,9 +334,8 @@ export type AutoExerciseAllExpiredInput<
|
|
|
332
334
|
omlpVault: Address<TAccountOmlpVault>;
|
|
333
335
|
/** Option mint (for burning) */
|
|
334
336
|
optionMint: Address<TAccountOptionMint>;
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
/** Market data for this underlying asset (contains pyth_feed_id) */
|
|
337
|
+
switchboardFeed: Address<TAccountSwitchboardFeed>;
|
|
338
|
+
/** Market data for this underlying asset (contains switchboard_feed_id) */
|
|
338
339
|
marketData: Address<TAccountMarketData>;
|
|
339
340
|
/** Keeper who pays for gas - anyone can call this after expiration */
|
|
340
341
|
keeper: TransactionSigner<TAccountKeeper>;
|
|
@@ -350,7 +351,7 @@ export function getAutoExerciseAllExpiredInstruction<
|
|
|
350
351
|
TAccountCollateralVault extends string,
|
|
351
352
|
TAccountOmlpVault extends string,
|
|
352
353
|
TAccountOptionMint extends string,
|
|
353
|
-
|
|
354
|
+
TAccountSwitchboardFeed extends string,
|
|
354
355
|
TAccountMarketData extends string,
|
|
355
356
|
TAccountKeeper extends string,
|
|
356
357
|
TAccountTokenProgram extends string,
|
|
@@ -364,7 +365,7 @@ export function getAutoExerciseAllExpiredInstruction<
|
|
|
364
365
|
TAccountCollateralVault,
|
|
365
366
|
TAccountOmlpVault,
|
|
366
367
|
TAccountOptionMint,
|
|
367
|
-
|
|
368
|
+
TAccountSwitchboardFeed,
|
|
368
369
|
TAccountMarketData,
|
|
369
370
|
TAccountKeeper,
|
|
370
371
|
TAccountTokenProgram,
|
|
@@ -379,7 +380,7 @@ export function getAutoExerciseAllExpiredInstruction<
|
|
|
379
380
|
TAccountCollateralVault,
|
|
380
381
|
TAccountOmlpVault,
|
|
381
382
|
TAccountOptionMint,
|
|
382
|
-
|
|
383
|
+
TAccountSwitchboardFeed,
|
|
383
384
|
TAccountMarketData,
|
|
384
385
|
TAccountKeeper,
|
|
385
386
|
TAccountTokenProgram,
|
|
@@ -397,7 +398,10 @@ export function getAutoExerciseAllExpiredInstruction<
|
|
|
397
398
|
collateralVault: { value: input.collateralVault ?? null, isWritable: true },
|
|
398
399
|
omlpVault: { value: input.omlpVault ?? null, isWritable: true },
|
|
399
400
|
optionMint: { value: input.optionMint ?? null, isWritable: true },
|
|
400
|
-
|
|
401
|
+
switchboardFeed: {
|
|
402
|
+
value: input.switchboardFeed ?? null,
|
|
403
|
+
isWritable: false,
|
|
404
|
+
},
|
|
401
405
|
marketData: { value: input.marketData ?? null, isWritable: false },
|
|
402
406
|
keeper: { value: input.keeper ?? null, isWritable: true },
|
|
403
407
|
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
@@ -430,7 +434,7 @@ export function getAutoExerciseAllExpiredInstruction<
|
|
|
430
434
|
getAccountMeta(accounts.collateralVault),
|
|
431
435
|
getAccountMeta(accounts.omlpVault),
|
|
432
436
|
getAccountMeta(accounts.optionMint),
|
|
433
|
-
getAccountMeta(accounts.
|
|
437
|
+
getAccountMeta(accounts.switchboardFeed),
|
|
434
438
|
getAccountMeta(accounts.marketData),
|
|
435
439
|
getAccountMeta(accounts.keeper),
|
|
436
440
|
getAccountMeta(accounts.tokenProgram),
|
|
@@ -448,7 +452,7 @@ export function getAutoExerciseAllExpiredInstruction<
|
|
|
448
452
|
TAccountCollateralVault,
|
|
449
453
|
TAccountOmlpVault,
|
|
450
454
|
TAccountOptionMint,
|
|
451
|
-
|
|
455
|
+
TAccountSwitchboardFeed,
|
|
452
456
|
TAccountMarketData,
|
|
453
457
|
TAccountKeeper,
|
|
454
458
|
TAccountTokenProgram,
|
|
@@ -471,9 +475,8 @@ export type ParsedAutoExerciseAllExpiredInstruction<
|
|
|
471
475
|
omlpVault: TAccountMetas[4];
|
|
472
476
|
/** Option mint (for burning) */
|
|
473
477
|
optionMint: TAccountMetas[5];
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
/** Market data for this underlying asset (contains pyth_feed_id) */
|
|
478
|
+
switchboardFeed: TAccountMetas[6];
|
|
479
|
+
/** Market data for this underlying asset (contains switchboard_feed_id) */
|
|
477
480
|
marketData: TAccountMetas[7];
|
|
478
481
|
/** Keeper who pays for gas - anyone can call this after expiration */
|
|
479
482
|
keeper: TAccountMetas[8];
|
|
@@ -510,7 +513,7 @@ export function parseAutoExerciseAllExpiredInstruction<
|
|
|
510
513
|
collateralVault: getNextAccount(),
|
|
511
514
|
omlpVault: getNextAccount(),
|
|
512
515
|
optionMint: getNextAccount(),
|
|
513
|
-
|
|
516
|
+
switchboardFeed: getNextAccount(),
|
|
514
517
|
marketData: getNextAccount(),
|
|
515
518
|
keeper: getNextAccount(),
|
|
516
519
|
tokenProgram: getNextAccount(),
|